/* =============================================================
   Cinematic V2 — design tokens, base, topnav, content shell.
   Per-tab accent ("--c") is set inline on .view sections AND as
   --tab-accent on documentElement (kept for backwards-compat with
   the existing modal/test wiring).
   ============================================================= */

:root {
  --bg: #0E0E0C;
  --bg-2: #181815;
  --bg-3: #23231F;
  --ink: #F4F1EA;
  --ink-2: #B7B3A8;
  --ink-3: #7C7868;
  --rule: rgba(244, 241, 234, 0.10);
  --rule-strong: rgba(244, 241, 234, 0.22);

  --accent: var(--ink);
  --tab-accent: #FFFFFF;

  --font-display: "Bricolage Grotesque", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  --radius: 12px;
  --nav-height: 68px;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04);

  /* Backwards-compat aliases used by existing components. */
  --fg: var(--ink);
  --fg-muted: var(--ink-2);
  --bg-alt: var(--bg-2);
  --border: var(--rule);
}

[data-theme="light"] {
  --bg: #F4F1EA;
  --bg-2: #ECE7DD;
  --bg-3: #D9D5CB;
  --ink: #0E0E0C;
  --ink-2: #4B4738;
  --ink-3: #7C7868;
  --rule: rgba(14, 14, 12, 0.10);
  --rule-strong: rgba(14, 14, 12, 0.22);
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "tnum";
  transition: background-color 200ms ease, color 200ms ease;
}

a { color: var(--ink); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.025em;
  font-variation-settings: "opsz" 96;
}
.label, .mono {
  font-family: var(--font-mono);
}

/* =============================================================
   Topnav — brand mark, sectional tabs, right-side avail pill
   ============================================================= */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  padding: 0 56px;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  gap: 24px;
}

.topnav-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  flex-shrink: 0;
}
.topnav-mark {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  transition: background 250ms ease, color 250ms ease;
}
.topnav-brand-name {
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.005em;
}
.topnav-brand-role {
  color: var(--ink-3);
  font-weight: 400;
  font-size: 13px;
  margin-left: 8px;
}

.topnav-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav-tabs::-webkit-scrollbar { display: none; }

.topnav-tab {
  flex-shrink: 0;
  appearance: none;
  background: transparent;
  border: 0;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--ink-3);
  border-radius: 999px;
  letter-spacing: -0.005em;
  transition: color 150ms ease, background-color 150ms ease;
}
.topnav-tab:hover {
  color: var(--ink);
}
.topnav-tab[aria-selected="true"] {
  background: var(--ink);
  color: var(--bg);
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.topnav-avail {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.topnav-avail::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #65D08C;
  box-shadow: 0 0 0 4px rgba(101, 208, 140, 0.18);
}
.topnav-theme-toggle {
  background: transparent;
  border: 1px solid var(--rule-strong);
  color: var(--ink);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.topnav-theme-toggle:hover { background: var(--bg-2); }
[data-theme="light"] .topnav-theme-icon-dark { display: none; }
[data-theme="dark"] .topnav-theme-icon-light { display: none; }

/* =============================================================
   Content shell
   ============================================================= */
main.content {
  margin: 0;
  padding: 0;
  min-height: calc(100vh - var(--nav-height));
  opacity: 0;
  transition: opacity 220ms ease;
}
main.content.is-visible { opacity: 1; }

/* =============================================================
   Buttons (Cinematic V2 style — pill shape, optional solid fill)
   ============================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  padding: 13px 20px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  border-radius: 999px;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn--primary:hover {
  background: transparent;
  color: var(--ink);
}
.btn--solid {
  background: var(--tab-accent, var(--ink));
  color: #0E0E0C;
  border-color: var(--tab-accent, var(--ink));
}
.btn--solid:hover {
  background: transparent;
  color: var(--tab-accent, var(--ink));
}

/* =============================================================
   Project tab — Cinematic V2 view structure
   Per-project accent color is set on the .view section as `--c`.
   ============================================================= */
.proj-view { display: block; }

.p-hero {
  padding: 48px 56px 40px;
  position: relative;
  background: linear-gradient(135deg, var(--tab-accent), color-mix(in srgb, var(--tab-accent) 50%, #1A1A18));
  color: #0E0E0C;
  overflow: hidden;
}
.p-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, transparent 0 22px, rgba(0,0,0,0.05) 22px 23px);
  pointer-events: none;
}
.p-hero-eye {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}
.p-hero-eye-line {
  flex: 0 0 36px;
  height: 1px;
  background: rgba(0,0,0,0.45);
}
.p-hero-eye-text {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.65);
  font-weight: 500;
}
.p-hero-headline {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" 64;
  font-size: clamp(40px, 7vw, 72px);
  line-height: 0.96;
  letter-spacing: -0.025em;
  margin: 0;
  color: #0E0E0C;
  max-width: 18ch;
  position: relative;
  z-index: 1;
}
.p-hero-headline em {
  font-style: italic;
  font-weight: 400;
  color: rgba(14, 14, 12, 0.55);
}
.p-hero-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.6fr repeat(4, 1fr);
  gap: 24px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid rgba(0,0,0,0.18);
}
@media (max-width: 900px) {
  .p-hero-strip { grid-template-columns: 1fr 1fr; }
}
.p-hero-impact {
  font-size: 16px;
  line-height: 1.45;
  color: rgba(0, 0, 0, 0.78);
  font-weight: 400;
  max-width: 42ch;
  margin: 0;
}
.p-hero-stats {
  display: contents;
}
.p-hero-stats .stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.p-hero-stats .stat-v {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.015em;
  color: #0E0E0C;
  line-height: 1;
}
.p-hero-stats .stat-k {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.6);
  font-weight: 500;
}

