/*
  PAPER SPEC (papercraft skill, web page path)
  SUBJECT   a software engineer's desk as a pop-up: pieces stand up from a blueprint sheet lying on a putty desk mat
  STOCK     cream cardstock for sheets, blueprint-blue stock for the plan and labels, kraft for the envelope
  PALETTE   ground #dad6c4 · page #f1e7d0 · core #fbf6ea · lead blueprint blue #34527a
            accents marigold #e2a63c (the one warm note) + coral #c8573e · support sage #7d9a78, kraft #b99263
            ink #2e2638 (never #000) · shadow tint plum
  LIGHT     key from the upper left: lit edges top/left, shadows fall right and down; the lamp re-lights it at night
  MOTION    hinge rotation only for paper (paper-up / paper-down springs), far row rises first;
            UI feedback under 300ms on a strong ease-out; drags track 1:1 and settle with a short transition
  SYSTEM    one card (.panel), one button pair (.btn / .btn.primary), one radius, equal left/right edges (.wrap)
*/
:root {
  --ground: #dad6c4; --page: #f1e7d0; --core: #fbf6ea; --edge: #d3c39d; --cream-d: #e3d5b4;
  --ink: #2e2638; --ink-rgb: 46 38 56; --shadow-rgb: 42 31 51; --on-ground: #2e2638;
  --blue: #34527a; --marigold: #e2a63c; --marigold-d: #c98a2a; --coral: #c8573e; --coral-d: #a8432e;
  --sage: #7d9a78; --sage-d: #5d7a5f; --kraft: #b99263; --screen: #352c44; --pane: #8a6f4a;

  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9 .6' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .15 0 0 0 0 .22 .4 0 0 0 -.16'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  --paper-page: var(--noise); --paper-ground: var(--noise); --paper-blue: var(--noise); --paper-kraft: var(--noise);

  --radius: 3px 5px 4px 6px;
  --cut: inset 1px 1px 0 rgb(251 246 234 / .75), 0 0 0 1px rgb(var(--ink-rgb) / .8), 1px 1px 0 1px rgb(var(--ink-rgb) / .8);
  --contact: 2px 3px 2px rgb(var(--shadow-rgb) / .4);
  --cast: 10px 14px 22px rgb(var(--shadow-rgb) / .2);
  --cast-s: 3px 5px 8px rgb(var(--shadow-rgb) / .2);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --paper-up: linear(0, 0.024, 0.087, 0.18, 0.297, 0.431, 0.574, 0.72, 0.861, 0.993, 1.091, 1.124, 1.095, 1.032, 0.971,
    0.936, 0.936, 0.964, 1.003, 1.033, 1.043, 1.032, 1.009, 0.986, 0.974, 0.975, 0.987, 1.002, 1.013, 1.016, 1.011,
    1.003, 0.995, 0.992, 0.993, 0.996, 1, 1.002, 1.003, 1.002, 1);
  --paper-down: linear(0, -0.02, -0.017, 0.003, 0.031, 0.065, 0.105, 0.15, 0.199, 0.251, 0.306, 0.362, 0.419, 0.477,
    0.536, 0.594, 0.652, 0.708, 0.764, 0.818, 0.871, 0.922, 0.971, 0.997, 0.989, 0.986, 0.987, 0.991, 0.998, 1, 1, 1, 1);
}
/* the lamp is on: the same desk, re-lit */
html[data-night] {
  --ground: #2d3350; --page: #e4d8bc; --core: #f6eeda; --edge: #b9a987; --cream-d: #d3c5a3;
  --blue: #27405f; --kraft: #9c7a52; --shadow-rgb: 8 10 26; --on-ground: #efe4c8; --pane: #ffc45a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
body {
  margin: 0; color: var(--ink); background: var(--paper-ground), var(--ground);
  font: 17px/1.55 Georgia, 'Times New Roman', serif; overflow-x: clip; -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
.wrap { width: min(1080px, 100% - 2.5rem); margin-inline: auto; }
.label { font-weight: 600; text-transform: uppercase; letter-spacing: .16em; font-size: .78rem; }
.soft { color: rgb(var(--ink-rgb) / .84); }
.svg-defs { position: absolute; width: 0; height: 0; }
:focus-visible { outline: 2px dashed var(--on-ground); outline-offset: 3px; }
.panel :focus-visible, .sheet :focus-visible { outline-color: var(--ink); }
.skip { position: fixed; z-index: 99; left: .75rem; top: .75rem; padding: .8em 1.1em; background: var(--page); color: var(--ink);
  box-shadow: var(--cut), var(--contact); transform: translateY(-300%); }
.skip:focus { transform: none; }

/* paper inks for the SVG pieces */
.cP { fill: var(--page); } .cD { fill: var(--cream-d); } .cO { fill: var(--core); } .cB { fill: var(--blue); }
.cM { fill: var(--marigold); } .cMd { fill: var(--marigold-d); } .cC { fill: var(--coral); } .cCd { fill: var(--coral-d); }
.cS { fill: var(--sage); } .cSd { fill: var(--sage-d); } .cK { fill: var(--kraft); } .cI { fill: var(--screen); }
.sD { stroke: var(--cream-d); } .sI { stroke: var(--screen); } .sMd { stroke: var(--marigold-d); }
.pane { fill: var(--pane); transition: fill .25s ease; }

/* ---------- the one card, the one button pair ---------- */
.panel {
  position: relative; background: var(--paper-page), var(--page); border-radius: var(--radius);
  border: 1px solid transparent;   /* forced-colors mode drops box-shadow and paints this */
  box-shadow: var(--cut), 1px 2px 0 var(--edge), var(--contact), var(--cast); padding: 1.5rem 1.75rem;
}
.panel .panel { box-shadow: var(--cut), 1px 2px 0 var(--edge), var(--contact), var(--cast-s); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  font: 600 .8rem/1 Georgia, 'Times New Roman', serif; letter-spacing: .14em; text-transform: uppercase;
  text-decoration: none; white-space: nowrap; color: var(--ink); background: var(--paper-page), var(--page);
  border: 1px solid transparent; border-radius: var(--radius); padding: .5em 1.3em; cursor: pointer;
  box-shadow: var(--cut), 1px 2px 0 var(--edge), var(--contact), var(--cast-s);
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out);
}
.btn:active, .btn[aria-pressed="true"] { transform: translate(1px, 2px); box-shadow: var(--cut), 0 0 0 var(--edge), 1px 1px 1px rgb(var(--shadow-rgb) / .45); }
.btn[aria-pressed="true"] { background: var(--paper-page), var(--cream-d); }
.btn.primary { background: var(--coral-d); color: var(--core); }
.btn.sm { font-size: .72rem; padding-inline: 1em; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:active, [aria-pressed="true"]) { transform: translateY(-2px); }
  .tabs a:hover { transform: translateY(.3em); }
  .links a:hover { text-decoration-color: var(--ink); }
}

