/* ===================================================
   KUBRIK — Design System
   Mobile-first. Dark premium. Cube colors as accent.
   =================================================== */

/* --- DESIGN TOKENS --- */
:root {
  /* Colors */
  --bg: #0B0B0F;
  --bg-surface: #131318;
  --bg-surface-2: #1A1A21;
  --fg: #F4F4F0;
  --fg-muted: #8A8A9A;
  --fg-subtle: #4A4A5A;

  /* Rubik's Cube — Pantone-derived palette (not RGB approximations) */
  --cube-red:    #C8102E;  /* Pantone 186 C  */
  --cube-blue:   #003DA5;  /* Pantone 286 C  */
  --cube-green:  #009639;  /* Pantone 355 C  */
  --cube-yellow: #FFCD00;  /* Pantone 116 C  */
  --cube-orange: #FF6A13;  /* Pantone 1505 C */
  --cube-white:  #F4F5F0;  /* Pantone 11-0601 Bright White */

  /* Typography — editorial / design-monograph */
  --font-display: 'Times New Roman', Times, serif;
  --font-body: 'Times New Roman', Times, serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace;

  /* Hairline rule system */
  --rule: 1px solid rgba(255, 255, 255, 0.18);

  /* Spacing scale (8px) */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;
  --space-8: 64px;
  --space-10: 80px;
  --space-12: 96px;
  --space-16: 128px;

  /* Layout */
  --max-width: 1200px;
  --nav-height: 64px;
}

/* --- RESET & BASE --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  font-feature-settings: 'tnum';
}

/* --- NAVIGATION --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 11, 15, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: var(--rule);
  height: var(--nav-height);
}

.nav__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--fg);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.nav__logo svg { flex-shrink: 0; }

.nav__links {
  display: flex;
  gap: var(--space-4);
  margin-left: auto;
}

.nav__links a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}

.nav__links a:hover { color: var(--fg); }

.nav__cta {
  margin-left: var(--space-4);
}

.badge--coming {
  background: rgba(255, 88, 0, 0.12);
  color: var(--cube-orange);
  border: 1px solid rgba(255, 88, 0, 0.25);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
}

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1);
  margin-left: auto;
}

.nav__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--fg-muted);
  border-radius: 2px;
}

/* --- HERO --- */
.hero {
  position: relative;
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.hero__glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 70% 40%, rgba(196, 30, 58, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 80% 60%, rgba(0, 81, 186, 0.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 65% 70%, rgba(0, 158, 96, 0.05) 0%, transparent 60%);
  pointer-events: none;
}

.hero__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-8) var(--space-4) var(--space-6);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  align-items: center;
  width: 100%;
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cube-orange);
  margin-bottom: var(--space-3);
}

.hero__headline {
  font-family: var(--font-display);
  font-size: clamp(36px, 7vw, 72px);
  font-weight: 700;
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: var(--space-4);
}

.hero__sub {
  font-size: clamp(16px, 2vw, 19px);
  color: var(--fg-muted);
  line-height: 1.65;
  max-width: 480px;
  font-weight: 300;
}

.hero__stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

/* WebGL cube container — fluid sizing, respects ResizeObserver */
#cube-container {
  width: 280px;
  height: 280px;
  max-width: 100%;
  display: block;
}

/* On narrow viewports: cube sits below headline, no clipping */
@media (max-width: 767px) {
  #cube-container {
    width: min(280px, 80vw);
    height: min(280px, 80vw);
  }

  #cube-container canvas {
    width: 100% !important;
    height: 100% !important;
  }
}

#cube-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.hero__stage-caption {
  font-size: 12px;
  color: var(--fg-subtle);
  letter-spacing: 0.04em;
  text-align: center;
  margin-top: var(--space-1);
}

.hero__scroll-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-subtle);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: var(--space-4);
  justify-content: center;
  animation: bounce-subtle 2.5s ease-in-out infinite;
}

@keyframes bounce-subtle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* --- MANIFESTO --- */
.manifesto {
  padding: var(--space-16) var(--space-4);
  border-top: var(--rule);
}

.manifesto__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.manifesto__label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--fg-subtle);
  margin-bottom: var(--space-5);
}

.manifesto__quote {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 44px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--fg);
  max-width: 860px;
  border-left: 3px solid var(--cube-orange);
  padding-left: var(--space-5);
  margin-bottom: var(--space-6);
}

.manifesto__body {
  font-size: 17px;
  color: var(--fg-muted);
  line-height: 1.75;
  max-width: 640px;
  margin-left: calc(var(--space-5) + 3px);
  font-weight: 300;
}

