/* ==========================================================================
   Kodiyo — base.css
   Design tokens, font loading, reset and base typography.
   Everything visual is defined here once and reused everywhere.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts
   Caviar Dreams is self-hosted (not on Google Fonts). Only the three cuts we
   actually use are loaded: Regular, Italic (hero "fast"), Bold (rare accents).
   League Spartan (300 Light / 400 Regular) is loaded from Google in the <head>.
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Caviar Dreams';
  src: url('../assets/fonts/CaviarDreams-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Caviar Dreams';
  src: url('../assets/fonts/CaviarDreams-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Caviar Dreams';
  src: url('../assets/fonts/CaviarDreams-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   2. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Colour ---------------------------------------------------------------- */
  --color-bg:            #1E1E1E;
  --color-fg:            #FFFFFF;
  --color-muted:         rgba(255, 255, 255, 0.70);
  --color-faint:         rgba(255, 255, 255, 0.45);
  --color-line:          rgba(255, 255, 255, 0.18);
  --color-line-strong:   rgba(255, 255, 255, 0.38);
  --color-surface:       #252525;
  --color-surface-2:     #2C2C2C;
  --color-header-bg:     rgba(30, 30, 30, 0.85);
  --color-on-accent:     #1E1E1E;

  /* Type families --------------------------------------------------------- */
  --font-heading: 'Caviar Dreams', 'Century Gothic', 'Questrial', ui-rounded, sans-serif;
  --font-sub:     'League Spartan', 'Helvetica Neue', Arial, sans-serif;
  --font-body:    'League Spartan', 'Helvetica Neue', Arial, sans-serif;

  --weight-body: 300;   /* League Spartan Light   */
  --weight-sub:  400;   /* League Spartan Regular */
  --weight-mid:  500;   /* League Spartan Medium  */

  /* Type scale — fluid, so every size is responsive by construction ------- */
  /* Capped at 4.5rem: the container stops growing at 1240px, so past that the
     copy column is fixed. The cap keeps "Beautiful Emails," on one line AND
     leaves a comfortable gutter between the headline and the card stack. */
  --fs-display: clamp(2.5rem, 4.2vw + 0.9vh, 4.5rem);
  --fs-h1:      clamp(2.25rem, 5.2vw, 3.75rem);
  --fs-h2:      clamp(1.875rem, 4.4vw, 3.25rem);
  --fs-h3:      clamp(1.25rem, 1.9vw, 1.5rem);
  --fs-lead:    clamp(1.0625rem, 1.5vw, 1.375rem);
  --fs-body:    clamp(1rem, 1.1vw, 1.0625rem);
  --fs-sm:      0.9375rem;
  --fs-xs:      0.8125rem;

  --lh-tight:  1.08;
  --lh-snug:   1.25;
  --lh-normal: 1.6;

  --tracking-tight: -0.015em;
  --tracking-wide:  0.08em;
  --tracking-wider: 0.14em;

  /* Spacing scale — use these, never one-off pixel values ------------------ */
  --space-3xs: 0.25rem;   /*  4 */
  --space-2xs: 0.5rem;    /*  8 */
  --space-xs:  0.75rem;   /* 12 */
  --space-sm:  1rem;      /* 16 */
  --space-md:  1.5rem;    /* 24 */
  --space-lg:  2rem;      /* 32 */
  --space-xl:  3rem;      /* 48 */
  --space-2xl: 4rem;      /* 64 */
  --space-3xl: 6rem;      /* 96 */
  --space-4xl: 8rem;      /* 128 */

  /* Vertical rhythm for full-bleed sections */
  --section-py: clamp(4.5rem, 9vw, 8.5rem);

  /* Layout ---------------------------------------------------------------- */
  --container-max: 1240px;
  --container-pad: clamp(1.25rem, 5vw, 4rem);
  --header-h: 84px;

  /* Extra indent for the big two-column copy blocks (hero, personalization),
     so they sit inboard of the logo's alignment line rather than on it. */
  --content-inset: clamp(0rem, 3vw, 3.25rem);

  /* Form / component shape ------------------------------------------------ */
  --radius-btn:   10px;
  --radius-input: 10px;
  --radius-card:  16px;
  --radius-quote: 28px;

  --border-hairline: 1px;
  --border-cta: 1.5px;

  /* Motion ---------------------------------------------------------------- */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 180ms;
  --dur-mid: 320ms;
  --dur-slow: 620ms;

  --z-header: 100;
  --z-nav-panel: 90;
}

