/* Thoth site. Style: the launch film (ink on paper, lights and cords). */

@font-face { font-family: 'Instrument Serif'; src: url('fonts/instrument-serif-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('fonts/instrument-serif-latin-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Inter Var'; src: url('fonts/inter-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'JBMono Var'; src: url('fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2'); font-weight: 100 800; font-style: normal; font-display: swap; }

:root {
  --bg: #F1ECE2; --panel: #FBF8F1; --ink: #1B1A17; --soft: #8E897D;
  --red: #E4472F; --amber: #F2A93B; --green: #3DA56A; --you: #2947D8; --off: #D8D2C5;
  --line: 3px;
  --serif: 'Instrument Serif', 'Songti SC', 'Noto Serif SC', serif;
  --sans: 'Inter Var', 'PingFang SC', 'Noto Sans SC', sans-serif;
  --mono: 'JBMono Var', 'PingFang SC', 'Noto Sans SC', monospace;
  --gutter: 32px;
  --shadow: 6px 8px 0 rgba(27, 26, 23, .1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 18px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
/* paper grain: printed on the whole page (and on the sticky header), never animated */
body { position: relative; }
body::before, .top::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url('img/grain.png') 0 0 / 900px 900px; opacity: .11; mix-blend-mode: multiply;
}
header, main, footer { position: relative; z-index: 1; }
.defs { position: absolute; }
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--you); outline-offset: 3px; border-radius: 6px; }

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

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1.5px solid rgba(27, 26, 23, .14); }
.top-row { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-size: 26px; line-height: 1; white-space: nowrap; }
.mark { width: 34px; height: 28px; flex: none; }
.nav { display: flex; align-items: center; gap: 26px; font-size: 15px; font-weight: 500; }
.nav a { text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav a:hover { border-bottom-color: var(--you); color: var(--you); }
.lang { display: flex; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--panel); }
.lang button { font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); background: none; border: 0; padding: 5px 11px; cursor: pointer; line-height: 1.3; }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }

