/* ============================================================
   Evolve Technologies — base layer
   Reset, shared utilities, theme + animation machinery.
   Design skins live in design-terminal.css / design-signal.css,
   selected by <html data-design="terminal|signal">.
   ============================================================ */

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3 { margin: 0; line-height: 1.1; letter-spacing: -0.02em; }
p, ul, dl { margin: 0; }
ul { padding: 0; list-style: none; }
dd { margin: 0; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { opacity: 0.85; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

section { scroll-margin-top: 88px; }

/* ---------- Design-scoped copy variants ---------- */

.only-terminal,
.only-signal { display: none; }

:root[data-design="terminal"] .only-terminal { display: inline; }
:root[data-design="signal"] .only-signal { display: inline; }
:root[data-design="signal"] li.only-signal { display: block; }

/* ---------- Logo mark ---------- */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* bordered square, mirroring the theme-toggle button */
.logo-box {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.logo-img {
  width: 20px;
  height: 20px;
  display: block;
  /* black mark → white on the dark default theme */
  filter: invert(1);
}

:root[data-theme="light"] .logo-img,
:root:not([data-theme]):has(#lightswitch:checked) .logo-img { filter: none; }

/* ---------- Theme toggle ---------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--muted); }

/* dark shows the sun (what you switch to), light shows the moon.
   JS drives [data-theme]; the :has() fallback keeps it working without JS. */
.icon-moon { display: none; }

:root[data-theme="light"] .icon-sun,
:root:not([data-theme]):has(#lightswitch:checked) .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon,
:root:not([data-theme]):has(#lightswitch:checked) .icon-moon { display: block; }

:root:has(#lightswitch:focus-visible) .theme-toggle {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Hero load animation ---------- */

.status-chip { animation: rise 0.6s ease both; }
h1 { animation: rise 0.6s 0.05s ease both; }
.lede { animation: rise 0.6s 0.1s ease both; }
.hero-actions { animation: rise 0.6s 0.15s ease both; }
.terminal { animation: rise 0.6s 0.2s ease both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ---------- Scroll reveals (JS-driven, motion-safe) ---------- */

.js:not(.rm) [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.6s ease var(--rd, 0s),
    transform 0.6s ease var(--rd, 0s);
}
.js:not(.rm) [data-reveal].in-view {
  opacity: 1;
  transform: none;
}

/* terminal lines typed/revealed by JS */
.js:not(.rm) .t-line { opacity: 0; }
.js:not(.rm) .t-line.shown { opacity: 1; transition: opacity 0.25s ease; }

/* 80/20 meter fills when the approach block reveals */
.js:not(.rm) .approach-copy .split-code {
  width: 0;
  transition: width 1s cubic-bezier(0.22, 0.61, 0.36, 1) 0.3s;
}
.js:not(.rm) .approach-copy.in-view .split-code { width: 80%; }

/* ---------- Slider edge overlays ---------- */

.slider-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 76px;
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  z-index: 2;
  transition: opacity 0.25s ease;
}
.slider-prev {
  left: 0;
  background: linear-gradient(to right, var(--bg) 25%, rgba(0, 0, 0, 0));
}
.slider-next {
  right: 0;
  background: linear-gradient(to left, var(--bg) 25%, rgba(0, 0, 0, 0));
}
.slider-edge svg { opacity: 0.5; transition: opacity 0.15s ease; }
.slider-edge:hover svg { opacity: 1; }
.slider-edge:disabled { opacity: 0; pointer-events: none; }

@media (max-width: 640px) {
  /* phones: swipe + card peek, no overlays */
  .slider-edge { display: none; }
}

/* ---------- Touch ergonomics ---------- */

@media (pointer: coarse) {
  .theme-toggle { width: 44px; height: 44px; }
  .logo-box { width: 44px; height: 44px; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
