/* =========================================================================
   The Practice Ground - single stylesheet
   No web fonts, no imports, no external request of any kind.
   Class vocabulary: prefix lp- (yardage book: tee, fairway, hole, green,
   card, ledger, caddie, strokes, sheet, plate, carry, clubhouse).
   Colour and rhythm variables live in the :root block below.
   ========================================================================= */

:root {
  /* ---- Colour ---------------------------------------------------------- */
  /* bentgrass green on a cool grass-white paper, deep pine ink */
  --paper: #eaeee9;         /* page background */
  --panel: #dbe2da;         /* contents rail, short-version blocks, footer */
  --block: #f6f8f4;         /* callouts, tables, figures */
  --ink: #182620;           /* body copy and headings */
  --ink-soft: #4a5a51;      /* summaries, captions, small print */
  --accent: #25634a;        /* links, numbers, rules */
  --accent-deep: #164733;   /* hover and pressed states */
  --rule: #c3cec3;          /* hairlines */
  --wash: #cfe0d3;          /* text selection and active contents entry */

  /* ---- Type ------------------------------------------------------------ */
  --face-head: Rockwell, "Rockwell Nova", "Roboto Slab", "Zilla Slab", "Bookman Old Style", Georgia, serif;
  --face-text: Verdana, Geneva, "DejaVu Sans", Tahoma, "Segoe UI", sans-serif;

  /* ---- Rhythm ---------------------------------------------------------- */
  --measure: 62ch;          /* maximum line length */
  --rail: 21rem;            /* width of the contents column */
  --step: 1.15rem;          /* base spacing unit */
  --leading: 1.62;
  --numeral: 0.82rem;       /* size of the section numerals */
  --hair: 1px;
  --corner: 0;              /* square corners throughout, scorecard look */
  --page-max: 74rem;

  /* ---- Heading sizes (fluid, never overflowing) ------------------------ */
  --h1: clamp(1.6rem, 1.18rem + 1.7vw, 2.35rem);
  --h2: clamp(1.2rem, 1.05rem + 0.7vw, 1.5rem);
  --h3: clamp(1rem, 0.96rem + 0.25vw, 1.12rem);
}

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--face-text);
  font-size: 0.98rem;
  line-height: var(--leading);
  overflow-wrap: break-word;
}

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

::selection { background: var(--wash); }

a { color: var(--accent); }
a:hover { color: var(--accent-deep); }

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

/* ---- Helpers ------------------------------------------------------------ */
.lp-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 20;
}
.lp-skip:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.lp-offscreen {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.lp-book {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: clamp(1rem, 3.5vw, 2.75rem);
}

/* ---- Masthead ----------------------------------------------------------- */
.lp-tee {
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
}

.lp-tee__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 1.6rem;
  padding-block: 1rem 0.85rem;
}

.lp-flag {
  font-family: var(--face-head);
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.15;
}
.lp-flag span {
  display: block;
  font-family: var(--face-text);
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 0.3rem;
}

