/* ═══════════════════════════════════════════════════════════════════
   CMAC Mini-Homes — Main Stylesheet
   ═══════════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────────── */
:root {
  --bg:       #0a0a09;
  --bg2:      #111110;
  --bg3:      #1a1917;
  --steel:    #c4c0b8;
  --rust:     #c42020;      /* darker hover/shadow shade */
  --rust2:    #ED2C29;      /* official CMAC brand red   */
  --gold:     #c8972a;
  --white:    #f5f2ed;
  --muted:    #7a756d;
  --border:   rgba(255,255,255,0.07);
  --font-head: 'Bebas Neue', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

/* ── Film Grain ─────────────────────────────────────────────────── */
/* SVG-based noise — pure CSS, no extra HTTP request */
body::after {
  content: '';
  position: fixed; inset: 0; z-index: 9000;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  animation: grainShift 0.08s steps(1) infinite;
}
@keyframes grainShift {
  0%   { background-position: 0 0; }
  20%  { background-position: -30px 15px; }
  40%  { background-position: 15px -20px; }
  60%  { background-position: -15px 30px; }
  80%  { background-position: 25px -10px; }
  100% { background-position: 0 0; }
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* ── Custom Cursor ──────────────────────────────────────────────── */
@media (pointer: fine) {
  body { cursor: none; }
}
#cursorDot {
  position: fixed; top: -4px; left: -4px; z-index: 9999;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--rust2); pointer-events: none;
  transform: translate(-100px,-100px);
  transition: background 0.2s;
}
#cursorRing {
  position: fixed; top: -20px; left: -20px; z-index: 9998;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid rgba(196,192,184,0.5); pointer-events: none;
  transform: translate(-100px,-100px);
  transition: width .25s, height .25s, border-color .25s, top .01s, left .01s;
}
#cursorRing.expand {
  width: 64px; height: 64px; top: -32px; left: -32px;
  border-color: var(--rust2);
}

/* ── Ticker ─────────────────────────────────────────────────────── */
.ticker-wrap {
  overflow: hidden; background: var(--rust); height: 36px;
  display: flex; align-items: center;
}
.ticker-track {
  display: flex; white-space: nowrap;
  animation: tickerMove 28s linear infinite;
}
.ticker-track:hover { animation-play-state: paused; }
#tickerInner, #tickerInner + #tickerInner {
  display: flex; gap: 0;
}
.ticker-item {
  display: flex; align-items: center; gap: 18px;
  padding: 0 40px;
  font-family: var(--font-head); font-size: 14px; letter-spacing: 0.15em;
  color: #fff; text-transform: uppercase;
}
.ticker-dot { width: 5px; height: 5px; background: rgba(255,255,255,0.5); border-radius: 50%; flex-shrink: 0; }
@keyframes tickerMove { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ── Nav ────────────────────────────────────────────────────────── */
#mainNav {
  position: fixed; top: 36px; left: 0; right: 0; z-index: 900;
  padding: 0 48px;
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
  transition: background 0.3s, backdrop-filter 0.3s, box-shadow 0.3s;
}
#mainNav.scrolled {
  background: rgba(10,10,9,0.92);
  backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 var(--border);
}
.nav-logo {
  display: flex; align-items: center; line-height: 1;
}
.nav-logo-svg {
  height: 38px;
  width: auto;
  display: block;
}
.nav-logo-img {
  height: 32px;
  width: auto;
  max-width: 140px;
  display: block;
  object-fit: contain;
  mix-blend-mode: screen;
}
.nav-logo-tagline {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--steel);
  margin-left: 6px;
  align-self: center;
}
.nav-links {
  display: flex; gap: 36px; list-style: none;
}
.nav-links a {
  font-size: 12px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--steel); transition: color 0.2s;
}
.nav-links a:hover { color: var(--white); }
.nav-cta {
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--rust); color: #fff; padding: 10px 24px;
  border: none; cursor: pointer; transition: background 0.2s;
}
.nav-cta:hover { background: var(--rust2); }
#hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; }
#hamburger span { display: block; width: 24px; height: 2px; background: var(--white); transition: 0.3s; }
#hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#hamburger.active span:nth-child(2) { opacity: 0; }
#hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
#mobileMenu {
  display: none; position: fixed; inset: 0; top: 108px; z-index: 850;
  background: rgba(10,10,9,0.97); backdrop-filter: blur(20px);
  flex-direction: column; align-items: center; justify-content: center; gap: 32px;
}
#mobileMenu.open { display: flex; }
#mobileMenu a {
  font-family: var(--font-head); font-size: 36px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--white);
}

