/* =========================================================
   Wilmoth Engineering — design tokens
   Palette: dark PCB base, dual accent (signal cyan / film amber)
   ========================================================= */
:root {
  --ink:        #0A0D13;
  --panel:      #12161F;
  --panel-2:    #171C27;
  --line:       #232938;
  --text:       #E9EDF3;
  --text-muted: #8892A6;
  --cyan:       #46E4D3;
  --cyan-dim:   #2A8F86;
  --amber:      #FF9A4D;
  --amber-dim:  #B8672A;
  --danger:     #FF5D5D;

  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body:    'Inter', 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', monospace;

  --wrap: 1180px;
  --radius: 14px;
  --ease: cubic-bezier(.19,1,.22,1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

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

img { max-width: 100%; display: block; }

.mono { font-family: var(--font-mono); letter-spacing: 0.01em; }

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

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

.skip-link {
  position: absolute; left: 12px; top: -60px;
  background: var(--cyan); color: #04110F;
  padding: 10px 16px; border-radius: 8px;
  font-family: var(--font-mono); font-weight: 600;
  z-index: 200; transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.05;
  margin: 0 0 .4em;
  letter-spacing: -0.01em;
}

h2 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h3 { font-size: 1.15rem; }

.eyebrow {
  color: var(--cyan);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  margin: 0 0 14px;
  display: inline-block;
}

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

.section {
  padding: 108px 0;
  position: relative;
}

.section-sub {
  color: var(--text-muted);
  max-width: 58ch;
  font-size: 1.05rem;
}

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  backdrop-filter: blur(10px) saturate(140%);
  background: rgba(10,13,19,0.72);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}
.brand-mark { color: var(--cyan); display: inline-flex; }
.brand-dot { color: var(--amber); }

.nav-list {
  display: flex;
  gap: 32px;
  list-style: none;
  margin: 0; padding: 0;
}
.nav-list a {
  text-decoration: none;
  font-size: .93rem;
  color: var(--text-muted);
  position: relative;
  padding: 4px 2px;
  transition: color .2s var(--ease);
}
.nav-list a:hover, .nav-list a:focus-visible { color: var(--text); }
.nav-list a::after {
  content: '';
  position: absolute;
  left: 0; right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--cyan);
  transition: right .25s var(--ease);
}
.nav-list a:hover::after, .nav-list a:focus-visible::after { right: 0; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s var(--ease), opacity .25s var(--ease);
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-top: 68px;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.hero-fallback {
  position: absolute;
  inset: 0;
  display: none;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(70,228,211,0.14), transparent 55%),
    radial-gradient(ellipse at 80% 70%, rgba(255,154,77,0.12), transparent 55%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 42px);
}

/* Under reduced motion, circuit.js still renders a static PCB frame onto
   the canvas (see js/circuit.js), so keep it visible and leave the plain
   gradient fallback hidden. */

.hero-inner {
  position: relative;
  z-index: 2;
  pointer-events: none;
}
.hero-inner .hero-actions,
.hero-inner .hero-hint { pointer-events: auto; }

