/* ==========================================================================
   Epic web system v1 — goepic.surf
   Built on the Epic app design system (SharedUI/Theme). Plain CSS, no JS.
   Themes: Epic Blue (default) · light · dark  →  data-theme on .ep
   Responsive: container queries on .ep (works at 360 px and up).
   ========================================================================== */

/* ---------- 1. Tokens ---------------------------------------------------- */
.ep {
  /* type */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Helvetica Neue", "Segoe UI", Roboto, sans-serif;

  /* ground (Epic Blue) */
  --bg-100: #002d56;
  --bg-gradient-1: #2182c9;
  --bg-gradient-2: #1466ad;
  --bg-gradient-3: #0054a3;
  --navy-1: #00385b;
  --navy-2: #002136;
  --today-1: #0f3968;
  --today-2: #386c99;
  --ground: radial-gradient(110% 70% at 20% 0%, var(--bg-gradient-2) 0%, var(--bg-gradient-3) 30%, var(--bg-100) 72%);

  /* ink: never a solid colour */
  --text-primary: rgba(255, 255, 255, 0.9);
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-tertiary: rgba(255, 255, 255, 0.5);
  --text-quaternary: rgba(255, 255, 255, 0.3);

  /* translucent layers */
  --inset-bg: rgba(0, 0, 0, 0.15);
  --inset-bg-alt: rgba(255, 255, 255, 0.15);
  --inset-bg-lighter: rgba(0, 0, 0, 0.1);
  --inset-bg-darker: rgba(0, 0, 0, 0.2);
  --tag-bg: rgba(255, 255, 255, 0.08);
  --now-bg: rgba(255, 255, 255, 0.1);
  --hairline: rgba(255, 255, 255, 0.12);
  --surface: rgba(0, 0, 0, 0.15);          /* web card = inset-bg */
  --surface-strong: rgba(0, 0, 0, 0.22);

  /* accent + condition scale (reserved for conditions) */
  --accent: #7ffe82;
  --ideal: #99e819;
  --scale-0: #00d5ff;
  --scale-1: #99e819;
  --scale-2: #e4e819;
  --scale-3: #e8ae19;
  --scale-4: #e85719;
  --tide-line: #00d5ff;
  --tide-fill: #19cfe8;
  --tide-low-glyph: #00d5ff;
  --logo-blue: #63adf5;
  --logo-green: #9efa91;

  /* web roles */
  --cta-bg: #7ffe82;            /* accent: 10.9:1 with bg-100 ink */
  --cta-ink: #002d56;
  --cta-ring: #7ffe82;
  --link: #7ffe82;
  --tag-good: #99e819;
  --tag-fair: #e4e819;
  --tag-poor: #e8ae19;

  /* spacing (app steps) + web layout steps */
  --space-2: 2px; --space-4: 4px; --space-6: 6px; --space-8: 8px;
  --space-10: 10px; --space-16: 16px; --space-20: 20px; --space-30: 30px;
  --space-48: 48px; --space-80: 80px; --space-120: 120px;
  --page-max: 1200px;
  --gutter: clamp(20px, 4cqi, 40px);
  --section-gap: clamp(64px, 9cqi, 120px);

  /* radius */
  --radius-xs: 3px; --radius-sm: 6px; --radius-md: 12px;
  --radius-lg: 20px; --radius-xl: 30px; --radius-capsule: 9999px;

  /* size + motion */
  --tap-target: 44px;
  --button-min-width: 240px;
  --dur: 1.618s;
  --ease-swell: cubic-bezier(.22, .9, .3, 1);

  container: page / inline-size;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-100) var(--ground) no-repeat;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 0;
}
.ep[data-theme="light"] {
  --bg-100: #e0ebed;
  --bg-gradient-1: #e0ebed;
  --bg-gradient-2: #e6ede3;
  --bg-gradient-3: #e6ede3;
  --ground: radial-gradient(110% 70% at 20% 0%, #e0ebed 0%, #e6ede3 70%);
  --text-primary: rgba(0, 0, 0, 0.9);
  --text-secondary: rgba(0, 0, 0, 0.7);
  --text-tertiary: rgba(0, 0, 0, 0.56);   /* web: 0.5 → 0.56 so labels pass 4.5:1 */
  --text-quaternary: rgba(0, 0, 0, 0.3);
  --inset-bg: rgba(255, 255, 255, 0.12);
  --inset-bg-alt: rgba(0, 0, 0, 0.08);
  --tag-bg: rgba(0, 0, 0, 0.1);
  --hairline: rgba(0, 0, 0, 0.09);
  --surface: rgba(255, 255, 255, 0.55);
  --surface-strong: rgba(255, 255, 255, 0.8);
  --accent: rgba(0, 0, 0, 0.9);
  --tide-low-glyph: #035088;
  --cta-bg: #002d56;
  --cta-ink: rgba(255, 255, 255, 0.95);
  --cta-ring: #002d56;
  --link: #0054a3;
}
.ep[data-theme="dark"] {
  --bg-100: #0f0f1f;
  --bg-gradient-1: #262626;
  --ground: radial-gradient(110% 70% at 20% 0%, #262626 0%, #0f0f1f 70%);
}

/* the app's own navy surface, used for device screens, widgets and share cards
   in every theme (widgets are always Epic Blue) */
.ep-blue {
  --text-primary: rgba(255, 255, 255, 0.9);
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-tertiary: rgba(255, 255, 255, 0.5);
  --inset-bg: rgba(0, 0, 0, 0.15);
  --inset-bg-alt: rgba(255, 255, 255, 0.15);
  --tag-bg: rgba(255, 255, 255, 0.08);
  --hairline: rgba(255, 255, 255, 0.12);
  --accent: #7ffe82;
  --tide-low-glyph: #00d5ff;
  color: var(--text-primary);
}

.ep *, .ep *::before, .ep *::after { box-sizing: border-box; }
.ep a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.ep a:hover { color: var(--text-primary); }
.ep :focus-visible { outline: 2px solid var(--cta-ring); outline-offset: 3px; border-radius: 4px; }
.ep img { max-width: 100%; display: block; }
.ep h1, .ep h2, .ep h3, .ep h4, .ep p, .ep ol, .ep ul, .ep dl, .ep dd, .ep figure { margin: 0; }
.ep ol, .ep ul { padding: 0; list-style: none; }
.ep .num { font-variant-numeric: tabular-nums; }
.ep .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 2. Type scale ------------------------------------------------ */
/* weights stay 300–600: there is no bold */
.t-display   { font: 600 clamp(42px, 7.2cqi, 84px)/1.02 var(--font-sans); letter-spacing: -0.025em; }
.t-headline  { font: 600 clamp(30px, 4.4cqi, 52px)/1.08 var(--font-sans); letter-spacing: -0.018em; }
.t-title-1   { font: 500 28px/34px var(--font-sans); letter-spacing: -0.01em; }
.t-title     { font: 600 20px/25px var(--font-sans); }
.t-subtitle  { font: 600 17px/22px var(--font-sans); }
.t-body      { font: 400 17px/1.55 var(--font-sans); color: var(--text-secondary); }
.t-lead      { font: 400 clamp(17px, 1.9cqi, 21px)/1.5 var(--font-sans); color: var(--text-secondary); }
.t-callout   { font: 400 16px/21px var(--font-sans); }
.t-footnote  { font: 400 13px/18px var(--font-sans); color: var(--text-secondary); }
.t-label     { font: 600 12px/16px var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--text-tertiary); }
.t-metric-hero { font: 300 clamp(64px, 11cqi, 120px)/0.95 var(--font-sans); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.t-metric-big  { font: 400 34px/41px var(--font-sans); font-variant-numeric: tabular-nums; }
.t-metric-med  { font: 400 22px/28px var(--font-sans); font-variant-numeric: tabular-nums; }
.t-metric-small{ font: 500 11px/13px var(--font-sans); font-variant-numeric: tabular-nums; }
.t-metric-tiny { font: 300 11px/13px var(--font-sans); color: var(--text-tertiary); }
.unit { font-size: .62em; color: var(--text-tertiary); margin-left: var(--space-2); letter-spacing: 0; font-weight: 400; }
.t-accent { color: var(--accent); }

/* ---------- 3. Layout ---------------------------------------------------- */
.ep-wrap { width: 100%; max-width: calc(var(--page-max) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.ep-section { padding-block: calc(var(--section-gap) / 2); }
.ep-stack { display: flex; flex-direction: column; gap: var(--space-16); }
.ep-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-16); }
.ep-grid { display: grid; gap: var(--space-16); grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--min, 260px)), 1fr)); }
.ep-card { background: var(--surface); border-radius: var(--radius-lg); padding: clamp(20px, 2.4cqi, 28px); }
.ep-well { background: var(--inset-bg); border-radius: var(--radius-md); }
.ep-rule { border: 0; border-top: 1px solid var(--hairline); margin: 0; }

