@import url("../fonts/fonts.css");

/* ==========================================================================
   Wicker — design tokens + reset
   ========================================================================== */

:root {
  /* Brand neutrals — navy page, navy-light raised surfaces, ink on paper */
  --white: #ffffff;
  --navy: #0A152A;
  --navy-light: #16243C;
  --ink: #0D1A32;
  --on-navy: #EDF2F8;
  --gray-900: #1A2A46;
  --gray-800: #22334F;
  --gray-700: #2E405E;
  --gray-500: #717B8E;
  --gray-400: #8E97A8;
  --gray-300: #B9C2D0;
  --silver: #c8cacd;
  --warm-gray: #e9e6e1;
  --paper: #F7FAFE;

  /* The one accent. Copper is a FILL colour (buttons, bars, dots); as text or
     thin lines it is too light, so use the contextual --c-accent instead. */
  --copper: #D97C50;
  --copper-light: #F0AD7F;      /* hover / pressed on navy */
  --copper-deep: #974A32;       /* pressed on paper */
  --copper-text-dark: #DC9A6C;  /* copper as text or hairline on navy */
  --copper-text-light: #A14E2B; /* copper as text or hairline on paper */

  /* Semantic */
  --ok: #7ee081;
  --warn: #f0c36d;
  --bad: #ff6b5e;

  --line: rgba(13, 26, 50, 0.14);
  --line-dark: rgba(255, 255, 255, 0.14);
  --line-dark-soft: rgba(255, 255, 255, 0.07);

  /* Type */
  --font-sans: "Bricolage Grotesque", system-ui, -apple-system, sans-serif;
  --font-serif: "Bricolage Grotesque", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Easing — lifted from the reference's motion vocabulary */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0.05, 0, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* Rhythm */
  --gutter: clamp(1.25rem, 4vw, 4rem);
  --section-pad: clamp(6rem, 14vh, 11rem);
  --container: 1600px;
  --measure: 62ch;
  --nav-h: 88px;
  --nav-h-compact: 64px;
  --radius: 2px;

  /* Current surface — flipped per-section by .is-paper */
  --c-bg: var(--navy);
  --c-ink: var(--on-navy);
  --c-mute: var(--gray-300);
  --c-line: var(--line-dark);
  --c-line-soft: var(--line-dark-soft);
  --c-accent: var(--copper-text-dark);
  --c-btn-hover: var(--copper-light);
  --c-btn-hover-fg: var(--navy);

  color-scheme: dark;
}

/* A light ("paper") surface. Sections opt in; everything inside inverts. */
.is-paper {
  --c-bg: var(--paper);
  --c-ink: var(--ink);
  --c-mute: var(--gray-500);
  --c-line: var(--line);
  --c-line-soft: rgba(13, 26, 50, 0.07);
  --c-accent: var(--copper-text-light);
  --c-btn-hover: var(--copper-deep);
  --c-btn-hover-fg: var(--paper);
  color-scheme: light;
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

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

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: auto; /* Lenis owns scrolling */
}

body {
  background: var(--navy);
  color: var(--on-navy);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
}

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

button { cursor: pointer; }

a {
  color: inherit;
  text-decoration: none;
}

ul, ol { list-style: none; }

table {
  border-collapse: collapse;
  border-spacing: 0;
}

::selection {
  background: var(--copper);
  color: var(--navy);
}

:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
  border-radius: 1px;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

.h-display {
  font-size: clamp(3.2rem, 12.5vw, 13rem);
  line-height: 0.86;
  letter-spacing: -0.045em;
  font-weight: 500;
}

/* Capped well below the hero: .h-xl is used inside .section-head, which only
   gives it ~55% of the container, so a 7rem cap ran to five lines. */
.h-xl {
  font-size: clamp(2.25rem, 5.4vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  font-weight: 500;
}

.h-lg {
  font-size: clamp(1.9rem, 3.9vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 500;
}

.h-md {
  font-size: clamp(1.5rem, 2.6vw, 2.25rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  font-weight: 500;
}

.h-sm {
  font-size: clamp(1.15rem, 1.6vw, 1.4rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 500;
}

.font-serif {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.02em;
}

.italic { font-style: italic; }

.font-mono { font-family: var(--font-mono); }

/* Inline code had no family set and fell back to the browser monospace; it takes the site mono. Size unchanged (inherits). */
code { font-family: var(--font-mono); }

.lead {
  font-size: clamp(1.05rem, 1.45vw, 1.3rem);
  line-height: 1.55;
  color: var(--c-mute);
  max-width: var(--measure);
  letter-spacing: -0.015em;
}

.body-sm {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--c-mute);
}

/* The small monospaced label that heads almost every section. */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-mute);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
  flex: none;
}

.eyebrow--dot::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--copper);
  opacity: 1;
}