.hero-title {
  font-size: clamp(3rem, 10vw, 6.4rem);
  margin: 8px 0 22px;
}
.hero-title .line {
  display: block;
  background: linear-gradient(90deg, var(--text) 40%, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.cursor-blip {
  color: var(--amber);
  animation: blink 1.1s steps(2) infinite;
}
@media (prefers-reduced-motion: reduce) {
  .cursor-blip { animation: none; }
}
@keyframes blink { 50% { opacity: 0; } }

.hero-sub {
  max-width: 46ch;
  font-size: 1.15rem;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  gap: 16px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.hero-hint {
  margin-top: 46px;
  color: var(--cyan-dim);
  font-size: .8rem;
  letter-spacing: .06em;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.btn-primary {
  background: var(--cyan);
  color: #04110F;
  box-shadow: 0 0 0 0 rgba(70,228,211,0.5);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -10px rgba(70,228,211,0.6);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-ghost:hover {
  border-color: var(--amber);
  color: var(--amber);
  transform: translateY(-2px);
}

/* =========================================================
   Reveal-on-scroll
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.is-visible { opacity: 1; transform: none; transition: none; }
}

/* =========================================================
   About / Datasheet
   ========================================================= */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 64px;
  align-items: start;
}

.about-copy p { color: var(--text-muted); }
.about-copy p:first-of-type { color: var(--text); font-size: 1.1rem; }

.datasheet {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px 30px;
  position: relative;
  overflow: hidden;
}
.datasheet::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(70,228,211,0.05) 1px, transparent 1px);
  background-size: 100% 28px;
  pointer-events: none;
}
.datasheet-head {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: .72rem;
  margin-bottom: 14px;
  letter-spacing: .06em;
}
.datasheet h3 {
  color: var(--cyan);
  margin-bottom: 16px;
  letter-spacing: .04em;
}
.ds-table { width: 100%; border-collapse: collapse; position: relative; }
.ds-table tr { border-top: 1px solid var(--line); }
.ds-table tr:first-child { border-top: none; }
.ds-table th, .ds-table td {
  text-align: left;
  padding: 11px 0;
  font-size: .88rem;
  vertical-align: top;
}
.ds-table th {
  color: var(--text-muted);
  font-weight: 500;
  width: 38%;
  font-family: var(--font-mono);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ds-status { color: var(--cyan); font-family: var(--font-mono); }

/* =========================================================
   Work / Project cards
   ========================================================= */
.project-grid {
  margin-top: 48px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 26px;
}

.card {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) translateY(24px);
  transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
  opacity: 0;
}
.card.is-visible {
  opacity: 1;
  transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .card { transform: none !important; opacity: 1; transition: border-color .2s, box-shadow .2s; }
}

.card:hover, .card:focus-within {
  border-color: var(--card-accent, var(--cyan));
  box-shadow: 0 20px 50px -24px var(--card-accent, var(--cyan));
}

.card-media {
  height: 168px;
  position: relative;
  background: var(--card-gradient, linear-gradient(135deg, #16202A, #1B2733));
  display: flex;
  align-items: flex-end;
  padding: 14px;
}
.card-media .card-glyph {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: rgba(255,255,255,0.65);
  background: rgba(0,0,0,0.35);
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: .04em;
}

.card-body {
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-cat {
  font-family: var(--font-mono);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--card-accent, var(--cyan));
}

.card-title { font-size: 1.2rem; margin: 0; }

.card-desc {
  color: var(--text-muted);
  font-size: .92rem;
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.card-tags span {
  font-size: .72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 999px;
}

.card-links {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: .85rem;
}
.card-links a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--card-accent, var(--cyan));
  padding-bottom: 1px;
  transition: color .2s;
}
.card-links a:hover { color: var(--card-accent, var(--cyan)); }

/* =========================================================
   Contact
   ========================================================= */
.contact-inner { text-align: center; }
.contact .eyebrow { display: block; }
.contact h2 { max-width: none; }
.contact .section-sub { margin: 0 auto 34px; }
.contact-email {
  font-size: clamp(1.4rem, 4vw, 2rem);
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 2px solid var(--cyan-dim);
  padding-bottom: 4px;
  transition: color .2s, border-color .2s;
}
.contact-email:hover { color: var(--amber); border-color: var(--amber-dim); }
.contact-note {
  margin-top: 22px;
  color: var(--text-muted);
  font-size: .9rem;
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 30px 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--text-muted);
  font-size: .85rem;
}
.footer-nav { display: flex; gap: 22px; }
.footer-nav a { color: var(--text-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--cyan); }

/* =========================================================
   Legal pages
   ========================================================= */
.legal {
  padding: 150px 0 100px;
  max-width: 760px;
  margin: 0 auto;
}
.legal h1 { font-size: 2.1rem; margin-bottom: 6px; }
.legal .updated { color: var(--text-muted); font-size: .9rem; margin-bottom: 40px; }
.legal h2 {
  font-size: 1.2rem;
  margin-top: 40px;
  color: var(--cyan);
}
.legal p { color: var(--text-muted); }
.legal a { color: var(--cyan); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .nav-list {
    position: fixed;
    top: 68px; left: 0; right: 0;
    flex-direction: column;
    background: rgba(10,13,19,0.98);
    border-bottom: 1px solid var(--line);
    padding: 20px 24px;
    gap: 18px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s var(--ease), transform .2s var(--ease);
  }
  .nav-list.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  .section { padding: 76px 0; }
  .hero { min-height: 92vh; }
}

@media (max-width: 480px) {
  .hero-actions { flex-direction: column; align-items: stretch; }
  .btn { justify-content: center; }
}
