/* ===========================================================================
   GreenCity Padel — foundations
   Tokens, reset, typography, motion, utilities.
   =========================================================================== */

:root {
  /* --- surface ---------------------------------------------------------- */
  --bg:            #060a08;
  --bg-2:          #0a100d;
  --bg-3:          #0e1613;
  --surface:       rgba(255, 255, 255, 0.035);
  --surface-2:     rgba(255, 255, 255, 0.062);
  --surface-3:     rgba(255, 255, 255, 0.09);
  --line:          rgba(255, 255, 255, 0.085);
  --line-2:        rgba(255, 255, 255, 0.16);

  /* --- brand ------------------------------------------------------------ */
  --brand:         #17e07e;
  --brand-2:       #8cff5a;
  --brand-deep:    #05a557;
  --brand-ink:     #032012;
  --brand-a08:     rgba(23, 224, 126, 0.08);
  --brand-a15:     rgba(23, 224, 126, 0.15);
  --brand-a30:     rgba(23, 224, 126, 0.3);
  --brand-grad:    linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);

  /* --- semantic --------------------------------------------------------- */
  --danger:        #ff5a6e;
  --danger-a15:    rgba(255, 90, 110, 0.15);
  --warn:          #ffb020;
  --warn-a15:      rgba(255, 176, 32, 0.15);
  --info:          #4da6ff;
  --info-a15:      rgba(77, 166, 255, 0.15);
  --gold:          #ffc94d;
  --silver:        #cbd5e1;
  --bronze:        #e08a4b;

  /* --- text ------------------------------------------------------------- */
  --text:          #eaf2ed;
  --text-2:        #9db0a6;
  --text-3:        #63786d;

  /* --- type ------------------------------------------------------------- */
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    ui-monospace, 'SF Mono', Menlo, monospace;

  --fs-xs:   0.75rem;
  --fs-sm:   0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md:   1.0625rem;
  --fs-lg:   1.25rem;
  --fs-xl:   1.5rem;
  --fs-2xl:  clamp(1.6rem, 1.2rem + 1.6vw, 2.15rem);
  --fs-3xl:  clamp(2rem, 1.4rem + 2.6vw, 3rem);

  /* --- space ------------------------------------------------------------ */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;

  /* --- shape ------------------------------------------------------------ */
  --r-sm:   10px;
  --r:      14px;
  --r-lg:   20px;
  --r-xl:   28px;
  --r-full: 999px;

  /* --- depth ------------------------------------------------------------ */
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --sh-2: 0 4px 16px rgba(0, 0, 0, 0.35);
  --sh-3: 0 12px 40px rgba(0, 0, 0, 0.5);
  --sh-brand: 0 6px 28px rgba(23, 224, 126, 0.22);

  /* --- motion ----------------------------------------------------------- */
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-1: 120ms;
  --dur-2: 220ms;
  --dur-3: 380ms;

  /* --- layout ----------------------------------------------------------- */
  --sidebar-w:  248px;
  --bottom-nav-h: 64px;
  --content-max: 1180px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

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

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

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: dark;
  overflow-x: hidden;
  /* Stop iOS from bouncing the whole page behind the fixed nav. */
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-md); }

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

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

button {
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

table { border-collapse: collapse; width: 100%; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--brand-a30); color: #fff; }

/* --- scrollbars ----------------------------------------------------------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: var(--r-full);
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--line-2); background-clip: content-box; }

/* --- ambient background --------------------------------------------------- */
/* Two soft brand-coloured pools of light plus a fine dot grid. Fixed and
   inert so it never interferes with scrolling or taps. */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 620px at 12% -8%,  rgba(23, 224, 126, 0.10), transparent 60%),
    radial-gradient(900px 520px at 92% 8%,   rgba(140, 255, 90, 0.055), transparent 60%),
    radial-gradient(760px 620px at 50% 108%, rgba(23, 224, 126, 0.05), transparent 62%),
    var(--bg);
}
.ambient::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 25%, transparent 78%);
  opacity: 0.55;
}

/* --- keyframes ------------------------------------------------------------ */
@keyframes fade-in    { from { opacity: 0 } to { opacity: 1 } }
@keyframes rise       { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
@keyframes rise-sm    { from { opacity: 0; transform: translateY(6px) }  to { opacity: 1; transform: none } }
@keyframes pop        { from { opacity: 0; transform: scale(0.9) }       to { opacity: 1; transform: none } }
@keyframes slide-left { from { opacity: 0; transform: translateX(-12px) } to { opacity: 1; transform: none } }
@keyframes shake      { 0%,100% { transform: translateX(0) } 20% { transform: translateX(-7px) } 40% { transform: translateX(7px) } 60% { transform: translateX(-4px) } 80% { transform: translateX(4px) } }
@keyframes float      { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }
@keyframes spin       { to { transform: rotate(360deg) } }
@keyframes shimmer    { 0% { background-position: -600px 0 } 100% { background-position: 600px 0 } }
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 var(--brand-a30) }
  70%  { box-shadow: 0 0 0 16px rgba(23, 224, 126, 0) }
  100% { box-shadow: 0 0 0 0 rgba(23, 224, 126, 0) }
}
@keyframes breathe {
  0%, 100% { opacity: 0.6 }
  50%      { opacity: 1 }
}
@keyframes count-flip {
  0%   { transform: translateY(40%) scale(0.85); opacity: 0 }
  100% { transform: none; opacity: 1 }
}

/* --- animation helpers ---------------------------------------------------- */
.anim-rise   { animation: rise var(--dur-3) var(--ease-out) both; }
.anim-pop    { animation: pop var(--dur-2) var(--ease-spring) both; }
.anim-shake  { animation: shake 420ms var(--ease); }
.anim-float  { animation: float 4s ease-in-out infinite; }

/* Stagger children — set --i on each child. */
.stagger > * { animation: rise-sm var(--dur-3) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 45ms); }

/* --- text utilities ------------------------------------------------------- */
.t-brand   { color: var(--brand); }
.t-muted   { color: var(--text-2); }
.t-faint   { color: var(--text-3); }
.t-danger  { color: var(--danger); }
.t-warn    { color: var(--warn); }
.t-center  { text-align: center; }
.t-right   { text-align: right; }
.t-xs      { font-size: var(--fs-xs); }
.t-sm      { font-size: var(--fs-sm); }
.t-lg      { font-size: var(--fs-lg); }
.t-bold    { font-weight: 700; }
.t-display { font-family: var(--font-display); }
.t-mono    { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.t-num     { font-variant-numeric: tabular-nums; }
.t-upper   { text-transform: uppercase; letter-spacing: 0.08em; }

.t-gradient {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.t-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- layout utilities ----------------------------------------------------- */
.row     { display: flex; align-items: center; gap: var(--s-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.col     { display: flex; flex-direction: column; gap: var(--s-3); }
.wrap    { flex-wrap: wrap; }
.grow    { flex: 1; min-width: 0; }
.hidden  { display: none !important; }
.mt-2 { margin-top: var(--s-2) } .mt-3 { margin-top: var(--s-3) }
.mt-4 { margin-top: var(--s-4) } .mt-6 { margin-top: var(--s-6) }
.mb-2 { margin-bottom: var(--s-2) } .mb-3 { margin-bottom: var(--s-3) }
.mb-4 { margin-bottom: var(--s-4) } .mb-6 { margin-bottom: var(--s-6) }
.w-full { width: 100%; }
.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;
}

/* --- 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;
  }
  .ambient { background-image: none; background: var(--bg); }
}
