@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond-roman.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond-italic.woff2") format("woff2");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #f6efe2;
  --tile: #fbf7ee;
  --ink: #1f2d24;
  --muted: #4f5c53;
  --hairline: rgb(31 45 36 / 0.15);
  --tile-border: #1f2d24;
  --today: rgb(47 90 60 / 0.09);

  --orange: #d9622b;
  --red: #a8322d;
  --gold: #e0a526;
  --ridge-near: #7d93a6;
  --ridge-mid: #9bafc0;
  --ridge-far: #b9c6d1;
  --route: #8a8f86;
  --cart-a: #2e5a3c;
  --cart-b: #c0561f;

  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16211a;
    --tile: #1b281f;
    --ink: #f6efe2;
    --muted: #b9b4a6;
    --hairline: rgb(246 239 226 / 0.15);
    --tile-border: rgb(246 239 226 / 0.45);
    --today: rgb(156 195 165 / 0.10);
    --ridge-near: #5d7284;
    --ridge-mid: #475968;
    --ridge-far: #36444f;
    --route: #7c8279;
    --cart-a: #9cc3a5;
    --cart-b: #e07a43;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  overflow-x: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 16px 32px;
  text-align: center;
}

/* Tracked small caps, shared by eyebrow, unit labels, table header and route labels. */
.eyebrow,
.label,
.unit-label,
.scorecard th,
.footer {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 600;
}

/* --- Masthead ---------------------------------------------------------- */

.eyebrow {
  margin: 0;
  font-size: 11px;
  /* letter-spacing adds trailing space after the last glyph; pull it back so it centers */
  margin-right: -0.2em;
}

.sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 500;
}

/* --- Countdown --------------------------------------------------------- */

.hero {
  margin-top: 40px;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(6px, 2vw, 14px);
}

.countdown[hidden] {
  display: none;
}

.unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(10px, 2.6vw, 20px) 0 clamp(9px, 2vw, 14px);
  background: var(--tile);
  border: 1px solid var(--tile-border);
}

.num {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(44px, 15vw, 120px);
  line-height: 0.8;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
  letter-spacing: -0.01em;
  padding-top: 0.08em;
}

.unit-label {
  margin-top: clamp(8px, 1.6vw, 12px);
  font-size: 10px;
  margin-right: -0.2em;
  color: var(--muted);
}

.headline {
  margin: 0;
  font-weight: 600;
  font-size: clamp(44px, 11vw, 88px);
  line-height: 1.05;
  letter-spacing: -0.005em;
}

.status {
  margin: 18px 0 0;
  font-style: italic;
  font-weight: 500;
  font-size: 20px;
  color: var(--muted);
  font-variant-numeric: lining-nums;
}

/* --- Route band -------------------------------------------------------- */

.route-band {
  margin: 36px 0 0;
}

.route-band svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 160px;
  overflow: visible;
  /* --u = SVG user units per CSS pixel; main.js keeps it current so hairlines stay hairlines. */
  --u: 1.67;
}

.ridge {
  stroke-width: calc(1.25px * var(--u));
  stroke-linejoin: round;
  stroke-linecap: round;
}

.ridge-far  { stroke: var(--ridge-far); }
.ridge-mid  { stroke: var(--ridge-mid); }
.ridge-near { stroke: var(--ridge-near); }

.route-rest {
  stroke: var(--route);
  stroke-width: calc(1.5px * var(--u));
  stroke-linecap: round;
  /* dasharray is set from JS in user units (calc() in dasharray is not reliable everywhere) */
}

.route-done {
  stroke: var(--orange);
  stroke-width: calc(2px * var(--u));
  stroke-linecap: round;
}

.wp-tick {
  stroke: var(--muted);
  stroke-width: calc(1px * var(--u));
}

.wp-label {
  fill: var(--muted);
  font-family: var(--sans);
  font-weight: 600;
  font-size: calc(9px * var(--u));
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.flagstick {
  stroke: var(--ink);
  stroke-width: 1px;
}

.pennant {
  fill: var(--red);
  transition: transform 0.6s ease;
}

.flag.flag-down .pennant {
  transform: translateY(15px);
}

.cart {
  stroke: none;
}

.cart-a { color: var(--cart-a); fill: var(--cart-a); }
.cart-b { color: var(--cart-b); fill: var(--cart-b); }

/* Knockout behind each cart so ridge and route lines stop short of the silhouette. */
.cart .halo {
  color: var(--bg);
  fill: var(--bg);
  stroke: var(--bg);
  stroke-width: 2.5px;
  stroke-linejoin: round;
}

/* --- Scorecard --------------------------------------------------------- */

.scorecard-wrap {
  margin-top: 48px;
}

.label {
  margin: 0 0 14px;
  font-size: 11px;
  margin-right: -0.2em;
  color: var(--muted);
}

.scorecard {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-variant-numeric: lining-nums tabular-nums;
}

.scorecard th {
  padding: 0 10px 8px;
  font-size: 10px;
  color: var(--muted);
  border-bottom: 1px solid var(--ink);
}

.scorecard td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: baseline;
}

.scorecard th:first-child,
.scorecard td:first-child {
  padding-left: 4px;
  width: 26%;
}

.scorecard .col-tee {
  text-align: right;
  padding-right: 4px;
  white-space: nowrap;
}

.day {
  display: block;
  font-weight: 600;
  font-size: 20px;
  line-height: 1.2;
}

.date {
  display: block;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.course {
  display: block;
  font-weight: 600;
  font-size: 21px;
  line-height: 1.2;
}

.note {
  display: block;
  font-style: italic;
  font-weight: 500;
  font-size: 16px;
  color: var(--muted);
}

.tee {
  font-weight: 600;
  font-size: 20px;
}

.scorecard tr.today td {
  background: var(--today);
}

/* --- Button & footer --------------------------------------------------- */

.cta {
  margin: 44px 0 0;
}

.btn {
  display: inline-block;
  padding: 12px 26px 13px;
  border: 1px solid var(--cart-a);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn:hover,
.btn:focus-visible {
  background: var(--cart-a);
  color: var(--bg);
}

a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

.footer {
  margin-top: 56px;
  font-size: 10px;
  margin-right: -0.2em;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
}

.footer a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- Narrow screens ---------------------------------------------------- */

@media (max-width: 559px) {
  .page {
    padding-top: 40px;
  }

  .hero {
    margin-top: 28px;
  }

  .route-band svg {
    max-height: 110px;
  }

  /* Only the endpoints are labelled on phones; intermediate towns keep their ticks. */
  .wp-minor .wp-label {
    display: none;
  }

  .scorecard td {
    padding: 12px 8px;
  }

  .course { font-size: 19px; }
  .note   { font-size: 15px; }
}

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