/* ==========================================================================
   HERHACK 2026 — base.css
   Tokens, reset, typography, layout shell, decorative layers, motion.
   ========================================================================== */

/* ------------------------------------------------------------- tokens --- */
:root {
  /* brand palette */
  --bg: #fff8f3;
  --ink: #17151a;
  --coral: #ff5a3d;
  --lavender: #a995ff;
  --pink: #f5b8d0;
  --lime: #c9f45a;
  --dark: #29262e;

  /* derived */
  --ink-70: #4a4550;
  --ink-55: #6b6572;
  --ink-35: #97909d;
  --cream: #fffdfb;
  --line: rgba(23, 21, 26, 0.11);
  --line-2: rgba(23, 21, 26, 0.2);
  --line-dark: rgba(255, 248, 243, 0.14);
  --line-dark-2: rgba(255, 248, 243, 0.26);

  /* accents mapped for reuse */
  --a-coral: var(--coral);
  --a-lavender: var(--lavender);
  --a-pink: var(--pink);
  --a-lime: var(--lime);
  --accent: var(--coral);

  /* type */
  --font-sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

  --fs-display: clamp(2.9rem, 10.6vw, 9.4rem);
  --fs-h2: clamp(2.35rem, 5.6vw, 4.9rem);
  --fs-h3: clamp(1.25rem, 2.1vw, 1.9rem);
  --fs-lead: clamp(1.05rem, 1rem + 0.5vw, 1.4rem);
  --fs-body: clamp(1rem, 0.96rem + 0.18vw, 1.1rem);
  --fs-mono: clamp(0.68rem, 0.62rem + 0.16vw, 0.78rem);

  /* rhythm */
  --space-section: clamp(72px, 8vw, 126px);
  --gutter: clamp(20px, 5vw, 56px);
  --maxw: 1280px;
  --nav-h: 68px;

  /* effects */
  --r-sm: 12px;
  --r-md: 20px;
  --r-lg: 30px;
  --r-pill: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 2px 10px rgba(23, 21, 26, 0.06);
  --shadow-md: 0 18px 44px -22px rgba(23, 21, 26, 0.35);
  --shadow-lg: 0 40px 90px -40px rgba(23, 21, 26, 0.45);
  --z-particles: 1;
  --z-content: 2;
  --z-dock: 90;
  --z-nav: 100;
  --z-menu: 200;
  --z-cursor: 900;
}

/* accent helper classes used across sections */
.is-coral { --accent: var(--coral); --tint: rgba(255, 90, 61, 0.1); }
.is-lavender { --accent: var(--lavender); --tint: rgba(169, 149, 255, 0.15); }
.is-pink { --accent: var(--pink); --tint: rgba(245, 184, 208, 0.26); }
.is-lime { --accent: var(--lime); --tint: rgba(201, 244, 90, 0.26); }

/* -------------------------------------------------------------- reset --- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 18px);
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.62;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

body,
.menu-open { overflow-x: hidden; }
html.menu-open, html.menu-open body { overflow: hidden; }

img, svg, canvas { display: block; max-width: 100%; }
svg { height: auto; }

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

p { text-wrap: pretty; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
ul, ol { list-style: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); }

::selection { background: var(--coral); color: #fff; }

/* ---------------------------------------------------------- a11y ------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: fixed;
  top: 10px; left: 50%;
  transform: translate(-50%, -180%);
  z-index: 999;
  background: var(--ink);
  color: var(--bg);
  padding: 12px 22px;
  border-radius: var(--r-pill);
  font: 600 0.82rem/1 var(--font-mono);
  letter-spacing: 0.06em;
  transition: transform 0.28s var(--ease);
}
.skip:focus { transform: translate(-50%, 0); }

:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
  border-radius: 6px;
}
.why :focus-visible,
.prizes :focus-visible,
.final :focus-visible,
.footer :focus-visible,
.menu :focus-visible,
.countdown :focus-visible { outline-color: var(--lime); }

#main { position: relative; z-index: var(--z-content); }

.noscript {
  max-width: 42rem;
  margin: 0 auto;
  padding: 22vh var(--gutter) 10vh;
}
.noscript h1 { font-size: clamp(2rem, 6vw, 3.4rem); margin-bottom: 20px; }
.noscript p { margin-bottom: 14px; color: var(--ink-70); }

/* ------------------------------------------------------ layout shell --- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  padding-block: var(--space-section);
}

.section[id] { scroll-margin-top: calc(var(--nav-h) + 12px); }

/* ---------------------------------------------------- section headers --- */
.shead { margin-bottom: clamp(38px, 5vw, 68px); }

.shead__title {
  font-size: var(--fs-h2);
  letter-spacing: -0.05em;
  text-transform: uppercase;
  line-height: 0.88;
}

.shead__sub {
  font-size: var(--fs-lead);
  color: var(--ink-70);
  max-width: 46ch;
  line-height: 1.5;
}

