:root {
  --bg: #f7f3ec;
  --frame: #ebe4d8;
  --paper: #fffdf8;
  --text: #3b3530;
  --muted: #8c8278;
  --line: #e2d9ca;
  --line-art: #2e2925;
  --edge: #2e2925;
  --accent: #ff6b4a;
  --blue: #4f7cff;
  --sky: #9fd8ff;
  --hill-back: #8fd18a;
  --hill-front: #5fb36a;
  --desk-shadow: rgba(46, 41, 37, 0.08);

  --skin: #c98d5e;
  --hair: #2b1d16;
  --shirt: #4f7cff;
}

:root[data-theme="dark"] {
  --bg: #1c1a18;
  --frame: #2a2724;
  --paper: #24211e;
  --text: #ece5da;
  --muted: #a2978b;
  --line: #3a3430;
  --edge: #6a6058;
  --accent: #ff7a5c;
  --sky: #1d2b4f;
  --hill-back: #36624a;
  --hill-front: #2a5039;
  --desk-shadow: rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--frame);
  color: var(--text);
  font: 16px/1.7 "Merriweather", Georgia, serif;
  padding: 8px;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s, color .3s;
}

.frame {
  position: relative;
  background: var(--bg);
  border-radius: 6px;
  min-height: calc(100vh - 16px);
  transition: background-color .3s;
}

a { color: inherit; }

.hand { font-family: "Caveat", "Comic Sans MS", cursive; }

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 72px 16px 0;
}

/* ── theme toggle ─────────────────────────────── */
.theme-toggle {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 5;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: transform .3s, color .2s;
}
.theme-toggle:hover { color: var(--text); transform: rotate(25deg); }
.theme-toggle svg { width: 24px; height: 24px; fill: currentColor; stroke: currentColor; stroke-width: 2; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; stroke: none; }

/* ── hero / scene ─────────────────────────────── */
.scene {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
}

.desk-scene { display: block; width: 100%; height: auto; overflow: visible; }
.ink { stroke: var(--line-art); }

.board text { fill: var(--line-art); }
.sky { fill: var(--sky); transition: fill .4s; }
.moon-bite { fill: var(--sky); transition: fill .4s; }
.hill-back { fill: var(--hill-back); transition: fill .4s; }
.hill-front { fill: var(--hill-front); transition: fill .4s; }
.sun { transition: opacity .4s; }
.moon, .stars { opacity: 0; transition: opacity .4s; }
[data-theme="dark"] .sun { opacity: 0; }
[data-theme="dark"] .moon, [data-theme="dark"] .stars { opacity: 1; }
.desk-shadow { fill: var(--desk-shadow); }

.clouds { animation: drift 16s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translateX(-8px); } to { transform: translateX(16px); } }

.hotspot { cursor: pointer; outline: none; }
.board, .record, .window { transition: transform .25s ease; transform-box: fill-box; transform-origin: 50% 100%; }
.board:hover, .board:focus-visible { transform: rotate(-1deg) translateY(-3px); }
.window:hover, .window:focus-visible { transform: translateY(-2px); }
.record:hover, .record:focus-visible { transform: translateY(-4px); }
.hotspot:focus-visible { filter: drop-shadow(0 0 6px var(--accent)); }

.note { transition: transform .25s ease; transform-box: fill-box; transform-origin: 50% 0; }
.board:hover .note:nth-of-type(odd) { transform: rotate(-4deg); }
.board:hover .note:nth-of-type(even) { transform: rotate(4deg); }

.vinyl-spin { animation: spin 5s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }

.notes { fill: var(--muted); }
.notes text { opacity: 0; animation: note 3.2s ease-in-out infinite; }
.notes text:nth-child(2) { animation-delay: 1.05s; }
.notes text:nth-child(3) { animation-delay: 2.1s; }
@keyframes note {
  0% { opacity: 0; transform: translate(0, 10px); }
  30% { opacity: .9; }
  100% { opacity: 0; transform: translate(8px, -14px); }
}

.steam path { stroke: var(--muted); opacity: 0; animation: steam 2.6s ease-in-out infinite; }
.steam path:nth-child(2) { animation-delay: .8s; }
.steam path:nth-child(3) { animation-delay: 1.6s; }
@keyframes steam {
  0% { opacity: 0; transform: translateY(6px); }
  40% { opacity: .7; }
  100% { opacity: 0; transform: translateY(-8px); }
}

