/* =========================================================
   CORTEXA — DESIGN SYSTEM
   Documentary-industrial. Slate + warm white. Hairline rules.
   ========================================================= */

:root {
  /* Surfaces */
  --slate-900: #0a1018;
  --slate-800: #0E1726;
  --slate-700: #18233a;
  --slate-600: #233148;
  --slate-500: #364359;
  --slate-400: #5b667c;
  --slate-300: #A5ADB8;
  --slate-200: #D5D9DE;
  --slate-100: #E6E8EC;

  --warm-white: #F5F2EC;
  --warm-white-2: #EDE9E0;
  --warm-white-3: #E2DDD0;

  --ink: #1B2330;
  --ink-2: #2C3545;
  --ink-3: #4F5867;
  --ink-4: #7A8290;

  /* Accents */
  --amber: #F2A04B;
  --amber-dim: #B97732;
  --teal: #2E7D7A;
  --teal-dim: #1E5654;
  --coral: #D9534F;

  /* Type */
  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Layout */
  --maxw: 1280px;
  --gutter: 24px;
  --section-pad-y: 128px;

  /* Rules */
  --hair: 1px solid rgba(255,255,255,0.08);
  --hair-dark: 1px solid rgba(27,35,48,0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-feature-settings: "ss01", "cv11";
  color: var(--ink);
  background: var(--warm-white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* Typography utilities */
.font-display { font-family: var(--font-display); letter-spacing: -0.02em; }
.font-mono { font-family: var(--font-mono); letter-spacing: 0.02em; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  font-weight: 500;
}
.eyebrow.on-dark { color: var(--slate-300); }
.eyebrow .num { color: var(--teal); margin-right: 8px; }
.eyebrow.on-dark .num { color: var(--amber); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.025em;
  margin: 0;
  text-wrap: balance;
  line-height: 1.05;
}

p { margin: 0; line-height: 1.6; text-wrap: pretty; }

/* Containers */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.container-wide { max-width: 1440px; margin: 0 auto; padding: 0 var(--gutter); }

/* Section helpers */
section { position: relative; }
.section { padding-block: var(--section-pad-y); }
.section-sm { padding-block: 80px; }

.on-dark {
  background: var(--slate-800);
  color: var(--slate-100);
}
.on-dark h1, .on-dark h2, .on-dark h3 { color: #fff; }
.on-dark p { color: var(--slate-200); }

.on-light h1, .on-light h2, .on-light h3 { color: var(--ink); }
.on-light p { color: var(--ink-2); }

/* Hairline rules */
.rule { height: 1px; background: rgba(255,255,255,0.08); width: 100%; }
.rule-dark { height: 1px; background: rgba(27,35,48,0.12); width: 100%; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  border-radius: 0;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.btn .arrow { transition: transform 0.18s ease; }
.btn:hover .arrow { transform: translateX(3px); }

.btn-primary {
  background: var(--amber);
  color: var(--slate-900);
  border-color: var(--amber);
}
.btn-primary:hover { background: #f5b06b; border-color: #f5b06b; }

.btn-ghost-dark {
  background: transparent;
  color: var(--slate-100);
  border-color: rgba(255,255,255,0.22);
}
.btn-ghost-dark:hover { border-color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.04); }

.btn-ghost-light {
  background: transparent;
  color: var(--ink);
  border-color: rgba(27,35,48,0.22);
}
.btn-ghost-light:hover { border-color: var(--ink); }

.btn-link {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid currentColor;
  transition: gap 0.18s ease;
  color: inherit;
}
.btn-link:hover { gap: 12px; }
.btn-link.accent-teal { color: var(--teal); }
.btn-link.accent-amber { color: var(--amber); }

/* Mono chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  color: var(--slate-300);
  background: transparent;
  white-space: nowrap;
}
.chip-solid {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.12);
}
.chip-dot::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Image placeholder — documentary frame */
.photo-slot {
  position: relative;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(242,160,75,0.06), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(46,125,122,0.08), transparent 55%),
    linear-gradient(180deg, #0a1320 0%, #14202f 100%);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.photo-slot::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(255,255,255,0.018) 39px 40px),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(255,255,255,0.018) 39px 40px);
  pointer-events: none;
}
.photo-slot::after {
  /* film-grain feel */
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.08 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.4;
  mix-blend-mode: overlay;
  pointer-events: none;
}
.photo-slot .photo-meta {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  z-index: 2;
}
.photo-slot .photo-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
}
.photo-slot .photo-caption {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: rgba(255,255,255,0.78);
  max-width: 60%;
  text-align: right;
}
.photo-slot .photo-corner {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  z-index: 2;
}
.photo-slot .photo-corner::before,
.photo-slot .photo-corner::after { content: ""; }
.photo-slot.light {
  background:
    linear-gradient(180deg, #efebe0 0%, #e2ddcf 100%);
  border-color: rgba(27,35,48,0.08);
}
.photo-slot.light::before {
  background-image:
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(27,35,48,0.04) 39px 40px),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(27,35,48,0.04) 39px 40px);
}
.photo-slot.light::after { opacity: 0.15; mix-blend-mode: multiply; }
.photo-slot.light .photo-tag { color: rgba(27,35,48,0.55); }
.photo-slot.light .photo-caption { color: rgba(27,35,48,0.78); }
.photo-slot.light .photo-corner { color: rgba(27,35,48,0.45); }

/* When a real photo is provided, suppress the placeholder treatment */
.photo-slot.has-photo { background: var(--slate-900); }
.photo-slot.has-photo::before,
.photo-slot.has-photo::after { display: none; }

/* Subtle grid background */
.bg-grid {
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 80px 80px;
}
.bg-grid-light {
  background-image:
    linear-gradient(rgba(27,35,48,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27,35,48,0.04) 1px, transparent 1px);
  background-size: 80px 80px;
}

/* Nav */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(14,23,38,0.85);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: var(--slate-100);
}
.topbar-inner {
  display: flex;
  align-items: center;
  height: 68px;
  gap: 36px;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: #fff;
}
.brand-mark .mark-glyph {
  width: 22px; height: 22px;
}
.nav-links { display: flex; gap: 28px; flex: 1; }
.nav-item {
  position: relative;
  font-size: 14px;
  color: var(--slate-200);
  padding: 10px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: none;
  background: none;
}
.nav-item:hover { color: #fff; }
.nav-item .chev {
  width: 9px; height: 9px;
  border-right: 1.4px solid currentColor;
  border-bottom: 1.4px solid currentColor;
  transform: rotate(45deg);
  margin-top: -3px;
}

.dropdown {
  position: absolute;
  top: calc(100% + 0px);
  left: 0;
  min-width: 460px;
  background: var(--slate-800);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all 0.18s ease;
}
.dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }

.dropdown-row {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 14px;
  padding: 12px 12px;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.12s ease;
  color: var(--slate-100);
}
.dropdown-row:hover { background: rgba(255,255,255,0.04); }
.dropdown-row .num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--slate-400);
  padding-top: 4px;
}
.dropdown-row .title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15px;
  color: #fff;
  letter-spacing: -0.015em;
}
.dropdown-row .desc {
  font-size: 12.5px;
  color: var(--slate-300);
  margin-top: 2px;
  line-height: 1.5;
}
.dropdown-foot {
  margin-top: 6px;
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate-400);
}
.dropdown-foot a { color: var(--amber); }

