/* Nebulonix design tokens */
:root {
  --bg: oklch(0.26 0.014 250);
  --bg-2: oklch(0.31 0.015 250);
  --bg-3: oklch(0.36 0.016 250);
  --ink: oklch(0.98 0.008 85);
  --ink-2: oklch(0.88 0.010 85);
  --ink-3: oklch(0.72 0.012 85);
  --line: oklch(0.40 0.014 250);
  --line-2: oklch(0.48 0.016 250);
  --accent: oklch(0.82 0.17 85);
  --accent-2: oklch(0.74 0.16 85);
  --accent-ink: oklch(0.22 0.03 85);
  --paper: oklch(0.97 0.006 85);
  --paper-2: oklch(0.93 0.008 85);
  --paper-ink: oklch(0.24 0.010 250);
  --paper-ink-2: oklch(0.46 0.012 250);
  --paper-line: oklch(0.86 0.010 85);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 22px;
  --density-y: 1;
  --container: 1280px;
  --shadow-soft: 0 1px 0 oklch(1 0 0 / 0.04) inset, 0 30px 60px -30px oklch(0.12 0.02 250 / 0.6);
  --logo-filter: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

.serif { font-family: 'Instrument Serif', 'Times New Roman', serif; font-weight: 400; letter-spacing: -0.01em; }
.mono { font-family: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace; font-feature-settings: "ss02"; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--accent); color: var(--accent-ink); }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 32px;
}

.eyebrow {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.h-display {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: clamp(56px, 8vw, 128px);
  line-height: 0.95;
  letter-spacing: -0.025em;
}
.h-1 {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: clamp(42px, 5vw, 88px);
  line-height: 1;
  letter-spacing: -0.02em;
}
.h-2 {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: clamp(32px, 3.4vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.015em;
}
.h-3 {
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 500;
}

.italic-s { font-style: italic; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: transform .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { transform: translateY(-1px); background: var(--accent-2); }
.btn-ghost {
  border: 1px solid var(--line-2);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--ink-2); background: oklch(1 0 0 / 0.04); }
.btn-light-ghost {
  border: 1px solid var(--paper-line);
  color: var(--paper-ink);
}

/* Cards */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: calc(28px * var(--density-y));
}

/* Paper section */
.paper {
  background: var(--paper);
  color: var(--paper-ink);
}
.paper .eyebrow { color: var(--paper-ink-2); }

/* Utility */
.divider { height: 1px; background: var(--line); }
.paper .divider { background: var(--paper-line); }

.marquee-wrap { overflow: hidden; }
.marquee {
  display: flex;
  gap: 56px;
  animation: marquee 40s linear infinite;
  white-space: nowrap;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Animations */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }
@keyframes typing { from { width: 0; } to { width: 100%; } }
@keyframes pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }

.fade-up { animation: fadeUp .6s ease both; }

/* Density toggles */
[data-density="compact"] { --density-y: 0.72; }
[data-density="spacious"] { --density-y: 1.22; }

/* Light mode */
[data-theme="light"] {
  --bg: oklch(0.97 0.006 85);
  --bg-2: oklch(0.94 0.008 85);
  --bg-3: oklch(0.91 0.009 85);
  --ink: oklch(0.24 0.010 250);
  --ink-2: oklch(0.40 0.012 250);
  --ink-3: oklch(0.56 0.014 250);
  --line: oklch(0.86 0.010 85);
  --line-2: oklch(0.78 0.012 85);
  --shadow-soft: 0 1px 0 oklch(1 0 0 / 0.6) inset, 0 30px 60px -30px oklch(0.24 0.03 250 / 0.22);
  --logo-filter: none;
}

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Responsive layout helpers ---------- */
.stack-on-md { display: grid; gap: 24px; }

/* Collapse any CSS-grid / flex-row inline layouts to single column on tablet/phone */
@media (max-width: 1024px) {
  .container { padding: 0 24px; }
  /* Generic: collapse multi-col CSS Grids we declared inline */
  .row-split > * { min-width: 0; }
  /* Cards two-up */
  .cases-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 820px) {
  :root { --container: 100%; }
  .container { padding: 0 20px; }
  body { font-size: 15px; }

  /* Force every inline 2-col / 3-col / 4-col grid to single column */
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* Keep tidy 2-col for metric/contact blocks we explicitly opt-in */
  .keep-2col[style*="grid-template-columns"] { grid-template-columns: 1fr 1fr !important; }

  /* Service-grid tiles span full width */
  .service-tiles > * { grid-column: 1 / -1 !important; }

  /* Legal sidebar → top nav */
  .legal-layout { grid-template-columns: 1fr !important; gap: 32px !important; }
  .legal-toc { position: relative !important; top: 0 !important; }
  .legal-toc-links { flex-direction: row !important; flex-wrap: wrap; gap: 6px !important; }
  .legal-toc-links a { padding: 6px 10px !important; border-left: 0 !important; border: 1px solid var(--line) !important; border-radius: 999px; font-size: 11px !important; }

  /* Hero + content grids */
  .hero-split { grid-template-columns: 1fr !important; gap: 40px !important; }

  /* Nav — hide desktop links, show hamburger */
  .nav-links-desktop { display: none !important; }
  .nav-cta-desktop { display: none !important; }
  .nav-hamburger { display: inline-flex !important; }

  /* Filter rows: allow wrap & horizontal scroll */
  .filter-row { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; scrollbar-width: none; }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-row > * { flex: 0 0 auto; }

  /* Typography scales */
  .h-display { font-size: clamp(44px, 12vw, 72px) !important; }
  .h-1 { font-size: clamp(36px, 10vw, 60px) !important; }
  .h-2 { font-size: clamp(28px, 7vw, 44px) !important; }

  /* Section padding */
  section[style*="padding: '120px 0"], section[style*="padding:120px 0"] { padding: 64px 0 !important; }
  section[style*="padding: '80px 0"] { padding: 48px 0 !important; }

  /* Tables/list rows collapse */
  .role-row, .post-row { grid-template-columns: 1fr !important; gap: 8px !important; }
  .role-row > *, .post-row > * { text-align: left !important; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr 1fr !important; gap: 32px !important; }
  .footer-wordmark-row { flex-direction: column !important; align-items: flex-start !important; gap: 20px !important; }
  .footer-wordmark-row img { height: clamp(56px, 18vw, 110px) !important; }

  /* Tweaks panel — smaller */
  .tweaks-panel { right: 12px !important; bottom: 12px !important; max-width: calc(100vw - 24px); }

  /* Buttons wrap */
  .btn { padding: 12px 18px; font-size: 13px; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .h-display { font-size: 44px !important; line-height: 1 !important; }
  .h-1 { font-size: 36px !important; }
  .h-2 { font-size: 28px !important; }
  .footer-grid { grid-template-columns: 1fr !important; }
}

/* Ensure images and SVGs never break the viewport */
img, svg, video, canvas { max-width: 100%; height: auto; }

/* Global overflow guard for decorative absolute children */
html, body { overflow-x: hidden; }
section { position: relative; }

/* Allow text-wrap pretty on long headings */
h1, h2, h3, .h-display, .h-1, .h-2 { text-wrap: balance; overflow-wrap: break-word; word-break: normal; hyphens: auto; }
