/* ======================================================================
   TOKENS — Blueprint / Schematic design system
   ====================================================================== */
:root {
  --bg: #0B1220;
  --bg-alt: #0E1830;
  --grid-line: rgba(90, 140, 200, 0.10);
  --grid-line-strong: rgba(120, 165, 220, 0.18);
  --ink: #EDEAE0;
  --ink-muted: #8B98AA;
  --brass: #C9A227;
  --brass-soft: rgba(201, 162, 39, 0.14);
  --teal: #3FA796;
  --teal-soft: rgba(63, 167, 150, 0.14);
  --card-bg: rgba(16, 25, 46, 0.72);
  --card-border: rgba(140, 170, 210, 0.16);
  --radius: 4px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --max-width: 1180px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; font-weight: 600; }
p { margin: 0; }
ul, ol, dl { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }

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

.mono-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}

/* Fixed blueprint grid backdrop across the whole page */
.blueprint-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 40%, transparent 100%);
}

/* ======================================================================
   NAV
   ====================================================================== */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  background: linear-gradient(180deg, rgba(11,18,32,0.92), rgba(11,18,32,0));
  backdrop-filter: blur(6px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
}
.brand-mark { color: var(--brass); font-family: var(--font-mono); }
.brand-text { font-size: 0.95rem; }

.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 10px;
  z-index: 60;
}
.nav-toggle span { width: 18px; height: 2px; background: var(--ink); display: block; transition: transform .25s var(--ease), opacity .25s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-links {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: min(78vw, 320px);
  background: var(--bg-alt);
  border-left: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.75rem;
  padding: 2rem;
  transform: translateX(100%);
  transition: transform .35s var(--ease);
  z-index: 55;
}
.nav-links.is-open { transform: translateX(0); }
.nav-links a {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink);
}
.nav-index { font-family: var(--font-mono); color: var(--brass); font-size: 0.75rem; }
.nav-cta { color: var(--brass) !important; }

@media (min-width: 900px) {
  .topnav { padding: 1.25rem 3rem; }
  .nav-toggle { display: none; }
  .nav-links {
    position: static;
    flex-direction: row;
    height: auto;
    width: auto;
    background: none;
    border: none;
    padding: 0;
    gap: 2rem;
    transform: none;
  }
  .nav-links a { font-size: 0.92rem; }
}

/* ======================================================================
   BUTTONS
   ====================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  transition: transform .2s var(--ease), border-color .2s, background .2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--brass); color: #191305; }
.btn-primary:hover { background: #dbb534; }
.btn-ghost { border-color: var(--card-border); color: var(--ink); }
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); }
.btn-text { color: var(--ink-muted); padding: 0.85rem 0.2rem; }
.btn-text:hover { color: var(--ink); }

/* ======================================================================
   HERO
   ====================================================================== */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding: 6.5rem 1.25rem 3.5rem;
  overflow: hidden;
}
#scene-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11,18,32,0.15) 0%, rgba(11,18,32,0.55) 60%, var(--bg) 100%);
  z-index: 1;
  pointer-events: none;
}
.hero-content { position: relative; z-index: 2; width: 100%; max-width: var(--max-width); margin: 0 auto; }
.hero-title {
  font-size: clamp(2.4rem, 9vw, 5rem);
  line-height: 1.02;
  margin: 0.6rem 0 0.3rem;
}
.hero-role { color: var(--brass); font-size: clamp(1rem, 3vw, 1.3rem); font-weight: 500; margin-bottom: 0.6rem; }
.hero-tagline { color: var(--ink-muted); max-width: 46ch; font-size: 1rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin: 2rem 0 2.5rem; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  border-top: 1px solid var(--card-border);
  padding-top: 1.5rem;
}
.stat { transition: transform .25s var(--ease); }
.stat:hover { transform: translateY(-4px); }
.stat dt { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); }
.stat dd { margin: 0.2rem 0 0; font-family: var(--font-display); font-size: 1.7rem; color: var(--ink); }