/* --- SPEC SHEET --- */
.spec {
  padding: var(--space-16) var(--space-4);
  background: var(--bg-surface);
}

.spec__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.spec__table {
  display: flex;
  flex-direction: column;
  border-top: var(--rule);
}

.spec__row {
  display: grid;
  grid-template-columns: 1fr;
  padding: var(--space-3) 0;
  border-bottom: var(--rule);
}

@media (min-width: 768px) {
  .spec__row {
    grid-template-columns: 20ch 1fr;
    padding: var(--space-4) 0;
  }
}

.spec__label {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding-top: 2px;
}

.spec__value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  color: var(--fg);
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

/* --- ORIGINS --- */
.origins {
  padding: var(--space-16) var(--space-4);
  border-top: var(--rule);
}

.origins__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-10);
}

.origins__label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--fg-subtle);
  margin-bottom: var(--space-4);
}

.origins__title {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: var(--space-4);
  line-height: 1.0;
}

.origins__body {
  font-size: 16px;
  color: var(--fg-muted);
  line-height: 1.75;
  margin-bottom: var(--space-8);
  font-weight: 300;
}

.origins__stat-row {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.origins__stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.origins__stat-number {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
}

.origins__stat-label {
  font-size: 12px;
  color: var(--fg-subtle);
  letter-spacing: 0.03em;
}

.origins__visual {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  justify-content: flex-end;
}

.origins__color-bar {
  display: flex;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
}

.origins__color-swatch { flex: 1; }
.origins__color-swatch--red    { background: var(--cube-red); }
.origins__color-swatch--blue   { background: var(--cube-blue); }
.origins__color-swatch--green  { background: var(--cube-green); }
.origins__color-swatch--yellow { background: var(--cube-yellow); }
.origins__color-swatch--orange { background: var(--cube-orange); }
.origins__color-swatch--white  { background: var(--cube-white); }

.origins__color-caption {
  font-size: 12px;
  color: var(--fg-subtle);
  letter-spacing: 0.03em;
}

/* --- PRODUCT / PRICING --- */
.product {
  padding: var(--space-16) var(--space-4);
  border-top: var(--rule);
}

.product__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.product__layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
  margin-top: var(--space-8);
}

/* Swatches */
.product__swatches {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.product__swatch-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.product__swatch {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.product__swatch-color {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.product__swatch--red    .product__swatch-color { background: var(--cube-red); }
.product__swatch--blue   .product__swatch-color { background: var(--cube-blue); }
.product__swatch--green  .product__swatch-color { background: var(--cube-green); }
.product__swatch--yellow .product__swatch-color { background: var(--cube-yellow); }
.product__swatch--orange .product__swatch-color { background: var(--cube-orange); }
.product__swatch--white  .product__swatch-color { background: var(--cube-white); }

.product__swatch-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--fg-subtle);
}

/* Spec dl */
.product__spec {
  display: flex;
  flex-direction: column;
  border-top: var(--rule);
}

.product__spec-row {
  display: grid;
  grid-template-columns: 1fr;
  padding: var(--space-3) 0;
  border-bottom: var(--rule);
}

@media (min-width: 768px) {
  .product__spec-row {
    grid-template-columns: 20ch 1fr;
    padding: var(--space-4) 0;
  }
}

/* Price + CTA */
.product__purchase {
  margin-top: var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-5);
}

.product__price {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.product__price-amount {
  font-family: var(--font-display);
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.0;
}

.product__price-note {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  background: var(--cube-orange);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.2s ease, transform 0.15s ease;
  cursor: pointer;
}

.btn-primary:hover {
  background: #ff7a2e;
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Responsive: 768px+ — two-column layout */
@media (min-width: 768px) {
  .product__layout {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-10);
  }

  .product__swatches {
    justify-content: flex-start;
  }

  .product__purchase {
    flex-direction: row;
    align-items: center;
    gap: var(--space-6);
    padding-top: var(--space-6);
    border-top: var(--rule);
    margin-top: var(--space-6);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn-primary {
    transition: none;
    transform: none;
  }
  .btn-primary:hover { transform: none; }
  .btn-primary:active { transform: none; }
}

/* --- CLOSING --- */
.closing {
  padding: var(--space-16) var(--space-4);
  background: var(--bg-surface);
  border-top: var(--rule);
  text-align: center;
}

.closing__inner {
  max-width: 680px;
  margin: 0 auto;
}

.closing__headline {
  font-family: var(--font-display);
  font-size: clamp(36px, 7vw, 72px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.0;
  margin-bottom: var(--space-5);
}

.closing__body {
  font-size: 18px;
  color: var(--fg-muted);
  line-height: 1.6;
  font-weight: 300;
}

/* --- FOOTER — Colophon --- */
.footer {
  padding: var(--space-8) var(--space-4);
}

.footer__inner--colophon {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

.footer__col {}

.footer__col--brand { grid-column: 1; }

.footer__col--links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer__col--colophon { grid-column: 1; }

/* Brand */
.footer__brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--fg);
  line-height: 1.2;
}

.footer__brand-tagline {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--fg-subtle);
  margin-top: var(--space-1);
  line-height: 1.6;
}

/* Link groups */
.footer__link-group {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.footer__link-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}

.footer__link {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  text-decoration: none;
}

.footer__link:hover { text-decoration: underline; }

/* Colophon proper */
.footer__colophon-text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--fg-subtle);
  line-height: 1.6;
}

