/* ===========================================================================
   Editable by Design — white spec-sheet theme, after attio.com/blog.
   White ground, neutral hairline grid, zero radius on content cells,
   pill radius on small controls, mono bracketed micro-labels, and a serif
   italic voice for bylines / standfirsts. Near-monochrome throughout.
   =========================================================================== */

:root {
  --paper:        #FFFFFF;   /* content ground — white                    */
  --page:         #FCFCFC;   /* the sliver outside cells                  */
  --mass:         #F6F6F5;   /* table heads, hover fills                  */
  --ink:          #1A1A18;
  --text:         #373734;
  --muted:        #6B6B66;
  --faint:        #9B9B95;
  --line:         #E8E8E5;   /* the hairline — neutral, very light        */
  --line-strong:  #D8D8D4;
  --accent:       #B14A28;   /* held in reserve: link underlines, marks   */
  --accent-deep:  #8C3A1F;
  --code-bg:      #1A1A18;
  --code-text:    #E9E9E6;
  --max:          1160px;
  --gut:          32px;
  --pill:         9999px;
  --disp: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* pages toggle sections with the hidden attribute — it must beat any display rule */
[hidden] { display: none !important; }

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 200;
  padding: 8px 14px; background: var(--ink); color: #fff; border-radius: var(--pill);
}
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ------------------------------------------------------- the label voice -- */
/* mono, uppercase, lightly tracked — [CATEGORY] 6 MIN READ */
.eyebrow, .grid-group-label, .foundations-label, .pn-dir, .type-tag,
.pcard-num, .pill, .grid-count, .wordmark .sub, .status, .back-link,
.tlink, .lang-btn, .site-footer {
  font-family: var(--mono); font-variant-ligatures: none;
}
.bracket::before { content: "["; } .bracket::after { content: "]"; }

/* ---------------------------------------------------------------- top bar -- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--gut);
  height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.wordmark { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wordmark .mark {
  font-family: var(--disp); font-weight: 600; font-size: 17.5px; color: var(--ink);
  letter-spacing: -0.022em; white-space: nowrap;
}
.wordmark .dot { width: 6px; height: 6px; border-radius: var(--pill); background: var(--ink); flex: none; }
.wordmark .sub {
  font-size: 10.5px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--faint);
  white-space: nowrap; line-height: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
/* Both controls get one fixed height and centre their own content, so glyph
   metrics can't set the box — "中文" is taller than "EN" and used to
   inflate the toggle past the link beside it. */
.topbar-actions .tlink, .lang-toggle { height: 32px; box-sizing: border-box; }
/* small controls are pills, the way the reference's nav buttons are */
.topbar-actions .tlink {
  display: inline-flex; align-items: center; line-height: 1;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  padding: 0 15px; border: 1px solid var(--line-strong); border-radius: var(--pill);
}
.topbar-actions .tlink:hover { color: var(--ink); border-color: var(--ink); text-decoration: none; }

.lang-toggle { display: inline-flex; align-items: center; gap: 2px; padding: 0 3px; border: 1px solid var(--line-strong); border-radius: var(--pill); }
.lang-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 24px; min-width: 34px; padding: 0 10px;
  font-size: 10.5px; letter-spacing: 0.06em; line-height: 1;
  border: 0; border-radius: var(--pill); background: transparent; color: var(--muted);
  cursor: pointer; transition: background .15s, color .15s;
}
.lang-btn:hover { color: var(--ink); }
.lang-btn[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ------------------------------------------------------------------- hero -- */
.hero { max-width: var(--max); margin: 0 auto; padding: 72px var(--gut) 0; }
/* [EDITABLE BY DESIGN] — no leading rule, just the label */
.hero .eyebrow {
  margin: 0; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint);
}
.hero .eyebrow::before { content: "["; }
.hero .eyebrow::after  { content: "]"; }
.hero h1 {
  font-family: var(--disp); font-weight: 600;
  font-size: clamp(34px, 5vw, 54px); line-height: 1.08; letter-spacing: -0.026em;
  color: var(--ink); margin: 18px 0 0; max-width: 20ch;
}
.hero .lede {
  margin: 20px 0 0; font-size: clamp(16px, 2vw, 18px); line-height: 1.6;
  color: var(--muted); max-width: 62ch;
}
.hero .lede strong, .hero .lede em { color: var(--text); font-weight: 500; font-style: normal; }
/* the essay's standfirst reads as a byline — serif italic, as on the reference */
.hero.essay h1 { max-width: 24ch; font-size: clamp(30px, 4.4vw, 46px); }
.hero.essay .lede {
  font-family: var(--serif); font-style: italic; font-size: clamp(17px, 2.1vw, 20px);
  line-height: 1.5; color: var(--muted);
}
/* meta line: [ESSAY] · HUMAN-AI COLLABORATION — no chips, no dividers */
.hero .meta { margin: 26px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 18px; padding-bottom: 36px; }
.hero .pill { font-size: 10.5px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--faint); }
.hero .pill:first-child::before { content: "["; }
.hero .pill:first-child::after  { content: "]"; }
/* the unbracketed meta items get a middot, as "6 MIN READ" follows [GUIDES] */
.hero .pill + .pill::before { content: "\00b7"; margin-right: 18px; color: var(--line-strong); }

