/* ==========================================================================
   Hockey Fantasy Pool — Design System
   NHL-arena look: deep navy ice, red/blue accents. Day/night themes via
   [data-theme]. No external assets/CDN/fonts — system font stacks only.

   Directives structurantes (implémentées intégralement) :
   - Reset minimal + box-sizing: border-box.
   - :root[data-theme="dark"]  : --bg:#0a0e1a; --surface:#111827; --text:#f1f5f9;
     --muted:#94a3b8; --accent:#e11d2e; --accent2:#1e5aa8; --border:#1f2a3f.
   - :root[data-theme="light"] : --bg:#f4f6fb; --surface:#ffffff; --text:#0f172a;
     --muted:#475569; --accent:#c8102e; --accent2:#1e5aa8; --border:#dbe2ee.
   - transition douce (0.25s) sur background/color au changement de thème.
   - Titres : font-stack condensée system (Arial Narrow, Impact fallback) via
     .display { font-stretch:condensed; text-transform:uppercase; letter-spacing:.02em }.
   - .container { max-width:1100px; margin-inline:auto; padding-inline:1rem }.
   - Header sticky, fond translucide + backdrop-filter blur.
   - Nav mobile : .main-nav cachée ≤640px, panneau plein écran quand .nav-open.
   - .btn / .btn-primary (fond --accent, hover translateY(-1px) + ombre), .btn-ghost.
   - .card { background:var(--surface); border:1px solid var(--border); border-radius:14px }.
   - .hero : dégradé radial marine + lignes de glace (linear-gradient répété subtil),
     grand titre .display, sous-titre --muted, deux CTA.
   - .reveal { opacity:0; transform:translateY(18px) } .reveal.visible { opacity:1;
     transform:none; transition:.6s cubic-bezier(.2,.7,.3,1) }.
   - Grilles responsives : .grid-3 (1 col mobile, 2 tablette, 3 desktop), .grid-2.
   - @media (prefers-reduced-motion: reduce) { * { transition:none!important; animation:none!important } }.

   Breakpoints : ≤640px mobile · 641–1024px tablette · >1024px desktop.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; }
img, picture, svg, video { display: block; max-width: 100%; height: auto; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
table { border-collapse: collapse; }

/* --------------------------------------------------------------------------
   2. Design tokens — day / night themes
   -------------------------------------------------------------------------- */
:root[data-theme="dark"] {
  --bg: #0a0e1a;
  --surface: #111827;
  --surface-2: #161f33;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #e11d2e;
  --accent-ink: #ffffff;
  --accent2: #1e5aa8;
  --border: #1f2a3f;
  --shadow: rgba(0, 0, 0, 0.45);
  --header-bg: rgba(10, 14, 26, 0.72);
  --ice-line: rgba(255, 255, 255, 0.035);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --text: #0f172a;
  --muted: #475569;
  --accent: #c8102e;
  --accent-ink: #ffffff;
  --accent2: #1e5aa8;
  --border: #dbe2ee;
  --shadow: rgba(15, 23, 42, 0.12);
  --header-bg: rgba(244, 246, 251, 0.78);
  --ice-line: rgba(15, 23, 42, 0.035);
  color-scheme: light;
}

/* --------------------------------------------------------------------------
   3. Base
   -------------------------------------------------------------------------- */
html, body {
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  transition: background-color .25s ease, color .25s ease;
}

h1, h2, h3, h4 { line-height: 1.15; }

p { color: var(--text); }

a { transition: color .2s ease; }
a:hover { color: var(--accent); }

::selection { background: var(--accent); color: var(--accent-ink); }

/* Condensed display type — headlines only */
.display {
  font-family: "Arial Narrow", "Helvetica Neue Condensed", "Roboto Condensed", Impact, system-ui, sans-serif;
  font-stretch: condensed;
  text-transform: uppercase;
  letter-spacing: .02em;
  font-weight: 800;
}

.eyebrow {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: .5rem;
}

.muted, .text-muted { color: var(--muted); }

/* --------------------------------------------------------------------------
   4. Layout primitives
   -------------------------------------------------------------------------- */
.container {
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: 1rem;
}

.section { padding-block: clamp(3rem, 6vw, 6rem); }
.section-tight { padding-block: clamp(2rem, 4vw, 3.5rem); }

/* Respiration sous les titres de section */
.section h2.display { margin-bottom: clamp(1.5rem, 3vw, 2.25rem); }

main { display: block; }

/* --------------------------------------------------------------------------
   5. Header / navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
  transition: background-color .25s ease, border-color .25s ease;
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: .01em;
  white-space: nowrap;
}

.brand:hover { color: var(--text); }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--accent), #8f0f1c);
  color: #fff;
  font-family: "Arial Narrow", "Helvetica Neue Condensed", Impact, sans-serif;
  font-stretch: condensed;
  font-weight: 800;
  font-size: .78rem;
  letter-spacing: .02em;
  box-shadow: 0 4px 10px var(--shadow);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin-inline: auto;
}

.main-nav a {
  font-size: .93rem;
  font-weight: 600;
  color: var(--text);
  opacity: .85;
}

.main-nav a:hover { opacity: 1; color: var(--accent); }

.main-nav a.btn { opacity: 1; }

/* Les liens-boutons du header gardent leur texte lisible au survol
   (sinon .main-nav a:hover met le texte en rouge sur fond rouge) */