/* Region toggle */
.region {
  display: inline-flex;
  align-items: center;
  gap: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.03);
  margin-right: 16px;
}
.region button {
  background: none;
  border: none;
  color: var(--slate-300);
  padding: 8px 12px;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
.region button.active {
  background: var(--slate-100);
  color: var(--slate-900);
}

/* Footer */
.footer {
  background: var(--slate-900);
  color: var(--slate-200);
  padding: 96px 0 32px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 80px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.footer-col h5 {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--slate-400);
  margin: 0 0 18px;
  font-weight: 500;
}
.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-col a {
  font-size: 13.5px;
  color: var(--slate-200);
}
.footer-col a:hover { color: #fff; }
.footer-tag {
  font-size: 13px;
  color: var(--slate-300);
  margin-top: 14px;
  max-width: 260px;
  line-height: 1.5;
}
.footer-bottom {
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--slate-400);
  letter-spacing: 0.02em;
}

/* Section eyebrow row */
.section-head {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(27,35,48,0.12);
  margin-bottom: 64px;
}
.section-head.on-dark-head { border-color: rgba(255,255,255,0.10); }
.section-head .lead { flex: 1; }
.section-head h2 {
  font-size: clamp(36px, 4.4vw, 56px);
  font-weight: 500;
  margin-top: 18px;
  max-width: 22ch;
}
.section-head .side-note {
  max-width: 360px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-3);
  padding-bottom: 6px;
}
.on-dark-head .side-note { color: var(--slate-300); }

/* Reveal-on-scroll */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* Page transition root */
#root { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }

/* Responsive */
@media (max-width: 920px) {
  :root { --section-pad-y: 72px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .nav-links { display: none; }
}