@media (min-width: 700px) {
  .hero-stats { grid-template-columns: repeat(4, auto); }
}

.scroll-cue {
  position: absolute;
  bottom: 1.25rem; left: 1.25rem;
  z-index: 2;
  display: none;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.scroll-cue span {
  width: 1px; height: 22px;
  background: var(--teal);
  animation: scrollcue 1.8s infinite var(--ease);
}
@keyframes scrollcue { 0%, 100% { transform: scaleY(1); opacity: .4; } 50% { transform: scaleY(0.4); opacity: 1; } }
@media (min-width: 700px) { .scroll-cue { display: flex; } }

/* ======================================================================
   SECTIONS (shared)
   ====================================================================== */
.section {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4.5rem 1.25rem;
}
.section-alt { background: var(--bg-alt); max-width: none; }
.section-alt > * { max-width: var(--max-width); margin-left: auto; margin-right: auto; }
.section-alt .section-head, .section-alt .stack-grid, .section-alt .pipeline,
.section-alt .contact-grid { max-width: var(--max-width); margin-left: auto; margin-right: auto; }

.section-head { margin-bottom: 2.5rem; }
.section-head h2 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin-top: 0.4rem; }
.section-sub { color: var(--ink-muted); margin-top: 0.5rem; max-width: 50ch; }

/* Reveal-on-scroll (rise + subtle 3D tilt-up) */
.reveal {
  opacity: 0;
  transform: perspective(900px) translateY(26px) rotateX(8deg);
  transform-origin: center bottom;
  transition: opacity .75s var(--ease), transform .75s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: perspective(900px) translateY(0) rotateX(0deg); }

/* Slide-in variants for side-by-side content */
.reveal-left { transform: perspective(900px) translateX(-34px) rotateY(14deg); }
.reveal-left.is-visible { transform: perspective(900px) translateX(0) rotateY(0deg); }
.reveal-right { transform: perspective(900px) translateX(34px) rotateY(-14deg); }
.reveal-right.is-visible { transform: perspective(900px) translateX(0) rotateY(0deg); }

/* Flip-up variant for grid items (stack/project/testimonial/pipeline cards) */
.reveal-flip { transform: perspective(900px) rotateX(28deg) translateY(18px) scale(0.96); transform-origin: center bottom; }
.reveal-flip.is-visible { transform: perspective(900px) rotateX(0deg) translateY(0) scale(1); }

.section, .about-grid, .stack-grid, .project-grid, .pipeline, .testimonial-grid, .contact-grid, .hero-stats {
  perspective: 1200px;
}

/* ======================================================================
   ABOUT
   ====================================================================== */
.about-grid { display: grid; gap: 2.5rem; }
.about-copy p { color: var(--ink-muted); font-size: 1.05rem; max-width: 60ch; }
.fact-list { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.6rem; }
.fact-list li { display: flex; gap: 0.75rem; font-size: 0.92rem; border-bottom: 1px dashed var(--card-border); padding-bottom: 0.6rem; }
.fact-list span { font-family: var(--font-mono); color: var(--teal); min-width: 90px; text-transform: uppercase; font-size: 0.72rem; letter-spacing: .05em; }

.about-portrait { max-width: 320px; }
.about-portrait.tilt-card { cursor: default; }
.portrait-float { animation: portraitFloat 6s ease-in-out infinite; }
.portrait-tilt {
  position: relative;
  transform-style: preserve-3d;
  transition: transform .15s ease-out;
}
@keyframes portraitFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.portrait-tilt img, .portrait-placeholder { border-radius: var(--radius); width: 100%; aspect-ratio: 4/5; object-fit: cover; }
.portrait-placeholder { background: var(--card-bg); display: flex; align-items: center; justify-content: center; border: 1px solid var(--card-border); }
.portrait-frame {
  position: absolute; inset: -10px;
  border: 1px solid var(--brass);
  border-radius: var(--radius);
  pointer-events: none;
  transform: translateZ(20px);
}

