/* ============================================================
   Ryder Pup — scorecard stylesheet
   Two-colour print on cardstock: pine ink + a red spot colour.
   ============================================================ */

:root {
  --stock:        #E2DED2;
  --stock-deep:   #D8D3C4;
  --stock-edge:   #CFC9B8;
  --ink:          #16302C;
  --ink-soft:     #52655F;
  --ink-faint:    #8A968F;
  --rule:         #B3AC9B;
  --red:          #9E2B20;
  --blue:         #2E5F8A;

  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body:    "Spectral", Georgia, serif;
  --data:    "IBM Plex Mono", "Courier New", monospace;

  --gutter: clamp(1.25rem, 4vw, 3rem);
  --measure: 66rem;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--stock);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  /* faint paper tooth */
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent, transparent 3px,
      rgba(22, 48, 44, 0.014) 3px, rgba(22, 48, 44, 0.014) 4px
    );
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { color: var(--red); text-decoration-color: var(--red); }
a:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

/* ---------- masthead ---------- */

.masthead {
  border-bottom: 2px solid var(--ink);
  padding-top: clamp(1.5rem, 4vw, 2.75rem);
}

.masthead__eyebrow {
  font-family: var(--display);
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.35rem;
}

.masthead__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.75rem, 11vw, 6.5rem);
  line-height: 0.86;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}

.masthead__nav {
  display: flex;
  flex-wrap: wrap;
  font-family: var(--display);
  font-size: 0.9rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.75rem 0;
}

.masthead__nav a {
  text-decoration: none;
  color: var(--ink-soft);
  margin: 0 1.35rem 0.35rem 0;
}
.masthead__nav a[aria-current="page"] { color: var(--red); }

/* ---------- countdown strip ---------- */

.next-up {
  border-bottom: 1px solid var(--rule);
  padding: 1.1rem 0;
}
.next-up__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  width: 100%;
}
.next-up__row > * { margin-right: 1.4rem; }

.next-up__label {
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
}

.next-up__place {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.3rem, 3.4vw, 1.9rem);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.next-up__meta {
  font-family: var(--data);
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.next-up__days {
  margin-left: auto;
  font-family: var(--data);
  font-size: 0.8rem;
  color: var(--red);
  white-space: nowrap;
}

.next-up__note {
  flex-basis: 100%;
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- section headings ---------- */

.section { padding: clamp(2rem, 5vw, 3.25rem) 0 0; }

.section__head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 0.4rem;
  margin-bottom: 1.25rem;
}

.section__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0;
}

.section__hint {
  font-family: var(--data);
  font-size: 0.7rem;
  color: var(--ink-faint);
  margin-left: auto;
  text-align: right;
}

/* ---------- the card (leaderboard) ---------- */

.card-scroll { overflow-x: auto; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); }

.card {
  width: 100%;
  border-collapse: collapse;
  min-width: 40rem;
}

.card thead th {
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: left;
  padding: 0 0.5rem 0.5rem;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

.card tbody tr { border-bottom: 1px solid var(--stock-edge); }
.card tbody tr:nth-child(even) { background: rgba(22, 48, 44, 0.022); }

.card td { padding: 0.6rem 0.5rem; vertical-align: middle; }

.card__rank {
  font-family: var(--data);
  font-size: 0.75rem;
  color: var(--ink-faint);
  width: 2.5rem;
}

.card__name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.35rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.card__name a { text-decoration: none; }

.card__index {
  font-family: var(--data);
  font-size: 1.15rem;
  font-weight: 500;
  text-align: right;
  width: 4.5rem;
  white-space: nowrap;
}

.card__trend {
  font-family: var(--data);
  font-size: 0.78rem;
  width: 4.5rem;
  white-space: nowrap;
}
.trend--down { color: var(--red); }        /* index falling = improving */
.trend--up   { color: var(--ink-faint); }
.trend--flat { color: var(--ink-faint); }

/* ---------- signature: the form line ---------- */

.form-line {
  display: flex;
  align-items: flex-end;
  min-width: 15rem;
}

.form-line__cell {
  flex: 1 1 0;
  margin-right: 2px;
  min-width: 9px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--data);
  font-size: 0.55rem;
  border: 1px solid var(--rule);
  color: var(--ink-faint);
  background: transparent;
}

/* the rounds that actually count toward the index get inked */
.form-line__cell--counts {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--stock);
}

