/* S4 — waiver & terms. Three parts:
   1. .waiver-text: the legal text itself. It's on /waiver, on every archived version
      (/waiver/<version>) and inside the registration form's "full waiver" panel, which copies
      it from /waiver (js/register.js). So /register loads this file too.
   2. The page: /waiver, the archived versions and /waiver/versions.
   3. Print: /waiver and the archived versions as a plain black-on-white document.
   Layout: one column up to 1099px, contents column + text from 1100px. */

/* ================= 1. The text ================= */
.waiver-text { --waiver-fs: 17px; --waiver-gap: 20px; font-size: var(--waiver-fs); line-height: 1.6; color: var(--text-muted); }
.waiver-section { display: flex; flex-direction: column; gap: var(--waiver-gap); }

/* The heading holds its own eyebrow: "Section 01" above the name here, "01 · Name" on one
   line where it's compact (the form's panel) and in print. */
.waiver-section__title { display: flex; flex-direction: column; gap: 12px; margin-bottom: 4px; font-size: 1em; font-weight: inherit; line-height: inherit; color: var(--text); }
.waiver-section__name { font-size: 34px; }

/* The paragraphs that have to stand out (WAIVER-TEXT.md: [CONSPICUOUS]). */
.waiver-text__conspicuous { padding: 20px 22px; background: var(--panel); border-top: 3px solid var(--red); font-weight: 700; color: var(--text); }
.waiver-text .waiver-text__list { display: flex; flex-direction: column; gap: 8px; margin-top: -4px; padding-left: 18px; border-left: 2px solid var(--line-strong); }
/* A note about the text, not part of the agreement (WAIVER-TEXT.md: [HINT]). */
.waiver-text__hint { display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 1.45; color: var(--text-subtle); }
.waiver-text__hint svg { flex: none; }

.waiver-text--compact { --waiver-fs: 15px; --waiver-gap: 14px; display: flex; flex-direction: column; gap: var(--waiver-gap); }
.waiver-text--compact .waiver-section__title { display: block; margin: 6px 0 0; font-size: 13px; font-weight: 800; line-height: 1.3; letter-spacing: 0.06em; text-transform: uppercase; }
.waiver-text--compact .waiver-section__num,
.waiver-text--compact .waiver-section__name { font: inherit; letter-spacing: inherit; color: inherit; }
.waiver-text--compact .waiver-section__num-word { display: none; }
.waiver-text--compact .waiver-section__num::after { content: " · "; }

@media (min-width: 1100px) {
  .waiver-text:not(.waiver-text--compact) { --waiver-fs: 18px; --waiver-gap: 22px; }
  .waiver-text:not(.waiver-text--compact) .waiver-section__title { margin-bottom: 6px; }
  .waiver-text:not(.waiver-text--compact) .waiver-section__name { font-size: 48px; }
}

/* ================= 2. The page ================= */
.waiver-page { position: relative; isolation: isolate; overflow: clip; }

/* Ghost slash behind the heading, the same one as /register's. */
.waiver-page__slash {
  position: absolute;
  z-index: -1;
  top: 8px;
  left: 28%;
  width: 138%;
  max-width: none;
  height: auto;
  aspect-ratio: 1000 / 236;
  fill: var(--red);
  opacity: 0.12;
  pointer-events: none;
}

/* ---------- Heading ---------- */
.waiver-hero__inner { display: flex; flex-direction: column; gap: 16px; padding-block: 28px; }
.waiver-back {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  min-height: 44px;
  margin: -8px 0 -4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
}
.waiver-back:hover { color: var(--text); opacity: 1; }
.waiver-hero__title { font-size: min(60px, 15.4vw); }
.waiver-hero__row,
.waiver-hero__copy { display: flex; flex-direction: column; gap: 16px; }
.waiver-hero__meta { font-size: 14px; font-weight: 700; line-height: 1.4; color: var(--text-subtle); }
.waiver-hero__url { display: none; } /* print only */
.waiver-hero__lead { font-size: 17px; line-height: 1.5; color: var(--text-muted); }
.waiver-hero__note { font-size: 14px; line-height: 1.45; color: var(--text-subtle); }
.waiver-hero__note a { color: var(--text); text-underline-offset: 3px; }
.waiver-hero__print { gap: 10px; width: 100%; margin-top: 4px; padding: 0 24px; }
.waiver-hero__print svg { flex: none; }
.no-js .waiver-hero__print { display: none; } /* it calls window.print() */