@media (min-width: 900px) {
  .about-grid { grid-template-columns: 1.3fr 0.7fr; align-items: center; }
}

/* ======================================================================
   STACK — component library
   ====================================================================== */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.stack-card {
  background: transparent;
  border-radius: var(--radius);
  min-height: 148px;
  perspective: 800px;
}
.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 148px;
  transform-style: preserve-3d;
  transition: transform .6s var(--ease);
}
.stack-card:hover .flip-inner, .stack-card:focus-within .flip-inner, .stack-card:focus .flip-inner {
  transform: rotateY(180deg);
}
.flip-front, .flip-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem;
}
.flip-front::before {
  content: "";
  position: absolute; top: 0; left: 0;
  width: 14px; height: 14px;
  border-top: 2px solid var(--accent, var(--brass));
  border-left: 2px solid var(--accent, var(--brass));
}
.flip-back {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-align: center;
  border-color: var(--accent, var(--card-border));
}
.flip-percent { font-family: var(--font-display); font-size: 2rem; color: var(--accent, var(--brass)); }
.flip-note { color: var(--ink-muted); font-size: 0.8rem; font-family: var(--font-body); text-transform: none; letter-spacing: normal; }

.stack-card-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.8rem; }
.stack-name { font-family: var(--font-display); font-weight: 600; }
.stack-bar { height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.stack-bar-fill { height: 100%; background: var(--accent, var(--brass)); border-radius: 2px; transition: width 1.2s var(--ease); }
.stack-percent { display: block; margin-top: 0.4rem; }

/* ======================================================================
   PROJECTS — shipped units
   ====================================================================== */
.filter-tabs { display: flex; gap: 0.6rem; margin-bottom: 2rem; }
.filter-tab {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--ink-muted);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all .2s;
}
.filter-tab.is-active, .filter-tab:hover { border-color: var(--teal); color: var(--teal); }

.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 720px) { .project-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .project-grid { grid-template-columns: repeat(3, 1fr); } }

.project-card {
  perspective: 900px;
  border-radius: var(--radius);
}
.project-card.is-hidden { display: none; }
.tilt-inner {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .15s ease-out, border-color .2s;
  will-change: transform;
}
.project-card:hover .tilt-inner, .project-card:focus-visible .tilt-inner { border-color: var(--teal); }

.project-media { position: relative; aspect-ratio: 16/10; background: #0A1120; }
.project-media img { width: 100%; height: 100%; object-fit: cover; }
.media-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.status-pill {
  position: absolute; top: 0.7rem; right: 0.7rem;
  font-family: var(--font-mono); font-size: 0.65rem; text-transform: uppercase;
  padding: 0.25rem 0.55rem; border-radius: 2px;
  background: var(--teal-soft); color: var(--teal); letter-spacing: 0.04em;
}
.status-live { animation: pillPulse 2.4s ease-in-out infinite; }
@keyframes pillPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63, 167, 150, 0.35); }
  50% { box-shadow: 0 0 0 4px rgba(63, 167, 150, 0); }
}
.status-in_review { background: var(--brass-soft); color: var(--brass); }
.status-archived, .status-sold_out { background: rgba(139,152,170,0.15); color: var(--ink-muted); }

.project-body { padding: 1.25rem; }
.project-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; margin-bottom: 0.5rem; }
.project-heading h3 { font-size: 1.15rem; }
.project-summary { color: var(--ink-muted); font-size: 0.9rem; margin-bottom: 0.9rem; }

.project-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.9rem; }
.project-tags li {
  font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase;
  padding: 0.2rem 0.5rem; border-radius: 2px;
  border: 1px solid var(--accent, var(--card-border));
  color: var(--accent, var(--ink-muted));
}
.project-specs { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-bottom: 0.9rem; color: var(--ink-muted); }
.project-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.project-links a { font-size: 0.85rem; color: var(--teal); text-decoration: none; }
.project-links a:hover { text-decoration: underline; }

.empty-note { color: var(--ink-muted); font-family: var(--font-mono); font-size: 0.85rem; }

