/* Entropia design system — adapted from /Users/mark/Downloads/Entropia for t3_site */

/* ENTROPIA — Design Tokens & Base Styles */

:root {
  /* Core palette — "Terracotta in the Soft" */
  /* Brand tokens */
  --color-primary:      #3B2118;   /* тёмно-коричневый — текст, заголовки */
  --color-accent:       #8B3326;   /* терракотовый — кнопки, ссылки */
  --color-accent-hover: #6E2419;   /* акцент при наведении */
  --color-bg:           #FAFAF8;   /* фон страницы */
  --color-beige:        #E8DCD0;   /* бежевый */
  --color-beige-light:  #F4EDE6;   /* светлый бежевый */
  --color-blue:         #BFCDD1;   /* холодный голубой акцент */
  --color-muted:        #7A7167;   /* приглушённый текст */
  --color-white:        #FFFFFF;

  /* Semi-transparent tints */
  --primary-04: rgba(59, 33, 24, 0.04);
  --primary-06: rgba(59, 33, 24, 0.06);
  --primary-08: rgba(59, 33, 24, 0.08);
  --primary-10: rgba(59, 33, 24, 0.10);
  --primary-12: rgba(59, 33, 24, 0.12);
  --accent-12:  rgba(139, 51, 38, 0.12);
  --accent-15:  rgba(139, 51, 38, 0.15);
  --accent-30:  rgba(139, 51, 38, 0.30);
  --blue-08:    rgba(191, 205, 209, 0.08);
  --blue-10:    rgba(191, 205, 209, 0.10);
  --beige-50:   rgba(232, 220, 208, 0.50);
  --beige-60:   rgba(232, 220, 208, 0.60);
  --beige-70:   rgba(232, 220, 208, 0.70);
  --bg-98:      rgba(250, 250, 248, 0.98);
  --shadow:     rgba(0, 0, 0, 0.15);

  /* Legacy aliases — keep existing component CSS working */
  --carbon: var(--color-bg);              /* page bg */
  --carbon-2: var(--color-beige-light);   /* surface */
  --carbon-3: var(--color-beige);         /* raised */
  --carbon-4: #DCCBB8;                    /* deeper sand */
  --line: rgba(59, 33, 24, 0.10);         /* hairlines on light */
  --line-2: rgba(59, 33, 24, 0.18);       /* stronger lines */
  --titanium: var(--color-primary);       /* primary text */
  --titanium-dim: #5A3A2C;                /* body text */
  --titanium-mute: var(--color-muted);
  --titanium-faint: #A89E92;

  /* Accent alias */
  --accent: var(--color-accent);
  --accent-glow: var(--accent-30);
  --accent-soft: var(--accent-12);

  /* Type */
  --font-sans: "Inter Tight", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;

  /* Scale */
  --fs-base: 15px;
  --fs-sm: 12px;
  --fs-xs: 11px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 32px;
  --fs-3xl: 48px;
  --fs-display: clamp(56px, 9vw, 148px);
  --fs-mega: clamp(80px, 14vw, 220px);

  /* Spacing — 8pt with sub-grid */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;
  --s-10: 128px;

  /* Geometry */
  --r-sm: 2px;
  --r-md: 4px;
  --r-lg: 8px;

  --hairline: 1px solid var(--line);
  --hairline-2: 1px solid var(--line-2);
  --hairline-faint: 1px solid rgba(255, 255, 255, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--carbon);
  color: var(--titanium);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.45;
  font-feature-settings: "ss01", "cv11", "tnum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(1200px 800px at 80% -10%, var(--blue-10), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, var(--beige-60), transparent 60%),
    var(--color-bg);
}

::selection { background: var(--color-accent); color: var(--color-white); }

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

.mono { font-family: var(--font-mono); font-feature-settings: "zero", "ss02"; }
.dim { color: var(--titanium-dim); }
.mute { color: var(--titanium-mute); }
.faint { color: var(--titanium-faint); }
.accent { color: var(--accent); }

/* Section frame */
.section {
  position: relative;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--s-10) var(--s-7);
  border-top: var(--hairline);
}
.section:first-of-type { border-top: none; }

@media (max-width: 720px) {
  .section { padding: var(--s-9) var(--s-5); }
}

