/* ============================================================
   RaceSnap AI: 2026 interface refresh
   Loaded after main.css. Same layouts, new surface:
   - Schibsted Grotesk for all reading and UI text (built for news and
     data-heavy pages); Bebas Neue kept for the brand hero and big numbers.
   - Paper page, white surfaces, hairline "rail" borders, one shadow scale.
   - Runner ranks drawn as saddlecloth tiles (the one signature element).
   ============================================================ */

:root {
  --paper:   #F4F6F1;
  --surface: #FFFFFF;
  --ink:     #102418;
  --rail:    #DDE4DA;
  --rail-2:  #C9D3C6;
  --silk:    #E2B33C;

  --card:  #FFFFFF;
  --card2: #FFFFFF;
  --border:  rgba(16,36,24,0.09);
  --border2: rgba(16,36,24,0.14);
  --border3: rgba(16,36,24,0.22);
  --text:  #102418;
  --text2: #44554A;
  --text3: #66766B;
  --text4: #B9C4BB;

  --font-b: 'Schibsted Grotesk', 'Noto Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-sm: 8px; --r-md: 10px; --r-lg: 12px; --r-xl: 18px; --r-2xl: 22px;

  --lift-1: 0 1px 2px rgba(16,36,24,0.05);
  --lift-2: 0 1px 2px rgba(16,36,24,0.04), 0 10px 28px -18px rgba(16,36,24,0.28);
  --lift-3: 0 2px 4px rgba(16,36,24,0.05), 0 24px 48px -24px rgba(16,36,24,0.35);
  --glass-shadow: var(--lift-2);
  --glow-gold: var(--lift-2);
  --glow-green: var(--lift-2);
}

