/* The landing page. Colours and fonts come from theme.css, which every page
   loads first. */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image: var(--lattice);
  font-family: var(--serif);
  color: var(--ink);
}

/* ---------- the sheet ---------- */

/* A column, not a page. Nothing inside runs wider than the lead's measure
   or the map's sheet, so a panel half again as wide as its widest contents
   only read as margin that had not been decided on. */
.landing {
  /* One column for the whole page. The rule, the lead and the map all take
     this width, so they share a left and a right edge; before, three
     different measures meant nothing below the title lined up with
     anything above it. The title keeps the full width: it is the masthead,
     and it needs the room at its largest size. */
  --col: 440px;

  width: min(680px, calc(100% - 48px));
  margin: 36px auto;
  padding: 48px 44px 40px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--silk);
  border-radius: var(--radius);
  background: var(--paper-2);
  box-shadow: 0 1px 0 var(--line-soft), 0 18px 40px -32px rgba(28, 25, 21, 0.5);
}

/* ---------- the title ---------- */

h1 {
  margin: 0;
  font-family: var(--display);
  /* A quarter down from 36/6.2/60: the title had been set to fill the width
     of the panel, which made it the loudest thing on a page whose argument
     is in the paragraphs underneath. */
  font-size: clamp(27px, 4.65vw, 45px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.01em;
  text-align: center;
}

/* The ornamental rule below the subtitle does the dividing now, so the
   double hairline that used to sit here is gone. */
.subtitle {
  margin: 16px auto 0;
  max-width: var(--col);
  text-align: center;
  font-size: clamp(15px, 2.1vw, 20px);
  font-weight: 400;
  line-height: 1.25;
  color: var(--ink-2);
}

/* Ranged left, and on the map's measure. Centred, each line broke where
   the width happened to run out, so both edges were ragged and no line
   started where the one above it did -- which is what made the block look
   out of true. One straight left edge, shared with the sheet below. */
.intro {
  margin: 26px auto 0;
  max-width: var(--col);
  font-size: 17px;
  line-height: 1.78;
  text-align: left;
  color: var(--ink-2);
}
/* The lead runs to three paragraphs. Between them the gap is a paragraph's,
   not the one that separates the lead from the rule above it. */
.intro + .intro { margin-top: 14px; }

/* ---------- the map ----------
   The landing page is the course's first leg, so it is drawn on the same
   sheet as lessons/: parchment rather than paper, a firmer lattice, hairline
   edges and a kranok band closing each end the way a scroll is bound. The
   page around it is the desk; this is the map laid on it.

   The warm tones are redeclared here rather than inherited, exactly as the
   journey does it, so everything inside reads off the sheet's own ink and
   lines instead of fighting the ones outside. */

.roadmap {
  --sheet: var(--paper-2);
  --edge: var(--paper-3);
  --muted: var(--ink-3);

  position: relative;
  max-width: var(--col);
  margin: 42px auto 0;
  padding: 54px 18px 46px;
  background: var(--paper) var(--lattice-firm);
  border-left: 1px solid var(--edge);
  border-right: 1px solid var(--edge);
  box-shadow: 0 0 36px -22px rgba(0, 0, 0, 0.55);
}
.roadmap::before,
.roadmap::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 18px;
  background: var(--kranok-band) repeat-x center / auto 18px;
}
.roadmap::before { top: 14px; }
.roadmap::after  { bottom: 14px; }

/* The road: the same faint track the lesson map uses for the way not yet
   walked. Gold is kept for ornament, where it counts for more. */
.road {
  position: absolute;
  left: 50%;
  top: 48px;
  bottom: 48px;
  width: 0;
  border-left: 3px dotted var(--paper-3);
  transform: translateX(-1.5px);
}

/* ---------- a stop ---------- */

.stop {
  position: relative;
  display: block;
  width: min(100%, 320px);
  margin: 0 auto;
  text-decoration: none;
  color: var(--ink);
}
.stop + .stop { margin-top: 44px; }

.stop.silk   { --unit: var(--silk); }
.stop.indigo { --unit: var(--indigo); }
.stop.jade   { --unit: var(--jade); }

/* The figure stands at the head of its sign, on its own ground shadow. It
   had a gilt frame for one draft, which made it a card — and a card is
   something you look at rather than someone who is there. */
