/* ==========================================================================
   Readyfi — Design System
   --------------------------------------------------------------------------
   Tailwind (via Play CDN) handles most layout utilities. This file holds the
   things Tailwind-CDN can't do cleanly: design tokens, the hero atmosphere,
   motion, focus styling, and accessibility helpers.

   You normally won't need to edit this file to change COPY — copy lives in the
   HTML pages and in assets/components.js. Edit this only to retune the look.
   ========================================================================== */

/* ----------------------------------------------------------------------------
   1. Design tokens
   Brand palette: a deep, confident slate base + one calm blue accent, with a
   restrained teal used only for subtle gradient depth. WCAG-AA conscious.
---------------------------------------------------------------------------- */
:root {
  /* Brand */
  --sr-ink:        #0b1220;   /* deep slate — dark sections, footer            */
  --sr-ink-soft:   #111a2e;   /* slightly lifted slate                          */
  --sr-accent:     #2563eb;   /* primary blue — CTAs, links (AA on white)       */
  --sr-accent-700: #1d4ed8;   /* hover blue                                     */
  --sr-accent-600: #2563eb;
  --sr-teal:       #0d9488;   /* secondary — used sparingly for gradient depth  */
  --sr-cyan:       #06b6d4;

  /* Neutrals */
  --sr-bg:         #ffffff;
  --sr-bg-tint:    #f6f8fc;   /* alternating section wash                       */
  --sr-line:       #e7ecf3;   /* hairline borders                               */
  --sr-text:       #0f172a;   /* slate-900 body                                 */
  --sr-text-muted: #475569;   /* slate-600 supporting text                      */

  /* Effects */
  --sr-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --sr-shadow-md: 0 4px 12px rgba(15, 23, 42, .06), 0 12px 28px rgba(15, 23, 42, .07);
  --sr-shadow-lg: 0 10px 30px rgba(15, 23, 42, .08), 0 30px 60px rgba(15, 23, 42, .10);
  --sr-ring:      0 0 0 3px rgba(37, 99, 235, .35);

  --sr-radius:    1rem;       /* rounded-2xl-ish                                */
  --sr-header-h:  4.25rem;    /* sticky header height (anchor offset)           */
}

/* Dark theme overrides (toggle adds .dark to <html>) ------------------------ */
.dark {
  --sr-bg:         #0b1220;
  --sr-bg-tint:    #0e1729;
  --sr-line:       #1e293b;
  --sr-text:       #e6edf6;
  --sr-text-muted: #93a3b8;
  --sr-shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --sr-shadow-md: 0 8px 24px rgba(0, 0, 0, .45);
  --sr-shadow-lg: 0 20px 50px rgba(0, 0, 0, .55);
}

/* ----------------------------------------------------------------------------
   2. Base
---------------------------------------------------------------------------- */
* { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--sr-bg);
  color: var(--sr-text);
  font-feature-settings: "cv11", "ss01";
  transition: background-color .3s ease, color .3s ease;
}

/* Display font for headings, Inter for everything else. */
.font-display {
  font-family: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  letter-spacing: -0.02em;
  font-weight: 600;
}

/* Offset in-page anchors so they don't hide under the sticky header. */
[id] { scroll-margin-top: calc(var(--sr-header-h) + 1.25rem); }

/* Selection */
::selection { background: rgba(37, 99, 235, .16); color: var(--sr-text); }

/* ----------------------------------------------------------------------------
   3. Accessibility helpers
---------------------------------------------------------------------------- */
/* Skip link — visible on keyboard focus only. */
.skip-link {
  position: absolute;
  left: 1rem; top: -100px;
  z-index: 100;
  padding: .6rem 1rem;
  border-radius: .6rem;
  background: var(--sr-accent);
  color: #fff;
  font-weight: 600;
  transition: top .2s ease;
}
.skip-link:focus { top: 1rem; }

