/* Motion, the Treasure Map cards and the little surprises (added 21 Nov 2026).
   Colours are the site's own: coral page, yellow headings, pink and cream cards, ink outlines.
   Everything that moves stops for people who ask their device for less motion. */
:root {
  --red: rgb(252, 53, 80);
  --yellow: rgb(255, 238, 161);
  --pink: rgb(250, 220, 220);
  --cream: rgb(255, 255, 231);
  --ink: rgb(26, 26, 26);
  --gold: rgb(255, 184, 64);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* ---------- Treasure Map ----------
   Same look as the builder's cards (measured on the live site, 21 Nov): photo with 20 px corners,
   the coloured box over its lower edge, a 50 px pill with a 1 px black line, 14 px light text.
   New: Askja's order, pink and cream taking turns, equal sizes side by side, a soft rise-in. */
.tm { background: var(--red); padding: 48px 31px 56px; transition: background-color 1.2s ease; }
.tm-head, .tm-intro, .tm-grid { max-width: 812px; margin-left: auto; margin-right: auto; }
.tm-head { display: flex; align-items: center; gap: 24px; }
.tm-heading { margin: 0; font: 700 24px/1.3 "Source Code Pro", monospace; color: var(--yellow); white-space: nowrap; }
.dash-line { flex: 1 1 0; min-width: 0; width: 100%; max-width: 300px; height: 8px; overflow: visible; }
.dash-line line { stroke: var(--pink); stroke-width: 4; stroke-dasharray: 10; }
.tm-intro { margin-top: 16px; margin-bottom: 40px; font: 400 16px/1.55 "Source Code Pro", monospace; color: #fff; }
.tm-grid { display: grid; grid-template-columns: 1fr; gap: 40px; }

.tm-card {
  --tone: var(--pink); --pill: var(--cream);
  display: flex; flex-direction: column;
  /* depth like a sticker lifted off the page (Askja, 21 Nov): ink line all round, solid ink edge below */
  border: 1.5px solid var(--ink); border-radius: 20px; overflow: hidden;
  background: var(--tone);
  box-shadow: 0 6px 0 var(--ink);
}
.tm-card:nth-child(even) { --tone: var(--cream); --pill: var(--pink); }
.tm-photo { aspect-ratio: 400 / 304; overflow: hidden; position: relative; z-index: 1; }
.tm-photo img {
  display: block; width: 100%; height: 100%; object-fit: cover;
}
/* Each photo framed exactly as on the original cards (builder crop: place, size, zoom),
   in % of the photo box so it holds at every width. No extra zoom (Askja, 21 Nov). */
.tm-photo img.crop {
  position: absolute; left: var(--l); top: var(--t);
  width: var(--w) !important; height: var(--h); max-width: none; object-fit: fill;
  transform: scale(var(--s)); transform-origin: 0 0;
}
.tm-box {
  position: relative; z-index: 2; flex: 1;
  margin-top: -25px; padding: 19px 15px 26px;
  background: var(--tone);
  border-top: 1.5px solid var(--ink);
}
.tm-title { margin: 0 0 24px 3px; font-size: inherit; }
.tm-pill {
  display: inline-flex; align-items: center; height: 50px; padding: 0 16px;
  font: 700 16px/1 "Source Code Pro", monospace; text-transform: uppercase;
  color: rgb(26, 26, 26); background: var(--pill);
  border: 1.5px solid var(--ink); border-radius: 22px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: default;
}
.tm-pill--link { text-decoration: none; cursor: pointer; transition: background-color .25s, color .25s, transform .35s var(--spring); }
.tm-pill--link:hover, .tm-pill--link:focus-visible { background: var(--red); color: #fff; }
.tm-lead { margin: 0 0 14px; font: 500 16px/1.55 "Source Code Pro", monospace; /* same weight as "Ask me about this" (Askja) */ color: rgb(29, 30, 32); }
.tm-text { margin: 0 0 10px; font: 300 16px/1.55 "Source Code Pro", monospace; color: rgb(29, 30, 32); }
.tm-text:last-child { margin-bottom: 0; }
.tm-text strong { font-weight: 500; }

/* Body text 17 px with airy lines (Askja, 21 Nov: 15 px "a tiny bit bigger", then "make it 17 px, more space between the lines", then "one smaller": 16 px) */
#z1LzcD h3, #z2sDJw h3, #zpffAW h3, #z1LzcD span, #z2sDJw span, #zpffAW span { line-height: 1.55; }
#z1LzcD span, #z2sDJw span, #zpffAW span { font-size: 16px; } /* every width: body text is one size (Askja) */
@media (min-width: 760px) {
  .tm { padding: 72px 32px 80px; }
  .tm-heading { font-size: 48px; line-height: 1.2; }
  .tm-intro { margin-bottom: 48px; }
  .tm-grid { grid-template-columns: 1fr 1fr; gap: 34px 12px; align-items: stretch; }
  .tm-box { margin-top: -32px; padding: 27px 45px 32px 45px; }
  .tm-title { margin: 0 0 24px -3px; }
  .tm-lead { margin-bottom: 16px; }
  /* the Kinworld Studio card closes the map across both columns: photo left, words right */
  .tm-card--wide { grid-column: 1 / -1; flex-direction: row; }
  .tm-card--wide .tm-photo { flex: 0 0 50%; aspect-ratio: auto; min-height: 304px; }
  .tm-card--wide .tm-box { margin-top: 0; border-top: 0; border-left: 1.5px solid var(--ink); display: flex; flex-direction: column; justify-content: center; }
  .tm-card--wide .tm-title { align-self: flex-start; }
  /* chequerboard in two columns, so neighbours never share a colour */
  .tm-card:nth-child(4n+2), .tm-card:nth-child(4n+3) { --tone: var(--cream); --pill: var(--pink); }
  .tm-card:nth-child(4n+1), .tm-card:nth-child(4n) { --tone: var(--pink); --pill: var(--cream); }
  .tm-card.tm-card--wide { --tone: var(--pink); --pill: var(--cream); }
}

/* A little life: cards rise in as they come into view, lift a touch on hover. */
.tm-card { transition: transform .45s var(--spring), box-shadow .45s var(--spring); }
.tm-pill { transition: transform .45s var(--spring), box-shadow .45s var(--spring), background-color .25s, color .25s; }
@media (hover: hover) {
  .tm-card:hover { transform: translateY(-5px); box-shadow: 0 11px 0 var(--ink); }
  .tm-card:hover .tm-pill { animation: pill-wiggle .6s var(--spring); box-shadow: 0 5px 0 var(--ink); transform: translateY(-2px); }
}
.tm-card:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); transition-duration: .12s; }
@keyframes pill-wiggle {
  0% { transform: translateY(-2px) rotate(0); }
  30% { transform: translateY(-3px) rotate(-6deg) scale(1.06); }
  65% { transform: translateY(-2px) rotate(2deg) scale(1.02); }
  100% { transform: translateY(-2px) rotate(0); }
}
.js .tm-card:not(.in) { opacity: 0; }
.tm-card.in { animation: rise-in .9s cubic-bezier(.2, .8, .3, 1.15) backwards; animation-delay: calc(var(--d, 0) * 120ms); }
@keyframes rise-in { from { opacity: 0; transform: translateY(48px) scale(.97); } 60% { opacity: 1; } to { opacity: 1; transform: none; } }

/* ---------- Dashed lines unfold once, left to right, then stay still (Askja, 21 Nov: walking was too much) ---------- */
.js svg.unfold { clip-path: inset(0 100% 0 0); transition: clip-path 1.3s cubic-bezier(.3, .7, .3, 1) .15s; }
.js svg.unfold.in { clip-path: inset(0 0 0 0); }

/* ---------- Text that types itself ---------- */
.typed .ch { opacity: 0; position: relative; }
.typed .ch.on { opacity: 1; }
.typed .ch.cur::after {
  content: ""; position: absolute; left: 100%; top: .12em; bottom: .08em; width: .5em;
  margin-left: .08em; background: currentColor; animation: blink .9s steps(1) infinite;
}
.typed.done .ch.cur::after { animation: blink-out .9s steps(1) 4 forwards; }
@keyframes blink-out { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes blink { 50% { opacity: 0; } }
.dots .dot { display: inline-block; animation: dot-hop 1.8s var(--spring) infinite; }
.dots .dot:nth-child(2) { animation-delay: .15s; }
.dots .dot:nth-child(3) { animation-delay: .3s; }
@keyframes dot-hop { 0%, 60%, 100% { transform: none; } 25% { transform: translateY(-8px); } }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s ease, transform .9s var(--spring); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- The volcano ---------- */
.volcano-hit { cursor: pointer; }
.volcano-hit:focus-visible { outline: 3px dashed var(--yellow); outline-offset: 6px; border-radius: 22px; }
.js .volcano-intro { animation: volcano-in 1.1s var(--spring) .15s backwards; }
@keyframes volcano-in {
  0% { opacity: 0; transform: translateY(40px) scale(.7) rotate(-7deg); }
  100% { opacity: 1; transform: none; }
}
.js .frame-intro { animation: frame-in 1s var(--spring) backwards; }
@keyframes frame-in {
  0% { opacity: 0; transform: translate(-36px, -24px) rotate(-4deg); }
  100% { opacity: 1; transform: none; }
}
.bob { animation: bob 5.5s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-7px) rotate(.4deg); } }
.rumble { animation: rumble .5s linear; }
@keyframes rumble {
  0%, 100% { transform: none; }
  15% { transform: translate(-3px, 1px) rotate(-.6deg); }
  30% { transform: translate(3px, -1px) rotate(.6deg); }
  45% { transform: translate(-2px, 2px) rotate(-.4deg); }
  60% { transform: translate(2px, -2px) rotate(.4deg); }
  80% { transform: translate(-1px, 1px); }
}
.fx-layer { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 30; }
.spark, .puff, .burst {
  position: absolute; left: 0; top: 0; border-radius: 50%; pointer-events: none; will-change: transform, opacity;
}
.spark { width: 7px; height: 7px; background: rgb(255, 168, 40); box-shadow: 0 0 6px rgba(255, 140, 30, .8); }
.puff { width: 26px; height: 26px; background: rgba(255, 245, 250, .75); filter: blur(4px); }
.burst-layer { position: fixed; inset: 0; pointer-events: none; z-index: 1000; overflow: hidden; }
.egg-note {
  position: fixed; z-index: 1001; pointer-events: none;
  padding: 10px 16px; border: 1.5px solid var(--ink); border-radius: 16px;
  background: var(--yellow); color: var(--ink); box-shadow: 0 4px 0 var(--ink);
  font: 700 14px/1.3 "Source Code Pro", monospace;
  transform: translate(-50%, -100%); animation: note 2.8s var(--spring) forwards;
}
@keyframes note {
  0% { opacity: 0; transform: translate(-50%, -60%) scale(.6) rotate(-6deg); }
  15% { opacity: 1; transform: translate(-50%, -100%) scale(1) rotate(-3deg); }
  80% { opacity: 1; transform: translate(-50%, -110%) scale(1) rotate(-3deg); }
  100% { opacity: 0; transform: translate(-50%, -130%) scale(.9) rotate(-3deg); }
}