/* ---------- 4. Components ----------------------------------------------- */

/* 4.1 Call-to-action button — every button is a capsule */
.ep-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-8);
  min-height: var(--tap-target); padding: var(--space-10) var(--space-20);
  border-radius: var(--radius-capsule); border: 0;
  font: 600 16px/21px var(--font-sans); text-decoration: none; white-space: nowrap;
  transition: filter .2s, transform .4s var(--ease-swell);
}
.ep .ep-btn { text-decoration: none; }
.ep-btn--primary   { background: var(--cta-bg); color: var(--cta-ink); min-width: min(100%, var(--button-min-width)); }
.ep-btn--secondary { background: var(--inset-bg-alt); color: var(--text-primary); }
.ep-btn--ghost     { background: transparent; color: var(--text-secondary); padding-inline: var(--space-10); }
.ep-btn--lg        { min-height: 56px; padding: 16px 28px; font-size: 17px; }
.ep .ep-btn--primary, .ep .ep-btn--primary:hover { color: var(--cta-ink); }
.ep .ep-btn--secondary, .ep .ep-btn--secondary:hover { color: var(--text-primary); }
.ep-btn:hover  { filter: brightness(.95); }
.ep-btn:active { filter: brightness(.95); color: var(--text-tertiary); transform: scale(.98); }
.ep-btn svg { width: 18px; height: 18px; flex: none; }