/* Eyebrow — small uppercase mono label */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--titanium-mute);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.eyebrow::before {
  content: "";
  width: 18px; height: 1px;
  background: var(--titanium-faint);
  display: inline-block;
}

/* Hairline grid backdrop */
.grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(26, 27, 31, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(26, 27, 31, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  padding: 14px 22px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  transition: all 200ms ease;
  background: transparent;
  color: var(--titanium);
}
.btn:hover {
  border-color: var(--titanium);
  background: var(--titanium);
  color: var(--carbon);
}
.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-white);
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  color: var(--color-white);
  border-color: var(--color-accent-hover);
  box-shadow: 0 8px 32px var(--accent-30);
}
.btn .arr { transition: transform 200ms ease; }
.btn:hover .arr { transform: translateX(4px); }

/* Tag chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--titanium-dim);
  border-radius: 100px;
}
.chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* Hairline divider with mono caption */
.divider {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin: var(--s-6) 0;
}
.divider .line { flex: 1; height: 1px; background: var(--line); }
.divider .num {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--titanium-mute);
}

/* Display type */
.display {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--fs-display);
  line-height: 0.92;
  letter-spacing: -0.04em;
  color: var(--titanium);
}
.display-mega {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--fs-mega);
  line-height: 0.88;
  letter-spacing: -0.05em;
}

h1, h2, h3, h4 { font-weight: 500; letter-spacing: -0.02em; }

/* Logo lockup */
.logo {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

/* Subtle entrance */
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.rise { animation: rise 800ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.rise.d1 { animation-delay: 80ms; }
.rise.d2 { animation-delay: 160ms; }
.rise.d3 { animation-delay: 240ms; }
.rise.d4 { animation-delay: 320ms; }
.rise.d5 { animation-delay: 400ms; }

@keyframes blink { 50% { opacity: 0.2; } }
.blink { animation: blink 1.4s steps(2) infinite; }

/* Caret */
.caret {
  display: inline-block;
  width: 0.6em; height: 1em;
  background: #41B6E6;
  vertical-align: -0.12em;
  margin-left: 0.1em;
  animation: blink 1.05s steps(2) infinite;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--carbon); }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--titanium-mute); }

/* No-noise focus */
:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

/* Utility */
.row { display: flex; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.gap-5 { gap: var(--s-5); }
.gap-6 { gap: var(--s-6); }
.gap-8 { gap: var(--s-8); }
.center { align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.full { width: 100%; }

/* ===== NAV ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 248, 0.85);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: var(--hairline);
}
.nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px var(--s-7);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-7);
}
.nav-logo { display: inline-flex; align-items: center; gap: 12px; }
.nav-mark {
  color: var(--titanium);
  display: inline-flex;
  align-items: center;
  width: 84px;
  height: 49px;
}
.nav-mark > img { width: 100%; height: 100%; object-fit: contain; }
.nav-burst { width: 100%; height: 100%; display: block; overflow: visible; }
.nav-items { display: flex; gap: 4px; justify-content: center; }
.nav-item {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 8px 12px;
  color: var(--titanium-mute);
  transition: color 160ms ease;
  border-radius: 2px;
}
.nav-item:hover { color: var(--titanium); }
.nav-item.is-active { color: var(--titanium); background: rgba(26, 27, 31, 0.05); }
.nav-right { display: flex; align-items: center; gap: var(--s-4); }
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10px; letter-spacing: 0.18em; color: var(--titanium-mute);
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent-glow);
  animation: blink 2.4s ease-in-out infinite;
}
.nav-cta { padding: 10px 16px; }

@media (max-width: 980px) {
  .nav-items { display: none; }
  .nav-right .status { display: none; }
}

/* ===== HERO ===== */
.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  padding: var(--s-9) var(--s-7);
  max-width: 1440px;
  margin: 0 auto;
  overflow: hidden;
}
.hero-canvas { position: absolute; inset: 0; pointer-events: auto; }
.hero-content {
  position: relative;
  z-index: 2;
  pointer-events: none;
}
.hero-content > * { pointer-events: auto; }
.hero-corner {
  position: absolute;
  z-index: 3;
  pointer-events: none;
}
.hero-corner.tl { top: 32px; left: 48px; }
.hero-corner.tr { top: 32px; right: 48px; text-align: right; }
.hero-corner.bl { bottom: 32px; left: 48px; }
.hero-corner.br { bottom: 32px; right: 48px; text-align: right; }

.hero-stats {
  margin-top: var(--s-9);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-5);
  border-top: var(--hairline);
  padding-top: var(--s-5);
  max-width: 880px;
}
.hstat { display: flex; flex-direction: column; }