.plant { transform-box: fill-box; transform-origin: 50% 100%; animation: sway 5s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-2deg); } to { transform: rotate(2deg); } }

.duck { transform-box: fill-box; transform-origin: 50% 100%; transition: transform .2s; }
.duck:hover { transform: rotate(-8deg); }

/* matt */
.matt { transform-box: fill-box; transform-origin: 50% 100%; }
.matt.hop { animation: hop .45s ease; }
@keyframes hop { 30% { transform: translateY(-14px); } 60% { transform: translateY(2px); } }

.hand-l, .hand-r { transform-box: fill-box; transform-origin: center; animation: typing .32s ease-in-out infinite alternate; }
.hand-r { animation-delay: .16s; }
@keyframes typing { to { transform: translateY(-4px); } }
.matt.talking .hand-l, .matt.talking .hand-r { animation-play-state: paused; }

.eye { transform-box: fill-box; transform-origin: center; transition: transform .07s; }
.eyes.blink .eye { transform: scaleY(.1); }
.brows { transition: transform .2s; }
.matt.talking .brows, .matt:hover .brows { transform: translateY(-4px); }
.mouth-open { display: none; }
.matt.talking .mouth-open { display: inline; }
.matt.talking .mouth-closed { display: none; }
.glasses { display: none; }
.glasses.on { display: inline; }

.hint { fill: var(--muted); opacity: 0; transition: opacity .2s; pointer-events: none; }
.desk-scene:has(.record:hover) .hint-song,
.desk-scene:has(.record:focus-visible) .hint-song,
.desk-scene:has(.matt:hover) .hint-matt,
.desk-scene:has(.window:hover) .hint-window,
.desk-scene:has(.window:focus-visible) .hint-window { opacity: 1; }

/* speech bubble */
.bubble {
  position: absolute;
  left: 50%;
  bottom: 77%;
  transform: translateX(-50%);
  z-index: 2;
  width: max-content;
  max-width: min(360px, 84%);
  padding: 8px 18px 10px;
  text-align: center;
  background: var(--paper);
  border: 3px solid var(--edge);
  border-radius: 20px;
  box-shadow: 4px 4px 0 var(--edge);
  animation: float 4s ease-in-out infinite;
  transition: background-color .3s;
}
@keyframes float { 50% { translate: 0 -5px; } }
.tail {
  position: absolute;
  top: calc(100% - 3px);
  left: calc(50% - 22px);
  width: 34px;
  height: 46px;
  overflow: visible;
}
.bubble-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2fbf71;
  box-shadow: 0 0 0 0 rgba(47, 191, 113, .6);
  animation: pulse 1.8s infinite;
}
.bubble.quip .live-dot { background: var(--accent); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(47, 191, 113, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 191, 113, 0); } }
/* the hidden "ghost" copy holds the final text so the bubble never resizes while typing */
.bubble-text {
  display: grid;
  min-height: 1.1em;
  font-family: "Caveat", cursive;
  font-size: 27px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}
.bubble-text > span { grid-area: 1 / 1; }
.bubble-text .ghost { visibility: hidden; }
.bubble-text .ghost::after { content: "▍"; }
.typed.typing::after { content: "▍"; font-weight: 400; color: var(--accent); animation: caret .7s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

.intro {
  max-width: 580px;
  margin: 20px auto 0;
  text-align: center;
  font-size: 16.5px;
}
.intro b { color: var(--accent); }

.links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 22px 0 0;
  padding: 0;
}
.links:empty { display: none; }
.social {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 15px 6px 11px;
  font: 700 21px/1.2 "Caveat", cursive;
  color: var(--text);
  text-decoration: none;
  background: var(--paper);
  border: 2px solid var(--edge);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--edge);
  transition: transform .15s ease, box-shadow .15s ease, color .15s;
}
.social svg { width: 19px; height: 19px; flex: none; }
.social:hover, .social:focus-visible {
  color: var(--brand, var(--accent));
  transform: translate(-2px, -2px) rotate(-2deg);
  box-shadow: 5px 5px 0 var(--edge);
}
.social:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--edge); }