/* ---------- "On this page" ---------- */
.waiver-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
.waiver-toc { margin-bottom: 36px; background: var(--panel); border-top: 3px solid var(--red); }
.waiver-toc__label { padding: 18px 20px 6px; }
.waiver-toc__list a {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 8px 20px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
}
.waiver-toc__list li + li a { border-top: 1px solid var(--line-strong); }
.waiver-toc__num { flex: none; font-size: 13px; letter-spacing: 0.1em; color: var(--red-text); }
.waiver-toc__foot { display: none; }

/* ---------- Sections ---------- */
.waiver-article { min-width: 0; max-width: 720px; }
/* Phones: the rule above each section runs edge to edge. */
.waiver-page .waiver-section,
.waiver-end { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); border-top: 1px solid var(--line); }
.waiver-page .waiver-section { padding-block: 40px 8px; }

.waiver-end { display: flex; flex-direction: column; gap: 14px; padding-block: 40px 44px; }
.waiver-end p { font-size: 14px; line-height: 1.45; color: var(--text-subtle); }
.waiver-end p a { color: var(--text); text-underline-offset: 3px; overflow-wrap: anywhere; }
.waiver-end__back { gap: 10px; width: 100%; margin-top: 6px; padding: 0 24px; }
.waiver-end__back svg { flex: none; }

/* ---------- Back to top (below 1100px, once a screen's worth has scrolled by: waiver.js) ---------- */
.back-to-top {
  position: fixed;
  z-index: 40; /* under the sticky header (50) */
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: var(--text);
  color: var(--black);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.back-to-top:hover { opacity: 1; }
.back-to-top:focus-visible { outline-color: var(--red); }

/* ---------- Past versions (/waiver/versions) ---------- */
.waiver-versions { max-width: 720px; padding-bottom: 56px; }
.waiver-versions__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding-block: 14px;
  border-top: 1px solid var(--line-strong);
  text-decoration: none;
}
.waiver-versions li:last-child .waiver-versions__row { border-bottom: 1px solid var(--line-strong); }
.waiver-versions__name { display: block; font-size: 17px; font-weight: 700; line-height: 1.3; }
.waiver-versions__meta { display: block; margin-top: 4px; font-size: 14px; line-height: 1.4; color: var(--text-subtle); }
.waiver-versions__row svg { flex: none; }

@media (min-width: 700px) {
  .waiver-hero__inner { gap: 20px; padding-block: 48px 40px; }
  /* 112px at 1440, as in the design; "WAIVER & TERMS" (8.4em) stays on one line throughout. */
  .waiver-hero__title { font-size: clamp(60px, 7.78vw, 112px); }
  .waiver-hero__row { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 40px; }
  .waiver-hero__copy { gap: 10px; max-width: 700px; }
  .waiver-hero__meta { font-size: 15px; }
  .waiver-hero__lead { font-size: 19px; }
  .waiver-hero__print { flex: none; width: auto; margin-top: 0; }
  .waiver-page .waiver-section,
  .waiver-end { margin-inline: 0; padding-inline: 0; }
  .waiver-end { padding-bottom: 72px; }
  .waiver-end__back { align-self: flex-start; width: auto; }
  .waiver-versions { padding-bottom: 96px; }
}

