/* manim-editor landing — editorial minimalism, Apple register, tuned for a code tool. */

:root {
  /* Surface */
  --paper: #fff;
  --soft: #f5f5f7;
  --black: #000;
  --line: #d2d2d7;

  /* Ink */
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --accent: #0071e3;

  /* On black */
  --night-ink: #f5f5f7;
  --night-muted: #86868b;
  --night-line: #2a2a2c;

  /* Space — 4 / 8 / 16 / 24 / 40 / 64 / 96 / 160 */
  --s1: 4px;
  --s2: 8px;
  --s3: 16px;
  --s4: 24px;
  --s5: 40px;
  --s6: 64px;
  --s7: 96px;
  --s8: 160px;

  /* Radius */
  --r-component: 12px;
  --r-card: 18px;
  --r-panel: 22px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --sans: -apple-system, BlinkMacSystemFont, "Inter Tight", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;

  color-scheme: light;
}

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

html {
  font-family: var(--sans);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: 0; /* Body tracking stays neutral; only display sizes tighten. */
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, figure, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
img, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; }

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { text-decoration-thickness: 2px; }
/* Navigation, wordmarks and calls to action carry their own affordance. */
.skip-link, .wordmark, .nav-links a, .cta, .footer-links a, .download-alt a { text-decoration: none; }
.nav-links a:hover, .footer-links a:hover, .download-alt a:hover, .cta:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--s1); }
::selection { background: #cfe6ff; color: var(--ink); }

.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.inline-icon { width: 1em; height: 1em; vertical-align: -0.12em; transition: transform 200ms var(--ease); }

.wrap { width: min(1120px, calc(100% - var(--s5))); margin-inline: auto; }

.skip-link { position: fixed; top: -100px; left: var(--s3); z-index: 20; padding: var(--s3); background: var(--paper); border-radius: var(--r-component); box-shadow: 0 1px 3px rgb(0 0 0 / 8%); }
.skip-link:focus { top: var(--s2); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgb(255 255 255 / 82%);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 250ms var(--ease);
}
.site-header.is-stuck { border-bottom-color: var(--line); }

.navigation { display: flex; align-items: center; gap: var(--s5); min-height: 56px; }
.wordmark { display: inline-flex; align-items: center; gap: var(--s2); color: var(--ink); font-size: 16px; font-weight: 600; letter-spacing: -0.021em; white-space: nowrap; }
.wordmark:hover { text-decoration: none; }
.nav-links { margin-left: auto; display: flex; align-items: center; gap: var(--s4); }
.nav-links a { color: var(--ink); font-size: 13px; letter-spacing: 0; opacity: 0.82; transition: opacity 180ms var(--ease); }
.nav-links a:hover { opacity: 1; text-decoration: none; }

/* ---------- Type ---------- */

.eyebrow {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
  margin-bottom: var(--s4);
}

h1 {
  font-size: clamp(2.75rem, 6.4vw, 5rem);
  line-height: 1.05;
  letter-spacing: -0.028em; /* Display */
  font-weight: 600;
}

h2 {
  font-size: clamp(2rem, 4.2vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.028em; /* Display */
  font-weight: 600;
}

h3 {
  font-size: clamp(1.375rem, 2.2vw, 1.75rem);
  line-height: 1.2;
  letter-spacing: -0.021em; /* Headline */
  font-weight: 600;
}

.line-muted { color: var(--muted); }
.line-dim { color: var(--night-muted); }

.lede {
  font-size: clamp(1.0625rem, 1.5vw, 1.3125rem);
  line-height: 1.45;
  letter-spacing: -0.012em;
  color: var(--muted);
  max-width: 62ch;
  margin-top: var(--s4);
}
.lede-left { margin-inline: 0; }

.footnote { font-size: 14px; color: var(--muted); margin-top: var(--s5); max-width: 68ch; }

/* ---------- Sections ---------- */

.section { padding-block: var(--s8); }
.section-soft { background: var(--soft); }
.section-head { max-width: 68ch; }
.section-head .lede { margin-top: var(--s4); }

/* ---------- Hero ---------- */

.hero { padding-top: var(--s7); padding-bottom: var(--s8); }
.hero-copy h1 { max-width: 12ch; }
.hero-copy .lede { max-width: 46ch; }
.hero-cta { margin-top: var(--s5); }

.cta {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: 19px;
  letter-spacing: -0.012em;
  color: var(--accent);
}
.cta:hover { text-decoration: none; }
.cta:hover .inline-icon { transform: translateX(3px); }

.hero-figure { margin-top: var(--s7); }
.hero-figure figcaption,
.stage-caption { margin-top: var(--s4); font-size: 14px; color: var(--muted); }

.frame-video {
  width: 100%;
  aspect-ratio: 854 / 480;
  background: var(--black);
  border-radius: var(--r-panel);
  border: 1px solid var(--line);
}

/* ---------- Code → result ---------- */

.code-result {
  margin-top: var(--s7);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s5);
  align-items: start;
}

/* Each half is one panel with its own file header, so the two columns read as a
   pair of documents rather than as loose captions floating above two boxes. */
.pane {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  overflow: hidden;
}

.pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  padding: 14px var(--s4);
  border-bottom: 1px solid var(--line);
}
.pane-file { font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.pane-role { font-size: 12px; color: var(--muted); }

.pane pre { margin: 0; padding: var(--s4); overflow-x: auto; }
.pane code {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: 0;
  color: var(--ink);
  white-space: pre;
}
.pane .frame-video { border: 0; border-radius: 0; }

/* ---------- Stories ---------- */

.story {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: var(--s6);
  align-items: center;
  margin-top: var(--s8);
}
.story-reverse .story-copy { order: 2; }
.story-plain { grid-template-columns: 1fr; }
.story-copy p { margin-top: var(--s4); color: var(--muted); max-width: 54ch; }
.story-wide { max-width: 72ch; }
.story-wide p { max-width: 68ch; }

.story-media img {
  width: 100%;
  aspect-ratio: 36 / 25;
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  object-fit: cover;
}

/* ---------- The black section ---------- */

.stage {
  background: var(--black);
  color: var(--night-ink);
  padding-block: var(--s8);
  margin-block: 0;
}
.stage-head h2 { max-width: 16ch; }
.stage-video {
  width: min(920px, 100%);
  aspect-ratio: 854 / 480;
  margin: var(--s7) auto 0;
  border-radius: var(--r-card);
  background: var(--black);
}
.stage-caption { color: var(--night-muted); max-width: 64ch; }
.stage-caption a { color: var(--night-ink); text-decoration: underline; text-decoration-color: var(--night-line); }
.stage-caption a:hover { text-decoration-color: currentColor; }

/* ---------- Install ---------- */

.downloads { margin-top: var(--s7); }
.download-primary .cta { font-size: 21px; }
.download-alt { display: flex; flex-wrap: wrap; gap: var(--s5); margin-top: var(--s4); font-size: 15px; }

.requirements {
  margin-top: var(--s7);
  border-top: 1px solid var(--line);
}
.requirements > div {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--s5);
  padding-block: var(--s4);
  border-bottom: 1px solid var(--line);
}
.requirements dt { font-weight: 500; }
.requirements dd { color: var(--muted); }

