/* ════════════════════════════════════════════════════════════════
   POLYFLAKE — Award-Level Design System
   Shared across all pages. Refined, subtle, purposeful motion.
   Inspired by studiomeyer.io structure + awwwards motion craft.
═══════════════════════════════════════════════════════════════ */

:root {
  /* ── Palette (Santorini Blue + ink + gold) ── */
  --ink-950:#07172C; --ink-900:#0A1E36; --ink-800:#0F2845;
  --ink-700:#0F2040; --ink-600:#162D58;
  --steel-700:#0C68C9; --steel-600:#0E77D9; --steel-500:#2E8FE0;
  --steel-400:#5BAAEB; --steel-300:#93CBF5;
  --gold-600:#C28A0E; --gold-500:#F5B91E; --gold-400:#FFC940; --gold-300:#FFD970;
  --stone-100:#F8F7F4; --stone-200:#EEE9E0; --stone-300:#D6CFC2; --stone-400:#B0A898;

  /* ── Type scale ── */
  --fs-display: clamp(2.8rem, 7vw, 6rem);
  --fs-h2:      clamp(2rem, 4.2vw, 3.4rem);
  --fs-h3:      clamp(1.35rem, 2vw, 1.75rem);
  --fs-lead:    clamp(1.05rem, 1.4vw, 1.25rem);

  /* ── Motion tokens ── */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);          /* expressive ease-out */
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
  --dur: 1.4s;

  /* ── Layout ── */
  --maxw: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'D-DIN', system-ui, sans-serif;
  background: var(--ink-950);
  color: var(--stone-100);
  margin: 0;
  overflow-x: hidden;
}
::selection { background: var(--steel-600); color: #fff; }

/* ════════ PREMIUM GRAIN OVERLAY ════════
   Faint film grain across the whole viewport adds tactile depth to flat
   navy fills — a hallmark of high-end dark interfaces. Sits above page
   backgrounds, below all content, and never intercepts pointer events. */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-reduced-motion: reduce) { body::before { opacity: 0.025; } }

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--ink-900); }
::-webkit-scrollbar-thumb { background: var(--steel-700); border-radius: 99px; border: 2px solid var(--ink-900); }
::-webkit-scrollbar-thumb:hover { background: var(--steel-600); }

.display { font-family: 'D-DIN', sans-serif; font-weight: 700; line-height: 1.04; letter-spacing: 0.005em; text-transform: uppercase; }
.overline { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold-500); }

/* Editorial eyebrow — short rule + label. Reads like a print art-director's
   kicker rather than the generic centered "overline" template tag. */
.kicker { display: inline-flex; align-items: center; gap: 0.85rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold-500); }
.kicker::before { content: ''; width: 2.25rem; height: 1px; background: currentColor; opacity: 0.55; flex-shrink: 0; }
.kicker--center { justify-content: center; }

/* Hairline-divided editorial list (replaces boxed-icon feature cards) */
.feature-row { display: grid; grid-template-columns: 1fr; gap: 0.6rem; padding: 2rem 0; border-top: 1px solid rgba(255,255,255,0.08); transition: border-color 0.4s var(--ease); }
.feature-row:last-child { border-bottom: 1px solid rgba(255,255,255,0.08); }
.feature-row:hover { border-top-color: rgba(245,185,30,0.4); }
.feature-row__idx { font-family: 'D-DIN Condensed', sans-serif; font-weight: 700; font-size: 0.95rem; color: var(--gold-500); letter-spacing: 0.05em; padding-top: 0.35rem; }
@media (min-width: 768px) { .feature-row { grid-template-columns: 3.5rem 18rem 1fr; align-items: baseline; gap: 2.5rem; } }
.container { max-width: var(--maxw); margin: 0 auto; padding-left: 1.5rem; padding-right: 1.5rem; }
@media (min-width: 1024px) { .container { padding-left: 2.5rem; padding-right: 2.5rem; } }

/* ════════ FULL-HEIGHT SECTIONS ════════
   Each section fills at least one screen; content is vertically centered.
   Sections taller than the viewport still grow naturally (nothing is clipped). */
.section-fill {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
/* On short viewports (landscape phones, small laptops) don't force a full
   screen if the content needs more room than the height allows. */
@media (max-height: 640px) {
  .section-fill { min-height: auto; }
}

/* ════════ FOCUS STATES (keyboard accessibility) ════════
   Visible focus ring for keyboard users on every interactive element.
   Gold ring reads clearly on the dark navy and light stone backgrounds. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 3px;
  border-radius: 2px;
}
/* Buttons already have a radius — keep the ring snug to their shape */
.btn-primary:focus-visible,
.btn-ghost:focus-visible { outline-offset: 2px; }
/* Don't show the ring on mouse click, only keyboard (browsers handle this,
   but suppress the legacy outline for non-keyboard focus) */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible) { outline: none; }

/* ════════ SCROLL PROGRESS ════════ */
#progress-bar {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--gold-500), var(--steel-400));
  z-index: 9999; transition: width 0.1s linear;
}

/* ════════ NAV ════════ */
#navbar {
  position: fixed; top: 2px; left: 0; right: 0; z-index: 500;
  transition: background 0.5s var(--ease), box-shadow 0.5s var(--ease), padding 0.4s var(--ease);
}
#navbar.scrolled {
  background: rgba(7, 23, 44, 0.82);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}
.nav-link {
  position: relative; color: rgba(248,247,244,0.72); font-size: 0.875rem;
  font-weight: 500; transition: color 0.25s var(--ease); padding-bottom: 3px; text-decoration: none;
}
.nav-link::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1.5px;
  background: var(--gold-500); transform: scaleX(0); transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.nav-link:hover { color: var(--stone-100); }
