@font-face {
  font-family: 'Royale Couture Serif';
  src: url('/fonts/royale-couture-serif.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f4f3ee;
  --surface: #ffffff;
  --ink: #14201a;
  --muted: #59625a;
  --line: #d8d6cc;
  --fairway: #1f4a33;
  --fairway-ink: #ffffff;
  --flag: #c9a24a;
  --flag-ink: #251c06;
  --taken: #aab3a6;
  --danger: #a3341f;
  --danger-bg: #fbeae5;
  --ok-bg: #e3eee6;
  --band: #11231a;
  --band-ink: #ece9df;
  color-scheme: light;

  --font-ui: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
  /* Numbers and tee times stay in the sans so they're quick to read */
  --font-sheet: 'Figtree', 'Segoe UI', system-ui, sans-serif;
  /* Headlines: Royale Couture Serif (licensed font, served from /fonts) */
  --font-display: 'Royale Couture Serif', Georgia, 'Times New Roman', serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1a14;
    --surface: #16251d;
    --ink: #e7ebe4;
    --muted: #a7b2a5;
    --line: #2c3d33;
    --fairway: #8fc3a2;
    --fairway-ink: #0c1810;
    --flag: #d9b45c;
    --flag-ink: #241b05;
    --taken: #4a5a50;
    --danger: #f08c74;
    --danger-bg: #3a1d16;
    --ok-bg: #1b3326;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  line-height: 1.5;
}

a { color: var(--fairway); }

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

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* ---- Brand bar --------------------------------------------------------- */
.brandbar { background: var(--band); color: var(--band-ink); border-bottom: 3px solid #c9a24a; }
.brandbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brandbar img { display: block; height: 46px; width: auto; max-width: 70vw; }
.brandbar a, .brandbar .hint { color: var(--band-ink); font-size: 0.95rem; }
.brandbar a:hover { color: #ffffff; }
@media (max-width: 560px) { .brandbar img { height: 34px; } .brandbar a { font-size: 0.85rem; } }
.wrap { padding-top: 2.25rem; }

h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
  margin: 0 0 0.75rem;
}
.lede { max-width: 38rem; color: var(--muted); margin: 0 0 2rem; }

h2 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0;
  font-size: 2rem;
  line-height: 1.05;
  margin: 0 0 1rem;
}

/* ---- Layout ------------------------------------------------------------ */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  gap: 2.5rem;
  align-items: start;
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
}

/* ---- Day tabs ---------------------------------------------------------- */
.days {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  margin-bottom: 1.5rem;
  scrollbar-width: thin;
}
.day {
  flex: 0 0 auto;
  min-width: 6.25rem;
  padding: 0.5rem 0.9rem 0.6rem;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.day span { display: block; }
.day .dow { font-size: 0.85rem; color: var(--muted); }
.day .dnum { font-family: var(--font-sheet); font-size: 1.35rem; font-weight: 600; line-height: 1.1; }
.day .dpay { font-size: 0.78rem; color: var(--muted); margin-top: 0.1rem; }
.day.paynow .dpay { color: var(--fairway); font-weight: 600; }
.day[aria-pressed='true'] .dpay { color: inherit; opacity: 0.9; }
.day[aria-pressed='true'] { border-color: var(--fairway); background: var(--fairway); color: var(--fairway-ink); }
.day[aria-pressed='true'] .dow { color: inherit; opacity: 0.85; }

/* ---- Tee sheet: the memorable bit -------------------------------------- */
.sheet { border-top: 1px solid var(--line); }
.hour {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.hour-label {
  font-family: var(--font-sheet);
  font-size: 1.1rem;
  color: var(--muted);
  padding-top: 0.55rem;
}
.hour-rule {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--fairway);
}
@media (max-width: 560px) { .hour-rule { display: inline; margin: 0 0 0 0.5rem; } }
.slots {
  display: grid;
  /* 8-minute tee times give 7 or 8 per hour: one row per hour on wide screens. */
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.35rem;
}
@media (max-width: 1040px) and (min-width: 861px), (max-width: 700px) {
  .slots { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .hour { grid-template-columns: minmax(0, 1fr); gap: 0.35rem; }
  .hour-label { padding-top: 0; }
}

.slot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 0.45rem 0.45rem 0.55rem;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.slot:hover:not(:disabled) { border-color: var(--fairway); }
.slot .t {
  font-family: var(--font-sheet);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.balls { display: flex; gap: 3px; }
.ball {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--fairway);
}
.ball.taken { background: var(--taken); border-color: var(--taken); }

.slot:disabled { cursor: not-allowed; background: transparent; }
.slot:disabled .t { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.slot:disabled .ball { border-color: var(--taken); }

.slot[aria-pressed='true'] {
  background: var(--flag);
  border-color: var(--flag);
  color: var(--flag-ink);
}
.slot[aria-pressed='true'] .ball { border-color: var(--flag-ink); }
.slot[aria-pressed='true'] .ball.taken { background: var(--flag-ink); opacity: 0.35; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }

/* ---- Booking panel ----------------------------------------------------- */
.panel {
  position: sticky;
  top: 1.25rem;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 1.5rem;
}
@media (max-width: 860px) { .panel { position: static; } }

.chosen {
  margin: 0 0 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px dashed var(--line);
}
.chosen .when { font-family: var(--font-sheet); font-size: 2.2rem; font-weight: 700; line-height: 1; }
.chosen .date { color: var(--muted); }
.empty { color: var(--muted); margin: 0; }

fieldset { border: 0; padding: 0; margin: 0 0 1.1rem; }
legend { padding: 0; }
legend, label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.35rem; }
.hint { font-weight: 400; color: var(--muted); }

.players { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
.players button {
  padding: 0.55rem 0;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sheet);
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
}
.players button[aria-pressed='true'] { background: var(--fairway); border-color: var(--fairway); color: var(--fairway-ink); }
.players button:disabled { opacity: 0.35; cursor: not-allowed; }

.field { margin-bottom: 1rem; }
input, select, textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--fairway); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--fairway) 25%, transparent); }