/* ── tabs ─────────────────────────────────────── */
.tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 56px 0 28px;
}
.tabs button {
  font: 700 30px/1.2 "Caveat", cursive;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 2px 14px 10px;
  cursor: pointer;
  transition: color .2s;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] {
  color: var(--text);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 10' preserveAspectRatio='none'%3E%3Cpath d='M2 6c10-6 18 4 28 0s18-6 28 0 18 4 28 0 18-6 30 0' fill='none' stroke='%23ff6b4a' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") bottom / 100% 10px no-repeat;
}
.tabs button:focus-visible { outline: 2px dashed var(--accent); outline-offset: 2px; border-radius: 6px; }

.panel { animation: fade-in .35s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }

/* ── projects lab ─────────────────────────────── */
.lab {
  display: grid;
  grid-template-columns: minmax(270px, 350px) 1fr;
  gap: 28px;
  align-items: start;
}

.card {
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 16px;
  transition: transform .2s, border-color .2s, box-shadow .2s, background-color .3s;
}
.card:hover { transform: translateY(-2px); }
.card.active { border-color: var(--edge); box-shadow: 4px 4px 0 var(--edge); }
:root[data-theme="dark"] .card.active { border-color: var(--accent); box-shadow: 4px 4px 0 var(--accent); }

.card-head { display: flex; align-items: center; gap: 12px; }
.card-emoji {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: var(--bg);
  border-radius: 12px;
}
.card h3 { margin: 0; font-size: 16.5px; line-height: 1.3; flex: 1; }
.status {
  font: 700 10.5px/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 5px 8px;
  border-radius: 999px;
  background: #fff1b8;
  color: #6b5300;
}
.status.live { background: #c9f2d9; color: #135c33; }
.card p { margin: 10px 0 0; font-size: 14px; line-height: 1.6; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.tags li {
  font: 12px/1 ui-monospace, Menlo, monospace;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
}
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 700 13px/1 ui-sans-serif, system-ui, sans-serif;
  padding: 9px 14px;
  border-radius: 999px;
  border: 2px solid var(--edge);
  background: var(--line-art);
  color: #fffdf8;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s, background-color .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
:root[data-theme="dark"] .btn:not(.ghost) { background: var(--accent); border-color: var(--accent); color: #1c1a18; }

.tester {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 3px solid var(--edge);
  border-radius: 16px;
  box-shadow: 6px 6px 0 var(--edge);
  overflow: hidden;
}
.tester-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--frame);
  border-bottom: 3px solid var(--edge);
}
.dots { display: flex; gap: 6px; margin-right: 4px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.dots i:nth-child(2) { background: #febc2e; }
.dots i:nth-child(3) { background: #28c840; }
.url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font: 13px/1.4 ui-monospace, Menlo, monospace;
}
.icon-btn {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: var(--text);
  background: transparent;
  border: 2px solid var(--line);
  border-radius: 9px;
  text-decoration: none;
  cursor: pointer;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn:disabled, .icon-btn[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.icon-btn[aria-pressed="true"] { background: var(--bg); border-color: var(--muted); }

.tester-body {
  position: relative;
  display: flex;
  justify-content: center;
  height: 560px;
  background: radial-gradient(var(--line) 1.2px, transparent 1.2px) 0 0 / 16px 16px, var(--bg);
}
.tester-body iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  transition: width .3s ease;
}
.tester-body.phone iframe {
  width: 390px;
  max-width: 100%;
  border-left: 3px solid var(--edge);
  border-right: 3px solid var(--edge);
}
.tester-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-size: 30px;
  color: var(--muted);
}
.tester.has-project .tester-empty { display: none; }
.tester:not(.has-project) iframe { visibility: hidden; }

/* ── song of the week ─────────────────────────── */
.song {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 44px;
  align-items: center;
  max-width: 860px;
  margin: 0 auto;
  padding: 32px;
  background: var(--paper);
  border: 3px solid var(--edge);
  border-radius: 20px;
  box-shadow: 6px 6px 0 var(--edge);
}
.big-vinyl { width: 100%; height: auto; display: block; }
.big-vinyl .vinyl-spin { animation-duration: 3.5s; }
.eyebrow {
  margin: 0;
  font: 700 11.5px/1.4 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}
.song-title { margin: 6px 0 0; font-size: 30px; line-height: 1.2; }
.song-title:empty, .song-artist:empty, .song-note:empty { display: none; }
.song-artist { margin: 2px 0 0; color: var(--muted); }
.song-note { margin: 14px 0 0; font-size: 25px; line-height: 1.2; }
.song-note::before { content: "“"; }
.song-note::after { content: "” — " attr(data-by); color: var(--muted); }
.embed { margin-top: 18px; }
.embed iframe { display: block; width: 100%; height: 152px; border: 0; border-radius: 12px; }
.embed .no-song { color: var(--muted); font-size: 14px; }

.past { max-width: 860px; margin: 40px auto 0; }
.past h3 { margin: 0 0 10px; font-size: 30px; }
.past ol { list-style: none; margin: 0; padding: 0; }
.past li {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 10px 4px;
  border-top: 2px dashed var(--line);
}
.past .when { font-family: "Caveat", cursive; font-size: 21px; color: var(--muted); }
.past a { text-decoration: none; font-weight: 700; }
.past a:hover { color: var(--accent); }
.past .by { color: var(--muted); }

/* ── footer ───────────────────────────────────── */
.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 72px 16px 36px;
  color: var(--muted);
  font-size: 13px;
}
.footer-row { display: flex; gap: 10px; align-items: baseline; }
.footer .hand { font-size: 21px; }

.secrets-btn {
  font: 700 12.5px/1 ui-sans-serif, system-ui, sans-serif;
  color: var(--muted);
  background: transparent;
  border: 2px dashed var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.secrets-btn:hover { color: var(--text); border-color: var(--muted); }
.secrets-btn.done { border-style: solid; border-color: var(--accent); color: var(--accent); }
.secrets-panel {
  width: min(380px, 100%);
  padding: 6px 16px;
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--edge);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--edge);
  animation: fade-in .25s ease;
}
.secrets-panel ul { list-style: none; margin: 0; padding: 0; }
.secrets-panel li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px dashed var(--line); font-size: 13.5px; color: var(--text); }
.secrets-panel li:first-child { border-top: 0; }
.secrets-panel .hint { color: var(--muted); font-style: italic; text-align: right; }
.secrets-panel .got { color: #2fbf71; font-weight: 700; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* deep links (#song) show the right panel before app.js runs */
:root[data-tab="song"] #panel-projects { display: none; }
:root[data-tab="song"] #panel-song[hidden] { display: block; }

.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; margin-right: 8px; vertical-align: -1px; }
.eq i { width: 3px; height: 100%; background: currentColor; border-radius: 1px; transform-origin: bottom; animation: eq .8s ease-in-out infinite alternate; }
.eq i:nth-child(2) { animation-delay: -.3s; }
.eq i:nth-child(3) { animation-delay: -.55s; }
.eq i:nth-child(4) { animation-delay: -.15s; }
@keyframes eq { from { transform: scaleY(.2); } to { transform: scaleY(1); } }

