/* Download / landing page (#8). Uses the app's tokens from ../styles.css; the app's body is a fixed
   canvas (overflow hidden), this page scrolls like a document.
   Direction: a studio render on lab paper. Deep navy headings, the magenta accent used sparingly, a
   matte "clay" 3D molecule on dotted paper with numbered callouts on leader lines, numbered section
   kickers, one cut-corner button, pixel clusters where the paper breaks up. */
/* The header's in-page links glide to their section instead of jumping (owner, 13 Nov 2026); each section
   stops a little below the top edge. This stylesheet loads only on the home page. */
html { scroll-behavior: smooth; }
.dl section[id] { scroll-margin-top: 24px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body.page-download {
  overflow: auto;
  background: var(--panel);
  --dl-navy: #262a4a;
  --dl-max: 1160px;
  --dl-gutter: clamp(16px, 4vw, 40px);
  --dl-space: clamp(64px, 9vw, 128px);
  --dl-h1: clamp(2.4rem, 1.1rem + 4.8vw, 4.8rem);
  --dl-h2: clamp(1.6rem, 1.1rem + 1.6vw, 2.4rem);
  --dl-ease: cubic-bezier(0.16, 1, 0.3, 1);
}
:root[data-theme="dark"] body.page-download { --dl-navy: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.page-download { --dl-navy: var(--ink); } }

.dl { position: relative; max-width: var(--dl-max); margin: 0 auto; padding: 0 var(--dl-gutter) 64px; overflow-x: clip; }
.dl h1, .dl h2, .dl h3 { font-family: var(--font-display); color: var(--dl-navy); margin: 0; }
.dl a { color: var(--accent); }
.dl :focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* Header: links sit under a hairline that turns accent on hover, like ruled tabs. */
.dl-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 0; }
.dl-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 700 1.2rem var(--font-display); color: var(--dl-navy) !important; }
.dl-nav { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 32px); }
.dl-nav a { position: relative; padding-top: 10px; color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.dl-nav a::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--line); transition: background 200ms, height 200ms; }
.dl-nav a:hover { color: var(--accent); }
.dl-nav a:hover::before { background: var(--accent); height: 2px; }

/* Kickers: "01 — INSTALL" */
.dl-kicker { font: 500 0.76rem var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.dl-kicker-n { color: var(--accent); }

/* Hero */
.dl-hero { position: relative; display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: clamp(24px, 4vw, 56px); align-items: center; padding: clamp(28px, 6vw, 80px) 0 var(--dl-space); }
.dl-hero h1 { font-size: var(--dl-h1); line-height: 1.02; letter-spacing: -0.03em; max-width: 13ch; text-wrap: balance; }
.dl-lead { font-size: clamp(1.02rem, 0.95rem + 0.3vw, 1.15rem); color: var(--ink-2); max-width: 44ch; margin: 22px 0 30px; }
.dl-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.dl-btn { min-height: 50px; padding: 0 24px; font-size: 0.98rem; text-decoration: none; display: inline-flex; align-items: center; gap: 12px; }
.dl .btn.primary { color: var(--accent-ink); }
/* One cut corner, bottom right: the hexagon's edge in a button. */
.dl-notch { border-radius: 4px; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%); padding-right: 30px; }
.dl-arrow { display: inline-block; transition: transform 300ms var(--dl-ease); }
.dl-notch:hover .dl-arrow { transform: translateX(5px); }
.dl-notch:active { transform: translateY(1px); }
.dl-fine { color: var(--muted); font-size: 0.84rem; margin: 16px 0 0; }

.dl-figure { margin: 0; position: relative; padding-bottom: 28px; }
.dl-stage {
  position: relative; aspect-ratio: 1 / 0.86; border-radius: 22px; overflow: hidden;
  background-color: var(--bench);
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.3px), radial-gradient(120% 90% at 30% 20%, transparent 40%, var(--panel-2));
  background-size: 18px 18px, 100% 100%;
  box-shadow: 0 1px 0 var(--line), 0 30px 60px -30px rgba(38, 42, 74, 0.35);
}
.dl-stage-svg { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; cursor: grab; touch-action: pan-y; } /* a vertical swipe scrolls the page; sideways turns the model */
.dl-stage-svg:active { cursor: grabbing; }
/* The figure is for turning and looking at, not for selecting text (Safari selects it on drag). */
.dl-figure { user-select: none; -webkit-user-select: none; }