.form-line__cell--empty {
  border-style: dotted;
  border-color: var(--stock-edge);
}

.legend {
  font-family: var(--data);
  font-size: 0.68rem;
  color: var(--ink-faint);
  margin-top: 0.85rem;
}
.legend > span { display: inline-block; margin: 0 1.4rem 0.3rem 0; }
.legend__swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border: 1px solid var(--rule);
  margin-right: 0.35rem;
  vertical-align: -1px;
}
.legend__swatch--counts { background: var(--ink); border-color: var(--ink); }

/* ---------- chart ---------- */

.chart-frame {
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.28);
  padding: 0.85rem;
  height: clamp(17rem, 45vw, 24rem);
  position: relative;
}
.chart-frame canvas { max-width: 100%; }

/* ---------- trips ---------- */

.trip {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0 1.25rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--stock-edge);
}

.trip__year {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.65rem;
  color: var(--red);
  line-height: 1;
}

.trip__place {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.35rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0;
  line-height: 1.1;
}

.trip__where {
  font-family: var(--data);
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin: 0.15rem 0 0.5rem;
}

.trip__winner {
  font-family: var(--display);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.trip__winner strong { color: var(--red); font-weight: 600; }

.trip__courses {
  font-family: var(--data);
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
}
.trip__courses li { display: inline; }
.trip__courses li:not(:last-child)::after { content: " · "; color: var(--rule); }

.trip__note {
  margin: 0.55rem 0 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
  max-width: 44rem;
}

/* ---------- golfer page ---------- */

.golfer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  padding: clamp(1.5rem, 4vw, 2.5rem) 0 1.25rem;
  border-bottom: 2px solid var(--ink);
}

.golfer-head__name {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.5rem, 9vw, 4.75rem);
  text-transform: uppercase;
  line-height: 0.9;
  margin: 0;
}

.stat { display: flex; flex-direction: column; margin: 0.5rem 2.75rem 0 0; }
.golfer-head__name { margin-right: 2.5rem; margin-bottom: 0.25rem; }
.stat__label {
  font-family: var(--display);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.stat__value {
  font-family: var(--data);
  font-size: 1.6rem;
  line-height: 1.2;
}
.stat__value--red { color: var(--red); }

.rounds {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--data);
  font-size: 0.8rem;
}
.rounds thead th {
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: left;
  padding: 0 0.5rem 0.45rem;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.rounds td { padding: 0.42rem 0.5rem; border-bottom: 1px solid var(--stock-edge); }
.rounds tbody tr:nth-child(even) { background: rgba(22, 48, 44, 0.022); }
.rounds .num { text-align: right; }
.rounds tr.counts td { color: var(--ink); font-weight: 500; }
.rounds tr.counts .rounds__flag { color: var(--red); }
.rounds td.course { font-family: var(--body); font-size: 0.85rem; }

.backlink {
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  display: inline-block;
  padding-top: 1.5rem;
}

/* ---------- footer ---------- */

.foot {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  border-top: 2px solid var(--ink);
  padding: 1rem 0 2.5rem;
  font-family: var(--data);
  font-size: 0.68rem;
  color: var(--ink-faint);
}
.foot span { display: inline-block; margin: 0 1.6rem 0.3rem 0; }

.empty {
  font-family: var(--data);
  font-size: 0.8rem;
  color: var(--ink-faint);
  border: 1px dotted var(--rule);
  padding: 1.25rem;
}

/* ---------- responsive ---------- */

@media (max-width: 34rem) {
  .trip { grid-template-columns: 1fr; gap: 0.35rem; }
  .trip__year { font-size: 1.3rem; }
  .next-up__days { margin-left: 0; flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- form / heat ---------- */

.card__heat {
  font-family: var(--data);
  font-size: 0.72rem;
  width: 3.75rem;
  white-space: nowrap;
}

.heat__icons { display: inline-flex; align-items: center; vertical-align: -2px; }
.heat__icons .ico:not(:first-child) { margin-left: 2px; }

.ico {
  width: 15px;
  height: 15px;
  display: block;
  fill: currentColor;
}
.ico--stroke { fill: none; }
.ico__inner { fill: var(--stock); }

.heat--hot  { color: var(--red); }
.heat--cold { color: var(--blue); }
.heat--even { color: var(--ink-soft); }

.card__name--hot a  { color: var(--red); }
.card__name--cold a { color: var(--blue); }

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