/* ============================================================
   base.css — Tidewater design system
   Ocean palette · Fraunces + Manrope · playful rounded corners
   ============================================================ */

/* --- Design tokens --------------------------------------------------- */
:root {
  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;
  --space-11: 96px;

  /* Radius — generous + playful */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 32px;
  --radius-2xl: 40px;
  --radius-pill: 9999px;

  /* Typography */
  --font-display: 'Fraunces', 'IBM Plex Serif', Georgia, serif;
  --font-body:    'Manrope', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;

  --t-display-xl: clamp(42px, 6.2vw, 68px);
  --t-display-lg: clamp(28px, 4vw, 40px);
  --t-display-md: 22px;
  --t-lead:       20px;
  --t-body-lg:    17px;
  --t-body:       15px;
  --t-meta:       14px;
  --t-micro:      12px;

  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;
  --fw-black:   800;

  /* Motion */
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-entrance: cubic-bezier(0, 0, 0.2, 1);
  --ease-exit:     cubic-bezier(0.4, 0, 1, 1);
  --ease-tide:     cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 150ms;
  --dur-med:  240ms;
  --dur-slow: 460ms;
}

/* --- Light theme (Tidewater) ----------------------------------------- */
[data-theme="light"],
:root {
  --bg:            #F0F7FB;
  --bg-grad-1:     #E4F1F8;
  --bg-grad-2:     #F7FBFD;
  --surface:       #FFFFFF;
  --surface-2:     #E8F2F8;
  --surface-3:     #D3E6F0;
  --border:        #D6E6EE;
  --border-strong: #A7C5D6;

  --text:          #0C2432;
  --text-dim:      #375469;
  --text-muted:    #5F7E93;

  --primary:       #0B6E8C;   /* deep sea */
  --primary-hover: #085570;
  --primary-ink:   #07394A;
  --primary-tint:  #DCEEF5;

  --accent:        #2AA5C7;   /* turquoise wave */
  --accent-tint:   #CDEAF4;
  --accent-deep:   #1A7FA0;

  --cta:           #FF7A59;   /* warm coral */
  --cta-hover:     #F0603C;
  --cta-ink:       #FFFFFF;

  --success:       #1F9A74;
  --success-tint:  #D4F1E5;
  --warn:          #E88B2A;
  --warn-tint:     #FCE9CC;
  --info:          #2D7CB5;
  --info-tint:     #D6E7F4;
  --accent-plum:       #6B4E9B;
  --accent-plum-tint:  #E8DFF3;

  --focus:   #FF7A59;

  --shadow-sm: 0 1px 2px rgba(11, 42, 60, 0.06),
               0 1px 1px rgba(11, 42, 60, 0.04);
  --shadow-md: 0 6px 18px rgba(11, 42, 60, 0.08),
               0 2px 6px rgba(11, 42, 60, 0.04);
  --shadow-lg: 0 22px 50px rgba(11, 42, 60, 0.14),
               0 6px 18px rgba(11, 42, 60, 0.08);
  --shadow-xl: 0 40px 80px rgba(11, 42, 60, 0.18),
               0 10px 26px rgba(11, 42, 60, 0.10);

  --ring-primary: 0 0 0 4px rgba(42, 165, 199, 0.22);

  --pinned-bg: rgba(240, 247, 251, 0.88);
}

/* --- Dark theme (Abyssal) ------------------------------------------- */
[data-theme="dark"] {
  --bg:            #07151E;
  --bg-grad-1:     #0B1F2C;
  --bg-grad-2:     #071521;
  --surface:       #0F2230;
  --surface-2:     #162E3F;
  --surface-3:     #1E3C52;
  --border:        #1E3C52;
  --border-strong: #2F5973;

  --text:          #EAF4FA;
  --text-dim:      #B3CAD8;
  --text-muted:    #7F9DAF;

  --primary:       #4FC6E3;
  --primary-hover: #74D5EB;
  --primary-ink:   #04232E;
  --primary-tint:  rgba(79, 198, 227, 0.14);

  --accent:        #6FD6E8;
  --accent-tint:   rgba(111, 214, 232, 0.14);
  --accent-deep:   #A8E6F2;

  --cta:           #FF8C6B;
  --cta-hover:     #FFA689;
  --cta-ink:       #1C0904;

  --success:       #5BD6A3;
  --success-tint:  rgba(91, 214, 163, 0.18);
  --warn:          #F2B454;
  --warn-tint:     rgba(242, 180, 84, 0.18);
  --info:          #82B9EC;
  --info-tint:     rgba(130, 185, 236, 0.18);
  --accent-plum:      #B99DDB;
  --accent-plum-tint: rgba(185, 157, 219, 0.18);

  --focus: #FF8C6B;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.40), 0 1px 2px rgba(0,0,0,0.22);
  --shadow-md: 0 6px 20px rgba(0,0,0,0.55), 0 2px 6px rgba(0,0,0,0.30);
  --shadow-lg: 0 22px 54px rgba(0,0,0,0.65), 0 6px 18px rgba(0,0,0,0.40);
  --shadow-xl: 0 40px 90px rgba(0,0,0,0.75), 0 10px 30px rgba(0,0,0,0.45);

  --ring-primary: 0 0 0 4px rgba(79, 198, 227, 0.24);

  --pinned-bg: rgba(7, 21, 30, 0.88);
}

/* --- High-contrast override ----------------------------------------- */
@media (prefers-contrast: more) {
  :root,
  [data-theme="light"] {
    --border: #7A99AB;
    --text-dim: #0C2432;
    --text-muted: #21465C;
  }
  [data-theme="dark"] {
    --border: #6B8FA5;
    --text-dim: #EAF4FA;
    --text-muted: #D1E0EA;
  }
}

/* --- Theme transition ----------------------------------------------- */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition:
    background-color var(--dur-slow) var(--ease-standard),
    color            var(--dur-med)  var(--ease-standard),
    border-color     var(--dur-slow) var(--ease-standard),
    box-shadow       var(--dur-slow) var(--ease-standard) !important;
}

/* --- Keyframes ------------------------------------------------------ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes tideFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

@keyframes ripple {
  0%   { transform: scale(0.6); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* --- Reduced motion -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Reset ----------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-weight: var(--fw-regular);
  font-size: var(--t-body-lg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  background:
    radial-gradient(1200px 700px at 88% -10%, var(--accent-tint) 0%, transparent 55%),
    radial-gradient(900px 600px at 8% 0%, var(--primary-tint) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-grad-1) 0%, var(--bg) 38%, var(--bg-grad-2) 100%);
  background-attachment: fixed;
}

/* --- Skip link ------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 9999;
  background: var(--cta);
  color: var(--cta-ink);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: var(--t-meta);
  font-weight: var(--fw-semi);
  text-decoration: none;
  transition: top var(--dur-med) var(--ease-standard);
}

.skip-link:focus { top: var(--space-4); }

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

/* --- Links ---------------------------------------------------------- */
a {
  color: var(--primary);
  text-decoration: none;
}
a:hover { color: var(--primary-hover); }

/* --- Lists ---------------------------------------------------------- */
ul, ol { list-style: none; }

/* --- Buttons -------------------------------------------------------- */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  line-height: 1.2;
}

/* --- Inputs --------------------------------------------------------- */
input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
}

/* --- Focus ring ----------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 8px;
  transition: none;
}

/* --- Images --------------------------------------------------------- */
img, svg { display: block; max-width: 100%; }

/* --- Utility -------------------------------------------------------- */
.hidden { display: none !important; }
