/* ============================================================
   TRAIN & SHINE — Base layer
   Docs-page chrome, live control bar, phone frames, utilities.
   (This file styles the SHOWCASE shell, not the RN components.)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Montserrat", system-ui, sans-serif;
  background: var(--page-bg, #0d0d10);
  color: var(--page-fg, #e9e9ee);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: color-mix(in oklch, var(--accent) 40%, transparent); }

/* ---- Docs shell palette (the gray studio background) ---- */
:root {
  --page-bg: #0e0e12;
  --page-fg: #e8e8ef;
  --page-dim: #9a9aa8;
  --page-line: #232330;
  --page-card: #16161d;
  --page-card-2: #1c1c25;
}

/* ============================================================
   TOP CONTROL BAR  (the live theme switcher — part of the deliverable)
   ============================================================ */
.studio-bar {
  position: sticky; top: 0; z-index: 500;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px 22px;
  background: color-mix(in oklch, var(--page-bg) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--page-line);
}
.studio-brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.studio-brand .mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(140deg, var(--accent), color-mix(in oklch, var(--accent) 55%, #fff));
  display: grid; place-items: center; color: var(--on-accent);
  font-weight: 700; font-size: 16px; box-shadow: 0 4px 14px var(--accent-soft);
}
.studio-brand b { font-size: 15px; letter-spacing: -0.2px; }
.studio-brand span { color: var(--page-dim); font-size: 12px; display: block; margin-top: -2px; font-weight: 500; }

.studio-nav { display: flex; gap: 4px; background: var(--page-card); padding: 4px; border-radius: 11px; border: 1px solid var(--page-line); }
.studio-nav a {
  text-decoration: none; padding: 7px 13px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--page-dim); transition: background var(--dur-2), color var(--dur-2);
}
.studio-nav a:hover { color: var(--page-fg); }
.studio-nav a[aria-current="page"] { background: var(--accent); color: var(--on-accent); }

.ctrl-group { display: flex; align-items: center; gap: 8px; }
.ctrl-label { font-size: 10px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--page-dim); }
.seg {
  display: inline-flex; background: var(--page-card); border: 1px solid var(--page-line);
  border-radius: 10px; padding: 3px; gap: 2px;
}
.seg button {
  border: 0; background: transparent; color: var(--page-dim); cursor: pointer;
  padding: 6px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 600;
  transition: background var(--dur-2), color var(--dur-2); display: inline-flex; align-items: center; gap: 6px;
}
.seg button:hover { color: var(--page-fg); }
.seg button.on { background: var(--accent); color: var(--on-accent); }
.seg.ghost button.on { background: var(--page-card-2); color: var(--page-fg); }