@media (max-width: 720px) {
  .hero { padding: var(--s-7) var(--s-5); }
  .hero-corner.tl, .hero-corner.tr, .hero-corner.bl, .hero-corner.br { display: none; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ===== SERVICES ===== */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: var(--hairline);
  border-left: var(--hairline);
}
.service-card {
  padding: var(--s-6) var(--s-5);
  border-right: var(--hairline);
  border-bottom: var(--hairline);
  transition: background 200ms ease;
  position: relative;
  min-height: 280px;
}
.service-card:hover { background: var(--blue-08); }
.service-card::after {
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 400ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.service-card:hover::after { width: 100%; }

@media (max-width: 980px) { .services-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .services-grid { grid-template-columns: 1fr; } }

/* ===== PHILOSOPHY ===== */
.phil-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--s-9);
  align-items: start;
}
.phil-quote {
  border-left: 1px solid var(--accent);
  padding-left: var(--s-6);
}
.phil-formula {
  margin-top: var(--s-7);
  padding: 20px 24px;
  background: rgba(255, 255, 255, 0.5);
  border: var(--hairline);
  font-size: 14px;
}
.phil-pillars { display: flex; flex-direction: column; gap: var(--s-5); }
.pillar {
  padding: var(--s-5);
  border: var(--hairline);
  background: rgba(255, 255, 255, 0.5);
}
@media (max-width: 900px) { .phil-grid { grid-template-columns: 1fr; gap: var(--s-7); } }

/* ===== CASES ===== */
.cases-table {
  border-top: var(--hairline);
}
.case-head, .case-row {
  display: grid;
  grid-template-columns: 80px 2fr 1fr 1fr 80px 40px;
  gap: var(--s-5);
  padding: var(--s-4) 0;
  border-bottom: var(--hairline);
  align-items: center;
}
.case-head {
  font-size: 10px; letter-spacing: 0.2em; color: var(--titanium-faint);
  padding: 12px 0;
}
.case-row {
  transition: background 160ms ease, padding 200ms ease;
  cursor: pointer;
}
.case-row:hover {
  background: linear-gradient(to right, var(--accent-12), transparent 40%);
  padding-left: 12px;
}
.case-arrow { transition: transform 200ms ease; }
.case-row:hover .case-arrow { transform: translateX(4px); color: var(--accent); }

@media (max-width: 800px) {
  .case-head { display: none; }
  .case-row { grid-template-columns: 1fr; gap: 8px; padding: var(--s-4) 0; }
  .case-arrow { display: none; }
}

/* ===== CASES · DIRECTIONS PICKER ===== */
/* Direction blocks reuse .service-card; reset native <button> styling. */
.cat-card {
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.cat-card.is-active { background: var(--accent-12); }
.cat-card.is-active::after { width: 100%; }

/* Back link above the filtered list. */
.cases-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: var(--s-6);
  cursor: pointer;
  color: var(--titanium-dim);
  font-size: 12px;
  letter-spacing: 0.12em;
  transition: color 160ms ease, transform 200ms ease;
}
.cases-back:hover { color: var(--accent); transform: translateX(-3px); }

/* Empty-state for directions without published cases. */
.cases-empty {
  border-top: var(--hairline);
  padding: var(--s-7) 0;
}

/* JS-driven view: shown only when <html class="cases-js"> is set by
   cases-filter.js. Without JS, none of these apply, so the picker and every
   case group stay visible (graceful fallback). */
.cases-js [data-directions].is-hidden { display: none; }
.cases-js [data-cases-list] { display: none; }
.cases-js [data-cases-list].is-active { display: block; }
.cases-js [data-case-group] { display: none; }
.cases-js [data-case-group].is-active { display: block; }
/* Back button only matters with JS. */
.cases-back { display: none; }
.cases-js [data-cases-list].is-active .cases-back { display: inline-flex; }

