/* ============================================================================
   reachtim.com

   Warm off-white page, dark warm ink for type, and very little else. The work —
   articles, photographs, drawings — supplies the colour; the page stays out of
   its way. Code samples are the one inversion, sitting as dark blocks on the
   light page.

   Accents are drawn from the art: a deep teal for the technical side, a deep
   ochre for the art side. Both are darkened well past their source values so
   that small text clears WCAG AA on this background.
   ========================================================================== */

@font-face {
  font-family: "Fraunces";
  src: url("/static/fonts/fraunces-display.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Spectral";
  src: url("/static/fonts/spectral-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Spectral";
  src: url("/static/fonts/spectral-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Spectral";
  src: url("/static/fonts/spectral-semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/static/fonts/plexmono-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --page: #f7f4ec;
  --surface: #fffdf7;
  --ink: #21201c;
  --muted: #55504a;
  --line: rgba(33, 30, 26, 0.13);
  --line-strong: rgba(33, 30, 26, 0.22);

  /* Dark block used for code samples */
  --code-bg: #23211d;
  --code-fg: #ece6d9;

  --teal: #1c565b;
  --ochre: #7d5a0f;
  --brick: #9c3c26;
  --citron: #57621f;

  --accent: var(--teal);

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Spectral", Georgia, "Times New Roman", serif;
  --font-mono: "Plex Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --measure: 36rem;
  --measure-wide: 58rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);

  --radius: 3px;
  --lift: 0 1px 2px rgba(33, 30, 26, 0.06), 0 10px 24px -14px rgba(33, 30, 26, 0.3);

  color-scheme: light;
}

.lane-tech {
  --accent: var(--teal);
}
.lane-art {
  --accent: var(--ochre);
}

/* --------------------------------------------------------------- foundation */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img,
svg,
picture {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.012em;
  text-wrap: balance;
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
  background: var(--ink);
  color: var(--page);
  padding: 0.6rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}
.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}
.eyebrow a {
  color: var(--accent);
  text-decoration: none;
}
.eyebrow a:hover {
  text-decoration: underline;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--accent);
}

/* ----------------------------------------------------------------- masthead */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  flex-wrap: wrap;
  padding: 1.75rem var(--gutter) 1.25rem;
  max-width: var(--measure-wide);
  width: 100%;
  margin: 0 auto;
}

.masthead__mark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  text-decoration: none;
}

.masthead__name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.masthead__rule {
  color: var(--line-strong);
  display: inline-block;
  width: 26px;
}
.masthead__mark:hover .masthead__rule {
  color: var(--accent);
}

.masthead__nav {
  display: flex;
  gap: 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
}

.masthead__nav a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.masthead__nav a:hover {
  color: var(--ink);
}
.masthead__nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: currentColor;
}
.lane-link--teal:hover {
  color: var(--teal);
}
.lane-link--ochre:hover {
  color: var(--ochre);
}

main {
  flex: 1;
}

/* --------------------------------------------------------------------- hero */

.hero {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) var(--gutter) clamp(2rem, 5vw, 3.25rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

.hero__text {
  max-width: 34rem;
}

.hero__name {
  font-size: clamp(1.9rem, 5vw, 2.9rem);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.05;
  margin: 0 0 1.3rem;
}

.hero__portrait {
  margin: 0;
  width: clamp(8.5rem, 20vw, 14rem);
}

.hero__portrait img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  border: 1px solid var(--line);
}

@media (max-width: 48rem) {
  .hero {
    grid-template-columns: 1fr;
  }
  /* Stacked, the photo belongs above the introduction rather than trailing it. */
  .hero__portrait {
    order: -1;
    width: 8.5rem;
  }
}

.hero__lede p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 1.09rem;
}
.hero__lede p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------- lane panels */

.lanes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr));
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  max-width: var(--measure-wide);
  margin: 0 auto;
}

.lane {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  padding: clamp(1.5rem, 4vw, 2.4rem) var(--gutter);
  background: var(--page);
  text-decoration: none;
  transition: background 180ms ease;
}
.lane:hover {
  background: var(--surface);
}
.lane--teal {
  --accent: var(--teal);
}
.lane--ochre {
  --accent: var(--ochre);
}

.lane__label {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.018em;
}

