/*
 * The website (Design/spec/website.md). Colors, type and the panel come from the app's
 * tokens.css and components.css; only the page layout and the hero's motion live here.
 */

html { background: var(--bg); }
body.site {
  margin: 0;
  padding: 0;
  background: var(--bg);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-primary);
}

.site a { color: inherit; text-decoration: none; }
.site .wrap { width: min(1152px, 100% - 32px); margin: 0 auto; }

/* ---- Key caps: defaults shown next to what they do ----------------------- */

.site kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.04em 0.34em 0.02em;
  border: 1px solid var(--border);
  border-bottom-width: 0.1em;
  border-radius: 0.22em;
  background: var(--surface);
  font-family: var(--font-ui);
  font-size: 0.72em;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  color: var(--text-ink);
  vertical-align: 0.1em;
}

/* ---- Navigation ---------------------------------------------------------- */

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.site-nav .brand { display: flex; align-items: center; gap: 10px; }
.site-nav .brand .app-icon { --size: 28px; box-shadow: 0 0 0 1px var(--border); }
.site-nav .brand span {
  font-family: var(--font-brand);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 2px;
}
.site-nav nav { display: flex; gap: 28px; font-size: 14px; color: var(--text-secondary); }

/* ---- Hero: the panel, called up in the middle of the page --------------- */

.hero { padding: 88px 0 120px; text-align: center; }
.hero h1 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 72px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.06em;
  color: var(--text-ink);
}
/* The mark's caret (spec/brand.md §一): 0.86 of the ink height, a tenth as wide. */
.hero h1::after {
  content: "";
  display: inline-block;
  width: 0.08em;
  height: 0.8em;
  margin-left: 0.08em;
  background: var(--accent);
  vertical-align: -0.06em;
}
.hero .lede {
  max-width: 34em;
  margin: 24px auto 0;
  font-size: 18px;
  color: var(--text-secondary);
}
.hero .actions { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 36px; }
.site .download {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 26px;
  border-radius: 10px;
  background: var(--accent);
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-foreground);
}
.site .download:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.hero .actions small { font-size: 13px; color: var(--text-tertiary); text-wrap: balance; }
.hero .stage { display: flex; align-items: flex-start; justify-content: center; margin-top: 72px; text-align: left; }
/* The hero's motion (site.js), with the app's streaming tokens (spec/streaming-motion.md §二). */
.hero .source,
.hero .result {
  overflow: hidden;
  transition: height calc(var(--motion-height-ms) * 1ms) var(--motion-ease-height);
}
.hero .source > span { display: block; transition: opacity 180ms ease-out; }
.hero .source.changing > span { opacity: 0; }
.hero .result .text {
  transition: color calc(var(--motion-height-ms) * 1ms) ease-out,
    opacity calc(var(--motion-height-ms) * 1ms) ease-out;
}
.hero .result .text.clearing { opacity: 0; }
/* The app eases each glyph in with a cubic ease-out (StreamGlyphFadeAnimation), which shows a
 * new character sooner than CSS's ease-out would. */
.hero .result .arrive {
  animation: char-in calc(var(--motion-char-in-ms) * 1ms) cubic-bezier(0.33, 1, 0.68, 1) both;
}
@keyframes char-in {
  from { opacity: 0; filter: blur(calc(var(--motion-blur-char-px) * 1px)); }
}
.hero .result .cursor {
  transition: opacity calc(var(--motion-cursor-out-ms) * 1ms) var(--motion-ease-cursor-out);
}
.hero .result .cursor.breathing {
  animation: breathe calc(var(--motion-breathe-ms) * 0.5ms) var(--motion-ease-breathe) infinite alternate;
}
.hero .result .cursor.gone { opacity: 0; }
@keyframes breathe {
  to { opacity: var(--motion-cursor-opacity-min); }
}

/* A character behind the writing head, --o of the way through its fade in
 * (spec/streaming-motion.md §二.2): opacity 0 → 1 and blur motion-blur-char-px → 0. */
.char-in { opacity: var(--o); }
/* site.js lets the still frame's fading characters finish, on the same curve as a new one. */
.hero .result .char-in.settled {
  opacity: 1;
  filter: none;
  transition: opacity calc(var(--motion-char-in-ms) * 1ms) cubic-bezier(0.33, 1, 0.68, 1),
    filter calc(var(--motion-char-in-ms) * 1ms) cubic-bezier(0.33, 1, 0.68, 1);
}
/* WebKit rasterizes a filtered inline box at 1x, so only the clearly blurred characters
 * carry the filter; below ~0.6 px the blur cannot be seen anyway. */
.char-in.blurred { filter: blur(calc((1 - var(--o)) * var(--motion-blur-char-px) * 1px)); }

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

.site section.block { padding: 112px 0; border-top: 1px solid var(--border); }
.site h2 {
  margin: 0 0 56px;
  font-family: var(--font-brand);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-ink);
}
.site h3 { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.5; }
.site p { margin: 0; }
.muted { color: var(--text-secondary); }

