/* 宣纸与墨：night is ink, day is paper, vermilion is the only accent. System fonts only, so the page loads anywhere. */
:root {
  color-scheme: dark;
  --bg: #11100e;
  --surface: #181714;
  --surface-2: #1f1d19;
  --line: #2f2c27;
  --text: #ece6d8;
  --muted: #a39b8b;
  --faint: #756e62;
  --accent: #df5a42;
  --accent-hover: #ec7660;
  --on-accent: #fff8ee;
  --shadow: 0 40px 120px #0008;
  --serif: 'Iowan Old Style', Georgia, 'Songti SC', 'STSong', 'Noto Serif SC', 'Source Han Serif SC', 'Source Han Serif CN', 'SimSun', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-font-smoothing: antialiased;
}

:root[data-theme=light] {
  color-scheme: light;
  --bg: #f5f0e6;
  --surface: #eee7d8;
  --surface-2: #e7dfcd;
  --line: #dbd1bc;
  --text: #1f1c17;
  --muted: #645d50;
  --faint: #978e7e;
  --accent: #ae3626;
  --accent-hover: #8f2a1d;
  --on-accent: #fffaf1;
  --shadow: 0 30px 90px #4a3a2026;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%),
    var(--bg);
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
::selection { background: var(--accent); color: var(--on-accent); }
blockquote { margin: 0; }
cite { font-style: normal; }

.wrap { width: min(1160px, calc(100% - 80px)); margin-inline: auto; }
/* Header: transparent over the hero, a frosted band with a hairline once the page scrolls. */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid transparent;
  transition: background-color .3s, border-color .3s;
}
.header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom-color: var(--line);
}
.header-inner { height: 64px; display: flex; align-items: center; gap: 14px; }
.header-menu { display: flex; align-items: center; gap: 24px; margin-left: auto; margin-right: 10px; }
.header-nav { display: flex; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font: 600 18px var(--serif); white-space: nowrap; letter-spacing: .06em; }
.brand .logo { display: block; width: 30px; height: 30px; border-radius: 22%; }
:root:not([data-theme=light]) .brand .logo { box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 22%, transparent); }
.header-prefs { display: flex; align-items: center; gap: 24px; }
.pref { display: contents; }
.pref-label, .menu-toggle { display: none; }
.header-nav a, #language, #theme-toggle {
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .875rem;
  letter-spacing: .06em;
  line-height: 1;
  color: var(--muted);
  transition: color .2s;
}
:is(.header-nav a, #language, #theme-toggle):hover { color: var(--text); }
.header-nav a { min-inline-size: 4.5rem; }
:is(#language, #theme-toggle) { width: 1.25rem; flex-shrink: 0; letter-spacing: 0; }
:is(#language, #theme-toggle) svg {
  width: 1.125rem;
  height: 1.125rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#language svg { stroke-width: 1.8; }
#language:lang(zh) .language-zh,
#language:lang(en) .language-en { stroke: var(--accent); }
.header-download { inline-size: 6.5rem; flex-shrink: 0; padding: 7px 12px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: .8125rem; letter-spacing: .08em; text-align: center; white-space: nowrap; transition: background-color .2s; }
.header-download:hover { background: var(--accent-hover); }

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 13px 24px;
  border-radius: 999px;
  font-size: .9375rem;
  font-weight: 600;
  transition: background .2s, transform .2s;
}
.primary { background: var(--accent); color: var(--on-accent); }
.primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.text-link { display: inline-flex; align-items: center; gap: 10px; font-size: .9375rem; color: var(--muted); transition: color .2s; }
.text-link:hover { color: var(--text); }

/* Hero */
.hero { padding-top: clamp(56px, min(7vw, 10vh), 104px); text-align: center; }
.hero h1 { margin: 0; font: 600 clamp(2.5rem, 5.4vw, 4.25rem)/1.3 var(--serif); letter-spacing: .04em; }
body[data-lang=en] .hero h1 { font-size: clamp(2.25rem, 5vw, 4rem); }
.hero-description { margin: 26px auto 0; max-width: 48em; color: var(--muted); font-size: 1.0625rem; line-height: 1.95; word-break: keep-all; text-wrap: balance; }
.hero-actions { display: flex; justify-content: center; align-items: center; gap: 28px; margin-top: 32px; }
.platform-note { margin: 18px 0 0; color: var(--faint); font-size: .8125rem; }

/* Showcase */
.showcase { padding-block: clamp(48px, 5vw, 64px) 0; }
.product-capture { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.capture-mat { display: block; width: 100%; overflow: hidden; border-radius: 9px; background: #181818; line-height: 0; cursor: zoom-in; }
.capture-mat img { display: block; width: 100%; height: auto; transition: transform .4s ease; }
.capture-mat:hover img { transform: scale(1.006); }

/* Lightbox: fits the viewport first; a click on the image toggles a readable, scrollable zoom. */
.lightbox { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: #ece6d8; }
.lightbox::backdrop { background: #0b0a09ee; }
html:has(.lightbox[open]) { overflow: hidden; }
.lightbox-stage { width: 100%; height: 100%; overflow: auto; display: grid; place-items: center; padding: clamp(16px, 4vw, 48px); overscroll-behavior: contain; }
.lightbox-stage img { display: block; max-width: 100%; max-height: calc(100dvh - 2 * clamp(16px, 4vw, 48px)); width: auto; height: auto; border-radius: 8px; box-shadow: 0 30px 90px #000a; cursor: zoom-in; }
.lightbox.is-zoomed .lightbox-stage { place-items: start; }
.lightbox.is-zoomed .lightbox-stage img { width: max(1600px, 100%); max-width: none; max-height: none; cursor: zoom-out; }
.lightbox-close {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #ece6d84d;
  border-radius: 50%;
  background: #1f1d19ed;
  color: #ece6d8;
}
.lightbox-close::before,
.lightbox-close::after {
  content: '';
  grid-area: 1 / 1;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}
.lightbox-close::before { transform: rotate(45deg); }
.lightbox-close::after { transform: rotate(-45deg); }
.lightbox-close:hover { background: #2f2c27; }
.lightbox-close:focus-visible { outline-color: currentColor; }

/* Product introduction */
.features { padding-block: clamp(96px, 13vw, 160px) clamp(72px, 10vw, 120px); }
.section-heading { text-align: center; max-width: 720px; margin-inline: auto; }
.section-heading h2, .download h2 { margin: 0; font: 600 clamp(1.875rem, 3.6vw, 2.75rem)/1.4 var(--serif); letter-spacing: .03em; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 56px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--line);
}
.feature { padding: 34px 32px 36px; background: var(--bg); }
.feature h3 { margin: 0 0 20px; font: 600 1.25rem var(--serif); letter-spacing: .04em; }
.feature-verse { padding-left: 14px; border-left: 2px solid var(--accent); }
.feature-verse p { margin: 0; font: 400 1rem/1.8 var(--serif); letter-spacing: .03em; }
.feature-verse cite { display: block; margin-top: 8px; font: 400 .8125rem var(--serif); color: var(--faint); letter-spacing: .06em; }
.feature-verse cite::before { content: '— '; }
.feature > p { margin: 20px 0 0; color: var(--muted); font-size: .9375rem; line-height: 1.95; }

/* Download theatre: ink portraits on paper, separate from product screenshots. */
.download {
  position: relative;
  margin-bottom: 36px;
  padding: 64px 40px 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  text-align: center;
}
.download-verse { margin: 12px 0 0; font: 400 clamp(1rem, 2vw, 1.25rem)/1.8 var(--serif); color: var(--muted); }
.download-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 8px; text-align: center; }
.download-card { position: relative; display: flex; flex-direction: column; align-items: center; padding: 22px 26px 26px; cursor: pointer; }
.download-card + .download-card::before { content: ''; position: absolute; left: 0; top: 48px; bottom: 30px; border-left: 1px solid var(--line); }
.portrait-button { position: relative; display: block; width: 190px; height: 190px; max-width: 100%; flex-shrink: 0; border-radius: 50%; outline-offset: 0; }
.portrait-frame {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  background-image: url('assets/download-cast.png');
  background-size: 300% 200%;
  background-position: var(--portrait-x) 0%;
  background-repeat: no-repeat;
  border-radius: 50%;
  mix-blend-mode: multiply;
}
:root:not([data-theme=light]) .portrait-frame { mix-blend-mode: normal; }
.is-speaking .portrait-frame { background-position: var(--portrait-x) 100%; }
.download-card .character-name { margin: 10px 0 4px; font: 600 .9375rem var(--serif); letter-spacing: .08em; }
.character-name-en { height: 16px; font: italic 12px Georgia, serif; color: var(--faint); }
.character-speech { width: 100%; height: 128px; padding-top: 20px; opacity: 0; visibility: hidden; transform: translateY(5px); transition: opacity .2s, transform .2s; }
.is-speaking .character-speech { opacity: 1; visibility: visible; transform: translateY(0); }
.character-speech blockquote { font: italic 400 1.1875rem/1.5 var(--serif); color: var(--text); }
.download-card .original-quote { min-height: 16px; margin: 6px 0; font: italic 11px/1.6 Georgia, serif; color: var(--faint); }
.download-card h3 { margin: 14px 0 6px; font: 600 1.25rem var(--serif); }
.download-card .platform-detail { margin: 0 0 18px; font-size: .8125rem; color: var(--muted); }
.download-link, .coming-soon { display: flex; justify-content: center; width: 100%; max-width: 220px; margin-top: auto; padding: 12px 16px; border-radius: 999px; font-size: .875rem; }
.download-link { background: var(--accent); color: var(--on-accent); font-weight: 600; transition: background .2s; }
.download-link:hover { background: var(--accent-hover); }
.coming-soon { border: 1px solid var(--line); color: var(--faint); }
body[data-lang=en] .character-name-en { display: none; }
body[data-lang=en] .character-speech blockquote { font-size: 1.25rem; }

/* Linus glances at Jobs first, then Gates. Only the eye area changes. */
.download-card[data-platform=linux].is-speaking .portrait-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('assets/download-cast-linus-right.png');
  background-size: 300% 200%;
  background-position: 50% 100%;
  background-repeat: no-repeat;
  clip-path: polygon(32% 36%, 48% 36%, 48% 45%, 32% 45%, 32% 36%, 53% 36%, 69% 36%, 69% 45%, 53% 45%, 53% 36%);
  opacity: 0;
  animation: linus-look-around 4.8s step-end infinite;
}
@keyframes linus-look-around { 0%, 49.99% { opacity: 0; } 50%, 100% { opacity: 1; } }

/* Footer */
.credits {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 4px 8px;
  margin: 0;
  text-align: center;
}
.credits dt { color: var(--muted); font-size: .8125rem; }
.credits dd { margin: 0; font: 600 .875rem/1.6 var(--serif); }

.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px; padding: 4px 0 36px; }
.footer .brand { gap: 8px; font-size: 13px; letter-spacing: .12em; color: var(--muted); transition: color .2s; }
.footer .brand:hover { color: var(--text); }
.footer .brand .logo { width: 22px; height: 22px; }
.footer-copy { margin: 0; font-size: .75rem; letter-spacing: .08em; color: var(--faint); }

body[data-lang=en] :is(h1, h2, h3, .brand) { letter-spacing: -.005em; }

.snowfall {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
  color: #fff8ed;
  --snow-shadow: #fff6df55;
}
:root[data-theme=light] .snowfall { color: #fff; --snow-shadow: #62584485; }
.snowflake {
  position: absolute;
  top: 0;
  left: var(--snow-left);
  width: var(--snow-size);
  height: var(--snow-size);
  opacity: var(--snow-opacity);
  animation: snow-fall var(--snow-duration) linear var(--snow-delay) infinite;
}
.snowflake::before {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 2px var(--snow-shadow), 0 1px 2px var(--snow-shadow);
  animation: snow-sway calc(var(--snow-duration) / 3) ease-in-out var(--snow-delay) infinite alternate;
}
@keyframes snow-fall {
  from { transform: translateY(-12px); }
  to { transform: translateY(calc(100dvh + 12px)); }
}
@keyframes snow-sway {
  from { transform: translateX(calc(-1 * var(--snow-sway))); }
  to { transform: translateX(var(--snow-sway)); }
}

::view-transition-group(root) {
  animation-duration: 360ms;
  animation-timing-function: ease-in-out;
}

/* Reveal the day palette along a curved horizon in both directions. */
@property --theme-horizon-height {
  syntax: '<percentage>';
  inherits: false;
  initial-value: 0%;
}
:root[data-theme-transition]::view-transition-group(root),
:root[data-theme-transition]::view-transition-old(root),
:root[data-theme-transition]::view-transition-new(root) {
  animation: none;
}
:root[data-theme-transition]::view-transition-old(root),
:root[data-theme-transition]::view-transition-new(root) {
  mix-blend-mode: normal;
}
:root[data-theme-transition=sunrise]::view-transition-new(root),
:root[data-theme-transition=sunset]::view-transition-old(root) {
  mask-image: radial-gradient(ellipse 115% var(--theme-horizon-height) at 50% 100%, #000 93%, transparent 100%);
}
:root[data-theme-transition=sunrise]::view-transition-new(root) {
  animation: sunrise 740ms ease-in-out both;
}
:root[data-theme-transition=sunset]::view-transition-old(root) {
  z-index: 1;
  animation: sunset 740ms ease-in-out both;
}
@keyframes sunrise {
  0% {
    --theme-horizon-height: 0%;
    filter: sepia(.4) saturate(1.28);
  }
  65% { filter: sepia(.15) saturate(1.08); }
  100% {
    --theme-horizon-height: 124%;
    filter: none;
  }
}
@keyframes sunset {
  0% {
    --theme-horizon-height: 124%;
    filter: none;
  }
  60% { filter: sepia(.3) saturate(1.22) brightness(.92); }
  100% {
    --theme-horizon-height: 0%;
    filter: sepia(.46) saturate(1.3) brightness(.86);
  }
}

/* Scroll reveal, enabled only by script when motion is allowed. */
.motion .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s ease, transform .8s ease; }
.motion .reveal.is-visible { opacity: 1; transform: none; }

@media (max-width: 960px) {
  .wrap { width: calc(100% - 48px); }
  .download { padding-inline: 20px; }
  .download-card { padding-inline: 14px; }
  .portrait-button { width: 160px; height: 160px; }
  .character-speech { height: 136px; }
  .character-speech blockquote { font-size: 1rem; }
}

@media (max-width: 640px) {
  .snowflake:nth-child(n + 17) { display: none; }
  .wrap { width: calc(100% - 36px); }
  :root { scroll-padding-top: 76px; }
  .header-inner { height: 58px; gap: 6px; }
  .header.is-menu-open { background: var(--bg); border-bottom-color: var(--line); }
  .brand { font-size: 16px; gap: 7px; letter-spacing: .06em; }
  .brand .logo { width: 26px; height: 26px; }
  .header-download { inline-size: 5.5rem; margin-left: auto; padding: 6px 10px; font-size: .75rem; letter-spacing: .04em; }
  .menu-toggle { width: 38px; height: 38px; margin-right: -8px; display: grid; place-content: center; gap: 6px; color: var(--text); }
  .menu-toggle span { display: block; width: 18px; height: 1.5px; border-radius: 1px; background: currentColor; transition: transform .25s; }
  .is-menu-open .menu-toggle span:first-child { transform: translateY(3.75px) rotate(45deg); }
  .is-menu-open .menu-toggle span:last-child { transform: translateY(-3.75px) rotate(-45deg); }
  .header-menu { position: absolute; top: 100%; left: 0; right: 0; display: none; flex-direction: column; align-items: stretch; gap: 0; margin: 0; padding: 4px 18px 10px; background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: 0 18px 32px -24px rgb(0 0 0 / .5); }
  .is-menu-open .header-menu { display: flex; }
  .header-prefs { flex-direction: column; align-items: stretch; gap: 0; }
  .header-nav a { flex: 1; }
  .header-nav a, .pref { height: 52px; display: flex; align-items: center; justify-content: space-between; font-size: .9375rem; letter-spacing: .06em; color: var(--text); }
  .pref { position: relative; border-top: 1px solid var(--line); }
  .pref-label { display: block; }
  .header-nav a::after { content: "→"; }
  .header-nav a::after, #language, #theme-toggle { height: auto; font-size: .9375rem; color: var(--muted); }
  :is(#language, #theme-toggle)::before { content: ""; position: absolute; inset: 0; }
  .hero h1 { font-size: clamp(1.5rem, 8.4vw, 2.125rem); letter-spacing: 0; }
  body[data-lang=en] .hero h1 { font-size: 2rem; }
  .hero-description { font-size: 1rem; }
  .hero-actions { flex-wrap: wrap; gap: 18px; }
  .platform-note { font-size: .75rem; }
  .product-capture { padding: 6px; border-radius: 12px; }
  .capture-mat { border-radius: 7px; }
  .section-heading h2, .download h2 { font-size: clamp(1.375rem, 7.2vw, 1.875rem); letter-spacing: 0; }
  .feature-grid { grid-template-columns: 1fr; margin-top: 36px; border-radius: 12px; }
  .feature { padding: 28px 22px 30px; }
  .download { padding: 44px 10px 20px; border-radius: 14px; }
  .download-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .download-card { padding: 14px 6px; }
  .portrait-button { width: min(190px, calc(100% + 8px)); max-width: none; height: auto; aspect-ratio: 1; }
  .download-card + .download-card::before { top: 30px; bottom: 20px; }
  .download-card .character-name { min-height: 27px; margin-bottom: 0; font-size: 11px; letter-spacing: 0; line-height: 1.5; }
  .character-name-en { height: 23px; font-size: 10px; }
  .character-speech { height: 170px; padding-top: 12px; }
  .character-speech blockquote, body[data-lang=en] .character-speech blockquote { font-size: 13px; }
  .download-card .original-quote { font-size: 10px; line-height: 1.5; }
  .download-card h3 { margin-top: 10px; font-size: 15px; }
  .download-card .platform-detail { min-height: 22px; font-size: 11px; }
  .download-link, .coming-soon { padding: 10px 6px; font-size: 11px; }
}

@media (max-width: 370px) {
  .wrap { width: calc(100% - 28px); }
  .header-menu { padding-inline: 14px; }
  .feature { padding-inline: 18px; }
  .download-link, .coming-soon { padding: 9px 2px; font-size: 10px; line-height: 1.4; border-radius: 14px; }
  .character-speech { height: 190px; }
}

@media (prefers-reduced-motion: reduce) {
  .snowfall { display: none; }
  :root { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .download-card[data-platform=linux].is-speaking .portrait-frame::after { opacity: 0; }
}
