/* Audiscene — colours follow the app's "Slate Ocean" theme (Styles.xaml / WavePalette.cs) */

:root {
  --bg: #14171a;
  --bg-deep: #101316;
  --panel: #181c20;
  --fg: #d8dde2;
  --muted: rgba(216, 221, 226, 0.72);
  --faint: rgba(216, 221, 226, 0.5);
  --hairline: rgba(216, 221, 226, 0.16);
  --hairline-strong: rgba(216, 221, 226, 0.35);
  --sand: #a8957f;
  --accent: #8fa9b0;
  --gold: #d6be8a;

  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  --font-text: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  --font-mono: "Cascadia Mono", "Cascadia Code", ui-monospace, Consolas, "SF Mono", Menlo, monospace;

  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body:lang(zh-Hant) { line-height: 1.8; letter-spacing: 0.02em; }

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration-color: var(--hairline-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

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

.skip {
  position: absolute; left: -9999px; top: 8px;
  background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 6px; z-index: 100;
}
.skip:focus { left: 8px; }

.badge {
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.04em;
  padding: 2px 8px;
  border: 1px solid var(--hairline-strong);
  border-radius: 4px;
  background: rgba(16, 19, 22, 0.35);
  white-space: nowrap;
}

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 20px;
  border-radius: 6px;
  background: var(--fg); color: var(--bg);
  font-weight: 600; font-size: 15px;
  text-decoration: none;
  transition: background 0.2s;
}
.btn:hover { background: #fff; }

/* ---------- title bar ---------- */

.bar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(20, 23, 26, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.bar.scrolled { border-bottom-color: var(--hairline); }

.bar .wrap { display: flex; align-items: center; gap: 24px; height: 60px; }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 20px; font-weight: 400;
  text-decoration: none;
  letter-spacing: 0;
}
.brand img { width: 26px; height: 26px; flex: none; }

.nav { display: flex; gap: 22px; margin-left: auto; font-size: 14px; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); }

/* language picker, styled like the app's source picker */
.lang { position: relative; font-size: 14px; }
.lang summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--hairline-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  user-select: none;
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover { background: rgba(255, 255, 255, 0.08); }
.lang summary svg { width: 15px; height: 15px; opacity: 0.8; }
.lang summary .chev { width: 10px; height: 10px; }
.lang ul {
  position: absolute; right: 0; top: calc(100% + 6px);
  margin: 0; padding: 4px; list-style: none; min-width: 160px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.lang li a {
  display: block; padding: 7px 12px; border-radius: 5px;
  text-decoration: none; color: var(--muted);
}
.lang li a:hover { background: rgba(255, 255, 255, 0.06); color: var(--fg); }
.lang li a[aria-current="true"] { color: var(--fg); }
.lang li a[aria-current="true"]::after { content: "  ·"; color: var(--accent); }

/* open / close motion; site.js holds the menu open until the close animation ends */
.lang summary .chev { transition: transform 0.2s ease; }
.lang[open]:not(.closing) summary .chev { transform: rotate(180deg); }
.lang ul { transform-origin: top right; }
.lang[open] ul { animation: menu-in 0.18s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.lang[open] li { animation: menu-item-in 0.22s ease both; }
.lang[open] li:nth-child(2) { animation-delay: 0.04s; }
.lang[open] li:nth-child(3) { animation-delay: 0.08s; }
.lang.closing ul { animation: menu-out 0.14s ease-in both; }
.lang.closing li { animation: none; }

@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.97); } }
@keyframes menu-out { to { opacity: 0; transform: translateY(-4px) scale(0.97); } }
@keyframes menu-item-in { from { opacity: 0; transform: translateY(-2px); } }

@media (max-width: 720px) {
  .nav { display: none; }
  .lang { margin-left: auto; }
}

/* ---------- home: one screen, no scrolling ---------- */

.home { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg-deep); }

.home .waves { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.home::before {
  /* keeps the copy readable over the brightest wave layers */
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(16, 19, 22, 0.82) 0%, rgba(16, 19, 22, 0.6) 45%, rgba(16, 19, 22, 0.25) 100%),
    linear-gradient(180deg, rgba(16, 19, 22, 0) 60%, rgba(16, 19, 22, 0.55) 100%);
}
.home > * { position: relative; z-index: 1; }
/* above .stage, so the language menu that drops over it stays clickable */
.home .bar { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; position: relative; z-index: 10; }

.stage {
  flex: 1;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: clamp(14px, 2.6vh, 32px) clamp(32px, 5vw, 72px);
  align-items: start;
  padding-top: clamp(8px, 3vh, 44px);
  padding-bottom: clamp(12px, 2.4vh, 28px);
}

.intro { grid-column: 1; }
body.home:lang(zh-Hant) .stage { line-height: 1.7; }

.eyebrow {
  margin: 0 0 10px;
  font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
}

.intro h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(34px, min(4.6vw, 7.4vh), 64px);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.intro h1:lang(zh-Hant) { line-height: 1.25; letter-spacing: 0.01em; font-size: clamp(32px, min(4.2vw, 6.6vh), 56px); }

