/* ============================================================
   COUPLING LABS — engineering-schematic aesthetic
   paper + ink + blueprint blue + safety orange
   ============================================================ */

:root {
  --paper: #f2eee4;
  --paper-deep: #e9e4d6;
  --ink: #16130e;
  --ink-soft: #4a453b;
  --blue: #1c3fa8;
  --orange: #ff4d00;
  --grid: rgba(28, 63, 168, 0.09);
  --rule: rgba(22, 19, 14, 0.22);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  line-height: 1.55;
  overflow-x: hidden;
}

/* ---- blueprint grid over everything ---- */
.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(rgba(28, 63, 168, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 63, 168, 0.045) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px;
}

/* ---- CAD coordinate readout ---- */
.cad-readout {
  position: fixed;
  bottom: 14px;
  right: 16px;
  z-index: 50;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--blue);
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 4px 10px;
  display: flex;
  gap: 14px;
  user-select: none;
}

main, .site-header, .site-footer, .ticker { position: relative; z-index: 1; }

/* ============ HEADER ============ */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(20px, 5vw, 64px);
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 40;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.04em;
}
.wordmark em { font-style: normal; color: var(--orange); }
.wordmark-glyph { width: 38px; height: 24px; fill: var(--ink); }
.wordmark-glyph rect { fill: var(--orange); }

.site-nav { display: flex; gap: clamp(12px, 3vw, 34px); align-items: center; }
.site-nav a {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--orange); }
.site-nav .nav-cta {
  border: 2px solid var(--ink);
  padding: 8px 18px;
  background: var(--ink);
  color: var(--paper);
}
.site-nav .nav-cta:hover { background: var(--orange); border-color: var(--orange); color: var(--ink); }

/* ============ ANNOTATIONS (mono figure labels) ============ */
.annotation {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--blue);
  display: flex;
  align-items: center;
  gap: 14px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}
.dim-line {
  flex: 1 1 40px;
  min-width: 24px;
  height: 1px;
  background: var(--blue);
  position: relative;
}
.dim-line::before, .dim-line::after {
  content: "";
  position: absolute;
  top: -3px;
  width: 1px;
  height: 7px;
  background: var(--blue);
}
.dim-line::before { left: 0; }
.dim-line::after { right: 0; }

/* ============ HERO ============ */
.hero {
  padding: clamp(40px, 8vh, 90px) clamp(20px, 5vw, 64px) 40px;
  max-width: 1280px;
  margin: 0 auto;
}
.hero-annotation { margin-bottom: 28px; }

.hero-title {
  font-size: clamp(42px, 8.4vw, 118px);
  line-height: 0.96;
  letter-spacing: -0.025em;
  font-weight: 700;
  text-transform: uppercase;
}
.hero-title .line { display: block; }
.accent { color: var(--orange); }

.coupling-stage { margin: clamp(28px, 5vh, 56px) 0 8px; }
#coupling-svg { width: 100%; height: auto; display: block; }
#coupling-svg .draw {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 2.5;
}
#coupling-svg .bolt { fill: var(--paper-deep); }
#coupling-svg .teeth { fill: var(--orange); stroke: var(--ink); stroke-width: 2; }
#coupling-svg .label {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.14em;
  fill: var(--blue);
  stroke: none;
}
#coupling-svg .label-right { text-anchor: end; }
#coupling-svg .dims line { stroke: var(--blue); stroke-width: 1; }
#coupling-svg .dims text {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  fill: var(--blue);
}
#lock-spark line {
  stroke: var(--orange);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0;
}

/* coupling animation */
#half-left  { transform: translateX(-80px); }
#half-right { transform: translateX(80px); }
.coupled #half-left  { transform: translateX(0); transition: transform 1.1s cubic-bezier(.7,0,.2,1.4); }
.coupled #half-right { transform: translateX(0); transition: transform 1.1s cubic-bezier(.7,0,.2,1.4); }
.coupled #lock-spark line { animation: spark 0.5s 1.05s ease-out; }
@keyframes spark {
  0% { opacity: 0; transform: scale(0.4); transform-origin: 379px 60px; }
  30% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.15); transform-origin: 379px 60px; }
}

.hero-sub {
  max-width: 640px;
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--ink-soft);
  margin: 18px 0 30px;
}

.hero-ctas { display: flex; gap: 16px; flex-wrap: wrap; }