/* --------------------------------------------------------------- content -- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gut) 72px; }
.status { padding: 40px 0; font-size: 11.5px; letter-spacing: 0.06em; color: var(--faint); }

.grid-group { margin: 0 0 48px; }
.grid-group-label {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: baseline; gap: 8px; margin: 0; padding-bottom: 14px;
}
/* the count rides the label as a bracketed superscript — All [48] */
.grid-count {
  font-size: 9.5px; color: var(--faint); letter-spacing: 0.04em;
  vertical-align: super; position: relative; top: -0.45em;
}
.grid-count::before { content: "["; } .grid-count::after { content: "]"; }

/* the hairline grid: cells butt together and share one rule, no gaps, no radius */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 0;
  border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
.pcard {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 22px 22px 26px; background: var(--paper); color: var(--text);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transition: background .15s;
}
.pcard:hover { background: var(--mass); text-decoration: none; }
.pcard-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pcard-num { font-size: 10.5px; letter-spacing: 0.06em; color: var(--faint); font-variant-numeric: tabular-nums; }
.pcard .type-tag {
  font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--faint);
  background: none; border: 0; padding: 0;
}
.pcard .type-tag::before { content: "["; } .pcard .type-tag::after { content: "]"; }
.pcard-name {
  font-family: var(--disp); font-size: 18.5px; font-weight: 600; line-height: 1.25;
  letter-spacing: -0.018em; color: var(--ink);
}
/* the "best for" line is the reference's serif italic byline */
.pcard-best { font-family: var(--serif); font-style: italic; font-size: 14px; line-height: 1.45; color: var(--muted); }
.pcard-go { position: absolute; right: 20px; bottom: 18px; color: var(--muted); opacity: 0; transition: opacity .15s, transform .15s; }
.pcard:hover .pcard-go { opacity: 1; transform: translateX(2px); }
.pcard.ref { flex-direction: row; align-items: center; justify-content: space-between; }
.pcard.ref .pcard-name { font-size: 15.5px; }

.foundations { margin-top: 8px; padding-top: 44px; border-top: 1px solid var(--line); }
.foundations-label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.foundations .prose { max-width: 760px; }
.foundations .prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.pattern-page { padding-top: 30px; }
.pattern-page .prose { max-width: 760px; }
.pattern-page .prose > h2:first-child { margin-top: 4px; }
.back-link {
  display: inline-block; margin-bottom: 26px; font-size: 10.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.back-link:hover { color: var(--ink); text-decoration: none; }

/* prev / next — the reference's list rows: dashed rules, arrow on the right */
.pn-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0; max-width: 760px;
  margin: 56px 0 0; border-top: 1px dashed var(--line-strong);
}
.pn-card {
  display: flex; flex-direction: column; gap: 6px; padding: 18px 4px;
  border-bottom: 1px dashed var(--line-strong); color: var(--text); transition: color .15s;
}
.pn-slot { border-bottom: 1px dashed var(--line-strong); }
.pn-card:hover { text-decoration: none; color: var(--ink); }
.pn-card.next { text-align: right; grid-column: 2; }
.pn-dir { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.pn-name { font-family: var(--disp); font-size: 16px; font-weight: 600; letter-spacing: -0.015em; color: var(--ink); }

/* ============================================================ prose ======= */
.prose { min-width: 0; max-width: 760px; }
.prose > :first-child { margin-top: 0; }
.prose h1 { /* the page's own H1 — hidden, the hero carries it */ display: none; }

.prose h2 {
  font-family: var(--disp); font-weight: 600; font-size: 25px; line-height: 1.22;
  letter-spacing: -0.022em; color: var(--ink);
  margin: 64px 0 12px; padding-top: 30px; border-top: 1px solid var(--line);
  scroll-margin-top: 80px; position: relative;
}
.prose h2.pattern { border-top: 0; padding-top: 0; margin: 52px 0 16px; }
.prose h2 .type-tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--faint); background: none; border: 0; padding: 0;
  vertical-align: middle; margin-left: 12px; white-space: nowrap;
}
.prose h2 .type-tag::before { content: "["; } .prose h2 .type-tag::after { content: "]"; }
.prose h3 {
  font-family: var(--disp); font-weight: 600; font-size: 18.5px; letter-spacing: -0.016em;
  color: var(--ink); margin: 38px 0 10px; scroll-margin-top: 80px;
}

.prose p { margin: 0 0 1.05em; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose em { font-family: var(--serif); font-style: italic; font-size: 1.05em; }
.prose a { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--line-strong); }
.prose a:hover { text-decoration-color: var(--accent); color: var(--accent-deep); }

