/* design.css — design layer for the Pazh mountaineering club site (fa, RTL).
   Loads AFTER x-theme.css, so these rules win at equal specificity.
   Part 1 re-declares the four skin palettes (same variable names, new values).
   Part 2 polishes the component system. No class names, HTML or text changed. */

/* ============================================================
   PART 1 — SKIN PALETTES
   Contrast (WCAG AA, 4.5:1) verified by relative-luminance script:
   light  text 16.49 / button 7.13 · night text 16.30 / button 9.59
   nature text 13.46 / button 11.08 · sport text 17.89 / button 6.67
   ============================================================ */

/* --- Alpine day (light, default): warm snow, stone text,
       deep pine primary, terracotta secondary. --- */
body {
  color-scheme: light;
  --fill-primary-on: #FAF8F4;
  --text-primary: #1C1917;
  --text-secondary: #57534E;
  --fill-primary: #14532D;
  --text-primary-on: #FFFFFF;
  --fill-tertiary: #EFEAE1;
  --stroke-primary: #1C191729;
  --stroke-secondary: #1C191714;
  --text-tertiary: #1C19174D;
  --mat-agent: #FAF8F4EE;
  --acc: #166534;
  --acc2: #C2410C;
  --on-acc: #FFFFFF;
  --r-s: 0.5rem; --r-m: 0.875rem; --r-l: 1.25rem; --r-xl: 1.75rem; --x-btn-r: 0.75rem;
  --x-hw: 700; --x-skew: 0deg; --x-hbg: transparent; --x-hfg: var(--text-primary); --x-hpad: 0;
  --hark-shadow: 0 1px 2px #1C191714, 0 8px 24px #1C191714;
  --x-glass: none; --x-bg: none;
  --x-soft: 0 1px 2px #1C19170D, 0 6px 20px #1C191714;
}

/* --- Alpine night: deep blue-slate, glacier teal primary,
       warm amber secondary. Dark button text on the light teal
       is what keeps the primary button at 9.59:1. --- */