/* ===== DASHBOARD ===== */
.dash {
  border: var(--hairline);
  background: rgba(255, 255, 255, 0.6);
}
.dash-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: var(--hairline);
}
.chip.alert {
  border-color: #FF6B6B;
  color: #FF6B6B;
  animation: blink 0.8s steps(2) infinite;
}
.dash-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.metric {
  padding: var(--s-5);
  border-right: var(--hairline);
  border-bottom: var(--hairline);
}
.metric:last-child { border-right: none; }
.metric-val {
  font-size: 36px;
  letter-spacing: -0.02em;
  margin-top: 12px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.metric-bar {
  margin-top: 16px;
  height: 2px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.metric-fill {
  height: 100%;
  background: var(--accent);
  transition: width 800ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.dash-chart {
  padding: var(--s-5);
}
@media (max-width: 900px) { .dash-grid { grid-template-columns: repeat(2, 1fr); } }

/* ===== CONTACT ===== */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-9);
  align-items: start;
}
.contact-meta {
  margin-top: var(--s-7);
  border-top: var(--hairline);
  padding-top: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.contact-meta > div { display: flex; gap: 16px; font-size: 12px; }
.contact-meta .faint { width: 80px; letter-spacing: 0.16em; font-size: 10px; }
.form { display: flex; flex-direction: column; gap: var(--s-5); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 10px; letter-spacing: 0.2em; }
.field input, .field textarea {
  font-family: var(--font-sans);
  font-size: 15px;
  background: transparent;
  border: none;
  border-bottom: var(--hairline);
  color: var(--titanium);
  padding: 12px 0;
  transition: border-color 200ms ease;
  resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-bottom-color: var(--accent);
}
.field input::placeholder, .field textarea::placeholder {
  color: var(--titanium-faint);
}
.err { color: #FF6B6B; font-size: 11px; letter-spacing: 0.12em; }
.form-success {
  padding: var(--s-7);
  border: var(--hairline);
  background: rgba(255, 255, 255, 0.6);
}
@media (max-width: 800px) { .contact-grid { grid-template-columns: 1fr; gap: var(--s-7); } }

/* ===== FOOTER ===== */
.footer {
  border-top: var(--hairline);
  padding: var(--s-7) 0;
}
.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--s-7);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-4);
}

/* ===== SECTION DIVIDER (between guide and site) ===== */
.handoff {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--s-9) var(--s-7);
  border-top: var(--hairline);
  border-bottom: var(--hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-5);
  flex-wrap: wrap;
}
.handoff h3 { font-size: 28px; letter-spacing: -0.02em; }
.handoff .mono { font-size: 11px; letter-spacing: 0.18em; color: var(--titanium-mute); }

/* ===== Compact hero (used on secondary pages) ===== */
.hero.hero-compact {
  min-height: 60vh;
  padding: var(--s-9) var(--s-7);
}
.hero.hero-compact .hero-corner { display: none; }
.hero.hero-compact .hero-stats { display: none; }

/* ===== FAQ — Entropia restyle ===== */
.faq-list { border-top: var(--hairline); }
.faq-item { border-bottom: var(--hairline); }
.faq-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: 60px 1fr 24px;
  gap: var(--s-4);
  align-items: center;
  padding: var(--s-5) 0;
  background: none;
  border: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: padding 200ms ease;
}
.faq-toggle:hover { padding-left: 8px; }
.faq-toggle .faq-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
}
.faq-toggle .faq-icon {
  font-family: var(--font-mono);
  color: var(--titanium-mute);
  transition: transform 200ms ease;
}
.faq-toggle.active .faq-icon { transform: rotate(45deg); color: var(--accent); }
.faq-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 400ms cubic-bezier(0.4,0,0.2,1), padding 400ms ease;
}
.faq-content.open {
  max-height: 800px;
  padding: 0 0 var(--s-5) 76px;
}
.faq-content p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--titanium-dim);
  max-width: 720px;
}

/* ===== Process / timeline (Entropia version) ===== */
.process-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: var(--hairline);
}
.process-step {
  background: rgba(255,255,255,0.5);
  padding: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.process-step .step-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
}
.process-step h3 { font-size: 22px; }
.process-step p { font-size: 14px; line-height: 1.55; color: var(--titanium-dim); }
@media (max-width: 800px) { .process-grid { grid-template-columns: 1fr; } }

