/* Nick Gomez — pass 2 design. A calm, precisely typeset document:
   warm ink on warm paper, structured by space and hairlines, not boxes.
   Three type registers — serif to read, sans for chrome, mono as the
   machine voice. One accent, with a job. Almost nothing moves. */

/* ---- Self-hosted fonts (Latin subset, woff2). No CDN at runtime. ---- */
@font-face { font-family: "Newsreader"; src: url("/fonts/newsreader-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("/fonts/newsreader-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("/fonts/newsreader-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/plex-mono-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --font-serif: "Newsreader", Charter, "Iowan Old Style", Georgia, Cambria, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --measure: 34rem;   /* ~66ch of prose */
  --wide: 52rem;      /* page container */

  /* warm paper + ink + one blueprint-slate accent (light) */
  --paper: #fbfaf6;
  --paper-2: #f2f0ea;
  --ink: #1b1a17;
  --muted: #6e6a62;
  --rule: #e3dfd6;
  --accent: #274b6b;
  --accent-fg: #fbfaf6;

  --rhythm: 1.75rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161513;
    --paper-2: #1f1e19;
    --ink: #e9e5dc;
    --muted: #9a948a;
    --rule: #2c2a25;
    --accent: #93b5e1;
    --accent-fg: #161513;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.1875rem);
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection { background: color-mix(in srgb, var(--accent) 16%, transparent); }

/* ---- Skip link ---- */
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus {
  left: 1rem; top: 1rem; z-index: 10;
  background: var(--paper); color: var(--ink);
  padding: 0.5rem 0.75rem; border: 1px solid var(--rule);
}

.site-header, main, .site-footer {
  max-width: var(--wide);
  margin-inline: auto;
  padding-inline: max(1.25rem, 5vw);
}

/* ---- Masthead ---- */
.site-header {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.5rem 1.1rem;
  border-bottom: 1px solid var(--rule);
}
.site-name { font-family: var(--font-serif); font-weight: 600; font-size: 1.2rem; letter-spacing: -0.01em; text-decoration: none; color: var(--ink); }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 0.9rem 1.25rem; margin: 0; padding: 0; list-style: none; }
.site-nav a {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase;
  text-decoration: none; color: var(--muted);
  display: inline-block; padding-block: 0.4rem; transition: color 120ms ease;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }

/* Narrow screens: stack nav under the name so all four labels fit (no clipping). */
@media (max-width: 32rem) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .site-nav { width: 100%; }
  .site-nav ul { gap: 0.6rem 1.1rem; }
  .site-nav a { font-size: 0.72rem; letter-spacing: 0.02em; }
}

main { padding-block: 3rem 3.5rem; }

/* ---- Links: ink + underline, never blue. Accent has other jobs. ---- */
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--muted); text-decoration-thickness: 1px; text-underline-offset: 0.15em; transition: text-decoration-color 120ms ease, text-decoration-thickness 120ms ease; }
a:hover { text-decoration-color: var(--accent); text-decoration-thickness: 2px; }

/* ---- Headings ---- */
h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; line-height: 1.15; text-wrap: balance; }
h1 { font-size: 1.95rem; letter-spacing: -0.01em; margin-block: 0 0.75rem; }
h2 { font-size: 1.55rem; margin-block: var(--rhythm) 0.5rem; }
h3 { font-size: 1.2rem; margin-block: 1.4rem 0.35rem; }
p { text-wrap: pretty; }

.lead { font-size: 1.3rem; line-height: 1.4; color: var(--muted); max-width: var(--measure); font-style: italic; }

/* ---- Prose column ---- */
.prose { max-width: var(--measure); }
.prose > * + * { margin-block-start: 1.1em; }
.prose h2, .prose h3 { max-width: var(--measure); }
.prose blockquote {
  margin-inline: 0; padding-left: 1.1rem;
  border-left: 2px solid var(--accent);
  color: var(--muted); font-style: italic;
}
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose li + li { margin-top: 0.4rem; }
.prose pre { overflow-x: auto; padding: 1rem; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 3px; }
.prose code, kbd, samp { font-family: var(--font-mono); font-size: 0.88em; }