body[data-skin="night"] {
  color-scheme: dark;
  --fill-primary-on: #0F172A;
  --text-primary: #F1F5F9;
  --text-secondary: #A8B0BB;
  --fill-primary: #E2E8F0;
  --text-primary-on: #0F172A;
  --fill-tertiary: #1E293B;
  --stroke-primary: #F1F5F92E;
  --stroke-secondary: #F1F5F917;
  --text-tertiary: #F1F5F959;
  --mat-agent: #131C2EEE;
  --acc: #2DD4BF;
  --acc2: #F59E0B;
  --on-acc: #0F172A;
  --r-s: 0.75rem; --r-m: 1.125rem; --r-l: 1.5rem; --r-xl: 1.75rem; --x-btn-r: 0.75rem;
  --x-hw: 600; --x-skew: 0deg; --x-hbg: transparent; --x-hfg: var(--text-primary); --x-hpad: 0;
  --hark-shadow: 0 10px 40px #00000080;
  --x-glass: blur(14px) saturate(1.4);
  --x-bg: radial-gradient(circle at 85% 0%, #2DD4BF26, transparent 45%), radial-gradient(circle at 10% 60%, #1D4ED822, transparent 40%);
  --x-soft: 0 1px 2px #00000040, 0 8px 24px #00000059;
}

/* --- Forest & earth (nature): warm cream, moss and bark neutrals,
       deep forest primary, muted clay secondary. --- */
body[data-skin="nature"] {
  color-scheme: light;
  --fill-primary-on: #F5F1E8;
  --text-primary: #292524;
  --text-secondary: #57534E;
  --fill-primary: #1B4332;
  --text-primary-on: #F5F1E8;
  --fill-tertiary: #EAE3D3;
  --stroke-primary: #29252430;
  --stroke-secondary: #29252418;
  --text-tertiary: #2925244D;
  --mat-agent: #F5F1E8EE;
  --acc: #1B4332;
  --acc2: #A16207;
  --on-acc: #FFFFFF;
  --r-s: 1rem; --r-m: 1.5rem; --r-l: 2rem; --r-xl: 2.5rem; --x-btn-r: 6.25rem;
  --x-hw: 600; --x-skew: 0deg; --x-hbg: transparent; --x-hfg: var(--text-primary); --x-hpad: 0;
  --hark-shadow: 0 6px 24px #5A3F1F1F;
  --x-glass: none; --x-bg: none;
  --x-soft: 0 1px 2px #2925240D, 0 6px 20px #5A3F1F14;
}

/* --- Summit energy (sport): near-black, vivid climbing orange,
       sharp radii, heavy headings, skewed heading chip.
       Dark button text on the bright orange keeps the
       primary button at 6.33:1. --- */
body[data-skin="sport"] {
  color-scheme: dark;
  --fill-primary-on: #141210;
  --text-primary: #FAFAF9;
  --text-secondary: #D1D5DB;
  --fill-primary: #FAFAF9;
  --text-primary-on: #141210;
  --fill-tertiary: #26221F;
  --stroke-primary: #FAFAF92E;
  --stroke-secondary: #FAFAF917;
  --text-tertiary: #FAFAF959;
  --mat-agent: #141210EE;
  --acc: #F97316;
  --acc2: #F87171;
  --on-acc: #141210;
  --r-s: 0.125rem; --r-m: 0.25rem; --r-l: 0.375rem; --r-xl: 0.5rem; --x-btn-r: 0.125rem;
  --x-hw: 900; --x-skew: -10deg; --x-hbg: #F97316; --x-hfg: #141210; --x-hpad: 0.375rem 1rem;
  --hark-shadow: 6px 6px 0 #F9731659, 0 10px 32px #00000080;
  --x-glass: none;
  --x-bg: radial-gradient(circle at 85% 0%, #F9731626, transparent 45%);
  --x-soft: 0 1px 2px #00000040, 0 8px 24px #00000059;
}

/* ============================================================
   PART 2 — POLISHED COMPONENT SYSTEM
   ============================================================ */

/* --- Guards and focus (not present as general rules in x-theme.css;
       x-theme only has per-element [hidden] rules and one narrow
       reduced-motion block for the mobile screen animation). --- */
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
  border-radius: var(--r-s);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .x-carousel { scroll-behavior: auto; }
  .x-cta, .x-ghost, .x-filter, .x-icon, .x-rm, .x-x, .x-drop, .x-toast,
  .photo-card, .photo-card__photos img, .x-car, .x-zoom img, .x-bar i,
  .x-quick button, .x-sheet-list button, .x-seg span {
    transition: none;
    animation: none;
  }
  .x-spin { animation: none; }
  .page.x-anim [data-tab], .x-modal[open], .x-modal[open]::backdrop { animation: none; }
}

/* --- Typography rhythm: headings 700/800, body 400, labels 500.
       Vazirmatn weights are loaded in index.html (400/500/700/800). --- */
.head h2, .cards h3, .x-panel h3, .photo-card__head h3,
.x-goal__top h3, .x-cart h3, .x-article h4, .x-cap { font-weight: 700; }
body[data-skin="sport"] :is(.head h2, .cards h3, .x-panel h3,
  .photo-card__head h3, .x-goal__top h3, .x-cart h3) { font-weight: 900; }
.fineprint, .x-help, .stat__label { font-weight: 400; }
.x-field, .x-check, .x-slider, .x-cap small { font-weight: 500; }
.stat__fig { font-weight: 800; font-variant-numeric: tabular-nums; }
.stat__label { font-weight: 500; }

/* --- Buttons: one coherent system. --- */
.x-cta, .x-ghost, .x-filter, .x-rm, .x-x {
  min-height: var(--tap);
  border-radius: var(--x-btn-r);
  font-weight: 600;
  transition: background-color var(--dur-quick) var(--ease-out),
    color var(--dur-quick) var(--ease-out),
    border-color var(--dur-quick) var(--ease-out),
    box-shadow var(--dur-quick) var(--ease-out),
    transform var(--dur-quick) var(--ease-out),
    filter var(--dur-quick) var(--ease-out);
}
.x-cta {
  padding: 0 1.375rem;
  box-shadow: 0 1px 2px #00000014;
}
.x-cta:hover { filter: brightness(1.08); }
.x-cta:active { transform: scale(0.98); filter: brightness(0.96); }
.x-cta:disabled, .x-cta[aria-disabled="true"] {
  background: var(--fill-tertiary);
  color: var(--text-secondary);
  box-shadow: none;
  cursor: not-allowed;
  filter: none;
  transform: none;
}
/* Danger: --acc2 only, for genuinely destructive actions. */
.x-cta--red { background: var(--acc2); color: var(--on-acc); }
.x-cta--red:hover { filter: brightness(1.07); }
.x-cta--red:disabled, .x-cta--red[aria-disabled="true"] {
  background: var(--fill-tertiary);
  color: var(--text-secondary);
}

.x-ghost {
  justify-content: center;
  font-weight: 500;
  background: var(--fill-primary-on);
}
.x-ghost:hover { background: var(--fill-tertiary); border-color: var(--stroke-primary); }
.x-ghost:active { transform: scale(0.98); }
.x-ghost:disabled, .x-ghost[aria-disabled="true"] {
  background: var(--fill-tertiary);
  color: var(--text-secondary);
  border-color: var(--stroke-secondary);
  cursor: not-allowed;
}

.x-filter {
  font-weight: 500;
  background: var(--fill-primary-on);
}
.x-filter:hover { background: var(--fill-tertiary); border-color: var(--stroke-primary); }
.x-filter:active { transform: scale(0.97); }
.x-filter[aria-pressed="true"] {
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--fill-primary);
}
.x-filter:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--fill-tertiary);
  color: var(--text-secondary);
}

