/* ym.ai — shared design system ("ivory / clay" — Anthropic html-effectiveness look)
   One stylesheet, linked by every page across every category site.
   The build (_build/build-site.mjs) copies this into each Netlify site root,
   so pages reference it with an absolute path: <link rel="stylesheet" href="/theme.css">

   Ivory background, white cards (12px radius, 1.5px gray borders), clay accent,
   olive secondary, serif headings + system-sans body + mono labels, spring easing.

   COMPONENT KIT (classes pages may use — do not invent new CSS):
     layout      .wrap  .stack
     header      .masthead  .glyph  .crumb  .crumb a
     hero        .hero  .kicker  h1  .lede
     cards       .tiles  .tile  .tile-title  .tile-desc  .tile-note  .arrow
     list        .rows  .row  .row-main  .row-title  .row-sub  .note
     badges      .badge  .badge.lock  .badge.soon  .tag
     stats       .stats  .stat  .stat-num (.garnet=accent)  .stat-label
     prose       .prose (h2/h3/p/ul/ol/blockquote/code/hr/a/table inside)
     callout     .callout  .callout.warn
     gate        .gate  (passcode screen — usually emitted by the build)
     footer      footer
   Utilities: .muted .center .mono .nowrap .hide-print
   Glyphs use stroke/fill="currentColor"; .glyph sets color to clay.
*/

:root {
  /* canonical palette */
  --ivory:   #FAF9F5;
  --slate:   #141413;
  --clay:    #D97757;
  --clay-ink:#C25A3A;
  --oat:     #E3DACC;
  --olive:   #788C5D;
  --white:   #ffffff;
  --gray-50: #F0EEE6;
  --gray-200:#D1CFC5;
  --gray-500:#87867F;
  --gray-800:#3D3D3A;

  /* legacy aliases (kept so existing markup + the gate's inline JS keep working) */
  --paper:  var(--ivory);
  --paper2: var(--gray-50);
  --card:   var(--white);
  --ink:    var(--slate);
  --ink2:   var(--gray-800);
  --mute:   var(--gray-500);
  --rule:   var(--gray-200);
  --rule2:  var(--oat);
  --garnet: var(--clay);
  --garnet2:var(--clay-ink);
  --good:   var(--olive);
  --gold:   var(--clay);

  /* type */
  --serif: ui-serif, Georgia, "Times New Roman", serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* modular type scale (1.20) */
  --t--1: 0.8125rem;
  --t-0:  0.9375rem;
  --t-1:  1.0625rem;
  --t-2:  1.3125rem;
  --t-3:  1.5rem;
  --t-4:  1.875rem;
  --t-5:  2.25rem;
  --t-6:  2.75rem;

  /* spacing scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 88px;

  --maxw: 720px;
  --radius: 12px;
  --radius-sm: 8px;
  --ease: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --shadow: 0 1px 2px rgba(20,20,19,.04), 0 12px 32px -20px rgba(20,20,19,.22);
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ivory);
  color: var(--slate);
  font-family: var(--sans);
  font-size: var(--t-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding: clamp(36px, 7vw, 64px) 22px;
}
::selection { background: rgba(217,119,87,.18); }

/* ---------- layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; }
.wrap.narrow { max-width: 540px; }
.stack > * + * { margin-top: var(--s5); }

/* ---------- header ---------- */
.masthead { display: flex; align-items: center; gap: var(--s4); margin-bottom: var(--s7); }
.glyph { width: 34px; height: 34px; display: block; flex: none; color: var(--clay); }
.crumb {
  font-family: var(--mono); font-size: var(--t--1); letter-spacing: .08em;
  text-transform: uppercase; color: var(--gray-500); margin: 0;
}
.crumb a { color: var(--clay); text-decoration: none; }
.crumb a:hover { color: var(--clay-ink); }
.crumb .sep { color: var(--gray-200); margin: 0 .4em; }

/* ---------- hero ---------- */
.hero { margin-bottom: var(--s7); }
.kicker {
  font-family: var(--mono); font-size: var(--t--1); letter-spacing: .08em;
  text-transform: uppercase; color: var(--gray-500); font-weight: 400; margin: 0 0 var(--s3);
}
h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(var(--t-4), 6vw, var(--t-5)); letter-spacing: -.01em;
  line-height: 1.12; margin: 0 0 var(--s3);
}
h1 em { font-style: italic; color: var(--clay); }
.lede { color: var(--gray-800); font-size: var(--t-1); margin: 0; max-width: 60ch; }

