/* ─────────────────────────────────────────────
   Arya Chandra — portfolio
   ───────────────────────────────────────────── */

:root {
  --bg: #f7f6f3;
  --bg-elev: #ffffff;
  --text: #161616;
  --text-2: #5e5e5b;
  --text-3: #9b9a95;
  --line: #e6e4de;
  --line-2: #d9d6ce;
  --chip: #efede8;
  --chip-hover: #e7e4dd;
  --frame: #0e0e0e;
  --frame-line: rgba(255, 255, 255, 0.07);
  --frame-ink: #f2f2f2;
  --frame-ink-2: rgba(255, 255, 255, 0.45);
  --green: #16a34a;
  --accent: #ff5b1f;
  --dot: rgba(0, 0, 0, 0.13);
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px -12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 1px 2px rgba(0, 0, 0, 0.05), 0 24px 48px -16px rgba(0, 0, 0, 0.22);

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Instrument Serif", Georgia, serif;

  --w: 720px;
  --gutter: 24px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0b;
    --bg-elev: #141414;
    --text: #ededec;
    --text-2: #a1a09c;
    --text-3: #6b6a66;
    --line: #1f1f1e;
    --line-2: #2b2b2a;
    --chip: #171716;
    --chip-hover: #1f1f1e;
    --frame: #121212;
    --frame-line: rgba(255, 255, 255, 0.06);
    --green: #22c55e;
    --dot: rgba(255, 255, 255, 0.085);
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 24px 48px -16px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b0b;
  --bg-elev: #141414;
  --text: #ededec;
  --text-2: #a1a09c;
  --text-3: #6b6a66;
  --line: #1f1f1e;
  --line-2: #2b2b2a;
  --chip: #171716;
  --chip-hover: #1f1f1e;
  --frame: #121212;
  --frame-line: rgba(255, 255, 255, 0.06);
  --green: #22c55e;
  --dot: rgba(255, 255, 255, 0.085);
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 24px 48px -16px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

/* ───────────── Base ───────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; interpolate-size: allow-keywords; }
body {
  margin: 0;
  background: var(--bg) radial-gradient(circle at 11px 11px, var(--dot) 1px, transparent 1.4px) 0 0 / 22px 22px fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.65;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* faint paper grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 100;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
::selection { background: var(--text); color: var(--bg); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 500; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.skip {
  position: absolute; left: 16px; top: -40px; z-index: 200;
  background: var(--text); color: var(--bg); padding: 6px 12px; border-radius: 8px; font-size: 13px;
}
.skip:focus { top: 12px; }

/* line icons */
.nav svg, .ul svg, .social svg, .xp__ext svg, .role__chev, .totop svg, .palette svg {
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

/* ───────────── Nav ───────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  mask-image: linear-gradient(to bottom, #000 78%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent);
}
.nav__inner {
  max-width: calc(var(--w) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 18px var(--gutter) 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.nav__links { display: flex; gap: 20px; font-size: 14px; color: var(--text-2); }
.nav__links a { position: relative; transition: color .2s; }
.nav__links a:hover, .nav__links a[aria-current="true"] { color: var(--text); }
.nav__links a[aria-current="true"]::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; width: 3px; height: 3px; border-radius: 50%;
  background: var(--text); transform: translateX(-50%);
}
.nav__actions { display: flex; align-items: center; gap: 12px; }
.nav__sep { width: 1px; height: 16px; background: var(--line-2); }
.kbd-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 6px 0 10px;
  border: 1px solid var(--line-2); border-radius: 999px;
  color: var(--text-2); background: var(--bg-elev);
  transition: border-color .2s, color .2s;
}
.kbd-btn:hover { color: var(--text); border-color: var(--text-3); }
.kbd-btn > svg { width: 15px; height: 15px; }
.kbd { display: inline-flex; gap: 3px; }
.kbd > span, kbd {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px;
  font: 500 11px/1 var(--mono); color: var(--text-2);
  background: var(--chip); border: 1px solid var(--line); border-radius: 5px;
}
.lamp-slot--box { width: 34px; height: 32px; }

/* ───────────── Lamp (theme switch) ───────────── */
.lamp {
  --head: 34px; --rod: 9px; --cord: 24px; --bead: 8px; --chain: 2px;
  --on: 1; --b1: #fffdf2; --b2: #ffe196; --b3: #ffae3d; --inner: #ffe3a3; --chain-c: #8b9199;
  position: fixed; top: 0; z-index: 55; width: var(--head);
  right: calc(max(0px, (100% - var(--w) - var(--gutter) * 2) / 2) + var(--gutter));
  pointer-events: none;
}
:root[data-theme="dark"] .lamp { --on: 0; --b1: #a29e97; --b2: #6d6a64; --b3: #42403c; --inner: #1f1f21; --chain-c: #747a82; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lamp { --on: 0; --b1: #a29e97; --b2: #6d6a64; --b3: #42403c; --inner: #1f1f21; --chain-c: #747a82; }
}
.lamp__mount {
  position: absolute; left: 50%; top: 0; translate: -50% 0;
  width: calc(var(--head) * .32); height: calc(var(--rod) * .12 + 3px); border-radius: 0 0 5px 5px;
  background: linear-gradient(90deg, #5b6067, #eef0f2 38%, #9aa0a7 66%, #4f545a);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.lamp__sway { transform-origin: 50% 0; animation: lamp-sway 7s ease-in-out infinite; }
@keyframes lamp-sway { 0%, 100% { rotate: -1.2deg; } 50% { rotate: 1.2deg; } }
.lamp__swing { position: relative; transform-origin: 50% 0; }
.lamp__rod {
  display: block; margin: 0 auto; width: 2px; height: var(--rod);
  background: linear-gradient(90deg, #5f646b, #eceef1 50%, #737880);
}
.lamp__head {
  position: relative; width: var(--head); height: calc(var(--head) * .775);
  pointer-events: auto; isolation: isolate;
}
.lamp__head svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .18)); }
.lamp__head::before {
  content: ""; position: absolute; z-index: -1; left: 50%; top: 84%;
  width: 160%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 196, 102, .55), rgba(255, 196, 102, .12) 40%, transparent 66%);
  opacity: var(--on); transition: opacity .5s;
}
.lamp__inner { fill: var(--inner); transition: fill .4s; }
.bulb-a { stop-color: var(--b1); transition: stop-color .4s; }
.bulb-b { stop-color: var(--b2); transition: stop-color .4s; }
.bulb-c { stop-color: var(--b3); transition: stop-color .4s; }
.lamp__beam {
  display: none; position: absolute; left: 50%; top: calc(var(--rod) + var(--head) * .66); translate: -50% 0;
  width: calc(var(--head) * 6); height: 78vh; pointer-events: none;
  background: radial-gradient(ellipse 50% 100% at 50% 0, rgba(255, 186, 92, .2), rgba(255, 186, 92, .07) 45%, transparent 80%);
  -webkit-mask-image: conic-gradient(from 156deg at 50% 0, transparent, #000 12deg, #000 36deg, transparent 48deg);
  mask-image: conic-gradient(from 156deg at 50% 0, transparent, #000 12deg, #000 36deg, transparent 48deg);
  opacity: var(--on); transition: opacity .5s;
}
.lamp__pull {
  position: absolute; left: 77.5%; top: calc(var(--rod) + var(--head) * .62); translate: -50% 0;
  width: 28px; height: calc(var(--cord) + var(--bead) * 1.25 + 12px);
  padding: 0; border: 0; background: none; pointer-events: auto; touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.lamp__pull:focus-visible { outline: none; }
.lamp__cord {
  position: absolute; left: 50%; top: 0; width: var(--chain); margin-left: calc(var(--chain) / -2);
  height: var(--len, var(--cord)); transform-origin: 50% 0; rotate: var(--ang, 0deg);
  background: radial-gradient(circle, var(--chain-c) 0 48%, transparent 58%) 50% 0 / var(--chain) calc(var(--chain) * 1.3) repeat-y;
}
.lamp__bead {
  position: absolute; left: 50%; top: 0; width: var(--bead); height: calc(var(--bead) * 1.25);
  margin-left: calc(var(--bead) / -2);
  translate: var(--bx, 0px) var(--by, var(--cord));
  border-radius: 50% 50% 46% 46% / 42% 42% 58% 58%;
  background: radial-gradient(circle at 34% 28%, #fff 0 9%, #dfe2e6 24%, #9197a0 58%, #4b5057);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .28);
}
.lamp__pull:focus-visible .lamp__bead { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (min-width: 1120px) {
  .lamp {
    --head: 76px; --rod: 64px; --cord: 58px; --bead: 12px; --chain: 3px;
    right: auto;
    left: calc(50% + var(--w) / 2 + var(--gutter) + (100% - var(--w) - var(--gutter) * 2) * .2 - var(--head) / 2);
  }
  .lamp-slot { display: none; }
  .lamp__beam { display: block; }
}
@media (prefers-reduced-motion: reduce) { .lamp__sway { animation: none; } }

/* ───────────── Page ───────────── */
.page {
  max-width: calc(var(--w) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 40px var(--gutter) 40px;
}
.section { margin-top: 88px; }
.section--tight { margin-top: 56px; }
.section__title {
  font-size: 14px; font-weight: 400; color: var(--text-3);
  margin-bottom: 22px; letter-spacing: 0;
}

/* ───────────── Intro ───────────── */
.id { display: flex; align-items: center; gap: 16px; margin-bottom: 30px; }
.avatar {
  position: relative; width: 60px; height: 60px; flex: none;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line), 0 0 0 4px var(--bg), 0 0 0 5px var(--line);
}
.avatar svg, .avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar__status {
  position: absolute; right: -1px; bottom: 1px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 0 3px var(--bg);
}
.avatar__status::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--green);
  animation: ping 2.4s cubic-bezier(0, 0, .2, 1) infinite;
}
@keyframes ping { 75%, 100% { transform: scale(2.2); opacity: 0; } }

.id__name { font-size: 19px; font-weight: 550; letter-spacing: -0.02em; line-height: 1.3; }
.id__role { color: var(--text-2); font-size: 15px; height: 1.6em; overflow: hidden; }
.id__role span { display: inline-block; transition: filter .35s var(--ease), opacity .35s var(--ease), transform .35s var(--ease); }
.id__role span.out { filter: blur(6px); opacity: 0; transform: translateY(-6px); }
.id__role span.pre { filter: blur(6px); opacity: 0; transform: translateY(6px); transition: none; }

.bio { display: grid; gap: 18px; color: var(--text-2); font-size: 16px; }
.bio strong { color: var(--text); font-weight: 500; }
.bio em {
  font-family: var(--serif); font-style: italic; font-size: 1.14em; color: var(--text);
  letter-spacing: 0; line-height: 1;
}
.bio q { color: var(--text); quotes: "\201C" "\201D"; }

.brand {
  display: inline-flex; align-items: center; gap: 6px; vertical-align: baseline;
  color: var(--text); font-weight: 500;
  background: linear-gradient(var(--line-2), var(--line-2)) 0 100% / 100% 1px no-repeat;
  transition: background-size .3s var(--ease);
}
.brand:hover { background-size: 100% 100%; background-image: linear-gradient(var(--chip), var(--chip)); border-radius: 4px; }
.brand__mark, .xp__logo, .edu__logo {
  display: inline-grid; place-items: center; flex: none;
  width: 18px; height: 18px; border-radius: 5px;
  background: #0d0d0d; color: #f2f2f2;
  font: 700 11px/1 var(--sans);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 1px 2px rgba(0,0,0,.15);
  transform: translateY(3px);
}
.brand__mark--e, .xp__logo--e { font: italic 400 15px/1 var(--serif); padding-bottom: 2px; }
.yc {
  display: inline-flex; align-items: center; height: 19px; padding: 0 6px;
  font: 500 10.5px/1 var(--mono); letter-spacing: .02em; color: #f26522;
  background: color-mix(in srgb, #f26522 10%, transparent);
  border: 1px solid color-mix(in srgb, #f26522 22%, transparent);
  border-radius: 5px; vertical-align: 2px; white-space: nowrap;
}

.ul {
  color: var(--text); font-weight: 500;
  text-decoration: underline; text-decoration-color: var(--line-2);
  text-underline-offset: 3px; text-decoration-thickness: 1px;
  transition: text-decoration-color .2s;
}
.ul:hover { text-decoration-color: var(--text); }
.copy { display: inline-flex; align-items: center; gap: 4px; }
.copy svg { width: 13px; height: 13px; color: var(--text-3); }
.js [data-email-only][hidden] { display: none !important; }

/* ───────────── Cards ───────────── */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card {
  position: relative; padding: 7px;
  border: 1px dashed var(--line-2);
  transition: border-color .3s;
}
.card:hover { border-color: var(--text-3); }
.corner { position: absolute; width: 9px; height: 9px; border: 0 solid var(--text-3); transition: all .35s var(--ease); }
.corner.tl { top: -5px; left: -5px; border-top-width: 1px; border-left-width: 1px; }
.corner.tr { top: -5px; right: -5px; border-top-width: 1px; border-right-width: 1px; }
.corner.bl { bottom: -5px; left: -5px; border-bottom-width: 1px; border-left-width: 1px; }
.corner.br { bottom: -5px; right: -5px; border-bottom-width: 1px; border-right-width: 1px; }
.card:hover .corner { border-color: var(--text); }
.card:hover .corner.tl { transform: translate(-3px, -3px); }
.card:hover .corner.tr { transform: translate(3px, -3px); }
.card:hover .corner.bl { transform: translate(-3px, 3px); }
.card:hover .corner.br { transform: translate(3px, 3px); }

.card__frame {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255,255,255,.07), transparent 60%),
    var(--frame);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px var(--frame-line);
}
.card__body { padding: 16px 8px 8px; display: flex; flex-direction: column; }
.card__title { display: flex; align-items: baseline; gap: 8px; font-size: 16.5px; font-weight: 550; letter-spacing: -0.018em; }
.card__num { font: 400 11px/1 var(--mono); color: var(--text-3); }
.card__text { margin-top: 6px; font-size: 14.5px; line-height: 1.55; color: var(--text-2); }

/* viz shared */
.viz { position: absolute; inset: 0; color: var(--frame-ink); }
.viz__tag {
  position: absolute; left: 12px; top: 10px;
  font: 500 10.5px/1 var(--mono); color: var(--frame-ink-2); letter-spacing: .02em;
}

/* 01 · curve */
.viz--curve svg { position: absolute; inset: 14% 8% 10% 8%; width: 84%; height: 76%; overflow: visible; }
.viz--curve .grid path { stroke: rgba(255,255,255,.06); stroke-width: 1; vector-effect: non-scaling-stroke; }
.viz--curve .line {
  fill: none; stroke: #fff; stroke-width: 1.75; vector-effect: non-scaling-stroke;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.8s var(--ease) .2s;
}
.viz--curve .area { fill: url(#none); fill: rgba(255,255,255,.05); opacity: 0; transition: opacity 1.2s ease .9s; }
.viz--curve .viz__dot {
  position: absolute; right: 8%; top: calc(14% + 76% * 12 / 150); width: 8px; height: 8px; margin: -4px -4px 0 0;
  border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 91, 31, .18), 0 0 18px 2px rgba(255, 91, 31, .55);
  opacity: 0; transform: scale(.4); transition: opacity .4s ease 1.7s, transform .5s var(--ease) 1.7s;
}
.marker {
  position: absolute; left: calc(8% + var(--x) * .84); top: calc(14% + var(--y) * .76);
  width: 7px; height: 7px; margin: -3.5px; border-radius: 50%;
  background: var(--frame); box-shadow: inset 0 0 0 1.5px #fff;
  opacity: 0; transition: opacity .4s ease;
}
.marker:nth-of-type(1) { transition-delay: .8s; }
.marker:nth-of-type(2) { transition-delay: 1.25s; }
.marker b {
  position: absolute; right: 12px; bottom: 9px;
  font: 500 9px/1 var(--mono); color: var(--frame-ink-2); letter-spacing: .04em; text-transform: uppercase;
  white-space: nowrap;
}
.marker::before { content: ""; position: absolute; right: 5px; bottom: 5px; width: 7px; height: 1px; background: rgba(255,255,255,.3); transform: rotate(-45deg); transform-origin: right; }
.is-in .viz--curve .line { stroke-dashoffset: 0; }
.is-in .viz--curve .area { opacity: 1; }
.is-in .viz--curve .viz__dot { opacity: 1; transform: none; }
.is-in .marker { opacity: 1; }

/* 02 · ripple */
.viz--ripple .ring {
  position: absolute; left: 50%; top: 50%; width: 22%; aspect-ratio: 1; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.35); transform: translate(-50%, -50%) scale(.4); opacity: 0;
}
.is-in .viz--ripple .ring { animation: ripple 3.6s cubic-bezier(.2,.6,.3,1) infinite; }
.viz--ripple .ring:nth-child(2) { animation-delay: 1.2s !important; }
.viz--ripple .ring:nth-child(3) { animation-delay: 2.4s !important; }
@keyframes ripple {
  0% { transform: translate(-50%, -50%) scale(.4); opacity: .9; }
  100% { transform: translate(-50%, -50%) scale(4.2); opacity: 0; }
}
.viz--ripple .core {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 24px 4px rgba(255,255,255,.35);
}
.viz--ripple .node {
  position: absolute; left: var(--x); top: var(--y);
  width: 26px; height: 26px; margin: -13px; border-radius: 8px;
  display: grid; place-items: center;
  background: #1b1b1b; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
  font: 600 9.5px/1 var(--mono); color: rgba(255,255,255,.75); letter-spacing: .02em;
}
.viz--ripple .node b { font-weight: 600; }
.is-in .viz--ripple .node { animation: glow 3.6s ease-in-out infinite; }
.viz--ripple .node:nth-of-type(5) { animation-delay: .5s !important; }
.viz--ripple .node:nth-of-type(6) { animation-delay: 1.1s !important; }
.viz--ripple .node:nth-of-type(7) { animation-delay: 1.7s !important; }
.viz--ripple .node:nth-of-type(8) { animation-delay: 2.3s !important; }
@keyframes glow {
  0%, 60%, 100% { box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); color: rgba(255,255,255,.7); }
  25% { box-shadow: inset 0 0 0 1px rgba(255,255,255,.6), 0 0 16px rgba(255,255,255,.18); color: #fff; }
}

/* 03 · funnel */
.viz--funnel { display: flex; flex-direction: column; justify-content: center; gap: 7px; padding: 0 12%; }
.viz--funnel .bar {
  position: relative; height: 17px; width: var(--w); border-radius: 4px;
  background: linear-gradient(90deg, rgba(255,255,255,.95), rgba(255,255,255,.55));
  transform-origin: left; transform: scaleX(0);
  transition: transform 1s var(--ease) var(--d);
}
.viz--funnel .bar span {
  position: absolute; left: 7px; top: 50%; transform: translateY(-50%);
  font: 600 9.5px/1 var(--mono); color: #0e0e0e; letter-spacing: .02em; text-transform: uppercase;
}
.is-in .viz--funnel .bar { transform: scaleX(1); }

/* 04 · terminal */
.viz--term { display: grid; place-items: center; padding: 9% 9% 0; }
.term {
  align-self: stretch; justify-self: stretch;
  border-radius: 8px 8px 0 0; background: #161616;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.09), 0 -10px 40px rgba(0,0,0,.4);
  overflow: hidden;
}
.term__bar { display: flex; align-items: center; gap: 5px; padding: 7px 9px; border-bottom: 1px solid rgba(255,255,255,.06); }
.term__bar i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.16); }
.term__bar span { margin-left: auto; font: 500 9px/1 var(--mono); color: rgba(255,255,255,.35); }
.term__body { padding: 9px 11px; font: 400 10.5px/1.7 var(--mono); color: rgba(255,255,255,.55); white-space: pre; }
.term__body .p { color: var(--accent); }
.term__body .c { color: #fff; }
.term__body .ok { color: #4ade80; }
.term__body .cursor { display: inline-block; width: 6px; height: 11px; background: #fff; vertical-align: -1px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ───────────── Experience ───────────── */
.xp + .xp { margin-top: 30px; }
.xp__company { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.xp__company > a:first-of-type { font-size: 16px; font-weight: 550; letter-spacing: -0.015em; }
.xp__logo { width: 24px; height: 24px; border-radius: 7px; font-size: 13px; transform: none; }
.xp__logo--e { font-size: 19px; }
.xp__now {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 11px/1 var(--mono); color: var(--text-2);
  padding: 4px 8px 4px 7px; border-radius: 999px; background: var(--chip);
}
.status__dot {
  position: relative; width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: none;
}
.status__dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--green);
  animation: ping 2.4s cubic-bezier(0, 0, .2, 1) infinite;
}
.xp__ext {
  margin-left: auto; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px;
  color: var(--text-3); transition: color .2s, background .2s;
}
.xp__ext:hover { color: var(--text); background: var(--chip); }
.xp__ext svg { width: 15px; height: 15px; }

.role { position: relative; padding-left: 34px; }
.role::before {
  content: ""; position: absolute; left: 11.5px; top: 9px; bottom: -4px; width: 1px;
  background: linear-gradient(var(--line-2), var(--line-2) 80%, transparent);
}
.role summary {
  position: relative; list-style: none; cursor: pointer;
  display: grid; grid-template-columns: 1fr auto; column-gap: 12px;
}
.role summary::-webkit-details-marker { display: none; }
.role summary::before {
  content: ""; position: absolute; left: -26px; top: 7px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--text-3);
  transition: background .2s, box-shadow .2s;
}
.role[open] summary::before { background: var(--text); box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--line-2); }
.role__title { font-size: 15.5px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.5; }
.role__meta, .role__tagline { grid-column: 1; font: 400 12.5px/1.6 var(--mono); color: var(--text-3); }
.role__meta i { display: inline-block; width: 1px; height: 10px; margin: 0 7px; background: var(--line-2); vertical-align: -1px; }
.role__tagline { color: var(--text-2); margin-top: 2px; }
.role__chev {
  grid-column: 2; grid-row: 1; width: 16px; height: 16px; margin-top: 4px; color: var(--text-3);
  transition: transform .35s var(--ease), color .2s;
}
.role summary:hover .role__chev { color: var(--text); }
.role[open] .role__chev { transform: rotate(180deg); }

.role::details-content {
  block-size: 0; overflow: hidden;
  transition: block-size .45s var(--ease), content-visibility .45s allow-discrete;
}
.role[open]::details-content { block-size: auto; }

.role__body { padding-top: 14px; }
.role__body ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.role__body li {
  position: relative; padding-left: 16px;
  font-size: 14.5px; line-height: 1.65; color: var(--text-2);
}
.role__body li::before {
  content: ""; position: absolute; left: 2px; top: .78em; width: 4px; height: 4px; border-radius: 50%;
  background: var(--text-3);
}
.role__body strong { color: var(--text); font-weight: 500; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; padding-bottom: 4px; }
.tags span {
  font: 400 11.5px/1 var(--mono); color: var(--text-2);
  padding: 5px 8px; border-radius: 6px; background: var(--chip);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ───────────── Chips ───────────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 11px 0 10px; border-radius: 8px;
  font: 400 12.5px/1 var(--mono); color: var(--text-2);
  background: var(--bg-elev); box-shadow: inset 0 0 0 1px var(--line), 0 1px 1px rgba(0,0,0,.02);
  transition: color .2s, box-shadow .2s, transform .2s var(--ease);
}
.chip i {
  width: 7px; height: 7px; border-radius: 2px; background: var(--c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent);
}
.chip:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2), 0 2px 6px rgba(0,0,0,.05); transform: translateY(-1px); }