.figure {
  display: block;
  width: 112px;
  height: 168px;
  margin: 0 auto 6px;
  /* No ground of its own. A pale halo was tried here to lift the lines off
     the sheet's lattice and it read as a white patch behind the figure,
     which is worse than the problem: the figure stands ON the sheet, so the
     sheet has to show through. The weight below does that work instead. */
}
/* A tail or a crest swings a little past the box; clipping it is what would
   make the movement read as a fault rather than as breath. */
.figure svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* The drawing itself: ink for the figure, gold for what is ornament on it. */
/* A shade darker and a shade heavier than the drawing wants on blank paper:
   the lattice runs behind it, and a line has to beat the pattern to read. */
/* The drawn figures take their ink from the palette too, so an elephant on
   a dark wall is drawn in chalk rather than disappearing into it. */
.figure .art  { fill: none; stroke: var(--figure-ink, #2f2619); stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }
.figure .orn  { fill: none; stroke: var(--figure-gold, #a87c12); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.figure .fine { stroke-width: 0.95; opacity: 0.8; }
.figure .shade { fill: #000; opacity: 0.1; stroke: none; }
.figure .dot   { fill: var(--figure-ink, #2f2619); stroke: none; }

/* Breath, not animation: slow enough that you notice it only once you have
   stopped to read, and never in step between the three.
   One angle does NOT fit every part. A degree of rotation moves the far end
   of a long shape by a lot and the end of a short one by nothing, so the
   first draft — one amplitude for all — looked alive only on the serpent,
   whose whole raised body is what swings. The amplitude is set per part:
   small hanging things swing wide, the big body barely at all. */
.figure .bob,
.figure .sway,
.figure .flap { transform-box: fill-box; }

.figure .bob {
  transform-origin: 50% 100%;
  animation: oc-bob 5.6s ease-in-out infinite;
}
/* A tail, a trunk: 40-odd units long against a body ten times that, so it
   takes a wider angle than the body to swing by the same amount. */
.figure .sway {
  transform-origin: 50% 4%;
  animation: oc-sway 4.8s ease-in-out infinite;
}
/* The serpent's whole raised body, ten times that length. The same angle
   here would have it toppling. */
.figure .sway.wide {
  animation-name: oc-sway-wide;
  animation-duration: 6.4s;
}
.figure .sway.s2 { animation-duration: 5.6s; }
/* An ear, hinged at its front edge. */
.figure .flap {
  transform-origin: 8% 30%;
  animation: oc-flap 3.8s ease-in-out infinite;
}

/* "A little" is the brief, and it was already being met: these are a touch
   above where they started, not a step up in kind. */
@keyframes oc-bob       { 0%, 100% { transform: translateY(0); }   50% { transform: translateY(-3px); } }
@keyframes oc-sway      { 0%, 100% { transform: rotate(-4.5deg); } 50% { transform: rotate(4.5deg); } }
@keyframes oc-sway-wide { 0%, 100% { transform: rotate(-2.2deg); } 50% { transform: rotate(2.2deg); } }
@keyframes oc-flap      { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }

.sign {
  display: block;
  padding: 18px 20px 20px;
  text-align: center;
  background: var(--sheet);
  border: 1px solid var(--edge);
  border-top: 2px solid var(--unit);
  border-radius: var(--radius);
}

/* The name the sign carries. It used to sit under a line of Thai and could
   stay small; alone, it has to hold the sign, so it is set larger. */
.sign-en {
  display: block;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--unit);
}

/* The kranok mark, shrunk, doing the work a rule would do inside the sign. */
.sign-flourish {
  display: block;
  width: 56px;
  height: 12px;
  margin: 9px auto 0;
  background: var(--kranok-mark) center / 56px 12px no-repeat;
  opacity: 0.85;
}

/* The line of numbers, set the way the lesson map sets a unit's topic.
   Block, with a width of its own: as an inline box it shared a line with the
   button whenever both happened to fit, which is a layout that depends on
   how long the words are. It held for two stops and broke on the third. */
.sign-chip {
  display: block;
  width: fit-content;
  margin-inline: auto;
  margin-top: 10px;
  padding: 4px 11px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* Lacquer and gilt, and not a rectangle. Black was the one thing on the
   sheet that came from nowhere in particular, and a plain box was the other:
   a Thai plaque is cut to a point at each end, the way a bai sema or a gable
   board is. So the button is the stop's own colour, cut to that shape, with
   a gilt rim drawn by the layer behind it.

   The rim is a second clipped box rather than a border, because a border is
   drawn outside the clip and would simply be cut off. The outer element is
   the gold; ::before, inset by a hair and clipped to the same silhouette,
   is the colour — so what is left showing at the edge is the rim. */
/* No button. The sign already carries two boxes — the name's rule above and
   the line of numbers below — and a third, filled, was one too many: every
   shape tried for it (square, pointed, chamfered) read as a control bolted
   onto a plaque. So the way in is set as words, in the stop's own colour,
   under a hairline of the same. Restraint is the point; it is the only
   element here that does not draw a box. */
.sign-go {
  position: relative;
  display: block;
  width: fit-content;
  margin: 17px auto 0;
  padding: 0 2px 7px;
  color: var(--unit);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: letter-spacing 0.22s ease;
}
/* The rule under it, held back at rest so that making it solid is something
   the hover can do. */
.sign-go::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: currentColor;
  opacity: 0.4;
  transition: opacity 0.22s ease;
}

/* Pointed at, the word opens out and its rule comes up to full. Nothing
   gold appears and nothing fills: the gilt-on-olive the filled button turned
   into on hover was the loudest thing on the page, and this page is quiet. */
.stop:hover .sign-go          { letter-spacing: 0.2em; }
.stop:hover .sign-go::before  { opacity: 1; }
/* The rest of what pointing at a stop does, which has nothing to do with the
   way in: the sign's edge takes the stop's colour, and the figure draws
   breath a little deeper. */
.stop:hover .sign { border-color: var(--unit); }
.stop:hover .figure .bob       { animation-duration: 2.6s; }
.stop:hover .figure .sway      { animation-duration: 2.2s; }
.stop:hover .figure .sway.wide { animation-duration: 3s; }
.stop:hover .figure .flap      { animation-duration: 1.9s; }

@media (prefers-reduced-motion: reduce) {
  .figure .bob, .figure .sway, .figure .flap,
  .stop:hover .figure .bob, .stop:hover .figure .sway,
  .stop:hover .figure .sway.wide, .stop:hover .figure .flap { animation: none; }
}

/* ---------- narrow screens ---------- */

@media (max-width: 760px) {
  .landing {
    width: min(100% - 24px, 920px);
    margin: 12px auto;
    padding: 30px 22px 26px;
  }

  /* The sheet keeps its shape; only its margins give way. The road still
     runs behind the signs, so there is nothing to take out. */
  .roadmap { padding-left: 10px; padding-right: 10px; }
  .stop { width: 100%; }
  .figure { width: 92px; height: 138px; }

}
/* The ornamental rule carries its own spacing on the landing page, and the
   column's width, so it ends where the sheet below it begins and ends. */
/* max-width, not width: on a phone the column is narrower than --col, and
   a fixed width ran the rule off the right edge of the text. */
.landing .kranok-rule { width: auto; max-width: var(--col); margin: 22px auto 4px; }


/* Written twice; see theme.css for why. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --figure-ink: #d7dcd6; --figure-gold: #dfb551; }
  /* A black shadow under a figure on a dark ground is a smudge. */
  .figure .shade { fill: #fff; opacity: 0.06; }
}

:root[data-theme="dark"] { --figure-ink: #d7dcd6; --figure-gold: #dfb551; }
/* A black shadow under a figure on a dark ground is a smudge. Scoped to the
   forced theme, not left loose: unqualified it would whiten the shadow in
   daylight too. */
:root[data-theme="dark"] .figure .shade { fill: #fff; opacity: 0.06; }


/* ---------- room, on a screen that has it ----------
   440px of column in the middle of 1500px of window is a strip, and the
   wall either side of it reads as something unfinished rather than as a
   margin. The column widens once there is room for it to: the measure stays
   comfortable to read and the paper stops looking like a mistake. */
@media (min-width: 1100px) {
  :root { --col: 560px; }
}
