/* =========================================================
   The Priory Golfing Society – site styles
   One stylesheet for every page. Colours come from the crest.
   ========================================================= */

:root {
  --ink: #1f1d1a;          /* main text */
  --muted: #57534c;        /* secondary text */
  --paper: #ffffff;        /* page background */
  --cream: #f8f5ee;        /* header and panels */
  --line: #ddd6c8;         /* borders */
  --crest-black: #231f20;  /* nav bar, table headings */
  --gold: #d4ac45;         /* accents on dark backgrounds only */
  --purple: #7a2a6b;       /* links */
  --purple-dark: #561c4b;  /* link hover */
  --stripe: #f6f2e9;       /* alternate table rows */
  --focus: #1a5fb4;        /* keyboard focus ring */
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}

img { max-width: 100%; height: auto; }

.wrap { width: 100%; max-width: 64rem; margin: 0 auto; padding: 0 1rem; }

/* ---------- Headings and text ---------- */
h1, h2, h3, h4 {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.25;
  color: var(--crest-black);
}
h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem); margin: 1.5rem 0 1rem; }
h2 { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.8rem); margin: 2.5rem 0 1rem; padding-bottom: .35rem; border-bottom: 2px solid var(--gold); }
h3 { font-size: 1.35rem; margin: 0 0 .5rem; }
h4 { font-size: 1.1rem; margin: 1.5rem 0 .75rem; }
p  { margin: 0 0 1rem; }

