/* Colours, face and sizes are named in docs/design.md. */

:root {
  color-scheme: light dark;
  --paper: #ffffff;
  --ink: #252423;
  --heading: #252423;
  --quiet: #6a6763;
  --quiet-hover: #45423f;
  --panel: #f1f1ef;
  --line: rgb(37 36 35 / 11%);
  --underline: rgb(106 103 99 / 35%);
  --pad: max(2.5rem, clamp(1.25rem, 3.4vw, 3.25rem));
  --radius: 10px;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Iowan Old Style", Georgia, "Noto Serif", "DejaVu Serif", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c1b1a;
    --ink: #e4e2de;
    --heading: #efede9;
    --quiet: #a6a29c;
    --quiet-hover: #ccc8c1;
    --panel: #262523;
    --line: rgb(228 226 222 / 17%);
    --underline: rgb(166 162 156 / 35%);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
}

::selection { background: rgb(128 128 128 / 22%); }

h1, h2 {
  color: var(--heading);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0;
}

h1 {
  font-size: clamp(2.2rem, 3.5vw, 2.65rem);
  line-height: 1.15;
}

h2 {
  font-size: 1.45rem;
  line-height: 1.4;
}

p { margin: 0; text-wrap: pretty; }

a {
  color: var(--quiet);
  text-decoration: underline;
  text-decoration-color: var(--underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-skip-ink: auto;
  transition: color 0.3s ease-in-out, text-decoration-color 0.3s ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
  a { transition: none; }
}

a:hover {
  color: var(--quiet-hover);
  text-decoration-color: var(--quiet-hover);
}

a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- page: one column (phone and tablet) ---------- */

.page { padding: 2.5rem 1.25rem 1.25rem; }

main { max-width: 600px; }

/* The headshot: 64px square, 2x files, above the name, at every width. */
.me {
  display: block;
  width: 64px;
  height: 64px;
  margin-bottom: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.lede { margin-top: 1.5rem; }

.role { margin-top: 1rem; }

.links {
  margin: 1.75rem 0 0;
  padding-left: 1.1rem;
  list-style: square;
}

.links li { padding-bottom: 0.2rem; }

.links li::marker { color: color-mix(in srgb, var(--quiet) 70%, transparent); }

/* The big panel exists only on wide screens (see below). */
.panel { display: none; }

/* ---------- projects: ruled rows ---------- */

.projects { margin-top: 3.5rem; }

.projects h2 { margin-bottom: 1.2rem; }

.projects ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.projects li {
  padding: 1rem 0 1.05rem;
  border-bottom: 1px solid var(--line);
}

.head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  column-gap: 1.25rem;
  color: var(--heading);
}

.years,
.meta {
  font-size: 14px;
  color: var(--quiet);
}

.years { font-variant-numeric: tabular-nums; }

.head + p { margin-top: 0.3rem; }

.meta {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.25rem;
  margin-top: 0.45rem;
}

/* 404: name and one link, nothing else */
.page-404 .lede { margin-top: 1.25rem; }

@media (max-width: 639px) {
  .head { flex-direction: column; row-gap: 0.1rem; }
}

@media (min-width: 640px) {
  .page { padding: var(--pad); }
}

/* ---------- two zones: text column left, sticky panel right ---------- */

@media (min-width: 1100px) {
  .page {
    max-width: 1440px;
    margin-inline: auto;
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(380px, 1fr);
    column-gap: clamp(2rem, 3.6vw, 3.75rem);
    align-items: start;
  }

  main { grid-column: 1; }

  .links {
    columns: 2;
    column-gap: 2.5rem;
  }

  .links li { break-inside: avoid; }

  .panel {
    display: block;
    position: sticky;
    top: var(--pad);
    justify-self: end;
    width: 100%;
    max-width: 480px;
    grid-column: 2;
    grid-row: 1;
    height: calc(100vh - 2 * var(--pad));
    height: calc(100svh - 2 * var(--pad));
    max-height: 820px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    /* Ohio sits centred at 47% of the image height; 50% 47% keeps it centred
       when cover crops the top and bottom (short windows) or the sides (1100px). */
    background: var(--panel) url("/panel.jpg") 50% 47% / cover no-repeat;
    background-image: image-set(url("/panel.webp") type("image/webp"), url("/panel.jpg") type("image/jpeg"));
  }
}

/* Dark mode has its own render of the panel. Both images are declared only
   inside min-width: 1100px, so phones and tablets never download either. */
@media (min-width: 1100px) and (prefers-color-scheme: dark) {
  .panel {
    background-image: url("/panel-dark.jpg");
    background-image: image-set(url("/panel-dark.webp") type("image/webp"), url("/panel-dark.jpg") type("image/jpeg"));
  }
}
