/* Tokens from src/styles.css of Toko (shadcn zinc palette). The dark
   tokens apply with the system theme, or with the choice of the theme
   button (data-theme on <html>). */
:root {
  color-scheme: light;
  --background: hsl(0 0% 100%);
  --foreground: hsl(240 10% 3.9%);
  --card: hsl(0 0% 100%);
  --muted: hsl(240 4.8% 95.9%);
  --muted-foreground: hsl(240 3.8% 46.1%);
  --border: hsl(240 5.9% 90%);
  --radius: 0.5rem;
  --shadow: 0 1px 2px hsl(240 10% 3.9% / 8%);
  --accent: var(--accent-light);
  --accent-foreground: var(--background);
  --header: 64px;
  --footer: 41px;
  --gap: 24px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: hsl(240 10% 3.9%);
  --foreground: hsl(0 0% 98%);
  --card: hsl(240 8% 8%);
  --muted: hsl(240 3.7% 15.9%);
  --muted-foreground: hsl(240 5% 64.9%);
  --border: hsl(240 3.7% 15.9%);
  --shadow: 0 1px 2px hsl(0 0% 0% / 40%);
  --accent: var(--accent-dark);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: hsl(240 10% 3.9%);
    --foreground: hsl(0 0% 98%);
    --card: hsl(240 8% 8%);
    --muted: hsl(240 3.7% 15.9%);
    --muted-foreground: hsl(240 5% 64.9%);
    --border: hsl(240 3.7% 15.9%);
    --shadow: 0 1px 2px hsl(0 0% 0% / 40%);
    --accent: var(--accent-dark);
  }
}

/* Accent of each product. #C4602F is 4.15:1 on white, so the light
   variant of Toko is darker to pass AA (4.99:1). The dark variants are
   lighter (7:1 or more on the dark background). */
html[data-product="toko"] { --accent-light: #B4532A; --accent-dark: #E0875A; }
html[data-product="toko-el"] { --accent-light: #6B3FA0; --accent-dark: #B794E6; }

/* Images and icons of one theme. */
.dark-only { display: none; }
:root[data-theme="dark"] .light-only { display: none; }
:root[data-theme="dark"] .dark-only { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .light-only { display: none; }
  :root:not([data-theme="light"]) .dark-only { display: block; }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: var(--header) 1fr var(--footer);
  grid-template-columns: minmax(0, 1fr);
  background: var(--background);
  color: var(--foreground);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
code, kbd, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: 0.9em; }
kbd, p code, figcaption code {
  padding: 0.05em 0.35em;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  background: var(--muted);
}
a { color: inherit; }
h1, h2, p, figure { margin: 0; }

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

/* Product switch: the elements of the other product are hidden.
   In a .swap box, both versions share one grid cell, so the box keeps
   the size of the larger one and nothing moves at a switch. */
html[data-product="toko"] [data-for="toko-el"]:not(.swap > *),
html[data-product="toko-el"] [data-for="toko"]:not(.swap > *) { display: none; }
html[data-product="toko"] .swap > [data-for="toko-el"],
html[data-product="toko-el"] .swap > [data-for="toko"] { visibility: hidden; }
.swap { display: grid; grid-template-columns: minmax(0, 1fr); }
.swap > * { grid-area: 1 / 1; }

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 var(--gap);
  border-bottom: 1px solid var(--border);
  background: var(--background);
}
.brand img { width: auto; height: 32px; }
.end { justify-self: end; display: flex; gap: 4px; }

.switch {
  display: flex;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--muted);
}
.switch button {
  min-width: 76px;
  padding: 5px 14px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.switch button[aria-pressed="true"] {
  background: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
}
.icon-button .icon { width: 18px; height: 18px; }
.icon-button:hover { background: var(--muted); }

/* Body */
.layout {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--gap);
  display: grid;
  gap: var(--gap);
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "intro" "stage" "features";
  align-content: start;
}
.intro { grid-area: intro; display: grid; gap: 12px; }
.features { grid-area: features; }
.stage { grid-area: stage; position: relative; }