/* A single, consistent, visible focus ring for keyboard users. */
:focus-visible {
  outline: none;
  box-shadow: var(--sr-ring);
  border-radius: .4rem;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ----------------------------------------------------------------------------
   4. Hero atmosphere — a calm gradient mesh + fine grid, no clichés.
   Pure CSS, no images.
---------------------------------------------------------------------------- */
.sr-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--sr-bg);
}
/* soft blurred colour fields */
.sr-hero::before {
  content: "";
  position: absolute; inset: -20% -10% auto -10%;
  height: 140%;
  z-index: -2;
  background:
    radial-gradient(48rem 30rem at 78% -8%, rgba(13, 148, 136, .14), transparent 60%),
    radial-gradient(52rem 34rem at 8% 0%, rgba(37, 99, 235, .18), transparent 58%),
    radial-gradient(40rem 28rem at 60% 120%, rgba(6, 182, 212, .10), transparent 60%);
  filter: saturate(115%);
}
.dark .sr-hero::before {
  background:
    radial-gradient(48rem 30rem at 78% -8%, rgba(13, 148, 136, .22), transparent 60%),
    radial-gradient(52rem 34rem at 8% 0%, rgba(37, 99, 235, .30), transparent 58%),
    radial-gradient(40rem 28rem at 60% 120%, rgba(6, 182, 212, .16), transparent 60%);
}
/* fine grid, faded out toward the edges with a radial mask */
.sr-hero::after {
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, .045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, .045) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(80% 60% at 50% 30%, #000 30%, transparent 78%);
          mask-image: radial-gradient(80% 60% at 50% 30%, #000 30%, transparent 78%);
}
.dark .sr-hero::after {
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, .08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, .08) 1px, transparent 1px);
}

/* A reusable faint dot texture for dark bands (CTA / footer top). */
.sr-dot-texture {
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.5px);
  background-size: 22px 22px;
}

/* ----------------------------------------------------------------------------
   5. Components that benefit from a little custom polish
---------------------------------------------------------------------------- */

/* Eyebrow / kicker label */
.sr-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .8rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--sr-accent);
}
.sr-eyebrow::before {
  content: ""; width: 1.5rem; height: 1px;
  background: currentColor; opacity: .5;
}

/* Cards: soft, lifted, with a hairline that warms to the accent on hover. */
.sr-card {
  background: var(--sr-bg);
  border: 1px solid var(--sr-line);
  border-radius: var(--sr-radius);
  box-shadow: var(--sr-shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.sr-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--sr-shadow-md);
  border-color: rgba(37, 99, 235, .35);
}

/* Icon chip */
.sr-iconchip {
  display: inline-grid; place-items: center;
  width: 3rem; height: 3rem;
  border-radius: .85rem;
  color: var(--sr-accent);
  background: linear-gradient(180deg, rgba(37, 99, 235, .12), rgba(37, 99, 235, .06));
  border: 1px solid rgba(37, 99, 235, .18);
}
.sr-iconchip.is-teal {
  color: var(--sr-teal);
  background: linear-gradient(180deg, rgba(13, 148, 136, .14), rgba(13, 148, 136, .06));
  border-color: rgba(13, 148, 136, .2);
}
.sr-iconchip svg { width: 1.4rem; height: 1.4rem; }