/* ── Hero ───────────────────────────────────────────────────────── */
#hero {
  position: relative; height: 100vh; min-height: 600px;
  display: flex; align-items: flex-end; justify-content: flex-start;
  padding: 0 48px 80px;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.65) 100%),
    url('../frames/f12.webp') center/cover no-repeat;
}
.hero-content {
  position: relative; z-index: 2; max-width: 780px;
}
#heroTagline {
  font-family: var(--font-head);
  font-size: clamp(52px, 8vw, 110px);
  line-height: 0.92;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: 20px;
}
#heroTagline em {
  color: var(--rust2); font-style: normal;
}
#heroSub {
  font-size: clamp(14px, 1.4vw, 17px);
  color: var(--steel);
  max-width: 520px;
  margin-bottom: 36px;
  line-height: 1.7;
}
#heroCtaGroup { display: flex; gap: 16px; flex-wrap: wrap; }
.cta-btn {
  display: inline-block; padding: 14px 32px;
  font-size: 12px; letter-spacing: 0.15em; text-transform: uppercase;
  border: none; cursor: pointer; transition: 0.2s;
  font-family: var(--font-body); font-weight: 600;
}
.cta-btn.primary { background: var(--rust); color: #fff; }
.cta-btn.primary:hover { background: var(--rust2); }
.cta-btn.secondary { background: transparent; color: var(--white); border: 1px solid var(--border); }
.cta-btn.secondary:hover { border-color: rgba(255,255,255,0.3); }
.hero-scroll-hint {
  position: absolute; bottom: 28px; right: 48px; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted);
}
.scroll-line {
  width: 40px; height: 1px; background: var(--muted);
  position: relative; overflow: hidden;
}
.scroll-line::after {
  content: '';
  position: absolute; left: -100%; top: 0;
  width: 100%; height: 100%;
  background: var(--rust2);
  animation: scanLine 2s ease-in-out infinite;
}
@keyframes scanLine {
  0%   { left: -100%; }
  50%  { left: 0; }
  100% { left: 100%; }
}

/* ── Stats Bar ──────────────────────────────────────────────────── */
#statsBar {
  background: var(--bg3); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 48px 48px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.stat-item {
  padding: 0 32px;
  border-right: 1px solid var(--border);
}
.stat-item:first-child { padding-left: 0; }
.stat-item:last-child  { border-right: none; }
.stat-num {
  font-family: var(--font-head); font-size: clamp(44px, 5vw, 68px);
  line-height: 1; color: var(--white); margin-bottom: 6px;
}
.stat-label {
  font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════════════
   BUILD SEQUENCE — Cinematic Full-Screen
   ═══════════════════════════════════════════════════════════════════ */

#buildWrapper {
  position: relative;
  height: 1500vh; /* ~125vh per frame — slow, deliberate scroll */
}

/* ── Sticky container — full viewport ────────────────────────────── */
#buildSticky {
  position: sticky; top: 0;
  width: 100%; height: 100vh;
  overflow: hidden;
  background: #000;
}

/* ── Canvas fills entire sticky area ─────────────────────────────── */
#buildCanvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}

/* ── Cinematic vignette ──────────────────────────────────────────── */
#buildVignette {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(
    ellipse at 60% 50%,
    transparent 30%,
    rgba(0,0,0,0.55) 100%
  );
}

/* ── Left gradient so text is readable ───────────────────────────── */
#buildGradient {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: linear-gradient(
    105deg,
    rgba(6,6,5,0.88) 0%,
    rgba(6,6,5,0.72) 28%,
    rgba(6,6,5,0.25) 52%,
    transparent 68%
  );
}

/* ── Text overlay, bottom-left ───────────────────────────────────── */
#buildOverlay {
  position: absolute; bottom: 0; left: 0; z-index: 5;
  width: 560px; max-width: 50%;
  padding: 0 64px 72px;
  display: flex; flex-direction: column; gap: 0;
  opacity: 0; /* GSAP reveals on load */
}

