/* The homepage: the overview map is the table of contents, with a card that explains the block under the pointer. */
body { line-height: 1.75; }
main h1, main h2 { margin: 0; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* The top bar is lighter here than on a chapter page: no rule under it, no mini map. */
.bar { align-items: baseline; gap: 28px; padding: 22px clamp(20px, 5vw, 64px); border-bottom: 0; font-size: 15px; }
.bar a { text-decoration: none; color: var(--grey); }
.bar a:hover { color: var(--ink); }

.button { display: inline-block; font-family: var(--hand); font-size: 20px; font-weight: 700; padding: 10px 26px 11px; border: 2px solid var(--ink);
  border-radius: var(--wobble); background: var(--ink); color: var(--paper); text-decoration: none; cursor: pointer;
  transition: transform .25s cubic-bezier(.16,1,.3,1), background .25s; }
.button:hover { transform: translateY(-2px) rotate(-.6deg); background: var(--red); border-color: var(--red); }
.picture { filter: brightness(1.02); }

.hero { display: grid; grid-template-columns: minmax(0, 15fr) minmax(280px, 6fr); gap: clamp(20px, 3vw, 48px);
  padding: 4px clamp(20px, 5vw, 64px) 56px; min-height: calc(100vh - 70px); align-items: start; align-content: start; }
.lead { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 15fr) minmax(280px, 6fr); gap: clamp(20px, 3vw, 48px); align-items: end; margin-bottom: 26px; }
.lead h1 { font-size: clamp(30px, 3.3vw, 48px); line-height: 1.2; }
.lead p { margin: 0 0 6px; color: var(--grey); font-size: 15.5px; }

.map { position: relative; }
.layer { position: relative; display: grid; grid-template-columns: 8em 1fr; border: 2px solid var(--ink); border-radius: var(--wobble); margin-top: -2px; background: var(--paper); }
.layer:nth-child(even) { border-radius: var(--wobble-2); }
.layer > .name { font-family: var(--hand); font-weight: 700; font-size: 21px; padding: 20px 0 20px 22px; line-height: 1.3; }
.layer > .name small { display: block; font-weight: 400; font-size: 14px; color: var(--grey); }
.layer > .name .finished { display: block; margin-top: 6px; font-weight: 400; font-size: 14px; color: var(--red); }
.blocks { display: flex; flex-wrap: wrap; gap: 10px; padding: 18px 22px 18px 6px; align-items: center; }
.block { appearance: none; margin: 0; font-weight: 400; font-family: var(--hand); font-size: 18.5px; line-height: 1.75; padding: 5px 13px 6px; border: 1.5px solid var(--ink); border-radius: var(--wobble); background: var(--wash);
  color: var(--ink); text-decoration: none; cursor: pointer; position: relative; transition: transform .3s cubic-bezier(.16,1,.3,1), background .3s; }
.block:nth-child(odd) { border-radius: var(--wobble-2); }
.block sup { font-family: var(--mono); font-size: 11px; font-weight: 600; margin-left: 7px; color: var(--grey); vertical-align: 3px; line-height: 0; }
.block:hover, .block.on { background: var(--red-wash); border-color: var(--red); transform: translateY(-2px) rotate(-.8deg); }
.block:hover sup, .block.on sup { color: var(--red); }
.block.todo { background: transparent; border: 1.5px dashed var(--pencil); color: var(--grey); }
.block.todo sup { color: var(--grey); }
.block.todo:hover, .block.todo.on { background: var(--wash); border-color: var(--grey); transform: none; }
.block.told { border-style: dotted; }
.across { margin: 12px 0 0 6px; font-family: var(--hand); color: var(--grey); font-size: 16px; }
/* Room above for her bun and the nod, so she stands clear of the bottom layer's border. */
.start { display: flex; align-items: center; gap: 6px; margin: 16px 0 0 8px; }
.start img { display: block; width: 84px; height: auto; }
.start span { font-family: var(--hand); font-size: 20px; color: var(--red); }
.start svg { width: 54px; height: 44px; overflow: visible; }