.lp-loop { margin-left: auto; }
.lp-loop ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.lp-loop a {
  display: inline-block;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  padding: 0.15rem 0 0.2rem;
  border-bottom: 2px solid transparent;
}
.lp-loop a:hover,
.lp-loop a[aria-current="page"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- Page opening ------------------------------------------------------- */
.lp-apron {
  padding-block: clamp(1.6rem, 4.5vw, 2.9rem) var(--step);
  border-bottom: var(--hair) solid var(--rule);
}

.lp-trail {
  font-size: 0.74rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.85rem;
}
.lp-trail a { color: var(--ink-soft); }
.lp-trail span { padding-inline: 0.45rem; }

.lp-title {
  font-family: var(--face-head);
  font-size: var(--h1);
  line-height: 1.14;
  font-weight: 700;
  margin: 0 0 0.65rem;
  max-width: 26ch;
}

.lp-brief {
  max-width: var(--measure);
  font-size: 1.02rem;
  color: var(--ink-soft);
  margin: 0;
}

.lp-stamp {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.9rem;
  list-style: none;
  margin: calc(var(--step) * 1.1) 0 0;
  padding: 0;
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.lp-stamp li {
  border-left: 2px solid var(--accent);
  padding-left: 0.55rem;
  line-height: 1.5;
}

/* ---- Spread: contents rail on the left, text on the right --------------- */
.lp-spread {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: clamp(1.4rem, 3.5vw, 3.25rem);
  /* never align-items: start, the left column has to stretch over the whole
     row or the sticky contents box runs out of travel after a few hundred px */
  align-items: stretch;
  padding-block: clamp(1.6rem, 3.5vw, 2.6rem) clamp(2.2rem, 5vw, 4rem);
}

.lp-rail {
  min-width: 0;
  align-self: stretch;
}

.lp-fairway {
  min-width: 0;
  max-width: var(--measure);
}

/* ---- Sticky contents ---------------------------------------------------- */
.lp-ledger {
  position: sticky;
  top: var(--step);
  max-height: calc(100vh - var(--step) * 2);
  overflow-y: auto;
  background: var(--panel);
  border: var(--hair) solid var(--rule);
  border-top: 4px solid var(--ink);
  border-radius: var(--corner);
  padding: 0.85rem 1rem 1rem;
}

.lp-ledger__head {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.lp-ledger__head::-webkit-details-marker { display: none; }
.lp-ledger__head::after {
  content: "\25BE"; /* small down triangle */
  font-size: 0.8rem;
  color: var(--accent);
}
.lp-ledger:not([open]) .lp-ledger__head::after { content: "\25B8"; }

.lp-ledger__list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  counter-reset: step;
  border-top: var(--hair) solid var(--rule);
}

.lp-ledger__step { border-bottom: var(--hair) solid var(--rule); }

.lp-ledger__step > a {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  gap: 0.55rem;
  align-items: baseline;
  padding: 0.5rem 0.3rem 0.5rem 0.45rem;
  margin-left: -0.45rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.85rem;
  line-height: 1.4;
  border-left: 4px solid transparent;
}
.lp-ledger__step > a::before {
  counter-increment: step;
  content: counter(step) ".";
  font-family: var(--face-head);
  font-size: 0.8rem;
  color: var(--accent);
  text-align: right;
}
.lp-ledger__step > a:hover {
  background: var(--block);
  color: var(--accent-deep);
}
.lp-ledger__step > a[aria-current="true"] {
  background: var(--wash);
  border-left-color: var(--accent);
  font-weight: 700;
}

/* optional second level of the contents list */
.lp-ledger__sub {
  list-style: none;
  margin: 0 0 0.45rem;
  padding: 0 0 0 2.15rem;
}
.lp-ledger__sub a {
  display: block;
  padding: 0.22rem 0;
  font-size: 0.79rem;
  color: var(--ink-soft);
  text-decoration: none;
}
.lp-ledger__sub a:hover { color: var(--accent); }

.lp-rail__note {
  margin: var(--step) 0 0;
  padding: 0.85rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  border-top: 3px double var(--rule);
}

/* ---- Numbered sections --------------------------------------------------- */
.lp-hole {
  padding-block: 0 clamp(1.5rem, 3.5vw, 2.4rem);
  scroll-margin-top: var(--step);
}
.lp-hole + .lp-hole {
  border-top: var(--hair) solid var(--rule);
  padding-top: clamp(1.5rem, 3.5vw, 2.3rem);
}

.lp-hole__head {
  display: grid;
  grid-template-columns: 2.9rem minmax(0, 1fr);
  align-items: start;
  gap: 0.65rem;
  font-family: var(--face-head);
  font-size: var(--h2);
  line-height: 1.22;
  font-weight: 700;
  margin: 0 0 0.75rem;
}
.lp-hole__no {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  font-family: var(--face-head);
  font-size: var(--numeral);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--block);
  background: var(--accent);
  border-radius: var(--corner);
  margin-top: 0.15em;
}

.lp-hole > p,
.lp-hole > ul,
.lp-hole > ol,
.lp-hole > dl,
.lp-hole > figure,
.lp-hole > div,
.lp-hole > aside,
.lp-hole > nav,
.lp-hole > blockquote,
.lp-hole > h3 {
  margin-left: 3.55rem;
}

/* sub-heading of a section: direct child only, so that the small block
   headings (lp-green__head, lp-caddie__head, lp-card__title) keep their own size */
.lp-hole > h3 {
  font-family: var(--face-head);
  font-size: var(--h3);
  margin-top: calc(var(--step) * 1.3);
  margin-bottom: 0.45rem;
  scroll-margin-top: var(--step);
}

.lp-hole p {
  margin-top: 0;
  margin-bottom: 0.95rem;
}

.lp-hole > ul,
.lp-hole > ol {
  margin-bottom: 1rem;
  padding-left: 1.1rem;
}
.lp-hole > ul > li,
.lp-hole > ol > li { margin-bottom: 0.35rem; }

/* the structured lists handle their own indentation */
.lp-hole > .lp-round,
.lp-hole > .lp-card,
.lp-hole > .lp-strokes { padding-left: 0; }
.lp-hole > .lp-round > li,
.lp-hole > .lp-card > li { margin-bottom: 0; }
.lp-hole > .lp-strokes > li { margin-bottom: 0.8rem; }

/* ---- Ordered steps ------------------------------------------------------- */
.lp-strokes {
  list-style: none;
  counter-reset: stroke;
  padding-left: 0;
}
.lp-strokes > li {
  counter-increment: stroke;
  position: relative;
  padding-left: 2.4rem;
  margin-bottom: 0.8rem;
}
.lp-strokes > li::before {
  content: counter(stroke);
  position: absolute;
  left: 0;
  top: 0.15rem;
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  font-family: var(--face-head);
  font-size: 0.82rem;
  color: var(--block);
  background: var(--ink);
  border-radius: var(--corner);
}

/* ---- Short version block at the foot of a section ------------------------ */
.lp-green {
  background: var(--panel);
  border: var(--hair) solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: var(--corner);
  padding: 0.95rem 1.15rem 1.05rem;
  margin-top: calc(var(--step) * 1.25);
}
.lp-green__head {
  font-family: var(--face-text);
  font-size: 0.69rem;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent-deep);
  margin: 0 0 0.55rem;
}
.lp-green__points {
  list-style: none;
  margin: 0;
  padding: 0;
}
.lp-green__points li {
  position: relative;
  padding-left: 1.35rem;
  margin-bottom: 0.4rem;
  font-size: 0.93rem;
}
.lp-green__points li:last-child { margin-bottom: 0; }
.lp-green__points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 0.6rem;
  height: 3px;
  background: var(--accent);
}

