/* Modernist design system — shared tokens + components for the Subtii
   redesign. Linked from every in-scope page (landing, login-failed, viewer2,
   sessions, host). Ported from the Claude Design "Modernist" system with the
   red accent (option 3b). */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700;900&family=IBM+Plex+Mono:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;600;800&display=swap');

:root {
  --color-bg: #f3f2f2;
  --color-surface: #eae9e9;
  --color-text: #201e1d;
  --color-accent: #ec3013;
  --color-divider: color-mix(in srgb, #201e1d 40%, transparent);

  --color-neutral-100: #f8f4f4;
  --color-neutral-200: #eae7e7;
  --color-neutral-300: #d7d3d3;
  --color-neutral-400: #bab6b6;
  --color-neutral-500: #9b9797;
  --color-neutral-600: #7d7979;
  --color-neutral-700: #605d5d;
  --color-neutral-800: #444141;
  --color-neutral-900: #2d2b2b;

  --color-accent-100: #fff2ef;
  --color-accent-200: #ffe0d9;
  --color-accent-300: #ffc4b8;
  --color-accent-400: #ff9783;
  --color-accent-500: #ff563c;
  --color-accent-600: #dd2b0f;
  --color-accent-700: #ae1800;
  --color-accent-800: #7c1405;
  --color-accent-900: #4d170e;

  --font-heading: "Archivo", "Noto Sans TC", system-ui, sans-serif;
  --font-body: "Archivo", "Noto Sans TC", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

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

  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;

  --shadow-sm: 0 1px 2px color-mix(in srgb, #2d2b2b 14%, transparent);
  --shadow-md: 0 3px 10px color-mix(in srgb, #2d2b2b 16%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, #2d2b2b 22%, transparent);
}

/* An operational/"cockpit" page (host, sessions) opts into the dark ramp by
   putting `theme-dark` on <body>. Viewer additionally offers this as a
   viewer-toggleable class on #app (see viewer2.css). */
.theme-dark {
  --color-bg: var(--color-neutral-900);
  --color-surface: var(--color-neutral-800);
  --color-text: var(--color-neutral-100);
  --color-divider: var(--color-neutral-700);
  --color-accent-100: var(--color-accent-900);
}

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

html, body { margin: 0; }
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading); font-weight: 800;
  line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 var(--space-2);
}
h1 { font-size: 42px; }
h2 { font-size: 32px; }
h3 { font-size: 25px; }
h4 { font-size: 20px; }
h5 { font-size: 16px; }
h6 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent); text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
.m, .mono { font-family: var(--font-mono); }
.text-muted { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.hr { height: 2px; border: 0; margin: var(--space-4) 0; background: var(--color-divider); }

/* — buttons — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: 800;
  font-size: 14px; line-height: 1.2; color: var(--color-text);
  background: transparent; border: 1px solid transparent;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border-radius: var(--radius-md);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--color-accent); color: var(--color-bg); }
.btn-primary:hover { background: var(--color-accent-600); }
.btn-primary:active { background: var(--color-accent-700); }
.btn-secondary { border-color: var(--color-divider); color: inherit; }
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn-ghost { color: var(--color-accent); padding-inline: var(--space-1); background: none; }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-block { width: 100%; }

/* — forms — */
.field > label { display: block; font-size: 12px; margin-bottom: 5px; color: color-mix(in srgb, var(--color-text) 70%, transparent); }
.input {
  width: 100%; min-height: 36px; padding: 6px 10px; font: inherit;
  font-size: 14px; color: var(--color-text); caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
textarea.input { min-height: 70px; resize: vertical; }

/* — cards — */
.card {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface);
}
.elev-sm { box-shadow: var(--shadow-sm); }
.elev-md { box-shadow: var(--shadow-md); }
.elev-lg { box-shadow: var(--shadow-lg); }

/* — tags — */
.tag {
  display: inline-flex; align-items: center; font-size: 11px;
  letter-spacing: 0.02em; padding: 3px 10px; font-weight: 600;
  border-radius: calc(var(--radius-md) * 0.75);
}
.tag-accent { background: var(--color-accent-100); color: var(--color-accent-800); }
.tag-neutral { background: var(--color-neutral-200); color: var(--color-neutral-800); }
.tag-outline { border: 1px solid var(--color-accent); color: var(--color-accent); }
.theme-dark .tag-neutral { background: var(--color-neutral-700); color: var(--color-neutral-100); }

/* — navigation — */
.nav {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid var(--color-divider);
}
.nav-brand { font-family: var(--font-heading); font-weight: 800; font-size: 18px; margin-right: auto; display: flex; align-items: center; gap: 8px; }
.nav a { color: inherit; text-decoration: none; font-size: 14px; }
.nav a:hover { color: var(--color-accent); }
/* The logo lockup is also an <a href="/"> (each page can return home) — tie-
   broken (same specificity as .nav a / .nav a:hover, later in source order)
   so it keeps its own 18px/800-weight sizing instead of the generic nav
   link's 14px, while still picking up a nice accent color on hover. */
.nav a.nav-brand { font-size: 18px; }
.nav a.nav-brand:hover { color: inherit; }

/* — tables — */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  padding: var(--space-2); border-bottom: 2px solid var(--color-divider);
}
.table td { padding: var(--space-2); border-bottom: 1px solid var(--color-divider); }

