/* ─────────────────────────────────────────────────────────────────────
   Plexus

   The identity has one idea in it: paths that cross without joining. The
   E in the wordmark has no stem, and the X in the mark is broken where
   the strokes meet. Agents reach each other without touching.

   That idea is the layout too — a wire runs down the page and sections
   are nodes on it, never quite meeting the text they belong to.
   ───────────────────────────────────────────────────────────────────── */

:root {
  /* Native UI — scrollbars, form controls — follows the system until the theme
     switch pins a choice, which it does by setting color-scheme on the root. */
  color-scheme: light dark;

  --ground:   #f7f6f3;
  --surface:  #ffffff;
  --sunk:     #eeedea;
  --ink:      #12211f;
  --muted:    #61726e;
  --faint:    #8b9995;
  --wire:     #d7ded9;
  --accent:   #0d6b5e;
  --accent-2: #0a5449;
  --signal:   #a2661a;
  --code-bg:  #10201d;
  --code-ink: #cfe0dc;
  --radius:   4px;
  --measure:  66ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:   #0b1110;
    --surface:  #101816;
    --sunk:     #0e1514;
    --ink:      #dce5e2;
    --muted:    #8a9c97;
    --faint:    #63756f;
    --wire:     #1e2b28;
    --accent:   #4ecdb4;
    --accent-2: #6fdcc6;
    --signal:   #dfa557;
    --code-bg:  #070d0c;
    --code-ink: #cfe0dc;
  }
}
:root[data-theme="dark"] {
  --ground:   #0b1110;
  --surface:  #101816;
  --sunk:     #0e1514;
  --ink:      #dce5e2;
  --muted:    #8a9c97;
  --faint:    #63756f;
  --wire:     #1e2b28;
  --accent:   #4ecdb4;
  --accent-2: #6fdcc6;
  --signal:   #dfa557;
  --code-bg:  #070d0c;
  --code-ink: #cfe0dc;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 16.5px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Monospace carries the identity: this is a wire format, and the type
   should say so before the words do. */
.mono, code, pre, .eyebrow, h1, h2, h3, .btn, th {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
               "Liberation Mono", monospace;
  font-feature-settings: "liga" 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap { width: min(100% - 2.5rem, 74rem); margin-inline: auto; }
.prose { max-width: var(--measure); }
.prose p, .prose li { color: var(--muted); }
.prose strong { color: var(--ink); font-weight: 600; }

/* ── nav ───────────────────────────────────────────────────────────── */
header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--wire);
}
header nav { display: flex; align-items: center; gap: 1.5rem; padding: .85rem 0; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); }
.brand svg.mark { width: 19px; height: 19px; color: var(--accent); flex: none; }
.brand svg.word { height: 17px; width: auto; color: var(--ink); }
header nav .spacer { flex: 1; }
header nav a.navlink { color: var(--muted); font-size: .84rem; letter-spacing: .02em; }
header nav a.navlink:hover { color: var(--ink); text-decoration: none; }
@media (max-width: 720px) { header nav a.navlink.opt { display: none; } }

/* The theme switch. One glyph for both directions: a sun that becomes a moon
   has to be kept in step with the theme, while a half-filled circle is already
   the picture of the choice, whichever way round it is. */
.theme {
  appearance: none; -webkit-appearance: none; flex: none; cursor: pointer;
  width: 34px; height: 34px; display: grid; place-items: center; padding: 0;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--wire); border-radius: var(--radius);
}
.theme:hover { color: var(--accent); border-color: var(--accent); }
.theme svg { width: 15px; height: 15px; display: block; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .58rem 1rem; font-size: .84rem; letter-spacing: .01em;
  border: 1px solid var(--wire); border-radius: var(--radius);
  color: var(--ink); background: var(--surface);
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--ground); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--ground); }

/* ── the wire: sections are nodes on a bus ─────────────────────────── */
main { position: relative; }
section { padding: 5.5rem 0; border-top: 1px solid var(--wire); }
section:first-of-type { border-top: 0; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 1.1rem;
}
/* A broken X before each eyebrow — the mark, repeated as punctuation. */
.eyebrow::before {
  content: ""; width: 11px; height: 11px; flex: none;
  background: currentColor;
  -webkit-mask: var(--x) center/contain no-repeat;
  mask: var(--x) center/contain no-repeat;
  --x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' fill='none' stroke='%23000' stroke-width='9' stroke-linecap='square'%3E%3Cpath d='M12 12 L26 26'/%3E%3Cpath d='M38 38 L52 52'/%3E%3Cpath d='M52 12 L38 26'/%3E%3Cpath d='M26 38 L12 52'/%3E%3C/svg%3E");
}

h1 { font-size: clamp(2rem, 5.2vw, 3.15rem); line-height: 1.08; letter-spacing: -.035em;
     margin: 0 0 1.3rem; text-wrap: balance; font-weight: 600; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.85rem); line-height: 1.2; letter-spacing: -.025em;
     margin: 0 0 1rem; text-wrap: balance; font-weight: 600; }