@media (max-width: 900px) {
  :root {
    --header-h: 68px;
  }
}

/* --------------------------------------------------------------------------
   3. Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-md));
}

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-body);
  font-weight: var(--weight-body);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ul, ol {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

img, picture, svg, video, iframe {
  display: block;
  max-width: 100%;
}

img, video {
  height: auto;
}

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

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

:focus-visible {
  outline: 2px solid var(--color-fg);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   4. Base typography
   Headings use Caviar Dreams; subheads League Spartan Regular;
   body copy League Spartan Light.
   -------------------------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 {
  font-size: var(--fs-h3);
  font-family: var(--font-sub);
  font-weight: var(--weight-sub);
  letter-spacing: 0;
  line-height: var(--lh-snug);
}

p {
  text-wrap: pretty;
}

strong, b {
  font-weight: var(--weight-sub);
}

em, i {
  font-style: italic;
}

/* --------------------------------------------------------------------------
   5. Shared utilities
   -------------------------------------------------------------------------- */

/* The one container every section uses. */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section {
  padding-block: var(--section-py);
}

/* Lead paragraph under a heading. */
.lead {
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--color-muted);
  max-width: 46ch;
}

.section__title {
  font-size: var(--fs-h2);
}

/* Small underlined text link — "Know More", "See free-sample terms". */
.text-link {
  display: inline-block;
  font-family: var(--font-sub);
  font-weight: var(--weight-sub);
  font-size: var(--fs-body);
  color: var(--color-fg);
  border-bottom: 1px solid var(--color-line-strong);
  padding-bottom: 2px;
  transition: border-color var(--dur-fast) var(--ease-out),
              opacity var(--dur-fast) var(--ease-out);
}

.text-link:hover {
  border-bottom-color: var(--color-fg);
}

/* The highlighter sweep used on "in under 3 hours".
   The ink is a real element rather than a pseudo-element so GSAP can animate
   its transform on the compositor. With no JS the ink is simply already
   drawn, so the highlight still reads as designed. */
.highlight {
  position: relative;
  display: inline-block;
  isolation: isolate;
  padding-inline: 0.18em;
  color: var(--color-on-accent);
  transition: color var(--dur-mid) var(--ease-out);
}

.highlight__ink {
  position: absolute;
  inset: -0.06em -0.02em -0.12em;
  z-index: 0;
  background-color: var(--color-fg);
  transform-origin: left center;
  pointer-events: none;
}

.highlight__text {
  position: relative;
  z-index: 1;
  font-weight: var(--weight-mid);
}

/* Once JS is in charge the text starts un-highlighted and the sweep lights it. */
.js .highlight {
  color: var(--color-fg);
}

.js .highlight.is-lit {
  color: var(--color-on-accent);
}

/* Screen-reader-only text. */
.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;
  border: 0;
}

/* Skip link. */
.skip-link {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 999;
  padding: var(--space-2xs) var(--space-sm);
  background: var(--color-fg);
  color: var(--color-on-accent);
  border-radius: var(--radius-btn);
  font-family: var(--font-sub);
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-out);
}

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

/* --------------------------------------------------------------------------
   6. Progressive enhancement hooks
   Elements that GSAP will animate in start hidden ONLY when JS is available,
   so a no-JS visitor still sees a complete page.
   -------------------------------------------------------------------------- */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  will-change: opacity, transform;
}

/* No JS: the highlighter ink is simply already drawn (see .highlight above,
   which defaults to the lit state). */

/* --------------------------------------------------------------------------
   7. Reduced motion
   Nothing here should ever trap or surprise a visitor who has asked for less.
   -------------------------------------------------------------------------- */
@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;
    scroll-behavior: auto !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }

  /* Highlighter holds its lit state rather than sweeping on a loop. */
  .js .highlight {
    color: var(--color-on-accent);
  }

  .highlight__ink {
    transform: scaleX(1) !important;
  }
}