/* torn label strips (clip-path eats box-shadow, so the shadow sits on the wrapper) */
.torn-wrap { display: inline-block; filter: drop-shadow(2px 3px 1.5px rgb(var(--shadow-rgb) / .42)) drop-shadow(8px 10px 10px rgb(var(--shadow-rgb) / .18)); }
h2.torn { background: var(--paper-blue), var(--blue); color: var(--core); padding: .7em 1.6em .75em;
  font-size: 1.05rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; }
.sec-head { margin-bottom: 1.5rem; }
.sec-head .torn-wrap { rotate: -1.2deg; }

/* ---------- index tabs ---------- */
.tabs { position: fixed; z-index: 50; top: 0; left: 0; right: 0; display: flex; justify-content: center; gap: .35rem; pointer-events: none; padding: 0 .5rem; }
.tabs a {
  pointer-events: auto; display: flex; align-items: flex-end; min-height: 44px; margin-top: -.4em;
  text-decoration: none; font-weight: 600; font-size: .7rem; letter-spacing: .13em; text-transform: uppercase;
  padding: 0 .95em .8em; background: var(--paper-page), var(--page); border-radius: 0 0 5px 4px;
  box-shadow: var(--cut), 1px 2px 0 var(--edge), var(--contact), var(--cast-s); transition: transform .15s var(--ease-out);
}
.tabs a:nth-child(2n) { background: var(--paper-page), var(--cream-d); }