h3 { font-size: 1.02rem; letter-spacing: -.01em; margin: 2.2rem 0 .6rem; font-weight: 600; }
.lede { font-size: 1.1rem; color: var(--muted); max-width: var(--measure); }

/* ── hero ──────────────────────────────────────────────────────────── */
.hero { padding: 5rem 0 4rem; }
.hero .word { width: min(340px, 74vw); height: auto; color: var(--ink); display: block;
              margin-bottom: 2.2rem; }
.hero .thesis { font-size: clamp(1.25rem, 2.8vw, 1.7rem); line-height: 1.35; letter-spacing: -.02em;
                max-width: 30ch; margin: 0 0 1.4rem; color: var(--ink); font-weight: 500; }
.hero .thesis em { font-style: normal; color: var(--accent); }
.cta { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 2rem; }

figure { margin: 2.6rem 0 0; }
figure img, figure video { width: 100%; height: auto; display: block;
             border: 1px solid var(--wire); border-radius: 6px; background: var(--sunk); }
figcaption { margin-top: .8rem; font-size: .84rem; color: var(--faint); max-width: var(--measure); }

/* ── code ──────────────────────────────────────────────────────────── */
pre {
  background: var(--code-bg); color: var(--code-ink);
  padding: 1rem 1.15rem; border-radius: 6px; overflow-x: auto;
  font-size: .82rem; line-height: 1.6; margin: 1.2rem 0;
  border: 1px solid transparent;
}
pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
code { background: var(--sunk); padding: .12em .38em; border-radius: 3px; font-size: .88em; }
.c-key { color: #8fd4c2; } .c-str { color: #d9b382; } .c-com { color: #5f7a74; }
.c-fn  { color: #9fc9f0; }

/* ── grid of cards ─────────────────────────────────────────────────── */
.grid { display: grid; gap: 1rem; margin-top: 2rem; }
.g3 { grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--wire);
  border-radius: 6px; padding: 1.35rem;
}
.card h3 { margin: 0 0 .5rem; font-size: .95rem; }
.card p { margin: 0; font-size: .9rem; color: var(--muted); }
.card .tag { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase;
             color: var(--faint); display: block; margin-bottom: .7rem; }

/* ── table ─────────────────────────────────────────────────────────── */
.tablewrap { overflow-x: auto; margin: 1.8rem 0; }
table { width: 100%; border-collapse: collapse; font-size: .89rem; min-width: 34rem; }
th, td { text-align: left; padding: .7rem .85rem; border-bottom: 1px solid var(--wire);
         vertical-align: top; }
th { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint);
     font-weight: 500; }
tbody tr:last-child td { border-bottom: 0; }
tr.highlight td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
tr.highlight td:first-child { color: var(--ink); font-weight: 600; }
td.yes { color: var(--accent); font-weight: 600; }
td.no  { color: var(--faint); }

/* ── tabs ──────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin: 1.8rem 0 0; border-bottom: 1px solid var(--wire); }
.tab {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
  padding: .6rem .9rem; font-size: .84rem; color: var(--muted); cursor: pointer;
  font-family: inherit;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab:hover { color: var(--ink); }
.panel[hidden] { display: none; }

/* ── callout ───────────────────────────────────────────────────────── */
.note {
  border-left: 2px solid var(--signal); padding: .1rem 0 .1rem 1.1rem;
  margin: 1.6rem 0; color: var(--muted); font-size: .93rem; max-width: var(--measure);
}
.note strong { color: var(--ink); }

footer { border-top: 1px solid var(--wire); padding: 3rem 0 4rem; color: var(--faint); font-size: .86rem; }
footer a { color: var(--muted); }
footer .row { display: flex; flex-wrap: wrap; gap: 2rem 3rem; align-items: flex-start; }
footer h4 { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
            color: var(--faint); margin: 0 0 .7rem; font-weight: 500;
            font-family: ui-monospace, "SF Mono", Menlo, monospace; }
footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }

/* ── author ────────────────────────────────────────────────────────── */
.author { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2.2rem;
          align-items: start; margin-top: 1.5rem; }
@media (max-width: 640px) { .author { grid-template-columns: 1fr; gap: 1.4rem; } }

/* A monogram rather than a photograph: the mark is the identity here, and a
   default avatar would read as a placeholder nobody got round to replacing. */
.monogram {
  width: 116px; height: 116px; flex: none; position: relative;
  display: grid; place-items: center;
  border: 1px solid var(--wire); border-radius: 8px; background: var(--surface);
  color: var(--accent);
}
.monogram svg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .16; }
.monogram span {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 1.9rem; font-weight: 600; letter-spacing: .06em;
  color: var(--ink); position: relative;
}
.author-body p { color: var(--muted); max-width: var(--measure); }
.author-role { font-family: ui-monospace, "SF Mono", Menlo, monospace;
               font-size: .82rem; color: var(--faint); margin: 0 0 1.2rem; }
