/* Racing pages: the course cards' mastheads, and the printable course cards
   page. Named in the front matter of the pages that use it (the racing hub,
   each race page and /racing/course-cards/), so site.css stays in budget.
   The map rules themselves are in site.css, shared with the harbour pages. */

/* Masthead: the course number in a navy tile on the left, the heading, and
   the wind tile on the right, in the navy of structure rather than the
   emblem red the map's port badges wear, so a big "3" never reads as leg 3.
   The Balmain cards have no number, so their letter tile stands alone. */
.course-head { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "no head dir"; gap: .2rem .8rem; align-items: center; margin: 0 0 .3rem; }
.course-head-dir { grid-template-columns: 1fr auto; grid-template-areas: "head dir"; }
.course-head h2, .course-head h3 { grid-area: head; margin: 0; }
.course-tile { display: inline-grid; justify-items: center; min-width: 3.2rem; padding: .3rem .5rem .35rem; border: 2px solid var(--navy); border-radius: 4px; line-height: 1; font-weight: 700; font-size: 1.55rem; letter-spacing: .02em; white-space: nowrap; }
.course-tile small { font-size: .56rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; margin-bottom: .22rem; }
.course-no { grid-area: no; background: var(--navy); color: #FFF; }
.course-dir { grid-area: dir; justify-self: end; color: var(--navy); background: var(--card); }
/* The wind tile's rose: a ring, north up, the winds' sector filled, drawn
   by windRose in lib/racing/course-map.js. */
.rose-row { display: inline-flex; align-items: center; gap: .35rem; }
/* the ring is as tall as the letters' line and centred on their capitals,
   which sit a little above the line's middle, so it never reaches the label */
.rose { display: block; width: 1em; height: 1em; position: relative; top: -.06em; }
.rose-ring { fill: #FFF; stroke: var(--navy); stroke-width: 1.5; }
.rose-sector { fill: var(--navy); }
.rose-hub { fill: #FFF; }
/* On a phone the tiles keep their corners and the heading drops under them;
   on the narrowest, the tiles shrink so Course 5's three winds and its rose
   still fit beside the number. */
@media (max-width: 30rem) {
  .course-head { grid-template-columns: auto 1fr; grid-template-areas: "no dir" "head head"; }
  .course-head-dir { grid-template-columns: 1fr; grid-template-areas: "dir" "head"; }
}
@media (max-width: 22rem) { .course-tile { font-size: 1.3rem; } }

/* Landing beaches, where a rescue boat tows a capsized skiff to right it: a
   star on every map, in the emblem red, numbered on the landing beaches map
   and in its list; the list's badge takes the same red. */
.mk-beach { fill: var(--emblem); stroke: #FFF; }
.lbl-beach { fill: var(--emblem-ink); }
.leg-beach { background: var(--emblem); }
.landing-map { max-width: 40rem; }
.beach-list .leg-note { color: var(--slate); }

/* The day's program on a race page: a time and what happens at it, the time
   column no wider than its longest time so the events get the room. */
.day-program td:first-child, .day-program th:first-child { white-space: nowrap; width: 1%; }

/* The course cards page: on screen a column of cards; in print one A5 page
   a course, with a cover that carries the key. A named page, so the A5 size
   touches nothing else that prints with this stylesheet; the whole page sits
   in it, or Chrome puts a blank page of the default size before the cover. */
@page cards { size: A5 portrait; margin: 9mm 9mm 8mm; }
.cards-print { page: cards; }
.card-page { background: var(--card); border: 1px solid var(--canvas-2); border-top: 3px solid var(--emblem); padding: 1rem 1rem 1.1rem; margin: 0 0 1.25rem; max-width: 36rem; }
.card-page .course-map { max-width: none; }
.card-page .map { margin-inline: -1rem; width: calc(100% + 2rem); border-inline: 0; }
.card-page .meta-line { margin: 0; }
.card-foot { margin: .5rem 0 0; font-size: .78rem; color: var(--slate); }
/* The signal pages: the race flags, the two countdowns and the handicap
   boards in the guide pages' own markup from site.css, packed for A5. */
.card-signals h2 { margin: 0 0 .3rem; }
.card-signals .guide-lede { font-size: .98rem; line-height: 1.45; margin: 0 0 .6rem; }
.card-signals .guide-tip { font-size: .88rem; margin: 0 0 .5rem; padding: .45rem .7rem; }
.card-signals .guide-tip p { line-height: 1.45; }
.card-page .signals-heading { font-family: var(--sans); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--slate); margin: .5rem 0 .25rem; }
/* a group's signals in one row, three across, so a row is never one card */
.card-signals .signals { gap: .35rem; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }
.card-signals .signals-wide { grid-template-columns: 1fr; }
/* a recall's title and its flags share a line, the note under both */
.card-signals .signals-wide .signal { padding: .3rem .5rem; }
.card-signals .signals-wide .signal-text { display: grid; grid-template-columns: auto 1fr; gap: 0 .6rem; align-items: baseline; }
.card-signals .signals-wide .signal-text p:not(.signal-flown) { grid-column: 1 / -1; line-height: 1.35; }
.card-signals .card-foot { margin-top: .35rem; }
.card-signals .signal { grid-template-columns: 2.6rem 1fr; gap: .5rem; padding: .4rem .5rem; }
.card-signals .signal-text h4 { margin: 0 0 .1rem; font-family: var(--sans); font-size: .88rem; font-weight: 700; color: var(--navy); line-height: 1.25; }
.card-signals .signal-text p { margin: .1rem 0; font-size: .8rem; line-height: 1.4; }
.card-signals .signal-flown { font-size: .8rem; }
.card-signals .countdown-steps { margin: .4rem 0; max-width: none; }
.card-signals .countdown-step { grid-template-columns: 3.4rem 1fr auto; grid-template-areas: "when what flags"; gap: .2rem .7rem; padding: .35rem 0; align-items: center; }
.card-signals .countdown-when { padding: .3rem .2rem; }
.card-signals .countdown-min { font-size: 1.3rem; }
.card-signals .countdown-time { margin-top: .15rem; font-size: .72rem; }
.card-signals .countdown-what h3 { margin: 0 0 .1rem; font-family: var(--sans); font-size: .92rem; font-weight: 700; letter-spacing: 0; }
.card-signals .countdown-what p { margin: .1rem 0; font-size: .85rem; line-height: 1.4; }
.card-signals .countdown-flags { justify-content: flex-end; min-height: 0; padding-right: .2rem; }
.card-signals .horn { font-size: .62rem; padding: .05rem .35rem; }
.card-signals .card-note { font-size: .9rem; margin: .4rem 0; }
/* The handicap boards: the number on the start boat, drawn at the moments
   that matter. */
.boards { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .45rem; }
.board-step { display: grid; grid-template-columns: 2.6rem 3.2rem 1fr; gap: .6rem; align-items: center; font-size: .85rem; }
.board { display: grid; place-items: center; height: 2.2rem; border: 3px solid var(--ink); background: #FFF; font-weight: 800; font-size: 1.3rem; line-height: 1; font-variant-numeric: tabular-nums; }
.board-when { font-weight: 700; font-variant-numeric: tabular-nums; }

/* The radio, on /racing/radio/ and the book's radio page: the two channels
   in tiles, the race committee's navy and distress the emblem red; the rule
   for which call to make; and the two calls as scripts, side by side where
   there is room, each line the words to say with the blanks to fill drawn as
   slots. */
.channels { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.channel { display: grid; grid-template-columns: auto 1fr; gap: .9rem; align-items: center; background: var(--card); border: 1px solid var(--canvas-2); padding: .75rem .9rem; }
.channel-tile { font-size: 2rem; min-width: 4.4rem; background: var(--navy); color: #FFF; }
.channel-distress .channel-tile { background: var(--emblem); border-color: var(--emblem); }
.channel h3 { margin: 0 0 .15rem; font-size: 1.05rem; }
.channel p { margin: 0; font-size: .9rem; line-height: 1.45; color: var(--slate); }
/* which call: the situation, then the call in bold, the MAYDAY row in red */
.call-rule { list-style: none; padding: 0; margin: 0; display: grid; gap: .1rem; }
.call-rule li { display: grid; gap: 0 .8rem; padding: .3rem 0; border-top: 1px solid var(--canvas-2); }
.call-rule li:first-child { border-top: 0; }
.rule-call { font-weight: 700; color: var(--navy-2); }
.rule-1 .rule-call { color: var(--emblem-ink); }
@media (min-width: 30rem) { .call-rule li { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.calls { display: grid; gap: 1rem; margin: 1rem 0; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.call { background: var(--card); border: 1px solid var(--canvas-2); border-top: 3px solid var(--navy-2); padding: 0 1rem 1rem; }
.call-mayday { border-top-color: var(--emblem); }
.call-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: .2rem .8rem; padding: .8rem 0 .5rem; border-bottom: 1px solid var(--canvas-2); }
.call-word { margin: 0; font-family: var(--sans); font-size: 1.6rem; font-weight: 800; letter-spacing: .04em; color: var(--navy-2); }
.call-mayday .call-word { color: var(--emblem-ink); }
.call-when { margin: 0; font-weight: 600; font-size: .95rem; }
.call-meta { margin: .4rem 0 0; font-size: .92rem; line-height: 1.45; }
.call-label { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--slate); margin-right: .25rem; }
/* the script: numbered lines, the words to say in bold, a blank a dashed
   slot in italics, the example and the alternative small beneath */
.script { list-style: none; counter-reset: line; padding: 0; margin: .7rem 0 0; }
.script li { counter-increment: line; display: grid; grid-template-columns: 1.5rem 1fr; gap: 0 .5rem; padding: .45rem 0; border-top: 1px solid var(--canvas-2); }
.script li::before { content: counter(line); font-size: .8rem; font-weight: 700; color: var(--slate); padding-top: .25rem; font-variant-numeric: tabular-nums; }
.say { grid-column: 2; margin: 0; font-weight: 700; font-size: 1.05rem; line-height: 1.45; }
.blank { display: inline-block; font-weight: 500; font-style: italic; color: var(--slate); border-bottom: 2px dashed var(--slate); padding: 0 .15em; line-height: 1.2; }
.say-or, .say-eg { grid-column: 2; margin: .15rem 0 0; font-size: .85rem; line-height: 1.4; color: var(--slate); }
.say-or strong { color: var(--ink); }
/* packed for the book's two A5 pages, one call a page: the channels two
   across wherever the page is wide enough, and in print; the script at a
   size to read on the water */
.card-radio .channels { gap: .4rem; margin: .4rem 0 .5rem; }
.card-radio .channel { padding: .4rem .55rem; gap: .55rem; }
.card-radio .channel-tile { font-size: 1.5rem; min-width: 3.4rem; padding: .25rem .4rem .3rem; }
.card-radio .channel h3 { font-family: var(--sans); font-size: .9rem; margin: 0 0 .05rem; }
.card-radio .channel p { font-size: .76rem; line-height: 1.35; }
.card-radio .guide-tip { padding: .3rem .6rem; }
.card-radio .call-rule li { font-size: .82rem; line-height: 1.35; padding: .2rem 0; }
.card-radio .call { margin: .6rem 0 0; padding: 0 .7rem .5rem; }
.card-radio .call-head { padding: .5rem 0 .35rem; gap: 0 .6rem; }
.card-radio .call-word { font-size: 1.3rem; }
.card-radio .call-when { font-size: .84rem; }
.card-radio .call-meta { font-size: .8rem; line-height: 1.4; margin: .3rem 0 0; }
.card-radio .call-label { font-size: .6rem; }
.card-radio .script { margin: .45rem 0 0; }
.card-radio .script li { grid-template-columns: 1.2rem 1fr; gap: 0 .35rem; padding: .32rem 0; }
.card-radio .script li::before { font-size: .72rem; padding-top: .2rem; }
.card-radio .say { font-size: .95rem; line-height: 1.35; }
.card-radio .say-or, .card-radio .say-eg { font-size: .76rem; line-height: 1.35; margin-top: .1rem; }
@media print, (min-width: 30rem) {
  .card-radio .channels { grid-template-columns: 1fr 1fr; }
}

/* The cover: the club's roundel, the title and the version in a tile, all
   centred, then the key one to a row, large, as the marks list under each
   map. */
.cover-head { text-align: center; margin: .5rem 0 1.4rem; }
.cover-mark { display: block; width: 9rem; height: auto; margin: 0 auto .9rem; }
.card-cover h1 { margin: 0 0 .7rem; }
.cover-version { margin: 0; }
.cover-version .course-tile { font-size: 1.25rem; padding: .35rem .7rem .4rem; }
.card-cover .map-key { display: grid; grid-template-columns: 1fr; gap: .35rem; margin: .4rem 0 1rem; font-size: 1.02rem; color: var(--ink); }
/* symbols in a column of their own, so the labels line up */
.card-cover .map-key li { display: grid; grid-template-columns: 4.2rem 1fr; gap: .6rem; align-items: center; }
.card-cover .map-key svg { width: 2.1rem; height: 2.1rem; justify-self: center; }
.card-cover .map-key .map-key-wide { width: 4rem; }
.card-cover .map-credit { font-size: .78rem; margin: .3rem 0 0; }
.card-cover .map-credit a { color: inherit; }
@media print {
  body { background: #FFF; }
  .wrap { max-width: none; padding: 0; }
  .skip, .crumbs, .cards-print-hide { display: none; }
  .card-page { break-after: page; break-inside: avoid; border: 0; padding: 0; margin: 0; max-width: none; }
  .card-page .map { margin-inline: 0; width: 100%; border: 1px solid var(--canvas-2); }
  /* On the page the tiles take the corners and the heading runs under them
     at full width, as on a phone, so a long name never breaks at its hyphen
     beside a wide wind tile. */
  .card-page .course-tile { font-size: 2rem; min-width: 4rem; }
  .card-page .course-head { grid-template-columns: auto 1fr; grid-template-areas: "no dir" "head head"; }
  .card-page .course-head-dir { grid-template-columns: 1fr; grid-template-areas: "dir" "head"; }
  .card-page h2 { font-size: 1.25rem; margin-top: .15rem; }
  /* the cover's foot sits at the page's foot */
  .card-cover { display: flex; flex-direction: column; min-height: 182mm; }
  .card-cover .card-foot { margin-top: auto; }
  .cover-head { margin: 2mm 0 5mm; }
  .cover-mark { width: 42mm; }
  .card-cover h1 { font-size: 2.2rem; }
  .cover-version .course-tile { font-size: 1.5rem; }
  /* nine key rows, with the landing beach, and the foot share the cover */
  .card-cover .map-key { gap: .22rem; font-size: .95rem; margin: .3rem 0 .6rem; }
  .card-cover .map-key li { grid-template-columns: 3.6rem 1fr; }
  .card-cover .map-key svg { width: 1.8rem; height: 1.8rem; }
  .card-cover .map-key .map-key-wide { width: 3.4rem; }
  /* seven rows of marks, the map and the masthead fit one A5 page */
  .card-page .course-legs { font-size: .95rem; line-height: 1.35; gap: .3rem; margin: .6rem 0; }
  /* the landing beaches page: the map narrower and ten beaches with their
     notes a step smaller, so the heading, the map, the list and the foot
     share one A5 page */
  .card-landings .map { width: 74%; margin-inline: auto; }
  .card-landings .course-legs { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(5, auto); grid-auto-flow: column; gap: .15rem .7rem; font-size: .76rem; line-height: 1.25; margin: .4rem 0; }
  .card-landings .course-legs li { grid-template-columns: 1.5rem 1fr; gap: .35rem; }
  .card-landings .leg-badge { min-width: 1.25rem; height: 1.25rem; font-size: .68rem; }
}
