/* Slide Archive — Downloads
   Design tokens and base rules are taken from the Neuroanalytica webapp
   (webapp/static/app.css) so app.crarylabslides.com and dl.crarylabslides.com
   read as one system: warm archival paper, letterpress restraint, oxblood accent. */

:root {
  /* color — warm paper substrate */
  --paper:        #f4f0e8;
  --paper-edge:   #ece6da;
  --surface:      #fbf9f4;
  --surface-2:    #f7f3ea;
  --sunken:       #ebe4d6;
  --selected:     #f3e7e4;
  --selected-rule:#c9a99f;
  /* color — ink */
  --ink:          #241f1b;
  --ink-2:        #5a5048;
  --ink-3:        #8a7e72;
  --ink-inverse:  #fbf9f4;
  /* color — hairlines */
  --rule:         #ddd4c4;
  --rule-strong:  #cabfa9;
  --rule-faint:   #e8e1d2;
  /* color — accent (anatomical oxblood) */
  --accent:       #7b2d2a;
  --accent-deep:  #611f1d;
  --accent-tint:  #f3e7e4;
  --accent-ink:   #6a2623;
  /* color — secondary (catalog gold) */
  --gold:         #9a7b35;
  --gold-tint:    #f1ead4;
  /* color — semantics */
  --ok:           #4a6a3f;  --ok-tint:    #e7eede;
  --danger:       #8f3331;  --danger-tint:#f4e2e0;

  --shadow-1: 0 1px 2px rgba(58,42,28,.06), 0 1px 1px rgba(58,42,28,.04);
  --shadow-2: 0 2px 6px rgba(58,42,28,.08), 0 4px 14px rgba(58,42,28,.05);

  --r-xs: 3px;  --r-sm: 5px;  --r-md: 7px;  --r-lg: 10px;  --r-round: 999px;

  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

  --font-display: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --font-body:    "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-sans:    "Spline Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-mono:    "Spline Sans Mono", "SFMono-Regular", "Cascadia Mono", ui-monospace, monospace;
  --t-xs:  0.733rem; --t-sm:  0.8rem;  --t-base:0.933rem; --t-md: 1.067rem;
  --t-lg:  1.333rem; --t-xl:  1.75rem; --t-2xl: 2.4rem;   --t-3xl: 3.2rem;
  --lh-tight: 1.15;  --lh-snug: 1.3;   --lh-body: 1.55;
  --w-reg: 400; --w-med: 500; --w-semi: 600; --w-bold: 700;

  --ease-out: cubic-bezier(.2,.7,.3,1);
  --dur-fast: 120ms; --dur: 200ms; --dur-slow: 320ms;

  --shell-h: 56px;
  --content-max: 1180px;

  font-size: 15px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  line-height: var(--lh-body);
  font-size: var(--t-base);
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--s-6) var(--s-5); }
a { color: var(--accent-ink); text-decoration-color: var(--rule-strong); text-underline-offset: 2px; }
a:hover { color: var(--accent-deep); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.eyebrow {
  font-family: var(--font-sans); font-size: var(--t-xs); font-weight: var(--w-semi);
  text-transform: uppercase; letter-spacing: 0.13em; color: var(--gold);
}
:where(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs);
}

/* ── masthead / colophon ─────────────────────────────────────────────────── */
.masthead {
  display: flex; align-items: center; gap: var(--s-4);
  height: var(--shell-h); padding: 0 var(--s-5);
  background: var(--surface); border-bottom: 1px solid var(--rule-strong);
}
.wordmark { display: flex; align-items: baseline; gap: var(--s-2); text-decoration: none; color: var(--ink); }
.wm-mark { color: var(--accent); font-size: 1.25rem; line-height: 1; }
.wm-name { font-family: var(--font-display); font-weight: var(--w-bold); font-size: var(--t-md); letter-spacing: -0.02em; }
.masthead-tag { padding-top: 2px; }
.masthead .spacer { flex: 1; }
.site-nav { display: flex; align-items: center; gap: var(--s-4); margin-left: var(--s-3); padding-left: var(--s-4); border-left: 1px solid var(--rule); }
.masthead-link.ext::after { content: " ↗"; font-size: .8em; color: var(--ink-3); }
.masthead-link, .who, .linkbtn { font-family: var(--font-sans); font-size: var(--t-sm); }
.masthead-link { text-decoration: none; color: var(--ink-2); }
.masthead-link:hover { color: var(--accent-deep); }
.who { color: var(--ink-3); }
.inline { display: inline; margin: 0; }
.linkbtn { background: none; border: none; padding: 0; color: var(--ink-2); cursor: pointer; font-weight: var(--w-med); }
.linkbtn:hover { color: var(--accent-deep); }

.colophon {
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  padding: var(--s-4) var(--s-5); border-top: 1px solid var(--rule);
  font-size: var(--t-xs); color: var(--ink-3);
}
.col-rule { flex: 1; height: 1px; background: var(--rule); }
.col-link { font-family: var(--font-sans); }
.col-note { font-family: var(--font-sans); }