/* ---------- type ---------- */
.title { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
h1.title { font-size: clamp(50px, 8.2vw, 116px); line-height: .98; }
#hero h1.title { font-size: clamp(40px, 5.3vw, 76px); line-height: 1.04; }
h2.title { font-size: clamp(38px, 4.6vw, 64px); line-height: 1.04; }
.title span, .title em { display: inline-block; }
.title em { font-style: italic; color: var(--you); }
.center { text-align: center; }
html[lang="zh"] .title { letter-spacing: 0; font-weight: 500; }
html[lang="zh"] h1.title { font-size: clamp(42px, 7vw, 96px); line-height: 1.12; }
html[lang="zh"] #hero h1.title { font-size: clamp(31px, 4.5vw, 64px); line-height: 1.22; }
html[lang="zh"] h2.title { font-size: clamp(32px, 4vw, 54px); line-height: 1.18; }
html[lang="zh"] .title em { font-style: normal; }
html[lang="zh"] body { line-height: 1.75; }

/* ---------- hero ---------- */
.hero { padding: 96px 0 0; text-align: center; }
.lead { max-width: 620px; margin: 28px auto 0; font-size: 20px; color: #4a4740; text-wrap: pretty; }
.cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 36px; }
.btn {
  display: inline-block; text-decoration: none; font-weight: 600; font-size: 16px; line-height: 1;
  padding: 15px 24px; border-radius: 14px; border: 2.5px solid var(--ink);
  background: var(--panel); color: var(--ink); box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-ink { background: var(--ink); color: var(--panel); }
.btn:hover { transform: translate(2px, 3px); box-shadow: 4px 5px 0 rgba(27, 26, 23, .1); }
.hero-scene { margin: 56px auto 0; width: 100%; max-width: 1280px; height: clamp(230px, 31vw, 440px); padding: 0 var(--gutter); }
.hero-scene:not(.mounted) { height: auto; }
.hero-scene .scene-fallback { max-height: 440px; height: auto; margin: 0 auto; }

/* ---------- scenes ---------- */
.scene { position: relative; }
.scene:not(.hero-scene) { aspect-ratio: 4 / 3; width: 100%; }
.scene-fallback { width: 100%; height: 100%; overflow: visible; }
.scene-mount { position: absolute; inset: 0; }
.hero-scene .scene-mount { inset: 0 var(--gutter); }
.scene.mounted .scene-fallback { display: none; }
.halo { mix-blend-mode: multiply; }
@keyframes breathe { from { opacity: .16; } to { opacity: .34; } }
.halo-needs { animation: breathe 1.4s ease-in-out infinite alternate; }

/* ---------- sections ---------- */
.band { padding: 128px 0; }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 72px; align-items: center; }
.split.flip .text { order: 2; }
.split.flip { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
.text p { margin-top: 24px; max-width: 30em; color: #4a4740; text-wrap: pretty; }

.because { margin: 0 0 18px !important; display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-style: italic; font-size: 22px; line-height: 1; color: var(--you) !important; }
.because::before { content: ''; flex: none; width: 13px; height: 13px; border-radius: 50%; background: var(--you); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--you); margin: 0 4px 0 5px; }
.because::after { content: ''; flex: none; width: 44px; height: 0; border-top: 3px solid var(--you); border-radius: 2px; }
html[lang="zh"] .because { font-style: normal; font-size: 18px; }
.soon { margin: 22px 0 0 !important; }
.soon span { display: inline-block; padding: 6px 14px; border: var(--line) solid var(--ink); border-radius: 999px; background: var(--panel); box-shadow: var(--shadow); font-family: var(--mono); font-size: 14px; letter-spacing: .02em; color: var(--ink); }
.states { list-style: none; padding: 0; margin: 32px 0 0; display: flex; flex-wrap: wrap; gap: 10px 26px; }
.states li { display: flex; align-items: center; gap: 6px; font-family: var(--serif); font-style: italic; font-size: 24px; line-height: 1; white-space: nowrap; }
.states svg { width: 44px; height: 44px; flex: none; overflow: visible; }
html[lang="zh"] .states li { font-style: normal; font-size: 20px; }

.ask {
  margin-top: 32px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 420px; padding: 8px 8px 8px 22px; border: 2.5px solid var(--ink); border-radius: 999px;
  background: var(--panel); box-shadow: var(--shadow);
}
.ask-text { font-size: 17px; min-width: 0; overflow-wrap: anywhere; }
.ask-text::after { content: ''; display: inline-block; width: 2px; height: 1.1em; margin-left: 3px; background: var(--you); vertical-align: -3px; }
.ask-send { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--you); display: grid; place-items: center; }
.ask-send svg { width: 22px; height: 22px; }

/* ---------- screenshots ---------- */
.shots { margin-top: 88px; }
.shots[hidden] { display: none; }
.shot-main { margin: 0; }
.shot-frame { border: var(--line) solid var(--ink); border-radius: 16px; overflow: hidden; background: var(--panel); box-shadow: 8px 10px 0 rgba(27, 26, 23, .1); }
.shot-frame img { width: 100%; height: auto; }
.shot-main figcaption { margin-top: 18px; text-align: center; font-family: var(--serif); font-style: italic; font-size: 22px; line-height: 1.3; }
html[lang="zh"] .shot-main figcaption { font-style: normal; font-size: 18px; }
.thumbs { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 22px; }
.thumbs button { padding: 0; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; background: var(--panel); cursor: pointer; width: 92px; height: 60px; opacity: .55; }
.thumbs button[aria-pressed="true"] { opacity: 1; border-color: var(--you); box-shadow: 0 0 0 2px var(--you); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.shots-phone { display: flex; justify-content: center; gap: 40px; flex-wrap: wrap; }
.shots-phone figure { margin: 0; width: min(260px, 100%); }
.shots-phone .shot-frame { border-radius: 30px; }
.shots-phone figcaption { margin-top: 16px; text-align: center; font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1.3; }
html[lang="zh"] .shots-phone figcaption { font-style: normal; font-size: 17px; }

/* ---------- film ---------- */
.film-frame { margin: 56px auto 0; max-width: 1040px; aspect-ratio: 16 / 9; border: var(--line) solid var(--ink); border-radius: 18px; overflow: hidden; background: var(--panel); box-shadow: 8px 10px 0 rgba(27, 26, 23, .1); }
.film-frame video { width: 100%; height: 100%; object-fit: cover; background: var(--bg); }
.film-empty { width: 100%; height: 100%; display: grid; place-items: center; }
.film-empty svg { width: min(320px, 70%); overflow: visible; }
.caption { margin-top: 26px; font-family: var(--serif); font-style: italic; font-size: 24px; line-height: 1.3; }
html[lang="zh"] .caption { font-style: normal; font-size: 19px; }

/* ---------- install ---------- */
.install { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 72px; align-items: start; }
.term { border: var(--line) solid var(--ink); border-radius: 16px; background: var(--panel); box-shadow: 8px 10px 0 rgba(27, 26, 23, .1); min-width: 0; }
.term-bar { display: flex; gap: 7px; padding: 13px 16px; border-bottom: 2.25px solid var(--ink); }
.term-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 10px 28px 0; }
.steps li { counter-increment: s; padding: 20px 0; border-bottom: 1.5px solid rgba(27, 26, 23, .12); }
.steps li:last-child { border-bottom: 0; }
.step { font-size: 16px; color: #4a4740; }
.step::before { content: counter(s); display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 10px; border: 2px solid var(--ink); border-radius: 50%; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--ink); line-height: 1; vertical-align: 1px; }
.step code, .note code { font-family: var(--mono); font-size: .92em; color: var(--ink); }
.cmd { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cmd code { font-family: var(--mono); font-size: 19px; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.cmd code::before { content: '$ '; color: var(--soft); }
.copy { flex: none; font: 600 13px/1 var(--sans); color: var(--ink); background: var(--bg); border: 2px solid var(--ink); border-radius: 9px; padding: 8px 12px; cursor: pointer; min-width: 68px; }
.copy:hover { border-color: var(--you); color: var(--you); }
.copy.done { background: var(--green); border-color: var(--ink); color: var(--ink); }
.note { margin: 0 28px; padding: 18px 0 24px; border-top: 1.5px solid rgba(27, 26, 23, .12); font-size: 15px; color: var(--soft); }

/* ---------- footer ---------- */
.foot { padding: 72px 0 88px; border-top: 1.5px solid rgba(27, 26, 23, .14); }
.foot-row { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.foot svg { width: 132px; overflow: visible; }
.foot p { font-family: var(--serif); font-style: italic; font-size: 22px; color: #4a4740; }
html[lang="zh"] .foot p { font-style: normal; font-size: 17px; }
.foot-link { font-family: var(--mono); font-size: 14px; color: var(--ink); text-decoration: none; padding: 6px 14px; border: 2px solid var(--ink); border-radius: 999px; background: var(--panel); }
.foot-link:hover { color: var(--you); border-color: var(--you); }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  :root { --gutter: 16px; }
  body { font-size: 17px; }
  .top-row { height: 56px; }
  .brand { font-size: 21px; gap: 7px; }
  .mark { width: 27px; height: 22px; }
  .nav { gap: 14px; font-size: 14px; }
  .lang button { padding: 4px 8px; font-size: 12px; }
  .hero { padding: 64px 0 0; }
  .lead { font-size: 18px; margin-top: 22px; }
  .hero-scene { margin-top: 36px; height: clamp(300px, 82vw, 380px); }
  .band { padding: 72px 0; }
  .split, .split.flip, .install { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .split.flip .text { order: 0; }
  .shots { margin-top: 48px; }
  /* phone screenshots: one row that scrolls sideways, so three phones do not make the page very long */
  .shots-phone {
    flex-wrap: nowrap; justify-content: flex-start; gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory;
    margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); padding: 0 var(--gutter) 18px;
    scroll-padding: 0 var(--gutter); -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .shots-phone::-webkit-scrollbar { display: none; }
  .shots-phone figure { flex: none; width: min(230px, 66vw); scroll-snap-align: start; }
  .shots-phone .shot-frame { border-radius: 26px; }
  .shot-frame { border-radius: 10px; border-width: 2px; }
  .thumbs button { width: 64px; height: 42px; }
  .film-frame { margin-top: 36px; border-radius: 12px; border-width: 2px; }
  .caption { font-size: 20px; }
  .steps { padding: 6px 18px 0; }
  .note { margin: 0 18px; }
  .cmd code { font-size: 16px; }
  .states li { font-size: 21px; }
  .states svg { width: 38px; height: 38px; }
}
@media (max-width: 400px) {
  .brand span { font-size: 19px; }
  .nav { gap: 11px; }
}

/* "through the brain first": a full-width flow (12 s loop) */
.flow-text { max-width: 760px; margin: 0 auto; text-align: center; }
.flow { width: min(1440px, 100% - 2 * var(--gutter)); margin: 56px auto 0; }
.flow-art { display: block; width: 100%; height: auto; overflow: visible; }
.flow-art text { fill: var(--ink); }
.f-ask { font-family: var(--sans); font-size: 19px; font-weight: 500; }
.f-label { font-family: var(--serif); font-style: italic; font-size: 26px; }
.f-adds { fill: var(--you) !important; }
.f-head { font-family: var(--serif); font-style: italic; font-size: 28px; }
.f-sub, .f-tag { font-family: var(--mono); font-size: 12.5px; fill: var(--soft) !important; }
.f-line { font-family: var(--sans); font-size: 15.5px; font-weight: 500; }
.f-list { transform: translateY(-380px); }
.f-dot, .f-chip, .f-packet { opacity: 0; }
.f-chip, .f-packet { transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .f-dot { animation: f-dot 12s infinite; }
  .f-list { animation: f-scroll 12s infinite; }
  .f-fade { animation: f-fade 12s infinite; }
  .f-hit { animation: f-hit 12s infinite; }
  .f-chip-a { animation: f-chip-a 12s infinite; }
  .f-chip-b { animation: f-chip-b 12s infinite; }
  .f-packet-a { animation: f-packet-a 12s infinite; }
  .f-packet-b { animation: f-packet-b 12s infinite; }
  .f-work { animation: f-work 12s infinite; }
}
@keyframes f-dot { 0%, 2% { opacity: 0; transform: none; } 4% { opacity: 1; transform: none; } 12% { opacity: 1; transform: translateX(70px); } 14%, 100% { opacity: 0; transform: translateX(70px); } }
@keyframes f-scroll { 0%, 14% { transform: none; } 32%, 94.9% { transform: translateY(-380px); } 95%, 100% { transform: none; } }
@keyframes f-fade { 0%, 90% { opacity: 1; } 94%, 96% { opacity: 0; } 99%, 100% { opacity: 1; } }
@keyframes f-hit { 0%, 32% { opacity: 0; } 36%, 90% { opacity: 1; } 94%, 100% { opacity: 0; } }
@keyframes f-chip-a { 0%, 38% { opacity: 0; transform: none; } 41% { opacity: 1; transform: none; } 52% { opacity: 1; transform: translate(190px, 34px) scale(.45); } 54%, 100% { opacity: 0; transform: translate(190px, 34px) scale(.45); } }
@keyframes f-chip-b { 0%, 40% { opacity: 0; transform: none; } 43% { opacity: 1; transform: none; } 53% { opacity: 1; transform: translate(190px, -118px) scale(.45); } 55%, 100% { opacity: 0; transform: translate(190px, -118px) scale(.45); } }
@keyframes f-packet-a { 0%, 52% { opacity: 0; transform: none; } 55% { opacity: 1; transform: none; } 66% { opacity: 1; transform: translate(225px, -120px) scale(.6); } 69%, 100% { opacity: 0; transform: translate(225px, -120px) scale(.6); } }
@keyframes f-packet-b { 0%, 53% { opacity: 0; transform: none; } 56% { opacity: 1; transform: none; } 67% { opacity: 1; transform: translate(225px, 150px) scale(.6); } 70%, 100% { opacity: 0; transform: translate(225px, 150px) scale(.6); } }
@keyframes f-work { 0%, 66% { opacity: 0; } 70%, 90% { opacity: 1; } 94%, 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .halo-needs { animation: none; }
  .btn { transition: none; }
}