.lane__tagline {
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.lane__index {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.lane__item {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lane__more {
  color: var(--accent);
  letter-spacing: 0.06em;
}

.lane__enter {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.lane:hover .lane__enter span {
  display: inline-block;
  transform: translateX(3px);
  transition: transform 180ms ease;
}

/* ------------------------------------------------------------- page headings */

.pagehead {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.75rem) var(--gutter) clamp(1.5rem, 3vw, 2rem);
}

.pagehead h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.7rem);
  margin: 0 0 1rem;
}

.pagehead__lede {
  margin: 0;
  color: var(--muted);
  max-width: var(--measure);
}
/* On gallery pages the lede is itself a <p>; on lane pages it is a wrapper
   holding several, which need to stay apart. */
.pagehead__lede p {
  margin: 0 0 0.9rem;
}
.pagehead__lede p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------- article list */

.index {
  list-style: none;
  counter-reset: row;
  margin: 0 auto;
  padding: 0 0 clamp(2rem, 6vw, 4rem);
  max-width: var(--measure-wide);
  border-top: 1px solid var(--line);
}

.index__row {
  counter-increment: row;
  border-bottom: 1px solid var(--line);
}

.index__link {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.15rem 1rem;
  padding: 1.5rem var(--gutter);
  text-decoration: none;
  transition: background 150ms ease;
}
.index__link:hover {
  background: var(--surface);
}
.index__link::before {
  content: counter(row, decimal-leading-zero);
  grid-row: 1 / span 3;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  padding-top: 0.45rem;
}

.index__title {
  font-size: 1.28rem;
  font-weight: 600;
}
.index__link:hover .index__title {
  color: var(--accent);
}

.index__summary {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.6;
  max-width: var(--measure);
}

.index__meta {
  margin: 0.6rem 0 0;
  display: flex;
  gap: 1rem;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

/* --------------------------------------------------------------- collections */

.collections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  max-width: var(--measure-wide);
  margin: 0 auto clamp(2rem, 6vw, 4rem);
}

.collection {
  background: var(--page);
  padding: clamp(1.4rem, 4vw, 2.1rem) var(--gutter);
  text-decoration: none;
  display: grid;
  gap: 0.55rem;
  align-content: start;
  transition: background 180ms ease;
}
.collection:hover {
  background: var(--surface);
}

.collection__title {
  font-size: 1.32rem;
}
.collection:hover .collection__title {
  color: var(--accent);
}

.collection__summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.collection__meta {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--accent);
}

/* ------------------------------------------------------------------- article */

.article,
.page-plain .prose {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(2rem, 5vw, 3.5rem);
}

.article__head {
  padding: clamp(1.25rem, 4vw, 2.5rem) 0 clamp(1rem, 2.5vw, 1.5rem);
}

.article__head h1 {
  font-size: clamp(1.8rem, 4.4vw, 2.6rem);
  margin: 0 0 1rem;
}

.article__summary {
  margin: 0;
  color: var(--muted);
  font-size: 1.0625rem;
  max-width: var(--measure);
}

.article__meta {
  margin: 1rem 0 0;
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.contents {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1.1rem 0;
  margin-bottom: clamp(1.5rem, 4vw, 2.25rem);
}

.contents__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.7rem;
}

.contents ol {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 2.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.9;
}

.contents a {
  color: var(--muted);
  text-decoration: none;
}
.contents a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.contents__item--l2 {
  padding-left: 1rem;
}
.contents__item--l3 {
  padding-left: 2rem;
}
.contents__item--l4 {
  padding-left: 3rem;
}

/* --------------------------------------------------------------------- prose */

.prose > * {
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
}

.prose h2,
.prose h3,
.prose h4 {
  margin: 2.3rem auto 0.75rem;
  scroll-margin-top: 1.5rem;
}
.prose h2 {
  font-size: 1.55rem;
}
.prose h3 {
  font-size: 1.22rem;
}
.prose h4 {
  font-size: 1.0625rem;
}
.prose > :first-child {
  margin-top: 0;
}

.prose p,
.prose ul,
.prose ol,
.prose dl {
  margin: 0 auto 1.15rem;
}

.prose li {
  margin-bottom: 0.4rem;
}

.prose a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.prose a:hover {
  color: var(--brick);
}

.prose strong {
  font-weight: 600;
}

.prose blockquote {
  margin: 0 auto 1.4rem;
  padding-left: 1.2rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.2rem auto;
}

.prose img {
  display: block;
  border: 1px solid var(--line);
  border-radius: 2px;
  margin: 0 auto 1.4rem;
  background: var(--surface);
}