/* ───────────── Education ───────────── */
.edu { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.edu li {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 10px; margin: 0 -10px; border-radius: 12px; transition: background .25s;
}
.edu li:hover { background: var(--chip); }
.edu__logo {
  width: 40px; height: 40px; border-radius: 10px; transform: none;
  font: italic 400 21px/1 var(--serif);
  background: var(--bg-elev); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgba(0,0,0,.04);
}
.edu__name { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
.edu__sub { font-size: 13.5px; color: var(--text-2); }
.edu__date { font: 400 12px/1 var(--mono); color: var(--text-3); white-space: nowrap; }

/* ───────────── Footer ───────────── */
.foot {
  margin-top: 72px; padding-top: 26px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font: 400 12.5px/1.6 var(--mono); color: var(--text-3);
}
.foot strong { color: var(--text-2); font-weight: 500; }
.foot .ul { font-weight: 400; color: var(--text-2); }
.foot i { display: inline-block; width: 1px; height: 10px; margin: 0 8px; background: var(--line-2); vertical-align: -1px; }

/* ───────────── Hover card ───────────── */
.hovercard {
  position: fixed; z-index: 60; width: 280px; padding: 14px;
  background: var(--bg-elev); border-radius: 14px;
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-lg);
  opacity: 0; transform: translateY(6px) scale(.97); transform-origin: top center;
  transition: opacity .2s, transform .25s var(--ease);
  pointer-events: none;
}
.hovercard.show { opacity: 1; transform: none; }
.hovercard__head { display: flex; align-items: center; gap: 10px; }
.hovercard__logo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #0d0d0d; color: #f2f2f2; font: 700 16px/1 var(--sans); }
.hovercard__logo.e { font: italic 400 24px/1 var(--serif); padding-bottom: 3px; }
.hovercard__name { display: block; font-size: 14px; font-weight: 550; }
.hovercard__url { display: block; font: 400 11.5px/1.4 var(--mono); color: var(--text-3); }
.hovercard__text { margin-top: 10px; font-size: 13px; line-height: 1.55; color: var(--text-2); }

/* ───────────── Toast ───────────── */
.toast {
  position: fixed; z-index: 70; left: 50%; bottom: 22px; width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 14px; border-radius: 12px;
  background: var(--bg-elev); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-lg);
  font-size: 13px;
  opacity: 0; transform: translate(-50%, 10px) scale(.98); filter: blur(4px);
  transition: opacity .35s var(--ease), transform .45s var(--ease), filter .35s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); filter: none; }