/* Section eyebrow */
#buildLabel {
  font-size: 10px; letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--rust2); margin-bottom: 22px;
  display: flex; align-items: center; gap: 12px;
}

/* Animated accent line */
#seq-line-accent {
  display: block; width: 28px; height: 1px;
  background: var(--rust2); flex-shrink: 0;
  transform-origin: left;
}

/* Ghost layer number */
#seq-num-display {
  font-family: var(--font-head);
  font-size: clamp(72px, 10vw, 130px);
  line-height: 0.85;
  letter-spacing: -0.03em;
  color: rgba(255,255,255,0.06);
  margin-bottom: -16px;
  pointer-events: none; user-select: none;
  opacity: 0; /* GSAP reveals */
}

/* Layer title */
#seq-title {
  font-family: var(--font-head);
  font-size: clamp(42px, 5vw, 68px);
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: 10px;
  opacity: 0; /* GSAP reveals */
}

/* Layer subtitle */
#seq-sub {
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--rust2); margin-bottom: 18px;
  opacity: 0;
}

/* Description */
#seq-desc {
  font-size: clamp(13px, 1.2vw, 15px);
  line-height: 1.8;
  color: rgba(196,192,184,0.85);
  max-width: 380px;
  min-height: 80px;
  opacity: 0;
}

/* ── Frame counter, top-right ─────────────────────────────────────── */
#buildCounter {
  position: absolute; top: 36px; right: 48px; z-index: 5;
  display: flex; align-items: baseline; gap: 4px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
  opacity: 0;
}
#seq-frame-current {
  font-size: 22px; font-weight: 400; color: rgba(255,255,255,0.75);
  letter-spacing: -0.02em;
}

/* ── "Build Sequence" label top-left ─────────────────────────────── */
#buildTopLabel {
  position: absolute; top: 36px; left: 64px; z-index: 5;
  font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  display: flex; align-items: center; gap: 10px;
}
#buildTopLabel::before {
  content: ''; width: 20px; height: 1px;
  background: rgba(255,255,255,0.3);
}

/* ── Progress bar, bottom edge ────────────────────────────────────── */
#buildProgressWrap {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 6;
  height: 2px; background: rgba(255,255,255,0.07);
  opacity: 0;
}
#seq-bar {
  height: 100%; width: 0%;
  background: var(--rust2);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Dot indicators, right edge ──────────────────────────────────── */
.seq-dots {
  position: absolute; right: 48px; top: 50%; transform: translateY(-50%);
  z-index: 5; display: flex; flex-direction: column; gap: 10px;
  opacity: 0;
}
.seq-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.18);
  transition: background 0.4s, transform 0.3s, border-color 0.3s;
}
.seq-dot.done   { background: rgba(224,90,30,0.4); border-color: rgba(224,90,30,0.5); }
.seq-dot.active { background: var(--rust2); border-color: var(--rust2); transform: scale(1.6); }

/* ── Loader overlay ──────────────────────────────────────────────── */
#buildLoader {
  position: absolute; inset: 0; z-index: 20;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
}
.loader-label {
  font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted);
}
.loader-track {
  width: 200px; height: 1px; background: rgba(255,255,255,0.08);
}
#loaderBar {
  height: 100%; width: 0%; background: var(--rust2);
  transition: width 0.15s linear;
}

/* ── Why CMAC Section ───────────────────────────────────────────── */
#whyCMAC {
  padding: 120px 48px;
  background: var(--bg);
}
.section-label {
  font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--rust2); margin-bottom: 20px; display: flex; align-items: center; gap: 12px;
}
.section-label::before {
  content: ''; width: 24px; height: 1px; background: var(--rust2);
}
.section-title {
  font-family: var(--font-head); font-size: clamp(40px, 5vw, 72px);
  line-height: 1; text-transform: uppercase; color: var(--white);
  margin-bottom: 64px; max-width: 700px;
}
.why-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--border);
}
.why-card {
  background: var(--bg2); padding: 48px 40px;
}
.why-icon {
  width: 40px; height: 40px; margin-bottom: 24px;
  color: var(--rust2);
}
.why-card h3 {
  font-family: var(--font-head); font-size: 28px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--white); margin-bottom: 12px;
}
.why-card p {
  font-size: 14px; line-height: 1.7; color: var(--steel);
}

