/* The Atlas design tokens (docs/designs/atlas-theme.md), with the Sakura pink
   and blue palette. The web UI and the desktop window both link this file;
   Android and iOS carry their own copy in `AppTheme.kt` and
   `Assets.xcassets`. A new colour needs a light and a dark value. */

:root {
  color-scheme: light dark;

  --color-bg: hsl(210 20% 98%);
  --color-surface: hsl(210 15% 96%);
  --color-surface-raised: hsl(0 0% 100%);
  --color-fg: hsl(220 25% 12%);
  --color-muted: hsl(215 10% 40%);
  --color-border: hsl(210 15% 88%);
  /* Sakura pink, three roles. The accent: focus ring, marker, tints, glow
     (3:1 on the page). */
  --color-primary: hsl(340 95% 57%);
  /* The fill: filled buttons, the end of the avatar gradient. A light pink,
     so the text on it is dark in both themes. */
  --color-primary-strong: hsl(345 100% 72%);
  --color-on-primary: hsl(220 25% 12%);
  /* Pink as text or a small icon on the page (4.5:1); the light fill fails. */
  --color-primary-deep: hsl(338 80% 42%);
  /* Blue: the second accent, the start of the avatar gradient, the second
     glow. Dark text on it. */
  --color-secondary: hsl(215 90% 72%);
  /* Blue as text (links): --color-secondary is too light on the page. */
  --color-secondary-strong: hsl(220 80% 48%);
  --color-on-secondary: hsl(220 25% 12%);
  --color-accent: hsl(165 70% 42%);
  --color-danger: hsl(0 75% 45%);
  --color-notice: hsl(35 90% 55%);
  --color-shadow: hsl(220 25% 12%);
  /* Behind and over a video, which is dark in either theme, so dark mode
     keeps these two as they are. */
  --color-video: hsl(220 25% 6%);
  --color-on-video: hsl(0 0% 100%);

  /* Derived from the colours above, so dark mode needs no second copy. */
  --color-glass: color-mix(in srgb, var(--color-bg) 70%, transparent);
  --color-hover: color-mix(in srgb, var(--color-fg) 6%, transparent);
  --color-glow: color-mix(in srgb, var(--color-primary) 12%, transparent);
  --color-glow-secondary: color-mix(in srgb, var(--color-secondary) 14%, transparent);
  --color-primary-soft: color-mix(in srgb, var(--color-primary) 14%, transparent);
  /* Text and icons on --color-primary-soft. */
  --color-primary-text: color-mix(in srgb, var(--color-primary-deep) 80%, var(--color-fg));
  /* A lighter fill, so its dark text gains contrast in both themes. */
  --color-primary-hover: color-mix(in srgb, var(--color-primary-strong) 80%, hsl(0 0% 100%));
  --color-accent-soft: color-mix(in srgb, var(--color-accent) 16%, transparent);
  --color-accent-text: color-mix(in srgb, var(--color-accent) 50%, var(--color-fg));
  --color-danger-soft: color-mix(in srgb, var(--color-danger) 10%, transparent);
  --color-notice-soft: color-mix(in srgb, var(--color-notice) 18%, transparent);
  --color-skeleton: color-mix(in srgb, var(--color-fg) 9%, transparent);
  --color-video-scrim: color-mix(in srgb, var(--color-video) 55%, transparent);
  /* The OBS overlay (`overlay.css`) sits on a stream's video and OBS has no
     theme to follow, so it has one look: these are never redefined for dark
     mode. Dark plates with white text; the pink and blue are the dark
     theme's light ones, which read on the plate (atlas-theme.md). */
  --color-overlay-plate: color-mix(in srgb, var(--color-video) 82%, transparent);
  --color-overlay-text: var(--color-on-video);
  --color-overlay-muted: color-mix(in srgb, var(--color-on-video) 75%, var(--color-video));
  --color-overlay-pink: hsl(345 100% 76%);
  --color-overlay-blue: hsl(215 90% 72%);
  --color-overlay-track: color-mix(in srgb, var(--color-on-video) 20%, transparent);
  --color-overlay-chip: color-mix(in srgb, var(--color-overlay-pink) 22%, transparent);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;

  --radius: 10px;
  --radius-small: 6px;
  --radius-pill: 999px;
  --border-width: 1px;
  --focus-width: 2px;

  --shadow-card: 0 1px 2px color-mix(in srgb, var(--color-shadow) 4%, transparent),
    0 6px 20px color-mix(in srgb, var(--color-shadow) 6%, transparent);
  --shadow-menu: 0 12px 36px color-mix(in srgb, var(--color-shadow) 18%, transparent);
  --blur: 12px;
  /* The OBS overlay's text and plates, over any video. */
  --shadow-overlay-text: 0 1px 2px var(--color-video);
  --shadow-overlay-plate: 0 0 0 var(--border-width) color-mix(in srgb, var(--color-overlay-pink) 40%, transparent),
    0 8px 32px color-mix(in srgb, var(--color-overlay-pink) 22%, transparent);

  --duration-fast: 150ms;
  --duration-enter: 250ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --distance-enter: 6px;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", "Noto Sans", sans-serif;
  --font-sans-zh: "Inter", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-sans-ja: "Inter", "Noto Sans JP", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.75rem;
  --text-2xl: 2.5rem;
  --text-display: 6rem;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --tracking-wide: 0.08em;
  --tracking-wordmark: 0.16em;
  --line-height: 1.5;
  --line-height-tight: 1.2;

  --size-icon: 20px;
  --size-control: 40px;
  --size-control-large: 48px;
  --size-avatar: 36px;
  --size-avatar-large: 64px;
  --size-header: 60px;
  --size-menu: 260px;
  --size-card-min: 260px;
  --size-heading-min: 140px;
  --size-control-small: 32px;
  --size-thumb: 96px;
  /* The party's volume slider. */
  --size-volume: 6rem;
  /* The party page: the side column (a queue row with a thumbnail and two
     lines; about 18rem at 1024 px wide, 23rem from about 1530 px), its
     collapsed strip, a queue row and its thumbnail, a search result card,
     how tall the open results may grow, the stage's height cap where the
     page scrolls, and the window height under which the page scrolls
     instead of fitting. The two window-height sizes use `vh` here and
     `dvh` below where the browser has it. */
  --size-party-side: clamp(18rem, 24vw, 23rem);
  --size-party-side-collapsed: var(--sidebar-width-collapsed);
  --size-queue-row: 3.5rem;
  --size-queue-thumb: 4rem;
  /* The phone remote: its column, its PIN field, and the PIN's spacing. */
  --width-remote: 36rem;
  --width-remote-pin: 16rem;
  --tracking-pin: 0.4em;
  --width-remote-value: 4.5rem;
  --size-check: 1.25rem;
  --size-result-card: 17rem;
  --size-party-results: min(33vh, 15rem);
  --size-party-stage-max: 70vh;
  --size-party-min-height: 36rem;
  --size-party-skeleton-block: 8rem;
  /* The OBS overlay, for a 1920×1080 browser source: its column, the
     progress bar's height, the edge on its plates, and the OBS panel in
     the room controls. */
  --size-overlay-column: 34rem;
  --size-overlay-progress: 0.5rem;
  --size-overlay-edge: 3px;
  --size-obs-menu: 22rem;
  --sidebar-width-collapsed: 72px;
  --sidebar-width-expanded: 280px;
  --width-content: 960px;
  --width-pet-gallery: 68.25rem;
  --text-pet-display: 4rem;
  --size-pet-portrait: 16rem;
  --size-pet-portrait-small: 12rem;
  --size-pet-stage: 24rem;
  --size-pet-stage-mobile: 15.625rem;
  --size-pet-phone-portrait: 14rem;
  --width-reading: 440px;
}