/* ───────────── Back to top ───────────── */
.totop {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-elev); color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .3s, transform .4s var(--ease), color .2s;
}
.totop.show { opacity: 1; transform: none; pointer-events: auto; }
.totop:hover { color: var(--text); }
.totop svg { width: 16px; height: 16px; }

/* ───────────── Command palette ───────────── */
.palette {
  width: min(560px, calc(100vw - 32px));
  margin: 14vh auto auto; padding: 0;
  border: 0; border-radius: 16px;
  background: var(--bg-elev); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line), 0 40px 80px -20px rgba(0,0,0,.4);
  overflow: hidden;
}
.palette[open] { animation: pop .28s var(--ease); }
.palette::backdrop { background: rgba(10,10,10,.28); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .2s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
.palette__search { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.palette__search > svg { width: 17px; height: 17px; color: var(--text-3); flex: none; }
.palette__search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text);
  font: 400 15px/1.4 var(--sans);
}
.palette__search input::placeholder { color: var(--text-3); }
.palette__list { list-style: none; margin: 0; padding: 6px; max-height: 340px; overflow-y: auto; }
.palette__group { padding: 10px 10px 6px; font: 400 11px/1 var(--mono); color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.palette__item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  font-size: 14px; color: var(--text-2); cursor: pointer;
}
.palette__item svg { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.palette__item .hint { margin-left: auto; font: 400 11.5px/1 var(--mono); color: var(--text-3); }
.palette__item[aria-selected="true"] { background: var(--chip); color: var(--text); }
.palette__item[aria-selected="true"] svg { color: var(--text); }
.palette__empty { padding: 26px 10px; text-align: center; color: var(--text-3); font-size: 14px; }
.palette__foot { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }
.palette__foot span { display: inline-flex; align-items: center; gap: 4px; }

/* ───────────── Reveal ───────────── */
.js [data-reveal] {
  opacity: 0; transform: translateY(10px); filter: blur(6px);
  transition: opacity .8s var(--ease), transform .8s var(--ease), filter .8s var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; filter: none; }

/* theme switch view transition */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ───────────── Responsive ───────────── */
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  body { font-size: 15px; }
  .hide-sm { display: none; }
  .nav__links { gap: 16px; }
  .page { padding-top: 24px; }
  .section { margin-top: 68px; }
  .cards { grid-template-columns: 1fr; gap: 24px; }
  .role { padding-left: 26px; }
  .role::before { left: 3.5px; }
  .xp__company { flex-wrap: wrap; row-gap: 6px; }
  .edu li { grid-template-columns: auto 1fr; }
  .edu__date { grid-column: 2; margin-top: -8px; }
  .foot { flex-direction: column; gap: 4px; }
  .totop { right: 16px; bottom: 16px; }
  .kbd-btn .kbd { display: none; }
  .kbd-btn { padding: 0 9px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
  .js [data-reveal] { filter: none; transform: none; }
}

.nowrap { white-space: nowrap; }

/* brand marks invert in dark mode so they don't disappear */
:root[data-theme="dark"] :is(.brand__mark, .xp__logo, .hovercard__logo) { background: #f2f2f0; color: #0d0d0d; box-shadow: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.brand__mark, .xp__logo, .hovercard__logo) { background: #f2f2f0; color: #0d0d0d; box-shadow: none; }
}

@media (max-width: 640px) {
  .toast { top: auto; bottom: 16px; left: 16px; right: 16px; width: auto; text-align: center; transform: translateY(8px) scale(.98); }
  .toast.show { transform: none; }
  .totop { bottom: 16px; }
}

/* ═════════════════════════════════════════════
   v2 — background, socials, widgets, reading
   ═════════════════════════════════════════════ */

/* ───────────── Background ───────────── */
.bgfx {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: -1; pointer-events: none;
}
.rails {
  position: fixed; top: 0; bottom: 0; left: 50%; z-index: -1; pointer-events: none;
  width: calc(var(--w) + var(--gutter) * 2 + 2px);
  transform: translateX(-50%);
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}
@media (max-width: 720px) { .rails { border: 0; } }

/* ───────────── Avatar photo ───────────── */
.avatar img { display: block; }

/* ───────────── Socials ───────────── */
.socials { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.social {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 13px 0 11px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500; color: var(--text-2);
  background: var(--bg-elev);
  box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgba(0,0,0,.04);
  transition: color .2s, box-shadow .2s, transform .25s var(--ease);
}
.social:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2), 0 4px 12px -4px rgba(0,0,0,.12); transform: translateY(-1px); }
.social:active { transform: translateY(0) scale(.98); }
.social svg { width: 15px; height: 15px; }
.social svg.fill { fill: currentColor; stroke: none; width: 13px; height: 13px; }