/* ---- Machine voice (mono) ---- */
.eyebrow {
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin-block: 0 0.6rem;
}
.eyebrow + h2 { margin-top: 0; }   /* keep the mono label bound to its heading */

/* ---- Home ---- */
.section { padding-block: var(--rhythm); }
.section + .section { border-top: 1px solid var(--rule); }

.recognition { padding-top: clamp(1.5rem, 6vh, 3.5rem); }
.recognition h1 {
  font-size: clamp(2.3rem, 1.7rem + 2.6vw, 3.4rem);
  line-height: 1.08; letter-spacing: -0.015em;
  max-width: 18ch; margin-bottom: 0;
}
.recognition .prose { margin-top: 1.4rem; }

/* The signature: "untangle" — chaos resolves to one clean line, once.
   Resolved (clean) line is the DEFAULT, so reduced-motion / no-JS get the
   full meaning with zero motion. */
.untangle { display: block; width: min(34rem, 100%); height: auto; margin: 1rem 0 0; overflow: visible; }
.untangle .tangle { fill: none; stroke: var(--muted); stroke-width: 2; opacity: 0; }
.untangle .clean  { fill: none; stroke: var(--accent); stroke-width: 2.25; stroke-linecap: round; }
@media (prefers-reduced-motion: no-preference) {
  .untangle .tangle { opacity: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: tangle-out 1s ease-in 0.2s forwards; }
  .untangle .clean  { stroke-dasharray: 1; stroke-dashoffset: 1; animation: clean-in 1s ease-out 0.55s forwards; }
}
@keyframes tangle-out { to { stroke-dashoffset: 1; opacity: 0; } }
@keyframes clean-in { from { opacity: 0.3; } to { stroke-dashoffset: 0; opacity: 1; } }

.approach { max-width: var(--measure); padding-left: 1.1rem; margin-block: 0.5rem; }
.approach li { margin-block: 0.4rem; }

/* ---- CTA: de-boxed, hairline + space ---- */
.cta { margin-block: 2.5rem 0; padding-top: var(--rhythm); border-top: 1px solid var(--rule); }
.cta h2 { margin-top: 0; }
.cta p { max-width: var(--measure); }
.cta-button {
  font-family: var(--font-sans); font-weight: 600; font-size: 0.95rem;
  display: inline-block; margin-top: 0.75rem; padding: 0.6rem 1.1rem;
  background: var(--accent); color: var(--accent-fg);
  text-decoration: none; border-radius: 2px;
  transition: transform 120ms ease, filter 120ms ease;
}
.cta-button:hover { filter: brightness(1.08); text-decoration: none; }
.cta-button:active { transform: translateY(1px); }
.cta-email { font-family: var(--font-sans); font-size: 0.9rem; color: var(--muted); margin-top: 0.6rem; }
.cta-email a { color: var(--muted); }

/* ---- Lists of items (work / ideas): hairline rows, no cards ---- */
.item-list { list-style: none; margin: 0; padding: 0; }
.item { position: relative; padding-block: 1.2rem; border-top: 1px solid var(--rule); }
.item:first-child { border-top: 0; }
/* accent bar in the left gutter, fades in on hover — no layout shift */
.item::before { content: ""; position: absolute; left: -0.9rem; top: 0.9rem; bottom: 0.9rem; width: 2px; background: var(--accent); opacity: 0; transition: opacity 120ms ease; }
.item:hover::before, .item:focus-within::before { opacity: 1; }
.item h3 { margin: 0 0 0.2rem; }
.item h3 a { text-decoration: none; }
.item h3 a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-decoration-color: var(--accent); }
.item .summary { margin: 0.2rem 0; max-width: var(--measure); color: var(--ink); }
.item .meta { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.03em; color: var(--muted); }
/* whole-row target */
.item h3 a::after { content: ""; position: absolute; inset: 0; }