/* ── Page ─────────────────────────────────────────────────── */
html { background: var(--paper); }
body {
  background: var(--paper);
  color: var(--ink);
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.003em;
}
body::before, .orb-gold, .orb-green, .particle-field { display: none !important; }
h1, h2, h3, h4 { letter-spacing: -0.018em; color: var(--ink); }
b, strong { font-weight: 700; }
a { text-underline-offset: 0.18em; }
::selection { background: rgba(22,129,63,0.2); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* Numbers line up in tables, odds and stats */
.kpi-value, .kpi-s-value, .stat-value, .pick-stat-value, .runner-stats, .runner-prob,
.runner-score, .multi-odds-value, .pick-odds, .pick-price, .ai-bet-stat-value, .leg-prob,
table td, .sp-pct { font-variant-numeric: tabular-nums; }

/* ── Navigation ───────────────────────────────────────────── */
.navbar {
  background: rgba(255,255,255,0.86);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--rail);
  box-shadow: none;
}
.nav-content { height: 62px; }
.logo { font-size: 1.35rem; color: var(--ink); }
.logo-accent { color: var(--green); }
.ico { display: block; flex-shrink: 0; }
.nav-link {
  color: var(--text2); font-weight: 600; font-size: 0.84rem;
  border-radius: 10px; padding: 0.45rem 0.7rem; gap: 0.45rem;
}
.nav-link .icon { display: inline-flex; font-size: 0; }
.nav-link:hover { color: var(--ink); background: rgba(16,36,24,0.05); }
.nav-link.active { color: var(--green-d); background: rgba(22,129,63,0.09); }
.nav-link.upload-btn {
  background: var(--green); color: #fff; box-shadow: none;
  padding: 0.45rem 0.95rem;
}
.nav-link.upload-btn:hover { background: var(--green-d); color: #fff; transform: none; opacity: 1; }
.nav-link.upload-btn.active { background: var(--green-d); color: #fff; }
.nav-link-admin { color: #6D3FC0 !important; }
.nav-member-badge {
  background: #FFF6DC !important; color: #6A4A05 !important;
  border: 1px solid #F0D58A !important; box-shadow: none !important;
}
.nav-hamburger { border-radius: 12px; border: 1px solid var(--rail); background: var(--surface); }
.nav-links {
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.nav-links .nav-link { font-size: 0.98rem; padding: 0.7rem 0.85rem; border-radius: 12px; gap: 0.75rem; }
.nav-links .nav-link .ico { width: 21px; height: 21px; }
.nav-close-btn { border-radius: 12px !important; }

/* Bottom bar (phones) */
.bottom-nav {
  background: rgba(255,255,255,0.94);
  border-top: 1px solid var(--rail);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  padding-top: 0.35rem;
}
.bottom-nav-item {
  position: relative; color: var(--text3); font-size: 0.66rem; font-weight: 600;
  gap: 0.25rem; min-height: 54px;
}
.bottom-nav-label { letter-spacing: 0; }
.bottom-nav-icon { display: inline-flex; font-size: 0; }
.bottom-nav-item.active, .bottom-nav-item:active { color: var(--green-d); }
.bottom-nav-item.active::before {
  content: ''; position: absolute; top: -0.35rem; left: 50%; width: 22px; height: 3px;
  margin-left: -11px; border-radius: 0 0 3px 3px; background: var(--green);
}
/* Scan button: a saddlecloth tile in the middle of the bar */
.bottom-nav-item:nth-child(3) { color: var(--ink) !important; }
.bottom-nav-item:nth-child(3) .bottom-nav-icon {
  width: 44px; height: 38px; margin-top: -0.55rem; border-radius: 11px;
  display: grid; place-items: center; color: #fff;
  background: var(--green);
  box-shadow: 0 6px 14px -6px rgba(22,129,63,0.7), inset 0 -3px 0 rgba(0,0,0,0.12);
}
.bottom-nav-item:nth-child(3).active::before { display: none; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  border-radius: 12px; font-weight: 650; letter-spacing: -0.005em;
  transition: background 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease), box-shadow 160ms var(--ease), transform 120ms var(--ease);
}
.btn:hover { transform: none; }
.btn:active { transform: translateY(1px); }
.btn-primary, .btn-green {
  background: var(--green); color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.14), 0 6px 16px -10px rgba(22,129,63,0.9);
}
.btn-primary:hover, .btn-green:hover { background: var(--green-d); color: #fff; transform: none;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.14), 0 8px 18px -10px rgba(22,129,63,0.95); }
.btn-secondary { background: var(--surface); border: 1px solid var(--rail-2); color: var(--ink); }
.btn-secondary:hover { background: #F7F9F6; border-color: var(--border3); }
.btn-ghost { background: transparent; border: 1px solid var(--rail-2); color: var(--ink); }
.btn-ghost:hover { background: rgba(16,36,24,0.04); }
.btn-xl { border-radius: 14px; }
.btn-glow { box-shadow: inset 0 -2px 0 rgba(0,0,0,0.14), 0 10px 24px -12px rgba(22,129,63,0.9); }

/* ── Surfaces ─────────────────────────────────────────────── */
.feature-card, .pick-card, .profile-card, .section-panel, .kpi-card, .upload-card,
.auth-card, .empty-state, .cta-inner {
  background: var(--surface);
  border: 1px solid var(--rail);
  box-shadow: var(--lift-2);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.feature-card::before { display: none; }
.feature-card:hover, .kpi-card:hover { transform: none; border-color: var(--rail-2); }
.kpi-card::after { height: 3px; opacity: 1; }
.auth-card { box-shadow: var(--lift-3); border-radius: 22px; }
.upload-card { border-radius: 22px; }
.panel-header { border-bottom-color: var(--rail); }
.analysis-row { background: transparent; border: 1px solid transparent; border-radius: 12px; }
.analysis-row:hover { background: #F7F9F6; border-color: var(--rail); }
.analysis-row + .analysis-row { box-shadow: 0 -1px 0 var(--rail); }
.drop-zone {
  border: 1.5px dashed var(--rail-2); background: #FAFBF8; border-radius: 16px;
}
.drop-zone:hover, .drop-zone.dragover, .drop-zone.drag-over { border-color: var(--green); background: rgba(22,129,63,0.04); }

/* Section labels: sentence case, no tracking */
.section-eyebrow, .picks-eyebrow {
  text-transform: none; letter-spacing: 0; font-size: 0.86rem; font-weight: 650; color: var(--green-d);
}
.section-eyebrow::before { width: 14px; height: 3px; border-radius: 2px; background: var(--green); }

/* ── Saddlecloth rank tiles (signature) ───────────────────── */
.runner-rank, .pick-rank {
  width: 34px; height: 38px; border-radius: 7px;
  font-family: var(--font-d); font-size: 1.35rem; font-weight: 400; line-height: 1;
  display: grid; place-items: center; padding-top: 2px;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--ink);
  box-shadow: inset 0 -4px 0 rgba(16,36,24,0.07);
}
.runner-rank.r1, .pick-rank.gold:first-child {
  background: var(--green); color: #fff; border-color: var(--green-d);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.16);
}
.runner-rank.r2 { background: var(--ink); color: #fff; border-color: var(--ink); }
.runner-rank.r3 { background: var(--silk); color: #3A2A04; border-color: #B88D1E; }
.runner-card { background: transparent; border: 1px solid var(--rail); border-radius: 14px; }
.runner-card:hover { border-color: var(--rail-2); }

/* ── Forms ────────────────────────────────────────────────── */
.form-input, .form-select, input[type=text].form-input, select.form-input, textarea.form-input {
  background: var(--surface); border: 1px solid var(--rail-2); border-radius: 12px;
  color: var(--ink); font-family: var(--font-b);
}
.form-input:hover, .form-select:hover { border-color: var(--border3); }
.form-input:focus, .form-select:focus {
  border-color: var(--green); box-shadow: 0 0 0 4px rgba(22,129,63,0.14); outline: none;
}
.form-label { color: var(--ink); font-weight: 650; }

/* ── Pills & toasts ───────────────────────────────────────── */
.pill { font-weight: 650; }
.toast {
  background: var(--ink); color: #fff; border: 0; border-radius: 14px;
  box-shadow: 0 18px 40px -16px rgba(16,36,24,0.6);
}
.toast.error { background: #7F1D1D; }
.toast.success { background: var(--green-d); }

/* ── Page loader: quieter ─────────────────────────────────── */
.page-loader { background: var(--paper) !important; }

/* ── Footer ───────────────────────────────────────────────── */
.rg-footer { background: transparent !important; border-top: 1px solid var(--rail) !important; }

/* ── Language picker (shown to Australian visitors) ───────── */
.lang-picker { position: relative; }
.lang-picker-btn {
  display: inline-flex; align-items: center; gap: 0.35rem; height: 38px; padding: 0 0.7rem;
  border-radius: 11px; border: 1px solid var(--rail); background: var(--surface);
  color: var(--ink); font: 650 0.8rem var(--font-b); cursor: pointer;
}
.lang-picker-btn:hover { border-color: var(--rail-2); }
.lang-picker-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 400; min-width: 200px;
  background: var(--surface); border: 1px solid var(--rail); border-radius: 14px;
  box-shadow: var(--lift-3); padding: 0.35rem; display: none;
}
.lang-picker.open .lang-picker-menu { display: block; }
.lang-picker-menu button {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 0.75rem; border: 0; background: none; border-radius: 10px; cursor: pointer;
  font: 500 0.92rem var(--font-b); color: var(--ink); text-align: start;
}
.lang-picker-menu button:hover { background: #F2F5F0; }
.lang-picker-menu button[aria-checked="true"] { background: rgba(22,129,63,0.09); color: var(--green-d); font-weight: 700; }
.lang-picker-menu small { color: var(--text3); font-size: 0.75rem; }
.lang-drawer { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--rail); }
.lang-drawer-title { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 650; color: var(--text3); margin: 0 0 0.4rem 0.85rem; }
.lang-drawer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; }
.lang-drawer-grid button {
  padding: 0.6rem 0.75rem; border-radius: 10px; border: 1px solid var(--rail); background: var(--surface);
  font: 600 0.88rem var(--font-b); color: var(--ink); cursor: pointer; text-align: start;
}
.lang-drawer-grid button[aria-checked="true"] { border-color: var(--green); background: rgba(22,129,63,0.08); color: var(--green-d); }

/* Scripts that Schibsted Grotesk doesn't cover */
html[lang="zh-Hans"] { --font-b: 'Schibsted Grotesk', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif; }
html[lang="ja"]      { --font-b: 'Schibsted Grotesk', 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', sans-serif; }
html[lang="ko"]      { --font-b: 'Schibsted Grotesk', 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; }
html[lang="ar"]      { --font-b: 'Noto Sans Arabic', 'Schibsted Grotesk', 'Geeza Pro', 'Segoe UI', sans-serif; }
html[lang="vi"]      { --font-b: 'Schibsted Grotesk', 'Noto Sans', sans-serif; }
/* Bebas Neue is Latin-only: big headings fall back to the body face in CJK/Arabic */
html[lang="zh-Hans"] :is(h1,h2,h3,.hero-title,.display), html[lang="ja"] :is(h1,h2,h3,.hero-title,.display),
html[lang="ko"] :is(h1,h2,h3,.hero-title,.display), html[lang="ar"] :is(h1,h2,h3,.hero-title,.display) {
  letter-spacing: 0;
}
html[lang="zh-Hans"], html[lang="ja"], html[lang="ko"], html[lang="ar"] { --font-d: 'Bebas Neue', var(--font-b); }
/* While a translation is being applied, keep the English from flashing */
html.i18n-pending body { visibility: hidden; }

/* Right-to-left (Arabic) */
html[dir="rtl"] body { text-align: start; }
html[dir="rtl"] .section-eyebrow::before { margin-right: 0; margin-left: 0.5rem; }
html[dir="rtl"] .nav-links { transform: translateX(100%); }
html[dir="rtl"] .nav-links.open, html[dir="rtl"] .nav-links.active { transform: translateX(0); }
@media (min-width: 769px) {
  html[dir="rtl"] .nav-links { left: auto; right: 0; }
}
html[dir="rtl"] .lang-picker-menu { right: auto; left: 0; }

@media (prefers-reduced-motion: reduce) {
  .btn, .nav-link { transition: none; }
}

/* ── Icon tiles (replace emoji on cards) ──────────────────── */
.profile-card-icon, .feature-icon, .feature-item-icon {
  display: grid; place-items: center; flex-shrink: 0;
  width: 42px; height: 42px; border-radius: 12px;
  background: rgba(22,129,63,0.09); color: var(--green-d); font-size: 0;
}
.feature-item-icon[style*="107,58,31"] { color: var(--gold); }
.feature-item-icon[style*="13,148,136"] { color: var(--teal); }
.feature-item-icon[style*="168,85,247"] { color: #7C3AED; }
.drop-zone-icon { color: var(--green); display: grid; place-items: center; font-size: 0; margin-bottom: 0.75rem; }
.drop-zone-icon .ico { width: 44px; height: 44px; stroke-width: 1.5; }
.empty-icon { color: var(--text3); display: grid; place-items: center; font-size: 0; }
.empty-icon .ico { width: 40px; height: 40px; stroke-width: 1.5; }

/* Nav fit: the member badge never shrinks; the language button drops its
   label on narrower desktops (the globe icon stays). */
.nav-member-badge { flex-shrink: 0; letter-spacing: 0.04em; }
@media (max-width: 1440px) { .nav-lang-desktop .lang-picker-btn > span { display: none; } .nav-lang-desktop .lang-picker-btn { padding: 0 0.6rem; } }
