/**
 * ĀROHA DIGITAL CORE — Global Typography & 1px Grid System
 * main.css — Issue 3: Typography Lock-up + Grid System
 * Epic 1: The Design System (Core Identity Implementation)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700;900&family=JetBrains+Mono:wght@300;400;500&display=swap');
@import './tokens.css';

/* ─── Reset & Base ───────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  color: var(--color-pure-black);
  background-color: var(--color-blush-base);
  line-height: 1.5;
  cursor: none; /* Replaced by custom cursor */
  overflow-x: hidden;
}

/* ─── Selection ────────────────────────────────────────────────────────  */
::selection {
  background: var(--color-pure-black);
  color: var(--color-blush-base);
}

/* ─── Custom Scrollbar ─────────────────────────────────────────────────  */
::-webkit-scrollbar {
  width: 2px;
  height: 2px;
}
::-webkit-scrollbar-track {
  background: var(--color-blush-base);
}
::-webkit-scrollbar-thumb {
  background: var(--color-pure-black);
}

/* ─── Typography Lock-up ───────────────────────────────────────────────  */
/* Brand Mark — ĀROHA Wordmark */
.brand-mark {
  font-family: var(--font-primary);
  font-weight: 900;
  letter-spacing: var(--tracking-massive);
  text-transform: uppercase;
  mix-blend-mode: multiply;
  line-height: 0.85;
}

/* Product Names — KĀNTI / KEŚA / REŚA */
.product-name {
  font-family: var(--font-primary);
  font-weight: 400;
  letter-spacing: var(--tracking-elegant);
  text-transform: uppercase;
  mix-blend-mode: multiply;
}

/* Tech Labels — Monospace Spec Data */
.tech-label {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-tech);
  text-transform: uppercase;
  font-variant: small-caps;
  mix-blend-mode: multiply;
}

/* Section Heading */
.section-heading {
  font-family: var(--font-primary);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  line-height: 1;
}

/* Body Copy */
.body-copy {
  font-family: var(--font-primary);
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1.7;
}

/* Watermark Text — 0.03 opacity bg mark */
.watermark-text {
  font-family: var(--font-primary);
  font-weight: 900;
  font-size: var(--text-watermark);
  letter-spacing: -0.02em;
  text-transform: uppercase;
  opacity: var(--watermark-opacity);
  color: var(--color-pure-black);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  line-height: 0.8;
  position: absolute;
  z-index: var(--z-watermark);
}

/* ─── 1px Grid Divider System ──────────────────────────────────────────  */
/* Issue 3: 1px Grid dividers — Epic 2 */
.divider {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--color-pure-black);
  mix-blend-mode: multiply;
}

.divider--vertical {
  width: 1px;
  height: 100%;
  background: var(--color-pure-black);
  mix-blend-mode: multiply;
}

/* Animated draw-line effect */
.divider--draw {
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform var(--duration-slow) var(--ease-out-expo);
}
.divider--draw.is-visible {
  transform: scaleX(1);
}

/* ─── Grid Spec Table (Technical Data) ────────────────────────────────── */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  border-top: var(--border-thin);
}

.spec-table__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: var(--border-thin);
  padding: var(--space-4) 0;
}

.spec-table__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-tech);
  text-transform: uppercase;
  opacity: 0.5;
  mix-blend-mode: multiply;
}

.spec-table__value {
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: var(--text-sm);
  letter-spacing: 0.05em;
  mix-blend-mode: multiply;
}

/* ─── Tactile Grain Overlay (Global Film Layer) ───────────────────────── */
/* Issue 2: The Tactile Layer — Epic 1 */
#grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url('../assets/textures/natural-paper-grain.png');
  background-repeat: repeat;
  background-size: 256px 256px;
  mix-blend-mode: multiply;
  will-change: transform;
}

/* ─── Custom Cursor ────────────────────────────────────────────────────  */
#cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  background: var(--color-pure-black);
  border-radius: 50%;
  pointer-events: none;
  z-index: var(--z-cursor);
  transform: translate(-50%, -50%);
  transition: transform var(--duration-fast) var(--ease-out-expo),
              width var(--duration-fast) var(--ease-out-expo),
              height var(--duration-fast) var(--ease-out-expo);
  mix-blend-mode: difference;
}

#cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 40px;
  height: 40px;
  border: var(--border-thin);
  border-radius: 50%;
  pointer-events: none;
  z-index: var(--z-cursor);
  transform: translate(-50%, -50%);
  transition: transform 0.12s var(--ease-out-expo),
              width var(--duration-base) var(--ease-out-expo),
              height var(--duration-base) var(--ease-out-expo);
  mix-blend-mode: difference;
}

/* Cursor states */
body.cursor-hover #cursor {
  width: 4px;
  height: 4px;
}
body.cursor-hover #cursor-ring {
  width: 64px;
  height: 64px;
  border-color: var(--color-oil-gold);
}
body.cursor-drag #cursor-ring {
  width: 80px;
  height: 80px;
  border-radius: 4px;
}

