:root {
  color-scheme: light;
  --paper: #f8f5ef;
  --white: #fffdfa;
  --ink: #25191a;
  --muted: #695c58;
  --line: #e6ddd2;
  --wine: #711f2d;
  --wine-dark: #47131e;
  --gold: #f4c477;
  --heading: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "DM Sans", system-ui, sans-serif;
  font-family: var(--body);
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, select, input { font: inherit; }
button, select { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
a { color: inherit; }
:focus-visible { outline: 3px solid #af641e; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--heading); line-height: .98; }
h2 { font-size: clamp(2.15rem, 5vw, 2.7rem); }
.shell { width: min(1160px, calc(100% - 64px)); margin-inline: auto; }

.site-header { background: var(--white); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; justify-content: space-between; align-items: center; min-height: 76px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.brand img { display: block; object-fit: contain; border-radius: 5px; }
.brand strong { display: block; letter-spacing: -.045em; font-size: 1.23rem; font-weight: 800; line-height: 1.1; }
.brand small { display: block; color: var(--muted); font-size: .76rem; margin-top: 3px; }
.header-link { color: var(--wine); text-decoration: none; font-weight: 700; font-size: .84rem; }
.header-link span { padding-left: 4px; }
.header-link:hover { text-decoration: underline; }

.hero {
  isolation: isolate;
  position: relative;
  display: grid;
  align-items: end;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 310px);
  gap: 24px;
  min-height: 350px;
  margin-top: 24px;
  padding: clamp(25px, 4vw, 46px);
  overflow: hidden;
  border-radius: 22px;
  background: #3b101a;
  color: #fff8ed;
}
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background-image: linear-gradient(90deg, #3b101a 0%, rgba(54, 15, 25, .9) 31%, rgba(53, 14, 23, .18) 77%, rgba(44, 14, 18, .18)), url("/campo.webp");
  background-size: cover;
  background-position: center, center 58%;
}
.hero-copy { align-self: center; }
.eyebrow { color: var(--gold); font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.hero h1 { font-size: clamp(3.5rem, 7.6vw, 6.2rem); font-weight: 800; letter-spacing: -.015em; margin-block: 10px 20px; }
.hero-link {
  display: inline-flex; align-items: center; gap: 16px; border: 1px solid #f0be786e;
  color: var(--gold); padding: 9px 13px; text-decoration: none; font-weight: 800; font-size: .86rem; border-radius: 7px;
}
.hero-link:hover { background: #f0be7820; }
.next-match {
  padding: 17px 19px; border: 1px solid #f4c47752; background: #281218ed; border-radius: 13px;
  box-shadow: 0 6px 25px #19090e2e;
}
.next-match p { font-size: .83rem; }
.next-match .eyebrow { font-size: .68rem; }
.next-match time { color: #f4dcb7; display: block; margin-block: 7px; font-size: .82rem; }
.next-match strong { display: block; line-height: 1.25; margin-bottom: 5px; }
.next-match p:last-child { color: #e4cfd0; }

.teams-section, .schedule { margin-top: 32px; }
.section-title { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.soft-button, .icon-button, .mode-button, .primary-button, .field-select select {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  padding: 9px 13px;
  border-radius: 8px;
  font-weight: 700;
  font-size: .87rem;
}
.soft-button:hover, .icon-button:hover:not(:disabled), .mode-button:hover { border-color: #c0a8a4; }
.soft-button[aria-pressed="true"] { color: var(--wine); background: #f1e4e3; border-color: #e0cdcf; }
.primary-button { background: var(--wine); color: white; border-color: var(--wine); }
.primary-button:hover:not(:disabled) { background: var(--wine-dark); }

.team-fip-2016 { --team: #8b2738; --team-wash: #f4e3e5; }
.team-fip-2017 { --team: #855618; --team-wash: #f5e8d0; }
.team-csi-u12 { --team: #2d5673; --team-wash: #e3ecf3; }
.team-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.team-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 106px;
  padding: 14px 15px 13px 17px;
  text-align: left;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 4px solid var(--team);
  border-radius: 11px;
}
.team-card:hover { border-color: var(--team); }
.team-card[aria-pressed="true"] { background: var(--team-wash); border-color: var(--team); }
.team-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.team-league { color: var(--team); font-size: .69rem; font-weight: 800; letter-spacing: .075em; text-transform: uppercase; }
.team-card strong { font-size: 1rem; line-height: 1.18; font-weight: 800; }
.team-card small { color: var(--muted); font-size: .8rem; }
.team-count { font-size: .71rem; white-space: nowrap; color: var(--team); }

.schedule { scroll-margin-top: 18px; }
.schedule-title { margin-bottom: 12px; align-items: end; }
.muted { color: var(--muted); font-size: .85rem; margin-top: 7px; }
.segmented { display: inline-flex; gap: 3px; background: #ede7de; border-radius: 10px; padding: 3px; }
.mode-button { background: transparent; border-color: transparent; color: var(--muted); }
.mode-button[aria-pressed="true"] { color: var(--wine); background: var(--white); border-color: var(--line); box-shadow: 0 1px 2px #48240412; }

.schedule-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 9px; min-height: 40px; }
.month-control { display: flex; align-items: stretch; gap: 6px; }
.month-control .icon-button { min-width: 36px; font-size: 1.3rem; line-height: 1; padding: 6px; }
.timezone { color: var(--muted); font-size: .78rem; }
.match-group { margin: 18px 0; }
.group-title { font-size: .94rem; color: var(--wine); font-weight: 800; margin: 0 0 8px 2px; text-transform: capitalize; }
.match-list { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--white); }
.match {
  display: grid;
  grid-template-columns: 74px minmax(0, 1.28fr) minmax(0, .84fr) auto;
  align-items: center;
  gap: 17px;
  padding: 13px 16px 13px 13px;
  min-height: 93px;
  border-left: 3px solid var(--team);
}
.match + .match { border-top: 1px solid var(--line); }
.match-date { display: grid; justify-items: center; gap: 3px; border-right: 1px solid var(--line); padding-right: 12px; color: var(--wine-dark); }
.match-date b { font: 700 2.2rem/.95 var(--heading); }
.match-date small { color: var(--muted); text-transform: uppercase; font-size: .67rem; font-weight: 700; }
.match-date span { color: var(--ink); font-size: .8rem; font-weight: 800; }
.match-play { min-width: 0; }
.match-play p { margin-top: 5px; font-weight: 750; font-size: .99rem; line-height: 1.3; overflow-wrap: anywhere; }
.match-play .versus { color: var(--muted); font-size: .83rem; font-weight: 500; white-space: nowrap; }
.match-team { color: var(--team); font-weight: 800; font-size: .75rem; }
.match-venue strong { display: block; font-size: .87rem; }
.match-venue small { display: block; margin-top: 4px; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.match-venue a { text-decoration: none; }
.match-venue a:hover { color: var(--wine); text-decoration: underline; }
.match-tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; justify-content: end; }
.badge { white-space: nowrap; color: var(--team); background: var(--team-wash); font-size: .73rem; font-weight: 800; padding: 5px 8px; border-radius: 6px; }
.badge.status { color: #7c1829; background: #f5e1e2; }
.empty { padding: 21px 17px; border: 1px dashed #cbbaad; color: var(--muted); border-radius: 9px; margin-top: 14px; }
.error-text { color: #8b2738; }

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
  margin: 11px 0 17px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--line);
  gap: 1px;
}
.month-day-head { background: #f0e9df; text-align: center; padding: 8px 0; color: var(--muted); font-size: .75rem; font-weight: 800; }
.month-day {
  display: flex; flex-direction: column; gap: 5px; align-items: flex-start;
  min-width: 0; min-height: 68px; background: var(--white); color: var(--ink);
  border: 0; padding: 7px 8px; text-align: left;
}
.month-day:disabled { opacity: 1; color: #776b65; }
.month-day:not(:disabled):hover { background: #f7eee8; }
.month-day[aria-pressed="true"] { background: #f0e2e3; box-shadow: inset 0 0 0 2px var(--wine); }
.month-day[aria-current="date"] b { color: var(--wine); text-decoration: underline; }
.month-day.blank { background: #f6f1ea; }
.month-day > b { font-size: .86rem; }
.day-event { display: flex; align-items: center; gap: 4px; width: 100%; color: var(--team); font-weight: 800; font-size: .66rem; }
.day-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-dot { flex: none; width: 6px; height: 6px; background: var(--team); border-radius: 50%; }
.day-selection { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 9px; }
.day-selection h3 { font-size: .92rem; }

.site-footer { border-top: 1px solid var(--line); margin-top: 35px; background: var(--white); }
.footer-inner { display: flex; gap: 14px; align-items: center; min-height: 75px; font-size: .84rem; }
.footer-inner span { color: var(--muted); }

.admin-main { padding-block: 35px 45px; }
.admin-title { margin-bottom: 18px; }
.admin-title h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); }
.notice { background: #f7e9d0; color: #624319; border-radius: 9px; padding: 11px 14px; margin-bottom: 13px; font-size: .88rem; }
.notice.success { background: #e6efe6; color: #264827; }
.admin-filter { display: block; margin: 17px 0 10px; }
.sync-tag { display: block; color: var(--muted); margin-top: 6px; font-size: .76rem; }
dialog {
  width: min(540px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 0;
  border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--white);
}
dialog::backdrop { background: #21131896; }
.editor { padding: 22px; }
.editor h2 { font-size: 2.15rem; }
.editor .icon-button { padding: 4px 10px; font-size: 1.2rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: .87rem; font-weight: 700; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid input, .form-grid select { border: 1px solid #d6c7ba; padding: 8px; border-radius: 7px; width: 100%; min-width: 0; background: #fff; color: var(--ink); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 17px; }
.form-error { color: var(--wine); font-size: .86rem; margin-top: 10px; }

.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: absolute; z-index: 1; left: 8px; top: 8px; padding: 8px; background: white; }

@media (max-width: 840px) {
  .shell { width: calc(100% - 40px); }
  .hero { min-height: 315px; }
  .match { grid-template-columns: 61px minmax(0, 1fr) minmax(0, .7fr); gap: 12px; }
  .match-tags { grid-column: 2 / -1; justify-content: start; }
}
@media (max-width: 570px) {
  .shell { width: calc(100% - 26px); }
  .header-inner { min-height: 66px; }
  .brand img { width: 40px; height: 40px; }
  .brand strong { font-size: 1.12rem; }
  .brand small, .header-link { font-size: .72rem; }
  .hero { grid-template-columns: 1fr; gap: 16px; padding: 24px 18px 17px; margin-top: 13px; border-radius: 15px; }
  .hero::before { background-position: center, 63% center; }
  .hero h1 { margin-block: 8px 13px; }
  .next-match { padding: 10px 13px; }
  .next-match time { margin-block: 4px; }
  .teams-section, .schedule { margin-top: 24px; }
  .team-grid { grid-template-columns: 1fr; gap: 7px; }
  .team-card { min-height: 0; gap: 4px; padding: 10px 11px; }
  .match { grid-template-columns: 45px minmax(0, 1fr); gap: 8px 10px; padding: 10px 10px 10px 7px; }
  .match-date { grid-row: 1 / 4; align-self: start; padding-right: 7px; }
  .match-date b { font-size: 1.85rem; }
  .match-venue, .match-tags { grid-column: 2; }
  .match-play p { font-size: .91rem; overflow-wrap: anywhere; }
  .match-venue small { margin-top: 1px; }
  .month-day { align-items: center; padding: 5px 2px; min-height: 46px; gap: 3px; }
  .day-label { display: none; }
  .day-event { width: auto; }
  .day-dots { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; }
  .editor { padding: 15px; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