/* ============ BUTTONS ============ */
.btn {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 14px 26px;
  border: 2px solid var(--ink);
  color: var(--ink);
  background: transparent;
  display: inline-block;
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn-primary { background: var(--orange); border-color: var(--ink); box-shadow: 5px 5px 0 var(--ink); }
.btn-primary:hover { transform: translate(2px, 2px); box-shadow: 3px 3px 0 var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-xl { font-size: clamp(16px, 2.6vw, 26px); padding: 20px 38px; }

/* ============ TICKER ============ */
.ticker {
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
  padding: 12px 0;
}
.ticker-track {
  display: flex;
  gap: 28px;
  width: max-content;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.18em;
  animation: ticker 36s linear infinite;
}
.tick-dot { color: var(--orange); }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ============ SECTIONS ============ */
section { padding: clamp(56px, 10vh, 110px) clamp(20px, 5vw, 64px); max-width: 1280px; margin: 0 auto; }

.section-head { margin-bottom: clamp(32px, 6vh, 56px); }
.section-head h2 {
  font-size: clamp(34px, 5.6vw, 72px);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-top: 18px;
  text-transform: uppercase;
}
.section-sub { color: var(--ink-soft); margin-top: 14px; max-width: 560px; }

/* ============ CATALOG / FIG CARDS ============ */
.fig-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 0;
  border: 2px solid var(--ink);
  background: var(--ink);
  grid-auto-rows: 1fr;
  row-gap: 2px;
  column-gap: 2px;
}

.fig-card {
  background: var(--paper);
  padding: 28px 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: background 0.15s ease;
}
.fig-card:hover { background: var(--paper-deep); }
.fig-card:hover .fig-no { background: var(--orange); color: var(--ink); }

.fig-head { display: flex; justify-content: space-between; align-items: flex-start; }
.fig-no {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  background: var(--ink);
  color: var(--paper);
  padding: 4px 10px;
  transition: background 0.15s ease, color 0.15s ease;
}
.fig-icon { width: 44px; height: 44px; fill: var(--ink); }
.fig-icon .icon-accent { fill: var(--orange); }
.fig-icon .icon-lines, .fig-icon .icon-stroke { stroke: var(--ink); stroke-width: 2.4; fill: none; }

.fig-card h3 {
  font-size: 21px;
  letter-spacing: 0.01em;
  line-height: 1.15;
}
.fig-card > p { color: var(--ink-soft); font-size: 15px; }

.fig-examples {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
}
.fig-examples li {
  padding-left: 18px;
  position: relative;
}
.fig-examples li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--orange);
}

.spec {
  margin-top: auto;
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.spec th, .spec td {
  border-top: 1px solid var(--rule);
  padding: 7px 4px;
  text-align: left;
  vertical-align: top;
}
.spec th {
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--blue);
  white-space: nowrap;
  padding-right: 16px;
  width: 1%;
}

/* ============ METHOD ============ */
.method-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 2px;
  border: 2px solid var(--ink);
  background: var(--ink);
  counter-reset: step;
}
.method-steps li { background: var(--paper); padding: 26px 24px 30px; position: relative; }
.method-steps li:hover { background: var(--paper-deep); }
.step-no {
  font-family: var(--font-mono);
  font-size: clamp(40px, 5vw, 64px);
  color: transparent;
  -webkit-text-stroke: 1.5px var(--orange);
  display: block;
  line-height: 1;
  margin-bottom: 14px;
}
.method-steps h3 { font-size: 19px; margin-bottom: 8px; letter-spacing: 0.03em; }
.method-steps p { font-size: 14.5px; color: var(--ink-soft); }

/* ============ PRINCIPLES ============ */
.principles { border-top: 2px solid var(--ink); }
.principle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(24px, 4vw, 48px);
}
.principle h3 {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.14em;
  border-bottom: 2px solid var(--orange);
  display: inline-block;
  padding-bottom: 6px;
  margin-bottom: 12px;
}
.principle p { font-size: 15px; color: var(--ink-soft); }

/* ============ CONTACT ============ */
.contact { text-align: center; }
.contact .annotation { justify-content: center; }
.contact h2 {
  font-size: clamp(30px, 5.4vw, 66px);
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 22px 0 18px;
}
.contact-sub { color: var(--ink-soft); max-width: 520px; margin: 0 auto 34px; }

/* ============ FOOTER ============ */
.site-footer {
  border-top: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  padding: 22px clamp(20px, 5vw, 64px);
}
.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
}
.footer-mark { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: 0.04em; }
.footer-mark em { font-style: normal; color: var(--orange); }
.footer-note, .footer-copy { color: rgba(242, 238, 228, 0.65); }

/* ============ MOTION SAFETY ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ticker-track { animation: none; }
  #half-left, #half-right { transform: none; transition: none; }
  .coupled #half-left, .coupled #half-right { transition: none; }
  .btn, .fig-card, .fig-no { transition: none; }
}

/* ============ SMALL SCREENS ============ */
@media (max-width: 640px) {
  .site-header { flex-direction: column; gap: 14px; }
  .cad-readout { display: none; }
  .annotation { white-space: normal; }
  .hero-ctas .btn { width: 100%; text-align: center; }
}