/* — dialog — */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  padding: var(--space-4);
  background: color-mix(in srgb, var(--color-neutral-900) 55%, transparent);
}
.dialog {
  width: min(440px, 100%); display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--color-surface); box-shadow: var(--shadow-lg); color: var(--color-text);
}
.dialog-title { font-family: var(--font-heading); font-weight: 800; font-size: 20px; }
.dialog-body { font-size: 14px; opacity: 0.9; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

/* — brand mark — a subtitle frame: two bars, a full line then a short one.
   Pure CSS, no image asset, sized via width/height + one modifier class. */
.brand-mark {
  --mark-size: 20px;
  width: var(--mark-size); height: var(--mark-size);
  flex: none;
  background: var(--color-accent);
  display: inline-flex; flex-direction: column; justify-content: center; gap: 18%;
  padding: 0 15%;
}
.brand-mark::before, .brand-mark::after {
  content: ""; display: block; height: 14%; background: var(--color-bg);
}
.brand-mark::after { width: 58%; }
.brand-mark--sm { --mark-size: 15px; }
.brand-mark--lg { --mark-size: 64px; }
.brand-mark--xl { --mark-size: 86px; }

/* — pricing tier cards — shared by landing's #pricing and host's top-up step
   1 (host.html), so both ever have exactly one definition of this look. Host
   renders these as <button> elements instead of landing's plain <div>s (the
   tier itself is the click target there) — .topup-tier-btn in host.css only
   resets the button-element defaults these rules don't already cover
   (border/font/text-align/cursor), the actual card look lives here. */
.pricing-tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: var(--color-divider); }
.pricing-tier { background: var(--color-surface); padding: var(--space-6); }
.pricing-tier-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.pricing-tier--featured { box-shadow: inset 0 0 0 2px var(--color-accent); }
.pricing-amount { font-size: 40px; font-weight: 800; line-height: 1; }
.pricing-amount span { font-size: 15px; font-weight: 400; color: color-mix(in srgb, var(--color-text) 60%, transparent); }
@media (max-width: 720px) {
  .pricing-tiers { grid-template-columns: 1fr; }
}

/* Logo lockup — a single <img> now (the real "Subtii 開字幕" artwork from
   the /logo source folder, not a CSS-drawn approximation): logo-black.png
   (black text/mark ink) on a light-background page, logo-white.png (white
   text) on a dark one. Both files are pre-cropped to their own content bbox
   with real alpha transparency — pick whichever file's ink color matches
   the page background, not the other way around. */
.brand-lockup { display: inline-flex; align-items: center; }
.brand-logo-img { height: 26px; width: auto; display: block; }