/* ─── Navigation ────────────────────────────────────────────────────────  */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--content-padding);
  mix-blend-mode: multiply;
}

.nav__logo {
  font-family: var(--font-primary);
  font-weight: 900;
  font-size: var(--text-base);
  letter-spacing: var(--tracking-massive);
  text-transform: uppercase;
  color: var(--color-pure-black);
  text-decoration: none;
  mix-blend-mode: multiply;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  list-style: none;
}

.nav__link {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-tech);
  text-transform: uppercase;
  color: var(--color-pure-black);
  text-decoration: none;
  position: relative;
  mix-blend-mode: multiply;
  transition: opacity var(--duration-fast);
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-pure-black);
  transition: width var(--duration-base) var(--ease-out-expo);
}

.nav__link:hover::after,
.nav__link.active::after {
  width: 100%;
}

.nav__counter {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-tech);
  opacity: 0.4;
}

/* ─── Scroll Progress Bar ───────────────────────────────────────────────  */
#scroll-progress {
  position: fixed;
  bottom: 0;
  left: 0;
  height: 1px;
  width: 0%;
  background: var(--color-pure-black);
  z-index: var(--z-progress);
  transform-origin: left;
  transition: width 0.1s linear;
  mix-blend-mode: multiply;
}

/* ─── Hero Section ──────────────────────────────────────────────────────  */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--color-blush-base);
}

.hero__wordmark {
  font-family: var(--font-primary);
  font-weight: 900;
  font-size: clamp(4rem, 12vw, 11rem);
  letter-spacing: var(--tracking-massive);
  text-transform: uppercase;
  color: var(--color-pure-black);
  mix-blend-mode: multiply;
  line-height: 0.85;
  position: relative;
  z-index: var(--z-content);
  text-align: center;
  overflow: hidden;
}

.hero__wordmark-inner {
  display: block;
  transform: translateY(110%);
  /* Animated in via GSAP */
}

.hero__tagline {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-tech);
  text-transform: uppercase;
  opacity: 0.5;
  mix-blend-mode: multiply;
  position: absolute;
  bottom: var(--space-10);
  left: var(--content-padding);
}

.hero__scroll-cue {
  position: absolute;
  bottom: var(--space-10);
  right: var(--content-padding);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.hero__scroll-line {
  width: 1px;
  height: 48px;
  background: var(--color-pure-black);
  animation: scroll-pulse 2s var(--ease-in-out-quart) infinite;
  mix-blend-mode: multiply;
}

@keyframes scroll-pulse {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  51% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

.hero__meta {
  position: absolute;
  left: var(--content-padding);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  opacity: 0; /* animated in via GSAP */
}

.hero__meta-line {
  width: 1px;
  height: 80px;
  background: var(--color-pure-black);
  mix-blend-mode: multiply;
}

/* ─── Track Container (Horizontal Scroll) ─────────────────────────────── */
/* Epic 2: Issue 1 — Track Layout */
.track-wrapper {
  position: relative;
  overflow: hidden;
}

.track-container {
  display: flex;
  width: 300vw; /* 3 slides × 100vw */
  height: 100vh;
  will-change: transform;
}

.product-slide {
  position: relative;
  width: 100vw;
  height: 100vh;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  background: var(--color-blush-base);
  border-left: var(--border-thin);
}

.product-slide:first-child {
  border-left: none;
}

/* ─── Product Slide: Content Side ──────────────────────────────────────  */
.slide__content {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-20) var(--content-padding) var(--space-16);
  position: relative;
  z-index: var(--z-content);
}

.slide__number {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-tech);
  opacity: 0.4;
  margin-bottom: var(--space-6);
  mix-blend-mode: multiply;
}

.slide__name {
  font-family: var(--font-primary);
  font-weight: 900;
  font-size: clamp(3rem, 7vw, 6.5rem);
  letter-spacing: var(--tracking-elegant);
  text-transform: uppercase;
  color: var(--color-pure-black);
  mix-blend-mode: multiply;
  line-height: 0.9;
  margin-bottom: var(--space-8);
}

.slide__subtitle {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-tech);
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: var(--space-12);
  mix-blend-mode: multiply;
}

.slide__divider {
  width: 100%;
  height: 1px;
  background: var(--color-pure-black);
  mix-blend-mode: multiply;
  margin-bottom: var(--space-8);
}

.slide__specs {
  display: flex;
  flex-direction: column;
  gap: 0;
}

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

.slide__spec-key {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-tech);
  text-transform: uppercase;
  opacity: 0.45;
  mix-blend-mode: multiply;
}

.slide__spec-val {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: var(--text-sm);
  letter-spacing: 0.05em;
  mix-blend-mode: multiply;
}

.slide__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-10);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-tech);
  text-transform: uppercase;
  color: var(--color-pure-black);
  text-decoration: none;
  position: relative;
  mix-blend-mode: multiply;
  transition: gap var(--duration-base) var(--ease-out-expo);
}

.slide__cta::before {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: var(--color-pure-black);
  transition: width var(--duration-base) var(--ease-out-expo);
}

.slide__cta:hover {
  gap: var(--space-5);
}

