/* "המשפחה" — shared design tokens and primitives. Dark navy world, light-blue voice, gold premium. */
:root {
  --navy-950: #05142e;
  --navy: #081e43;
  --navy-2: #0e285c;
  --navy-3: #143676;
  --gold: #f5bd41;
  --gold-2: #d9a12a;
  --gold-3: #ffe08a;
  --sky: #8ecbff;
  --sky-2: #5eb3ff;
  --sky-dim: #6f8fc2;
  --ink: #ffffff;
  --ink-2: #c7d3ea;
  --ink-3: #8a9bc0;
  --line: rgba(142, 203, 255, 0.16);
  --line-strong: rgba(142, 203, 255, 0.32);
  --gold-line: rgba(245, 189, 65, 0.45);
  --ok: #3ddc97;
  --danger: #ff7b7b;
  --grey: #a09f9c;

  --font: 'Heebo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.2rem;
  --fs-xl: 1.44rem;
  --fs-2xl: 1.728rem;
  --fs-3xl: 2.074rem;
  --fs-4xl: 2.488rem;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-card: 22px;
  --shadow-card: 0 18px 40px -12px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow-sheet: 0 -12px 40px rgba(0, 0, 0, 0.45);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-fast: 160ms;
  --dur: 220ms;

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  background: var(--navy-950);
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(94, 179, 255, 0.14), transparent 60%),
    var(--navy-950);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--gold); color: var(--navy); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--navy-3); border-radius: 999px; border: 2px solid var(--navy-950); }
::-webkit-scrollbar-track { background: transparent; }

h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 700; text-wrap: balance; }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
p { margin: 0; }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
bdi, .num { font-variant-numeric: tabular-nums; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

.container { width: min(100% - 32px, 1120px); margin-inline: auto; }
.narrow { width: min(100% - 32px, 520px); margin-inline: auto; }

/* ---- eyebrow-free labels: small tracked captions used as data labels, never above headings ---- */
.label { font-size: var(--fs-xs); font-weight: 500; letter-spacing: 0.08em; color: var(--sky); text-transform: none; }
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 600; font-size: var(--fs-md); line-height: 1; cursor: pointer;
  text-decoration: none; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-gold { background: linear-gradient(180deg, var(--gold-3) 0%, var(--gold) 45%, var(--gold-2) 100%); color: var(--navy); box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.6); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-sky { background: rgba(142, 203, 255, 0.12); color: var(--sky); border-color: transparent; }
.btn-danger { background: rgba(255, 123, 123, 0.12); color: var(--danger); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: var(--fs-sm); }
.btn-block { width: 100%; }
.btn-icon { width: 44px; min-height: 44px; padding: 0; border-radius: 50%; }
@media (max-width: 899px) {
  .btn-ghost, .btn-sky, .btn-danger { color: var(--gold); border-color: var(--gold-line); background: rgba(245, 189, 65, 0.06); }
  .tabbar a.active { color: var(--gold); }
}
@media (hover: hover) and (pointer: fine) {
  .btn-gold:hover { filter: brightness(1.05); }
  .btn-ghost:hover { border-color: var(--sky); background: rgba(142, 203, 255, 0.06); }
  .btn-sky:hover { background: rgba(142, 203, 255, 0.2); }
  a.btn:hover { text-decoration: none; }
}

/* ---- forms ---- */
.field { display: grid; gap: 6px; margin-block-end: 18px; }
.field > label { font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: var(--fs-xs); color: var(--ink-3); }
.field .err { display: none; font-size: var(--fs-sm); color: var(--danger); }
.field.invalid .err { display: block; }
.field.invalid .input { border-color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 16px; font: inherit; font-size: 16px; color: var(--ink);
  background: rgba(14, 40, 92, 0.55); border: 1.5px solid var(--line); border-radius: var(--r-md);
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
  caret-color: var(--gold);
}
.input::placeholder { color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--sky); background: rgba(14, 40, 92, 0.85); }
textarea.input { min-height: 96px; resize: vertical; }
select.input { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%238ecbff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M4 6l4 4 4-4'/></svg>"); background-repeat: no-repeat; background-position: left 14px center; padding-inline-start: 40px; }
.row { display: flex; gap: 12px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 420px) { .grid-2 { grid-template-columns: 1fr; } }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-sm); color: var(--ink-2); }
.check input { width: 20px; height: 20px; accent-color: var(--gold); }