/* ===== Handoff CTA (light variant) ===== */
.handoff-light {
  background: var(--blue-08);
}

/* ===== Footer dark closing block ===== */
.footer.footer-dark {
  background: var(--titanium);
  color: var(--carbon-3);
  padding: var(--s-8) 0;
  border-top: none;
  margin-top: var(--s-8);
}
.footer.footer-dark .footer-inner { color: var(--carbon-3); }
.footer.footer-dark .mono.faint { color: var(--beige-50); }
.footer.footer-dark a { color: var(--beige-70); }
.footer.footer-dark a:hover { color: var(--carbon-3); }
.footer.footer-dark .logo { color: var(--carbon-3); }

/* ===== Page-specific section variants ===== */
.section-light-blue { background: var(--blue-08); }

/* ===== Mobile menu (kept from old site, lightly restyled) ===== */
.mobile-menu {
  position: fixed;
  inset: 0;
  background: var(--bg-98);
  backdrop-filter: blur(20px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.mobile-menu.open { opacity: 1; pointer-events: auto; }
.mobile-menu a {
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--titanium);
}
.mobile-menu a:hover { color: var(--accent); }

/* ===== Reveal animations (kept from main.js bindings) ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms cubic-bezier(0.4,0,0.2,1), transform 700ms cubic-bezier(0.4,0,0.2,1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ===== CPU intro loader (first-load overlay) =====
   SVG centerpiece adapted from the 21st.dev "cpu-architecture" community
   component (https://21st.dev/community/components/svg-ui/cpu-architecture/default)
   — React/Tailwind ported to vanilla CSS, recolored to the t3_site palette. */
.cpu-intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--color-bg);
  display: grid;
  place-items: center;
  animation: cpuIn 400ms ease both;
}
.cpu-intro.is-fading { animation: cpuOut 600ms cubic-bezier(.2, .7, .2, 1) both; }
@keyframes cpuIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cpuOut { from { opacity: 1; } to { opacity: 0; transform: scale(1.04); } }

.cpu-stage {
  position: relative;
  width: min(720px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Frame around the cpu-architecture SVG. The component's natural aspect ratio
   is 200x100, so we cap the width and let the height follow. */
.cpu-arch-frame {
  width: 100%;
  aspect-ratio: 2 / 1;
  max-height: 60vh;
  padding: 24px;
  border: 1px solid var(--primary-12);
  background: rgba(255, 255, 255, 0.4);
  border-radius: 4px;
}
.cpu-arch-svg {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--color-muted); /* drives stroke="currentColor" on traces */
  animation: cpuTraceFill 1.6s cubic-bezier(.25,.1,.5,1) forwards;
}
/* Traces redden as they draw in: muted → brand accent over the load. */
@keyframes cpuTraceFill {
  0%   { color: var(--color-muted); }
  100% { color: var(--color-accent); }
}

/* Animated light dots: each circle rides its corresponding mask path using
   offset-path. Original 21st.dev component relied on a registry CSS class
   (.cpu-architecture .cpu-line-N) — we replicate it here with named keyframes
   per trace, staggered to feel like packets flowing across the die. */
.cpu-arch-line {
  opacity: 0;
  animation-duration: 3.6s;
  animation-iteration-count: infinite;
  animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
  animation-fill-mode: both;
}
.cpu-arch-line-1 { animation-name: cpuArchLine1; animation-delay: 0.0s; }
.cpu-arch-line-2 { animation-name: cpuArchLine2; animation-delay: 0.5s; }
.cpu-arch-line-3 { animation-name: cpuArchLine3; animation-delay: 1.0s; }
.cpu-arch-line-4 { animation-name: cpuArchLine4; animation-delay: 1.4s; }
.cpu-arch-line-5 { animation-name: cpuArchLine5; animation-delay: 1.8s; }
.cpu-arch-line-6 { animation-name: cpuArchLine6; animation-delay: 0.2s; }
.cpu-arch-line-7 { animation-name: cpuArchLine7; animation-delay: 0.8s; }
.cpu-arch-line-8 { animation-name: cpuArchLine8; animation-delay: 1.2s; }

/* Each keyframe walks the dot from path start → path end via translate.
   Coordinates mirror the mask paths in the SVG. */
@keyframes cpuArchLine1 {
  0% { transform: translate(10px, 20px); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translate(94.5px, 49px); opacity: 0; }
}
@keyframes cpuArchLine2 {
  0% { transform: translate(180px, 10px); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translate(105.3px, 39px); opacity: 0; }
}
@keyframes cpuArchLine3 {
  0% { transform: translate(130px, 20px); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translate(115px, 46.8px); opacity: 0; }
}
@keyframes cpuArchLine4 {
  0% { transform: translate(170px, 80px); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translate(115px, 53px); opacity: 0; }
}
@keyframes cpuArchLine5 {
  0% { transform: translate(135px, 65px); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translate(105.2px, 60px); opacity: 0; }
}
@keyframes cpuArchLine6 {
  0% { transform: translate(94.8px, 95px); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translate(94.8px, 59px); opacity: 0; }
}
@keyframes cpuArchLine7 {
  0% { transform: translate(88px, 88px); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translate(82px, 53px); opacity: 0; }
}
@keyframes cpuArchLine8 {
  0% { transform: translate(30px, 30px); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translate(85px, 51.5px); opacity: 0; }
}

/* Corner labels */
.cpu-meta {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-primary);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
}
.cpu-meta-dim { color: var(--color-muted); }
.cpu-meta-tl { top: 24px; left: 24px; }
.cpu-meta-tr { top: 24px; right: 24px; align-items: flex-end; text-align: right; }
.cpu-meta-bl { bottom: 24px; left: 24px; }
.cpu-meta-br { bottom: 24px; right: 24px; align-items: flex-end; text-align: right; }