.main-nav a.btn-primary,
.main-nav a.btn-primary:hover { color: var(--accent-ink); }
.main-nav a.btn-ghost:hover { color: var(--accent2); }

.nav-tools {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding-inline: .4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
}

.lang-switch:hover { border-color: var(--accent); color: var(--accent); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color .2s ease, transform .2s ease, background-color .25s ease;
}

.theme-toggle:hover { border-color: var(--accent2); transform: rotate(20deg); }

/* Burger — hidden on desktop, shown ≤1024px alongside collapsed nav */
.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s ease, opacity .25s ease;
}

.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem 1.15rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: .92rem;
  line-height: 1;
  white-space: nowrap;
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  transition: transform .18s ease, box-shadow .18s ease, background-color .25s ease, border-color .25s ease, color .25s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px var(--shadow);
  color: var(--text);
}

.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 82%, black);
  border-color: color-mix(in srgb, var(--accent) 82%, black);
  color: var(--accent-ink);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 45%, transparent);
}

.btn-secondary {
  background: var(--accent2);
  border-color: var(--accent2);
  color: #fff;
}

.btn-secondary:hover { box-shadow: 0 10px 22px color-mix(in srgb, var(--accent2) 45%, transparent); }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

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

.btn-lg { padding: .85rem 1.6rem; font-size: 1rem; border-radius: 12px; }
.btn-block { width: 100%; }

/* --------------------------------------------------------------------------
   7. Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  transition: background-color .25s ease, border-color .25s ease, transform .2s ease, box-shadow .2s ease;
}

.card:hover { transform: translateY(-3px); box-shadow: 0 14px 28px var(--shadow); }

.card h3 { margin-bottom: .5rem; }
.card p:last-child { margin-bottom: 0; }

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

/* Feature card icons (sprite: /assets/img/icons.svg) */
.feature-icon {
  width: 40px;
  height: 40px;
  color: var(--accent2);
  margin-bottom: .9rem;
  transition: color .2s ease;
}

.card:hover .feature-icon { color: var(--accent); }

/* --------------------------------------------------------------------------
   8. Hero
   Photo credit: "An indoor ice rink with a hockey goal" by Chris DeSort
   (@desort_design), sourced from images.unsplash.com, Unsplash License
   (free for commercial use, no attribution required). Locally hosted at
   assets/img/hero.jpg — no NHL branding/logos visible in the source photo.
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(4rem, 10vw, 8rem);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -10%, color-mix(in srgb, var(--accent2) 26%, transparent), transparent 65%),
    radial-gradient(ellipse 60% 50% at 85% 10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    linear-gradient(180deg, rgba(10, 14, 26, .78), rgba(10, 14, 26, .92)),
    url("/assets/img/hero.jpg");
  background-size: cover;
  background-position: center 60%;
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--border);
  transition: background-color .25s ease, border-color .25s ease;
}

/* Lighter veil over the photo in light theme (dark text needs a pale
   backdrop, not a navy one) while keeping the same brand color glows. */
:root[data-theme="light"] .hero {
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -10%, color-mix(in srgb, var(--accent2) 20%, transparent), transparent 65%),
    radial-gradient(ellipse 60% 50% at 85% 10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    linear-gradient(180deg, rgba(244, 246, 251, .84), rgba(244, 246, 251, .95)),
    url("/assets/img/hero.jpg");
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.hero-inner.center { max-width: 780px; margin-inline: auto; text-align: center; }

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  margin-bottom: 1rem;
}

.hero h1 .accent { color: var(--accent); }

.hero p.lead {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--muted);
  max-width: 60ch;
  margin-bottom: 2rem;
}

.hero-inner.center p.lead { margin-inline: auto; }

.hero-sub {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--muted);
  max-width: 60ch;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem;
  margin-top: 2rem;
}

.hero-inner.center .hero-cta { justify-content: center; }

/* --------------------------------------------------------------------------
   9. Grids
   -------------------------------------------------------------------------- */
.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 641px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1025px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* --------------------------------------------------------------------------
   10. Reveal-on-scroll animation
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
}

.reveal.visible {
  opacity: 1;
  transform: none;
  transition: .6s cubic-bezier(.2, .7, .3, 1);
}

/* Stagger helpers for grids of reveal items */
.reveal:nth-child(2) { transition-delay: .06s; }
.reveal:nth-child(3) { transition-delay: .12s; }
.reveal:nth-child(4) { transition-delay: .18s; }
.reveal:nth-child(5) { transition-delay: .24s; }
.reveal:nth-child(6) { transition-delay: .3s; }

