/* Terms and policies pages (/terms, /guided-swim-terms, /event-terms, /weather-and-cancellation, /privacy,
   /gift-voucher-terms). Loaded after /css/content-pages.css and only adds what the cp-* components don't cover:
   the summary box, numbered clauses, tables, definitions and the "last updated" line, plus a print stylesheet. */

/* Summary box at the top of each document */
/* Same look as the site's .cp-note callouts: sand panel, teal rule on the left */
.lg-summary {
  margin: var(--space-5) 0 0;
  padding: var(--space-3);
  background: var(--cp-soft);
  border-left: 4px solid var(--cp-deep);
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
}

.content-page .lg-summary h2 {
  margin-bottom: var(--space-1);
  font-size: 1.35rem;
}

.lg-summary ul {
  margin: 0;
  padding-left: 1.25rem;
}

.lg-summary li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.lg-summary__note {
  margin: var(--space-2) 0 0;
  font-size: 0.92rem;
  color: var(--cp-muted);
}

/* Numbered sections and clauses: "5." on the heading, "5.1" hanging beside each clause.
   Text runs the full width of the section, as on the guides. */

.lg-h-num {
  display: inline-block;
  min-width: 2.25rem;
  color: var(--color-accent-dark);
}

.lg-clause {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 0 var(--space-1);
  margin: 0 0 var(--space-2);
  line-height: 1.65;
}

@media (max-width: 40rem) {
  .lg-clause {
    grid-template-columns: 2.25rem minmax(0, 1fr);
  }

  /* A clause holding a table gives the table the full width: the number sits on its own line above */
  .lg-clause:has(.r2r-stack-wrap) > .lg-text {
    grid-column: 1 / -1;
    margin-top: 0.25rem;
  }
}

.lg-num {
  font-weight: 700;
  color: var(--cp-deep);
  font-variant-numeric: tabular-nums;
}

.lg-text > :first-child {
  margin-top: 0;
}

.lg-text > :last-child {
  margin-bottom: 0;
}

.lg-text p {
  margin: 0 0 var(--space-1);
}

.lg-text ul,
.lg-text ol {
  margin: 0 0 var(--space-1);
  padding-left: 1.25rem;
}

.lg-text li {
  margin-bottom: 0.35rem;
}

.lg-clause:target,
.lg-doc .cp-section:target h2 {
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.lg-clause:target {
  background: var(--cp-soft);
  outline: 2px solid var(--cp-line);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Definitions */
.lg-defs {
  margin: 0;
}

.lg-defs dt {
  font-weight: 700;
}

.lg-defs dd {
  margin: 0 0 var(--space-1);
}

/* Tables: cancellation scales, payment, lawful bases, processors, retention */
.lg-table-wrap {
  max-width: 100%;
  margin: var(--space-1) 0 var(--space-2);
  overflow-x: auto;
  border: 1px solid var(--cp-line);
  border-radius: var(--radius-card);
}

.lg-table-wrap:focus-visible {
  outline: 3px solid var(--color-black);
  outline-offset: 2px;
}

.lg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.5;
}

.lg-table caption {
  padding: var(--space-1) var(--space-2);
  text-align: left;
  font-weight: 700;
  color: var(--cp-deep);
  background: var(--cp-soft);
  border-bottom: 1px solid var(--cp-line);
}

.lg-table th,
.lg-table td {
  padding: 0.65rem var(--space-2);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--cp-line);
}

.lg-table thead th {
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cp-muted);
}

.lg-table tbody th {
  font-weight: 700;
}

.lg-table tr:last-child > * {
  border-bottom: 0;
}

/* Shared stacked-table pattern: .r2r-stack-wrap around a <table class="r2r-stack-table">, every <td> carrying
   data-label="<its column heading>". Wide screens get a normal table; under 40rem each row becomes a card, the
   row heading leads, and each cell is labelled from data-label. The <thead> stays in the accessibility tree.
   display:block drops table semantics in Safari/VoiceOver, so the markup carries static ARIA roles too
   (table, rowgroup, row, columnheader, rowheader, cell): keep them on any new stacked table.
   Used by the legal tables, the SUP clinic condition bands and the tides table (those pages load this file). */