h1 { font-size: 27px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
.lead { color: var(--muted-foreground); }
.family { font-size: 13px; color: var(--muted-foreground); }

.steps, .facts { margin: 0; padding: 0; list-style: none; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.steps li { display: grid; grid-template-columns: auto 1fr; align-items: center; align-content: start; gap: 2px 8px; font-size: 13px; }
.steps .icon { color: var(--accent); }
.steps strong { font-size: 14px; font-weight: 600; }
.steps span { grid-column: 1 / -1; color: var(--muted-foreground); }
.facts { display: flex; flex-wrap: wrap; gap: 6px; }
.facts li {
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background);
  color: var(--foreground);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.button:hover { background: var(--muted); }
.button.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-foreground); }
.button.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--foreground)); }

/* Feature tabs: the active tab has a tinted background. */
.tablist { display: grid; gap: 2px; }
[role="tab"] {
  display: grid;
  gap: 1px;
  padding: 5px 12px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--foreground);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
[role="tab"]:hover { background: var(--muted); }
[role="tab"][aria-selected="true"] { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tab-title { font-size: 14px; font-weight: 600; }
[role="tab"][aria-selected="true"] .tab-title { color: var(--accent); }
.tab-line { font-size: 13px; color: var(--muted-foreground); }

/* Player */
.player { display: grid; gap: 10px; }
.frame {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
  box-shadow: var(--shadow);
}
.frame video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; }
figcaption { min-height: 3lh; font-size: 14px; color: var(--muted-foreground); }

.stage[data-view="panel"] .player { display: none; }

/* Download and Install panels */
.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -6px -8px -4px 0; }
h2 { font-size: 18px; font-weight: 600; }
.version { color: var(--muted-foreground); font-weight: 500; }
.note, .status { font-size: 14px; color: var(--muted-foreground); }
.link { align-self: start; font-size: 14px; font-weight: 500; color: var(--accent); text-underline-offset: 3px; }

.systems { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.systems:empty { display: none; }
.system h3 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.system h3 small { font-size: 12px; font-weight: 500; color: var(--accent); }
.system ul { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.asset {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  font-size: 14px;
  text-decoration: none;
}
.asset:hover { background: var(--muted); }
.asset .format { font-weight: 600; }
.asset .meta { margin-left: auto; font-size: 13px; color: var(--muted-foreground); white-space: nowrap; }

.code { position: relative; }
.code pre {
  margin: 0;
  padding: 14px 52px 14px 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.code .copy { position: absolute; top: 6px; right: 6px; }
.code .copy:hover { background: var(--background); }
.copy .icon-check, .copy.done .icon-copy { display: none; }
.copy.done .icon-check { display: block; color: var(--accent); }

/* Footer */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--gap);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted-foreground);
}
.footer p { display: flex; justify-content: center; gap: 8px; }
.footer a { text-underline-offset: 3px; }
.footer a:hover { color: var(--foreground); }

@media (prefers-reduced-motion: no-preference) {
  .button, .icon-button, [role="tab"], .switch button, .asset { transition: background-color 120ms, color 120ms; }
}

/* Small screens: one column, normal page scroll. */
@media (max-width: 599px) {
  :root { --gap: 16px; }
  .topbar { grid-template-columns: auto 1fr auto; }
  .switch { justify-self: center; }
  .switch button { min-width: 0; padding: 5px 10px; }
  .brand img { height: 28px; }
  h1 { font-size: 26px; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .steps span { grid-column: auto; }
  .steps li { grid-template-columns: auto auto 1fr; }
}

/* Wide screens: two columns, the window does not scroll. */
@media (min-width: 900px) {
  body { height: 100dvh; overflow: hidden; }
  .layout {
    min-height: 0;
    column-gap: 48px;
    grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "intro stage" "features stage";
  }
  .features { min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px 4px; }
  .stage { min-height: 0; }
  /* The player fits in the window height: 16:10 video plus a 2 line caption. */
  .player { max-width: calc((100dvh - var(--header) - var(--footer) - 2 * var(--gap) - 2lh - 12px) * 1.6); }
  figcaption { min-height: 2lh; }
  .panel { position: absolute; inset: 0 0 auto; max-height: 100%; overflow-y: auto; }
  .stage[data-view="panel"] .player { display: grid; visibility: hidden; }
}