/* ---------- card grid ---------- */
.tiles {
  display: grid; gap: var(--s4); list-style: none; padding: 0; margin: 0;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.tile {
  display: flex; flex-direction: column; gap: var(--s2);
  background: var(--white); border: 1.5px solid var(--gray-200);
  border-radius: var(--radius); padding: var(--s5);
  text-decoration: none; color: var(--slate);
  transition: border-color .2s var(--ease), box-shadow .25s var(--ease-out), transform .25s var(--ease);
}
.tile:hover { border-color: var(--clay); box-shadow: var(--shadow); transform: translateY(-3px); }
.tile-title { font-family: var(--serif); font-size: var(--t-1); font-weight: 500; display: flex; align-items: center; gap: var(--s3); }
.tile-title .arrow { color: var(--clay); font-family: var(--mono); margin-left: auto; transition: transform .25s var(--ease); }
.tile:hover .tile-title .arrow { transform: translateX(4px); }
.tile-desc { color: var(--gray-800); font-size: var(--t-0); }
.tile-note { font-family: var(--mono); font-size: var(--t--1); color: var(--gray-500); letter-spacing: .03em; margin-top: auto; }
.tile.muted { opacity: .6; }
.tile.muted:hover { transform: none; border-color: var(--gray-200); box-shadow: none; }

/* ---------- list rows ---------- */
.rows { list-style: none; padding: 0; margin: 0; }
.row {
  display: flex; align-items: center; gap: var(--s4); justify-content: space-between;
  text-decoration: none; color: var(--slate);
  padding: var(--s4) var(--s2); border-bottom: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  transition: background .18s var(--ease-out), padding-left .2s var(--ease);
}
.rows li:first-child .row { border-top: 1.5px solid var(--gray-200); }
.row:hover { background: var(--white); padding-left: var(--s4); }
.row:hover .row-title { color: var(--clay); }
.row-main { min-width: 0; }
.row-title { display: block; font-family: var(--serif); font-size: var(--t-1); font-weight: 500; transition: color .18s var(--ease-out); }
.row-sub { display: block; color: var(--gray-500); font-size: var(--t-0); margin-top: 2px; }
.note { font-family: var(--mono); font-size: var(--t--1); color: var(--gray-500); letter-spacing: .03em; white-space: nowrap; }
.note .arrow { color: var(--clay); margin-left: .5em; }
.empty {
  font-family: var(--mono); font-size: var(--t-0); color: var(--gray-500);
  border: 1.5px dashed var(--gray-200); border-radius: var(--radius-sm); padding: var(--s5);
}

/* ---------- badges & tags ---------- */
.badge, .tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  font-weight: 500; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.badge { background: #FBF1EC; color: var(--clay-ink); border: 1px solid rgba(217,119,87,.28); }
.badge.lock::before { content: "🔒"; font-size: 9px; }
.badge.soon { background: var(--gray-50); color: var(--gray-500); border-color: var(--gray-200); }
.tag { background: var(--gray-50); color: var(--gray-800); border: 1px solid var(--gray-200); text-transform: none; letter-spacing: .01em; }

/* ---------- stat cards ---------- */
.stats { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { background: var(--white); border: 1.5px solid var(--gray-200); border-radius: var(--radius); padding: var(--s5); }
.stat-num { font-family: var(--serif); font-size: var(--t-3); font-weight: 500; letter-spacing: -.01em; }
.stat-num.garnet, .stat-num.accent { color: var(--clay); }
.stat-num.olive { color: var(--olive); }
.stat-label { font-family: var(--mono); font-size: var(--t--1); color: var(--gray-500); letter-spacing: .04em; text-transform: uppercase; margin-top: var(--s2); }

/* ---------- callout ---------- */
.callout {
  border: 1.5px solid var(--gray-200); border-left: 3px solid var(--clay); background: var(--white);
  border-radius: var(--radius-sm); padding: var(--s4) var(--s5); color: var(--gray-800); font-size: var(--t-0);
}
.callout strong { color: var(--slate); }
.callout.warn { border-left-color: var(--clay-ink); }

/* ---------- prose (content pages) ---------- */
.prose { font-size: var(--t-1); color: var(--slate); line-height: 1.65; }
.prose > * + * { margin-top: var(--s4); }
.prose h2 { font-family: var(--serif); font-weight: 500; font-size: var(--t-2); letter-spacing: -.01em; margin-top: var(--s7); }
.prose h3 { font-family: var(--serif); font-weight: 500; font-size: var(--t-1); margin-top: var(--s6); }
.prose a { color: var(--clay-ink); text-underline-offset: 3px; }
.prose blockquote { margin: 0; padding-left: var(--s5); border-left: 3px solid var(--gray-200); color: var(--gray-800); font-style: italic; }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 6px; padding: 1px 6px; }
.prose pre { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-sm); padding: var(--s4); overflow: auto; }
.prose pre code { background: none; border: none; padding: 0; }
.prose hr { border: none; border-top: 1.5px solid var(--gray-200); margin: var(--s7) 0; }
.prose img { max-width: 100%; border-radius: var(--radius-sm); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: var(--s2); }

/* transcript timestamps + month headers + embedded PDF */
.prose h3.ts { font-family: var(--mono); font-size: var(--t--1); font-weight: 500; letter-spacing: .05em; color: var(--clay); margin-top: var(--s6); }
.transcript p { color: var(--gray-800); }
.monthhead { margin: var(--s6) 0 var(--s2); }
.pdfframe { display: block; width: 100%; height: 78vh; border: 1.5px solid var(--gray-200); border-radius: var(--radius); background: var(--white); }

table { border-collapse: collapse; width: 100%; font-size: var(--t-0); }
th, td { text-align: left; padding: var(--s3) var(--s4); border-bottom: 1.5px solid var(--gray-200); }
th { font-family: var(--mono); font-size: var(--t--1); text-transform: uppercase; letter-spacing: .06em; color: var(--gray-500); font-weight: 500; }

/* ---------- passcode gate (emitted by the build) ---------- */
.gate { width: 100%; max-width: 400px; margin: 14vh auto 0; text-align: center; }
.gate .glyph { margin: 0 auto var(--s5); width: 40px; height: 40px; }
.gate h1 { font-size: var(--t-2); }
.gate form { display: flex; flex-direction: column; gap: var(--s3); margin-top: var(--s5); }
.gate input {
  width: 100%; min-width: 0; font-family: var(--mono); font-size: var(--t-1); letter-spacing: .18em; text-align: center;
  padding: 14px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  background: var(--white); color: var(--slate); outline: none;
  transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.gate input:focus { border-color: var(--clay); box-shadow: 0 0 0 3px rgba(217,119,87,.14); }
.gate button {
  width: 100%; font-family: var(--mono); font-size: var(--t--1); font-weight: 500; letter-spacing: .08em; padding: 13px 18px;
  border: none; border-radius: var(--radius-sm); background: var(--clay); color: #fff; cursor: pointer;
  transition: background .18s var(--ease-out), transform .12s var(--ease);
}
.gate button:hover { background: var(--clay-ink); }
.gate button:active { transform: scale(.98); }
.gate button:disabled { opacity: .55; cursor: wait; }
.gate .msg { min-height: 20px; margin-top: var(--s4); font-family: var(--mono); font-size: 12.5px; color: var(--clay-ink); }
.gate .hint { margin-top: var(--s6); font-family: var(--mono); font-size: 11px; color: var(--gray-500); line-height: 1.6; }

/* ---------- footer ---------- */
footer {
  margin-top: var(--s9); padding-top: var(--s5); border-top: 1.5px solid var(--gray-200);
  font-family: var(--mono); font-size: var(--t--1); color: var(--gray-500);
  display: flex; gap: var(--s5); flex-wrap: wrap; align-items: center;
}
footer a { color: var(--clay); text-decoration: none; }
footer a:hover { color: var(--clay-ink); }
footer .spacer { margin-left: auto; }

/* ---------- utilities ---------- */
.muted { color: var(--gray-500); }
.center { text-align: center; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero, .stack > * { animation: rise .5s var(--ease-out) both; }
  .stack > *:nth-child(2) { animation-delay: .04s; }
  .stack > *:nth-child(3) { animation-delay: .08s; }
  .stack > *:nth-child(4) { animation-delay: .12s; }
  .stack > *:nth-child(5) { animation-delay: .16s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media print { .hide-print { display: none !important; } body { padding: 0; background: #fff; } * { animation: none !important; } }

@media (max-width: 540px) {
  .masthead { margin-bottom: var(--s6); }
  .tiles { grid-template-columns: 1fr; }
  footer { gap: var(--s3); }
}
