/* ==========================================================================
   Code Repair Shop — styles
   Zero dependencies: plain CSS, system fonts. Warm "workshop" theme:
   dark by default, light when the system color scheme prefers it —
   or when the visitor picks a theme with the header toggle, which wins.
   ========================================================================== */

/* Design tokens live in `tokens.css`, which the page loads first. These
   aliases map the shop's long-standing variable names onto the shared --c-*
   tokens, so the rest of this file needs no further change; the terminal
   below re-pins a few to their dark values on purpose. */
:root {
  --bg: var(--c-bg);
  --panel: var(--c-panel);
  --panel-2: var(--c-panel-2);
  --line: var(--c-line);
  --line-strong: var(--c-line-strong);
  --ink: var(--c-ink);
  --muted: var(--c-muted);
  --accent: var(--c-accent);
  --accent-strong: var(--c-accent-strong);
  --accent-ink: var(--c-accent-ink);
  --ok: var(--c-ok);
  --err: var(--c-err);
  --header-bg: var(--c-header-bg);
  --card-hover-line: var(--c-accent-line);
  --glow: var(--c-glow);
  --glow-soft: var(--c-glow-soft);
  --step-num: color-mix(in srgb, var(--c-accent) 28%, transparent);
  --terminal-bg: var(--c-terminal-bg);
  --t-dim: var(--c-faint);
  --shadow: var(--c-shadow);
  --sans: var(--font-sans);
  --mono: var(--font-mono);
}

/* Light mode (system preference or the header toggle) is owned entirely by
   `tokens.css`: it re-points the --c-* tokens, and the aliases above follow.
   The accent darkens for 4.5:1 text contrast on paper there, which is why the
   bright --accent-strong is only used inside the dark terminals. */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.015em; margin: 0; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.container { max-width: 1080px; margin-inline: auto; padding-inline: 24px; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  font-weight: 600;
  z-index: 100;
}
.skip:focus { left: 0; }

.accent { color: var(--accent); }

/* --------------------------------------------------------------------------
   Header / nav
   -------------------------------------------------------------------------- */

.site-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  height: var(--nav-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-icon { width: 22px; height: 22px; color: var(--accent); flex: none; }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}

.nav-menu a {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--muted);
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-menu a:hover { color: var(--ink); background: var(--panel-2); }

.nav-cta {
  margin-left: 8px;
  color: var(--accent) !important;
  border: 1px solid var(--line-strong);
  background: var(--panel);
}
.nav-cta:hover { border-color: var(--accent) !important; }

/* Light/dark toggle. JS drives the icon + label; hidden until JS loads
   because without it the button can't do anything. */
.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.theme-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn svg[hidden] { display: none; }
html:not(.js) .theme-btn { display: none; }

.menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  margin-left: auto;
  padding: 10px;
  background: none;
  border: 0;
  cursor: pointer;
}
.menu-btn span {
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  padding: calc(var(--nav-h) + 72px) 0 80px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -160px;
  right: -120px;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow), transparent);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 56px;
  position: relative;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  margin-bottom: 20px;
}

.lede {
  color: var(--muted);
  font-size: 1.12rem;
  max-width: 34rem;
  margin-bottom: 32px;
}

.cta-row { display: flex; flex-wrap: wrap; gap: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.07); }

.btn-ghost { border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); }

.btn-lg { padding: 15px 26px; font-size: 1.05rem; }

/* Terminal -------------------------------------------------------------- */

.terminal {
  /* Terminals keep their dark chrome in both color schemes (like code
     blocks on docs sites), so the shared vars are pinned here to the
     base dark values. */
  --panel: #14110d;
  --line: #27211a;
  --muted: #a89d8d;
  --accent: #ff8a3d;
  --accent-strong: #ff9d5c;
  --ok: #86dcae;
  --err: #ff7a70;
  color-scheme: dark;
  background: var(--terminal-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-err { background: var(--err); }
.dot-warn { background: var(--accent); }
.dot-ok { background: var(--ok); }

.terminal-title {
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.terminal pre {
  margin: 0;
  padding: 20px 22px;
  overflow-x: auto;
}

.terminal code {
  font-family: var(--mono);
  font-size: clamp(0.72rem, 1.4vw, 0.84rem);
  line-height: 1.75;
  white-space: pre;
}

.t-cmd { color: var(--accent-strong); font-weight: 600; }
.t-ok { color: var(--ok); }
.t-err { color: var(--err); }
.t-warn { color: var(--accent-strong); }
.t-dim { color: var(--t-dim); }

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.05em;
  margin-left: 0.15em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

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

/* --------------------------------------------------------------------------
   Makes & models strip
   -------------------------------------------------------------------------- */

.strip {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
}

.strip-title {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.chip {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
}

.chip-acc { color: var(--accent); border-color: var(--line-strong); }

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section { padding: 96px 0; }
.section-alt { background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

section { scroll-margin-top: calc(var(--nav-h) + 16px); }

.section-head { max-width: 46rem; margin-bottom: 48px; }

.label {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 750;
  margin-bottom: 14px;
}

.section-sub { color: var(--muted); font-size: 1.05rem; }

/* Cards ------------------------------------------------------------------ */

.services-grid, .values-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.section-alt .card { background: var(--bg); }

.card:hover {
  border-color: var(--card-hover-line);
  transform: translateY(-3px);
}

.card-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 12px;
}

.card h3 { font-size: 1.08rem; font-weight: 700; margin-bottom: 10px; }
.card p { color: var(--muted); font-size: 0.95rem; margin: 0; }

/* Process ---------------------------------------------------------------- */

.process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}

.step-num {
  display: block;
  font-family: var(--mono);
  font-size: 2rem;
  color: var(--step-num);
  -webkit-text-stroke: 1px var(--accent);
  margin-bottom: 14px;
}

.step h3 { font-size: 1.05rem; margin-bottom: 8px; }
.step p { color: var(--muted); font-size: 0.95rem; margin: 0; }

/* Custom builds ------------------------------------------------------------ */

.builds { padding: 96px 0; position: relative; }

.builds-panel {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 48px;
  padding: 48px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  position: relative;
  overflow: hidden;
}

.builds-panel::before {
  content: "";
  position: absolute;
  top: -140px;
  left: -100px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow-soft), transparent);
  pointer-events: none;
}

.builds-copy { position: relative; }

.builds-copy h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 750;
  margin-bottom: 16px;
}