.total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 1.25rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.total strong { font-family: var(--font-sheet); font-size: 1.8rem; font-variant-numeric: tabular-nums; }

.btn {
  display: inline-block;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 0;
  border-radius: 6px;
  background: var(--fairway);
  color: var(--fairway-ink);
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: progress; }
.btn.secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.small { width: auto; padding: 0.4rem 0.75rem; font-size: 0.9rem; font-weight: 600; }
.btn.danger { background: transparent; color: var(--danger); border: 1.5px solid currentColor; }

.fine { font-size: 0.88rem; color: var(--muted); margin: 0.9rem 0 0; }

.notice {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin: 0 0 1.25rem;
  background: var(--ok-bg);
}
.notice.error { background: var(--danger-bg); color: var(--danger); }
[hidden] { display: none !important; }

.loading { color: var(--muted); padding: 1.5rem 0; }

/* ---- Confirmation ------------------------------------------------------ */
.ticket {
  max-width: 34rem;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 1.75rem;
}
.ticket dl { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.5rem; margin: 1.25rem 0 0; }
.ticket dt { color: var(--muted); }
.ticket dd { margin: 0; font-weight: 600; }
.ticket .big { font-family: var(--font-sheet); font-size: 3rem; font-weight: 700; line-height: 1; margin: 0.25rem 0; }

@media (prefers-reduced-motion: no-preference) {
  .slot, .day, .players button { transition: background-color 120ms, border-color 120ms; }
}
.ticket h1 { font-size: clamp(2.2rem, 5vw, 3rem); }

/* ---- Group-size rule ---------------------------------------------------- */
.rule {
  max-width: 38rem;
  margin: -0.75rem 0 2rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--flag);
  background: var(--surface);
  border-radius: 0 6px 6px 0;
}
.rule p { margin: 0; }
.rule p + p { margin-top: 0.35rem; }
.group-note {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--muted);
}

/* ---- Waiting list and societies --------------------------------------- */
.slot.full { background: transparent; border-style: dashed; border-color: var(--taken); }
.slot.full .t { color: var(--muted); }
.slot.full:hover { border-color: var(--fairway); }
.slot.full[aria-pressed='true'] { border-style: solid; background: var(--flag); border-color: var(--flag); }
.slot.full[aria-pressed='true'] .t { color: var(--flag-ink); }
.slot-mini {
  display: inline-block; width: 1.4rem; height: 0.9rem;
  border: 1.5px dashed var(--taken); border-radius: 3px;
}
.society-link { margin: -1rem 0 1.75rem; color: var(--muted); }
.waitlist-note { margin: 0.75rem 0 0; font-size: 0.92rem; color: var(--ink); }
.field.check label { display: flex; gap: 0.5rem; align-items: flex-start; font-weight: 400; }
.field.check input { width: auto; margin-top: 0.3rem; accent-color: var(--fairway); }
#waitlist-done .btn { margin-top: 0.5rem; }

/* Simple centred page for forms and booking details */
.narrow { max-width: 38rem; }
.card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 0.45rem 1.5rem; margin: 1rem 0; }
.card dt { color: var(--muted); }
.card dd { margin: 0; font-weight: 600; }
.card .big { font-family: var(--font-sheet); font-size: 2.6rem; font-weight: 700; line-height: 1; margin: 0.25rem 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; } }
.actions-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.actions-row .btn { width: auto; }
textarea { min-height: 6rem; resize: vertical; }
.status-tag { display: inline-block; font-size: 0.85rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 4px; background: var(--ok-bg); }
.status-tag.off { background: var(--danger-bg); color: var(--danger); }

