:root {
  --navy: #071d3c;
  --navy-2: #0d2d55;
  --blue: #18599a;
  --gold: #f4c542;
  --gold-deep: #d69b13;
  --cream: #fff8e6;
  --paper: #fffdf8;
  --ink: #102033;
  --muted: #667085;
  --line: rgba(7, 29, 60, 0.15);
  --page-width: min(850px, calc(100vw - 32px));
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(24, 89, 154, 0.14), transparent 28rem),
    #eef2f6;
}

button, input, select, textarea { font: inherit; }

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 48px);
  color: white;
  border-bottom: 3px solid var(--gold);
  background: rgba(7, 29, 60, 0.97);
  box-shadow: 0 6px 24px rgba(7, 29, 60, 0.2);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--navy);
  border: 2px solid white;
  border-radius: 50%;
  background: var(--gold);
  font: 900 26px/1 "Barlow Condensed", sans-serif;
}

.brand strong, .brand small { display: block; }
.brand strong { font: 800 19px/1 "Barlow Condensed", sans-serif; letter-spacing: 0.03em; text-transform: uppercase; }
.brand small { margin-top: 3px; color: #c8d5e5; font-size: 11px; }

.header-actions { display: flex; align-items: center; gap: 12px; }
.page-count { color: #c8d5e5; font-size: 12px; }

.print-button {
  padding: 10px 14px;
  color: var(--navy);
  border: 0;
  border-radius: 8px;
  background: var(--gold);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.14);
  font-weight: 800;
  cursor: pointer;
}

.print-button:hover { background: #ffd45a; }

main { padding: clamp(22px, 4vw, 48px) 0 64px; }

.program-stack {
  display: grid;
  justify-items: center;
  gap: clamp(24px, 5vw, 52px);
}

.program-page {
  position: relative;
  width: var(--page-width);
  aspect-ratio: 8.5 / 11;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 18px 50px rgba(7, 29, 60, 0.2), 0 2px 8px rgba(7, 29, 60, 0.12);
}

.program-page::before {
  position: absolute;
  z-index: 2;
  inset: 0;
  border: clamp(5px, 0.8vw, 10px) solid var(--navy);
  pointer-events: none;
  content: "";
}

.program-page::after {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 0;
  width: 18%;
  height: 8px;
  background: var(--gold);
  content: "";
}

.page-number {
  position: absolute;
  z-index: 10;
  right: 17px;
  bottom: 12px;
  display: grid;
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  place-items: center;
  color: white;
  border-radius: 50%;
  background: var(--navy);
  font: 800 14px/1 "Barlow Condensed", sans-serif;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 1.6% 2.3% 1.2%;
  color: white;
  background: var(--navy);
}

.section-heading h2 {
  margin: 0;
  font: 900 clamp(22px, 4.2vw, 50px)/0.88 "Barlow Condensed", sans-serif;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.section-kicker {
  order: 2;
  color: var(--gold);
  font: 700 clamp(8px, 1.2vw, 13px)/1 Inter, sans-serif;
  letter-spacing: 0.12em;
  text-align: right;
  text-transform: uppercase;
}

.media-frame { position: relative; overflow: hidden; background: #d9e0e8; }
.media-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }

.image-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 72px;
  place-content: center;
  gap: 6px;
  color: #6f7d8c;
  background:
    linear-gradient(135deg, rgba(255,255,255,.55) 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(315deg, rgba(255,255,255,.55) 25%, transparent 25%) 0 0 / 18px 18px,
    #dce3ea;
  text-align: center;
}

.image-placeholder span { color: var(--gold-deep); font-size: clamp(18px, 4vw, 42px); }
.image-placeholder strong { padding: 0 8px; font: 800 clamp(9px, 1.5vw, 16px)/1.1 "Barlow Condensed", sans-serif; letter-spacing: 0.08em; text-transform: uppercase; }

/* Cover */
.cover-page {
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 9% 8% 7%;
  color: white;
  background:
    linear-gradient(to bottom, rgba(2, 14, 33, 0.35), rgba(2, 14, 33, 0.92)),
    url("./assets/template/cover-base.png") center / cover,
    var(--navy);
}

.cover-page::before { border-width: clamp(8px, 1.4vw, 16px); border-color: var(--gold); }
.cover-page::after { display: none; }
.cover-page .page-number { display: none; }

.cover-title {
  position: relative;
  z-index: 3;
  margin: -3% -2% 0;
  padding: 3% 3% 3.5%;
  border: 2px solid rgba(244, 197, 66, .8);
  border-bottom-width: clamp(5px, .8vw, 9px);
  background: rgba(7, 29, 60, .96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
  text-align: center;
  text-transform: uppercase;
}
.cover-kicker { color: var(--gold); font: 800 clamp(12px, 2.2vw, 24px)/1 "Barlow Condensed", sans-serif; letter-spacing: .17em; }
.cover-title h1 { max-width: 90%; margin: 1.5% auto 0; font: 900 clamp(42px, 8vw, 86px)/0.82 "Barlow Condensed", sans-serif; letter-spacing: -0.02em; text-shadow: 0 3px 16px rgba(0,0,0,.5); }
.cover-opponent { margin: 2% 0 0; color: white; font: 800 clamp(16px, 3vw, 30px)/1 "Barlow Condensed", sans-serif; letter-spacing: .08em; }

.team-photo {
  z-index: 3;
  align-self: center;
  width: 100%;
  height: 64%;
  border: clamp(6px, 1vw, 12px) solid white;
  box-shadow: 0 12px 34px rgba(0,0,0,.4);
}

.cover-footer {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  text-transform: uppercase;
}

.cover-footer span { font: 700 clamp(10px, 1.6vw, 18px)/1 "Barlow Condensed", sans-serif; letter-spacing: .08em; }
.cover-footer strong { color: var(--gold); font: 900 clamp(34px, 7vw, 72px)/.8 "Barlow Condensed", sans-serif; }

/* Sponsors */
.sponsor-page { padding: 3.5%; background: linear-gradient(180deg, white, #faf8f1); }
.sponsor-grid { display: grid; width: 100%; height: 100%; grid-template: repeat(2, minmax(0, 1fr)) / repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 2.2%; }
.sponsor-slot { display: flex; min-width: 0; min-height: 0; flex-direction: column; overflow: hidden; color: var(--navy); border: 2px solid rgba(7,29,60,.18); border-radius: 4px; background: white; text-align: center; }
.sponsor-size-full { grid-column: span 2; grid-row: span 2; }
.sponsor-size-half { grid-column: span 2; }
.sponsor-size-quarter { grid-column: span 1; }
.sponsor-creative { display: grid; min-width: 0; min-height: 0; flex: 1 1 auto; place-content: center; overflow: hidden; padding: 3%; }
.sponsor-creative img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.sponsor-creative strong { font: 800 clamp(12px, 2.4vw, 25px)/1 "Barlow Condensed", sans-serif; text-transform: uppercase; }
.sponsor-placeholder-mark { display: inline-block; margin: 0 auto 2%; padding: .5em .8em; color: var(--navy); background: var(--gold); font: 900 clamp(9px, 1.4vw, 14px)/1 "Barlow Condensed", sans-serif; letter-spacing: .12em; }
.sponsor-info { display: flex; align-items: center; justify-content: space-between; gap: 2%; min-height: 8%; padding: 1.2% 2%; color: white; border-top: 4px solid var(--gold); background: var(--navy); text-align: left; }
.sponsor-name { overflow: hidden; font: 800 clamp(9px, 1.5vw, 16px)/1 "Barlow Condensed", sans-serif; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.sponsor-contacts { display: flex; justify-content: flex-end; gap: .8em; min-width: 0; }
.sponsor-contacts a { overflow: hidden; color: white; font-size: clamp(7px, 1vw, 11px); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.sponsor-size-quarter .sponsor-info { display: grid; align-content: center; }
.sponsor-size-quarter .sponsor-contacts { justify-content: start; }

/* Coaches, captains, seniors */
.coaches-page, .features-page, .people-page { display: grid; grid-template-rows: 1fr 1fr; padding: 3.4%; gap: 2%; }
.half-section, .feature-half { display: grid; min-height: 0; grid-template-rows: auto 1fr auto; overflow: hidden; border: 1px solid var(--line); background: white; }
.half-section .media-frame, .feature-half .media-frame { min-height: 0; }
.name-strip { min-height: 6.2%; margin: 0; padding: 1.3% 2%; color: var(--navy); border-top: 4px solid var(--gold); background: var(--cream); font: 700 clamp(9px, 1.45vw, 15px)/1.25 "Barlow Condensed", sans-serif; text-align: center; white-space: pre-line; }
.schedule-block .media-frame { background: white; }
.schedule-block .media-frame img { object-fit: contain; }

/* Roster */
.roster-page { display: grid; grid-template-rows: auto 1fr auto; padding: 3.2%; gap: 1.5%; }
.player-grid { display: grid; min-height: 0; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 1.2%; }
.player-card { display: grid; min-width: 0; min-height: 0; grid-template-rows: 1fr auto; overflow: hidden; border: 1px solid rgba(7,29,60,.25); background: white; box-shadow: 0 3px 8px rgba(7,29,60,.1); }
.player-photo { min-height: 0; }
.player-label { display: grid; grid-template-columns: auto 1fr; align-items: center; min-width: 0; color: white; background: var(--navy); }
.player-index { display: grid; align-self: stretch; min-width: 2.2em; place-items: center; color: var(--navy); background: var(--gold); font: 900 clamp(10px, 1.8vw, 19px)/1 "Barlow Condensed", sans-serif; }
.player-name { min-width: 0; padding: 5% 6%; }
.player-name strong, .player-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-name strong { font: 800 clamp(8px, 1.35vw, 14px)/1 "Barlow Condensed", sans-serif; text-transform: uppercase; }
.player-name span { margin-top: 3px; color: #cad7e5; font-size: clamp(6px, .95vw, 10px); }
.not-pictured { display: flex; align-items: baseline; gap: 2%; padding: 1.2% 2%; color: var(--navy); background: var(--gold); }
.not-pictured strong { flex: 0 0 auto; font: 900 clamp(10px, 1.5vw, 16px)/1 "Barlow Condensed", sans-serif; text-transform: uppercase; }
.not-pictured p { margin: 0; font-size: clamp(7px, 1vw, 11px); }

/* Action */
.action-page { display: grid; grid-template-rows: auto 1fr auto; padding: 3.2%; gap: 1.4%; background: var(--navy); }
.action-page .section-heading { color: var(--navy); background: var(--gold); }
.action-page .section-kicker { color: var(--navy); }
.action-photo { min-height: 0; border: clamp(5px, .8vw, 10px) solid white; }
.action-caption { margin: 0; padding: 1.2% 2%; color: white; border-left: 6px solid var(--gold); font: 700 clamp(9px, 1.4vw, 15px)/1.3 "Barlow Condensed", sans-serif; }

.load-error { display: grid; gap: 8px; width: min(560px, calc(100vw - 32px)); padding: 32px; color: #7a271a; border: 1px solid #f4b8ad; border-radius: 12px; background: #fff0ed; }
.site-footer { display: flex; justify-content: space-between; gap: 16px; padding: 26px clamp(16px, 4vw, 48px); color: #c8d5e5; border-top: 4px solid var(--gold); background: var(--navy); font-size: 12px; }

@media (max-width: 640px) {
  :root { --page-width: calc(100vw - 16px); }
  .site-header { min-height: 64px; padding: 9px 12px; }
  .brand-mark { width: 36px; height: 36px; font-size: 22px; }
  .brand strong { font-size: 16px; }
  .brand small { font-size: 9px; }
  .page-count { display: none; }
  .print-button { padding: 9px 10px; font-size: 12px; }
  main { padding-top: 14px; }
  .program-stack { gap: 18px; }
  .program-page { box-shadow: 0 9px 28px rgba(7,29,60,.18); }
  .page-number { right: 9px; bottom: 7px; min-width: 22px; height: 22px; font-size: 10px; }
  .site-footer { display: grid; }
}

@page { size: Letter portrait; margin: 0; }

@media print {
  html, body { width: 8.5in; margin: 0; background: white; }
  .site-header, .site-footer { display: none !important; }
  main { padding: 0; }
  .program-stack { display: block; }
  .program-page { width: 8.5in; height: 11in; margin: 0; break-after: page; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .program-page:last-child { break-after: auto; }
}