/* The browser's toolbar can cover part of `vh` on a phone; `dvh` is what is
   really visible. */
@supports (height: 1dvh) {
  :root {
    --size-party-results: min(33dvh, 15rem);
    --size-party-stage-max: 70dvh;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: hsl(220 20% 6%);
    --color-surface: hsl(220 18% 10%);
    --color-surface-raised: hsl(220 16% 13%);
    --color-fg: hsl(210 15% 93%);
    --color-muted: hsl(215 10% 62%);
    --color-border: hsl(220 15% 18%);
    /* The original Sakura pink (#ff85a3) in all three roles; near-black
       text on it. */
    --color-primary: hsl(345 100% 76%);
    --color-primary-strong: hsl(345 100% 76%);
    --color-on-primary: hsl(220 20% 6%);
    --color-primary-deep: hsl(345 100% 76%);
    --color-secondary: hsl(215 85% 72%);
    --color-secondary-strong: hsl(220 80% 65%);
    --color-on-secondary: hsl(220 20% 6%);
    --color-accent: hsl(165 65% 50%);
    --color-danger: hsl(0 80% 70%);
    --color-notice: hsl(35 85% 60%);
    --color-shadow: hsl(0 0% 0%);

    /* On a dark background a border reads better than a shadow. */
    --shadow-card: none;
    --shadow-menu: 0 12px 36px color-mix(in srgb, var(--color-shadow) 60%, transparent);
  }
}