/* p-body — three-column "case study" layout */
.p-body {
  padding: 56px 56px 40px;
  display: grid;
  grid-template-columns: 240px 1fr 1fr;
  gap: 48px;
  border-bottom: 1px solid var(--rule);
}
.p-body[hidden] { display: none; }
.p-body--intro {
  grid-template-columns: 240px 1fr;
}
@media (max-width: 900px) {
  .p-body, .p-body--intro {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 40px 28px 32px;
  }
}
.p-body-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0;
  font-weight: 500;
}
.p-body-label .label { display: block; }
.p-body-label b {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-transform: none;
  margin-top: 6px;
}
.p-body-col[hidden] { display: none; }
.p-body-col h4 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.012em;
  margin: 0 0 12px;
  color: var(--ink);
}
.p-body-prose {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 46ch;
}
.p-body-prose p { margin: 0 0 12px; }
.p-body-prose p:last-child { margin-bottom: 0; }
.p-body-intro-text {
  font-family: var(--font-display);
  font-weight: 400;
  font-variation-settings: "opsz" 32;
  font-size: 22px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
  max-width: 52ch;
}

/* p-stack — horizontal chip row */
.p-stack {
  padding: 32px 56px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  border-bottom: 1px solid var(--rule);
}
@media (max-width: 900px) { .p-stack { padding: 24px 28px; } }
.p-stack-lead {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-right: 12px;
  font-weight: 500;
}
.p-stack-chips {
  display: contents;
}
.p-stack-chips > span {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid var(--rule);
  padding: 7px 12px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  font-weight: 500;
}

/* p-shot — full-bleed image / mockup container */
.p-shot {
  padding: 64px 56px 64px;
  background: var(--bg-2);
}
@media (max-width: 900px) { .p-shot { padding: 40px 28px; } }
.p-shot-cap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.p-shot-cap-l {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.p-shot-cap-l b {
  color: var(--ink);
  font-weight: 500;
  margin-right: 10px;
}
.p-shot-cap-r {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--tab-accent, var(--ink));
  letter-spacing: 0.04em;
}
.p-shot-body { display: block; cursor: pointer; }

/* p-cta — bottom strip with title + button row */
.p-cta {
  padding: 48px 56px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
  border-bottom: 1px solid var(--rule);
}
@media (max-width: 900px) {
  .p-cta {
    grid-template-columns: 1fr;
    padding: 40px 28px;
    gap: 20px;
  }
}
.p-cta-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: -0.018em;
  margin: 0;
  max-width: 24ch;
  color: var(--ink);
}
.p-cta-title em { color: var(--ink-3); font-style: italic; font-weight: 300; }
.p-cta-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* =============================================================
   Cinematic V2 "browser" mockup chrome — used inside p-shot-body
   so per-project mockup fragments inherit a consistent shell.
   ============================================================= */
.cinema-browser {
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
  max-width: 920px;
  margin: 0 auto;
  color: #0E0E0C;
  font-family: var(--font-sans);
}
.cinema-browser-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: #F4F1EA;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.cinema-browser-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #D9D5CB;
}
.cinema-browser-url {
  flex: 1;
  text-align: center;
  background: #fff;
  padding: 5px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #7C7868;
  letter-spacing: 0.04em;
}
.cinema-browser-body { padding: 24px; }

/* =============================================================
   Video modal — adjusted for dark scheme
   ============================================================= */
.video-modal[hidden] { display: none; }
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
}
.video-modal-dialog {
  position: relative;
  width: min(900px, 100%);
  background: var(--bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.video-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 22px;
  z-index: 1;
}
.video-modal-video {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
}

/* =============================================================
   Mobile overrides
   ============================================================= */
@media (max-width: 720px) {
  .topnav {
    padding: 0 16px;
    gap: 8px;
  }
  .topnav-brand-role { display: none; }
  .topnav-avail { display: none; }
  .p-hero { padding: 32px 28px; }
  .p-hero-headline { font-size: clamp(36px, 9vw, 56px); }
  .p-hero-strip { grid-template-columns: 1fr; gap: 16px; }
}