.prose table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 auto 1.4rem;
  font-size: 0.9375rem;
}
.prose th,
.prose td {
  border: 1px solid var(--line-strong);
  padding: 0.5rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
.prose th {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.prose dt {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  margin-top: 1rem;
}
.prose dd {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

/* The old blog marked asides with {: .callout}. */
.prose .callout {
  background: rgba(28, 86, 91, 0.07);
  border-left: 2px solid var(--accent);
  border-radius: 0 2px 2px 0;
  padding: 1rem 1.2rem;
  margin: 0 auto 1.4rem;
  color: var(--muted);
}
.prose .callout > :last-child {
  margin-bottom: 0;
}
.prose .note {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brick);
  font-weight: 400;
}

.prose--narrow > * {
  max-width: var(--measure);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: rgba(33, 30, 26, 0.06);
  border: 1px solid var(--line);
  padding: 0.05em 0.32em;
  border-radius: 2px;
  overflow-wrap: anywhere;
}

/* Code samples are the one dark surface on the page. */
.prose pre {
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin: 0 auto 1.4rem;
  overflow-x: auto;
  max-width: var(--measure-wide);
  font-size: 0.85rem;
  line-height: 1.6;
  tab-size: 4;
}
.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.prose .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.25rem 0;
}

/* Pygments, tuned against the dark code block. */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs, .highlight .ch { color: #918a80; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt { color: #d8a32b; }
.highlight .kc, .highlight .bp, .highlight .nb { color: #e8b845; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc,
.highlight .sd, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx,
.highlight .sr, .highlight .ss { color: #a8bb52; }
.highlight .nf, .highlight .fm { color: #4fb3b8; }
.highlight .nc, .highlight .nn, .highlight .ne { color: #d8c98f; }
.highlight .nd, .highlight .nt { color: #d4694a; }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo,
.highlight .il { color: #c98a6b; }
.highlight .o, .highlight .ow, .highlight .p { color: #a9a196; }
.highlight .nv, .highlight .vi, .highlight .vg, .highlight .vc { color: #ece6d9; }
.highlight .err, .highlight .gd { color: #d4694a; }
.highlight .gi { color: #a8bb52; }

/* ----------------------------------------------------------------- galleries */

.plates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(2rem, 5vw, 3.5rem);
}

.plate {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--lift);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.plate__frame {
  --mat: clamp(0.85rem, 2.5vw, 1.4rem);
  position: relative;
  display: block;
  aspect-ratio: var(--mount, 1 / 1);
  background: var(--surface);
}
/* Taken out of flow deliberately. In flow, a percentage height can't resolve
   against a height that aspect-ratio derives from the width — it falls back to
   auto, the image's natural height then grows the box through min-height: auto,
   and the openings stop matching. Absolute positioning breaks that cycle, so
   every mat is identical and object-fit letterboxes the piece inside it. */
.plate__frame img {
  position: absolute;
  top: var(--mat);
  left: var(--mat);
  width: calc(100% - 2 * var(--mat));
  height: calc(100% - 2 * var(--mat));
  object-fit: contain;
}
.plate__frame:focus-visible {
  outline-offset: -3px;
}

.plate__caption {
  padding: 0.9rem clamp(0.9rem, 2.5vw, 1.35rem) clamp(1rem, 2.5vw, 1.35rem);
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.plate__title {
  font-size: 1.0625rem;
  color: var(--ink);
  margin: 0 0 0.4rem;
}

.plate__caption p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ------------------------------------------------------------------- footers */

.article__foot {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.25rem) var(--gutter);
}

.backlink {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-decoration: none;
}
.backlink:hover {
  color: var(--accent);
}

.footer {
  border-top: 1px solid var(--line);
  margin-top: clamp(2rem, 6vw, 4rem);
}

.footer__inner {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 1.6rem var(--gutter) 2.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}

.footer__who {
  margin: 0;
  color: var(--muted);
}

.footer__links {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.footer__links a {
  color: var(--muted);
  text-decoration: none;
}
.footer__links a:hover {
  color: var(--accent);
}

/* --------------------------------------------------------------- adjustments */

@media (max-width: 40rem) {
  .contents ol {
    columns: 1;
  }
  .index__link {
    grid-template-columns: 1.75rem 1fr;
    gap: 0.15rem 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  body {
    background: #fff;
  }
  .masthead__nav,
  .footer__links,
  .backlink,
  .skip {
    display: none;
  }
  .prose pre {
    background: #f4f4f4;
    color: #000;
    border: 1px solid #ccc;
  }
  .prose pre .highlight span {
    color: #000 !important;
  }
}