@media (max-width: 40rem) {
  .r2r-stack-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .r2r-stack-wrap table.r2r-stack-table,
  .r2r-stack-wrap table.r2r-stack-table caption,
  .r2r-stack-wrap table.r2r-stack-table tbody,
  .r2r-stack-wrap table.r2r-stack-table tr,
  .r2r-stack-wrap table.r2r-stack-table th,
  .r2r-stack-wrap table.r2r-stack-table td {
    display: block;
    width: auto;
    min-width: 0;
  }

  .r2r-stack-wrap table.r2r-stack-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .r2r-stack-wrap table.r2r-stack-table caption {
    margin: 0 0 var(--space-1);
    padding: 0;
    background: none;
    border: 0;
    text-align: left;
    font-weight: 700;
    color: var(--cp-deep);
  }

  .r2r-stack-wrap table.r2r-stack-table tr {
    margin: 0 0 var(--space-1);
    padding: var(--space-2);
    background: var(--color-white);
    border: 1px solid var(--cp-line);
    border-radius: var(--radius-card);
  }

  .r2r-stack-wrap table.r2r-stack-table tr:last-child {
    margin-bottom: 0;
  }

  .r2r-stack-wrap table.r2r-stack-table th,
  .r2r-stack-wrap table.r2r-stack-table td {
    padding: 0;
    border: 0;
    background: none;
    white-space: normal;
  }

  .r2r-stack-wrap table.r2r-stack-table tbody th {
    margin: 0 0 0.5rem;
    font-weight: 700;
    color: var(--color-black);
  }

  .r2r-stack-wrap table.r2r-stack-table td + td {
    margin-top: 0.6rem;
  }

  .r2r-stack-wrap table.r2r-stack-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.1rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cp-deep);
  }
}

/* Footer of each document */
.lg-updated {
  margin: var(--space-5) 0 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--cp-line);
  font-size: 0.92rem;
  color: var(--cp-muted);
}

/* Hub: "the essentials in plain English". A plain surface panel (the accent top is kept for .lg-summary);
   four items go 1, then 2 x 2, then 4 across so there is never a lone half-row. */
.lg-essentials {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2) var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Pale blue panels, the same as the swim and add-on cards */
.lg-essentials > li {
  padding: var(--space-3);
  background: #e5f8ff;
  border: 1px solid rgba(0, 128, 163, 0.14);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}

@media (min-width: 40rem) {
  .lg-essentials {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 64rem) {
  .lg-essentials {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Hub document cards: at most three across, so six cards make two full rows */
.content-page .lg-cards {
  grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
}

.content-page .lg-essentials h3 {
  margin: 0 0 0.35rem;
}

.lg-essentials p {
  margin: 0;
  line-height: 1.6;
}

/* Clean printing: content only, black on white, link targets spelled out */
/* "On this page" pills: thirteen of them took about 300px on a phone. Tighter pills and gaps under 40rem,
   still 44px tall to tap. */
@media (max-width: 40rem) {
  .content-page .cp-toc {
    gap: 0.375rem 0.25rem;
    padding-top: var(--space-2);
  }

  .content-page .cp-toc a {
    padding: 0 0.7rem;
    border-width: 1px;
    font-size: 0.875rem;
  }
}

@media print {
  .site-header,
  .site-footer,
  .mobile-cta,
  .skip-link,
  .cp-toc,
  .cp-cta,
  .lg-related {
    display: none !important;
  }

  .content-page .cp-hero {
    padding: 0 0 1rem;
    background: none;
    color: #000;
    border-bottom: 2px solid #000;
  }

  .content-page .cp-hero h1,
  .content-page .cp-eyebrow,
  .content-page .cp-breadcrumb a,
  .content-page h2,
  .lg-num,
  .lg-h-num {
    color: #000;
  }

  .lg-summary,
  .lg-table-wrap,
  .lg-essentials {
    background: none;
    border-color: #000;
  }

  .lg-table-wrap {
    overflow: visible;
  }


  .lg-clause,
  .lg-table tr {
    break-inside: avoid;
  }

  .content-page h2 {
    break-after: avoid;
  }

  .cp-section {
    padding-top: 1.25rem;
  }

  .content-page .lg-doc a[href^="/"]::after {
    content: " (rivertoreefwatersafety.co.uk" attr(href) ")";
    font-size: 0.85em;
  }
}
