/* Long reading on a pale ticket: a measured column, numbered clauses, contents beside it on a wide window. Grouped: layout, type, colour, motion. */

/* ---------- LAYOUT ---------- */

:root {
  --paper-column: 42rem;
  --contents-width: 15rem;
  --clause-gap: clamp(1.5rem, 1rem + 2vw, 2.5rem);
}

.ticket { gap: 1.25rem var(--clause-gap); }

/* Contents list: a small double-framed panel above the clauses, or beside them. */
.ticket > nav { padding: 1.1rem 1.25rem; align-self: start; }
.ticket > nav > p { margin-block-end: 0.5rem; }
.ticket > nav > ol { display: grid; gap: 0.1rem; margin: 0; padding-inline-start: 1.4rem; }
.ticket > nav li > a { display: inline-flex; align-items: center; min-block-size: 2.75rem; }

/* Clauses: each section is one numbered clause; the counter lives on the wrapping div. */
.ticket > nav + div { min-inline-size: 0; counter-reset: clause; }
.ticket > nav + div > section { counter-increment: clause; max-inline-size: var(--paper-column); scroll-margin-block-start: 1.5rem; }
.ticket > nav + div > section + section { margin-block-start: var(--clause-gap); }
.ticket > nav + div > section > :is(p, ul, ol, dl, address) { margin-block: 0 0.9rem; }
.ticket > nav + div :is(ul, ol) { padding-inline-start: 1.4rem; }
.ticket > nav + div li + li { margin-block-start: 0.35rem; }
.ticket > nav + div dd { margin-inline-start: 0; margin-block-end: 0.75rem; }
.ticket > nav + div button { margin-block-start: 0.25rem; }

/* Not-found page: one small photograph inside the ticket. */
.ticket > figure { inline-size: min(100%, 22rem); margin-inline: auto; }
.ticket > figure > img { aspect-ratio: 16 / 9; }

@media (min-width: 62rem) {
  .ticket:has(> nav) { display: grid; grid-template-columns: var(--contents-width) minmax(0, 1fr); align-items: start; }
  .ticket:has(> nav) > :is(h1, p) { grid-column: 1 / -1; }
}

/* ---------- TYPE ---------- */

.ticket > nav { font-size: 1rem; line-height: 1.35; }
.ticket > nav > p { font-family: var(--jost); font-weight: 500; font-size: 1.2rem; }
.ticket > nav + div { font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.125rem); line-height: 1.65; }
.ticket > nav + div > section > h2 { font-size: clamp(1.375rem, 1.15rem + 0.9vw, 1.75rem); }
.ticket > nav + div > section > h2::before { content: counter(clause) ". "; font-variant-numeric: lining-nums tabular-nums; }
.ticket > nav + div dt { font-weight: 700; }
.ticket > nav + div address { font-style: normal; }
.ticket > nav + div a, .ticket > p a { text-underline-offset: 0.2em; }

/* ---------- COLOUR ---------- */

/* The contents panel repeats the ticket device: a 2px outer stroke, a gap, a 1px inset stroke. */
.ticket > nav {
  border: var(--twine) solid var(--magenta);
  box-shadow: inset 0 0 0 0.25rem var(--blush), inset 0 0 0 calc(0.25rem + var(--thread)) var(--magenta);
}
.ticket > nav + div a, .ticket > nav a { text-decoration-color: var(--magenta); }

/* ---------- MOTION ---------- */

.ticket a { transition: text-decoration-thickness 200ms ease-out; }
.ticket a:hover { text-decoration-thickness: 0.18em; }

@media (prefers-reduced-motion: reduce) {
  .ticket a { transition: none; }
}