svg.lava { position: absolute; pointer-events: none; overflow: visible; filter: drop-shadow(0 0 8px rgba(255, 150, 60, .55)); opacity: .92; }
svg.lava .flow path { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100 100; }

/* More air around the dashed line between the first two texts (Askja, 21 Nov) */
.layout-element:has(> #z2sDJw) { margin-top: 30px; }

/* ---------- Portrait ---------- */
.blob-breathe { animation: blob 11s ease-in-out infinite; transform-origin: 50% 50%; }
@keyframes blob {
  /* breathes in place: no tilt, never bigger than its spot (Askja: shapes looked misaligned) */
  0%, 100% { transform: scale(1); }
  50% { transform: scale(.97, .985); }
}
.portrait-hit { cursor: pointer; transition: transform .5s var(--spring); }
@media (hover: hover) { .portrait-hit:hover { transform: rotate(-4deg) scale(1.04); } }
.star {
  position: fixed; z-index: 1000; pointer-events: none; color: var(--yellow);
  font: 700 22px/1 "Source Code Pro", monospace; text-shadow: 0 2px 0 var(--ink);
  animation: star 1.3s var(--spring) forwards;
}
@keyframes star {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(0); }
  30% { opacity: 1; transform: translate(calc(-50% + var(--dx) * .6), calc(-50% + var(--dy) * .6)) scale(1.2) rotate(40deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.6) rotate(120deg); }
}

/* "relational alchemy" gets a hand-drawn line when it comes into view */
.squiggle {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 10' preserveAspectRatio='none'%3E%3Cpath d='M1 6 C 12 1, 22 9, 34 5 S 56 1, 68 6 S 92 9, 104 4 S 116 3, 119 5' fill='none' stroke='rgb(252,53,80)' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 0 100% / 0% .5em;
  padding-bottom: .22em;
  transition: background-size 1.3s cubic-bezier(.65, 0, .35, 1) .3s;
}
.squiggle.in { background-size: 100% .5em; }

/* ---------- Alchemy (type the word anywhere) ---------- */
html.gold .block-background, html.gold .tm, html.gold .site-footer { background-color: var(--gold) !important; }
.block-background, .site-footer { transition: background-color 1.2s ease; }

/* ---------- Less motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .tm-card:not(.in), .js .reveal { opacity: 1; transform: none; }
  .typed .ch { opacity: 1; }
  .js svg.unfold { clip-path: none; }
}