/* ── controls ────────────────────────────────────────────────────────────── */
.field {
  width: 100%; font-family: var(--font-sans); font-size: var(--t-base); color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--r-sm);
  padding: 8px 10px; transition: border-color var(--dur), box-shadow var(--dur);
}
.field::placeholder { color: var(--ink-3); }
.field:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }

.btn {
  display: inline-block; font-family: var(--font-sans); font-size: var(--t-sm); font-weight: var(--w-semi);
  text-transform: uppercase; letter-spacing: 0.06em; line-height: 1; padding: 9px 16px;
  border-radius: var(--r-sm); border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  min-height: 36px; text-decoration: none; text-align: center;
  transition: background var(--dur), border-color var(--dur), color var(--dur), box-shadow var(--dur);
}
.btn-primary { background: var(--accent); color: var(--ink-inverse); box-shadow: var(--shadow-1); }
.btn-primary:hover { background: var(--accent-deep); color: var(--ink-inverse); }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--rule-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-deep); }
.btn-small { font-size: var(--t-xs); padding: 6px 10px; min-height: 28px; }
.btn.copied { background: var(--ok-tint); border-color: var(--ok); color: var(--ok); }

/* ── login title page (from app.css §13) ─────────────────────────────────── */
.login.title-page {
  max-width: 380px; margin: var(--s-8) auto; padding: var(--s-7) var(--s-6);
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2); text-align: center;
}
.tp-mark { display: block; color: var(--accent); font-size: 2rem; line-height: 1; margin-bottom: var(--s-3); }
.tp-title { font-family: var(--font-display); font-size: clamp(1.9rem, 6vw, 2.5rem); font-weight: var(--w-bold); margin: var(--s-2) 0 4px; letter-spacing: -0.03em; }
.tp-sub { color: var(--ink-2); font-style: italic; font-size: var(--t-md); margin: 0; }
.tp-rule { border: none; border-top: 1px solid var(--rule); margin: var(--s-5) 0; }
.tp-form { text-align: left; display: flex; flex-direction: column; gap: var(--s-4); }
.tp-form label { display: flex; flex-direction: column; gap: 6px; font-family: var(--font-sans); font-size: var(--t-sm); color: var(--ink-2); }
.tp-submit { width: 100%; margin-top: var(--s-2); }
.tp-note { margin-top: var(--s-5); font-size: var(--t-xs); color: var(--ink-3); line-height: 1.6; }
.login .hint { color: var(--ink-3); font-weight: var(--w-reg); }
.login .error { color: var(--danger); background: var(--danger-tint); border: 1px solid #e0b9b7; border-radius: var(--r-sm); padding: 8px 12px; font-size: var(--t-sm); margin-bottom: var(--s-4); text-align: left; }
/* The 2FA field is always present but recedes until it is actually needed. */
.otp-quiet { opacity: .72; transition: opacity var(--dur); }
.otp-quiet:focus-within, .otp-quiet:hover { opacity: 1; }
.otp-live { padding: var(--s-3); margin: calc(var(--s-3) * -1); border-radius: var(--r-sm); background: var(--accent-tint); border: 1px solid var(--selected-rule); }

/* ── landing ─────────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: var(--s-8) var(--s-4) var(--s-7); border-bottom: 1px solid var(--rule); }
.hero-title { font-family: var(--font-display); font-size: clamp(2.2rem, 7vw, var(--t-3xl)); font-weight: var(--w-bold); letter-spacing: -0.035em; line-height: var(--lh-tight); margin: var(--s-2) 0 var(--s-3); }
.hero-sub { max-width: 54ch; margin: 0 auto var(--s-6); color: var(--ink-2); font-size: var(--t-md); }
.hero-actions { display: flex; gap: var(--s-3); justify-content: center; flex-wrap: wrap; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s-5); margin-top: var(--s-7); }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s-5); box-shadow: var(--shadow-1); }
.card-title { font-family: var(--font-display); font-size: var(--t-lg); font-weight: var(--w-semi); margin: 0 0 var(--s-3); letter-spacing: -0.02em; }
.card p { margin: 0; color: var(--ink-2); }
.snippet { background: var(--sunken); border: 1px solid var(--rule); border-radius: var(--r-sm); padding: var(--s-3); margin-top: var(--s-3); overflow-x: auto; }
.snippet code { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink); white-space: pre; }

/* ── numbered steps (landing + help) ─────────────────────────────────────── */
.steps { list-style: none; counter-reset: step; margin: var(--s-7) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s-5); }
.steps li { counter-increment: step; position: relative; padding-left: var(--s-7); }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 34px; height: 34px; border-radius: var(--r-round);
  display: grid; place-items: center;
  font-family: var(--font-sans); font-size: var(--t-sm); font-weight: var(--w-semi);
  color: var(--accent); background: var(--accent-tint); border: 1px solid var(--selected-rule);
}
.steps li h2 { font-family: var(--font-display); font-size: var(--t-md); font-weight: var(--w-semi); margin: 4px 0 var(--s-2); letter-spacing: -0.01em; }
.steps li p { margin: 0 0 var(--s-2); color: var(--ink-2); }
.steps li p:last-child { margin-bottom: 0; }
.steps .aside { font-size: var(--t-xs); color: var(--ink-3); }
/* On the help page the steps stack full-width so the prose can breathe. */
.doc .steps { grid-template-columns: 1fr; gap: var(--s-6); max-width: var(--measure, 68ch); }