/* The script adds .build: only then do the layers start hidden and stack up from the bottom one.
   Without the script, or with reduced motion, the map is simply there. */
.map.build .layer { opacity: 0; transform: translateY(46px) rotate(-1.2deg); }
.map.build .layer.up { opacity: 1; transform: none; transition: transform .8s cubic-bezier(.16,1,.3,1), opacity .35s; }
.map.build .start { opacity: 0; transition: opacity .6s .2s; }
.map.build .start.up { opacity: 1; }
.start img { animation: nod 2.6s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes nod { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(3deg) translateY(-3px); } }

.card > * { transition: opacity .35s, transform .45s cubic-bezier(.16,1,.3,1); }
.card.swap > * { opacity: 0; transform: translateY(8px); transition: none; }
.card { position: sticky; top: 24px; padding: 22px 24px 24px; border: 2px solid var(--ink); border-radius: var(--wobble-2); min-height: 360px; }
.card .where { font-family: var(--hand); color: var(--red); font-size: 17px; }
.card h2 { font-size: 30px; line-height: 1.25; margin: 2px 0 10px; }
.card p { margin: 0 0 14px; color: var(--ink); font-size: 15.5px; }
.card .pi { font-family: var(--mono); font-size: 12.5px; color: var(--grey); word-break: break-all; }
.card img { display: block; margin: 6px auto 12px; max-height: 190px; width: auto; }
.card .button { margin-top: 8px; font-size: 18px; }
.card .soon { font-family: var(--hand); color: var(--grey); font-size: 17px; }

.below { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(24px, 5vw, 80px); padding: 96px clamp(20px, 5vw, 64px) 40px; align-items: start; }
.below h2 { font-size: clamp(30px, 3.4vw, 46px); }
.below .words p { color: var(--ink); max-width: 28em; }
.below pre { font-family: var(--mono); font-size: 13.5px; font-variant-ligatures: none; background: var(--wash); padding: 14px 18px; border-radius: var(--wobble); margin: 14px 0; overflow-x: auto; }

.chapters { list-style: none; margin: 0; padding: 0; }
.chapters li { display: grid; grid-template-columns: 5.2em 1fr; gap: 0 18px; padding: 18px 0; border-top: 1.5px solid var(--ink); }
.chapters li:last-child { border-bottom: 1.5px solid var(--ink); }
.chapters .no { font-family: var(--hand); font-size: 19px; color: var(--grey); }
.chapters a { font-family: var(--hand); font-size: 23px; font-weight: 700; text-decoration: none; }
.chapters a:hover { color: var(--red); }
.chapters p { margin: 2px 0 0; grid-column: 2; color: var(--grey); font-size: 15.5px; max-width: 62ch; }
.chapters li.todo { border-top: 1.5px dashed var(--pencil); padding: 11px 0; }
.chapters li.todo + li.todo { border-top-width: 1px; }
.chapters li.todo .title { font-family: var(--hand); font-size: 19px; color: var(--grey); }
.chapters li.todo .no { font-size: 17px; }
.chapters li.todo:last-child { border-bottom: 1.5px dashed var(--pencil); }

@media (max-width: 980px) {
  .hero, .below, .lead { grid-template-columns: minmax(0, 1fr); }
  .layer { grid-template-columns: 1fr; }
  .layer > .name { padding: 14px 18px 0; }
  .blocks { padding: 10px 14px 16px; }
  .card { position: static; min-height: 0; }
  .start span { font-size: 17px; }
  .below { padding-top: 48px; }
}

@media (max-width: 900px) {
  /* site.css gives the name its own row on a chapter page; here the three links fit beside it. */
  .bar .name { flex-basis: auto; }
}

/* The search box sits at the right end of this bar, so its list opens leftwards to stay on screen. */
.results { left: auto; right: 0; }
@media (max-width: 900px) { .results { left: 0; right: auto; } }
