@font-face { font-family: "Reggae One"; src: url("fonts/reggae-one.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Balsamiq Sans"; src: url("fonts/balsamiq-sans-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Balsamiq Sans"; src: url("fonts/balsamiq-sans-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Comic Neue"; src: url("fonts/comic-neue-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Comic Neue"; src: url("fonts/comic-neue-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Bangers"; src: url("fonts/bangers-regular.woff2") format("woff2"); font-display: swap; }

:root {
  --ink: #2e2421;
  --paper: #f4eedb;
  --paper-shade: #e4dcc2;
  --night: #1c1a19;
  --glow: #fff4c5;
  --paint: #983c31;
  --display: "Reggae One", "Balsamiq Sans", system-ui, sans-serif;
  --hand: "Balsamiq Sans", system-ui, sans-serif;
  --letter: "Comic Neue", "Balsamiq Sans", system-ui, sans-serif;      /* a letterer's capitals, for what is said in a bubble */
  --shout: "Bangers", "Reggae One", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--night); color: var(--ink); font: 400 17px/1.5 var(--hand); overflow: hidden; -webkit-font-smoothing: antialiased; }

.skip { position: fixed; left: 12px; top: -60px; z-index: 50; padding: 8px 12px; background: var(--paper); color: var(--ink); border-radius: 6px; }
.skip:focus { top: 12px; }

/* ── the picture: a stack of painted sheets, moved as one ── */
.view { position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: default; }
.view.can-pan { cursor: grab; }
.view.is-panning { cursor: grabbing; }
.view.over { cursor: pointer; }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; opacity: 0; transition: opacity .9s ease; }
.ready .stage { opacity: 1; }
.plate, .shafts, .motes, .dim { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.thing img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.thing img.fine { opacity: 0; transition: opacity .3s ease; }                    /* painted again from close to: there once the camera is */
.thing.is-open img.fine { opacity: 1; transition: opacity .75s ease .35s; }
.thing { position: absolute; pointer-events: none; transform-origin: 50% 100%; transition: transform .32s cubic-bezier(.2, .9, .3, 1.25), filter .32s ease; }
.thing.is-hover { transform: translateY(-10px) scale(1.012); filter: drop-shadow(0 12px 9px rgba(40, 24, 20, .34)) brightness(1.05) saturate(1.06); }
.thing[data-id="board"] { transform-origin: 50% 0; }
.thing[data-id="board"].is-hover { transform: rotate(-1.6deg); }                 /* it hangs from a nail */
.thing[data-id="cat"].is-hover { transform: scale(1.035, 1.05); }                 /* it sits up */
.thing.is-open { z-index: 30 !important; filter: drop-shadow(0 0 26px rgba(255, 236, 190, .38)); }
.dim { z-index: 20; background: #1a1220; opacity: 0; transition: opacity .7s ease; }
.focused .dim { opacity: .42; }
.shafts { z-index: 40; mix-blend-mode: screen; animation: breathe 11s ease-in-out infinite; }
.motes { z-index: 41; mix-blend-mode: screen; }
/* the kettle is on: thin wisps that curl as they rise and are gone within a hand's breadth or two */
.steam { position: absolute; z-index: 19; width: 0; height: 0; pointer-events: none; }
.steam i { position: absolute; left: -34px; top: -70px; width: 68px; height: 96px; border-radius: 50%; opacity: 0; filter: blur(7px);
  background: radial-gradient(closest-side, rgba(246, 244, 236, .62), rgba(246, 244, 236, 0)); animation: rise 5.6s linear infinite; }
.steam i:nth-child(2) { --dx: 34px; animation-delay: -1.4s; animation-duration: 6.4s; }
.steam i:nth-child(3) { --dx: -64px; animation-delay: -2.9s; }
.steam i:nth-child(4) { --dx: 8px; animation-delay: -4.3s; animation-duration: 7s; }
@keyframes rise {
  0% { transform: translate(0, 0) scale(.3, .4); opacity: 0; }
  14% { opacity: .85; }
  45% { transform: translate(calc(var(--dx, -26px) * -.35), -150px) scale(.8, 1.3); opacity: .55; }
  100% { transform: translate(var(--dx, -26px), -360px) scale(1.5, 2.3); opacity: 0; }
}
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .86; } }

.spot { position: absolute; z-index: 50; padding: 0; border: 0; background: none; border-radius: 18px; pointer-events: none; }
.spot:focus { outline: none; }
.spot:focus-visible { outline: 5px dashed var(--glow); outline-offset: 12px; }

/* ── the name, a hint, and the label that follows the pointer ── */
.name { position: fixed; left: max(22px, env(safe-area-inset-left)); top: 14px; z-index: 5; color: var(--paper); text-shadow: 0 1px 10px rgba(20, 12, 10, .7); pointer-events: none; opacity: 0; transition: opacity 1.2s ease .5s; }
.ready .name { opacity: 1; }
.name h1 { margin: 0; font: 400 clamp(20px, 2.1vw, 30px)/1.1 var(--display); letter-spacing: .02em; }
.name p { margin: 2px 0 0; font-size: clamp(12px, 1vw, 15px); opacity: .85; }

.hint { position: fixed; left: 50%; bottom: 18px; z-index: 5; margin: 0; padding: 7px 16px 8px; transform: translateX(-50%); white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis;
  background: rgba(244, 238, 219, .93); border: 2px solid var(--ink); border-radius: 999px; font-weight: 700; font-size: 15px; opacity: 0; transition: opacity .6s ease 1.6s; pointer-events: none; }
.ready .hint { opacity: 1; }
.ready.seen .hint { opacity: 0; transition-delay: 0s; }

.tag { position: fixed; left: 0; top: 0; z-index: 6; padding: 5px 12px 6px; background: var(--paper); border: 2px solid var(--ink); border-radius: 9px 7px 10px 6px / 7px 10px 6px 9px;
  box-shadow: 0 4px 0 rgba(46, 36, 33, .28); text-align: center; pointer-events: none; opacity: 0; transition: opacity .16s ease; white-space: nowrap; }
.tag.show { opacity: 1; }
.tag b { display: block; font: 400 19px/1.15 var(--display); letter-spacing: .03em; }
.tag span { display: block; font-size: 13px; opacity: .78; }
.tag::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 12px; height: 12px; margin-left: -6px; background: var(--paper); border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.tag.below::after { bottom: auto; top: -8px; border-width: 2px 0 0 2px; }

/* ── the card that opens beside a thing ── */
.card { position: fixed; z-index: 10; top: 50%; width: min(430px, 38vw); max-height: calc(100vh - 48px); overflow: auto; padding: 26px 28px 20px;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 10px 14px 9px 15px / 14px 9px 15px 10px;
  box-shadow: 0 2px 0 var(--paper-shade) inset, 0 14px 0 -6px rgba(26, 18, 32, .35), 0 26px 50px rgba(20, 12, 16, .45);
  opacity: 0; visibility: hidden; transform: translateY(-50%) translateX(26px) rotate(.5deg); transition: opacity .32s ease, transform .5s cubic-bezier(.2, .9, .3, 1.1), visibility 0s .5s; }
.card[data-side="right"] { right: 4vw; }
.card[data-side="left"] { left: 4vw; transform: translateY(-50%) translateX(-26px) rotate(-.5deg); }
.card.open { opacity: 1; visibility: visible; transform: translateY(-50%) rotate(-.4deg); transition-delay: .28s, .28s, 0s; }
.card[data-side="left"].open { transform: translateY(-50%) rotate(.4deg); }

.card-kind { display: flex; align-items: center; gap: 9px; margin: 0 34px 10px 0; font-size: 13.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; opacity: .82; }
.dab { flex: none; width: 26px; height: 13px; background: var(--paint); border: 2px solid var(--ink); border-radius: 60% 40% 55% 45% / 55% 60% 40% 45%; }
.card h2 { margin: 0 0 8px; font: 400 clamp(30px, 3vw, 44px)/1.05 var(--display); letter-spacing: .01em; outline: none; }
.card-title { margin: 0 0 12px; font-weight: 700; font-size: 19px; line-height: 1.32; }
.card-blurb { margin: 0 0 14px; }
.card-note { margin: 0 0 14px; padding: 9px 12px; border: 2px dashed rgba(46, 36, 33, .5); border-radius: 8px; font-size: 14.5px; }
.card p:empty, .card ul:empty { display: none; }
.card ul { list-style: none; margin: 0 0 14px; padding: 0; }

.card-links { display: flex; flex-wrap: wrap; gap: 10px; }
.card-links a { display: inline-block; padding: 8px 15px 9px; background: var(--ink); color: var(--paper); border: 2px solid var(--ink); border-radius: 8px 10px 7px 11px / 10px 7px 11px 8px;
  font-weight: 700; text-decoration: none; box-shadow: 0 4px 0 var(--paint); transition: transform .12s ease, box-shadow .12s ease; }
.card-links a::after { content: " \2197"; }
.card-links a:hover, .card-links a:focus-visible { transform: translateY(2px); box-shadow: 0 2px 0 var(--paint); }

.card-list li { border-top: 2px solid rgba(46, 36, 33, .16); }
.card-list a { display: flex; align-items: baseline; gap: 10px; padding: 8px 2px; color: inherit; text-decoration: none; }
.card-list a b { font: 400 18px/1.2 var(--display); white-space: nowrap; }
.card-list a span { font-size: 14px; opacity: .78; }
.card-list a:hover b, .card-list a:focus-visible b { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

.card-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; padding-top: 12px; border-top: 2px solid rgba(46, 36, 33, .16); }
.card-nav button, .card-close { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.card-nav button { padding: 4px 2px; font-size: 14.5px; font-weight: 700; opacity: .78; }
.card-nav button:hover, .card-nav button:focus-visible { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
.card-close { position: absolute; right: 12px; top: 10px; width: 38px; height: 38px; font-size: 30px; line-height: 1; border-radius: 50%; }
.card-close:hover, .card-close:focus-visible { background: rgba(46, 36, 33, .1); }
.card :focus-visible { outline: 2.5px solid var(--paint); outline-offset: 3px; }
.card h2:focus-visible { outline: none; }
.card-hint { margin: 0 0 14px; font-size: 14.5px; font-weight: 700; }
.card-hint::before { content: "\261E  "; }
.card-draft { margin: -6px 0 14px; font-size: 12.5px; font-style: italic; opacity: .6; }
.card-draft[hidden] { display: none; }

.card-ink { display: none; }
.ink { fill: #1d1716; }
.paper { fill: #fffdf6; }

/* ── wide screens: what a thing says, it says in a speech bubble, lettered in capitals, with its tail toward the thing ── */
@media (min-width: 820px) {
  .card { width: min(520px, 42vw); max-height: none; overflow: visible; padding: 62px 66px 52px; background: none; border: 0; border-radius: 0; box-shadow: none;
    text-align: center; font: 700 15.5px/1.42 var(--letter); text-transform: uppercase; letter-spacing: .015em;
    transform: translateY(-50%) scale(.82); transition: opacity .2s ease, transform .42s cubic-bezier(.2, 1.3, .35, 1), visibility 0s .42s; }
  .card[data-side="right"] { transform-origin: 0 60%; }
  .card[data-side="left"] { transform-origin: 100% 60%; transform: translateY(-50%) scale(.82); }
  .card.open, .card[data-side="left"].open { transform: translateY(-50%); transition-delay: .3s, .3s, 0s; }
  .card-ink { display: block; position: absolute; left: 0; top: 0; z-index: -1; overflow: visible; filter: drop-shadow(5px 8px 0 rgba(26, 18, 32, .3)); }
  .card-in { max-height: calc(100vh - 170px); overflow: auto; scrollbar-width: thin; }
  .card-close { right: 62px; top: 40px; }
  .card-kind { justify-content: center; margin: 0 30px 8px; font-size: 12.5px; }
  .card h2 { font-size: clamp(30px, 2.9vw, 42px); text-transform: none; }
  .card-title { font-size: 17px; line-height: 1.3; }
  .card-blurb { font-weight: 400; }
  .card-note { font-size: 13.5px; text-transform: none; font-family: var(--hand); font-weight: 400; }
  .card-draft { text-transform: none; font-family: var(--hand); font-weight: 400; }
  .card-hint { font-size: 13.5px; }
  .card-links { justify-content: center; }
  .card-links a { font-size: 14.5px; letter-spacing: .04em; border-radius: 999px; }
  .card-list { text-align: left; }
  .card-list a b { text-transform: none; }
  .card-list a span { font-size: 12.5px; }
  .card-nav { border-top: 0; padding-top: 2px; justify-content: center; gap: 26px; }
  .card-nav button { font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; }
}

/* ── a word from one of the small things. The shape of the bubble (main.js) and the lettering say how it is said ── */
.quip { position: fixed; z-index: 8; display: grid; place-items: center; pointer-events: none; opacity: 0; transform: scale(.4) rotate(var(--lean, 0deg)); }
.quip svg { position: absolute; left: 0; top: 0; overflow: visible; filter: drop-shadow(4px 6px 0 rgba(26, 18, 32, .3)); }
.quip b { position: relative; display: block; width: max-content; max-width: min(300px, 62vw); padding: 0 4px; font: 400 clamp(26px, 2.3vw, 36px)/1.02 var(--shout); letter-spacing: .045em; text-transform: uppercase; text-align: center; color: #1d1716; }
.quip:not([data-as="yell"]) b { max-width: min(230px, 56vw); font: 700 clamp(15px, 1.25vw, 18px)/1.16 var(--letter); letter-spacing: .01em; }
.quip[data-as="weak"] b { font-size: clamp(12.5px, 1vw, 14.5px); color: #4a4244; }
.quip.show { opacity: 1; transform: rotate(var(--lean, 0deg)); animation: pop .34s cubic-bezier(.2, 1.5, .4, 1); transition: none; }
.quip:not(.show) { transition: opacity .18s ease, transform .18s ease; }
@keyframes pop { 0% { opacity: 0; transform: scale(.3) rotate(calc(var(--lean, 0deg) - 8deg)); } 60% { opacity: 1; transform: scale(1.1) rotate(calc(var(--lean, 0deg) + 2deg)); } 100% { transform: rotate(var(--lean, 0deg)); } }

.plain { display: none; padding: 24px; background: var(--paper); }

/* ── narrow screens: the card is a sheet that comes up from the bottom ── */
@media (max-width: 819px) {
  .card, .card[data-side] { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 52vh; padding: 20px 20px calc(14px + env(safe-area-inset-bottom));
    border-width: 2.5px 0 0; border-radius: 18px 18px 0 0; transform: translateY(40px); }
  .card.open, .card[data-side].open { transform: none; }
  .card h2 { font-size: 30px; }
  .card-title { font-size: 17px; }
  .hint { bottom: 12px; font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .thing, .card, .dim, .stage, .tag { transition-duration: .01s !important; transition-delay: 0s !important; }
  .quip.show { animation: none; }
  .thing.is-hover { transform: none !important; }
  .shafts { animation: none; }
  .steam i { animation: none; opacity: .4; transform: translate(-8px, -120px) scale(.8, 1.4); }
  .steam i:nth-child(n+3) { display: none; }
  .motes { display: none; }
}