/* 768px — two-column */
@media (min-width: 768px) {
  .footer__inner--colophon {
    grid-template-columns: 1fr 1fr;
    column-gap: var(--space-8);
    row-gap: var(--space-8);
  }

  .footer__col--brand { grid-column: 1; }
  .footer__col--links { grid-column: 2; }
  .footer__col--colophon {
    grid-column: 1 / -1;
    padding-top: var(--space-6);
    border-top: var(--rule);
  }
}

/* 1200px — three-column */
@media (min-width: 1200px) {
  .footer__inner--colophon {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .footer__col--brand { grid-column: 1; }
  .footer__col--links { grid-column: 2; }
  .footer__col--colophon {
    grid-column: 3;
    padding-top: 0;
    border-top: none;
  }
}

/* --- SECTION EYEBROWS --- */
.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--fg-subtle);
  display: block;
  margin-bottom: var(--space-3);
}

/* --- FOCUS STATES --- */
/* All interactive elements have a visible focus ring using the cube accent */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--cube-orange);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Nav links need larger tap target + focus */
.nav__links a {
  display: block;
  padding: var(--space-1) var(--space-2);
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
}

/* Nav toggle — ensure the button itself has visible focus */
.nav__toggle:focus-visible {
  outline: 2px solid var(--cube-orange);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --- RESPONSIVE: Tablet --- */
@media (min-width: 768px) {
  .hero__inner {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-10);
    padding: var(--space-12) var(--space-4) var(--space-10);
  }

  
  .origins__inner {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }
}

/* --- RESPONSIVE: Desktop --- */
@media (min-width: 1024px) {
  .nav__toggle { display: none; }
  .nav__links, .nav__cta { display: flex !important; }
  .nav__toggle { display: none; }
}

/* --- MOBILE MENU --- */
@media (max-width: 767px) {
  .nav__toggle { display: flex; }
  .nav__links, .nav__cta { display: none; }
}

/* Nav open state (toggled via JS) */
.nav__links.is-open {
  display: flex !important;
  flex-direction: column;
  position: absolute;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background: rgba(11, 11, 15, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: var(--rule);
  padding: var(--space-3) var(--space-4);
  gap: var(--space-2);
  z-index: 99;
}

.nav__links.is-open a {
  min-height: 48px;
  padding: var(--space-2) 0;
  font-size: 16px;
}

.nav__cta.is-open {
  display: flex !important;
  padding: var(--space-2) 0 var(--space-3);
}

/* --- WAITLIST FORM --- */
.waitlist-form {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: var(--space-4);
}

.waitlist-form__input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-surface-2);
  border: var(--rule);
  border-right: none;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 13px;
  border-radius: 4px 0 0 4px;
  min-width: 0;
  outline: none;
  transition: border-color 0.2s ease;
}

.waitlist-form__input::placeholder { color: var(--fg-subtle); }
.waitlist-form__input:focus { border-color: rgba(255,255,255,0.35); }

.waitlist-form__btn {
  padding: 12px 24px;
  background: var(--cube-orange);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.waitlist-form__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.waitlist-form__btn:hover:not(:disabled) { background: #ff7a2e; }

.waitlist-form__error {
  margin-top: var(--space-1);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cube-red);
  letter-spacing: 0.04em;
}

.waitlist-form__success {
  margin-top: var(--space-4);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}

@media (max-width: 480px) {
  .waitlist-form {
    flex-direction: column;
    align-items: stretch;
  }
  .waitlist-form__input { border-right: var(--rule); border-radius: 4px 4px 0 0; }
  .waitlist-form__btn { border-radius: 0 0 4px 4px; }
}

/* --- PREFERS-REDCUED-MOTION --- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero__scroll-hint {
    animation: none;
  }

  .waitlist-form__btn {
    transition: none;
  }
}