/* Buttons */
.sr-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-weight: 600; line-height: 1; white-space: nowrap;
  border-radius: .7rem;
  padding: .8rem 1.15rem;
  transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease, border-color .2s ease;
}
.sr-btn:active { transform: translateY(1px); }
.sr-btn-primary {
  background: var(--sr-accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .25), 0 8px 20px rgba(37, 99, 235, .22);
}
.sr-btn-primary:hover { background: var(--sr-accent-700); box-shadow: 0 2px 4px rgba(37, 99, 235, .3), 0 12px 26px rgba(37, 99, 235, .3); }
.sr-btn-ghost {
  background: transparent;
  color: var(--sr-text);
  border: 1px solid var(--sr-line);
}
.sr-btn-ghost:hover { border-color: rgba(37, 99, 235, .4); color: var(--sr-accent); }
.sr-btn-light {
  background: #fff; color: var(--sr-ink);
}
.sr-btn-light:hover { background: #eef2f9; }

/* Links inside prose / nav underline animation */
.sr-link {
  color: var(--sr-accent); font-weight: 600;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 2px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size .25s ease;
  padding-bottom: 2px;
}
.sr-link:hover { background-size: 100% 2px; }

/* Numbered process connector line */
.sr-step-num {
  display: inline-grid; place-items: center;
  width: 2.75rem; height: 2.75rem; flex: none;
  border-radius: 999px;
  font-weight: 700; font-size: 1.05rem;
  color: #fff;
  background: linear-gradient(180deg, var(--sr-accent), var(--sr-accent-700));
  box-shadow: 0 6px 16px rgba(37, 99, 235, .35);
}

/* FAQ accordion */
.sr-faq-item { border-bottom: 1px solid var(--sr-line); }
.sr-faq-trigger {
  width: 100%; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: 1.35rem 0;
  font-weight: 600; font-size: 1.05rem; color: var(--sr-text);
}
.sr-faq-icon { transition: transform .3s ease; color: var(--sr-text-muted); flex: none; }
.sr-faq-trigger[aria-expanded="true"] .sr-faq-icon { transform: rotate(45deg); color: var(--sr-accent); }
.sr-faq-panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height .35s ease, opacity .3s ease, padding .35s ease;
  opacity: 0;
  color: var(--sr-text-muted);
  line-height: 1.7;
}
.sr-faq-panel.is-open { padding-bottom: 1.4rem; opacity: 1; }

/* Header scroll state */
#site-header .sr-headerbar {
  transition: background-color .3s ease, border-color .3s ease, box-shadow .3s ease, backdrop-filter .3s ease;
}
#site-header[data-scrolled="true"] .sr-headerbar {
  background-color: color-mix(in srgb, var(--sr-bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
          backdrop-filter: saturate(180%) blur(12px);
  border-color: var(--sr-line);
  box-shadow: var(--sr-shadow-sm);
}

/* ----------------------------------------------------------------------------
   6. Motion — orchestrated, restrained, and reduced-motion safe.
---------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s cubic-bezier(.16,.84,.44,1), transform .7s cubic-bezier(.16,.84,.44,1);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* Hero load-in stagger */
.hero-rise { opacity: 0; transform: translateY(16px); animation: heroRise .8s cubic-bezier(.16,.84,.44,1) forwards; }
.hero-rise.d1 { animation-delay: .05s; }
.hero-rise.d2 { animation-delay: .15s; }
.hero-rise.d3 { animation-delay: .25s; }
.hero-rise.d4 { animation-delay: .35s; }
.hero-rise.d5 { animation-delay: .45s; }
@keyframes heroRise { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .hero-rise { opacity: 1 !important; transform: none !important; animation: none !important; transition: none !important; }
  .sr-card:hover { transform: none; }
}

/* ----------------------------------------------------------------------------
   7. Long-form prose (Resources articles, About body)
---------------------------------------------------------------------------- */
.sr-prose { color: var(--sr-text-muted); line-height: 1.75; font-size: 1.05rem; }
.sr-prose h2 { color: var(--sr-text); font-size: 1.6rem; margin: 2.2rem 0 .8rem; }
.sr-prose h3 { color: var(--sr-text); font-size: 1.2rem; margin: 1.8rem 0 .6rem; }
.sr-prose p { margin: 0 0 1.1rem; }
.sr-prose ul { margin: 0 0 1.1rem; padding-left: 1.2rem; }
.sr-prose li { margin: .4rem 0; }
.sr-prose a { color: var(--sr-accent); font-weight: 600; }
.sr-prose strong { color: var(--sr-text); }