.swatches { display: flex; gap: 6px; }
.swatch { width: 22px; height: 22px; border-radius: 7px; border: 2px solid transparent; cursor: pointer; padding: 0; transition: transform var(--dur-1); }
.swatch:hover { transform: scale(1.12); }
.swatch.on { border-color: var(--page-fg); }
.swatch[data-val="green"]  { background:#1faa4d; }
.swatch[data-val="blue"]   { background:#2f7ff0; }
.swatch[data-val="violet"] { background:#7257f5; }
.swatch[data-val="orange"] { background:#f06a2f; }
.swatch[data-val="ink"]    { background:#1c1c22; border:2px solid #44444f; }

/* ============================================================
   DOCS CONTENT LAYOUT
   ============================================================ */
.wrap { max-width: 1240px; margin: 0 auto; padding: 40px 24px 120px; }
.page-head { margin: 18px 0 36px; }
.page-head .eyebrow { color: var(--accent); font-weight: 700; font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; }
.page-head h1 { font-size: clamp(30px, 5vw, 46px); letter-spacing: -1.2px; margin: 10px 0 12px; line-height: 1.02; }
.page-head p { color: var(--page-dim); font-size: 16px; line-height: 1.6; max-width: 62ch; margin: 0; }

.section { margin-top: 56px; }
.section > h2 { font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--page-dim); margin: 0 0 20px; padding-bottom: 12px; border-bottom: 1px solid var(--page-line); display: flex; align-items: baseline; gap: 12px; }
.section > h2 .n { color: var(--accent); font-variant-numeric: tabular-nums; }
.section-note { color: var(--page-dim); font-size: 14px; line-height: 1.6; max-width: 64ch; margin: -8px 0 24px; }

.card-grid { display: grid; gap: 16px; }
.studio-card { background: var(--page-card); border: 1px solid var(--page-line); border-radius: 16px; padding: 22px; }
.studio-card h3 { margin: 0 0 4px; font-size: 15px; }
.studio-card .desc { color: var(--page-dim); font-size: 13px; line-height: 1.55; margin: 0 0 16px; }

/* a labeled spec pill */
.spec { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-family: ui-monospace, "SF Mono", Menlo, monospace; color: var(--page-dim); background: var(--page-card-2); border: 1px solid var(--page-line); border-radius: 6px; padding: 3px 7px; }

/* ============================================================
   PLATFORM PAIR LAYOUT (iOS | Android side by side)
   ============================================================ */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 920px) { .pair { grid-template-columns: 1fr; } }
.platform-col { display: flex; flex-direction: column; gap: 0; }
.platform-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--page-dim); margin-bottom: 12px; }
.platform-tag .dot { width: 7px; height: 7px; border-radius: 50%; }
.platform-tag[data-p="ios"] .dot { background: #0a84ff; }
.platform-tag[data-p="android"] .dot { background: #4caf50; }

/* ============================================================
   PHONE FRAME (CSS-built device bezel)
   .phone has data-platform + data-theme to drive the surface.
   ============================================================ */
.phone {
  position: relative;
  width: var(--pw, 360px);
  height: var(--ph, 740px);
  border-radius: 46px;
  background: #000;
  padding: 11px;
  box-shadow: 0 2px 0 1px #2a2a31, 0 0 0 12px #0c0c0f, 0 30px 70px -20px rgba(0,0,0,.7);
  flex: none;
  font-family: var(--font-ui);
}
.phone[data-platform="android"] { border-radius: 40px; }
.phone-screen {
  position: relative; width: 100%; height: 100%;
  border-radius: 36px; overflow: hidden;
  background: var(--bg);
  color: var(--text);
  display: flex; flex-direction: column;
}
.phone[data-platform="android"] .phone-screen { border-radius: 30px; }

/* iOS dynamic island */
.phone[data-platform="ios"] .island {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 108px; height: 30px; background: #000; border-radius: 16px; z-index: 40; pointer-events: none;
}
/* status bar */
.statusbar {
  height: 50px; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; font-size: 14px; font-weight: 600; color: var(--text); position: relative; z-index: 30;
}
.phone[data-platform="ios"] .statusbar { padding-top: 6px; }
.statusbar .clock { font-variant-numeric: tabular-nums; letter-spacing: 0.3px; }
.phone[data-platform="android"] .statusbar { font-size: 13px; padding: 0 18px; height: 38px; }
.statusbar .sb-right { display: flex; align-items: center; gap: 6px; }
.statusbar svg { width: 17px; height: 17px; }
.phone[data-platform="android"] .statusbar .clock { order: -1; margin-right: auto; }

/* scrollable screen body */
.screen-body { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.screen-body::-webkit-scrollbar { width: 0; height: 0; }

/* home indicator / gesture pill */
.home-indicator { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); z-index: 45; pointer-events: none; }
.phone[data-platform="ios"] .home-indicator { width: 134px; height: 5px; border-radius: 3px; background: var(--text); opacity: .85; }
.phone[data-platform="android"] .home-indicator { width: 108px; height: 4px; border-radius: 3px; background: var(--text); opacity: .7; }

/* small frame variant for the component gallery (no full height) */
.phone.snippet { height: auto; }
.phone.snippet .phone-screen { height: auto; }
.phone.snippet .screen-body { overflow: visible; }

/* ============================================================
   UTILITIES
   ============================================================ */
.row { display: flex; align-items: center; gap: var(--sp-4); }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.center { align-items: center; justify-content: center; }
.wrapflex { flex-wrap: wrap; }
.muted { color: var(--text-2); }
.fill { flex: 1; }
.stack-sm > * + * { margin-top: var(--sp-3); }
.stack > * + * { margin-top: var(--sp-5); }
.icon { width: 24px; height: 24px; flex: none; display: inline-flex; }
.icon svg { width: 100%; height: 100%; }
.icon-16 { width: 16px; height: 16px; }
.icon-20 { width: 20px; height: 20px; }
.icon-28 { width: 28px; height: 28px; }

/* platform-conditional visibility (for shared demo templates) */
[data-platform="ios"] .android-only { display:none !important; }
[data-platform="android"] .ios-only { display:none !important; }

/* reduced-motion respect */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* striped media placeholder (per design-system convention) */
.media-ph {
  position: relative; border-radius: var(--r-md); overflow: hidden;
  background-color: var(--surface-2);
  background-image: repeating-linear-gradient(45deg, var(--fill-2) 0 10px, transparent 10px 20px);
  display: grid; place-items: center;
  color: var(--text-3); font-family: ui-monospace, Menlo, monospace; font-size: 11px; letter-spacing: 0.3px;
  border: 1px solid var(--separator);
}
.media-ph .ph-play { width: 52px; height: 52px; border-radius: 50%; background: color-mix(in oklch, var(--bg) 70%, transparent); display: grid; place-items: center; color: var(--text); }