/* ── entrance ─────────────────────────────────── */
.intro-anim .board { animation: drop-in .7s cubic-bezier(.2, 1.5, .45, 1) .1s backwards; }
.intro-anim .window { animation: drop-in .7s cubic-bezier(.2, 1.5, .45, 1) .25s backwards; }
.intro-anim .matt { animation: rise-in .8s cubic-bezier(.2, 1.3, .45, 1) .4s backwards; }
.intro-anim .duck { animation: pop-in .5s cubic-bezier(.2, 1.6, .45, 1) .6s backwards; }
.intro-anim .mug { animation: pop-in .5s cubic-bezier(.2, 1.6, .45, 1) .7s backwards; }
.intro-anim .record { animation: pop-in .5s cubic-bezier(.2, 1.6, .45, 1) .8s backwards; }
.intro-anim .plant-egg { animation: pop-in .5s cubic-bezier(.2, 1.6, .45, 1) .9s backwards; }
.intro-anim .bubble { animation: pop-in .45s cubic-bezier(.2, 1.6, .45, 1) .9s backwards, float 4s ease-in-out infinite; }
@keyframes drop-in { from { translate: 0 -70px; rotate: -5deg; opacity: 0; } }
@keyframes rise-in { from { translate: 0 130px; } }
@keyframes pop-in { from { scale: .3; opacity: 0; } }