.x-icon {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  flex: none;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--dur-quick) var(--ease-out);
}
.x-icon:hover { background: var(--fill-tertiary); }
.x-icon:active { background: var(--fill-tertiary); transform: scale(0.96); }
.x-icon:disabled { color: var(--text-tertiary); cursor: not-allowed; }
.x-icon svg { width: 1.375rem; height: 1.375rem; }

.x-rm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  font-weight: 500;
  background: var(--fill-primary-on);
}
.x-rm:hover { background: color-mix(in srgb, var(--acc2) 10%, var(--fill-primary-on)); }
.x-rm:active { transform: scale(0.97); }
.x-rm:disabled { opacity: 0.45; cursor: not-allowed; }

.x-x {
  display: grid;
  place-items: center;
  font-weight: 400;
}
.x-x:hover { background: var(--fill-tertiary); filter: brightness(0.98); }
.x-x:active { transform: scale(0.96); }

/* --- Fields: consistent height, radius, border, focus, error. --- */
.x-field input, .x-field select, .x-field textarea,
.x-search input, .x-up input {
  min-height: var(--tap);
  border-radius: var(--r-m);
  border: 1px solid var(--stroke-primary);
  background: var(--fill-primary-on);
  color: var(--text-primary);
  transition: border-color var(--dur-quick) var(--ease-out),
    box-shadow var(--dur-quick) var(--ease-out);
}
.x-field input:hover, .x-field select:hover, .x-field textarea:hover,
.x-search input:hover {
  border-color: var(--text-tertiary);
}
.x-field input:focus, .x-field select:focus, .x-field textarea:focus,
.x-search input:focus, .x-up input:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 18%, transparent);
}
.x-field input:disabled, .x-field select:disabled, .x-field textarea:disabled {
  background: var(--fill-tertiary);
  color: var(--text-secondary);
  cursor: not-allowed;
}
/* Native affordances kept: selects and date inputs stay native,
   only sized and coloured to match the system. */
.x-field select, .x-field input[type="date"] { cursor: pointer; }
.x-field input[type="date"] { font-variant-numeric: tabular-nums; }
/* Restrained error state: --acc2 border + soft ring, readable message. */
.x-field.bad input, .x-field.bad select, .x-field.bad textarea {
  border-color: var(--acc2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc2) 14%, transparent);
}
.x-field.bad input:focus, .x-field.bad select:focus, .x-field.bad textarea:focus {
  border-color: var(--acc2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc2) 20%, transparent);
}
.x-err { color: var(--acc2); font-weight: 500; }
.x-drop.bad, .x-drop.x-photo.bad { border-color: var(--acc2); }

/* Photo upload drop zone. */
.x-drop {
  border-radius: var(--r-m);
  transition: border-color var(--dur-quick) var(--ease-out),
    background-color var(--dur-quick) var(--ease-out);
}
.x-drop:hover { border-color: var(--acc); }
.x-drop:focus-within {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 18%, transparent);
}

/* --- Top nav: clean spacing, clear active state. --- */
.x-nav__in { gap: 1rem; }
.x-links a { transition: color var(--dur-quick), background-color var(--dur-quick); }
.x-links a:hover { color: var(--text-primary); background: var(--fill-tertiary); }
.x-links a[aria-current="true"] {
  color: var(--acc);
  font-weight: 700;
  background: color-mix(in srgb, var(--acc) 10%, transparent);
  box-shadow: inset 0 -2px var(--acc);
}
.x-brand b { letter-spacing: 0; }

/* --- Mobile bottom tab bar: 56px+ height, 44px+ targets,
       clear active icon + label, safe-area padding kept. --- */
.x-tabbar { min-height: calc(3.5rem + env(safe-area-inset-bottom)); }
.x-tabbar button {
  min-height: 3.5rem;
  min-width: var(--tap);
  border-radius: var(--r-m);
  transition: color var(--dur-quick), background-color var(--dur-quick);
}
.x-tabbar button:hover { color: var(--text-primary); }
.x-tabbar button:active { transform: scale(0.97); }
.x-tabbar button[aria-current="page"] { font-weight: 700; }