.intro .sub { margin: 14px 0 0; max-width: 36em; font-size: clamp(16px, 2.1vh, 18px); color: var(--muted); }

.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: clamp(14px, 2.6vh, 28px); }
.cta small { color: var(--faint); font-size: 14px; }

/* tabs */
.tabs { grid-column: 1; align-self: end; }

.tablist {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: clamp(10px, 2vh, 20px);
  overflow-x: auto;
  scrollbar-width: none;
}
.tablist::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  padding: 10px 14px 12px;
  border: 0; background: none;
  color: var(--faint);
  font: inherit; font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
}
.tab:first-child { padding-left: 0; }
.tab:hover { color: var(--muted); }
.tab[aria-selected="true"] { color: var(--fg); }
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--sand); border-radius: 1px;
}
.tab:first-child[aria-selected="true"]::after { left: 0; }

/* all panels share one grid cell, so the block is always as tall as the longest one and nothing shifts */
.panels { display: grid; }
.panel { grid-area: 1 / 1; }
.panel:not([hidden]) { animation: panel-in 0.4s ease both; }
.panel[hidden] { display: block; visibility: hidden; }
.panel h2 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 600; font-size: clamp(19px, 2.6vh, 22px); line-height: 1.35; }
.panel p { margin: 0; color: var(--muted); max-width: 38em; font-size: 15px; }
.panel .chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.panel .note { margin-top: 10px; font-size: 13px; color: var(--faint); }

@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* theme swatches, drive the page background */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.swatch {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 7px;
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  background: rgba(16, 19, 22, 0.5);
  color: var(--muted);
  font: inherit; font-size: 13.5px;
  cursor: pointer;
}
.swatch i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2); }
.swatch:hover { color: var(--fg); }
.swatch[aria-pressed="true"] { color: var(--fg); border-color: var(--fg); }

/* screenshot that follows the selected tab */
.screens {
  grid-column: 2; grid-row: 1 / span 2;
  align-self: center;
  position: relative;
  margin: 0;
  aspect-ratio: 16 / 9;
  max-height: calc(100dvh - 200px);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  background: var(--panel);
}
.screens img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 0.6s ease;
}
.screens img.on { opacity: 1; }

.home .foot { border-top: 0; padding: 0 0 14px; }
.home .foot .wrap { align-items: center; }
.home .foot .tm { flex-basis: auto; margin: 0; }

/* site.js adds .fits only when the whole page fits the window; otherwise it scrolls normally */
html:has(body.home.fits) { overflow: hidden; height: 100%; }
body.home.fits { height: 100vh; height: 100dvh; overflow: hidden; }

@media (max-width: 959px) {
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .intro, .tabs, .screens { grid-column: 1; grid-row: auto; }
  .screens { max-height: none; }
}

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--hairline);
  padding: 36px 0 48px;
  font-size: 13.5px;
  color: var(--faint);
}
.foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: space-between; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.foot nav a { color: var(--muted); text-decoration: none; }
.foot nav a:hover { color: var(--fg); }
.foot .tm { flex-basis: 100%; margin: 8px 0 0; font-size: 12.5px; max-width: 64em; }

/* ---------- legal page ---------- */

.doc { padding: 64px 0 96px; }
.doc .wrap { max-width: 760px; }
.doc h1 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: clamp(32px, 4.4vw, 46px); line-height: 1.2; }
.doc .updated { margin: 10px 0 0; color: var(--faint); font-size: 14px; font-family: var(--font-mono); }
.doc .summary {
  margin: 36px 0 8px;
  padding: 22px 26px;
  border-left: 2px solid var(--sand);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 0 8px 8px 0;
}
.doc .summary p { margin: 0 0 8px; font-weight: 600; }
.doc .summary ul { margin: 0; padding-left: 1.1em; color: var(--muted); }
.doc h2 { margin: 48px 0 12px; font-family: var(--font-display); font-weight: 600; font-size: 22px; }
.doc h2 .n { font-family: var(--font-mono); font-size: 14px; color: var(--sand); margin-right: 10px; font-weight: 400; }
.doc p, .doc li { color: var(--muted); }
.doc strong { color: var(--fg); font-weight: 600; }
.doc ul { padding-left: 1.2em; }
.doc li { margin: 4px 0; }
.doc code { font-family: var(--font-mono); font-size: 0.88em; background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 4px; word-break: break-all; }

.table-scroll { overflow-x: auto; margin: 16px 0; }
.doc table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 520px; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--hairline); }
.doc th { font-weight: 600; font-size: 13px; color: var(--faint); letter-spacing: 0.04em; }
.doc td { color: var(--muted); }
.doc td:first-child { color: var(--fg); white-space: nowrap; }

/* ---------- small pages ---------- */

.center {
  min-height: 70vh; display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 40px var(--gutter);
}
.center h1 { font-family: var(--font-display); font-weight: 600; font-size: 40px; margin: 0 0 8px; }
.center p { color: var(--muted); margin: 6px 0; }
.center .langs { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; justify-content: center; }
.center .langs a {
  padding: 8px 18px; border: 1px solid var(--hairline-strong); border-radius: 6px; text-decoration: none;
}
.center .langs a:hover { background: rgba(255,255,255,0.06); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