/* ---- surfaces ---- */
.panel {
  background: linear-gradient(180deg, rgba(14, 40, 92, 0.75), rgba(8, 30, 67, 0.75));
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px;
}
.hairline { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---- membership card (the one object) ---- */
.mcard {
  position: relative; aspect-ratio: 1.586; width: 100%; border-radius: var(--r-card);
  padding: 20px 22px; color: var(--ink); overflow: hidden; isolation: isolate;
  background:
    linear-gradient(20deg, #061838 0%, var(--navy) 45%, #12306b 100%);
  box-shadow: var(--shadow-card), inset 0 0 0 1px var(--gold-line);
  display: grid; grid-template-rows: auto 1fr auto;
}
.mcard::before { /* sheen */
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(115deg, transparent 30%, rgba(142, 203, 255, 0.12) 45%, transparent 60%);
}
.mcard::after { /* foil strip on the inline-start edge */
  content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 10px;
  background: linear-gradient(180deg, var(--gold-3), var(--gold) 40%, var(--gold-2) 70%, var(--gold-3));
  opacity: 0.95;
}
.mcard-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-inline-start: 6px; position: relative; z-index: 1; }
.mcard-brand { display: flex; align-items: center; gap: 10px; }
.mcard-brand img { display: none; }
.mcard-crest { position: absolute; inset-inline-end: 7%; top: 50%; transform: translateY(-46%); height: 58%; aspect-ratio: 1; width: auto; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45)); z-index: 0; pointer-events: none; }
.mcard-brand .t1 { font-weight: 700; font-size: var(--fs-sm); line-height: 1.1; }
.mcard-brand .t2 { font-size: var(--fs-xs); color: var(--sky); letter-spacing: 0.06em; }
.mcard-body { display: grid; align-content: end; gap: 4px; padding-inline-start: 6px; max-width: 58%; position: relative; z-index: 1; }
.mcard-name { font-size: var(--fs-xl); font-weight: 500; letter-spacing: 0.01em; }
.mcard-no {
  font-size: var(--fs-4xl); font-weight: 800; letter-spacing: 0.04em; line-height: 1;
  color: var(--gold); font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 rgba(255, 224, 138, 0.5), 0 -1px 0 rgba(0, 0, 0, 0.35);
}
.mcard-foot { display: flex; justify-content: space-between; align-items: end; padding-inline-start: 6px; font-size: var(--fs-xs); color: var(--sky); letter-spacing: 0.06em; position: relative; z-index: 1; }
.mcard-season { font-size: var(--fs-xs); color: var(--sky); letter-spacing: 0.06em; white-space: nowrap; }

/* ---- status pills ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 500; border: 1px solid var(--line-strong); color: var(--ink-2); white-space: nowrap; }
.pill.gold { color: var(--navy); background: var(--gold); border-color: transparent; font-weight: 700; }
.pill.sky { color: var(--sky); border-color: rgba(142, 203, 255, 0.4); }
.pill.ok { color: var(--sky); border-color: rgba(142, 203, 255, 0.55); background: rgba(142, 203, 255, 0.08); }
.pill.danger { color: var(--danger); border-color: rgba(255, 123, 123, 0.4); }
.pill.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---- toast ---- */
#toast {
  position: fixed; inset-inline: 16px; bottom: calc(24px + var(--sab)); z-index: 1000;
  margin-inline: auto; width: fit-content; max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 999px; background: var(--ink); color: var(--navy);
  font-weight: 500; font-size: var(--fs-sm); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0; transform: translateY(12px);
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast[data-kind="error"] { background: var(--danger); color: #2a0808; }
#toast[data-kind="success"] { background: var(--navy-2); color: var(--ink); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 0 1px var(--gold-line); }
#toast[data-kind="success"]::before { content: "\2713  "; color: var(--gold); font-weight: 800; }

/* ---- skeleton ---- */
.skel { background: linear-gradient(90deg, rgba(142, 203, 255, 0.06), rgba(142, 203, 255, 0.14), rgba(142, 203, 255, 0.06)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-sm); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---- utilities ---- */
.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; }
.hp { position: absolute; inset-inline-start: -9999px; opacity: 0; height: 0; width: 0; overflow: hidden; }
[dir="rtl"] .icon-dir { transform: scaleX(-1); }
.stack { display: grid; gap: 12px; }
.center { text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
