@font-face {
  font-family: "Pretendard Variable";
  src: url("assets/PretendardVariable.woff2") format("woff2");
  font-style: normal;
  font-weight: 45 920;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --paper: #fff;
  --ink: #1e2230;
  --ink-soft: #3c4252;
  --muted: #747887;
  --line: #ece9e1;
  --line-soft: #f2f0ea;
  --chip: #f3f1eb;
  --green: #2f9b4f;
  --green-ink: #1f6f38;
  --green-soft: #e4f5e6;
  --sky: #2f7fd1;
  --sky-soft: #e3f0ff;
  --peach: #df7337;
  --peach-soft: #ffeadc;
  --lilac: #8a5cd6;
  --lilac-soft: #efe7ff;
  --gold: #ffbe3b;
  --gold-soft: #fff4d6;
  --deep: #161a22;
  --shadow-sm: 0 1px 2px #2a24120d, 0 2px 8px #2a24120a;
  --shadow: 0 1px 2px #2a24120a, 0 10px 34px #3a30140f;
  --shadow-lg: 0 2px 6px #2a24120f, 0 22px 60px #3a301424;
  --radius: 22px;
  --font: "Pretendard Variable", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --gutter: clamp(15px, 4vw, 60px);
  --meadow-height: 108px;
  --direction: 1;
  --ease-pop: cubic-bezier(.2, .9, .3, 1.25);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { height: 100dvh; display: grid; grid-template-rows: minmax(0, 1fr) 64px; padding-top: clamp(12px, 2.2vh, 24px); box-sizing: border-box; color: var(--ink); background: var(--bg); font: 400 16px/1.6 var(--font); letter-spacing: -.01em; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
:focus-visible { outline: 2.5px solid var(--green); outline-offset: 3px; border-radius: 10px; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 10px; left: 12px; z-index: 30; padding: 8px 14px; border-radius: 999px; background: var(--ink); color: white; }

/* Frame and wallet */
.scene-controls, .scene-view { width: min(1460px, calc(100% - var(--gutter) * 2)); margin-inline: auto; min-width: 0; }
.wallet { min-width: 70px; padding: 6px 13px 6px 9px; border-radius: 999px; background: var(--gold-soft); box-shadow: inset 0 0 0 1px #f6dc9a; display: inline-flex; align-items: center; gap: 7px; justify-content: center; color: #7a4a08; font: 760 14px/1.4 var(--mono); }
.wallet.hit { animation: wallet-hit 340ms ease-out; }
.coin-face { position: relative; display: block; width: 16px; height: 16px; flex: none; border-radius: 50%; border: 1px solid #b0701f; background: linear-gradient(130deg, #fff3b4, #ffc24a 55%, #c27420); box-shadow: inset 0 0 0 2px #f0a93c; }
.coin-face::after { content: ""; position: absolute; inset: 25% 35%; border: 1px solid #8e511e; border-width: 0 1px; }

/* Scene frame */
.scene-view { position: relative; isolation: isolate; min-height: 0; overflow: hidden; border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.scene-view:focus { outline: none; }
.scene { position: absolute; inset: 0; min-height: 0; overflow: hidden; background: var(--paper); }
body:not([data-scene="cover"]) :is(.about-scene, .project-scene) { inset-block-end: var(--meadow-height); }
:is(.about-scene, .project-scene)::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  z-index: 4;
  height: 18px;
  pointer-events: none;
  background: linear-gradient(#fff0, var(--paper));
}
body[data-scene="cover"] :is(.scene-controls, #particle-layer) { visibility: hidden; }
body[data-scene="cover"] .scene-view { box-shadow: none; background: transparent; }
body[data-scene="cover"] .cover-scene { background: transparent; }

/* Cover */
.cover-scene { inset: 0; display: grid; place-items: center; text-align: center; touch-action: pinch-zoom; }
.cover-scene h1 { margin: 0; }
.cover-start { display: grid; justify-items: center; border: 0; border-radius: 28px; padding: .12em .2em; background: transparent; color: var(--ink); font-size: clamp(59px, 11vw, 150px); font-weight: 880; letter-spacing: -.07em; line-height: 1; white-space: nowrap; }
.cover-start:hover { color: #14361f; }
.cover-eyebrow { margin-bottom: clamp(14px, 2.2vw, 26px); padding: 6px 16px; border-radius: 999px; background: var(--green-soft); color: var(--green-ink); font-size: clamp(13px, 1.2vw, 16px); font-weight: 700; letter-spacing: 0; line-height: 1.4; }
.cover-hint { display: inline-flex; align-items: center; gap: 8px; margin-top: clamp(22px, 3vw, 38px); padding: 10px 20px; border-radius: 999px; background: var(--ink); color: #fff; font-size: clamp(14px, 1.15vw, 16px); font-weight: 680; letter-spacing: 0; line-height: 1.3; box-shadow: 0 8px 22px #1e223033; transition: transform 200ms var(--ease-pop); }
.cover-hint::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; rotate: -45deg; }
.cover-start:hover .cover-hint { transform: translateY(-2px); }

.scene-entering { z-index: 2; animation: scene-in 470ms cubic-bezier(.17,.72,.27,1) both; }
.scene-leaving { z-index: 1; animation: scene-out 410ms cubic-bezier(.38,0,.68,1) both; pointer-events: none; }
@keyframes scene-in { from { opacity: 0; transform: translateY(calc(30px * var(--direction))) scale(.984); } }
@keyframes scene-out { to { opacity: 0; transform: translateY(calc(-24px * var(--direction))) scale(.99); } }

/* About */
.about-scroll { height: 100%; display: flex; overflow: auto; overscroll-behavior: contain; padding: clamp(16px, 2.6vw, 36px) clamp(18px, 3vw, 44px); scrollbar-width: thin; scrollbar-color: #d3d0c5 transparent; }
.profile { width: min(1180px, 100%); margin: auto; display: grid; grid-template-columns: minmax(230px, .62fr) minmax(0, 2fr); gap: clamp(16px, 2.4vw, 32px); align-items: start; }
.profile h2, .profile h3, .profile h4 { margin: 0; font-weight: 840; line-height: 1.2; letter-spacing: -.04em; }
.profile dl, .profile dd { margin: 0; }
.profile dt { color: var(--muted); font-size: 12.5px; font-weight: 650; }
.profile dd { overflow-wrap: anywhere; }
.profile-card { position: sticky; top: 0; display: grid; justify-items: center; gap: 5px; padding: clamp(18px, 2vw, 26px) clamp(16px, 1.8vw, 22px); border-radius: var(--radius); background: linear-gradient(170deg, #f1faef, #fbfaf6 62%); box-shadow: inset 0 0 0 1px #e6efe1; text-align: center; }
.profile-portrait { display: block; width: clamp(88px, 8.5vw, 120px); height: auto; margin-bottom: 8px; border-radius: 26px; box-shadow: var(--shadow); }
.profile-card h2 { font-size: clamp(30px, 3vw, 40px); }
.profile-role { margin: 0; padding: 3px 12px; border-radius: 999px; background: var(--green-soft); color: var(--green-ink); font-size: 13px; font-weight: 700; }
.profile-quote { position: relative; margin: 12px 0 6px; padding: 12px 14px; border-radius: 14px; background: #ffffffd0; color: var(--ink-soft); font-size: 14px; font-weight: 600; line-height: 1.55; word-break: keep-all; }
.profile-quote::before { content: ""; position: absolute; top: -6px; left: 50%; width: 12px; height: 12px; translate: -50%; rotate: 45deg; background: inherit; }
.profile-contact { justify-self: stretch; display: grid; gap: 8px; margin-top: 6px !important; text-align: left; }
.profile-contact > div { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: baseline; gap: 6px; font-size: 14px; }
.profile-main { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(12px, 1.4vw, 16px); align-items: start; }
.profile-main > :first-child { grid-column: 1 / -1; }
.profile-block { padding: clamp(14px, 1.6vw, 20px) clamp(16px, 1.8vw, 22px); border-radius: var(--radius); background: #fbfaf6; box-shadow: inset 0 0 0 1px var(--line-soft); }
.profile-block h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: clamp(17px, 1.5vw, 20px); }
.profile-block h3::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--green); box-shadow: 12px 0 0 -1px #9fd3ab; margin-right: 12px; }
.profile-bio { margin: 0 0 10px; color: var(--ink-soft); word-break: keep-all; font-size: clamp(14px, 1.15vw, 15.5px); line-height: 1.65; }
.profile-traits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.profile-traits li { display: flex; align-items: baseline; gap: 9px; padding: 7px 12px; font-size: 13.5px !important; border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-sm); color: var(--ink); font-size: 14.5px; font-weight: 600; word-break: keep-all; }
.profile-traits li::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--tone, var(--green)); translate: 0 -1px; }
.profile-traits li:nth-child(2) { --tone: var(--sky); }
.profile-traits li:nth-child(3) { --tone: var(--peach); }
.profile-traits li:nth-child(4) { --tone: var(--lilac); }
.resume { display: grid; gap: 10px; }
.resume-group h4 { margin-bottom: 4px; color: var(--green-ink); font-size: 14px; letter-spacing: 0; }
.resume-group ul { display: grid; gap: 3px; margin: 0; padding: 0 0 0 14px; border-left: 2px dashed #cfe5d2; list-style: none; }
.resume-group li { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 8px; color: var(--ink); font-size: 13.5px; line-height: 1.5; word-break: keep-all; }
.resume-group li span { color: var(--muted); font: 600 11.5px/1.95 var(--mono); }
.profile-contact a, .project-external a, .project-notes a { color: var(--green-ink); font-weight: 650; text-decoration: underline; text-decoration-color: #9fd3ab; text-decoration-thickness: 2px; text-underline-offset: .25em; }
.profile-contact a:hover, .project-external a:hover, .project-notes a:hover { color: var(--ink); text-decoration-color: var(--green); }
.profile-skills { display: grid; gap: 8px; }
.profile-skills > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 8px 12px; font-size: 14px; border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-sm); }

/* Project layout */
.project-scene { display: grid; grid-template-columns: clamp(164px, 17vw, 232px) minmax(0, 1fr); }
.project-nav { display: flex; flex-direction: column; min-height: 0; padding: clamp(16px, 2vw, 26px) 12px; border-inline-end: 1px solid var(--line-soft); background: #fcfbf8; }
.nav-heading { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 10px 12px; color: var(--muted); }
.nav-heading h2 { margin: 0; font-size: 13px; font-weight: 760; letter-spacing: .02em; }
.nav-heading span { padding: 1px 8px; border-radius: 999px; background: var(--chip); font: 600 11px/1.6 var(--mono); }
#project-menu { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #d6d3c8 transparent; }
.project-choice { position: relative; width: 100%; min-height: 38px; display: flex; align-items: center; gap: 10px; margin: 2px 0; padding: 7px 10px; border: 0; border-radius: 12px; background: transparent; text-align: left; color: var(--ink-soft); font-size: 14px; font-weight: 620; line-height: 1.2; transition: background-color 150ms, color 150ms; }
.project-choice::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 2px; background: #d6d3c8; transition: background-color 150ms, scale 200ms var(--ease-pop); }
.project-choice:hover { background: var(--chip); color: var(--ink); }
.project-choice[aria-pressed="true"] { background: var(--green-soft); color: var(--green-ink); font-weight: 720; }
.project-choice[aria-pressed="true"]::before { background: var(--green); scale: 1.3; }

#project-content { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: clamp(16px, 2.2vw, 34px) clamp(16px, 2.8vw, 44px) 0; }
#project-content:focus { outline: none; }
.project-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 14px; flex: none; margin: 0 0 16px; }
.project-head > :not(.project-tabs) { grid-column: 1; }
.project-category { justify-self: start; display: inline-flex; align-items: center; gap: 6px; margin: 0 0 8px; padding: 3px 11px; border-radius: 999px; background: var(--green-soft); color: var(--green-ink); font-size: 12px; font-weight: 720; }
.project-category::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: currentColor; }
.project-head h2 { margin: 0; font-size: clamp(31px, 5vw, 66px); font-weight: 860; line-height: 1; letter-spacing: -.055em; overflow-wrap: anywhere; }
.title-word { display: inline-block; max-width: 100%; }
.project-head .subtitle { margin: 10px 0 0; color: var(--ink-soft); font-size: clamp(14px, 1.45vw, 19px); font-weight: 580; line-height: 1.4; word-break: keep-all; }
.tech-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.tech-list li { padding: 3px 10px; border-radius: 999px; background: var(--chip); color: var(--ink-soft); font: 600 11.5px/1.5 var(--mono); white-space: nowrap; }
.project-tabs { display: flex; align-self: end; grid-column: 2; grid-row: 1 / 5; gap: 2px; padding: 4px; border-radius: 999px; background: var(--chip); }
.project-tabs button { min-height: 36px; padding: 5px 16px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 680; white-space: nowrap; transition: background-color 160ms, color 160ms, box-shadow 160ms; }
.project-tabs button:hover { color: var(--ink); }
.project-tabs button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); }
.project-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #d6d3c8 transparent; padding: 0 2px 16px; }
.project-overview { display: grid; gap: 4px; width: min(100%, 880px); margin: 0 auto clamp(30px, 6vh, 64px); }
.project-summary { min-width: 0; padding: 18px 20px; border-radius: 18px; background: #fbfaf6; box-shadow: inset 0 0 0 1px var(--line-soft); }
.project-meta { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.lead { margin: 8px 0 0; color: var(--ink-soft); font-size: clamp(15px, 1.22vw, 17px); line-height: 1.7; word-break: keep-all; }
.project-external { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }

/* Story */
.project-notes { --wild-start: clamp(69px, 6.7vw, 98px); --wild-end: clamp(60px, 6.3vw, 93px); color: var(--ink-soft); padding-bottom: clamp(105px, 18dvh, 190px); }
.story-section { padding-top: 26px; }
.story-section + .story-section { margin-top: 30px; }
.story-heading { display: flex; align-items: center; margin: 0 0 6px; padding-inline: var(--wild-start) var(--wild-end); color: var(--ink); font-size: clamp(22px, 2.35vw, 32px); line-height: 1.22; letter-spacing: -.045em; word-break: keep-all; }
.story-heading::before { content: ""; width: 10px; height: 10px; flex: none; margin-right: 26px; border-radius: 3px; background: var(--green); box-shadow: 14px 0 0 -1px #9fd3ab; }
.story-row { position: relative; isolation: isolate; overflow: clip; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(16px, 3vw, 44px); align-items: start; padding-block: 22px 26px; padding-inline: var(--wild-start) var(--wild-end); }
.story-row + .story-row::before { content: ""; position: absolute; top: 0; left: var(--wild-start); right: var(--wild-end); height: 1px; background: var(--line); }
.story-row > :is(.story-copy, .story-figure) { position: relative; z-index: 2; }
.story-copy { min-width: 0; padding: 4px 0 0; font-size: clamp(15px, 1.26vw, 17px); line-height: 1.75; }
.story-copy p { margin: 0; word-break: keep-all; overflow-wrap: anywhere; }
.story-copy strong { font-weight: 760; color: var(--ink); background: linear-gradient(transparent 62%, #d9f2dd 62%); }
.story-copy p code { padding: 1px 6px; border-radius: 6px; background: var(--chip); color: var(--ink); font: .85em/1.55 var(--mono); overflow-wrap: anywhere; }
.story-step { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; margin-right: 6px; border-radius: 7px; background: var(--green-soft); color: var(--green-ink); font-size: .82em; font-weight: 780; vertical-align: .08em; }
.story-row-visual { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.story-row-text { grid-template-columns: minmax(0, 1fr); }
.story-row-text .story-copy { max-width: 72ch; }
.story-clip video { position: absolute; top: 0; left: 0; width: 100%; height: auto; aspect-ratio: 704 / 408; object-fit: contain; border-radius: 16px; background: #f4f3ee; opacity: 0; transition: opacity 170ms ease; }
.story-clip video.active { opacity: 1; }
.story-row-visual > .story-figure { width: min(100%, 560px); }
.story-figure { margin: 0; min-width: 0; }
.story-figure img { display: block; width: 100%; height: auto; aspect-ratio: 704 / 408; object-fit: contain; border-radius: 16px; background: #f4f3ee; box-shadow: var(--shadow-sm); }
.story-figure figcaption { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; margin-top: 8px; color: var(--muted); font-size: 12.5px; }
.story-figure figcaption span { min-width: 0; overflow-wrap: anywhere; }
.story-printing:not(:focus-within) { mask: url("assets/text-dither.png") 0 var(--story-mask) / 100% 3300% no-repeat; }

/* Flow diagram */
.flow-chart { position: relative; padding: 18px 18px 16px; border-radius: 18px; background: #fbfaf6; box-shadow: inset 0 0 0 1px var(--line-soft); }
.flow-title { display: flex; align-items: center; margin: 0 0 14px; color: var(--ink); font-size: 14px; font-weight: 760; letter-spacing: -.02em; }
.flow-title::before { content: ""; width: 8px; height: 8px; flex: none; margin-right: 30px; border-radius: 2px; background: var(--green); box-shadow: 11px 0 0 #9fd3ab, 22px 0 0 #d9f2dd; }
.flow-steps { position: relative; display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.flow-steps li { --tone: var(--green); --tone-soft: var(--green-soft); position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 14px 8px 8px; border-radius: 14px; background: var(--paper); box-shadow: var(--shadow-sm); color: var(--ink); font-size: 13.5px; font-weight: 620; line-height: 1.35; word-break: keep-all; }
.flow-steps li:nth-child(4n + 2) { --tone: var(--sky); --tone-soft: var(--sky-soft); }
.flow-steps li:nth-child(4n + 3) { --tone: var(--peach); --tone-soft: var(--peach-soft); }
.flow-steps li:nth-child(4n + 4) { --tone: var(--lilac); --tone-soft: var(--lilac-soft); }
.flow-steps li + li::before { content: ""; position: absolute; left: 21px; top: -11px; width: 2px; height: 12px; background: repeating-linear-gradient(#cfccc1 0 3px, transparent 3px 6px); }
.flow-num { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 9px; background: var(--tone-soft); color: var(--tone); font: 800 13px/1 var(--mono); }
.flow-text { min-width: 0; }
.flow-loop .flow-steps { padding-right: 34px; }
.flow-loop .flow-steps::after { content: ""; position: absolute; top: 22px; right: 8px; bottom: 22px; width: 20px; border: 2px dashed #cfccc1; border-left: 0; border-radius: 0 14px 14px 0; }
.flow-return { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin: 10px 0 0; color: var(--muted); font-size: 12px; font-weight: 650; }
.flow-return::before { content: "↻"; color: var(--green); font-size: 14px; font-weight: 800; }
.story-figure[data-visible="true"][data-playback="play"] .flow-steps li { animation: flow-step 3.6s ease-in-out calc(var(--i) * .9s) infinite; }
.story-figure[data-visible="true"][data-playback="play"] .flow-num { animation: flow-num 3.6s ease-in-out calc(var(--i) * .9s) infinite; }
@keyframes flow-step { 0%, 26%, 100% { translate: 0; } 6%, 20% { translate: 4px 0; box-shadow: 0 0 0 2px var(--tone-soft), var(--shadow); } }
@keyframes flow-num { 0%, 26%, 100% { scale: 1; } 6%, 20% { background: var(--tone); color: #fff; scale: 1.08; } }

/* Media */
.media-display { margin: 0; min-width: 0; }
.media-frame { position: relative; isolation: isolate; width: 100%; aspect-ratio: 16 / 9; max-height: min(52dvh, 495px); overflow: hidden; border-radius: 18px; background: var(--deep); box-shadow: var(--shadow); }
.media-fill { display: block; width: 100%; height: 100%; object-fit: contain; }
.media-frame video { position: absolute; inset: 0; opacity: 0; transition: opacity 170ms ease; }
.media-frame video.active { opacity: 1; }
.media-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 9px; min-height: 36px; padding: 6px 2px; color: var(--muted); font-size: 12.5px; }
.media-toolbar p { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.play-control { display: flex; align-items: center; gap: 6px; flex: none; min-height: 30px; padding: 3px 12px 3px 10px; border: 0; border-radius: 999px; background: var(--chip); color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.play-control:hover { background: #ebe8df; }
.play-control::before { content: ""; width: 8px; height: 9px; background: var(--green); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.play-control[aria-pressed="true"]::before { clip-path: polygon(0 0, 33% 0, 33% 100%, 0 100%, 0 0, 67% 0, 100% 0, 100% 100%, 67% 100%, 67% 0); }

/* Scene controls */
.scene-controls { align-self: center; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; text-align: center; }
.scene-controls button { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 18px; border: 0; border-radius: 999px; background: var(--paper); box-shadow: var(--shadow-sm); font-size: 13.5px; font-weight: 680; white-space: nowrap; transition: translate 200ms var(--ease-pop), box-shadow 160ms; }
.scene-controls button:not(:disabled):hover { box-shadow: var(--shadow); translate: 0 -1px; }
#scene-prev::before, #scene-next::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; }
#scene-prev::before { rotate: 135deg; }
#scene-next::after { rotate: -45deg; }
#scene-next:not(:disabled) { background: var(--ink); color: #fff; }
#scene-print::before { content: ""; width: 12px; height: 10px; border: 2px solid currentColor; border-radius: 3px; box-shadow: inset 0 -3px 0 -1px var(--paper); }
body[data-scene="cover"] #scene-print { display: none; }
.scene-controls button:disabled { opacity: .4; box-shadow: none; }
#scene-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 14px; font-weight: 650; }

/* Meadow */
.meadow {
  position: absolute; inset: auto 0 0; z-index: 5; height: var(--meadow-height); overflow: hidden;
  background:
    radial-gradient(ellipse at 22% 122%, #c4e6a85e 4%, transparent 53%),
    radial-gradient(ellipse at 80% 114%, #cfeab680 2%, transparent 49%),
    linear-gradient(#fff 4%, #fbfef8 23%, #eef8e6 57%, #e3f3d6 100%);
}
.meadow-scenery {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(circle at 2px 2px, #8fc47062 0 1px, transparent 1.1px),
    radial-gradient(circle at 3px 3px, #addb8f7a 0 1px, transparent 1.12px);
  background-size: 11px 11px, 17px 17px;
  background-position: 0 0, 5px 4px;
  mask-image: linear-gradient(transparent 14%, #0004 41%, #000b 71%, #000);
}
.meadow-tuft, .meadow-patch { position: absolute; left: var(--tuft-x); translate: -50%; }
.meadow-scenery .meadow-tuft { bottom: var(--tuft-bottom); height: var(--tuft-height); }
.meadow-scenery .meadow-patch { bottom: 3px; width: clamp(40px, 6vw, 70px); opacity: .72; }
.meadow-hud { position: absolute; top: 10px; right: 12px; z-index: 1; display: flex; align-items: center; gap: 8px; }
.meadow-shop-button { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 4px 14px 4px 11px; border: 0; border-radius: 999px; background: var(--paper); box-shadow: var(--shadow-sm); color: var(--green-ink); font-size: 13px; font-weight: 740; transition: translate 200ms var(--ease-pop), box-shadow 160ms; }
.meadow-shop-button::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--gold); box-shadow: inset 0 0 0 1.5px #d08f1b; }
.meadow-shop-button:hover, .meadow-shop-button[aria-expanded="true"] { box-shadow: var(--shadow); translate: 0 -1px; }
.meadow-pets { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
.meadow-pet { position: absolute; top: 0; left: 0; display: grid; place-items: end center; width: 56px; height: 49px; padding: 0 0 3px; border: 1px solid transparent; border-radius: 12px; background: transparent; pointer-events: auto; cursor: grab; touch-action: none; user-select: none; will-change: transform; }
.meadow-pet[data-state="held"] { cursor: grabbing; }
.meadow-pet::after { content: ""; position: absolute; z-index: -1; inset: auto 8px 0; height: 5px; border-radius: 50%; background: #2f5c2433; }
.meadow-pet:not([data-state="grounded"])::after { opacity: 0; }
.meadow-pet .pet-body { width: 45px; max-height: 100%; filter: drop-shadow(0 0 1px #fff8) drop-shadow(2px 2px 0 #32462630); transform: scaleX(var(--pet-facing, 1)); }
.meadow-pet .pet-emote { position: absolute; bottom: calc(100% - 3px); left: 50%; translate: -50%; width: 19px; max-height: none; filter: drop-shadow(0 0 1px #fff); animation: pet-emote-in 200ms cubic-bezier(.2,.65,.3,1.5) both; }
.meadow-pet.pet-reacting .pet-body { animation: pet-hop 430ms cubic-bezier(.2,.55,.32,1) both; }
@keyframes pet-emote-in { from { opacity: 0; scale: .4; } }
@keyframes pet-hop { 38% { translate: 0 -8px; scale: .93 1.08; } 79% { translate: 0 1px; scale: 1.09 .88; } }

.pet-shop { position: absolute; right: 10px; bottom: calc(var(--meadow-height) + 8px); z-index: 10; width: min(360px, calc(100% - 20px)); max-height: calc(100% - var(--meadow-height) - 16px); overflow: auto; overscroll-behavior: contain; padding: 18px; border-radius: 20px; background: var(--paper); box-shadow: var(--shadow-lg); animation: shop-in 260ms var(--ease-pop) both; transform-origin: 90% 100%; }
@keyframes shop-in { from { opacity: 0; scale: .94; translate: 0 8px; } }
.pet-shop:focus { outline: none; }
.pet-shop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pet-shop-head h2 { margin: 0; color: var(--ink); font-size: 18px; line-height: 1.2; font-weight: 820; letter-spacing: -.03em; }
.pet-shop button { min-height: 30px; padding: 3px 12px; border: 0; border-radius: 999px; background: var(--green-soft); color: var(--green-ink); font-size: 12px; font-weight: 720; white-space: nowrap; }
.pet-shop button:disabled { opacity: .55; background: var(--chip); color: var(--muted); }
.pet-shop button:not(:disabled):hover { background: #d3eed7; }
#pet-shop-close { background: var(--chip); color: var(--ink-soft); }
.pet-catalog { display: grid; gap: 8px; margin: 14px 0 12px; padding: 0; list-style: none; }
.pet-catalog li { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 52px; padding: 6px 10px 6px 6px; border-radius: 14px; background: #fbfaf6; box-shadow: inset 0 0 0 1px var(--line-soft); }
.pet-catalog .pixel-sprite { width: 30px; max-height: 29px; object-fit: contain; justify-self: center; }
.pet-catalog strong { color: var(--ink); font-size: 14px; font-weight: 720; }
.pet-auto { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border-radius: 14px; background: var(--chip); color: var(--ink-soft); font-size: 13px; cursor: pointer; }
.pet-auto input { margin: 3px 0 0; width: 16px; height: 16px; flex: none; accent-color: var(--green); }
.pet-auto small { display: block; color: var(--muted); font-size: 12px; }

/* Wild pockets & monsters */
.pixel-sprite { display: block; width: auto; height: auto; image-rendering: pixelated; }
.wild-pocket { pointer-events: none; position: absolute; z-index: 1; top: var(--wild-top); height: 96px; }
.wild-pocket[data-side="start"] { inset-inline-start: 0; width: calc(var(--wild-start) - 5px); }
.wild-pocket[data-side="end"] { inset-inline-end: 0; width: calc(var(--wild-end) - 5px); }
.wild-ground { position: absolute; left: var(--plant-x); bottom: 2px; width: min(calc(100% + 24px), 116px); height: auto; transform: translateX(-50%); opacity: .85; animation: ground-in 480ms ease-out both; }
.wild-plant { position: absolute; width: auto; height: calc(27px * var(--plant-scale)); bottom: 10px; left: var(--plant-x); transform: translateX(-50%); animation: monster-pop 420ms cubic-bezier(.15,.82,.22,1) both; }
.monster-roam { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.monster { pointer-events: auto; position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 45px; height: 43px; padding: 2px; border: 0; border-radius: 12px; background: transparent; will-change: transform; animation: monster-pop 270ms cubic-bezier(.15,.82,.22,1) both; }
.monster:hover { background: #ffffffb8; box-shadow: var(--shadow-sm); }
.monster .pixel-sprite { width: 39px; height: auto; filter: drop-shadow(0 0 1px #fff) drop-shadow(2px 3px 0 #30412738); }
@keyframes monster-pop { from { opacity: 0; scale: .55; } }
@keyframes ground-in { from { opacity: 0; } }

/* Transitions */
.sand-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.leaving .project-head h2 { animation: dither-print 460ms steps(32, end) reverse both; }
.arriving .project-head > :not(.project-tabs), .arriving .note-entry {
  animation: dither-print var(--print-time, 565ms) steps(32, end) var(--note-delay, 0ms) backwards,
    ink-rise var(--print-time, 565ms) cubic-bezier(.18, .75, .32, 1) var(--note-delay, 0ms) backwards;
}
.arriving .project-head h2 { --note-delay: 45ms; --print-time: 680ms; }
.arriving .subtitle { --note-delay: 122ms; }
.arriving .tech-list { --note-delay: 155ms; }
.arriving .note-entry { --print-time: 440ms; }
.leaving .note-entry { animation: dither-print 270ms steps(32, end) var(--note-reverse, 0ms) reverse both; }
.note-entry:focus-within { animation: none !important; }
.leaf-fade .media-fill { animation: media-in 235ms ease-out both; }
@keyframes dither-print {
  from, to { mask: url("assets/text-dither.png") 0 0 / 100% 3300% no-repeat; }
  to { mask-position: 0 100%; }
}
@keyframes ink-rise { from { transform: translateY(7px); } }
@keyframes media-in { from { opacity: 0; } }

#particle-layer { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 15; }
.coin-plus { position: absolute; left: var(--left); top: var(--top); color: #7a4a08; font: 800 22px/1 var(--mono); text-shadow: 1px 1px #ffe4a4, 0 0 8px #ffbd54bb; transform: translate(-50%, -100%); animation: coin-pop 600ms ease-out both; }
.coin-plus::before { content: ""; position: absolute; top: 12px; left: -9px; width: 5px; height: 5px; background: var(--gold); box-shadow: -5px 10px 0 -1px var(--gold), 12px 12px 0 -1px var(--gold); }
.monster-burst { position: absolute; }
.monster-burst i { position: absolute; width: var(--size); height: var(--size); animation: monster-burst 620ms cubic-bezier(.09,.7,.3,1) both; }
@keyframes coin-pop { 0% { scale: 1.06; } 22% { scale: 1; } 66% { opacity: 1; } 100% { opacity: 0; } }
@keyframes wallet-hit { 35% { scale: 1.08; box-shadow: inset 0 0 0 1px #e3ad3d, 0 0 14px #f4c87675; } }
@keyframes monster-burst { to { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--spin)) scale(.28); } }

@media (max-width: 1000px) {
  .profile { gap: 25px; }
}
@media (max-width: 730px) {
  :root { --gutter: 10px; --meadow-height: 83px; --radius: 18px; }
  body { grid-template-rows: minmax(0, 1fr) 56px; padding-top: 10px; }
  .wallet { min-width: 52px; gap: 5px; padding: 5px 9px 5px 7px; font-size: 12px; }
  .cover-start { font-size: clamp(54px, 13vw, 99px); }
  .about-scroll { padding: 20px 16px 26px; }
  .profile { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .profile-card { position: static; }
  .profile-main { grid-template-columns: minmax(0, 1fr); }
  .profile-traits { grid-template-columns: minmax(0, 1fr); }
  .profile-block { padding: 16px; }
  .resume-group li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .profile-skills > div { padding: 8px 12px; }
  .project-scene { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .project-nav { padding: 8px 8px 6px; border-inline-end: 0; border-bottom: 1px solid var(--line-soft); }
  .nav-heading { padding: 0 4px 4px; }
  .nav-heading h2 { font-size: 12px; }
  #project-menu { display: flex; align-items: center; gap: 4px; overflow: auto; padding: 1px 1px 3px; }
  .project-choice { width: auto; flex: none; min-height: 34px; margin: 0; white-space: nowrap; font-size: 13px; }
  #project-content { padding: 14px 12px 0; }
  .project-head { grid-template-columns: minmax(0, 1fr); margin-bottom: 10px; }
  .project-head h2 { font-size: clamp(29px, 8.2vw, 49px); }
  .project-head .subtitle { margin-top: 6px; }
  .tech-list { margin-top: 8px; }
  .project-tabs { justify-self: start; grid-column: 1; grid-row: auto; margin-top: 10px; }
  .project-tabs button { min-height: 32px; padding: 3px 12px; font-size: 12px; }
  .project-overview { gap: 2px; }
  .project-summary { padding: 14px 16px; }
  .project-notes { --wild-start: 49px; --wild-end: 44px; }
  .story-row { grid-template-columns: minmax(0, 1fr); gap: 12px; padding-block: 16px 18px; }
  .story-section { padding-top: 18px; }
  .story-section + .story-section { margin-top: 18px; }
  .story-copy { padding-top: 2px; }
  .flow-chart { padding: 14px 12px 12px; }
  .flow-steps li { min-height: 40px; font-size: 13px; }
  .wild-plant { height: calc(19px * var(--plant-scale)); }
  .monster { width: 32px; height: 36px; }
  .monster .pixel-sprite { width: 28px; }
  .media-frame { max-height: 32dvh; }
  .scene-controls { gap: 8px; }
  .scene-controls button { min-height: 38px; padding-inline: 14px; }
  #scene-print { display: none; }
  .meadow-hud { top: 6px; right: 6px; gap: 6px; }
  .meadow-shop-button { min-height: 30px; padding-inline: 9px 11px; font-size: 12px; }
  .meadow-pet { width: 48px; height: 43px; }
  .meadow-pet .pet-body { width: 37px; }
  .meadow-scenery .meadow-tuft { height: calc(var(--tuft-height) * .79); }
  #scene-label { font-size: 13px; }
}
@media (max-width: 360px) {
  .cover-start { font-size: clamp(44px, 16vw, 56px); }
  .project-notes { --wild-start: 41px; --wild-end: 38px; }
  .monster { width: 28px; }
  .monster .pixel-sprite { width: 24px; }
}
@media (max-height: 650px) and (min-width: 731px) {
  :root { --meadow-height: 78px; }
  body { grid-template-rows: minmax(0, 1fr) 54px; padding-top: 10px; }
  .project-head h2 { font-size: clamp(29px, 4vw, 52px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .story-printing:not(:focus-within) { mask: none; }
  .coin-plus { animation: none !important; }
}

/* Print: the current page (introduction or one project) laid out in full on A4 pages. */
@page { size: A4; margin: 14mm 12mm; }
@media print {
  html, body { height: auto; overflow: visible; background: #fff; }
  body { display: block; padding: 0; font-size: 11pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .skip-link, .scene-controls, #particle-layer, .meadow, .meadow-pets, .pet-shop, .project-nav, .project-tabs,
    .scene[hidden], :is(.about-scene, .project-scene)::after { display: none !important; }
  .scene-view, .scene, .project-scene, #project-content, .project-body, .about-scroll { position: static !important; display: block; width: auto; height: auto !important; max-height: none; overflow: visible !important; inset: auto; padding: 0; margin: 0; border-radius: 0; box-shadow: none; background: none; animation: none !important; }
  .scene-leaving { display: none !important; }
  * { animation: none !important; transition: none !important; }
  .story-printing, .note-entry, .project-head > * { mask: none !important; }
  .project-head { display: block; margin-bottom: 8mm; }
  .project-head h2 { font-size: 30pt; }
  .project-overview { width: 100%; margin: 0 0 8mm; break-inside: avoid; }
  .media-frame { max-height: 95mm; box-shadow: none; }
  .media-frame video, .story-clip video { display: none; }
  .project-notes { padding: 0; --wild-start: 0px; --wild-end: 0px; }
  .story-section { break-before: auto; padding-top: 4mm; }
  .story-heading { break-after: avoid; }
  .story-row { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); padding: 4mm 0; break-inside: avoid; overflow: visible; }
  .story-row-visual { grid-template-columns: minmax(0, 1fr); }
  .story-row + .story-row::before { left: 0; right: 0; }
  .story-figure img, .flow-chart, .flow-steps li, .project-summary, .profile-block, .profile-card, .profile-traits li, .profile-skills > div { box-shadow: none; border: 1px solid #e6e3da; }
  .profile { grid-template-columns: 66mm minmax(0, 1fr); gap: 6mm; zoom: .9; }
  .profile-contact > div { grid-template-columns: 46px minmax(0, 1fr); font-size: 8.6pt; }
  .profile-contact dd { overflow-wrap: normal; }
  .profile-card { position: static; break-inside: avoid; }
  .profile-block { break-inside: avoid; }
}