/* --- Skin switcher: tidy menu, clear selected state. --- */
.x-skins > button { font-weight: 600; transition: filter var(--dur-quick), transform var(--dur-quick); }
.x-skins > button:hover { filter: brightness(1.06); }
.x-skins > button:active { transform: scale(0.97); }
.x-skins__menu { gap: 0.25rem; padding: 0.5rem; }
.x-skins__menu button { transition: background-color var(--dur-quick), color var(--dur-quick); }
.x-skins__menu button:hover { background: var(--fill-tertiary); }
.x-skins__menu button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--acc) 12%, transparent);
  color: var(--acc);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--acc);
}

/* --- Cards, carousels, stats, tables. --- */
.cards > div, .photo-card, .x-gear, .x-panel {
  padding: clamp(1.125rem, 3vw, 1.5rem);
}
.cards > div, .photo-card, .x-gear {
  border: 1px solid var(--stroke-secondary);
  box-shadow: var(--hark-shadow);
}
.photo-card__body { gap: 0.75rem; }
.photo-card__stage img, .photo-card__photos img { object-fit: cover; }
.x-gear img, .x-up img { object-fit: cover; border-radius: var(--r-m); }
.x-car img, .band img, .step__figure img { object-fit: cover; }
.x-carousel { scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.x-carousel > * { scroll-snap-align: start; }
.stats { gap: 0; }
.stat { padding: 0.875rem 1.5rem; }
.table-wrap {
  border: 1px solid var(--stroke-secondary);
  border-radius: var(--r-m);
  background: var(--fill-primary-on);
  padding: 0.25rem 0.75rem;
}
.table-wrap tbody tr { transition: background-color var(--dur-quick); }
.table-wrap tbody tr:hover { background: var(--fill-tertiary); }
.table-wrap caption { font-weight: 500; }

/* --- Wizard steps and progress bar. --- */
.x-steps { align-items: start; }
.x-steps span { display: inline-flex; align-items: center; gap: 0.375rem; }
.x-steps .x-sn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  background: var(--fill-tertiary);
  color: var(--text-secondary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.x-steps .on { color: var(--acc); font-weight: 700; }
.x-steps .on .x-sn, .x-steps .cur .x-sn {
  background: var(--acc);
  color: var(--on-acc);
}
.x-steps .cur .x-sl { font-weight: 700; }
.x-bar { height: 0.5rem; }
.x-bar i { border-radius: inherit; background: var(--acc); }

/* --- Modal, toast, pills and chips. --- */
.x-modal { overscroll-behavior: contain; }
.x-modal__in { padding: clamp(1.25rem, 3vw, 1.75rem); }
.x-modal__top h3 { font-weight: 700; }
.x-handle::before { background: var(--stroke-primary); }
.x-toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  border: 1px solid var(--stroke-primary);
}
.pill, .chip { font-weight: 500; }
.pill { padding: 0.125rem 0.625rem; }
.chip { border: 1px solid var(--stroke-secondary); }

/* --- Contrast fixes for elements that hard-code white text on
       a skin accent: use --on-acc so night (teal/amber) and sport
       (orange/coral) stay readable. --- */
.x-banner { color: var(--on-acc); }
.x-toast--bad { background: var(--acc2); color: var(--on-acc); }
.x-subtabs .x-n, #adm-tabs .x-n, #coach-tabs .x-n { color: var(--on-acc); }
.x-okmark { background: var(--acc); color: var(--on-acc); }

/* --- Container queries: the three grids become containers.
       Their auto-fit minmax already yields one column below ~26rem;
       these rules reinforce it (children span the full track) and
       tighten inner spacing, without fighting the existing grids. --- */
.cards, .photo-cards, .x-gears { container-type: inline-size; }

@container (max-width: 26rem) {
  .cards > div, .photo-card, .x-gear { grid-column: 1 / -1; }
  .cards > div, .photo-card__body, .x-gear { padding: 1rem; }
  .photo-card__head { gap: 0.5rem; }
}

/* ---------- فرم ارزیابی ورزشکار (پنل) — رندر از EVAL_FORM در app.js ---------- */
#eval-head { margin-bottom: 12px; }
#eval .x-eval-sec { grid-column: 1 / -1; margin: 14px 0 2px; font-size: 1rem; font-weight: 700; }
#eval .x-eval-sec:first-child { margin-top: 0; }
.x-eval-pair { grid-column: 1 / -1; display: grid; gap: 6px; }
.x-eval-pair-t { font-weight: 600; margin: 0; }
.x-eval-pair-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .x-eval-pair-grid { grid-template-columns: 1fr; } }
#eval-hist .timeline { margin-top: 8px; }