.slide__cta:hover::before {
  width: 40px;
}

/* ─── Product Slide: Visual Side ────────────────────────────────────────  */
.slide__visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-left: var(--border-thin);
}

.slide__product-img {
  position: relative;
  z-index: var(--z-product);
  width: clamp(180px, 28vw, 380px);
  height: auto;
  object-fit: contain;
  will-change: transform;
  filter: drop-shadow(0 0 0 transparent);
  transition: filter var(--duration-slow) var(--ease-out-expo);
}

/* Refraction highlight on hover — Epic 3 */
.slide__visual:hover .slide__product-img {
  filter: drop-shadow(0 24px 60px rgba(0,0,0,0.18))
          drop-shadow(0 0 48px rgba(196, 97, 58, 0.12));
}

/* ─── Marquee Footer ─────────────────────────────────────────────────── */
/* Component: footer-marquee */
.marquee-track {
  position: relative;
  overflow: hidden;
  padding: var(--space-8) 0;
  border-top: var(--border-thin);
  background: var(--color-sage);
}

.marquee-inner {
  display: flex;
  gap: var(--space-16);
  white-space: nowrap;
  animation: marquee 30s linear infinite;
  width: max-content;
}

.marquee-inner:hover {
  animation-play-state: paused;
}

.marquee-item {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-tech);
  text-transform: uppercase;
  opacity: 0.7;
  flex-shrink: 0;
  mix-blend-mode: multiply;
}

.marquee-separator {
  width: 4px;
  height: 4px;
  background: var(--color-pure-black);
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
  opacity: 0.4;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ─── Science / Ingredient Grid ─────────────────────────────────────────  */
.science-section {
  padding: var(--space-32) var(--content-padding);
  border-top: var(--border-thin);
  position: relative;
  overflow: hidden;
}

.science-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: var(--space-16);
  padding-bottom: var(--space-8);
  border-bottom: var(--border-thin);
}

.science-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: var(--border-thin);
}

.science-column {
  padding: var(--space-10) var(--space-8);
  border-right: var(--border-thin);
}

.science-column:last-child {
  border-right: none;
}

.science-column__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-tech);
  text-transform: uppercase;
  opacity: 0.45;
  margin-bottom: var(--space-6);
  mix-blend-mode: multiply;
}

.science-column__heading {
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: var(--text-xl);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  margin-bottom: var(--space-8);
  mix-blend-mode: multiply;
}

/* Ingredient rows */
.ingredient-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4) 0;
  border-bottom: var(--border-muted);
}

.ingredient-index {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-tech);
  opacity: 0.3;
  width: 24px;
  mix-blend-mode: multiply;
}

.ingredient-name {
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: var(--text-sm);
  mix-blend-mode: multiply;
}

/* ─── Slide Indicator (Track Progress) ─────────────────────────────────  */
.track-indicator {
  position: fixed;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  z-index: var(--z-progress);
}

.track-dot {
  width: 24px;
  height: 1px;
  background: var(--color-pure-black);
  opacity: 0.25;
  transition: opacity var(--duration-base) var(--ease-out-expo),
              width var(--duration-base) var(--ease-out-expo);
  mix-blend-mode: multiply;
}

.track-dot.active {
  opacity: 1;
  width: 48px;
}

/* ─── Page Loader ────────────────────────────────────────────────────────  */
#page-loader {
  position: fixed;
  inset: 0;
  background: var(--color-blush-base);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-6);
}

.loader__brand {
  font-family: var(--font-primary);
  font-weight: 900;
  font-size: clamp(2rem, 5vw, 4rem);
  letter-spacing: var(--tracking-massive);
  text-transform: uppercase;
  color: var(--color-pure-black);
  mix-blend-mode: multiply;
  overflow: hidden;
}

.loader__line {
  width: 80px;
  height: 1px;
  background: var(--color-pure-black);
  transform-origin: left;
  transform: scaleX(0);
  mix-blend-mode: multiply;
}

.loader__counter {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-tech);
  opacity: 0.4;
  text-transform: uppercase;
  mix-blend-mode: multiply;
}

/* ─── Utility Classes ────────────────────────────────────────────────────  */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.no-scroll {
  overflow: hidden;
}

.overflow-clip {
  overflow: hidden;
}

/* ─── Responsive ────────────────────────────────────────────────────────  */
@media (max-width: 768px) {
  .product-slide {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .slide__visual {
    border-left: none;
    border-bottom: var(--border-thin);
    min-height: 50vh;
  }

  .slide__content {
    padding: var(--space-10) var(--space-6) var(--space-8);
  }

  .nav__links {
    display: none;
  }

  .track-container {
    flex-direction: column;
    width: 100vw;
    height: 300vh;
  }

  .product-slide {
    width: 100vw;
    height: 100vh;
  }
}

/* ─── Print ──────────────────────────────────────────────────────────────  */
@media print {
  #grain-overlay,
  #cursor,
  #cursor-ring,
  .marquee-track {
    display: none;
  }
}

/* ─── Reduced Motion ────────────────────────────────────────────────────  */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
