/* ============ Apex Dynamics — styles.css ============ */

:root {
  --ink: #0B0E11;
  --panel: #15191D;
  --line: #262C32;
  --mid: #3A4149;
  --body: #C8CDD2;
  --bright: #F2F4F6;
  --teal: #2DD4BF;
  --teal-deep: #0F766E;
  --dim: #9BA3AB;              /* muted text — readable on ink */

  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --shell: 1120px;
  --radius: 2px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 92px; }

body {
  background: var(--ink);
  color: var(--body);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { font-family: var(--font-display); color: var(--bright); line-height: 1.12; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.6rem); }
h3 { font-size: 1.25rem; }

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-deep); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

.mono { font-family: var(--font-mono); font-size: 0.8125rem; letter-spacing: 0.02em; }

.eyebrow {
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  margin-bottom: 18px;
}

.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;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1rem;
  padding: 13px 26px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.btn-primary { background: var(--teal); color: var(--ink); }
.btn-primary:hover { background: var(--teal-deep); color: var(--bright); }
.btn-ghost { border-color: var(--dim); color: var(--bright); }
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); }
.btn-block { width: 100%; text-align: center; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 14, 17, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; gap: 32px; height: 76px; }

.brand { display: flex; align-items: center; gap: 12px; color: var(--bright); }
.brand-mark { display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--bright); }
.brand-sub { font-family: var(--font-mono); font-size: 0.625rem; color: var(--dim); letter-spacing: 0.06em; text-transform: uppercase; }

.site-nav { display: flex; gap: 26px; margin-left: auto; }
.site-nav a { color: var(--body); font-size: 0.9375rem; }
.site-nav a:hover { color: var(--teal); }
.btn-header { padding: 10px 20px; font-size: 0.9375rem; }

/* ---------- Hero ---------- */
.hero { padding: 110px 0 90px; border-bottom: 1px solid var(--line); }
.hero-title { font-size: clamp(2.5rem, 6.2vw, 4.4rem); font-weight: 700; }

.rotator {
  position: relative;
  display: inline-block;
  width: 13.5ch;            /* sized for "Manufacturing" — prevents layout shift */
  height: 1.14em;
  vertical-align: bottom;
  perspective: 520px;       /* the drum's camera distance */
  border-bottom: 3px solid var(--teal-deep);
  white-space: nowrap;
}
.rotator .word {
  position: absolute;
  inset: 0;
  color: var(--teal);
  transform-origin: 50% 50%;
  backface-visibility: hidden;
  will-change: transform, opacity;
}
/* incoming face rolls up from underneath */
.rotator .word.roll-in  { animation: rollIn  420ms cubic-bezier(0.3, 0.7, 0.4, 1) forwards; }
/* outgoing face rolls up and over the top of the cylinder.
   Declared AFTER roll-in so it always takes precedence if classes ever collide. */
.rotator .word.roll-out { animation: rollOut 420ms cubic-bezier(0.3, 0.7, 0.4, 1) forwards; }
/* fast shuffle — same roll, shorter throw */
.rotator .word.fast { animation-duration: 140ms; animation-timing-function: linear; }

@keyframes rollOut {
  45%  { opacity: 0.25; }  /* exiting face fades early so faces never visually collide */
  to   { transform: translateY(-58%) rotateX(84deg); opacity: 0; }
}
@keyframes rollIn {
  from { transform: translateY(58%) rotateX(-84deg); opacity: 0; }
  to   { transform: translateY(0)   rotateX(0);      opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .rotator .word.roll-out, .rotator .word.roll-in { animation: none; }
}

.hero-sub { max-width: 620px; margin-top: 28px; font-size: 1.1875rem; }
.hero-actions { display: flex; gap: 14px; margin-top: 36px; flex-wrap: wrap; }
.hero-note { margin-top: 18px; color: var(--dim); }

/* ---------- Proof strip ---------- */
.proof { border-bottom: 1px solid var(--line); background: var(--panel); }
.proof-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.proof-item {
  padding: 30px 20px;
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px;
}
.proof-item:first-child { border-left: none; padding-left: 0; }
.proof-num { font-family: var(--font-display); font-size: 2.4rem; font-weight: 700; color: var(--bright); line-height: 1; }
.proof-unit { font-size: 1.1rem; color: var(--teal); margin-left: 2px; }
.proof-label { color: var(--dim); }

/* ---------- Sections ---------- */
.section { padding: 96px 0; }
.section-ruled { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--panel); }
.section-title { margin-bottom: 14px; }
.section-lede { max-width: 560px; margin-bottom: 48px; }

.grid-2 { display: grid; grid-template-columns: 5fr 6fr; gap: 64px; align-items: start; }
.section-body p + p { margin-top: 18px; }
.section-body-p { margin-top: 18px; max-width: 520px; }

/* ---------- Services ---------- */
.service-row {
  display: grid; grid-template-columns: 4fr 7fr; gap: 40px;
  padding: 34px 0; border-top: 1px solid var(--line);
  margin-top: 0;
}
.service-row:first-of-type { margin-top: 40px; }
.service-row p + p { margin-top: 12px; }
.outcome { color: var(--teal); }
.industries { margin-top: 44px; color: var(--dim); }