@media (min-width: 1100px) {
  .waiver-page__slash { top: 13px; left: 13.9%; width: 76.4%; opacity: 0.09; }
  .waiver-hero { border-bottom: 1px solid var(--line); }
  .waiver-hero__inner { gap: 22px; padding-block: 64px 56px; }
  .waiver-back { margin-block: -14px; font-size: 15px; }

  .waiver-layout { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 32px; align-items: start; padding-block: 64px 96px; }
  .waiver-toc { position: sticky; top: calc(var(--header-h) + 24px); grid-column: span 3; margin-bottom: 0; }
  .waiver-toc__label { padding: 20px 22px 8px; }
  .waiver-toc__list a { align-items: flex-start; gap: 12px; min-height: 0; padding: 14px 22px; font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--text-muted); }
  .waiver-toc__list a:hover { color: var(--text); opacity: 1; }
  /* The section being read (waiver.js). */
  .waiver-toc__list a[aria-current] { font-weight: 700; color: var(--text); box-shadow: inset 3px 0 0 var(--red); }
  .waiver-toc__num { padding-top: 2px; font-size: 12px; }
  .waiver-toc__foot { display: flex; flex-direction: column; gap: 10px; padding: 18px 22px 22px; border-top: 1px solid var(--line-strong); }
  .waiver-toc__foot .btn { width: 100%; padding: 0 16px; }
  .waiver-toc__foot p { font-size: 13px; line-height: 1.45; color: var(--text-subtle); }
  .waiver-toc__foot p a { color: var(--text); text-underline-offset: 3px; overflow-wrap: anywhere; }

  .waiver-article { grid-column: 5 / span 7; }
  .waiver-page .waiver-section { padding-block: 56px 8px; }
  .waiver-page .waiver-section:first-child { padding-top: 0; border-top: 0; }
  .waiver-end { flex-direction: row; align-items: center; justify-content: space-between; gap: 24px; margin-top: 56px; padding-block: 32px 0; }
  .waiver-end p { font-size: 15px; }
  .waiver-end__questions { display: none; } /* it's under the contents column here */
  .waiver-end__back { flex: none; align-self: auto; margin-top: 0; }

  .back-to-top { display: none; }
  .waiver-versions { padding-block: 56px 96px; }
}

/* ================= 3. Print ================= */
/* /waiver and the archived versions print as a plain document: the heading with the version
   and address, then the text. The conspicuous paragraphs keep a border and stay bold. */
@media print {
  @page { margin: 0.6in 0.75in 0.75in; }

  [data-page="waiver"] { background: #FFFFFF; color: #000000; font-size: 11.5pt; line-height: 1.45; }
  [data-page="waiver"]::before, /* the grain */
  [data-page="waiver"] .skip-link,
  [data-page="waiver"] .preview-banner,
  [data-page="waiver"] .site-header,
  [data-page="waiver"] .site-footer,
  .waiver-page__slash,
  .waiver-back,
  .waiver-hero__lead,
  .waiver-hero__note,
  .waiver-hero__print,
  .waiver-hero__sep,
  .waiver-toc,
  .waiver-end,
  .back-to-top { display: none !important; }

  .waiver-page { overflow: visible; }
  .waiver-page .container { max-width: none; padding-inline: 0; }

  .waiver-hero { border-bottom: 2px solid #000000; }
  .waiver-hero__inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 6pt 24pt; padding-block: 0 12pt; }
  .waiver-hero .eyebrow { grid-column: 1; font-size: 8pt; color: #000000; white-space: nowrap; }
  .waiver-hero .eyebrow::before { content: "S4 Grappling Series · "; }
  .waiver-hero__title { grid-column: 1; font-size: 24pt; line-height: 1; letter-spacing: -0.03em; }
  .waiver-hero__row { display: block; grid-column: 2; grid-row: 1 / span 2; }
  .waiver-hero__meta { font-size: 9pt; font-weight: 400; line-height: 1.5; color: #000000; text-align: right; }
  .waiver-hero__meta > span { display: block; }

  .waiver-layout { display: block; padding-block: 6pt 0; }
  .waiver-article { max-width: none; }
  .waiver-text { font-size: 11.5pt; line-height: 1.45; color: #000000; }
  .waiver-page .waiver-section { display: block; margin: 0; padding: 0; border: 0; }
  .waiver-text .waiver-section__title { display: block; margin: 14pt 0 8pt; font-size: 13pt; font-weight: 800; line-height: 1.3; letter-spacing: 0.04em; text-transform: uppercase; color: #000000; break-after: avoid; }
  .waiver-text .waiver-section__num,
  .waiver-text .waiver-section__name { font: inherit; letter-spacing: inherit; color: inherit; }
  .waiver-text .waiver-section__num-word { display: none; }
  .waiver-text .waiver-section__num::after { content: " · "; }
  .waiver-text p { margin: 0 0 8pt; orphans: 3; widows: 3; }
  .waiver-text__conspicuous { padding: 8pt 10pt; border: 1.5pt solid #000000; background: none; font-weight: 700; color: #000000; break-inside: avoid; }
  .waiver-text .waiver-text__list { display: block; margin: 0 0 8pt; padding-left: 16pt; border: 0; }
  .waiver-text__hint { display: block; font-size: inherit; font-style: italic; line-height: inherit; color: #000000; }
  .waiver-text__hint svg { display: none; }
}
