/* ── My Lucky Horse — shared styles ────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Nunito:wght@400;600;700&display=swap');

/* ── Tokens ─────────────────────────────────────────────────────────────────── */
:root {
  --green:      #1d5c38;
  --green-mid:  #4aaa72;
  --green-dark: #133d25;
  --green-pale: #e8f5ee;
  --gold:       #c8a000;
  --gold-pale:  #fdf6dc;
  --cream:      #faf8f2;
  --white:      #ffffff;
  --text:       #1a1a1a;
  --text-muted: #666;
  --border:     #e0ddd4;
  --shadow:     0 2px 12px rgba(0,0,0,0.08);
  --radius:     12px;
  --radius-sm:  8px;
}

/* ── Reset & base ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', system-ui, sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: 'Playfair Display', Georgia, serif;
  line-height: 1.2;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ── Layout helpers ──────────────────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── Site header ─────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--green);
  color: var(--white);
  padding: 1rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--white);
  text-decoration: none;
}

.site-logo .logo-emoji { font-size: 2rem; }

.site-logo .logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.site-logo .logo-tagline {
  font-size: 0.75rem;
  opacity: 0.8;
  display: block;
  font-weight: 400;
  letter-spacing: 0.5px;
}

.header-nav a {
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
  font-weight: 600;
  margin-left: 1.25rem;
}

.header-nav a:hover { color: var(--white); text-decoration: none; }

.lang-flag {
  margin-left: 0.5rem;
  padding: 0.15rem 0.6rem;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* ── Site footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--green-dark);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 4rem;
  font-size: 0.85rem;
}

.site-footer a { color: rgba(255,255,255,0.85); }
.site-footer .disclaimer {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  opacity: 0.6;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Bookies bar ─────────────────────────────────────────────────────────────── */
.bookies-bar {
  background: var(--gold-pale);
  border-top: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  padding: 1rem 0;
  text-align: center;
  margin: 2.5rem 0;
}

.bookies-bar p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bookies-links {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.bookie-btn {
  display: inline-block;
  padding: 0.45rem 1.1rem;
  background: var(--green);
  color: var(--white) !important;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none !important;
  transition: background 0.15s, transform 0.1s;
}

.bookie-btn:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
}

/* ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ─ */
/*  HOME PAGE STYLES                                                              */
/* ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ─ */

/* ── Hero ────────────────────────────────────────────────────────────────────── */
.home-hero {
  background: linear-gradient(135deg, var(--green-mid) 0%, var(--green) 100%);
  color: var(--white);
  padding: 3.5rem 0 3rem;
  text-align: center;
}

.home-hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin-bottom: 0.75rem;
}

.home-hero .subtitle {
  font-size: 1.15rem;
  opacity: 0.85;
  max-width: 540px;
  margin: 0 auto 2rem;
}

.home-search {
  display: flex;
  max-width: 480px;
  margin: 0 auto;
  border-radius: 50px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

.home-search input {
  flex: 1;
  border: none;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}

.home-search button {
  border: none;
  background: var(--gold);
  color: var(--text);
  padding: 0.85rem 1.4rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.home-search button:hover { background: #b08c00; }

#search-hint {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  opacity: 0.75;
  min-height: 1.2em;
}

/* ── Stats strip ─────────────────────────────────────────────────────────────── */
.stats-strip {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0;
}

.stats-strip .container {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}

.stat-item { text-align: center; }
.stat-item .stat-num { font-size: 1.4rem; font-weight: 700; color: var(--green); }
.stat-item .stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Section headings ────────────────────────────────────────────────────────── */
.section-heading {
  font-size: 1.5rem;
  color: var(--green);
  margin: 2.5rem 0 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--green-pale);
}

/* ── Category cards grid ─────────────────────────────────────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 3rem;
}

.cat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none !important;
  color: var(--text) !important;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  cursor: pointer;
}

.cat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  border-color: var(--green);
  text-decoration: none !important;
}

.cat-card .cat-emoji { font-size: 2rem; }
.cat-card .cat-label { font-family: 'Playfair Display', serif; font-size: 1.1rem; font-weight: 700; }
.cat-card .cat-count {
  display: inline-block;
  background: var(--green-pale);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 20px;
  align-self: flex-start;
}
.cat-card .cat-desc { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ── No results message ──────────────────────────────────────────────────────── */
.no-results {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ─ */
/*  CATEGORY PAGE STYLES                                                          */
/* ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ── ─ */

/* ── Category hero ───────────────────────────────────────────────────────────── */
.cat-hero {
  background: linear-gradient(135deg, var(--green-mid) 0%, var(--green) 100%);
  color: var(--white);
  padding: 2.5rem 0 2rem;
}

.cat-hero .breadcrumb {
  font-size: 0.85rem;
  opacity: 0.75;
  margin-bottom: 0.75rem;
}

.cat-hero .breadcrumb a { color: rgba(255,255,255,0.85); }

.cat-hero-inner {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}

.cat-hero-emoji { font-size: 3.5rem; line-height: 1; }

.cat-hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }

.cat-hero .cat-hero-desc {
  font-size: 1.05rem;
  opacity: 0.85;
  margin-top: 0.4rem;
  max-width: 600px;
}

.cat-hero .cat-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  opacity: 0.8;
}