/* ======================================================================
   PROCESS — build pipeline
   ====================================================================== */
.pipeline {
  display: grid;
  gap: 1.25rem;
  counter-reset: step;
}
@media (min-width: 900px) { .pipeline { grid-template-columns: repeat(3, 1fr); } }
.pipeline-step {
  border-left: 2px solid var(--card-border);
  padding-left: 1.1rem;
  position: relative;
  overflow: hidden;
}
.pipeline-step::before {
  content: "";
  position: absolute;
  left: -2px; top: 0;
  width: 2px; height: 0;
  background: var(--brass);
  transition: height 1s var(--ease) .15s;
}
.pipeline-step.is-visible::before { height: 100%; }
.pipeline-index { display: block; margin-bottom: 0.4rem; }
.pipeline-step h3 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.pipeline-step p { color: var(--ink-muted); font-size: 0.9rem; }

/* ======================================================================
   TESTIMONIALS
   ====================================================================== */
.testimonial-grid { display: grid; gap: 1.25rem; }
@media (min-width: 800px) { .testimonial-grid { grid-template-columns: repeat(3, 1fr); } }
.testimonial-card {
  margin: 0;
  border-radius: var(--radius);
  perspective: 800px;
}
.testimonial-tilt {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .15s ease-out, border-color .2s;
}
.testimonial-card:hover .testimonial-tilt, .testimonial-card:focus-visible .testimonial-tilt { border-color: var(--teal); }
.testimonial-mark {
  display: block;
  font-family: var(--font-display);
  font-size: 2.6rem;
  line-height: 1;
  color: var(--brass);
  opacity: 0.6;
  margin-bottom: 0.3rem;
  transform: translateZ(24px);
}
.testimonial-quote { color: var(--ink); font-size: 0.95rem; margin-bottom: 1rem; }
.testimonial-tilt footer { display: flex; flex-direction: column; gap: 0.15rem; }
.testimonial-name { font-weight: 600; }
.testimonial-title { color: var(--ink-muted); font-size: 0.82rem; }
.testimonial-rating { color: var(--brass); margin-top: 0.3rem; }

/* ======================================================================
   CONTACT
   ====================================================================== */
.contact-grid { display: grid; gap: 2.5rem; }
@media (min-width: 900px) { .contact-grid { grid-template-columns: 1.3fr 0.7fr; } }

.contact-form {
  border-radius: var(--radius);
  transition: box-shadow .3s var(--ease);
  padding: 0.25rem;
}
.contact-form:focus-within {
  box-shadow: 0 0 0 1px var(--teal), 0 0 28px rgba(63, 167, 150, 0.22);
}
.form-row { margin-bottom: 1.1rem; display: flex; flex-direction: column; gap: 0.4rem; }
.form-row label { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); }
.form-row input, .form-row textarea {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--ink);
  padding: 0.8rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  resize: vertical;
}
.form-row input:focus, .form-row textarea:focus { border-color: var(--teal); outline: none; }
.hp-field { position: absolute; left: -9999px; }

.form-status { margin-top: 0.9rem; min-height: 1em; }
.form-status.is-success { color: var(--teal); }
.form-status.is-error { color: #e06666; }

.contact-side { display: flex; flex-direction: column; gap: 1rem; align-items: flex-start; }
.contact-line { display: flex; flex-direction: column; gap: 0.2rem; text-decoration: none; font-size: 1rem; }
.social-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.5rem; }
.social-row a { text-decoration: none; color: var(--ink-muted); font-size: 0.88rem; border-bottom: 1px solid transparent; }
.social-row a:hover { color: var(--teal); border-color: var(--teal); }

/* ======================================================================
   FOOTER
   ====================================================================== */
.site-footer { position: relative; z-index: 1; padding: 2.5rem 1.25rem; text-align: center; color: var(--ink-muted); font-size: 0.85rem; }
.footer-inner { max-width: var(--max-width); margin: 0 auto; display: flex; flex-direction: column; gap: 0.4rem; }