/* ── easter eggs ──────────────────────────────── */
.egg { cursor: pointer; outline: none; transition: translate .2s ease, transform .2s ease; }
.egg:hover, .egg:focus-visible { translate: 0 -2px; }
.egg:focus-visible { filter: drop-shadow(0 0 6px var(--accent)); }

/* duck */
.duck.squish { animation: squish .35s ease; }
@keyframes squish { 35% { scale: 1.18 .78; } 70% { scale: .95 1.08; } }
.quack { fill: var(--accent); opacity: 0; pointer-events: none; }
.duck.squish .quack { animation: quack .9s ease; }
@keyframes quack { 0% { opacity: 0; translate: 0 6px; } 25% { opacity: 1; } 100% { opacity: 0; translate: 0 -14px; } }

/* coffee */
.mug.sip .steam path { animation-duration: .9s; stroke-width: 3.5; }
.matt.caffeinated .hand-l, .matt.caffeinated .hand-r { animation-duration: .06s; }
.matt.caffeinated .eye { scale: 1.15; }

/* plant */
.drops { opacity: 0; }
.plant-egg.watering .drops { animation: drip .7s ease-in; }
@keyframes drip { 0% { opacity: 0; translate: 0 -10px; } 20% { opacity: 1; } 100% { opacity: 0; translate: 0 34px; } }
.plant-egg.watering .plant { animation: sway 5s ease-in-out infinite alternate, perk .5s ease; }
@keyframes perk { 50% { scale: 1.07; } }
.flower { scale: 0; transform-box: fill-box; transform-origin: 50% 80%; transition: scale .7s cubic-bezier(.2, 1.6, .4, 1); }
.plant-egg.bloomed .flower { scale: 1; }

/* sleeping + dizzy */
.eyes-closed, .eyes-dizzy, .zzz { display: none; }
.matt.sleeping .eyes, .matt.dizzy .eyes { display: none; }
.matt.sleeping .eyes-closed, .matt.dizzy .eyes-dizzy, .matt.sleeping .zzz { display: inline; }
.matt.sleeping .hand-l, .matt.sleeping .hand-r { animation-play-state: paused; }
.matt-head { transform-box: fill-box; transform-origin: 50% 90%; transition: rotate .6s ease; }
.matt.sleeping .matt-head { rotate: -7deg; }
.matt.dizzy .matt-head { animation: wobble .45s ease-in-out infinite alternate; }
@keyframes wobble { from { rotate: -8deg; } to { rotate: 8deg; } }
.eyes-dizzy path { transform-box: fill-box; transform-origin: center; animation: spin .7s linear infinite; }
.zzz text { fill: var(--muted); opacity: 0; animation: zzz 2.4s ease-in-out infinite; }
.zzz text:nth-child(2) { animation-delay: .8s; }
.zzz text:nth-child(3) { animation-delay: 1.6s; }
@keyframes zzz { 0% { opacity: 0; translate: 0 8px; } 30% { opacity: 1; } 100% { opacity: 0; translate: 12px -18px; } }