/* Callouts on leader lines */
.dl-callout { position: absolute; display: flex; flex-direction: column; gap: 2px; pointer-events: none; }
.dl-callout strong { font: 600 1.25rem var(--font-display); color: var(--dl-navy); letter-spacing: -0.01em; }
.dl-callout strong sub { font-size: 0.7em; }
.dl-callout span { font: 500 0.68rem var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.dl-callout::before { content: ''; position: absolute; height: 2px; width: 34px; background: var(--accent); bottom: -8px; left: 0; }
.dl-callout::after { content: ''; position: absolute; height: 1px; width: 70px; background: var(--muted); opacity: 0.5; transform-origin: left center; }
.dl-callout-a { top: 9%; left: 7%; }
.dl-callout-a::after { left: 34px; bottom: -8px; transform: rotate(32deg); }
.dl-callout-b { top: 12%; right: 7%; text-align: right; align-items: flex-end; }
.dl-callout-b::before { left: auto; right: 0; }
.dl-callout-b::after { right: 34px; left: auto; bottom: -8px; transform-origin: right center; transform: rotate(-32deg); }
.dl-callout-c { bottom: 9%; right: 8%; text-align: right; align-items: flex-end; }
.dl-callout-c::before { left: auto; right: 0; }
.dl-callout-c::after { right: 34px; left: auto; top: -10px; transform-origin: right center; transform: rotate(28deg); }

/* The 2D drawing as a paper card laid over the corner of the stage. */
.dl-flat {
  position: absolute; left: -18px; bottom: 0; width: min(44%, 230px); margin: 0;
  background: var(--bench); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 8px;
  box-shadow: 0 18px 40px -18px rgba(38, 42, 74, 0.45); transform: rotate(-3deg);
  transition: transform 500ms var(--dl-ease);
}
.dl-figure:hover .dl-flat { transform: rotate(0deg) translateY(-4px); }
.dl-flat-art svg { width: 100%; height: auto; display: block; }
.dl-flat figcaption { font: 500 0.66rem var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
/* Starts past the tilted 2D card (its width minus its -18px offset, plus room for the tilt and shadow). */
.dl-figure-cap { margin-top: 18px; padding-left: calc(min(44%, 230px) - 18px + 50px); color: var(--muted); font-size: 0.84rem; }
.dl-figure-flat-only .dl-stage { display: none; }
.dl-figure-flat-only .dl-flat { position: static; width: 100%; transform: none; }

/* Pixel clusters */
.dl-pixels { position: absolute; color: var(--accent); opacity: 0.18; pointer-events: none; }
.dl-pixels rect { fill: currentColor; }
.dl-pixels-hero { top: 8px; right: 34%; }
.dl-pixels-maker { right: 0; top: 0; color: var(--dl-navy); opacity: 0.12; }

/* Sections */
.dl-get, .dl-examples, .dl-why { padding-bottom: var(--dl-space); }
.dl h2 { font-size: var(--dl-h2); letter-spacing: -0.02em; margin-bottom: 10px; }
.dl-section-lead { color: var(--ink-2); margin: 0 0 28px; }
.dl-get h2 { margin-bottom: 28px; }
.dl-reveal { opacity: 0; transform: translateY(28px); transition: opacity 700ms var(--dl-ease), transform 900ms var(--dl-ease); }
.dl-reveal.is-in { opacity: 1; transform: none; }

.dl-cards { display: grid; grid-template-columns: 1.3fr 1fr 0.7fr; gap: 16px; align-items: start; }
.dl-card { background: var(--bench); border: 1px solid var(--line); border-radius: 14px; padding: 26px; display: flex; flex-direction: column; gap: 12px; }
.dl-card h3 { font-size: 1.3rem; }
.dl-card p { margin: 0; color: var(--ink-2); }
.dl-card .btn { align-self: flex-start; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.dl-card-main { border-top: 4px solid var(--accent); box-shadow: 0 24px 48px -28px rgba(38, 42, 74, 0.35); }
.dl-card-quiet { background: transparent; border-style: dashed; }
.dl-steps { margin: 4px 0; padding-left: 0; list-style: none; counter-reset: step; display: grid; gap: 12px; }
.dl-steps li { counter-increment: step; display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; }
.dl-steps li::before {
  content: counter(step, decimal-leading-zero); padding-top: 2px;
  font: 500 0.78rem var(--font-mono); color: var(--accent); border-top: 2px solid var(--accent);
}
.dl-note { font-size: 0.86rem; color: var(--muted) !important; border-left: 3px solid var(--line); padding-left: 10px; }


/* Why */
.dl-points { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 48px; margin: 28px 0 0; }
.dl-points dt { font: 600 1.12rem var(--font-display); color: var(--dl-navy); padding-top: 16px; border-top: 2px solid var(--dl-navy); }
.dl-points dd { margin: 8px 0 0; color: var(--ink-2); }

.dl-foot { border-top: 1px solid var(--line); padding-top: 24px; color: var(--muted); font-size: 0.86rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.dl-foot p { margin: 0; }
.dl-maker-role { display: flex; flex-wrap: wrap; margin-top: 4px !important; color: var(--muted); }
.dl-maker-role span + span::before { content: '·'; padding: 0 0.5em; color: var(--line); }

@media (max-width: 900px) {
  .dl-cards { grid-template-columns: 1fr 1fr; }
  .dl-card-quiet { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .dl-hero { grid-template-columns: 1fr; }
  .dl-figure { order: -1; }
  .dl-figure { padding-bottom: 0; }
  .dl-flat { position: relative; left: 8px; width: 52%; margin-top: -72px; }
  .dl-figure-cap { padding-left: 0; padding-top: 4px; }
  .dl-callout strong { font-size: 1rem; }
  .dl-pixels-hero { display: none; }
  .dl-cards, .dl-points { grid-template-columns: 1fr; }
  .dl-nav a { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .dl-reveal, .dl-reveal.is-in, .dl-flat, .dl-arrow { transition: none; transform: none; opacity: 1; }
}

/* Thai has no capitals: tracked monospace labels pull its letters apart. Plain body text instead. */
:root[lang="th"] .dl-kicker, :root[lang="th"] .dl-callout span,
:root[lang="th"] .dl-flat figcaption {
  font-family: var(--font-body); letter-spacing: 0; text-transform: none; font-size: 0.8rem;
}
@media (max-width: 720px) {
  .dl-maker-role { flex-direction: column; }
  .dl-maker-role span + span::before { content: none; }
  .dl-pixels-maker { display: none; }
}
/* Thai marks above and below the line (ที่, ปุ่ม) need more leading than Latin. */
:root[lang="th"] .dl-hero h1 { line-height: 1.2; }
:root[lang="th"] .dl h2 { line-height: 1.3; }