/* SKIP button */
.cpu-skip {
  position: fixed;
  top: 24px; right: 24px;
  z-index: 10000;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  padding: 8px 14px;
  border: 1px solid var(--primary-12);
  color: var(--color-muted);
  background: transparent;
  cursor: pointer;
  transition: all 160ms ease;
  text-transform: uppercase;
}
.cpu-skip:hover { color: var(--color-accent); border-color: var(--color-accent); }

/* Caption (eyebrow + ENTROPIA wordmark + tag) — fades in at +1200ms */
.cpu-caption {
  margin-top: 32px;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 600ms ease, transform 600ms cubic-bezier(.2, .7, .2, 1);
}
.cpu-caption.is-on { opacity: 1; transform: translateY(0); }
.cpu-caption-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.2em; color: var(--color-accent);
  text-transform: uppercase;
}
.cpu-caption-logo {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.32em;
  font-size: 28px;
  margin-top: 12px;
  color: var(--color-primary);
}
.cpu-caption-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--color-muted);
  margin-top: 8px;
  text-transform: uppercase;
}

@media (max-width: 600px) {
  .cpu-meta { font-size: 9px; }
  .cpu-meta-tl, .cpu-meta-tr { top: 16px; }
  .cpu-meta-bl, .cpu-meta-br { bottom: 16px; }
  .cpu-meta-tl, .cpu-meta-bl { left: 16px; }
  .cpu-meta-tr, .cpu-meta-br { right: 16px; }
  .cpu-caption-logo { font-size: 22px; }
  .cpu-arch-frame { padding: 12px; }
}

/* Body lock while intro is on */
body.cpu-intro-active { overflow: hidden; }

/* ============================================================
   MOBILE OPTIMISATION
   - Burger button + drawer trigger built by main.js
   - Tames hardcoded inline font-sizes / grid-template-columns via
     attribute selectors (avoids editing 7 HTML files)
   - Tightens vertical rhythm and padding on small screens
   - Stacks complex two-column page layouts (cases, contact, etc.)
   ============================================================ */

/* Burger trigger — hidden by default, shown when nav items collapse */
.nav-burger {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: transparent;
  padding: 0;
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}
.nav-burger:hover { border-color: var(--titanium); background: var(--primary-04); }
.nav-burger > span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--titanium);
  border-radius: 2px;
  transition: transform 200ms ease, opacity 160ms ease;
}

