/* ============================================================
 *  GLOBAL READABILITY · applies to every page
 *  Fixes: blurry text from transforms, low contrast, overlap
 *  with global tickers, stacking issues over hero copy.
 *  Also defines reusable "cine" visual primitives used to
 *  replace text-heavy grids with compact cinematic widgets.
 * ============================================================ */

/* ---------- Crisp text everywhere ---------- */
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
body { font-feature-settings: "kern" 1, "liga" 1, "calt" 1; }
h1, h2, h3, h4, h5, h6, p, li, span, b, a, button { text-rendering: optimizeLegibility; }
h1, h2, h3, .section-title { text-wrap: balance; }
p, li, .kicker, .section-sub { text-wrap: pretty; }

/* Don't blur text under transforms */
[style*="transform"], .inf-slab, .stack-row, .iiv2-app, .iiv2-stage-preview {
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  -webkit-perspective: 1000; perspective: 1000;
  transform-style: preserve-3d;
  will-change: transform;
}

/* ---------- Contrast bump for body text ---------- */
:root {
  --site-text:   #ECF0FA;
  --site-text-2: #A4B0CC;
  --site-text-3: #6E7B98;
}
.kicker, .section-sub, p { color: var(--site-text-2); }

/* ---------- Tickers must not bleed over headings ---------- */
.cinema-ticker, .ticker, .global-ticker, .infra-ticker, .marquee, [class*="ticker"] {
  z-index: 1 !important;
}
.inf-section, .section, section.section, .container { position: relative; z-index: 2; }
.inf-section-head, .section-head, .hero, .feature, .iiv2-section { position: relative; z-index: 3; }
.inf-section-head h2, .inf-section-head .section-title, .section-title, .hero h1 {
  position: relative; z-index: 4;
  isolation: isolate;
}

/* Push global page tickers out of the section-head zone */
body > .cinema-ticker, body > .ticker, body > .infra-ticker {
  pointer-events: none;
}

/* ============================================================
 *  CINE PRIMITIVES — compact, visual replacements for
 *  long text-grid sections. Use these instead of <ul>/lists.
 *  Add `class="cine-section"` to wrap a section in a tighter,
 *  more visual layout.
 * ============================================================ */

.cine-section { padding: 96px 0; }
.cine-section .cine-head {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px;
  align-items: end; margin-bottom: 48px;
}
.cine-section .cine-head h2 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(36px, 4vw, 56px); line-height: 1.05;
  letter-spacing: -0.025em; color: #fff; margin: 12px 0 0;
}
.cine-section .cine-head .eyebrow,
.cine-section .cine-head .cine-eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em;
  color: var(--site-cyan, #4FC8FF); text-transform: uppercase;
}
.cine-section .cine-head p {
  color: var(--site-text-2);
  font-size: 15px; line-height: 1.55; max-width: 480px; margin: 0;
}

