/* Rex public site: product page (index.html) and developer guide (docs.html). */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f2f0ea;
  --text: #1b1a17;
  --muted: #5f5b52;
  --line: #e3dfd5;
  --accent: #e2462f;
  --accent-ink: #ffffff;
  --accent-soft: #fde8e3;
  --code-bg: #f4f2ec;
  --ok: #1f7a4d;
  --radius: 14px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #12110f;
    --surface: #1b1a17;
    --surface-2: #24221e;
    --text: #f3f0e8;
    --muted: #aaa497;
    --line: #34312b;
    --accent: #ff6a52;
    --accent-ink: #1b0d09;
    --accent-soft: #3a1d17;
    --code-bg: #1f1d1a;
    --ok: #5cc98f;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #12110f;
  --surface: #1b1a17;
  --surface-2: #24221e;
  --text: #f3f0e8;
  --muted: #aaa497;
  --line: #34312b;
  --accent: #ff6a52;
  --accent-ink: #1b0d09;
  --accent-soft: #3a1d17;
  --code-bg: #1f1d1a;
  --ok: #5cc98f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
img, svg { max-width: 100%; }
code, pre { font-family: var(--mono); font-size: 0.88em; }
:not(pre) > code { background: var(--code-bg); border: 1px solid var(--line); border-radius: 6px; padding: 0.05em 0.35em; overflow-wrap: anywhere; }
pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; overflow-x: auto; line-height: 1.5; margin: 14px 0; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 20px; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 17px; }
.top nav { margin-left: auto; display: flex; gap: 18px; align-items: center; }
.top nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px; }
.top nav a:hover, .top nav a[aria-current='page'] { color: var(--text); }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 999px; font-weight: 700; text-decoration: none; border: 1px solid transparent; font-size: 15px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { border-color: var(--line); color: var(--text); background: var(--surface); }
.top nav .btn { padding: 7px 14px; color: var(--accent-ink); }