/* ---- Holes, players and prices ------------------------------------------ */
.brand-links { display: flex; gap: 1.25rem; align-items: center; }
.member-strip { margin: 0 0 1.1rem; padding: 0.7rem 0.85rem; background: var(--ok-bg); border-radius: 4px; font-size: 0.92rem; }
.holes { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.holes button {
  min-height: 44px; border: 1.5px solid var(--line); border-radius: 4px; background: var(--paper);
  color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.holes button[aria-pressed='true'] { background: var(--fairway); border-color: var(--fairway); color: var(--fairway-ink); }
.player-rows { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem; }
/* Each golfer: the label ("You", "Player 2") on the left, and their boxes (name, type,
   membership number) stacked underneath each other on the right, all the same width.
   On narrow phones the label sits on its own line and the boxes go full width. */
.player-row { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 0.4rem 0.6rem; align-items: center; }
.player-row > * { grid-column: 2; min-width: 0; width: 100%; box-sizing: border-box; }
.player-row > .who { grid-column: 1; grid-row: 1; align-self: center; font-weight: 600; font-size: 0.95rem; width: auto; }
.player-row select, .player-row input { padding: 0.5rem 0.55rem; font-size: 1rem; }
@media (max-width: 420px) {
  .player-row { grid-template-columns: minmax(0, 1fr); }
  .player-row > *, .player-row > .who { grid-column: 1; }
  .player-row > .who { grid-row: auto; margin-top: 0.35rem; }
}
.quote { list-style: none; margin: 1rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.quote li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px dashed var(--line); font-size: 0.95rem; }
.quote li span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.quote small { display: block; color: var(--muted); font-size: 0.82rem; }
.quote + .total { margin-top: 0.5rem; border-top: 0; }
.bk-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.8rem 0; border-bottom: 1px solid var(--line); }
.bk-row a { white-space: nowrap; font-weight: 600; }
.card .big { font-family: var(--font-display); }
.player-help { margin: 0.5rem 0 0; font-size: 0.85rem; font-weight: 400; }

/* ---- Society booking ---------------------------------------------------- */
.society-sum { margin: 0 0 0.75rem; padding: 0.7rem 0.85rem; background: var(--ok-bg); border-radius: 4px; font-size: 0.95rem; }
.start-times { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 0.4rem; }
.start-times button {
  min-height: 46px; border: 1.5px solid var(--line); border-radius: 4px; background: var(--paper);
  color: var(--ink); font: inherit; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer;
}
.start-times button[aria-checked='true'] { background: var(--flag); border-color: var(--flag); color: var(--flag-ink); }
.terms { margin: 0 0 1rem; padding-left: 1.2rem; font-size: 0.95rem; }
.terms li { margin-bottom: 0.4rem; }
.card h2 { margin-top: 0.5rem; }

/* ---- Embedded payment panel -------------------------------------------- */
body.pay-open { overflow: hidden; }
.pay-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(17, 35, 26, 0.6);
  display: flex; justify-content: center; align-items: flex-start;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}
.pay-sheet {
  width: 100%; max-width: 560px; min-height: 100%;
  background: var(--surface); padding: 1.25rem 1.25rem 2rem;
}
@media (min-width: 640px) {
  .pay-overlay { padding: 2rem 1rem; }
  .pay-sheet { min-height: 0; border-radius: 8px; border-top: 3px solid var(--flag); }
}
.pay-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.pay-head h2 { margin: 0; }
.pay-summary { margin: 0.25rem 0 0; color: var(--muted); }
.pay-back {
  flex: 0 0 auto; min-height: 44px; padding: 0 1rem; border: 1.5px solid var(--line); border-radius: 4px;
  background: var(--paper); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.pay-form { min-height: 320px; }
.pay-note { margin-top: 1rem; }

/* ---- Small footer on booking pages --------------------------------------- */
.mini-foot { max-width: 1100px; margin: 2rem auto 0; padding: 1.25rem 1rem 2rem; border-top: 1px solid var(--line); text-align: center; font-size: 0.9rem; color: var(--muted); }
.mini-foot a { color: var(--muted); }

/* ---- Golfers changing their booking (manage page) ---------------------- */
.chg-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.8rem; }
.chg-tabs .btn { width: auto; }
.chg-tabs .btn[aria-pressed='true'] { background: var(--fairway); color: var(--fairway-ink); border-color: var(--fairway); }
.chg-panel { display: grid; gap: 0.6rem; }
.chg-label { font-weight: 700; font-size: 0.9rem; }
.chg-times { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: 0.45rem; }
.chg-time { display: grid; gap: 0.1rem; min-height: 54px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); font: inherit; cursor: pointer; }
.chg-time span { font-size: 0.8rem; color: var(--muted); }
.chg-time[aria-pressed='true'] { background: var(--flag); border-color: var(--flag); color: var(--flag-ink); }
.chg-time[aria-pressed='true'] span { color: var(--flag-ink); }
.chg-rows { display: grid; gap: 0.4rem; }
.chg-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem; align-items: center; }
.chg-row .btn { width: auto; justify-self: end; }
.chg-confirm { margin-top: 0.6rem; padding: 0.9rem; border: 2px solid var(--fairway); border-radius: 10px; display: grid; gap: 0.4rem; }
.chg-confirm p { margin: 0; }
.chg-money { font-weight: 700; }
@media (max-width: 520px) { .chg-row { grid-template-columns: minmax(0, 1fr); } }

.chg-row .pnum { grid-column: 1 / -1; }