/* ---------- Stations ---------- */
.stations { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.station { background: var(--ink); padding: 34px 30px; display: flex; gap: 22px; }
.station-num { color: var(--teal); font-size: 1rem; padding-top: 5px; }
.station p { margin-top: 10px; }
.station .outcome { margin-top: 14px; }

/* ---------- Ledger (keep / refuse) ---------- */
.ledger { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; margin-top: 44px; }
.ledger-head { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.75rem; margin-bottom: 22px; }
.ledger-col:first-child .ledger-head { color: var(--teal); }
.ledger-col:last-child .ledger-head { color: var(--dim); }

.keep, .refuse { list-style: none; }
.keep li, .refuse li { padding: 14px 0 14px 32px; border-top: 1px solid var(--line); position: relative; }
.keep li::before {
  content: "→"; position: absolute; left: 0; color: var(--teal);
  font-family: var(--font-mono);
}
.keep strong { color: var(--bright); display: block; margin-bottom: 2px; }
.refuse li { color: var(--dim); text-decoration: line-through; text-decoration-color: var(--dim); }
.refuse li::before {
  content: "✕"; position: absolute; left: 0; color: var(--dim);
  font-family: var(--font-mono); text-decoration: none;
}

/* ---------- Proof / case studies ---------- */
.case-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0 64px; margin-top: 44px;
}
.case { padding: 30px 0; border-top: 1px solid var(--line); }
.case-tag { color: var(--teal); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.6875rem; margin-bottom: 10px; }
.case h3 { margin-bottom: 10px; }
.case .outcome { margin-top: 14px; color: var(--dim); }
.case-more { margin-top: 44px; max-width: 640px; color: var(--body); }
.case-cta { margin-top: 14px; }

/* ---------- Product ticker ---------- */
.ticker {
  display: block;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--ink);
}
.ticker-track {
  display: flex;
  width: max-content;
  animation: tick 42s linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-group { display: flex; white-space: nowrap; }
.tick-item {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--body);
  padding: 13px 0;
  margin-right: 3em;
  transition: color 140ms ease;
}
.tick-item::before { content: "■"; color: var(--teal); margin-right: 0.9em; font-size: 0.6em; vertical-align: 2px; }
.ticker:hover .tick-item { color: var(--teal); }
@keyframes tick { to { transform: translateX(-50%); } }

@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
}

/* ---------- Product spotlight ---------- */
.spotlight {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 36px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 36px;
  margin: 44px 0 32px;
}
.spotlight-name {
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--bright);
  margin: 10px 0 12px;
  letter-spacing: -0.01em;
}
.spotlight-body p { max-width: 560px; }
.spotlight-body .btn { margin-top: 22px; }
.spotlight-mark {
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.5rem;
  color: var(--teal);
  user-select: none;
}

/* ---------- Product plates ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.plate {
  background: var(--ink);
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-top: 2px solid transparent;
  transition: background 140ms ease, border-color 140ms ease;
}
.plate:hover { background: var(--panel); border-top-color: var(--teal); }
.plate .case-tag { margin-bottom: 0; font-size: 0.625rem; }
.plate-name {
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  color: var(--bright);
  transition: color 140ms ease;
}
.plate:hover .plate-name { color: var(--teal); }
.plate-desc { font-size: 0.875rem; color: var(--dim); line-height: 1.55; flex-grow: 1; }
.plate-cta { font-size: 0.6875rem; color: var(--dim); transition: color 140ms ease; }
.plate:hover .plate-cta { color: var(--teal); }
.plate.active { background: var(--panel); border-top-color: var(--teal); }
.plate.active .plate-name { color: var(--teal); }
.plate.active .plate-cta { color: var(--dim); }

.spotlight-body.swapping { opacity: 0; }
.spotlight-body { transition: opacity 160ms ease; }

/* ---------- Locations ---------- */
.loc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 44px; }
.loc { background: var(--ink); padding: 30px; }
.loc-meta { color: var(--teal); margin: 8px 0 12px; }

/* ---------- Contact / form ---------- */
.contact { border-top: 1px solid var(--line); background: var(--panel); }
.contact-alt { margin-top: 28px; }
.contact-promise { color: var(--dim); }

.lead-form { background: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 34px; }
.hp { display: none; }
.field { margin-bottom: 20px; }
.field label {
  display: block; font-family: var(--font-mono); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--body); margin-bottom: 8px;
}
.field input, .field textarea, .field select {
  width: 100%; background: var(--panel); border: 1px solid var(--mid);
  border-radius: var(--radius); color: var(--bright);
  font-family: var(--font-body); font-size: 1rem; padding: 12px 14px;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--teal); outline: none; }
.field textarea { resize: vertical; }
.form-note { margin-top: 14px; color: var(--dim); text-align: center; }

/* (removed: bare .demo-link color rule — it overrode .btn-primary and made the
   spotlight button text teal-on-teal / invisible) */

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 48px 0; }
.footer-row { display: flex; align-items: flex-start; gap: 40px; flex-wrap: wrap; }
.footer-nav { display: flex; gap: 22px; margin-left: auto; }
.footer-nav a { color: var(--body); font-size: 0.9375rem; }
.footer-meta { color: var(--dim); text-align: right; }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 500ms ease, transform 500ms ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .site-nav { display: none; }
  .grid-2, .ledger { grid-template-columns: 1fr; gap: 40px; }
  .proof-grid { grid-template-columns: 1fr 1fr; }
  .proof-item { border-left: none; border-top: 1px solid var(--line); padding-left: 0; }
  .proof-item:nth-child(-n+2) { border-top: none; }
  .stations { grid-template-columns: 1fr; }
  .case-grid { grid-template-columns: 1fr; gap: 0; }
  .spotlight { grid-template-columns: 1fr; gap: 20px; }
  .spotlight-mark { min-height: 110px; font-size: 3rem; }
  .service-row { grid-template-columns: 1fr; gap: 12px; }
  .loc-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .hero { padding: 72px 0 60px; }
  .hero-title { font-size: clamp(1.9rem, 8.5vw, 2.5rem); }
  .rotator { width: 13.5ch; }
  .lead-form { padding: 24px; }
  .footer-nav { margin-left: 0; }
  .footer-meta { text-align: left; }
}