/* ---- Caddie note (aside) -------------------------------------------------- */
.lp-caddie {
  background: var(--block);
  border: var(--hair) solid var(--rule);
  border-top: 3px double var(--ink-soft);
  border-radius: var(--corner);
  padding: 0.9rem 1.1rem;
  margin: calc(var(--step) * 0.95) 0;
}
.lp-caddie__head {
  font-size: 0.69rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 0 0 0.35rem;
}
.lp-caddie p:last-child { margin-bottom: 0; }

/* ---- Terms ---------------------------------------------------------------- */
.lp-terms {
  margin: 0;
  border-top: 3px double var(--rule);
}
.lp-terms dt {
  font-family: var(--face-head);
  font-weight: 700;
  padding-top: 0.7rem;
}
.lp-terms dd {
  margin: 0.15rem 0 0.7rem;
  padding-bottom: 0.7rem;
  border-bottom: var(--hair) solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.93rem;
}

/* ---- Tables that scroll cleanly ------------------------------------------- */
.lp-sheet {
  overflow-x: auto;
  border: var(--hair) solid var(--rule);
  border-radius: var(--corner);
  background: var(--block);
  margin: calc(var(--step) * 0.95) 0;
}
.lp-sheet table {
  border-collapse: collapse;
  width: 100%;
  min-width: 32rem;
  font-size: 0.88rem;
}
.lp-sheet caption {
  text-align: left;
  padding: 0.7rem 0.85rem;
  font-size: 0.73rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: var(--hair) solid var(--rule);
}
.lp-sheet th,
.lp-sheet td {
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-bottom: var(--hair) solid var(--rule);
  border-right: var(--hair) solid var(--rule);
  vertical-align: top;
}
.lp-sheet th:last-child,
.lp-sheet td:last-child { border-right: 0; }
.lp-sheet thead th {
  background: var(--ink);
  color: var(--block);
  border-right-color: var(--ink-soft);
  font-family: var(--face-head);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  font-weight: 700;
}
.lp-sheet tbody tr:last-child td { border-bottom: 0; }
.lp-sheet tbody th { font-weight: 700; }

/* ---- Figures ---------------------------------------------------------------- */
.lp-plate {
  margin: calc(var(--step) * 0.95) 0;
}
.lp-plate img {
  display: block;
  width: 100%;
  border: var(--hair) solid var(--rule);
  border-radius: var(--corner);
  background: var(--block);
}
.lp-plate figcaption {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: 0.45rem;
  padding-left: 0.6rem;
  border-left: 2px solid var(--rule);
}