/* ── help / prose document ───────────────────────────────────────────────── */
.doc { max-width: 74ch; margin: 0 auto; }
.doc-title { font-family: var(--font-display); font-size: var(--t-2xl); font-weight: var(--w-bold); letter-spacing: -0.03em; line-height: var(--lh-tight); margin: var(--s-2) 0 var(--s-3); }
.doc-lede { font-size: var(--t-md); color: var(--ink-2); margin: 0 0 var(--s-5); }
.doc-rule { border: none; border-top: 1px solid var(--rule); margin: var(--s-7) 0 var(--s-6); }
.doc-h2 { font-family: var(--font-display); font-size: var(--t-lg); font-weight: var(--w-semi); letter-spacing: -0.02em; margin: 0 0 var(--s-4); }
.faq { margin: 0; }
.faq dt { font-family: var(--font-sans); font-size: var(--t-sm); font-weight: var(--w-semi); color: var(--ink); margin-top: var(--s-4); }
.faq dd { margin: 4px 0 0; color: var(--ink-2); padding-left: 0; border-left: 2px solid var(--rule-faint); padding-left: var(--s-3); }
.doc-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-7); }

.tip { background: var(--gold-tint); border: 1px solid var(--rule-strong); border-left: 3px solid var(--gold);
  border-radius: var(--r-sm); padding: var(--s-3) var(--s-4); margin: 0 0 var(--s-4);
  font-size: var(--t-sm); color: var(--ink-2); }

/* ── browse ──────────────────────────────────────────────────────────────── */
.crumbs { font-family: var(--font-sans); font-size: var(--t-sm); margin-bottom: var(--s-4); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.crumb { text-decoration: none; color: var(--ink-2); }
.crumb:hover { color: var(--accent-deep); text-decoration: underline; }
.crumb.current { font-weight: var(--w-semi); color: var(--ink); }
.crumb-sep { color: var(--ink-3); }

.browse-bar { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-3); }
.counts { font-family: var(--font-sans); font-size: var(--t-sm); color: var(--ink-3); margin: 0; }
.filter { max-width: 280px; margin-left: auto; }

.listing { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; }
.listing thead th { text-align: left; font-family: var(--font-sans); font-size: var(--t-xs); font-weight: var(--w-semi); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); border-bottom: 1px solid var(--rule-strong); background: var(--surface-2); padding: 0; }
.listing thead th button { width: 100%; text-align: left; background: none; border: none; cursor: pointer; font: inherit; color: inherit; padding: var(--s-3) var(--s-4); text-transform: inherit; letter-spacing: inherit; }
.listing thead th button:hover { color: var(--accent-deep); }
.listing thead th[aria-sort] button::after { content: " ▾"; }
.listing thead th[aria-sort="ascending"] button::after { content: " ▴"; }
.listing td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--rule-faint); vertical-align: middle; }
.listing tr:last-child td { border-bottom: none; }
.listing tr.row:hover { background: var(--surface-2); }
.listing tr.up a { color: var(--ink-3); font-family: var(--font-sans); font-size: var(--t-sm); text-decoration: none; }
.col-name a { text-decoration: none; }
.col-name a:hover { text-decoration: underline; }
.col-size, .col-date { font-size: var(--t-sm); color: var(--ink-2); white-space: nowrap; }
.col-size { text-align: right; }
.col-act { text-align: right; white-space: nowrap; }
.col-act .btn + .btn { margin-left: var(--s-2); }
.ico { display: inline-block; width: 1.1em; color: var(--ink-3); }
.ico.dir { color: var(--gold); }
.ico.slide { color: var(--accent); }
.empty, .empty-filter td { color: var(--ink-3); font-style: italic; }

@media (max-width: 900px) {
  .site-nav { gap: var(--s-3); margin-left: var(--s-2); padding-left: var(--s-3); }
  .masthead-tag { display: none; }
}
@media (max-width: 720px) {
  main { padding: var(--s-5) var(--s-3); }
  .col-date { display: none; }
  .col-act .copy { display: none; }
  .masthead { padding: 0 var(--s-3); gap: var(--s-2); overflow-x: auto; }
  .site-nav .ext { display: none; }   /* keep the masthead usable on a phone */
  .who { display: none; }
}
