/* ============================================================
   Sniplyst — presentation site
   Direction: a math-first flashcard app, set like lecture notes.
   Light = fine cool paper · Dark = blackboard.
   Type: Spectral (display) · IBM Plex Sans (body) · IBM Plex Mono (labels) · KaTeX (math)
   ============================================================ */

:root {
  --paper:    #f3f3f9;
  --raised:   #fbfbfe;
  --ink:      #1a1c46;
  --ink-soft: #5b5e8c;
  --indigo:   #3a40b0;
  --indigo-2: #2c318f;
  --amber:    #c5790a;
  --rule:     #e1e1ee;
  --wash:     #ececf8;
  --shadow:   0 1px 0 rgba(26,28,70,.04), 0 22px 48px -28px rgba(26,28,70,.35);

  --serif: "Spectral", ui-serif, Georgia, "Times New Roman", serif;
  --sans:  "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --measure: 880px;
  --doc:     720px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:    #0c0e2a;
    --raised:   #14173c;
    --ink:      #ecedf8;
    --ink-soft: #a7abd6;
    --indigo:   #aab4ff;
    --indigo-2: #c6ccff;
    --amber:    #f7b500;
    --rule:     #2a2e5e;
    --wash:     #181c46;
    --shadow:   0 1px 0 rgba(0,0,0,.3), 0 30px 60px -30px rgba(0,0,0,.7);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -0.012em; margin: 0; }
p { margin: 0 0 1rem; }
a { color: var(--indigo); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--indigo-2); }

/* utility: monospace eyebrow / label */
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 18px;
}

.wrap { width: 100%; max-width: var(--measure); margin: 0 auto; padding: 0 28px; }

:focus-visible { outline: 2.5px solid var(--indigo); outline-offset: 3px; border-radius: 4px; }

/* ---------- Header ---------- */
.masthead { border-bottom: 1px solid var(--rule); background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; }
.masthead .wrap { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.wordmark { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); }
.wordmark:hover { color: var(--ink); }
.wordmark img { width: 28px; height: 28px; border-radius: 7px; }
.wordmark b { font-family: var(--serif); font-weight: 600; font-size: 21px; letter-spacing: -0.01em; }
.mast-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 22px; font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase; }
.mast-nav a { color: var(--ink-soft); text-decoration: none; }
.mast-nav a:hover { color: var(--amber); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--rule); }
/* faint graph paper, the natural texture of the subject */
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, var(--rule) 1px, transparent 1px),
    linear-gradient(to bottom, var(--rule) 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: .32;
  -webkit-mask-image: radial-gradient(120% 80% at 50% 0%, #000 35%, transparent 78%);
          mask-image: radial-gradient(120% 80% at 50% 0%, #000 35%, transparent 78%);
}
.hero .wrap { position: relative; padding-top: 76px; padding-bottom: 84px; }
.hero-grid { display: grid; grid-template-columns: 1fr minmax(300px, 440px); gap: 54px; align-items: center; }
.hero h1 { font-size: clamp(2.5rem, 5.4vw, 3.9rem); font-weight: 500; letter-spacing: -0.02em; }
.hero h1 em { font-style: italic; color: var(--indigo); }
.lede { font-size: 1.18rem; color: var(--ink-soft); max-width: 30ch; margin: 22px 0 28px; }
.avail { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.05em; color: var(--ink-soft); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.avail .dot { color: var(--amber); }
.avail b { color: var(--ink); font-weight: 600; }

/* ---------- Flashcard (signature) ---------- */
.deck { text-align: center; }
.flashcard {
  appearance: none; border: 0; background: transparent; padding: 0; cursor: pointer;
  display: block; width: min(100%, 420px); margin: 0 auto; aspect-ratio: 5 / 3.4;
  perspective: 1600px; font: inherit; color: inherit; text-align: left;
}
.flip-inner { display: block; position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .72s cubic-bezier(.2,.75,.2,1); }
.flashcard.is-flipped .flip-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--raised); border: 1px solid var(--rule); border-radius: 16px;
  box-shadow: var(--shadow); padding: 26px 28px;
  display: flex; flex-direction: column;
}
.face--back { transform: rotateY(180deg); }
.face .tag { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-soft); }
.face--back .tag { color: var(--amber); }
.face .prompt { font-family: var(--serif); font-size: 1.5rem; line-height: 1.35; margin-top: auto; }
.face--back .answer { margin-top: auto; font-size: 1.18rem; }
.face .corner { position: absolute; top: 0; right: 0; width: 30px; height: 30px;
  background: linear-gradient(225deg, var(--wash) 0 50%, transparent 50%);
  border-top-right-radius: 16px; }
.deck .hint { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; color: var(--ink-soft); margin: 16px 0 0; }
.deck .hint span { color: var(--amber); }

/* ---------- Sections / rules ---------- */
.section { padding: 76px 0; border-bottom: 1px solid var(--rule); }
.section h2 { font-size: clamp(1.7rem, 3.6vw, 2.3rem); font-weight: 500; }
.section .intro { color: var(--ink-soft); max-width: 56ch; margin: 14px 0 0; }
.section-head { margin-bottom: 40px; }

