/* The home page, set like the title page of an old travel book: one centre line, one measure, one leading, and the
   camp from the end of the Quest Log trail as a small painted plate between the tagline and the intro.
   This file sets all of the type, so the page stands with the script blocked. js/home.js only adds the drawings,
   inside .camp-stage, placed from where the words actually are.
   The widths written as plain numbers (13.19, 15.464) are the widths of phrases in Young Serif, in em, measured in
   the page with kerning on. If the words or the typeface change, measure them again. */

/* ---------------------------------------------------------------------------------------------- the stage */
/* the words stay on top of anything drawn */
.camp .hero--quiet > h1, .camp .hero--quiet > p { position: relative; z-index: 2; }
.camp-stage { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .35s ease; }
html.camp-on .camp-stage { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .camp-stage { transition: none; } }

/* "why?" is set in the site's purple; the ink ring round it is not used, and no room is kept for it */
.camp .circ { position: static; display: inline; padding: 0; margin: 0; color: var(--accent); }
.camp .circ svg { display: none; }
.camp .hero--quiet .tagline { max-width: none; text-wrap: initial; }
.camp .hero--quiet > h1 { padding-right: 0; }
.camp > .wrap--hero, .camp .hero--quiet { max-width: none; }
main.camp ~ .foot { max-width: none; }

/* a painted piece: its washes (a bitmap mixed for this wall) under its ink (vector) */
.cp { position: absolute; left: 0; top: 0; }
.cp > img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }
.cp[hidden] { display: none; }
/* the paper cutout is drawn by the WebGL layer; once it is up the flat drawing steps aside. The card arrives a moment
   after the camp is shown, so the two cross-fade rather than swap. */
.cp--flat, .cp--under { transition: opacity .4s ease, visibility 0s linear 0s; }
.cp--flat.is-card { opacity: 0; visibility: hidden; transition: opacity .4s ease, visibility 0s linear .4s; }
.cp--under { opacity: 0; visibility: hidden; }
.cp--under.is-card { opacity: 1; visibility: visible; }