/* Product page */
.hero { padding: 72px 0 56px; }
.eyebrow { display: inline-block; font-weight: 700; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.hero h1 { font-size: clamp(36px, 6vw, 64px); margin: 0 0 18px; max-width: 14em; }
.hero p.lead { font-size: clamp(18px, 2.2vw, 21px); color: var(--muted); max-width: 36em; margin: 0 0 28px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
section.band { padding: 64px 0; border-top: 1px solid var(--line); }
section.band h2 { font-size: clamp(28px, 4vw, 40px); margin: 0 0 12px; }
section.band > .wrap > p.sub { color: var(--muted); font-size: 18px; max-width: 40em; margin: 0 0 32px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card h3 { margin: 0 0 8px; font-size: 19px; }
.card p { margin: 0; color: var(--muted); }
.card .icon { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 14px; }
.card .icon svg { width: 22px; height: 22px; }

/* Mock TV screen with rows */
.screen { background: #0e0d0c; border-radius: 18px; padding: 22px; border: 1px solid var(--line); color: #f3f0e8; box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.45); }
.screen .row-name { font-weight: 700; font-size: 14px; margin: 0 0 10px; color: #f3f0e8; }
.screen .row-name small { color: #9b958a; font-weight: 600; margin-left: 6px; }
.screen .tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 18px; }
.screen .tiles:last-child { margin-bottom: 0; }
.tile { aspect-ratio: 16 / 10; border-radius: 8px; position: relative; overflow: hidden; }
.tile.p { aspect-ratio: 2 / 3; }
.tile::after { content: ''; position: absolute; left: 8px; right: 30%; bottom: 8px; height: 6px; border-radius: 3px; background: rgb(255 255 255 / 0.55); }
.tile .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); }
.w12 { width: 12%; } .w24 { width: 24%; } .w40 { width: 40%; } .w62 { width: 62%; } .w80 { width: 80%; }
.tile .live { position: absolute; top: 6px; left: 6px; background: #e2462f; color: #fff; font-size: 9px; font-weight: 800; padding: 1px 5px; border-radius: 4px; letter-spacing: 0.04em; }
.t1 { background: linear-gradient(135deg, #3b4a6b, #1d2436); }
.t2 { background: linear-gradient(135deg, #6b3b3b, #2e1818); }
.t3 { background: linear-gradient(135deg, #2f5d50, #15291f); }
.t4 { background: linear-gradient(135deg, #6b5a2f, #2b2412); }
.t5 { background: linear-gradient(135deg, #51386b, #22172e); }
.split { display: grid; gap: 40px; grid-template-columns: 1fr 1.1fr; align-items: center; }
.rows-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.rows-list li { padding-left: 16px; border-left: 3px solid var(--accent); }
.rows-list b { display: block; }
.rows-list span { color: var(--muted); }

.steps { counter-reset: step; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps .card { position: relative; padding-top: 58px; }
.steps .card::before { counter-increment: step; content: counter(step); position: absolute; top: 18px; left: 22px; width: 28px; height: 28px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checks li { padding-left: 30px; position: relative; }
.checks li::before { content: ''; position: absolute; left: 0; top: 5px; width: 18px; height: 18px; border-radius: 50%; background: var(--ok); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 0a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm-1.2 14.2-4-4 1.4-1.4 2.6 2.6 5.6-5.6 1.4 1.4-7 7Z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M10 0a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm-1.2 14.2-4-4 1.4-1.4 2.6 2.6 5.6-5.6 1.4 1.4-7 7Z'/%3E%3C/svg%3E") center / contain no-repeat; }
.steps + .cta { margin-top: 40px; }
.cta { background: var(--text); color: var(--bg); border-radius: 22px; padding: 44px 32px; text-align: center; }
.cta h2 { margin: 0 0 10px; }
.cta p { color: color-mix(in srgb, var(--bg) 75%, var(--text)); margin: 0 auto 24px; max-width: 34em; }
.cta .actions { justify-content: center; }
.cta .btn-ghost { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 35%, var(--text)); }
footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 14px; margin-top: 64px; }
footer .wrap { display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
footer a { color: var(--muted); }

/* Developer guide */
.docs { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 48px; padding-top: 32px; }
.toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; font-size: 14px; }
.toc p { margin: 18px 0 6px; font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.toc p:first-child { margin-top: 0; }
.toc a { display: block; padding: 4px 0; color: var(--text); text-decoration: none; }
.toc a:hover { color: var(--accent); }
.content { min-width: 0; max-width: 820px; }
.content h1 { font-size: clamp(32px, 5vw, 44px); margin: 0 0 12px; }
.content h2 { font-size: 28px; margin: 56px 0 12px; padding-top: 16px; border-top: 1px solid var(--line); scroll-margin-top: 80px; }
.content h3 { font-size: 20px; margin: 32px 0 8px; scroll-margin-top: 80px; }
.content p.lead { font-size: 19px; color: var(--muted); }
.endpoint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-family: var(--mono); font-size: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
.method { font-weight: 800; font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font-family: var(--font); }
.method.get { background: var(--ok); color: #fff; }
.table { overflow-x: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; background: var(--surface); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-size: 13px; }
tr:last-child td { border-bottom: 0; }
td:first-child { white-space: nowrap; }
.req { font-size: 11px; font-weight: 700; color: var(--accent); margin-left: 4px; }
.note { background: var(--accent-soft); border-radius: 10px; padding: 12px 16px; margin: 16px 0; }
.note p { margin: 0; }

@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .docs { grid-template-columns: 1fr; gap: 0; }
  .toc { position: static; max-height: none; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--surface); margin-bottom: 8px; }
  .top nav .hide-sm { display: none; }
}
@media (max-width: 560px) {
  .hero { padding: 44px 0 36px; }
  .screen { padding: 14px; }
  .screen .tiles { grid-template-columns: repeat(3, 1fr); }
  .screen .tiles > :nth-child(n + 4) { display: none; }
  section.band { padding: 44px 0; }
  .cta { padding: 32px 20px; }
}
