/* ============================================================
   FIFA Match Calendar — styles.css
   Mobile-first. A "fixture board" look: warm paper background,
   deep pitch green, big condensed type for dates/teams/times.

   All colors live in CSS variables below — change them once,
   the whole site follows. Dark mode overrides the same
   variables via prefers-color-scheme (no JavaScript involved).
   ============================================================ */

:root {
  /* Colors */
  --bg: #f5f4ee;          /* warm paper */
  --card: #ffffff;
  --ink: #181d20;         /* near-black text */
  --muted: #5c6670;       /* secondary text */
  --line: #e2e1d8;        /* borders */
  --accent: #0c7a3d;      /* pitch green */
  --accent-soft: #e3efe4; /* pale green fill (Today pill) */
  --live: #d92b2b;        /* live red */
  --friendly-bg: #f4e9cd; /* amber fill for the Friendly tag */
  --friendly-ink: #8a6a16;

  /* Type */
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Barlow", "Helvetica Neue", Arial, sans-serif;

  /* Shape */
  --radius: 14px;
  --shadow: 0 1px 2px rgba(24, 29, 32, 0.05), 0 4px 14px rgba(24, 29, 32, 0.05);
}

/* Dark mode: same variables, darker values. Applied automatically
   when the device prefers a dark color scheme. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161a;
    --card: #1a2126;
    --ink: #eef1f3;
    --muted: #9fabb5;
    --line: #2a323a;
    --accent: #3fbf74;
    --accent-soft: #16321f;
    --live: #ff5d5d;
    --friendly-bg: #3a3015;
    --friendly-ink: #e4c269;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);
  }
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  border-top: 4px solid var(--accent); /* broadcast-style top stripe */
}

.wrap {
  max-width: 44rem;
  margin-inline: auto;
  padding-inline: 16px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 5px;
}

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Screen-reader-only helper (search label) */
.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;
}

/* ---------- Page header ---------- */

.site-header { padding: 26px 0 14px; }

.kicker {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.site-header h1 {
  margin: 2px 0 6px;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.tz-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}

/* ---------- Sticky controls (search + filters + timezone) ---------- */

.controls {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 10px 0 12px;
}

#search {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
}
#search::placeholder { color: var(--muted); }
#search:focus { border-color: var(--accent); outline: none; }

.control-rows {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.control-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Timezone group hugs the right edge when there is room */
.tz-group { margin-left: auto; }

.chip {
  min-height: 42px;
  padding: 0 14px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { border-color: var(--muted); }

/* Active filter: solid ink. Active timezone: solid green.
   Different colors so the two groups read as separate controls. */
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.chip-tz[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Selected-team pill (shown in the sticky bar when a team is tapped) */
.team-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--accent-soft);
  border-radius: 10px;
}
.team-bar-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.team-bar-label .flag { width: 22px; height: 15px; }
.team-bar-note { color: var(--muted); font-weight: 500; font-size: 0.9rem; }
.team-clear {
  margin-left: auto;
  min-height: 36px;
  padding: 0 12px;
  background: none;
  border: 1.5px solid transparent;
  border-radius: 8px;
  color: var(--accent);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.team-clear:hover { border-color: var(--accent); }

/* ---------- Day sections ---------- */

main { padding-bottom: 8px; }

.result-line {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.day {
  margin-top: 26px;
  scroll-margin-top: 175px; /* keep day headers visible below the sticky controls */
}

.day-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 12px;
  padding-bottom: 7px;
  border-bottom: 3px solid var(--ink);
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
}

.day-count {
  margin-left: auto;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.day-pill {
  align-self: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.day-pill.is-soft {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Match cards ---------- */

.match-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 12px;
}

.card.is-live { border-color: var(--live); }

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.time {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* Badge group (Friendly tag + status), right side of the card top row */
.badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Amber tag marking friendlies — distinct from every status badge */
.tag-friendly {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--friendly-bg);
  color: var(--friendly-ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.badge-upcoming { color: var(--muted); border: 1.5px solid var(--line); }
.badge-final    { background: var(--ink); color: var(--bg); }
.badge-other    { background: var(--accent-soft); color: var(--accent); }
.badge-live     { background: var(--live); color: #fff; }
.badge-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: live-pulse 1.3s ease-in-out infinite;
}
@keyframes live-pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) {
  .badge-live::before { animation: none; }
}

/* Team names — the big readable line */
.teams {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 10px;
  row-gap: 4px;
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.1;
}

/* A team = flag + name, kept together as one wrapping unit.
   It's a <button>: tapping it filters the calendar to that team. */
.team {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: underline dotted 1.5px;
  text-decoration-color: color-mix(in srgb, var(--muted) 40%, transparent);
  text-underline-offset: 5px;
}
.team:hover,
.team:focus-visible {
  text-decoration-style: solid;
  text-decoration-color: var(--accent);
}

.flag {
  width: 28px;
  height: 19px;
  object-fit: cover;          /* uniform size whatever the flag's ratio */
  border-radius: 3px;
  box-shadow: 0 0 0 1px var(--line);
  flex: none;
}

.vs {
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.score-dash { padding-inline: 4px; color: var(--muted); font-weight: 600; }
.is-live .score { color: var(--live); }

/* Competition / venue lines */
.meta {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.meta + .meta-place { margin-top: 2px; }

/* Card buttons */
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;       /* comfortable touch target */
  padding: 0 14px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.is-flash { border-color: var(--accent); color: var(--accent); }

.btn-solid {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-solid:hover { border-color: var(--accent); filter: brightness(1.08); }

/* ---------- Empty state & errors ---------- */

.empty {
  margin-top: 30px;
  padding: 30px 20px;
  text-align: center;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
}
.empty-hint { margin: 0 0 16px; color: var(--muted); }
.empty .btn-solid { justify-content: center; }

.loading, .load-error { margin-top: 28px; color: var(--muted); }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 44px;
  padding: 18px 0 56px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}
.site-footer p { margin: 0 0 8px; }

/* ---------- Larger screens: a little more air ---------- */

@media (min-width: 640px) {
  .wrap { padding-inline: 24px; }
  .site-header { padding-top: 40px; }
  .card { padding: 16px 20px 14px; }
  .time { font-size: 1.7rem; }
  .teams { font-size: 1.7rem; }
  .day-head { font-size: 1.9rem; }
}