/* App Store badge slot — replace inner markup with Apple's official badge SVG */
.ep-store {
  display: inline-flex; align-items: center; gap: 10px; height: 54px; padding: 0 18px 0 14px;
  border-radius: 12px; background: #000; color: #fff; border: 1px solid #a6a6a6; text-decoration: none;
}
.ep .ep-store, .ep .ep-store:hover { color: #fff; text-decoration: none; }
.ep-store svg { width: 26px; height: 26px; fill: #fff; }
.ep-store b { display: block; font: 400 11px/12px var(--font-sans); letter-spacing: .02em; }
.ep-store strong { display: block; font: 500 22px/24px var(--font-sans); letter-spacing: -0.02em; }

/* 4.2 Stat tile — measure first, unit smaller and dimmer */
.ep-stat {
  display: flex; flex-direction: column; gap: var(--space-4);
  padding: var(--space-16); border-radius: var(--radius-md); background: var(--inset-bg); min-width: 0;
}
.ep-stat__label { font: 600 12px/16px var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--text-tertiary); }
.ep-stat__value { font: 400 34px/41px var(--font-sans); font-variant-numeric: tabular-nums; color: var(--text-primary); display: flex; align-items: baseline; gap: var(--space-6); }
.ep-stat__value .unit { font-size: 20px; margin: 0; }
.ep-stat__sub { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-6); font: 400 13px/18px var(--font-sans); color: var(--text-secondary); }
.ep-stat--compact .ep-stat__value { font-size: 22px; line-height: 28px; }
.ep-stat--compact .ep-stat__value .unit { font-size: 15px; }

/* 4.3 Direction arrow — write the FROM bearing (as forecasts state it);
   the arrow draws where the water/air is travelling (from + 180°). */