/* Mobile drawer — extend the existing .mobile-menu rules */
.mobile-menu {
  padding: var(--s-9) var(--s-5) var(--s-7);
  justify-content: flex-start;
  gap: var(--s-4);
  overflow-y: auto;
}
.mobile-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  line-height: 1;
  color: var(--titanium);
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}
.mobile-close:hover { border-color: var(--accent); color: var(--accent); }
.mobile-menu-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--s-2);
  width: min(420px, 100%);
  margin-top: var(--s-5);
}
.mobile-menu-list a {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--titanium);
  padding: 14px 4px;
  border-bottom: var(--hairline);
  transition: color 160ms ease, padding-left 200ms ease;
}
.mobile-menu-list a:hover,
.mobile-menu-list a.is-active { color: var(--accent); padding-left: 8px; }
.mobile-menu .mobile-cta {
  margin-top: var(--s-6);
  width: min(420px, 100%);
  justify-content: center;
  padding: 16px 22px;
}
body.menu-open { overflow: hidden; }

/* Show the burger when the inline nav items collapse */
@media (max-width: 980px) {
  .nav-burger { display: inline-flex; }
}

/* Tablet — 980px and below ----------------------------------- */
@media (max-width: 980px) {
  .nav-inner {
    grid-template-columns: auto 1fr auto;
    gap: var(--s-4);
    padding: 14px var(--s-5);
  }
  .nav-mark { width: 64px; height: 38px; }
  .hero { padding: var(--s-8) var(--s-5); }
  .hero.hero-compact { min-height: 50vh; padding: var(--s-8) var(--s-5); }
  .section { padding: var(--s-8) var(--s-5); }

  /* Inline 2-up case detail layouts → stack */
  [style*="grid-template-columns: 1fr 1.3fr"],
  [style*="grid-template-columns: 1.2fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: var(--s-7) !important;
  }
  [style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Phone — 720px and below ------------------------------------ */
@media (max-width: 720px) {
  /* Section / hero rhythm */
  .section { padding: var(--s-7) var(--s-5); }
  .hero { padding: var(--s-7) var(--s-5); min-height: auto; }
  .hero.hero-compact { padding: var(--s-7) var(--s-5); min-height: auto; }
  .hero-stats { margin-top: var(--s-6); padding-top: var(--s-4); gap: var(--s-4); }
  .hstat .mono[style*="font-size: 28px"] { font-size: 22px !important; }

  /* Tame inline display / heading sizes — they were authored at desktop scale */
  h1.display[style*="font-size: clamp(56px, 9vw, 120px)"] {
    font-size: clamp(40px, 11vw, 64px) !important;
  }
  h2[style*="font-size: 56px"] {
    font-size: clamp(34px, 9vw, 44px) !important;
    line-height: 1.05 !important;
  }
  h2[style*="font-size: 44px"] {
    font-size: clamp(28px, 7.5vw, 36px) !important;
    line-height: 1.1 !important;
  }
  h3[style*="font-size: 36px"] {
    font-size: clamp(24px, 6.5vw, 30px) !important;
    line-height: 1.15 !important;
  }
  h3[style*="font-size: 28px"],
  h3[style*="font-size: 22px"] { font-size: 20px !important; }
  p[style*="font-size: 17px"] { font-size: 16px !important; }
  p[style*="font-size: 16px"] { font-size: 15px !important; }
  p[style*="font-size: 14px"] { font-size: 14px !important; line-height: 1.55 !important; }

  /* Big metric numerals on case/product pages */
  div[style*="font-size: 36px"] { font-size: 28px !important; }
  div[style*="font-size: 56px"] { font-size: 36px !important; line-height: 1.05 !important; }
  /* Manifesto "P" text */
  p[style*="font-size: 28px"] { font-size: 22px !important; line-height: 1.3 !important; }

  /* Inline metric grids → 2 columns */
  [style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Section header rows: stop wedging an h2 next to a meta tag */
  .section .row.between {
    flex-direction: column;
    align-items: flex-start !important;
    gap: var(--s-3);
  }

  /* Handoff CTA stacks vertically with full-width button */
  .handoff {
    padding: var(--s-7) var(--s-5);
    flex-direction: column;
    align-items: stretch;
    gap: var(--s-5);
  }
  .handoff .btn { width: 100%; justify-content: center; }

  /* Footer rows */
  .footer-inner {
    padding: 0 var(--s-5);
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s-3);
    text-align: left;
  }
  .footer-inner > .row { flex-wrap: wrap; gap: var(--s-3) !important; }

  /* Case rows: better stacked layout with breathing room */
  .case-row {
    padding: var(--s-4) 0 !important;
    row-gap: 6px !important;
  }
  .case-row:hover { padding-left: 0 !important; }

  /* Form: prevent iOS auto-zoom on focus (needs ≥16px) */
  .field input,
  .field textarea { font-size: 16px; padding: 14px 0; }
  .field label { font-size: 11px; }

  /* Nav becomes more compact */
  .nav-inner { padding: 12px var(--s-4); gap: var(--s-3); }
  .nav-logo .logo { font-size: 12px !important; }
  .nav-cta { padding: 10px 14px; font-size: 10px; }
  .nav-cta .arr { display: none; }

  /* Buttons get a touch-friendly minimum */
  .btn { padding: 14px 20px; }

  /* FAQ: tighter columns to free up text width */
  .faq-toggle {
    grid-template-columns: 44px 1fr 24px;
    gap: var(--s-3);
    font-size: 16px;
  }
  .faq-content.open { padding-left: 56px; }
}

/* Small phone — 480px and below ------------------------------ */
@media (max-width: 480px) {
  .nav-inner { padding: 10px var(--s-4); gap: var(--s-2); }
  .nav-logo .logo { display: none; } /* keep mark only */
  .nav-cta { display: none; } /* CTA lives inside the drawer */
  .nav-right { gap: var(--s-2); }

  .section { padding: var(--s-6) var(--s-4); }
  .hero, .hero.hero-compact { padding: var(--s-6) var(--s-4); }

  .hero-stats { grid-template-columns: 1fr 1fr; gap: var(--s-3); }
  .hstat .mono[style*="font-size: 28px"] { font-size: 20px !important; }

  /* Tighten section heading even more */
  h2[style*="font-size: 56px"] { font-size: 30px !important; }
  h2[style*="font-size: 44px"] { font-size: 26px !important; }
  h3[style*="font-size: 36px"] { font-size: 22px !important; }

  /* Metric tile grids at 4-up / 3-up collapse to 1 column on tiny screens */
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* Process grid is already 1-col below 800; ensure padding */
  .process-step { padding: var(--s-5); }

  /* Dashboard grid — collapse to 1 col so values stay readable */
  .dash-grid { grid-template-columns: 1fr !important; }
  .metric { border-right: none; }

  /* Footer text wrap */
  .footer-inner .row { gap: var(--s-2) !important; }

  /* Mobile menu list slightly larger taps */
  .mobile-menu-list a { font-size: 20px; padding: 16px 4px; }
}

/* ===== Language switcher (globe + menu) ===== */
.lang-switch { position: relative; display: inline-flex; }
.lang-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 9px;
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  color: var(--titanium-mute);
  font-size: 11px; letter-spacing: 0.12em;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.lang-toggle:hover { color: var(--titanium); border-color: var(--titanium); }
.lang-globe { display: block; flex: none; }
.lang-current { line-height: 1; }
.lang-caret { font-size: 9px; opacity: .65; transform: translateY(0.5px); transition: transform .18s ease; }
.lang-switch.open .lang-caret { transform: rotate(180deg) translateY(-0.5px); }
.lang-switch.open .lang-toggle { color: var(--titanium); border-color: var(--titanium); }

.lang-menu {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  min-width: 168px;
  margin: 0; padding: 6px;
  list-style: none;
  background: rgba(250, 250, 248, 0.98);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(59, 33, 24, 0.16);
  opacity: 0; visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
  z-index: 60;
}
.lang-switch.open .lang-menu { opacity: 1; visibility: visible; transform: translateY(0); }

.lang-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%;
  padding: 9px 11px;
  background: transparent; border: 0; border-radius: 6px;
  color: var(--titanium-dim);
  font-size: 13px; letter-spacing: 0.01em;
  text-align: left; cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.lang-opt:hover { background: var(--accent-12); color: var(--titanium); }
.lang-opt .lang-code { font-size: 10px; letter-spacing: 0.18em; color: var(--titanium-faint); }
.lang-opt.is-active { color: var(--accent); }
.lang-opt.is-active .lang-code { color: var(--accent); }

@media (max-width: 720px) {
  .lang-toggle { padding: 6px 8px; }
  .lang-toggle .lang-caret { display: none; }
}