/* ---------- hero ---------- */
.hero { padding: 5.5rem 0 2.5rem; overflow-x: clip; }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 2.5rem; align-items: center; }
.hero-card { padding: 2.1rem 2.1rem 2.2rem; z-index: 3; }
.hero-card h1 { font-size: clamp(2.2rem, 4.6vw, 3.5rem); line-height: 1.06; letter-spacing: -.02em; margin: .8rem 0 1rem; text-wrap: balance; }
.hero-card h1 span { color: var(--coral-d); }
.hero-card .lede { font-size: 1.1rem; margin-bottom: 1.6rem; max-width: 46ch; }
.actions { display: flex; flex-wrap: wrap; gap: .8rem; }
.tape { position: absolute; top: -.85rem; left: 2.1rem; width: 6.2rem; height: 1.7rem; background: var(--marigold); rotate: -4deg;
  clip-path: polygon(0 8%, 4% 0, 8% 10%, 12% 0, 100% 3%, 97% 30%, 100% 55%, 97% 80%, 100% 100%, 5% 97%, 0 82%, 3% 55%, 0 30%); }

.stage { min-width: 0; }
.scene { position: relative; aspect-ratio: 10 / 8.6; perspective: 1500px; perspective-origin: 50% 0%; user-select: none; -webkit-user-select: none; }
.plan { position: absolute; left: 1%; right: 1%; bottom: 3%; height: 108%; transform-origin: 50% 100%; transform: rotateX(57deg) rotate(-1.5deg);
  filter: drop-shadow(2px 4px 2px rgb(var(--shadow-rgb) / .45)) drop-shadow(10px 22px 18px rgb(var(--shadow-rgb) / .22)); }
.plan-in { position: absolute; inset: 0; background:
    linear-gradient(rgb(251 246 234 / .2) 2px, transparent 2px) 0 0 / 100% 20%,
    linear-gradient(90deg, rgb(251 246 234 / .2) 2px, transparent 2px) 0 0 / 20% 100%,
    linear-gradient(rgb(251 246 234 / .09) 1px, transparent 1px) 0 0 / 100% 4%,
    linear-gradient(90deg, rgb(251 246 234 / .09) 1px, transparent 1px) 0 0 / 4% 100%,
    var(--paper-blue), var(--blue); }
.plan-in svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pool { position: absolute; z-index: 1; left: var(--px, 12%); bottom: var(--py, 30%); width: 70%; aspect-ratio: 2 / 1; translate: -32% 46%;
  background: radial-gradient(closest-side, rgb(255 196 90 / .5), rgb(255 196 90 / .2) 50%, transparent); mix-blend-mode: screen;
  opacity: 0; transition: opacity .3s ease; pointer-events: none; }
html[data-night] .pool { opacity: 1; }