/* ───────────── Widgets ───────────── */
.widgets { display: grid; grid-template-columns: 1fr 168px 168px; gap: 12px; }
.widget {
  position: relative; height: 168px; overflow: hidden;
  border-radius: 22px;
  background: var(--bg-elev);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
}

/* music */
.widget--music { display: flex; align-items: center; gap: 14px; padding: 13px; }
.music__art {
  position: relative; flex: none; width: 140px; height: 140px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(135deg, #2a2a2a, #111);
  display: grid; place-items: center;
  box-shadow: 0 6px 16px -6px rgba(0,0,0,.35);
}
.music__art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.music__art-ph { width: 34px; height: 34px; fill: none; stroke: rgba(255,255,255,.35); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.widget--music.is-playing .music__art img { transform: scale(1.04); }
.music__meta { min-width: 0; flex: 1; }
.music__label {
  display: flex; align-items: center; gap: 6px;
  font: 500 10.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3);
}
.music__title { margin-top: 8px; font-size: 15.5px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.music__artist { font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music__play {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  height: 30px; padding: 0 13px 0 10px; border-radius: 999px;
  font-size: 13px; font-weight: 500; color: var(--text);
  background: var(--chip); box-shadow: inset 0 0 0 1px var(--line);
  transition: background .2s, transform .2s var(--ease);
}
.music__play:hover { background: var(--chip-hover); }
.music__play:active { transform: scale(.96); }
.music__play svg { width: 13px; height: 13px; fill: currentColor; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.music__play .i-pause { display: none; fill: none; stroke-width: 3; stroke-linecap: round; }
.is-playing .music__play .i-play { display: none; }
.is-playing .music__play .i-pause { display: block; }
.music__src {
  position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; color: var(--text-3); transition: color .2s, background .2s;
}
.music__src:hover { color: var(--text); background: var(--chip); }
.music__src svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.music__progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; opacity: 0; transition: opacity .3s; }
.music__progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.is-playing .music__progress { opacity: 1; }
.eq { display: none; align-items: flex-end; gap: 1.5px; height: 10px; }
.eq i { width: 2px; height: 100%; background: var(--accent); border-radius: 1px; transform-origin: bottom; animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; }
.eq i:nth-child(3) { animation-delay: -.6s; }
.eq i:nth-child(4) { animation-delay: -.15s; }
@keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
.is-playing .eq { display: inline-flex; }
.is-playing .music__label { color: var(--accent); }

/* clock */
.widget--clock { display: grid; place-items: center; }
.clock { width: 100%; height: 100%; }
.clock .tk { stroke: var(--text-3); stroke-width: .7; stroke-linecap: round; }
.clock .tk--h { stroke: var(--text); stroke-width: 1.6; }
.clock .num { fill: var(--text); font: 600 17px var(--sans); letter-spacing: -0.04em; }
.clock .hand { stroke: var(--text); stroke-linecap: round; }
.clock .hand--h { stroke-width: 4.2; }
.clock .hand--m { stroke-width: 3; }
.clock .hand--s { stroke: var(--accent); stroke-width: 1; }
.clock .pin { fill: var(--bg-elev); stroke: var(--accent); stroke-width: 1.4; }

/* ascii */
.widget--game { cursor: pointer; }
.widget--game canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.widget--game.is-playing { cursor: none; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), var(--shadow); }
.widget--game.is-playing canvas { touch-action: none; }
.widget--game:has(canvas:focus-visible) { box-shadow: inset 0 0 0 2px var(--text), var(--shadow); }

/* ───────────── Reading ───────────── */
.shelf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.book { display: block; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.book__stage {
  position: relative; aspect-ratio: 4 / 4.6;
  display: grid; place-items: center;
  border-radius: 18px;
  background:
    radial-gradient(90% 70% at 50% 30%, color-mix(in srgb, var(--bg-elev) 100%, transparent), transparent),
    var(--chip);
  box-shadow: inset 0 0 0 1px var(--line);
  perspective: 1100px;
  transition: background .3s;
}
.book:hover .book__stage { background: var(--chip-hover); }
.book__3d {
  position: relative; width: 56%; aspect-ratio: 2 / 3;
  container-type: inline-size;
  transform-style: preserve-3d;
  transition: transform .8s var(--ease);
}
.book__3d::after {
  content: ""; position: absolute; left: 6%; right: -8%; bottom: -9px; height: 14px;
  background: radial-gradient(closest-side, rgba(0,0,0,.32), transparent);
  filter: blur(3px); transform: translateZ(-2px);
  transition: transform .8s var(--ease), opacity .8s;
}
.book__pages {
  position: absolute; top: 1.5%; bottom: 1.5%; left: 1%; right: -3.5%;
  border-radius: 0 3px 3px 0;
  background:
    repeating-linear-gradient(90deg, #e9e4d8 0 1px, #f8f5ee 1px 2px) right / 6px 100% no-repeat,
    #f8f5ee;
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
  transform-style: preserve-3d;
}
.book__pages i {
  position: absolute; inset: 0 3px 0 0; border-radius: 0 3px 3px 0;
  transform-origin: left center;
  background:
    repeating-linear-gradient(180deg, transparent 0 7px, rgba(0,0,0,.07) 7px 8px) 14% 16% / 72% 62% no-repeat,
    linear-gradient(90deg, rgba(0,0,0,.08), transparent 12%),
    #fbf9f4;
  backface-visibility: hidden;
  transition: transform .9s cubic-bezier(.3,.7,.2,1);
}
.book__cover {
  position: absolute; inset: 0; transform-origin: left center; transform-style: preserve-3d;
  transition: transform .95s cubic-bezier(.25,.8,.2,1);
}
.book__front, .book__inside {
  position: absolute; inset: 0; overflow: hidden;
  border-radius: 2px 5px 5px 2px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.book__front {
  display: flex; flex-direction: column; padding: 13cqw 11cqw 11cqw 15cqw;
  box-shadow: 0 1px 1px rgba(0,0,0,.2), 0 6px 14px -6px rgba(0,0,0,.4);
}
.book__front::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,.32) 0, rgba(255,255,255,.22) 2.5%, rgba(0,0,0,.12) 5.5%, transparent 9%),
    linear-gradient(120deg, rgba(255,255,255,.2), transparent 38%);
}
.book__inside {
  transform: rotateY(180deg);
  background: linear-gradient(270deg, rgba(0,0,0,.1), transparent 10%), #efeae0;
  display: grid; place-items: center;
}
.book__inside span { font: 500 7cqw/1 var(--mono); color: #9a9486; letter-spacing: .04em; }

.book:hover .book__3d, .book:focus-visible .book__3d { transform: rotateY(-10deg) rotateX(3deg) translateY(-4px); }
.book:hover .book__cover, .book:focus-visible .book__cover { transform: rotateY(-24deg); }
.book:hover .book__pages i:first-child { transform: rotateY(-8deg); }

.book.is-open .book__3d { transform: translateX(42%) translateY(-2px) scale(.86); }
.book.is-open .book__3d::after { transform: translateZ(-2px) translateX(-48%) scaleX(2); opacity: .55; }
.book.is-open .book__cover { transform: rotateY(-168deg); }
.book.is-open .book__pages i:nth-child(1) { transform: rotateY(-160deg); transition-delay: .12s; }
.book.is-open .book__pages i:nth-child(2) { transform: rotateY(-150deg); transition-delay: .22s; }

.book__title { margin-top: 12px; font-size: 14px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.35; }
.book__author { font: 400 12px/1.5 var(--mono); color: var(--text-3); }

/* cover 1 · Hooked */
.book--1 .book__front { background: #ff5b1f; color: #fff; }
.b1__kicker { font: 500 5.4cqw/1.3 var(--mono); text-transform: uppercase; letter-spacing: .04em; opacity: .85; max-width: 80%; }
.b1__title { margin-top: 6cqw; font: italic 400 30cqw/.9 var(--serif); letter-spacing: -0.02em; }
.b1__hook { width: 20cqw; margin: 6cqw 0 0 34cqw; fill: none; stroke: #fff; stroke-width: 3.5; stroke-linecap: round; }
.b1__author { margin-top: auto; font: 600 6cqw/1 var(--mono); text-transform: uppercase; letter-spacing: .12em; }

/* cover 2 · Contagious */
.book--2 .book__front { background: #0f2e24; color: #d9f99d; }
.b2__rings { position: absolute; right: -26cqw; bottom: -26cqw; width: 90cqw; aspect-ratio: 1; }
.b2__rings i { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(217,249,157,.35); }
.b2__rings i:nth-child(2) { inset: 18%; border-color: rgba(217,249,157,.5); }
.b2__rings i:nth-child(3) { inset: 38%; background: #d9f99d; border: 0; }
.b2__title { position: relative; font: 700 17cqw/.88 var(--sans); text-transform: uppercase; letter-spacing: -0.04em; }
.b2__kicker { position: relative; margin-top: 6cqw; font: italic 400 10cqw/1.05 var(--serif); color: #f0fdf4; }
.b2__author { position: relative; margin-top: auto; font: 600 5.6cqw/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; }

/* cover 3 · Obviously Awesome */
.book--3 .book__front { background: #ece6d8; color: #141414; }
.b3__title { font: 750 15.5cqw/.92 var(--sans); letter-spacing: -0.05em; }
.b3__sticker {
  align-self: flex-start; margin-top: 9cqw; padding: 3.5cqw 4.5cqw; border-radius: 3cqw;
  background: #141414; color: #ece6d8; font: 500 5.2cqw/1.3 var(--mono); text-transform: uppercase; letter-spacing: .03em;
  transform: rotate(-4deg); max-width: 78%;
}
.b3__author { margin-top: auto; font: 600 5.6cqw/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; }

/* ───────────── Responsive v2 ───────────── */
@media (max-width: 640px) {
  .widgets { grid-template-columns: 1fr 1fr; }
  .widget--music { grid-column: 1 / -1; }
  .widget--clock, .widget--game { height: auto; aspect-ratio: 1; }
  .shelf { gap: 8px; }
  .book__stage { border-radius: 14px; }
  .book__3d { width: 68%; }
  .book__title { font-size: 13px; }
  .book__author { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .book.is-open .book__cover { transform: rotateY(-24deg); }
}

/* mid widths: keep the widget row from squeezing the music card */
.music__label { padding-right: 26px; white-space: nowrap; }
@media (min-width: 641px) and (max-width: 820px) {
  .widgets { grid-template-columns: 1fr 150px 150px; }
  .widget { height: 150px; }
  .music__art { width: 122px; height: 122px; }
  .music__src { display: none; }
  .music__label { padding-right: 0; }
}

/* ═════════════════════════════════════════════
   v3: clickable work cards, work window, cursor
   ═════════════════════════════════════════════ */

/* section head + hint */
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.section__head .section__title { margin-bottom: 0; }
.section__hint { display: inline-flex; align-items: center; gap: 7px; font: 400 12.5px/1 var(--mono); color: var(--text-3); }
.section__hint-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); animation: hintPulse 2s ease-in-out infinite; }
@keyframes hintPulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 0%, transparent); } }

/* cards as buttons */
.cards { align-items: stretch; }
.card { cursor: pointer; display: flex; flex-direction: column; outline: none; }
.card .card__body { flex: 1; }
.card__frame { transition: transform .5s var(--ease); }
.card:hover .card__frame { transform: scale(1.015); }
.card:focus-visible { border-color: var(--text); border-style: solid; }
.card__title .card__name { flex: 1; min-width: 0; }
.card__count { flex: none; font: 400 11.5px/1 var(--mono); font-weight: 400; color: var(--text-3); letter-spacing: 0; }

/* big section heading */
.section__title--big {
  font-size: 32px; font-weight: 550; color: var(--text);
  letter-spacing: -0.04em; line-height: 1.1;
}
.section__title--big em { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.12em; letter-spacing: -0.01em; }
.section__head { align-items: flex-end; margin-bottom: 26px; }
.section__hint { padding-bottom: 5px; }
@media (max-width: 640px) { .section__title--big { font-size: 27px; } }

/* ───────────── Work window (styled like the cards) ───────────── */
html:has(.win[open]) { overflow: hidden; }
.win {
  width: min(760px, calc(100vw - 40px));
  max-width: none; max-height: none;
  margin: auto; padding: 0; border: 0;
  background: transparent; color: var(--text);
  overflow: visible;
  transform-origin: top left;
}
.win[open] { display: block; }
.win::backdrop {
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.win__panel {
  position: relative; display: flex; flex-direction: column;
  max-height: min(86vh, 880px);
  padding: 7px;
  background: var(--bg);
  border: 1px dashed var(--line-2);
  box-shadow: 0 50px 90px -40px rgba(0,0,0,.35);
}
.win .corner { border-color: var(--text); }
.win__bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 2px 9px 6px; }
.win__title { min-width: 0; font: 400 12px/1 var(--mono); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win__title b { font-weight: 500; color: var(--text); }
.win__nav { flex: none; display: flex; align-items: center; gap: 2px; }
.win__nav button {
  width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--text-2);
  transition: background .2s, color .2s;
}
.win__nav button:hover { background: var(--chip); color: var(--text); }
.win__nav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.win__sep { width: 1px; height: 14px; margin: 0 4px; background: var(--line-2); }

.win__body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.win__hero { position: relative; height: 230px; overflow: hidden; border-radius: 3px; background: var(--frame); }
.win__hero .card__frame { position: absolute; inset: 0; aspect-ratio: auto; height: 100%; transform: none !important; }
.win__content { padding: 22px 8px 12px; }
.win__kicker { display: flex; align-items: baseline; gap: 8px; font: 400 12px/1 var(--mono); color: var(--text-3); }
.win__h { margin-top: 10px; font-size: 30px; font-weight: 550; letter-spacing: -0.035em; line-height: 1.12; }
.win__lede { margin-top: 10px; font-size: 15.5px; line-height: 1.6; color: var(--text-2); max-width: 58ch; }
.win__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; }
.wstat { padding: 12px 14px; border: 1px dashed var(--line-2); }
.wstat__v { font-size: 22px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.2; }
.wstat__l { margin-top: 4px; font: 400 11.5px/1.45 var(--mono); color: var(--text-3); }

.win__list { list-style: none; margin: 22px 0 0; padding: 0; border-top: 1px dashed var(--line-2); }
.witem {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 14px; align-items: start;
  padding: 18px 0; border-bottom: 1px dashed var(--line-2);
  animation: witemIn .55s var(--ease) both; animation-delay: calc(120ms + var(--i, 0) * 55ms);
}
.win__list li:last-child .witem { border-bottom: 0; }
@keyframes witemIn { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } }
a.witem { transition: background .2s; }
a.witem:hover { background: var(--chip); }
.witem__logo {
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  background: #0d0d0d; color: #f2f2f2; font: 700 14px/1 var(--sans);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.witem__logo.e { font: italic 400 20px/1 var(--serif); padding-bottom: 2px; }
:root[data-theme="dark"] .witem__logo { background: #f2f2f0; color: #0d0d0d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .witem__logo { background: #f2f2f0; color: #0d0d0d; } }
.witem__head { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; }
.witem__title { font-size: 16px; font-weight: 550; letter-spacing: -0.015em; line-height: 1.35; }
.witem__when { font: 400 11.5px/1.4 var(--mono); color: var(--text-3); }
.witem__text { margin-top: 5px; font-size: 14.5px; line-height: 1.6; color: var(--text-2); }
.witem__tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.witem__tags span { font: 400 11px/1 var(--mono); color: var(--text-2); padding: 5px 7px; border-radius: 4px; background: var(--chip); box-shadow: inset 0 0 0 1px var(--line); }
.witem__result {
  max-width: 180px; justify-self: end;
  display: inline-flex; align-items: flex-start; gap: 5px;
  padding: 6px 9px; border-radius: 4px;
  font: 500 12px/1.35 var(--mono); color: #e8551c;
  background: color-mix(in srgb, #ff5b1f 9%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #ff5b1f 22%, transparent);
}
.witem__result svg { flex: none; width: 13px; height: 13px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.witem__ext { width: 14px; height: 14px; color: var(--text-3); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 640px) {
  .section__head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .win { width: calc(100vw - 24px); }
  .win__panel { max-height: 88vh; }
  .win__hero { height: 150px; }
  .win__content { padding: 18px 4px 8px; }
  .win__h { font-size: 24px; }
  .win__stats { grid-template-columns: 1fr 1fr; }
  .witem { grid-template-columns: 30px 1fr; }
  .witem__result { grid-column: 2; justify-self: start; max-width: none; }
}

/* ───────────── Custom cursor ───────────── */
html.has-cursor, html.has-cursor * { cursor: none !important; }
html.has-cursor input, html.has-cursor textarea { cursor: text !important; }
.cursor, .cursor[popover] {
  position: fixed; inset: 0 auto auto 0; margin: 0; padding: 0; border: 0;
  width: 0; height: 0; overflow: visible; background: transparent; color: inherit;
  pointer-events: none; z-index: 2147483647;
  opacity: 0; transition: opacity .2s;
  will-change: transform;
}
html.has-cursor .cursor { opacity: 1; }
html.has-cursor .cursor.is-hidden, html.has-cursor .cursor.is-out { opacity: 0; }
.cursor svg {
  position: absolute; left: -4.4px; top: -3.5px; width: 28px; height: 28px; overflow: visible;
  transform-origin: 4.4px 3.5px;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.22)) drop-shadow(0 1px 1px rgba(0,0,0,.15));
  transition: transform .22s var(--ease);
}
.cursor path { fill: #0b0b0b; stroke: #fff; stroke-width: 4.2; stroke-linejoin: round; paint-order: stroke; }
.cursor.is-link svg { transform: scale(.92) rotate(-6deg); }
.cursor.has-label svg { transform: scale(.88); }
.cursor.is-down svg { transform: scale(.78); }
.cursor__label {
  position: absolute; left: 20px; top: 22px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px;
  background: #0b0b0b; color: #fff; font: 500 12.5px/1 var(--sans); letter-spacing: -0.005em;
  box-shadow: 0 0 0 2px #fff, 0 8px 20px -6px rgba(0,0,0,.4);
  transform: scale(.4); transform-origin: 0 0; opacity: 0;
  transition: transform .28s var(--ease), opacity .18s;
}
.cursor.has-label .cursor__label { transform: none; opacity: 1; }
@media (max-width: 640px) { .wstat:last-child:nth-child(odd) { grid-column: 1 / -1; } }