.source { margin-top: var(--s7); }
.source-label { font-size: 15px; color: var(--muted); margin-bottom: var(--s3); }
.command {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s3) var(--s3) var(--s3) var(--s4);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-component);
  max-width: 640px;
}
.command code { min-width: 0; font-family: var(--mono); font-size: 13.5px; overflow-x: auto; white-space: nowrap; }
.copy {
  position: relative;
  margin-left: auto;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--s2);
  background: var(--paper);
  font-size: 13px;
  color: var(--muted);
  transition: color 180ms var(--ease), border-color 180ms var(--ease);
}
.copy:hover { color: var(--ink); border-color: var(--muted); }
.copy-done {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--paper);
  border-radius: var(--s2);
  color: var(--accent);
  opacity: 0;
  transition: opacity 180ms var(--ease);
}
.copy.is-copied .copy-done { opacity: 1; }

/* ---------- Limitations ---------- */

.limits { margin-top: var(--s7); border-top: 1px solid var(--line); max-width: 90ch; }
.limits li { padding-block: var(--s4); border-bottom: 1px solid var(--line); color: var(--muted); }
.limits strong { color: var(--ink); font-weight: 500; }
.limits code { font-family: var(--mono); font-size: 0.9em; }

/* ---------- Footer ---------- */

.site-footer { padding-block: var(--s6) var(--s7); border-top: 1px solid var(--line); }
.footer-inner { display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap; }
.footer-links { margin-left: auto; display: flex; flex-wrap: wrap; gap: var(--s5); font-size: 14px; }
.footer-links a { color: var(--ink); opacity: 0.82; }
.colophon { margin-top: var(--s5); font-size: 13px; color: var(--muted); max-width: 72ch; }

/* ---------- Reveal on scroll ----------
   Guarded by the `js` class so the page is fully legible without JavaScript. */

.js .reveal { opacity: 0; transform: translateY(24px); }
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 620ms var(--ease), transform 620ms var(--ease);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .code-result { grid-template-columns: 1fr; gap: var(--s6); }
  .story, .story-reverse { grid-template-columns: 1fr; gap: var(--s5); margin-top: var(--s7); }
  .story-reverse .story-copy { order: 0; }
  .requirements > div { grid-template-columns: 1fr; gap: var(--s2); }
}

@media (max-width: 640px) {
  :root { --s8: 96px; --s7: 64px; }
  body { font-size: 16px; }
  .wrap { width: calc(100% - var(--s5)); }
  .nav-links { gap: var(--s3); }
  .nav-links a:not(:last-child) { display: none; }
  .hero { padding-top: var(--s6); }
  .hero-copy { max-width: none; }
  .frame-video, .stage-video { border-radius: var(--r-card); }
  .download-alt { gap: var(--s4); }
  .footer-links { margin-left: 0; gap: var(--s4); }
}

/* ---------- Preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  /* Cross-fade only: never translate. */
  .js .reveal { transform: none; }
  .js .reveal.is-visible { transition: opacity 200ms linear; }
  .cta:hover .inline-icon { transform: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header { background: var(--paper); backdrop-filter: none; border-bottom-color: var(--line); }
}

@media (prefers-contrast: more) {
  :root { --muted: #45454a; --line: #8e8e93; --night-muted: #c7c7cc; }
  .nav-links a, .footer-links a { opacity: 1; }
  .frame-video, .story-media img { border-width: 2px; }
}