/* --------------------------------------------------------------------------
   11. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  color: var(--muted);
  font-size: .85rem;
  transition: border-color .25s ease;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

/* --------------------------------------------------------------------------
   12. Misc utilities
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .65rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
}

.divider {
  height: 1px;
  background: var(--border);
  border: none;
  margin-block: 2.5rem;
}

.text-center { text-align: center; }
.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;
}

/* --------------------------------------------------------------------------
   12b. Forms
   -------------------------------------------------------------------------- */
.auth-section { padding-block: clamp(3rem, 8vw, 6rem); }
.form-narrow { max-width: 420px; margin-inline: auto; }
.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: .4rem;
  color: var(--muted);
}
.field input,
.field select {
  width: 100%;
  padding: .7rem .85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: .95rem;
  transition: border-color .2s ease, background-color .25s ease;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent2);
}
.form-alert {
  padding: .75rem 1rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--text);
  font-size: .9rem;
  margin-bottom: 1.1rem;
}
.form-note {
  padding: .75rem 1rem;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: .85rem;
  margin-bottom: 1.1rem;
}
.form-foot {
  margin-top: 1.25rem;
  font-size: .9rem;
  color: var(--muted);
  text-align: center;
}
.form-foot a { color: var(--accent2); font-weight: 600; }

/* --------------------------------------------------------------------------
   12c. Pools - status/role badges, invite box, banners
   -------------------------------------------------------------------------- */
.btn-sm { padding: .45rem .8rem; font-size: .82rem; border-radius: 8px; }

.pool-card { display: flex; flex-direction: column; gap: .65rem; }
.pool-card-badges { display: flex; flex-wrap: wrap; gap: .5rem; }
.pool-card-meta { color: var(--muted); font-size: .88rem; }
.pool-price-estimate { color: var(--muted); font-size: .85rem; margin: 0; }

/* Role badges */
.badge-role-admin {
  background: color-mix(in srgb, var(--accent2) 18%, transparent);
  border-color: color-mix(in srgb, var(--accent2) 45%, transparent);
  color: var(--accent2);
}
.badge-role-player {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--muted);
}

/* Status badges: setup (neutral), pending_payment (accent/red), active (accent2/blue), archived (dimmed) */
.badge-status-setup {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--muted);
}
.badge-status-pending_payment {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
}
.badge-status-active {
  background: color-mix(in srgb, var(--accent2) 20%, transparent);
  border-color: color-mix(in srgb, var(--accent2) 55%, transparent);
  color: var(--accent2);
  font-weight: 700;
}
.badge-status-archived {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
  opacity: .65;
}

/* Pending-approval indicator (player member not yet approved by the admin) */
.badge-pending {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--accent);
}

/* Invite link box */
.invite-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin-block: .25rem;
}
.invite-box input[type="text"] {
  flex: 1 1 220px;
  min-width: 180px;
  padding: .55rem .75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: .82rem;
}
.copy-btn.copied {
  border-color: var(--accent2);
  color: var(--accent2);
}

/* Success banner (pool created / join request sent) */
.banner-success {
  padding: 1rem 1.25rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent2) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent2) 40%, transparent);
  color: var(--text);
  margin-bottom: 1.5rem;
}
.banner-success p { margin-bottom: .5rem; }
.banner-success p:last-child { margin-bottom: 0; }

.pools-actions {
  display: flex;
  justify-content: center;
  margin-block: 2rem;
}

.join-card { margin-top: 1rem; }
.join-card h2 { margin-bottom: 1rem; }

/* --------------------------------------------------------------------------
   13. Responsive breakpoints
   ≤640px mobile · 641–1024px tablette · >1024px desktop
   -------------------------------------------------------------------------- */

/* Mobile (≤640px): collapse nav into full-screen panel */
@media (max-width: 640px) {
  .main-nav {
    position: fixed;
    inset: 64px 0 0 0;
    z-index: 90;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 1.5rem 1.25rem;
    background: var(--bg);
    overflow-y: auto;
  }

  .main-nav.nav-open {
    display: flex;
  }

  .main-nav a {
    padding: 1rem 0;
    font-size: 1.25rem;
    border-bottom: 1px solid var(--border);
    opacity: 1;
  }

  .main-nav a.btn {
    margin-top: 1rem;
    border-bottom: none;
    width: 100%;
  }

  .burger { display: inline-flex; }

  .hero-cta { flex-direction: column; }
  .hero-cta .btn { width: 100%; }
}

/* Tablet (641–1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
  .main-nav { gap: 1.1rem; }
  .container { padding-inline: 1.5rem; }
}

/* Show burger at tablet width too if nav gets tight; keep nav visible by default */
@media (min-width: 641px) and (max-width: 1024px) {
  .burger { display: none; }
}

/* Desktop (>1024px) */
@media (min-width: 1025px) {
  .container { padding-inline: 1rem; }
}

/* --------------------------------------------------------------------------
   14. Accessibility — reduced motion kill-switch
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