.prose ul, .prose ol { margin: 0 0 1.1em; padding-left: 1.35em; }
.prose ul > li { list-style: none; position: relative; }
.prose ul > li::before {
  content: ""; position: absolute; left: -1.05em; top: 0.72em;
  width: 4px; height: 4px; border-radius: var(--pill); background: var(--line-strong);
}
.prose ol > li { list-style: decimal; }
.prose li { margin: .32em 0; }
.prose li::marker { font-family: var(--mono); font-size: .85em; color: var(--faint); }

/* the standfirst / pull note — serif italic, hairline on the left */
.prose blockquote {
  margin: 1.6em 0; padding: 4px 0 4px 22px; border-left: 1px solid var(--line-strong);
  font-family: var(--serif); font-style: italic; font-size: 1.08em; line-height: 1.5; color: var(--muted);
}
.prose blockquote p { margin: 0; }
.prose blockquote em { font-family: inherit; font-size: 1em; }

.table-wrap { overflow-x: auto; margin: 1.5em 0; border: 1px solid var(--line); }
.prose table { border-collapse: collapse; width: 100%; font-size: 13.5px; background: var(--paper); }
.prose th, .prose td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.prose th:last-child, .prose td:last-child { border-right: 0; }
.prose th {
  background: var(--mass); color: var(--muted); font-family: var(--mono); font-weight: 400;
  font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase;
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; }

.prose :not(pre) > code {
  font-family: var(--mono); font-size: 0.85em;
  background: var(--mass); color: var(--text);
  padding: 1px 5px; border: 1px solid var(--line);
}

.codeblock { position: relative; margin: 1.5em 0; }
.prose pre {
  margin: 0; background: var(--code-bg); padding: 20px; overflow-x: auto;
  font-size: 12.5px; line-height: 1.65;
}
.prose pre code { font-family: var(--mono); color: var(--code-text); background: none; border: 0; padding: 0; }
.prose pre:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.copy-btn {
  position: absolute; top: 10px; right: 10px; z-index: 1;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 5px 11px; color: #A5A5A0; background: transparent;
  border: 1px solid rgba(233,233,230,0.2); border-radius: var(--pill);
  cursor: pointer; opacity: 0; transition: opacity .15s, color .15s, border-color .15s;
}
.codeblock:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: #fff; border-color: rgba(233,233,230,0.5); }
.copy-btn[data-copied="true"] { color: #9FBE7E; opacity: 1; }

.prose .anchor {
  position: absolute; left: -0.9em; width: 0.9em; opacity: 0;
  color: var(--line-strong); text-decoration: none; font-weight: 400;
}
.prose h2:hover .anchor, .prose h3:hover .anchor, .anchor:focus { opacity: 1; }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 10px 0; }

/* syntax tokens — low chroma, near-monochrome against the dark block */
.hljs { color: var(--code-text); }
.hljs-attr, .hljs-attribute, .hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-name { color: #C9C7BE; }
.hljs-string, .hljs-meta-string { color: #A8A59A; }
.hljs-number, .hljs-literal, .hljs-boolean { color: #BFA38F; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #C9C7BE; }
.hljs-comment, .hljs-quote { color: #75736C; font-style: italic; }
.hljs-punctuation, .hljs-meta { color: #8C8A83; }
.hljs-type, .hljs-params { color: #B6B3AA; }

/* footer */
.site-footer {
  border-top: 1px solid var(--line); margin-top: 48px;
  padding: 28px var(--gut) 56px; color: var(--faint);
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
}
.site-footer .inner { max-width: var(--max); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.site-footer a { color: var(--faint); }
.site-footer a:hover { color: var(--ink); }

/* --------------------------------------------------------- responsive ----- */
@media (max-width: 920px) {
  :root { --gut: 20px; }
  .hero { padding-top: 52px; }
  .prose { max-width: none; }
  .wordmark .sub { display: none; }
  .topbar-actions .tlink { display: none; }
  .pn-nav { grid-template-columns: 1fr; }
  .pn-card.next { grid-column: 1; text-align: left; }
  .pn-slot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ------------------------------------------------------------- zh guard --- */
/* Chinese has no true italic — browsers fake it by skewing the glyphs, which
   looks broken. Drop to upright sans and carry the emphasis with weight/colour. */
html[lang^="zh"] .hero.essay .lede,
html[lang^="zh"] .prose blockquote,
html[lang^="zh"] .pcard-best {
  font-family: var(--sans); font-style: normal;
}
html[lang^="zh"] .hero.essay .lede { font-size: clamp(15.5px, 1.9vw, 17.5px); line-height: 1.7; }
html[lang^="zh"] .prose blockquote { font-size: 1em; line-height: 1.7; }
html[lang^="zh"] .pcard-best { font-size: 13px; }
html[lang^="zh"] .prose em {
  font-family: var(--sans); font-style: normal; font-size: 1em;
  color: var(--ink); font-weight: 500;
}
html[lang^="zh"] .wordmark .sub {
  font-family: var(--sans); letter-spacing: 0.05em;
}