.builds-copy > p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 32rem;
  margin-bottom: 22px;
}

.builds-copy .chips { margin-bottom: 28px; }

.builds .terminal { position: relative; }

@media (max-width: 900px) {
  .builds-panel { grid-template-columns: 1fr; padding: 32px; gap: 36px; }
}

/* Mission ---------------------------------------------------------------- */

.mission-statement {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.4;
  max-width: 48rem;
  margin-bottom: 20px;
}

.mission-support {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 48rem;
  margin-bottom: 56px;
}

.mission-statement em, .mission-support em {
  font-style: normal;
  color: var(--accent);
}

/* Contact ---------------------------------------------------------------- */

.contact-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: start;
  gap: 56px;
}

.contact-main h2 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); margin-bottom: 16px; }
.contact-main > p { color: var(--muted); font-size: 1.05rem; max-width: 32rem; }
.contact-main .btn { margin: 8px 0 12px; }

.small { font-size: 0.85rem; color: var(--muted); }

.info-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 18px;
}

.info-list li {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.info-k {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.info-v { color: var(--muted); font-size: 0.95rem; }

/* Estimate form ------------------------------------------------------------- */

.estimate-form { display: grid; gap: 16px; margin-top: 28px; max-width: 34rem; }

.form-row { display: grid; gap: 6px; }

.form-row label { font-size: 0.85rem; color: var(--muted); }

.estimate-form input,
.estimate-form select,
.estimate-form textarea {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 11px 14px;
}

.estimate-form select { appearance: none; }

.estimate-form textarea { resize: vertical; min-height: 130px; }

.estimate-form :is(input, select, textarea):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

/* Honeypot: hidden from humans, tempting for bots. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.form-status { font-size: 0.9rem; color: var(--ok); min-height: 1.2em; margin: 0; }
.form-status.err { color: var(--err); }

/* Footer ----------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 44px 0;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 28px;
}

.footer-brand p {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-links { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.footer-links a {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 8px;
}
.footer-links a:hover { color: var(--ink); background: var(--panel-2); }

/* --------------------------------------------------------------------------
   Reveal-on-scroll (activated only when JS is present)
   -------------------------------------------------------------------------- */

html.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

html.js .reveal.in { opacity: 1; transform: none; }

.grid-stagger > .reveal:nth-child(2) { transition-delay: 70ms; }
.grid-stagger > .reveal:nth-child(3) { transition-delay: 140ms; }
.grid-stagger > .reveal:nth-child(4) { transition-delay: 210ms; }
.grid-stagger > .reveal:nth-child(5) { transition-delay: 280ms; }
.grid-stagger > .reveal:nth-child(6) { transition-delay: 350ms; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }
  .contact-grid { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 760px) {
  .section { padding: 72px 0; }
  .hero { padding-top: calc(var(--nav-h) + 48px); padding-bottom: 56px; }

  .menu-btn { display: flex; }

  .nav-menu {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px 24px 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    display: none;
  }

  .nav-menu.open { display: flex; }
  .nav-menu a { padding: 12px 10px; font-size: 1rem; }
  .nav-cta { margin: 10px 0 0; text-align: center; justify-content: center; }

  /* The terminals are fixed-geometry monospace panels: a phone can only
     read them by scrolling sideways, and they crowd out the copy they
     sit beside. Below the phone breakpoint each section's copy stands
     alone. They are role="img" illustrations of that copy, so nothing
     is lost by dropping them from the mobile reading order. */
  .terminal { display: none; }
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .reveal { transition: none; opacity: 1; transform: none; }
  .cursor { animation: none; }
  .card, .btn { transition: none; }
}