/* Ways to use: one row per shortcut, the keys first, the clip beside them. */
.uses { display: flex; flex-direction: column; gap: 88px; }
.use { display: grid; grid-template-columns: 1fr 760px; gap: 56px; align-items: start; }
.use h3 { font-family: var(--font-brand); font-size: 26px; font-weight: 600; line-height: 1.4; color: var(--text-ink); }
.use .keys { margin-top: 14px; font-size: 20px; }
.use p { margin-top: 14px; font-size: 15px; color: var(--text-secondary); }
.site .section-note { margin: -40px 0 56px; font-size: 15px; color: var(--text-secondary); }
.clip {
  display: block;
  background: var(--surface-dim);
  width: 100%;
  aspect-ratio: 2544 / 1632;
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--border), 0 18px 48px #1A1A1812;
  object-fit: cover;
}

/* Install: a real sequence, so it is numbered. */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step);
  display: block;
  margin-bottom: 18px;
  font-family: var(--font-brand);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  color: var(--accent);
}
.steps p { margin-top: 10px; font-size: 15px; color: var(--text-secondary); }
.permissions { margin-top: 72px; border-top: 1px solid var(--border); }
.permissions .row { display: grid; grid-template-columns: 180px 1fr 1fr; gap: 32px; padding: 18px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.permissions .row b { font-weight: 600; }
.permissions .head { font-size: 13px; color: var(--text-tertiary); padding: 12px 0; }

/* Privacy: said on the result pane's paper, in the result pane's serif. */
.site section.privacy { background: var(--surface-paper); border-top: 1px solid var(--border); }
.privacy ul { display: flex; flex-direction: column; gap: 22px; max-width: 34em; margin: 0; padding: 0; list-style: none; }
.privacy li { font-family: var(--font-result-cjk); font-size: 22px; line-height: 1.75; color: var(--text-ink); }

/* Updates: the latest notes in the update panel the app shows. */
.updates { display: grid; grid-template-columns: 1fr 800px; gap: 56px; align-items: start; }
.updates h2 { margin-bottom: 20px; }
.updates .intro p { font-size: 15px; color: var(--text-secondary); }
.updates .more { display: inline-block; margin-top: 20px; font-size: 15px; font-weight: 600; color: var(--accent); }

/* Release notes (/releases/): one version per row, its notes in the result pane's serif. */
.releases-page h1 {
  margin: 56px 0 8px;
  font-family: var(--font-brand);
  font-size: 44px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-ink);
}
.releases-page .intro { margin-bottom: 40px; font-size: 15px; color: var(--text-secondary); }
.release { display: grid; grid-template-columns: 240px 1fr; gap: 56px; padding: 40px 0; border-top: 1px solid var(--border); }
.release h2 { margin: 0; font-size: 26px; }
.release time { display: block; margin-top: 6px; font-size: 14px; color: var(--text-tertiary); }
.release ul { display: flex; flex-direction: column; gap: 12px; max-width: 40em; margin: 0; padding: 0; list-style: none; }
.release li { font-family: var(--font-result-cjk); font-size: 17px; line-height: 1.85; color: var(--text-ink); }

/* Footer: one block in one voice. Every line is 14 px Inter on a 22 px rhythm; ink marks the
 * two names (辞达 and its maker), everything else is secondary. */
.site footer { padding: 56px 0 72px; border-top: 1px solid var(--border); font-size: 14px; line-height: 22px; color: var(--text-secondary); }
.site footer .wrap { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: start; }
.site footer .app-icon { --size: 44px; }
.site footer .credits b { display: block; font-family: var(--font-brand); font-size: 15px; font-weight: 600; letter-spacing: 1px; color: var(--text-ink); }
.site footer .credits a { color: var(--text-ink); }
.site footer nav { display: flex; gap: 24px; }
.site footer a { text-underline-offset: 0.2em; }
.site footer a:hover { color: var(--text-ink); text-decoration: underline; }

/* ---- Medium screens: a clip or a panel next to its text needs 1100 px ----- */

@media (max-width: 1100px) {
  .use, .updates { grid-template-columns: 1fr; gap: 28px; }
  .updates .panel { width: 100%; }
}

/* ---- Narrow screens ------------------------------------------------------ */

@media (max-width: 720px) {
  .site-nav { height: 60px; }
  .site-nav nav { gap: 18px; }
  .hero { padding: 48px 0 72px; }
  .hero h1 { font-size: 44px; }
  .hero .lede { font-size: 16px; }
  .hero .actions small { max-width: 22em; }
  .hero .stage { margin-top: 48px; }
  /* The panel reflows to the screen width like any other block. */
  .hero .stage .panel { width: 100%; }
  .site section.block { padding: 72px 0; }
  .site h2 { font-size: 26px; margin-bottom: 36px; }
  .use h3 { font-size: 22px; }
  .site .section-note { margin: -24px 0 36px; }
  .steps { grid-template-columns: 1fr; gap: 36px; }
  .permissions .row { grid-template-columns: 1fr; gap: 4px; }
  .permissions .head { display: none; }
  .privacy li { font-size: 18px; }
  .site footer .wrap { grid-template-columns: auto 1fr; }
  .site footer nav { grid-column: 2; }
  .releases-page h1 { margin-top: 32px; font-size: 32px; }
  .release { grid-template-columns: 1fr; gap: 16px; padding: 28px 0; }
}