/* ---- Home page programme (a list, never a card grid) ------------------------ */
.lp-round {
  list-style: none;
  counter-reset: chapter;
  margin: 0;
  padding: 0;
  border-top: 3px double var(--rule);
}
.lp-round > li {
  counter-increment: chapter;
  border-bottom: var(--hair) solid var(--rule);
}
.lp-round a {
  display: grid;
  grid-template-columns: 2.9rem minmax(0, 1fr);
  gap: 0.15rem 0.65rem;
  padding: 0.9rem 0.35rem 0.95rem 0;
  text-decoration: none;
  color: var(--ink);
}
.lp-round a:hover { background: var(--block); }
.lp-round a::before {
  content: counter(chapter, decimal-leading-zero);
  grid-row: 1 / span 3;
  font-family: var(--face-head);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  padding-top: 0.1rem;
}
.lp-round__title {
  font-family: var(--face-head);
  font-size: var(--h3);
  font-weight: 700;
  line-height: 1.28;
}
.lp-round a:hover .lp-round__title { color: var(--accent-deep); }
.lp-round__abstract {
  color: var(--ink-soft);
  font-size: 0.89rem;
  margin-top: 0.2rem;
}
.lp-round__marks {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.lp-round__marks b {
  font-weight: 700;
  color: var(--accent);
}

/* ---- Section index (dense scorecard rows) ----------------------------------- */
.lp-card {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: var(--hair) solid var(--rule);
}
.lp-card > li {
  padding: 0.8rem 0 0.85rem;
  border-bottom: var(--hair) solid var(--rule);
}
.lp-card__title {
  font-family: var(--face-head);
  font-size: var(--h3);
  margin: 0 0 0.2rem;
}
.lp-card__title a { text-decoration: none; color: var(--ink); }
.lp-card__title a:hover { color: var(--accent); text-decoration: underline; }
.lp-card__abstract {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.89rem;
}
.lp-card__marks {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.85rem;
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  font-size: 0.71rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---- Carry on (end of page links) ------------------------------------------- */
.lp-carry {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  margin-top: calc(var(--step) * 1.5);
  border-top: 3px double var(--rule);
  padding-top: var(--step);
}
.lp-carry a {
  display: block;
  padding: 0.8rem 0.95rem;
  border: var(--hair) solid var(--rule);
  border-left: 4px solid var(--rule);
  border-radius: var(--corner);
  background: var(--block);
  text-decoration: none;
  color: var(--ink);
}
.lp-carry a:hover { border-left-color: var(--accent); }
.lp-carry small {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.25rem;
}
.lp-carry b {
  font-family: var(--face-head);
  font-weight: 700;
}

/* ---- Clubhouse (footer) ------------------------------------------------------ */
.lp-clubhouse {
  border-top: 3px solid var(--ink);
  background: var(--panel);
  padding-block: clamp(1.5rem, 3.5vw, 2.2rem);
  font-size: 0.88rem;
}
.lp-clubhouse__row {
  display: grid;
  gap: var(--step) clamp(1.2rem, 3vw, 2.5rem);
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}
.lp-clubhouse h2 {
  font-family: var(--face-text);
  font-size: 0.69rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0 0 0.55rem;
  color: var(--ink-soft);
}
.lp-clubhouse ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.lp-clubhouse li { margin-bottom: 0.3rem; }
.lp-clubhouse a { color: var(--ink); }
.lp-clubhouse a:hover { color: var(--accent-deep); }
.lp-clubhouse__base {
  margin-top: var(--step);
  padding-top: 0.85rem;
  border-top: var(--hair) solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.8rem;
}

/* =========================================================================
   Narrow screens: the contents list moves above the text and stops sticking
   ========================================================================= */
@media (max-width: 62rem) {
  .lp-spread { grid-template-columns: minmax(0, 1fr); }
  .lp-ledger {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .lp-rail__note { margin-top: 0.9rem; }
}

@media (max-width: 34rem) {
  :root { --step: 0.95rem; }
  .lp-loop { margin-left: 0; width: 100%; }
  .lp-hole__head { grid-template-columns: 2.2rem minmax(0, 1fr); gap: 0.5rem; }
  .lp-hole__no { width: 1.8rem; height: 1.8rem; font-size: 0.74rem; }
  .lp-hole > p,
  .lp-hole > ul,
  .lp-hole > ol,
  .lp-hole > dl,
  .lp-hole > figure,
  .lp-hole > div,
  .lp-hole > aside,
  .lp-hole > nav,
  .lp-hole > blockquote,
  .lp-hole > h3 { margin-left: 0; }
  .lp-round a { grid-template-columns: 2.2rem minmax(0, 1fr); }
}

/* ---- Print -------------------------------------------------------------------- */
@media print {
  .lp-rail,
  .lp-loop,
  .lp-skip { display: none; }
  .lp-spread { display: block; }
  body { background: #fff; color: #000; }
  .lp-sheet thead th { background: #fff; color: #000; }
}