a { color: var(--purple); text-underline-offset: .15em; }
a:hover { color: var(--purple-dark); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.note { color: var(--muted); font-style: italic; }
.back { margin-top: -.5rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  background: var(--crest-black); color: #fff; padding: .6rem 1rem; border-radius: 0 0 .4rem .4rem;
}
.skip-link:focus { top: 0; color: #fff; }

/* ---------- Header and navigation ---------- */
.site-header { background: var(--cream); border-bottom: 1px solid var(--line); }
.brand-row { padding-top: .75rem; padding-bottom: .75rem; }
.brand { display: inline-flex; align-items: center; gap: .85rem; text-decoration: none; color: var(--crest-black); }
.brand img { width: 56px; height: auto; mix-blend-mode: multiply; }
.brand-name { display: block; font-family: Georgia, serif; font-size: clamp(1.2rem, 1rem + 1.2vw, 1.65rem); font-weight: bold; line-height: 1.2; }
.brand-tag { display: block; color: var(--muted); font-size: .9rem; }
.brand:hover .brand-name { text-decoration: underline; }

.site-nav { background: var(--crest-black); }
.site-nav ul { list-style: none; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 0 .25rem; }
.site-nav a {
  display: block; padding: .7rem .75rem; color: #fff; text-decoration: none; font-weight: 600;
  border-bottom: 3px solid transparent;
}
.site-nav a:hover { color: #fff; border-bottom-color: #8c8478; }
.site-nav a[aria-current="page"] { border-bottom-color: var(--gold); }
.site-nav a:focus-visible { outline-color: var(--gold); outline-offset: -3px; }

@media (min-width: 40em) {
  .brand img { width: 72px; }
}

/* Banner photo across the top of every page (decorative) */
.banner { background: #3b5e2b; line-height: 0; }
.banner img {
  display: block; width: 100%; height: clamp(110px, 24vw, 300px);
  object-fit: cover; object-position: 50% 60%;
}

/* ---------- Footer ---------- */
.site-footer { margin-top: 3rem; background: var(--crest-black); color: #eee; padding: 1.5rem 0; font-size: .95rem; }
.site-footer p { margin: .25rem 0; }
.site-footer a { color: #f0d58c; }
.site-footer a:hover { color: #fff; }

/* ---------- Home page ---------- */
.home-grid { display: grid; gap: 2rem; }
.cta { font-weight: 600; background: var(--cream); border-left: 4px solid var(--gold); padding: .75rem 1rem; }
.captain { background: var(--cream); border: 1px solid var(--line); border-radius: .5rem; padding: 1rem 1.25rem; align-self: start; }
.captain h2 { margin-top: 0; }
.captain-photo { display: block; width: 100%; max-width: 280px; border-radius: .35rem; margin: 0 auto 1rem; }
.quick-links ul { display: grid; gap: .5rem; padding-left: 1.25rem; }
@media (min-width: 50em) {
  .home-grid { grid-template-columns: 1fr 20rem; }
  .quick-links ul { grid-template-columns: 1fr 1fr; }
}

/* ---------- Lists ---------- */
.rules li, .local-rules li { margin-bottom: .75rem; }
.rules li p { margin: 0 0 .4rem; }
.local-rules { list-style: lower-roman; }
.season-list { font-size: 1.15rem; }
.season-list li { margin-bottom: .4rem; }
.downloads { padding-left: 1.25rem; }
.filetype { color: var(--muted); font-size: .9em; }
.member-list { columns: 14rem auto; column-gap: 2rem; padding-left: 1.25rem; }
.member-list li { break-inside: avoid; }

/* ---------- Members login ---------- */
.login-form { max-width: 24rem; background: var(--cream); border: 1px solid var(--line); border-radius: .5rem; padding: 1.25rem; margin: 0 0 1.5rem; }
.login-form label { display: block; font-weight: 600; margin-bottom: .35rem; }
.login-form input {
  display: block; width: 100%; font: inherit; padding: .6rem .7rem; margin-bottom: 1rem;
  border: 2px solid var(--muted); border-radius: .35rem; background: #fff; color: var(--ink);
}
.login-form input:focus-visible { border-color: var(--focus); }
.form-error { color: #a4161a; font-weight: 600; background: #fdeceb; border-left: 4px solid #a4161a; padding: .5rem .75rem; }
.button {
  font: inherit; font-weight: 600; cursor: pointer; padding: .6rem 1.4rem; border-radius: 2rem;
  background: var(--purple); color: #fff; border: 2px solid var(--purple);
}
.button:hover { background: var(--purple-dark); border-color: var(--purple-dark); }
.button-secondary { background: #fff; color: var(--purple); }
.button-secondary:hover { color: #fff; }
.logout-form { margin-top: 1.5rem; }

/* ---------- Members area pages ---------- */
.members-nav { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.members-welcome { display: grid; gap: 1.5rem; align-items: start; }
.members-crest { width: 160px; height: auto; margin: 0 auto; mix-blend-mode: multiply; }
.members-links { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.members-links a {
  display: block; padding: .85rem 1rem; border: 1px solid var(--line); border-left: 4px solid var(--purple);
  border-radius: .4rem; background: var(--cream); text-decoration: none;
}
.members-links a:hover { border-left-color: var(--gold); }
.members-links strong { display: block; font-size: 1.1rem; }
.members-links span { display: block; color: var(--muted); font-size: .95rem; }
@media (min-width: 40em) { .members-welcome { grid-template-columns: 200px 1fr; } .members-crest { width: 200px; } }

.contact-list td, .contact-list th { white-space: nowrap; }
.contact-list td a { overflow-wrap: anywhere; }
.bank-details { font-size: 1.1rem; background: var(--cream); border: 1px solid var(--line); border-radius: .5rem; padding: 1rem 1.25rem; max-width: 32rem; }
.captains { max-width: 30rem; }
.captains td:first-child { font-variant-numeric: tabular-nums; width: 5rem; }

.golfwear { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); }
.golfwear li { border: 1px solid var(--line); border-radius: .5rem; padding: 1rem; background: #fff; display: flex; flex-direction: column; }
.golfwear img { display: block; width: 100%; height: 12rem; object-fit: contain; margin-bottom: .75rem; }
.golfwear h2 { font-size: 1.1rem; border: 0; margin: 0 0 .25rem; padding: 0; }
.golfwear p { margin: 0 0 .25rem; color: var(--muted); }
.golfwear .price { margin-top: auto; padding-top: .5rem; font-size: 1.25rem; font-weight: 700; color: var(--purple); }

figure { margin: 0; }
.inline-figure { margin: 1.5rem 0; }
.inline-figure figcaption { color: var(--muted); font-size: .9rem; margin-top: .3rem; }

/* ---------- Season switcher (2025 / 2026 / 2027) ---------- */
.season-nav ul { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.season-nav a {
  display: inline-block; padding: .35rem .9rem; border: 2px solid var(--purple); border-radius: 2rem;
  text-decoration: none; font-weight: 600;
}
.season-nav a[aria-current="page"] { background: var(--purple); color: #fff; }

/* ---------- Tables (fixtures, results, handicaps) ---------- */
.table-wrap { position: relative; overflow-x: auto; margin: 0 0 1.5rem; border: 1px solid var(--line); border-radius: .4rem; }
.table-wrap:focus-visible { outline: 3px solid var(--focus); }
table { border-collapse: collapse; width: 100%; font-size: 1rem; }
caption { text-align: left; font-weight: 600; padding: .6rem .75rem; color: var(--muted); }
th, td { padding: .55rem .75rem; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
thead th { background: var(--crest-black); color: #fff; border-top: 0; white-space: nowrap; }
tbody tr:nth-child(even) { background: var(--stripe); }
tbody th { font-weight: 600; }
.fixtures td:first-child { white-space: nowrap; }
.handicaps td, .results td.num, .results th.num { text-align: right; font-variant-numeric: tabular-nums; }
.handicaps thead th:not(:first-child) { text-align: right; }

/* Season scores grid (wide: scrolls sideways on phones, member names stay in view) */
.season-grid { font-size: .95rem; }
.season-grid th, .season-grid td { padding: .45rem .55rem; }
.season-grid thead th { white-space: normal; vertical-align: bottom; line-height: 1.25; min-width: 4.5rem; }
.season-grid tbody th, .season-grid tfoot th { white-space: nowrap; position: sticky; left: 0; background: var(--paper); z-index: 1; }
.season-grid tbody tr:nth-child(even) th { background: var(--stripe); }
.season-grid thead th:first-child { position: sticky; left: 0; z-index: 2; }
.season-grid .col-date { display: block; font-weight: normal; font-size: .8rem; color: #d9d4ca; }
.season-grid .dnp { color: var(--muted); }
.season-grid tfoot th, .season-grid tfoot td { background: var(--cream); font-weight: 600; border-top: 2px solid var(--crest-black); }

/* ---------- Meetings ---------- */
.meeting { padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.meeting::after { content: ""; display: table; clear: both; }
.meeting-date { display: block; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; font-size: 1rem; font-weight: normal; color: var(--muted); margin-top: .2rem; }
.trophy-line { font-size: 1.1rem; }
.feature, .trophy { display: block; border-radius: .35rem; margin: 0 0 1rem; }
.feature { max-width: min(100%, 320px); }
.trophy { max-width: 160px; }
@media (min-width: 40em) {
  .feature, .trophy { float: right; margin: 0 0 1rem 1.5rem; }
}

.details { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 1rem; }
.details dt { font-weight: 600; }
.details dd { margin: 0; }

/* Photo grid: 2 across on phones, 3–4 on larger screens */
.photo-grid { list-style: none; padding: 0; margin: 0; clear: both; display: grid; gap: .75rem; align-items: start; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 40em) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 60em) { .photo-grid { grid-template-columns: repeat(4, 1fr); } }
.photo-grid a { display: block; border-radius: .35rem; overflow: hidden; background: var(--cream); }
.photo-grid img { display: block; width: 100%; transition: transform .2s; }  /* whole photo shown – never cropped */
.photo-grid a:hover img { transform: scale(1.03); }
.photo-grid figcaption { font-size: .9rem; color: var(--muted); margin-top: .35rem; line-height: 1.35; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-nav, .skip-link, .season-nav { display: none; }
  .site-footer { background: none; color: var(--ink); }
  a { color: inherit; }
}