/* party mode (konami) */
.shades { opacity: 0; translate: 0 -150px; transition: translate .7s cubic-bezier(.3, 1.3, .5, 1), opacity .25s; }
.party .shades { opacity: 1; translate: 0 0; }
.party body { animation: party-bg 2.4s linear infinite; }
@keyframes party-bg { 0%, 100% { background-color: #ffd6e7; } 25% { background-color: #fff3b0; } 50% { background-color: #c8f7dc; } 75% { background-color: #d8ccff; } }
.party .sky { animation: party-sky 1.6s linear infinite; }
@keyframes party-sky { 0%, 100% { fill: #ff8fb1; } 25% { fill: #ffd23f; } 50% { fill: #7fdbff; } 75% { fill: #b28dff; } }
.party .vinyl-spin { animation-duration: .7s; }
.party .notes text { animation-duration: 1.4s; }
.party .matt { animation: bop .5s ease-in-out infinite alternate; }
@keyframes bop { from { translate: 0 0; rotate: -2deg; } to { translate: 0 -8px; rotate: 2deg; } }
.party .hand-l, .party .hand-r { animation-duration: .12s; }

/* shooting star (night only) */
.shooting-star { opacity: 0; }
.shooting-star.shoot { animation: shoot 1.1s ease-out; }
@keyframes shoot { 0% { opacity: 0; translate: 0 0; } 15% { opacity: 1; } 100% { opacity: 0; translate: -130px 55px; } }

/* lol rain, barrel roll, confetti, toast */
.lol-drop {
  position: fixed;
  bottom: -70px;
  z-index: 50;
  font-family: "Caveat", cursive;
  font-weight: 700;
  pointer-events: none;
  animation-name: lol-rise;
  animation-timing-function: cubic-bezier(.3, .6, .5, 1);
  animation-fill-mode: both;
}
@keyframes lol-rise { from { translate: 0 0; rotate: 0deg; opacity: 1; } 80% { opacity: 1; } to { translate: var(--drift) -115vh; rotate: var(--spin); opacity: 0; } }
.frame.roll { animation: roll 1.3s cubic-bezier(.65, 0, .35, 1); }
@keyframes roll { to { rotate: 360deg; } }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 55; pointer-events: none; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  font: 700 14px/1.3 ui-sans-serif, system-ui, sans-serif;
  text-align: center;
  color: #fffdf8;
  background: var(--line-art);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  translate: -50% 180%;
  transition: translate .45s cubic-bezier(.2, 1.4, .4, 1);
  pointer-events: none;
}
.toast.show { translate: -50% 0; }
:root[data-theme="dark"] .toast { background: var(--accent); color: #1c1a18; }

/* ── share image (rendered from /?og) ─────────── */
.og body { padding: 0; }
.og .frame { min-height: 100vh; border-radius: 0; display: grid; place-items: center; }
.og .wrap { width: 100%; padding: 20px 0 0; }
.og .theme-toggle, .og .tabs, .og .panel, .og .footer, .og .intro, .og .links, .og .hint, .og .toast, .og #confetti { display: none !important; }
.og .scene { max-width: 900px; }
.og .bubble { animation: none; }
.og .hero::after { content: "mattlol.com"; display: block; margin-top: -4px; text-align: center; font: 700 46px/1 "Caveat", cursive; color: var(--text); }

/* ── currently listening ──────────────────────── */
.now-playing {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: min(460px, 100%);
  margin: 22px auto 0;
  padding: 7px 16px 7px 7px;
  color: var(--text);
  text-decoration: none;
  background: var(--paper);
  border: 2px solid var(--edge);
  border-radius: 16px;
  box-shadow: 3px 3px 0 var(--edge);
  transition: transform .15s ease, box-shadow .15s ease;
}
.now-playing[hidden] { display: none; }
a.now-playing[href]:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--edge); }
.np-art, .np-disc { flex: none; width: 46px; height: 46px; border-radius: 10px; }
.np-art { object-fit: cover; border: 2px solid var(--edge); }
.np-disc { display: none; border-radius: 50%; background: radial-gradient(circle, var(--paper) 0 7%, var(--accent) 8% 32%, #1e1e1e 33% 100%); animation: spin 4s linear infinite; }
.np-art[hidden] + .np-disc { display: block; }
.np-body { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.np-label { display: flex; align-items: center; font: 700 10.5px/1.5 ui-sans-serif, system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.now-playing.live .np-label { color: #1db954; }
.now-playing:not(.live) .eq i { animation: none; transform: scaleY(.35); }
.np-track { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14.5px; line-height: 1.4; }
.np-artist { color: var(--muted); }
.np-spotify { flex: none; width: 20px; height: 20px; margin-left: 4px; color: #1db954; }
.np-spotify svg { width: 100%; height: 100%; display: block; }
.np-paused .record .vinyl-spin { animation-play-state: paused; }

.cta {
  display: table;
  margin: 22px auto 0;
  padding: 10px 18px;
  font: 700 21px/1.2 "Caveat", cursive;
  color: var(--text);
  text-decoration: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  transition: background-color .2s, transform .15s;
}
.cta b { color: var(--accent); }
.cta:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); transform: rotate(-1.5deg) scale(1.03); }

.tabs-row { display: flex; justify-content: center; align-items: flex-start; gap: 8px; margin: 56px 0 28px; flex-wrap: wrap; }
.tabs-row .tabs { margin: 0; }
.tabs-link { font: 700 30px/1.2 "Caveat", cursive; color: var(--muted); text-decoration: none; padding: 2px 14px 10px; transition: color .2s; }
.tabs-link:hover { color: var(--accent); }
.tabs-link::after { content: " ↗"; font-size: .7em; }

.og .now-playing, .og .cta { display: none !important; }

/* ── contact page ─────────────────────────────── */
.contact-wrap { max-width: 860px; padding-top: 56px; }
.back { display: inline-block; font-size: 22px; color: var(--muted); text-decoration: none; transition: color .2s, transform .2s; }
.back:hover { color: var(--accent); transform: translateX(-3px); }
.contact-hero { display: grid; grid-template-columns: 180px 1fr; gap: 28px; align-items: center; margin: 18px 0 40px; }
.mini-matt { width: 100%; height: auto; overflow: visible; }
.wave { transform-box: fill-box; transform-origin: 30% 90%; animation: wave 1.6s ease-in-out infinite; }
@keyframes wave { 0%, 60%, 100% { rotate: 0deg; } 10%, 30% { rotate: 18deg; } 20%, 40% { rotate: -10deg; } }
.contact-title { margin: 0; font-size: 64px; line-height: 1; }
.contact-sub { margin: 10px 0 0; font-size: 17px; max-width: 520px; }
.section-title { margin: 0 0 14px; font-size: 32px; }

.services { list-style: none; margin: 0 0 40px; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.service { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--paper); border: 2px solid var(--line); border-radius: 16px; transition: transform .2s, border-color .2s; }
.service:hover { transform: translateY(-2px) rotate(-.5deg); border-color: var(--edge); }
.service-emoji { flex: none; width: 40px; height: 40px; display: grid; place-items: center; font-size: 22px; background: var(--bg); border-radius: 12px; }
.service h3 { margin: 0; font-size: 15.5px; line-height: 1.3; }
.service p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); }

.form-card { padding: 26px 28px 28px; background: var(--paper); border: 3px solid var(--edge); border-radius: 20px; box-shadow: 6px 6px 0 var(--edge); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font: 700 13px/1.3 ui-sans-serif, system-ui, sans-serif; color: var(--muted); }
.field em { font-weight: 400; }
.field input, .field select, .field textarea {
  font: 15px/1.5 "Merriweather", Georgia, serif;
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.send-btn { font-size: 15px; padding: 12px 22px; }
.form-status { margin: 0; font-size: 14px; color: var(--muted); }
.form-status.error { color: #e25d4a; }
.sent { text-align: center; padding: 10px 0; animation: fade-in .4s ease; }
.sent-emoji { margin: 0; font-size: 54px; animation: pop-in .5s cubic-bezier(.2, 1.6, .45, 1) backwards; }
.sent h3 { margin: 6px 0 0; font-size: 36px; }
.sent p { color: var(--muted); }
.contact-page .links { margin-top: 40px; }

/* ── small screens ────────────────────────────── */
@media (max-width: 860px) {
  .lab { grid-template-columns: 1fr; }
  .tester { position: relative; top: 0; order: -1; }
  .tester-body { height: 480px; }
}

@media (max-width: 640px) {
  body { padding: 4px; }
  .frame { min-height: calc(100vh - 8px); }
  .wrap { padding-top: 64px; }
  .bubble {
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    margin: 0 auto -6vw;
    max-width: 92%;
  }
  .bubble-text { font-size: 24px; min-height: 2.2em; align-items: center; }
  .tabs-row { margin-top: 40px; gap: 0; }
  .tabs button, .tabs-link { font-size: 25px; padding-inline: 10px; }
  .contact-hero { grid-template-columns: 1fr; gap: 6px; text-align: center; }
  .mini-matt { max-width: 150px; margin: 0 auto; }
  .contact-title { font-size: 52px; }
  .contact-sub { margin-inline: auto; }
  .services, .field-row { grid-template-columns: 1fr; }
  .form-card { padding: 20px 18px 22px; }
  .song { grid-template-columns: 1fr; gap: 24px; padding: 22px; }
  .big-vinyl { max-width: 200px; margin: 0 auto; }
  .song-title { font-size: 25px; }
  .past li { grid-template-columns: 70px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .notes text, .steam path { opacity: .6; }
}