.shead--split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: end;
}
.shead--split .shead__sub { justify-self: end; padding-bottom: 0.6em; }
.shead__aside { display: grid; gap: 18px; justify-items: start; }

.shead--center {
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 20px;
}
.shead--center .shead__sub { margin-inline: auto; }

.sub-head {
  font-size: var(--fs-mono);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-55);
  font-weight: 500;
  margin-top: clamp(46px, 6vw, 78px);
  display: flex;
  align-items: center;
  gap: 14px;
}
.sub-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.accent-coral { color: var(--coral); }
.accent-lavender { color: var(--lavender); }
.accent-pink { color: var(--pink); }
.accent-lime { color: var(--lime); }

/* eyebrow / kicker */
.eyebrow,
.kicker {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink-55);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.eyebrow::before,
.kicker::before {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
  flex: none;
}
.eyebrow--light { color: rgba(255, 248, 243, 0.62); }
.shead--center .eyebrow::before { display: none; }

/* ------------------------------------------------- decorative layers --- */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.42;
  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'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.32'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.particles {
  position: fixed;
  inset: 0;
  z-index: var(--z-particles);
  pointer-events: none;
  opacity: 0.9;
}

/* custom cursor */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  border: 1.5px solid rgba(23, 21, 26, 0.42);
  border-radius: 50%;
  pointer-events: none;
  z-index: var(--z-cursor);
  opacity: 0;
  transition: opacity 0.3s var(--ease), width 0.35s var(--ease), height 0.35s var(--ease),
    margin 0.35s var(--ease), background-color 0.35s var(--ease), border-color 0.35s var(--ease);
  will-change: transform;
}
.cursor.is-on { opacity: 1; }
.cursor.is-hot {
  width: 62px; height: 62px;
  margin: -31px 0 0 -31px;
  background: rgba(255, 90, 61, 0.1);
  border-color: rgba(255, 90, 61, 0.6);
}
.cursor.is-press { width: 24px; height: 24px; margin: -12px 0 0 -12px; background: rgba(255, 90, 61, 0.28); }
.cursor__dot {
  position: absolute;
  top: 0; left: 0;
  width: 5px; height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: var(--coral);
  will-change: transform;
}
@media (pointer: coarse) { .cursor { display: none; } }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 140%);
  z-index: 950;
  background: var(--ink);
  color: var(--cream);
  padding: 14px 22px;
  border-radius: var(--r-pill);
  font: 500 0.78rem/1.3 var(--font-mono);
  letter-spacing: 0.05em;
  max-width: min(90vw, 30rem);
  text-align: center;
  transition: transform 0.45s var(--ease);
  box-shadow: var(--shadow-lg);
}
.toast.is-on { transform: translate(-50%, 0); }

/* ------------------------------------------------- floating micro labels */
.float-label {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.14em;
  font-weight: 500;
  white-space: nowrap;
  background: var(--cream);
  color: var(--ink);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-sm);
  animation: floaty var(--d, 16s) ease-in-out infinite;
  transform: translate3d(0, var(--py, 0px), 0);
}
.float-label::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.float-label.is-lime { background: #f4ffdc; border-color: rgba(105, 145, 20, 0.28); }
.float-label.is-pink { background: #fff0f6; }
.float-label.is-lavender { background: #f5f2ff; }
.float-label.is-coral { background: #fff0eb; }

@keyframes floaty {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -14px; }
}

/* pulse dot */
.pulse-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 0 rgba(201, 244, 90, 0.7);
  animation: pulse 2.4s var(--ease) infinite;
  flex: none;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(201, 244, 90, 0.65); }
  70% { box-shadow: 0 0 0 10px rgba(201, 244, 90, 0); }
  100% { box-shadow: 0 0 0 0 rgba(201, 244, 90, 0); }
}

/* ---------------------------------------------------------- reveals ----- */
.reveal {
  opacity: 0;
  transform: translate3d(0, calc(26px + var(--py, 0px)), 0);
  transition: opacity 0.95s var(--ease-out), transform 0.95s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 80ms);
}
.reveal.is-in { opacity: 1; transform: translate3d(0, var(--py, 0px), 0); }

/* items that stagger on scroll */
.is-in[data-parallax] { transform: translate3d(0, var(--py, 0px), 0); }

/* ------------------------------------------------------- media queries -- */
@media (max-width: 900px) {
  .shead--split { grid-template-columns: 1fr; align-items: start; gap: 20px; }
  .shead--split .shead__sub { justify-self: start; padding-bottom: 0; }
}

@media (max-width: 560px) {
  :root { --nav-h: 60px; }
}

/* keep the sticky mobile dock from covering the end of the page */
@media (max-width: 860px) {
  body { padding-bottom: 84px; }
}

/* ------------------------------------------------- reduced motion ------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .particles { display: none; }
  .cursor { display: none; }
  .float-label { animation: none; }
}