/* Markdown -> math demo */
.render { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--rule); border-radius: 14px; overflow: hidden; background: var(--raised); box-shadow: var(--shadow); }
.render .col { padding: 26px 28px; }
.render .col + .col { border-left: 1px solid var(--rule); }
.render .col-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 16px; }
.render pre { font-family: var(--mono); font-size: 13.5px; line-height: 1.7; color: var(--ink); margin: 0; white-space: pre-wrap; word-break: break-word; }
.render pre .tok { color: var(--amber); }
.render .out p { margin: 0 0 12px; }
.render .out p:last-child { margin: 0; }
.render .katex-display { margin: .4em 0; }

/* Spaced-repetition ruler (signature) */
.ruler { margin-top: 8px; }
.ruler .track { position: relative; display: flex; align-items: flex-end; height: 96px; border-bottom: 2px solid var(--rule); }
.ruler .stop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.ruler .stop::after { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--paper); border: 2px solid var(--indigo); margin-bottom: -6.5px; }
.ruler .stop:last-child::after { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 0 5px color-mix(in srgb, var(--amber) 22%, transparent); }
.ruler .bar { width: 2px; background: var(--indigo); opacity: .5; }
.ruler .lab { font-family: var(--mono); font-size: 12px; color: var(--ink); margin-bottom: 12px; white-space: nowrap; }
.ruler .scale { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--ink-soft); margin-top: 12px; }

/* Theorem / axiom environment */
.axiom { border-left: 3px solid var(--amber); background: var(--wash); border-radius: 0 14px 14px 0; padding: 32px 36px; }
.axiom .label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--amber); margin-bottom: 14px; }
.axiom .stmt { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.25; margin: 0 0 16px; }
.axiom p { color: var(--ink-soft); max-width: 62ch; margin: 0 0 6px; }
.axiom .sig { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; color: var(--ink-soft); margin-top: 18px; }
.axiom .sig b { color: var(--ink); font-weight: 600; }

/* Definitions list (capabilities) */
.defs { display: grid; gap: 0; }
.defs .def { display: grid; grid-template-columns: 200px 1fr; gap: 28px; padding: 22px 0; border-top: 1px solid var(--rule); }
.defs .def:last-child { border-bottom: 1px solid var(--rule); }
.defs dt { font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em; color: var(--amber); font-weight: 500; }
.defs dd { margin: 0; color: var(--ink-soft); }
.defs dd b { color: var(--ink); font-weight: 600; font-family: var(--serif); font-size: 1.08rem; display: block; margin-bottom: 3px; }

/* ---------- Legal / document pages ---------- */
.doc { padding: 64px 0 88px; }
.doc .wrap { max-width: var(--doc); }
.doc h1 { font-size: clamp(2.1rem, 5vw, 2.9rem); font-weight: 500; letter-spacing: -0.02em; }
.doc .meta { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.04em; color: var(--ink-soft); margin: 14px 0 8px; }
.doc hr { border: 0; border-top: 1px solid var(--rule); margin: 28px 0 40px; }
.doc section { padding: 0; border: 0; margin: 0 0 30px; }
.doc h2 { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; display: flex; gap: 14px; align-items: baseline; margin-bottom: 10px; }
.doc h2 .no { font-family: var(--mono); font-size: 13px; color: var(--amber); font-weight: 500; flex: none; }
.doc p, .doc li { color: var(--ink); }
.doc ul { margin: 0 0 1rem; padding-left: 22px; }
.doc li { margin-bottom: 7px; }
.doc strong { font-weight: 600; }

/* ---------- Contact ---------- */
.contact { padding: 84px 0; }
.contact .wrap { max-width: 560px; text-align: center; }
.contact .deck { margin-top: 40px; }
.contact .flashcard { width: min(100%, 460px); aspect-ratio: 5/3; }
.contact .face .prompt { font-size: 1.6rem; }
.contact .face--back .answer { font-family: var(--mono); font-size: 1.05rem; }
.btn {
  display: inline-block; font-family: var(--sans); font-weight: 600; font-size: 16px;
  background: var(--indigo); color: #fff; padding: 13px 26px; border-radius: 11px;
  text-decoration: none; transition: transform .15s ease, background .15s ease;
}
.btn:hover { background: var(--indigo-2); color: #fff; transform: translateY(-1px); }
@media (prefers-color-scheme: dark) { .btn { color: #0c0e2a; } .btn:hover { color: #0c0e2a; } }
.contact .sub { color: var(--ink-soft); margin: 22px auto 30px; max-width: 44ch; }

/* ---------- Footer ---------- */
.colophon { padding: 44px 0; }
.colophon .wrap { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: baseline; justify-content: space-between; }
.colophon .about { font-family: var(--mono); font-size: 12.5px; line-height: 1.8; color: var(--ink-soft); max-width: 46ch; }
.colophon .about b { color: var(--ink); font-weight: 600; }
.colophon .qed { color: var(--amber); }
.colophon nav { display: flex; flex-wrap: wrap; gap: 18px; font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.04em; text-transform: uppercase; }
.colophon nav a { color: var(--ink-soft); text-decoration: none; }
.colophon nav a:hover { color: var(--amber); }

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .deck { order: -1; }
  .lede { max-width: none; }
  .render { grid-template-columns: 1fr; }
  .render .col + .col { border-left: 0; border-top: 1px solid var(--rule); }
  .defs .def { grid-template-columns: 1fr; gap: 6px; }
  .mast-nav { gap: 16px; font-size: 11.5px; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 20px; }
  .mast-nav a:first-child { display: none; }
  .ruler .lab { font-size: 11px; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .flip-inner { transition: none; }
  .btn { transition: none; }
}