/* ── Specs Section ──────────────────────────────────────────────── */
#specs {
  padding: 120px 48px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
}
.specs-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: start;
}
.spec-table { width: 100%; border-collapse: collapse; }
.spec-row {
  border-bottom: 1px solid var(--border);
}
.spec-row td {
  padding: 16px 0; font-size: 14px;
}
.spec-row td:first-child { color: var(--muted); letter-spacing: 0.05em; }
.spec-row td:last-child  { color: var(--white); text-align: right; font-weight: 500; }
.spec-note {
  font-size: 12px; color: var(--muted); margin-top: 16px; line-height: 1.6;
}
.specs-cta-side {
  display: flex; flex-direction: column; justify-content: center; gap: 24px;
}
.specs-cta-side h2 {
  font-family: var(--font-head); font-size: clamp(36px, 4vw, 56px);
  line-height: 1.05; text-transform: uppercase; color: var(--white);
}
.specs-cta-side p {
  font-size: 15px; line-height: 1.7; color: var(--steel);
}

/* ── CTA / Contact Section ──────────────────────────────────────── */
#contact {
  padding: 140px 48px;
  background: var(--bg);
  text-align: center;
  border-top: 1px solid var(--border);
}
#contact .section-label { justify-content: center; }
#contact .section-label::before { display: none; }
#contact h2 {
  font-family: var(--font-head); font-size: clamp(52px, 7vw, 100px);
  line-height: 0.95; text-transform: uppercase; color: var(--white);
  margin-bottom: 20px;
}
#contact h2 em { color: var(--rust2); font-style: normal; }
#contact p {
  font-size: 16px; color: var(--steel); max-width: 480px; margin: 0 auto 48px;
  line-height: 1.7;
}
.contact-form {
  max-width: 520px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 16px;
}
.contact-form input,
.contact-form textarea {
  background: var(--bg2); border: 1px solid var(--border); color: var(--white);
  padding: 16px 20px; font-size: 14px; font-family: var(--font-body);
  outline: none; transition: border-color 0.2s; width: 100%; resize: vertical;
}
.contact-form input:focus,
.contact-form textarea:focus { border-color: var(--rust); }
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: var(--muted); }
.contact-form button {
  background: var(--rust); color: #fff; border: none; cursor: pointer;
  padding: 16px; font-size: 12px; letter-spacing: 0.15em; text-transform: uppercase;
  font-family: var(--font-body); font-weight: 600; transition: background 0.2s;
}
.contact-form button:hover { background: var(--rust2); }

/* ── Footer ─────────────────────────────────────────────────────── */
footer {
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: 40px 48px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.footer-left {
  font-family: var(--font-head); font-size: 20px; letter-spacing: 0.08em; color: var(--muted);
}
.footer-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 5px;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
.footer-credit {
  font-size: 10px; letter-spacing: 0.08em; color: rgba(122,117,109,0.5);
  text-transform: none;
}
.footer-credit a {
  color: rgba(237,44,41,0.5); text-decoration: none; transition: color 0.2s;
}
.footer-credit a:hover { color: var(--rust2); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  #statsBar { grid-template-columns: repeat(2, 1fr); }
  .stat-item:nth-child(2) { border-right: none; }
  .stat-item:nth-child(3) { padding-left: 0; }
  #buildOverlay { width: 90%; max-width: 90%; padding: 0 32px 64px; }
  .why-grid { grid-template-columns: 1fr 1fr; }
  .specs-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  #mainNav { padding: 0 24px; }
  .nav-links, .nav-cta { display: none; }
  #hamburger { display: flex; }
  #hero { padding: 0 24px 60px; }
  #statsBar { grid-template-columns: 1fr 1fr; padding: 32px 24px; }
  .stat-item { padding: 16px; }
  .stat-item:nth-child(2n) { border-right: none; }
  .stat-item:nth-child(3) { border-top: 1px solid var(--border); }
  .stat-item:nth-child(4) { border-top: 1px solid var(--border); }
  #whyCMAC, #specs, #contact { padding: 80px 24px; }
  .why-grid { grid-template-columns: 1fr; }
  footer { padding: 32px 24px; flex-direction: column; text-align: center; }
}