/* Cinematic console — sidebar + stage */
.cine-console {
  --ic: var(--site-cyan, #4FC8FF);
  display: grid; grid-template-columns: 280px 1fr;
  background: linear-gradient(180deg, rgba(10,14,31,0.88), rgba(5,7,15,0.92));
  border: 1px solid rgba(79,200,255,0.12);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.cine-console::before {
  content: ''; position: absolute; inset: -1px; pointer-events: none;
  background: radial-gradient(700px 360px at 80% 0%, color-mix(in oklab, var(--ic) 16%, transparent), transparent 60%);
  opacity: 0.5;
}
@media (max-width: 1000px) { .cine-console { grid-template-columns: 1fr; } }

/* ============================================================
 *  CINE PRIMITIVES — MOBILE VARIANT (≤767px)
 *  Compresses padding, converts vertical rail to horizontal
 *  chip-scroller, shrinks stage min-height, and stacks foot KVs.
 *  Desktop styles above are untouched.
 * ============================================================ */
@media (max-width: 767px) {
  /* Section padding tightens */
  .cine-section { padding: 56px 0; }
  .cine-section .cine-head {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 24px;
  }
  .cine-section .cine-head h2 {
    font-size: clamp(28px, 8vw, 38px);
    line-height: 1.08;
  }
  .cine-section .cine-head p {
    font-size: 14px;
    line-height: 1.55;
    max-width: 100%;
  }

  /* Console: stays single-column (from 1000px rule), but flatter inside */
  .cine-console::before { opacity: 0.35; } /* dial back the radial glow */

  /* Rail becomes a top horizontal chip scroller */
  .cine-rail {
    border-right: 0;
    border-bottom: 1px solid rgba(79, 200, 255, 0.10);
    background: rgba(0, 0, 0, 0.4);
  }
  .cine-rail-h {
    padding: 12px 16px;
    /* Title row + meta — let it wrap so meta drops below */
    flex-wrap: wrap;
    gap: 8px;
  }
  .cine-rail-h > * { font-size: 10px; }

  .cine-rail-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 12px 10px;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    /* Hide scrollbar — chip rail reads cleaner without it */
    scrollbar-width: none;
    /* Soft fade at the right edge to hint at more content */
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent 100%);
  }
  .cine-rail-list::-webkit-scrollbar { display: none; }

  .cine-tab {
    width: auto;
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 8px 12px;
    gap: 8px;
    border-left: 0;
    border: 1px solid rgba(79, 200, 255, 0.12);
    border-radius: 999px;
    font-size: 12.5px;
    min-height: 36px;
    color: rgba(255, 255, 255, 0.7);
  }
  .cine-tab .num { display: none; }     /* hide step numerals on mobile */
  .cine-tab svg { width: 14px; height: 14px; }
  .cine-tab.on {
    border-left: 1px solid var(--c);    /* match border weight on all sides */
    border-color: color-mix(in oklab, var(--c) 60%, transparent);
    background: color-mix(in oklab, var(--c) 16%, transparent);
  }

  /* Stage: tighter chrome, shorter body, foot wraps */
  .cine-stage-head {
    padding: 14px 18px;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .cine-stage-name { font-size: 18px; line-height: 1.2; }
  .cine-stage-sub { font-size: 10px; margin-top: 3px; }

  /* Meta cluster wraps below name */
  .cine-stage-meta {
    width: 100%;
    gap: 14px;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px dashed rgba(79, 200, 255, 0.08);
  }
  .cine-stage-meta .m b { font-size: 11.5px; }
  .cine-stage-meta .m span { font-size: 8.5px; }

  .cine-stage-body {
    /* Was 460px on desktop — that's two phone screens of blank space */
    min-height: 0;
    padding: 18px 18px 22px;
  }

  .cine-stage-foot {
    flex-wrap: wrap;
    padding: 4px 0;
  }
  .cine-stage-foot .kv {
    flex: 1 1 50%;
    min-width: 50%;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid rgba(79, 200, 255, 0.06);
  }
  .cine-stage-foot .kv:nth-child(odd) {
    border-right: 1px solid rgba(79, 200, 255, 0.06);
  }
  .cine-stage-foot .kv:nth-last-child(-n+2) { border-bottom: 0; }
  .cine-stage-foot .kv span { font-size: 8.5px; }
  .cine-stage-foot .kv b { font-size: 12px; }

  /* Compact card grid: force single column, tighter padding */
  .cine-grid { grid-template-columns: 1fr; }
  .cine-card { padding: 16px 18px; }
  .cine-card .h { font-size: 16px; }
  .cine-card .d { font-size: 12.5px; }

  /* Chip cloud: keep wrap, but allow horizontal scroll if it's > ~3 lines tall */
  .cine-chips { gap: 5px; }
  .cine-chip { padding: 4px 8px; font-size: 11px; }
}

/* Very small phones — collapse foot KVs to single column */
@media (max-width: 380px) {
  .cine-stage-foot .kv {
    flex: 1 1 100%;
    min-width: 100%;
    border-right: 0 !important;
  }
  .cine-stage-foot .kv:nth-last-child(n+2) {
    border-bottom: 1px solid rgba(79, 200, 255, 0.06);
  }
  .cine-stage-foot .kv:last-child { border-bottom: 0; }
}

.cine-rail {
  background: rgba(0,0,0,0.35);
  border-right: 1px solid rgba(79,200,255,0.08);
  display: flex; flex-direction: column;
  position: relative; z-index: 1;
}
.cine-rail-h {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(79,200,255,0.08);
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.18em; color: rgba(255,255,255,0.55);
  display: flex; justify-content: space-between; align-items: center;
}
.cine-rail-list { display: flex; flex-direction: column; padding: 6px 0; }
.cine-tab {
  --c: var(--ic);
  width: 100%; background: transparent; border: 0; cursor: pointer;
  display: grid; grid-template-columns: 8px 18px 1fr auto;
  align-items: center; gap: 12px;
  padding: 12px 18px;
  text-align: left; font: inherit; font-size: 13.5px;
  color: rgba(255,255,255,0.6);
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
}
.cine-tab .dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.18); }
.cine-tab svg { color: rgba(255,255,255,0.45); }
.cine-tab .num { font-family: var(--font-mono); font-size: 10px; color: rgba(255,255,255,0.3); letter-spacing: 0.1em; }
.cine-tab:hover { color: #fff; background: rgba(255,255,255,0.02); }
.cine-tab.on {
  color: #fff; border-left-color: var(--c);
  background: linear-gradient(90deg, color-mix(in oklab, var(--c) 14%, transparent), transparent 80%);
}
.cine-tab.on .dot { background: var(--c); box-shadow: 0 0 8px var(--c); }
.cine-tab.on svg { color: var(--c); }
.cine-tab.on .num { color: var(--c); }

.cine-stage {
  display: flex; flex-direction: column;
  position: relative; z-index: 1;
}
.cine-stage-head {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  padding: 20px 28px;
  border-bottom: 1px solid rgba(79,200,255,0.08);
}
.cine-stage-name { font-family: var(--font-display); font-size: 22px; color: #fff; font-weight: 500; letter-spacing: -0.01em; }
.cine-stage-sub { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.16em; color: var(--ic); margin-top: 4px; }
.cine-stage-meta { display: flex; gap: 22px; }
.cine-stage-meta .m { display: flex; flex-direction: column; gap: 3px; }
.cine-stage-meta .m span { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.16em; color: rgba(255,255,255,0.45); }
.cine-stage-meta .m b { font-family: var(--font-mono); font-size: 12px; color: #fff; font-weight: 500; }

.cine-stage-body { flex: 1; min-height: 460px; padding: 28px; }
.cine-stage-foot {
  display: flex;
  border-top: 1px solid rgba(79,200,255,0.08);
  background: rgba(0,0,0,0.3);
}
.cine-stage-foot .kv {
  flex: 1; padding: 12px 18px;
  border-right: 1px solid rgba(79,200,255,0.06);
  display: flex; flex-direction: column; gap: 3px;
}
.cine-stage-foot .kv:last-child { border-right: 0; }
.cine-stage-foot .kv span { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.14em; color: rgba(255,255,255,0.45); }
.cine-stage-foot .kv b { font-family: var(--font-mono); font-size: 13px; color: #fff; font-weight: 500; }
.cine-stage-foot .kv b.ok { color: #5EFFA4; }

/* Live blink */
@keyframes cine-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.cine-live { display: inline-flex; align-items: center; gap: 6px; color: var(--ic); font-weight: 600; }
.cine-live::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ic);
  box-shadow: 0 0 8px var(--ic);
  animation: cine-blink 1.4s ease-in-out infinite;
}

/* ---------- Visual chip cloud ---------- */
.cine-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cine-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 2px;
  font-size: 11px; color: rgba(255,255,255,0.78);
  transition: all 0.3s ease;
}
.cine-chip i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,0.2); transition: all 0.3s ease; }
.cine-chip.on {
  background: color-mix(in oklab, var(--ic, #4FC8FF) 14%, transparent);
  border-color: color-mix(in oklab, var(--ic, #4FC8FF) 40%, transparent);
  color: #fff;
}
.cine-chip.on i { background: var(--ic, #4FC8FF); box-shadow: 0 0 6px var(--ic, #4FC8FF); }

/* ---------- Compact card grid (replaces long lists) ---------- */
.cine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1px;
  background: rgba(79,200,255,0.08);
  border: 1px solid rgba(79,200,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}
.cine-card {
  background: rgba(10,14,31,0.7);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 8px;
  transition: background 0.3s ease;
}
.cine-card:hover { background: rgba(10,14,31,0.95); }
.cine-card .ic { width: 28px; height: 28px; color: var(--site-cyan, #4FC8FF); }
.cine-card .num { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.18em; color: rgba(255,255,255,0.4); }
.cine-card .h { font-family: var(--font-display); font-size: 17px; color: #fff; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; }
.cine-card .d { font-size: 12.5px; color: var(--site-text-2); line-height: 1.5; margin-top: 2px; }

/* Section title spacing fix when inside cine-section */
.cine-section .container { position: relative; z-index: 2; }