.ep-arrow {
  --from: 0deg;
  display: inline-block; width: 1em; height: 1em; flex: none; vertical-align: -0.12em;
  transform: rotate(calc(var(--from) + 180deg)); color: currentColor;
}
.ep-arrow path { fill: currentColor; }
.ep-dir { display: inline-flex; align-items: center; gap: var(--space-6); font-variant-numeric: tabular-nums; }
.ep-dir--ring { width: 44px; height: 44px; justify-content: center; border-radius: 50%; background: var(--inset-bg); font-size: 20px; }
.ep-dir--swell { color: var(--ideal); }
.ep-dir--wind  { color: rgba(255,255,255,.7); }
.ep[data-theme="light"] .ep-dir--wind { color: rgba(0,0,0,.7); }
.ep[data-theme="light"] .ep-dir--swell { color: #2f6b00; }

/* 4.4 Vibe tag — scale colour carries the meaning, always with a word */
.ep-tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: var(--radius-sm); background: var(--tag-bg); font: 600 12px/16px var(--font-sans); letter-spacing: .02em; color: var(--text-secondary); white-space: nowrap; }
.ep-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ep-tag--good { color: var(--tag-good); }
.ep-tag--fair { color: var(--tag-fair); }
.ep-tag--poor { color: var(--tag-poor); }
.ep[data-theme="light"] .ep-tag--good { background: var(--scale-1); color: rgba(0,0,0,.85); }
.ep[data-theme="light"] .ep-tag--fair { background: var(--scale-2); color: rgba(0,0,0,.85); }
.ep[data-theme="light"] .ep-tag--poor { background: var(--scale-3); color: rgba(0,0,0,.85); }
.ep-blue .ep-tag--good { background: var(--tag-bg); color: var(--tag-good); }

/* 4.5 Tide chip */
.ep-tide {
  display: inline-flex; align-items: center; gap: var(--space-6);
  min-height: 32px; padding: var(--space-6) 12px; border-radius: var(--radius-capsule);
  background: var(--tag-bg); font: 500 15px/20px var(--font-sans); font-variant-numeric: tabular-nums; color: var(--text-primary); white-space: nowrap;
}
.ep-tide svg { width: 10px; height: 10px; flex: none; }
.ep-tide--high svg { fill: var(--text-primary); }
.ep-tide--low  svg { fill: var(--tide-low-glyph); }
.ep-tide__h { font-weight: 400; color: var(--text-tertiary); }
.ep-tide--next { background: var(--inset-bg-alt); box-shadow: inset 0 0 0 1px var(--tide-line); }
.ep-tide--past { opacity: .55; }

/* 4.6 Flame badge (ideal conditions) */
.ep-flame { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; box-shadow: inset 0 0 0 2.5px var(--ideal); color: var(--text-primary); flex: none; }
.ep-flame svg { width: 16px; height: 16px; }

/* 4.7 Logo lockup */
.ep-logo { display: inline-flex; align-items: center; gap: 10px; font: 600 19px/1 var(--font-sans); letter-spacing: -0.01em; color: var(--text-primary); text-decoration: none; }
.ep .ep-logo, .ep .ep-logo:hover { color: var(--text-primary); text-decoration: none; }
/* epic-mark.png is the spiral on a white square with the app-icon margin built in:
   round it like an iOS icon (22.37%), no extra padding. Never use the pre-rounded app-icon.png */
.ep-logo img { width: 32px; height: 32px; background: #fff; border-radius: 22.37%; box-shadow: 0 0 0 .5px rgba(0,0,0,.12); }

/* ---------- 5. Device + widget surfaces ---------------------------------- */
.ep-phone { width: 300px; aspect-ratio: 300 / 640; padding: 10px; border-radius: 52px; background: #0c1b22; box-shadow: 0 0 0 1.5px #233a44 inset, 0 40px 80px -30px rgba(0,10,30,.55); flex: none; }
.ep-phone__screen { position: relative; height: 100%; border-radius: 43px; overflow: hidden; background: #002d56 radial-gradient(120% 60% at 20% 0%, #0f3968 0%, #002d56 60%); display: flex; flex-direction: column; }
.ep-phone__island { position: absolute; top: 11px; left: 50%; width: 92px; height: 27px; margin-left: -46px; border-radius: 20px; background: #000; }
.ep-widget { border-radius: 22px; padding: 14px 16px; background: linear-gradient(160deg, #1b4a6e 0%, #0f3557 55%, #0b2c4a 100%); color: rgba(255,255,255,.9); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.ep-today { border-radius: var(--radius-lg); background: linear-gradient(170deg, #0f3968 0%, #002d56 100%); }

/* ---------- 6. Responsive (container, not viewport) ---------------------- */
@container page (max-width: 760px) {
  .ep-hide-sm { display: none !important; }
  .ep-stack-sm { flex-direction: column !important; align-items: stretch !important; }
  .ep-btn--primary { width: 100%; }
}
@container page (min-width: 761px) {
  .ep-show-sm { display: none !important; }
}
@media (prefers-reduced-motion: reduce) { .ep * { transition: none !important; animation: none !important; } }