/* Mobile menu button — guarantee a 44×44px touch target (Apple HIG / Material) */
#burger { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }

/* ════════ BUTTONS ════════ */
.btn-primary {
  position: relative; display: inline-flex; align-items: center; gap: 0.55rem;
  background: var(--steel-600); color: #FFFFFF;
  font-weight: 700; font-size: 0.875rem; letter-spacing: 0.02em;
  padding: 0.95rem 1.85rem; border-radius: 2px; text-decoration: none;
  overflow: hidden; isolation: isolate;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.btn-primary::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: var(--steel-500); transform: translateY(101%);
  transition: transform 0.4s var(--ease);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -10px rgba(14,119,217,0.55); }
.btn-primary:hover::before { transform: translateY(0); }
.btn-primary i, .btn-primary svg { transition: transform 0.3s var(--ease); }
.btn-primary:hover i, .btn-primary:hover svg { transform: translateX(3px); }

.btn-ghost {
  position: relative; display: inline-flex; align-items: center; gap: 0.55rem;
  border: 1px solid rgba(248,247,244,0.25); color: var(--stone-100);
  font-weight: 600; font-size: 0.875rem; text-decoration: none;
  padding: 0.95rem 1.85rem; border-radius: 2px; overflow: hidden; isolation: isolate;
  transition: color 0.35s var(--ease), border-color 0.35s var(--ease), transform 0.3s var(--ease);
}
.btn-ghost::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: rgba(248,247,244,0.08); transform: scaleX(0); transform-origin: left;
  transition: transform 0.4s var(--ease);
}
.btn-ghost:hover { border-color: rgba(248,247,244,0.6); transform: translateY(-2px); }
.btn-ghost:hover::before { transform: scaleX(1); }

/* Magnetic wrapper (JS adds translate) */
.magnetic { display: inline-block; will-change: transform; }

/* ════════ REVEAL ANIMATIONS ════════ */
[data-reveal] {
  opacity: 0; transform: translateY(48px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  will-change: opacity, transform;
}
[data-reveal="fade"]   { transform: none; }
[data-reveal="left"]   { transform: translateX(-52px); }
[data-reveal="right"]  { transform: translateX(52px); }
[data-reveal="scale"]  { transform: scale(0.9); }
[data-reveal].is-visible { opacity: 1; transform: none; }

/* Stagger children: parent gets data-stagger, children animate sequentially */
[data-stagger] > * {
  opacity: 0; transform: translateY(40px);
  transition: opacity 1.2s var(--ease), transform 1.2s var(--ease);
}
[data-stagger].is-visible > * { opacity: 1; transform: none; }

/* Line-by-line headline reveal */
.reveal-line { display: block; overflow: hidden; }
.reveal-line > span {
  display: block; transform: translateY(110%);
  transition: transform 1.5s var(--ease);
}
.is-visible .reveal-line > span, .reveal-line.is-visible > span { transform: translateY(0); }

/* ════════ CUSTOM CURSOR ════════ */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 10000;
  border-radius: 50%; transform: translate(-50%, -50%); mix-blend-mode: difference;
}
.cursor-dot { width: 6px; height: 6px; background: var(--gold-400); transition: opacity 0.3s; }
.cursor-ring {
  width: 38px; height: 38px; border: 1px solid rgba(255,201,64,0.6);
  transition: width 0.3s var(--ease), height 0.3s var(--ease), background 0.3s var(--ease), opacity 0.3s;
}
.cursor-ring.is-hover { width: 64px; height: 64px; background: rgba(255,201,64,0.08); }
@media (hover: none), (pointer: coarse) { .cursor-dot, .cursor-ring { display: none; } }

/* ════════ SECTION NUMBER ════════ */
.section-num {
  font-family: 'D-DIN Condensed', sans-serif;
  font-size: clamp(5rem, 13vw, 12rem); font-weight: 700; line-height: 1;
  color: transparent; -webkit-text-stroke: 1px rgba(245,185,30,0.13);
  user-select: none; pointer-events: none;
}

/* Count-up data figures — tall condensed numerals, tabular so they don't jitter */
[data-count] { font-family: 'D-DIN Condensed', sans-serif; font-weight: 700; font-feature-settings: 'tnum' 1; letter-spacing: 0; }

/* ════════ CARDS ════════ */
.tilt-card {
  position: relative; overflow: hidden;
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
.tilt-card:hover { transform: translateY(-6px); box-shadow: 0 30px 60px -25px rgba(0,0,0,0.7); }
.zoom-img { transition: transform 0.8s var(--ease); will-change: transform; }
.tilt-card:hover .zoom-img, .group-zoom:hover .zoom-img { transform: scale(1.07); }

/* Image fade-in on load (prevents CLS flash) */
img { display: block; }

/* ════════ PRODUCT DETAIL — STICKY MEDIA PANEL ════════
   The image/stat column stays in view beside the spec text on desktop,
   filling the column and removing dead space. Single-column on mobile/tablet
   must NOT be sticky (transparent text would scroll over a pinned image). */
@media (min-width: 1024px) {
  .lg-sticky { position: sticky; top: 100px; align-self: start; }
}

/* ════════ MARQUEE ════════ */
.marquee-track { display: flex; gap: 3rem; animation: marquee 32s linear infinite; white-space: nowrap; width: max-content; }
.marquee-track:hover { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.7); } }

/* ════════ REDUCED MOTION ════════ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marquee-track { animation: none; }
  [data-reveal], [data-stagger] > *, .reveal-line > span { opacity: 1 !important; transform: none !important; transition: none !important; }
  .cursor-dot, .cursor-ring { display: none !important; }
}