.text-copper { color: var(--c-accent); }
.text-mute { color: var(--c-mute); }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.shell {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  position: relative;
  background: var(--c-bg);
  color: var(--c-ink);
  padding-block: var(--section-pad);
  overflow: clip;
}

.section--flush { padding-block: 0; }
.section--tight { padding-block: clamp(3.5rem, 7vh, 6rem); }

.rule {
  height: 1px;
  background: var(--c-line);
  border: 0;
  width: 100%;
}

.grid {
  display: grid;
  gap: clamp(1.5rem, 3vw, 3rem);
}

.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: end;
  margin-bottom: clamp(2.5rem, 6vw, 5rem);
}

.section-head__aside {
  padding-bottom: 0.4rem;
}

@media (max-width: 900px) {
  .section-head { grid-template-columns: 1fr; align-items: start; }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Buttons + links
   -------------------------------------------------------------------------- */

.btn {
  --btn-bg: var(--copper);
  --btn-fg: var(--navy);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 52px;
  padding-inline: 1.6rem;
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  isolation: isolate;
  overflow: hidden;
  background: var(--btn-bg);
  color: var(--btn-fg);
  transition: color 0.4s var(--ease-out), border-color 0.4s var(--ease-out);
  will-change: transform;
}

/* The wipe: a disc scales up from the bottom on hover. */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--c-btn-hover);
  transform: translateY(101%);
  transition: transform 0.55s var(--ease-out-expo);
}

.btn:hover::after,
.btn:focus-visible::after { transform: translateY(0); }

.btn:hover,
.btn:focus-visible { color: var(--c-btn-hover-fg); }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--c-ink);
  border: 1px solid var(--c-line);
}

.btn--ghost:hover { border-color: var(--c-accent); }

.btn__icon {
  width: 14px;
  height: 14px;
  flex: none;
  transition: transform 0.45s var(--ease-out-expo);
}

.btn:hover .btn__icon { transform: translateX(4px); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

/* Underline that draws in from the left. */
.link-underline {
  position: relative;
  display: inline-block;
  padding-bottom: 2px;
}

.link-underline::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease-out-expo);
}

.link-underline:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.link-arrow svg {
  width: 12px;
  height: 12px;
  transition: transform 0.45s var(--ease-out-expo);
}

.link-arrow:hover svg { transform: translateX(5px); }

/* --------------------------------------------------------------------------
   Small parts
   -------------------------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 30px;
  padding-inline: 0.85rem;
  border: 1px solid var(--c-line);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-mute);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--copper);
  flex: none;
}

.dot--live { animation: pulse 2.4s var(--ease-in-out) infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.8); }
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding-inline: 0.55rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.badge--get    { background: rgba(126, 224, 129, 0.14); color: #7ee081; }
.badge--post   { background: rgba(217, 124, 80, 0.16); color: var(--c-accent); }
.badge--patch  { background: rgba(240, 195, 109, 0.16); color: var(--warn); }
.badge--put    { background: rgba(160, 180, 255, 0.16); color: #a9baff; }
.badge--delete { background: rgba(255, 107, 94, 0.16); color: var(--bad); }

/* --------------------------------------------------------------------------
   Motion primitives
   -------------------------------------------------------------------------- */

/* Word/line masks. JS splits text into these; CSS holds the pre-state so
   nothing flashes un-animated before GSAP boots. */
.split-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.12em;
  margin-bottom: -0.12em;
}

.split-word {
  display: inline-block;
  white-space: pre;
}

.word-inner {
  display: inline-block;
  will-change: transform;
}

/* Generic reveal — the fallback for anything not split. */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
}

.no-js [data-reveal],
.motion-off [data-reveal] {
  opacity: 1 !important;
  transform: none !important;
}

.no-js .word-inner,
.motion-off .word-inner {
  transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .word-inner { transform: none !important; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Lenis */
html.lenis-smooth { scroll-behavior: auto !important; }
html.lenis-stopped { overflow: hidden; }

/* --------------------------------------------------------------------------
   Texture — a fine grain over the whole page, as on the reference
   -------------------------------------------------------------------------- */

.grain {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.028;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.visually-hidden {
  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;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10000;
  background: var(--copper);
  color: var(--navy);
  padding: 0.6rem 1rem;
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 500;
  transform: translateY(-200%);
  transition: transform 0.3s var(--ease-out);
}

.skip-link:focus { transform: translateY(0); }

.hide-on-touch { display: block; }
@media (hover: none), (pointer: coarse) {
  .hide-on-touch { display: none !important; }
}