.piece, .piece-shadow { position: absolute; left: var(--x); bottom: var(--y); width: var(--w); transform-origin: 50% 100%; padding: 0; margin: 0; border: 0; background: none; }
.piece { z-index: var(--z, 2); cursor: grab; touch-action: pan-y; transition: transform 1s var(--paper-up) var(--d, 0s); }
.piece[data-fixed] { cursor: default; pointer-events: none; }
.piece.dragging { cursor: grabbing; }
.piece.settle, .piece-shadow.settle { transition: translate .25s var(--ease-out); }
.piece svg, .piece-shadow svg { display: block; width: 100%; height: auto; overflow: visible; pointer-events: none; }
.piece-shadow { z-index: 1; pointer-events: none; opacity: .52; filter: url(#shadow-tint); transform: skewX(-54deg) scaleY(.4);
  transition: transform 1s var(--paper-up) var(--d, 0s); }
html[data-night] .piece-shadow { opacity: .7; }
/* folded flat: the whole pop-up (scene without .up) or one piece (.down) */
.js .scene:not(.up) .piece, .piece.down { transform: rotateX(90deg); transition-duration: .8s; transition-timing-function: var(--paper-down); }
.js .scene:not(.up) .piece-shadow, .piece-shadow.down { transform: skewX(-54deg) scaleY(0); transition-duration: .8s; transition-timing-function: var(--paper-down); }
.piece.hop { transform: translateY(-22%) rotate(-7deg); transition: transform .16s var(--ease-out); }
.piece.near { filter: blur(2.2px); z-index: 30; }

.says { position: absolute; z-index: 40; left: var(--sx, 10%); bottom: var(--sy, 50%); max-width: min(15rem, 62%); padding: .55em .9em .6em;
  font-size: .95rem; font-style: italic; line-height: 1.3; background: var(--paper-page), var(--page); border-radius: var(--radius);
  box-shadow: var(--cut), var(--contact), var(--cast-s); transform-origin: 12% 100%; opacity: 0; transform: scale(.94) translateY(6px);
  transition: opacity .18s var(--ease-out), transform .18s var(--ease-out); pointer-events: none; }
.says.on { opacity: 1; transform: none; }

.controls { position: relative; z-index: 4; display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.3rem; }
.hint { margin-top: .8rem; font-style: italic; font-size: .95rem; color: var(--on-ground); opacity: .85; transition: opacity 1.4s ease; }
.hint.gone { opacity: 0; }
html:not(.js) .controls, html:not(.js) .hint { display: none; }

/* life: small and slow */
.sway { transform-box: fill-box; transform-origin: 50% 100%; animation: sway 5.5s ease-in-out infinite alternate; }
.sway.b { animation-duration: 7s; animation-delay: -2s; }
.sway.c { animation-duration: 4.6s; animation-delay: -1s; }
@keyframes sway { from { transform: rotate(-1.6deg); } to { transform: rotate(1.8deg); } }
.steam { transform-box: fill-box; transform-origin: 50% 100%; animation: steam 4.2s ease-in-out infinite alternate; }
.steam.b { animation-delay: -1.7s; }
@keyframes steam { from { transform: rotate(-4deg) translateY(1px); } to { transform: rotate(5deg) translateY(-2px); } }
.blink { animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.plane { position: absolute; z-index: 35; left: 0; top: 4%; width: 13%; pointer-events: none; animation: fly 34s linear infinite; }
.plane svg { display: block; width: 100%; height: auto; overflow: visible; animation: bank 5s ease-in-out infinite alternate; }
@keyframes fly { from { transform: translate(-160%, 40%); } 45% { transform: translate(380%, -30%); } to { transform: translate(900%, 60%); } }
@keyframes bank { from { transform: rotate(-7deg) translateY(-3px); } to { transform: rotate(3deg) translateY(4px); } }

/* ---------- sections ---------- */
section { padding: 3rem 0; }
h3 { letter-spacing: -.01em; line-height: 1.2; }

.about-grid { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 2.2rem; align-items: start; padding: 2rem; }
.photo { padding: .7rem .7rem .9rem; rotate: -2deg; text-align: center; }
.photo svg, .photo img { display: block; width: 100%; height: auto; outline: 1px solid rgb(0 0 0 / .1); outline-offset: -1px; }
.photo figcaption { font-style: italic; font-size: .9rem; margin-top: .55rem; }
.about-text p { max-width: 65ch; }
.about-text p + p { margin-top: .9rem; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; margin-top: 1.5rem; }
.facts li { padding: .8rem .9rem; background: var(--paper-page), var(--cream-d); }
.facts b { display: block; font-size: 1.7rem; font-style: italic; line-height: 1.1; color: var(--blue); font-variant-numeric: tabular-nums; }
.facts span { font-size: .72rem; }

.skill-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.4rem; padding-top: 1.1rem; }
.skill { padding: 1.9rem 1.2rem 1.3rem; }
.skill::before { content: ''; position: absolute; left: 0; right: 0; top: 1.25rem; border-top: 2px solid rgb(200 87 62 / .7); }
.skill h3 { position: absolute; top: -1.2rem; left: 1rem; font-size: .7rem; letter-spacing: .16em; line-height: 1; padding: .7em 1em .6em; color: var(--core);
  background: var(--tab, var(--blue)); border-radius: 4px 5px 0 0; box-shadow: var(--cut), var(--contact); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.chips li { font-size: .86rem; padding: .28em .7em; background: var(--paper-page), var(--core); border-radius: 2px 3px 2px 4px;
  box-shadow: 0 0 0 1px rgb(var(--ink-rgb) / .75), 1px 1px 0 1px rgb(var(--ink-rgb) / .75), 2px 3px 2px rgb(var(--shadow-rgb) / .3); }

.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.8rem; }
.work { perspective: 1600px; }
.flip { display: grid; height: 100%; transform-style: preserve-3d; transition: transform .8s var(--paper-up); }
.work.flipped .flip { transform: rotateY(180deg); }
.face { grid-area: 1 / 1; display: flex; flex-direction: column; padding: .8rem .8rem 1.2rem; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face.back { transform: rotateY(180deg); padding: 1.6rem 1.7rem 1.2rem; background: var(--paper-page), var(--cream-d);
  /* turned over: mirror the offsets so the light still comes from the upper left */
  box-shadow: inset -1px 1px 0 rgb(251 246 234 / .75), 0 0 0 1px rgb(var(--ink-rgb) / .8), -1px 1px 0 1px rgb(var(--ink-rgb) / .8),
    -1px 2px 0 var(--edge), -2px 3px 2px rgb(var(--shadow-rgb) / .4), -10px 14px 22px rgb(var(--shadow-rgb) / .2); }
html:not(.js) .face.back, html:not(.js) .flip-btn { display: none; }
.thumb { display: block; width: 100%; height: auto; outline: 1px solid rgb(0 0 0 / .1); outline-offset: -1px; }
.face h3 { font-size: 1.3rem; margin: 1rem .5rem .3rem; }
.face.back h3 { margin: 0 0 .9rem; }
.face > p { margin: 0 .5rem; }
.face .chips { margin: .9rem .5rem 1.1rem; }
.face .flip-btn { margin: auto .5rem 0; align-self: flex-start; }
.face.back .flip-btn, .face.back .links { margin-inline: 0; }
.face dt { font-size: .7rem; color: var(--coral-d); }
.face dd { margin-bottom: .8rem; }
.links { display: flex; flex-wrap: wrap; gap: .2rem 1.4rem; font-size: .74rem; margin-block: .2rem .9rem; }
.links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  text-decoration-thickness: 2px; text-underline-offset: 5px; text-decoration-color: var(--coral); transition: text-decoration-color .15s ease; }

.timeline { position: relative; display: grid; gap: 1.5rem; padding-left: 2.6rem; }
.timeline::before { content: ''; position: absolute; left: .7rem; top: .4rem; bottom: .4rem; border-left: 3px dashed var(--on-ground); opacity: .55; }
.job { padding: 1.2rem 1.5rem 1.3rem; }
.job::before { content: ''; position: absolute; left: -2.45rem; top: 1.35rem; width: 1.15rem; height: 1.15rem; border-radius: 50%;
  background: var(--marigold); box-shadow: inset 1px 1px 0 rgb(251 246 234 / .6), 0 0 0 1px rgb(var(--ink-rgb) / .8), 1px 1px 0 1px rgb(var(--ink-rgb) / .8), 2px 3px 2px rgb(var(--shadow-rgb) / .35); }
.job.edu::before { background: var(--sage); }
.job h3 { font-size: 1.2rem; margin: .2rem 0 .1rem; }
.job .where { font-style: italic; }
.job ul { margin-top: .6rem; padding-left: 1.1rem; list-style: square; max-width: 65ch; }
.job li + li { margin-top: .25rem; }
.job li::marker { color: var(--coral); }

.envelope { background: var(--paper-kraft), var(--kraft); padding: 2.2rem 1.5rem 4.2rem; overflow: hidden; }
.letter { max-width: 34rem; margin: 0 auto; padding: 1.8rem 2rem 1.4rem; text-align: center; z-index: 1; transition: transform .9s var(--paper-up); }
.letter h3 { font-size: clamp(1.5rem, 3.4vw, 2rem); line-height: 1.15; letter-spacing: -.02em; margin: .5rem 0 .6rem; text-wrap: balance; }
.letter .actions { justify-content: center; margin-top: 1.3rem; }
.socials { justify-content: center; margin: 1rem 0 0; }
.pocket { position: absolute; z-index: 2; inset: 0; background: var(--paper-kraft), var(--kraft); transform: translateY(calc(100% - 3.2rem));
  box-shadow: 0 -1px 0 rgb(var(--ink-rgb) / .8), 0 -3px 3px rgb(var(--shadow-rgb) / .3); transition: transform .6s var(--ease-drawer); }
.pocket svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.open-btn { position: absolute; z-index: 3; left: 50%; top: 50%; translate: -50% -50%; display: none; }
.js .envelope:not(.open) .letter { transform: translateY(12%); transition: transform .5s var(--ease-drawer); }
.js .envelope:not(.open) .pocket { transform: translateY(32%); }
.js .envelope:not(.open) .open-btn { display: inline-flex; }

footer { padding: 1.5rem 0 3rem; text-align: center; font-style: italic; font-size: .92rem; color: var(--on-ground); }

/* ---------- terminal: a sheet of paper sliding over the desk ---------- */
.sheet { width: min(40rem, 100% - 1.5rem); max-height: min(34rem, 100dvh - 3rem); padding: 0; border: 0; color: var(--core);
  background: var(--screen); border-radius: 6px 7px 6px 8px; overflow: hidden; flex-direction: column;
  box-shadow: 0 0 0 1px rgb(var(--ink-rgb)), 0 0 0 5px var(--page), 0 0 0 6px rgb(var(--ink-rgb) / .8), 4px 8px 4px rgb(8 10 26 / .4), 18px 30px 44px rgb(8 10 26 / .35);
  font: 15px/1.5 ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  opacity: 0; transform: translateY(40px) rotate(-1.5deg);
  transition: transform .4s var(--ease-drawer), opacity .2s ease, overlay .4s allow-discrete, display .4s allow-discrete; }
.sheet[open] { display: flex; opacity: 1; transform: none; }
@starting-style { .sheet[open] { opacity: 0; transform: translateY(40px) rotate(-1.5deg); } }
.sheet::backdrop { background: rgb(21 15 36 / .5); opacity: 0; transition: opacity .3s ease, overlay .3s allow-discrete, display .3s allow-discrete; }
.sheet[open]::backdrop { opacity: 1; }
@starting-style { .sheet[open]::backdrop { opacity: 0; } }
.term-head { display: flex; align-items: center; justify-content: space-between; padding: .5rem .5rem .5rem 1.1rem; background: var(--paper-page), var(--page); color: var(--ink); font-family: Georgia, 'Times New Roman', serif; }
.term-log { flex: 1; min-height: 12rem; overflow-y: auto; overscroll-behavior: contain; padding: 1rem 1.1rem .4rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-log .in { color: var(--marigold); } .term-log .err { color: #f0a08c; } .term-log .dim { color: rgb(251 246 234 / .7); }
.term-form { display: flex; align-items: center; gap: .6rem; padding: .2rem 1.1rem .9rem; color: var(--marigold); }
.term-form input { flex: 1; min-width: 0; min-height: 44px; background: none; border: 0; border-bottom: 2px dashed rgb(251 246 234 / .45);
  color: var(--core); font: inherit; font-size: 16px; caret-color: var(--marigold); border-radius: 0; }
.term-form input::placeholder { color: rgb(251 246 234 / .5); }
.term-form input:focus-visible { outline: 0; border-bottom-color: var(--marigold); }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .hero { padding-top: 4.4rem; }
  .hero .wrap { grid-template-columns: 1fr; gap: 1.4rem; }
  .stage { max-width: 520px; width: 100%; margin-inline: auto; }
  .skill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.2rem 1.2rem; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .wrap { width: min(1080px, 100% - 1.6rem); }
  .tabs { gap: .2rem; } .tabs a { font-size: .6rem; letter-spacing: .08em; padding-inline: .7em; }
  .hero-card { padding: 1.7rem 1.3rem 1.6rem; }
  .actions .btn { flex: 1 1 100%; }
  .controls .btn { flex: 1 1 calc(50% - .3rem); }
  .about-grid, .work-grid, .skill-grid { grid-template-columns: 1fr; }
  .about-grid { padding: 1.4rem 1.2rem; }
  .photo { max-width: 200px; margin-inline: auto; }
  .facts { gap: .5rem; } .facts li { padding: .6rem .5rem; } .facts b { font-size: 1.35rem; } .facts span { font-size: .6rem; letter-spacing: .08em; }
  .letter { padding: 1.5rem 1.1rem 1.2rem; }
  .face.back { padding: 1.3rem 1.2rem 1.1rem; }
  section { padding: 2.2rem 0; }
}

/* ---------- reduced motion / capture: final states, nothing travels ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .piece, .piece-shadow, .flip, .letter, .pocket, .sheet, .btn, .tabs a, .says { transition-duration: .01s !important; transition-delay: 0s !important; }
  .sway, .steam, .blink, .plane, .plane svg { animation: none !important; }
}
.capture .piece, .capture .piece-shadow, .capture .flip, .capture .letter, .capture .pocket, .capture .sheet { transition: none !important; }
.capture .sway, .capture .steam, .capture .blink, .capture .plane, .capture .plane svg { animation-play-state: paused !important; }
.capture .plane { animation-delay: -9s; }
.capture .hint { display: none; }