/* ── Stories section ─────────────────────────────────────────────────────────── */
.stories-section { margin: 2.5rem 0; }

.story-card {
  background: var(--gold-pale);
  border: 1px solid var(--gold);
  border-left: 5px solid var(--gold);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.story-card.featured { border-left-color: var(--green); background: var(--green-pale); }

.story-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.story-headline {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  color: var(--green);
}

.story-badge {
  background: var(--gold);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.story-body { font-size: 0.95rem; line-height: 1.7; }

.story-meta {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.story-meta strong { color: var(--text); }

/* ── Data disclaimer box ─────────────────────────────────────────────────────── */
.data-disclaimer {
  background: #fff8e8;
  border: 1px solid #e8cc80;
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #5a4a00;
  margin-top: 1.5rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

/* ── Horses grid ─────────────────────────────────────────────────────────────── */
.horses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

/* ── Horse card ──────────────────────────────────────────────────────────────── */
.horse-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.horse-card-head {
  background: var(--green);
  color: var(--white);
  padding: 0.9rem 1.1rem 0.75rem;
  position: relative;
}

/* ── Position badge (shown after race has run) ───────────────────────────────── */
.position-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  line-height: 1;
}

.position-badge.pos-1  { background: #ffd700; color: #5a4000; }  /* gold */
.position-badge.pos-2  { background: #c0c0c0; color: #2a2a2a; }  /* silver */
.position-badge.pos-3  { background: #cd7f32; color: #fff; }      /* bronze */
.position-badge.pos-n  { background: rgba(255,255,255,0.2); color: #fff; } /* other */
.position-badge.pos-nr { background: #c0392b; color: #fff; }      /* PU/UR/F etc. */

/* ── SP badge ────────────────────────────────────────────────────────────────── */
.sp-badge {
  background: var(--gold-pale);
  color: #7a5f00;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
}

.horse-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
}

.horse-match-tag {
  display: inline-block;
  margin-top: 0.3rem;
  background: rgba(255,255,255,0.2);
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.horse-card-body { padding: 1rem 1.1rem; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }

.race-where {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.race-course { font-weight: 700; font-size: 1rem; }
.race-time   { font-size: 0.9rem; color: var(--text-muted); }

.race-date-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -0.25rem;
}

.race-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0.25rem 0;
}

.chip {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-weight: 600;
  background: var(--green-pale);
  color: var(--green);
}

.chip.chip-type { background: #e8edf5; color: #2a4a7a; }
.chip.chip-going { background: #fdf0e8; color: #8a4a10; }
.chip.chip-prize { background: var(--gold-pale); color: #7a5f00; }

.horse-connections {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.2rem 0.5rem;
  margin-top: 0.25rem;
}

.horse-connections span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.horse-connections strong { color: var(--text); }

.horse-form-row {
  display: flex;
  gap: 1rem;
  font-size: 0.82rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.form-string {
  font-family: monospace;
  font-size: 0.9rem;
  letter-spacing: 1px;
  color: var(--green-dark);
  font-weight: 700;
}

.form-debut { color: var(--gold); font-style: italic; }

.rating-badge {
  background: var(--green-pale);
  color: var(--green);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
}

.rpr-badge {
  background: #eef3ff;
  color: #3050a0;
}

.btn-badge {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.horse-comment {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  line-height: 1.4;
}

.last-run-badge {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.last-run-badge.long-absence { color: #c05000; font-weight: 700; }

.horse-card-foot {
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--border);
  background: #f9f9f7;
}

.find-bookie-btn {
  display: block;
  text-align: center;
  background: var(--gold);
  color: var(--text) !important;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  text-decoration: none !important;
  transition: background 0.15s;
}

.find-bookie-btn:hover { background: #b08c00; }

/* ── Past horse card variant ─────────────────────────────────────────────────── */
.horse-card.past .horse-card-head {
  background: #4a5568;   /* muted slate instead of racing green */
}

.horse-card.past {
  opacity: 0.88;
}

.horse-card.past .horse-match-tag {
  background: rgba(255,255,255,0.15);
}

/* ── Race name (truncated) ───────────────────────────────────────────────────── */
.race-full-name {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: -0.1rem;
}

/* ── Loading & error states ──────────────────────────────────────────────────── */
.loading-msg, .error-msg {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.loading-msg .spinner {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  animation: spin 1.5s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-msg { color: #c0392b; }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .home-hero { padding: 2.5rem 0 2rem; }
  .cat-hero-inner { flex-direction: column; gap: 0.75rem; }
  .cat-hero-emoji { font-size: 2.5rem; }
  .horses-grid { grid-template-columns: 1fr; }
  .horse-connections { grid-template-columns: 1fr; }
  .header-nav { display: none; }
}