/* ---- Topics (mono chips, hairline) ---- */
.topics { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 1.25rem 0 0; }
.topics li a { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.03em; text-decoration: none; color: var(--muted); border: 1px solid var(--rule); padding: 0.15rem 0.55rem; border-radius: 2px; }
.topics li a:hover { color: var(--ink); border-color: var(--accent); }

/* ---- Article meta as a mono datasheet ---- */
.article-meta { font-family: var(--font-mono); color: var(--muted); font-size: 0.8rem; margin-block: 0.5rem 1.5rem; }
.article-meta dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1.25rem; margin: 0.75rem 0; }
.article-meta dt { color: var(--ink); text-transform: uppercase; letter-spacing: 0.04em; }
.article-meta dd { margin: 0; }
.ideas-single .article-meta, .work-single .eyebrow { font-family: var(--font-mono); }

/* ---- Evidence note & sidenotes: the annotated margin ---- */
.evidence-note {
  font-style: italic; color: var(--muted); font-size: 0.98rem; line-height: 1.5;
  margin-block: 1.25rem; padding-left: 0.9rem; border-left: 2px solid var(--accent);
}
.evidence-note strong { font-style: normal; color: var(--ink); }

/* ---- Owner-turn coda: the essay stands alone; this is the delineated business turn ---- */
.owner-turn { max-width: var(--measure); margin-block: 2.5rem 0; padding-left: 1.1rem; border-left: 2px solid var(--accent); }
.owner-turn-label { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.6rem; }
.owner-turn p { color: var(--ink); }
.owner-turn p + p { margin-top: 0.8rem; }

/* ---- Table of contents: de-boxed ---- */
.toc { font-size: 0.9rem; margin-block: 1.5rem; padding-left: 0.9rem; border-left: 1px solid var(--rule); color: var(--muted); }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); text-decoration: underline; }
.toc nav > ul { margin: 0; }

/* Wide screens: float the evidence note into the right margin as a gloss.
   Work pages only — essays have no gloss, so they must NOT reserve the rail. */
@media (min-width: 66rem) {
  .work-single { max-width: var(--wide); }
  .work-single > .prose, .work-single > h1, .work-single > .lead,
  .work-single > .article-meta, .work-single > .eyebrow { max-width: var(--measure); }
  .work-single .evidence-note {
    float: right; clear: right; width: 13rem; margin: 0.2rem 0 1.25rem 2rem;
    border-left: none; padding-left: 0; border-top: 2px solid var(--accent); padding-top: 0.5rem;
    font-size: 0.9rem;
  }
  .work-single .topics, .work-single .cta { clear: both; }
}

/* ---- Draft badge (dev only) ---- */
.draft-badge { font-family: var(--font-mono); display: inline-block; font-size: 0.68rem; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--accent); padding: 0.05rem 0.4rem; border-radius: 2px; margin-left: 0.5rem; vertical-align: middle; }

/* ---- Placeholder marker ---- */
.placeholder { background: color-mix(in srgb, var(--accent) 12%, var(--paper)); border: 1px dashed var(--accent); padding: 0.1rem 0.3rem; border-radius: 2px; }

/* ---- Footer + self-reporting colophon ---- */
.site-footer { border-top: 1px solid var(--rule); padding-block: 1.5rem 3rem; color: var(--muted); }
.site-footer .footer-contact { font-family: var(--font-serif); font-size: 1rem; margin: 0 0 0.75rem; }
.colophon { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.02em; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 0; }
.colophon .sep { opacity: 0.5; }
.colophon .dot { display: inline-block; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--accent); }

/* ---- Focus: a first-class, on-palette craft detail ---- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---- Reduced motion: neutralize everything ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
