/* =========================================================
   ReelOmni v1.3 — base.css (FINAL)
   Order: tokens.css → foundation.css → base.css → components.css
   Purpose: normalize, layout primitives, typography, links,
            containers, global helpers
   ========================================================= */

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

:where(html) { -webkit-text-size-adjust: 100%; }
:where(body) { margin: 0; }

img, svg, video, canvas, audio, iframe, embed, object {
  display: block; max-width: 100%;
}

:where(h1,h2,h3,h4,h5,h6,p,figure,blockquote,dl,dd){ margin: 0; }
:where(ul[role="list"], ol[role="list"]){ list-style: none; margin:0; padding:0; }

:where(button, input, select, textarea){ font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }

:where(a){ color: inherit; text-underline-offset: 2px; }

/* ---------- Root / Color Scheme ---------- */
:root {
  color-scheme: dark light;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

/* ---------- Typography ---------- */
:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --fs-xxl: clamp(2rem, 1.1rem + 3vw, 3.4rem);
  --fs-xl:  clamp(1.6rem, 1rem + 2vw, 2.4rem);
  --fs-lg:  clamp(1.2rem, .9rem + 1vw, 1.35rem);
  --fs-md:  1rem;
  --fs-sm:  .92rem;
  --lh: 1.55;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh);
  letter-spacing: .2px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, .h1 { font-size: var(--fs-xxl); line-height: 1.15; font-weight: 800; }
h2, .h2 { font-size: var(--fs-xl);  line-height: 1.2;  font-weight: 800; }
h3, .h3 { font-size: 1.25rem;       line-height: 1.25; font-weight: 700; }
h4, .h4 { font-size: 1.1rem;        font-weight: 700; }

p + p { margin-top: .75rem; }

/* Muted text + strong */
.muted { color: var(--muted); }
strong, b { color: var(--text-strong); font-weight: 800; }

/* ---------- Links ---------- */
a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}
a:focus-visible { outline: 2px dotted var(--gold); outline-offset: 2px; }

/* ---------- Layout primitives ---------- */
.container { width: min(1100px, 92vw); margin-inline: auto; }
.section { padding: 64px 0; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: none; }
.section--alt { background: var(--surface-1); }

.split {
  display: grid; gap: 1rem; grid-template-columns: 1.2fr .8fr;
}
@media (max-width: 960px){ .split { grid-template-columns: 1fr; } }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 960px){ .grid.cols-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px){ .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }

.inline { display: inline-flex; align-items: center; gap: .6rem; }
.stack  > * + * { margin-top: .75rem; }

/* ---------- Surfaces / Borders ---------- */
:root {
  /* falls back to tokens; these just ensure harmony if tokens missing */
  --bg:           #0b0b0c;
  --bg-2:         #0f0f12;
  --surface:      #121214;
  --surface-1:    #151518;
  --surface-2:    #191a1f;
  --text:         #e8e8ea;
  --text-strong:  #ffffff;
  --muted:        #a6a6af;
  --line:         #2a2a33;
  --gold:         #d4af37;
  --red:          #9f1d20;
  --link:         color-mix(in oklab, var(--gold), white 25%);
  --link-hover:   color-mix(in oklab, var(--gold), white 45%);
}

.theme-light {
  --bg:           #f7f7fb;
  --bg-2:         #ffffff;
  --surface:      #ffffff;
  --surface-1:    #fbfbfe;
  --surface-2:    #f3f3f9;
  --text:         #17171a;
  --text-strong:  #000;
  --muted:        #5d5d68;
  --line:         #e6e6ef;
}

/* ---------- Header spacing fixes ---------- */
.demo-header .container { padding: .8rem 0; }
.nav-actions .pill { border: 1px solid var(--line); border-radius: 999px; padding: .4rem .8rem; }

/* ---------- Forms ---------- */
input, textarea, select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .55rem .7rem;
}
input::placeholder, textarea::placeholder { color: color-mix(in oklab, var(--muted), white 10%); }
label { font-weight: 600; }

/* ---------- Code / Pre ---------- */
code, pre, kbd, samp { font-family: var(--font-mono); }
pre {
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .8rem;
  overflow: auto;
}

/* ---------- Focus & selection ---------- */
:focus-visible { outline: 2px dotted var(--gold); outline-offset: 2px; }
::selection { background: color-mix(in oklab, var(--gold), black 70%); color: #fff; }

/* ---------- Small helpers ---------- */
hr {
  border: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  margin: 1rem 0;
}
.shadow-1 { box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.round    { border-radius: 12px; }
.center   { text-align: center; }

/* ---------- Print (just in case) ---------- */
@media print {
  .demo-header, .chat-fab, .admin-chip, #toTop, #stickyCta, #ro-progress { display:none !important; }
  a[href]::after { content: " (" attr(href) ")"; font-size: .8em; color: #666; }
}