.camp-gl { position: absolute; left: 0; top: 0; display: block; opacity: 0; transition: opacity .4s ease; }
.camp-gl.is-up { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .cp--flat, .cp--flat.is-card, .cp--under, .camp-gl { transition: none; } }
.camp-ink { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.camp-ink .hk-ink { fill: var(--ink); }

/* smoke: two drawings of it, one fading slowly into the other; loose scraps climb it */
.cp--plume { opacity: 1; }
.cp--plume-b { opacity: 0; }
.cp--wisp { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .cp--plume { animation: camp-plume-a 9s ease-in-out infinite alternate; }
  .cp--plume-b { animation: camp-plume-b 9s ease-in-out infinite alternate; }
  .cp--wisp { will-change: transform, opacity; animation: camp-wisp 8.2s linear infinite; }
}
@keyframes camp-plume-a { 0%, 18% { opacity: 1; } 82%, 100% { opacity: 0; } }
@keyframes camp-plume-b { 0%, 18% { opacity: 0; } 82%, 100% { opacity: 1; } }
@keyframes camp-wisp {
  0%   { transform: translate(0, 0) scale(.5); opacity: 0; }
  18%  { opacity: .8; }
  60%  { opacity: .55; }
  100% { transform: translate(var(--dx, -8px), var(--dy, -70px)) scale(1.25); opacity: 0; }
}
/* the smoke that answers the pointer (js/home.js Stir): inside each of the two drawings' pieces the wash is shown on a
   canvas and the pen in an SVG of its own, and the painted pictures step out of sight behind them.
   (No pointer events: the page under the smoke is clicked, selected and scrolled as if nothing were there.) */
.cp > .cp-stir { position: absolute; display: none; pointer-events: none; }
.cp.is-stir > .cp-stir { display: block; }
.cp.is-stir > img { visibility: hidden; }

/* ---------------------------------------------------------------------------------------------- the page
     --M   the measure. The longest phrase (13.19em wide) is set to fill it, which gives the phrases their size, --F.
           The name, in capitals spaced --ls apart (11.264em of letters and fourteen gaps), fills it too: --N.
           So the first line of the page and the last line of the tagline are one width, and the plate under them
           is cut to that width as well.
     --L   the leading: baseline to baseline of the phrases. Every distance down the page is counted in it.
   The measure grows with the window, so the page is as large in a big window as in a small one: a little over half
   the width beside the menu, held to what the window's height can show. Name, tagline, plate and intro come to
   about .95 of the measure, and with whites of half a measure and the footer the whole page is about 1.45 measures
   and 144px high (204px with the menu bar), which is where 69vh - 99px comes from.
   The page is a grid of eight rows: head margin, the name with its rule, the tagline, a white, the plate, a white,
   the intro, foot margin. The four whites share what the window has left over in fixed parts (--head, --g1, --g2,
   --foot), each with a least size, so the page keeps one rhythm at every height: title, picture, a line under the
   picture, and the links at the foot as the imprint. Nothing is stranded in a tall window or crowded in a short one.
   The plate's row (--plate) is kept by this stylesheet, not by the script: the script draws the camp into whatever
   room the row has, so nothing moves when the drawings arrive. Where the script cannot run the row closes up. */
.camp--title { --vh: 1vh; --M: clamp(400px, min((100vw - 220px) * .52, 69 * var(--vh) - 99px), 760px); --ls: .3em;
  --P: 13.19;                                 /* the longest phrase's width in em */
  --F: calc(var(--M) / var(--P)); --N: calc(var(--M) / 15.464); --L: calc(var(--F) * 1.32);
  --g: 2.2;                                   /* name's baseline to the first phrase's, in leadings */
  --rh: calc(var(--F) * .34);                 /* the height of the rule's box (its diamond) */
  --plate: calc(var(--M) * .331);             /* the plate is a measure wide; its painting is 480 by 159 */
  --gap1: calc(var(--L) * .8); --gap2: calc(var(--L) * .4); --head0: 24px; --foot0: 12px;      /* the least each white may be */
  --head: 5fr; --g1: 3.4fr; --g2: 1.9fr; --foot: 2.6fr; }                                       /* how they share the rest */
@supports (width: round(1.5px, 1px)) { .camp--title { --L: round(calc(var(--F) * 1.32), 1px); } }
@supports (height: 1svh) { .camp--title { --vh: 1svh; } }       /* (the window with a phone's or tablet's bars showing, as the page's own min-height is) */
/* (under 1180px the menu is a bar across the top, which is head room already) */
@media (max-width: 1179px) { .camp--title { --M: clamp(400px, min(30vw + 220px, 69 * var(--vh) - 141px), 540px); --head: 3fr; --g1: 3.6fr; --g2: 2fr; --foot: 3.4fr; } }
@media (max-width: 650px) { .camp--title { --M: min(100vw - 48px, 420px); --plate: calc(var(--M) * .379); } }
/* no script, or the script could not draw the camp: the plate's row closes */
html:not(.js) .camp--title, html.camp-off .camp--title { --plate: 0px; --gap1: 0px; --g1: 0fr; }
/* the page's own column fills the space above the footer, and the hero fills the column. (gap: 0, because the site's
   .hero still carries a row-gap of 22px from an older layout, which would be added between every pair of rows.) */
.camp--title > .wrap--hero { flex: 1 0 auto; display: flex; flex-direction: column; }
.camp--title .hero--quiet { flex: 1 0 auto; display: grid; gap: 0; grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: 0 20px;
  grid-template-rows: minmax(var(--head0), var(--head)) auto auto minmax(var(--gap1), var(--g1)) var(--plate) minmax(var(--gap2), var(--g2)) auto minmax(var(--foot0), var(--foot)); }
/* The name: one line of the leading high. (A spaced line carries its last gap after its last letter; taking that
   gap back off the last word leaves the letters themselves on the centre line, and exactly the measure wide.) */
.camp--title .hero--quiet > h1 { grid-row: 2; font-size: var(--N); line-height: var(--L); letter-spacing: var(--ls); text-transform: uppercase; white-space: nowrap; }
.camp--title .nm2 { margin-right: calc(var(--ls) * -1); }
/* The swelled rule: two pen strokes swelling toward a diamond, drawn with the plate's own pen. It stands midway
   between the name's baseline and the tops of the first phrase's capitals: with this face (baseline .34em under the
   middle of its line, capitals .75em high) that is --x under the name's line, and the tagline then starts --y under
   the rule. */
.camp--title { --x: calc((var(--g) * var(--L) - .75 * var(--F)) / 2 - var(--L) / 2 + .34 * var(--N) - var(--rh) / 2);
  --y: calc((var(--g) - 1) * var(--L) - .34 * (var(--F) - var(--N)) - var(--x) - var(--rh)); }
.camp--title .hero--quiet > h1::after { content: ''; display: block; width: calc(var(--M) * .31); height: var(--rh); margin: var(--x) auto 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 20' preserveAspectRatio='none'%3E%3Cpath fill='%231B242C' fill-rule='evenodd' d='M238 9.68l-32.71-1.35-13.11-0.74-19.62-0.48-13.08 0.33-6.52 0.36-10.9 0.31-4.36 0.49-2.19 0.41-0.02 2.07 2.17 0.57 4.36 0.69 6.54 0.06 17.47-0.44 8.73-0.06 19.64 0.31 32.69-1.21 6.55-0.42 4.36-0.4zM2 10.24l10.9 0.8 10.92 0.28 61.06 1.1 6.53 0.1 6.52-0.02 4.4-0.67 2.18-0.62-0.01-2.18-2.19-0.39-4.34-0.48-6.56-0.23-17.45-0.48-13.07 0.19-13.1-0.25-6.54 0.11-8.73 0.32-19.62 1.34-10.89 0.58zM119.81 17.94l8.09-7.92-8.02-7.85-7.93 7.56z'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
.camp--title .hero--quiet > .tagline { grid-row: 3; font-size: var(--F); line-height: var(--L); margin-top: var(--y); }
/* (every phrase ends in a full stop, which weighs next to nothing: the lines are moved a tenth of an em to the right,
   so it is their letters that stand on the centre line and the stops hang) */
.camp--title .tp { display: block; position: relative; left: .1em; }
.camp--title .hero--quiet > .intro-todo { grid-row: 7; max-width: min(max(var(--M), 20em), 100%); margin: 0; text-wrap: balance; }
/* (the intro is the line under the plate: it keeps to the same measure, and grows a little with a large page) */
@media (min-width: 1180px) { .camp--title .hero--quiet > .intro-todo { font-size: clamp(19px, calc(var(--M) * .033), 22px); } }
main.camp--title ~ .foot { justify-content: center; padding-left: 20px; padding-right: 20px; }
/* Centred on the window, not on the space beside the menu. Where the menu is a rail down the left, the column is
   centred in what is right of it, so the page is moved back by half the rail. That leaves the content at least
   160px clear of the rail at 1180px. */
@media (min-width: 1180px) { .camp--title .hero--quiet, main.camp--title ~ .foot { padding-right: calc(20px + 220px); } }
