/* ==========================================================================
   Cineon26 Tutorial — Apple-Inspired Design System Tokens
   Light-first editorial clarity + Studio Dark mode matching macOS Cineon26
   ========================================================================== */

:root {
  /* Typography — Authentic Apple System Font Stack */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Light Palette (Apple Support / Apple HIG editorial clarity) */
  --bg: #ffffff;
  --bg-subtle: #fbfbfd;
  --surface: #f5f5f7;
  --surface-elevated: #ffffff;
  --surface-hover: #ececf0;
  --surface-glass: rgba(255, 255, 255, 0.80);
  --surface-glass-strong: rgba(255, 255, 255, 0.92);

  --ink: #1d1d1f;
  --ink-secondary: #515154;
  --ink-tertiary: #6e6e73;
  --ink-muted: #86868b;

  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --divider: rgba(0, 0, 0, 0.06);

  /* Brand & Semantic Accents */
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.10);
  --accent-border: rgba(0, 113, 227, 0.24);

  /* Cineon26 Warm Film Amber */
  --film: #b86614;
  --film-soft: rgba(184, 102, 20, 0.10);
  --film-border: rgba(184, 102, 20, 0.24);

  /* Exact Cineon26 Geometry & Status Semantics */
  --geo-green: #24a148;
  --geo-green-bright: #30d158;
  --geo-green-soft: rgba(48, 209, 88, 0.12);
  --geo-blue: #007aff;
  --geo-blue-bright: #0a84ff;
  --geo-blue-soft: rgba(0, 122, 255, 0.12);

  --warn: #b25000;
  --warn-soft: rgba(255, 149, 0, 0.12);
  --warn-border: rgba(255, 149, 0, 0.28);

  --danger: #d70015;
  --danger-soft: rgba(255, 59, 48, 0.10);
  --danger-border: rgba(255, 59, 48, 0.24);

  --success: #1d8348;
  --success-soft: rgba(52, 199, 89, 0.12);
  --success-border: rgba(52, 199, 89, 0.26);

  /* Studio Mockup Chrome (always dark, matching native Cineon26 macOS UI) */
  --studio-bg: #111215;
  --studio-panel: #191b20;
  --studio-card: #22252c;
  --studio-line: rgba(255, 255, 255, 0.10);
  --studio-ink: #f3f4f6;
  --studio-muted: #9ca3af;
  --studio-amber: #ffb56f;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.14);
  --kbd-bg: #ffffff;
  --kbd-shadow: 0 1px 0 rgba(0, 0, 0, 0.14);

  /* Radii & Layout */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-pill: 980px;

  --nav-h: 52px;
  --max-hub: 1120px;
  --max-reader: 1320px;
  --sidebar-w: 272px;
  --toc-w: 224px;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

[data-theme="dark"] {
  --bg: #000000;
  --bg-subtle: #0b0c0e;
  --surface: #141518;
  --surface-elevated: #1c1d21;
  --surface-hover: #25272d;
  --surface-glass: rgba(18, 19, 22, 0.80);
  --surface-glass-strong: rgba(22, 23, 27, 0.94);

  --ink: #f5f5f7;
  --ink-secondary: #c7c7cc;
  --ink-tertiary: #a1a1a6;
  --ink-muted: #7c7c82;

  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --divider: rgba(255, 255, 255, 0.07);

  --accent: #2997ff;
  --accent-hover: #47a6ff;
  --accent-soft: rgba(41, 151, 255, 0.15);
  --accent-border: rgba(41, 151, 255, 0.34);

  --film: #ffb56f;
  --film-soft: rgba(255, 181, 111, 0.14);
  --film-border: rgba(255, 181, 111, 0.30);

  --geo-green: #30d158;
  --geo-green-soft: rgba(48, 209, 88, 0.16);
  --geo-blue: #0a84ff;
  --geo-blue-soft: rgba(10, 132, 255, 0.16);

  --warn: #ff9f0a;
  --warn-soft: rgba(255, 159, 10, 0.15);
  --warn-border: rgba(255, 159, 10, 0.32);

  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.15);
  --danger-border: rgba(255, 69, 58, 0.30);

  --success: #30d158;
  --success-soft: rgba(48, 209, 88, 0.15);
  --success-border: rgba(48, 209, 88, 0.30);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.40);
  --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 28px 72px rgba(0, 0, 0, 0.72);
  --kbd-bg: #26282e;
  --kbd-shadow: 0 1px 0 rgba(0, 0, 0, 0.65);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.72;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

body.modal-open { overflow: hidden; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -64px;
  left: 16px;
  z-index: 200;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* Tactile macOS Keycaps */
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin: 0 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
  background: var(--kbd-bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: var(--kbd-shadow);
  vertical-align: 1px;
  white-space: nowrap;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--divider);
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
