/* ==========================================================================
   nahidhtamim.com - portfolio stylesheet
   The site is a two-page book: a static dark left page (profile) and a
   right page that holds the chapters. Desktop turns pages with a 3D
   paper-slice animation; <=900px collapses into a stacked mobile edition.

   CONTENTS
   01. Design tokens          - colour / spacing variables on :root
   02. Base / reset           - element defaults
   03. Backdrop               - blurred room photo, window light, grain
   04. Sidenav                - slim icon rail (desktop) / app bar (mobile)
   05. Theme                  - light default, dark overrides, toggles
   06. Stage & book           - the book shell, spine, page-edge stack
   07. Left page              - cover photo, signature, identity, CTAs
   08. Right page             - chapter layout + every chapter component
   09. Turning sheet          - the 6 hinged slices that animate the flip
   10. Paper scope            - variables for everything printed on paper
   11. Book-native pass       - serif, ruled, printed treatments
   12. Dark-mode overrides    - components outside the .paper var scope
   13. Edge tabs              - thumb-index tabs on the fore-edge
   14. Mobile edition         - the <=900px layout
   15. Reduced motion         - transitions off when the user asks
   16. Cursor                 - custom pointer drawn by js/effects.js
   ========================================================================== */

/* ==========================================================================
   01. DESIGN TOKENS
   ========================================================================== */
:root {
  --bg: #14120e;
  --paper: #fdfcf8;
  --paper-ink: #1e2420;
  /* greens unified to the logo's forest green - base #254230 sampled from assets/logo.png;
     dark #1a2e22, mid #3e6b4f, soft #7fb08d, pale #a9cdb2 are shades of the same hue */
  --sage: #254230;
  --sage-deep: #1a2e22;
  --grain-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  --glass: rgba(255, 255, 255, 0.04);
  --glass-card: rgba(255, 255, 255, 0.05);
  --stroke: rgba(255, 255, 255, 0.08);
  --ink: #f2f5f3;
  --body: rgba(238, 243, 241, 0.82);
  --muted: rgba(226, 234, 231, 0.58);
  --accent: #7fb08d;
  --accent-deep: #679a76;
  --grad: linear-gradient(90deg, #679a76, #7fb08d);
  --gold: #f5b942;
  --green: #4c9468;
  --leftw: 37%;
  --radius: 20px;
}

/* ==========================================================================
   02. BASE / RESET
   ========================================================================== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  background: radial-gradient(120% 90% at 28% 10%, #36322b 0%, #221f19 48%, #12100c 100%);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(127, 176, 141, 0.35); }
button { font-family: inherit; }
a { color: var(--accent); }

/* ==========================================================================
   03. BACKDROP - warm charcoal, window light, faint room silhouette
   ========================================================================== */
.backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.backdrop-img {
  position: absolute; inset: -46px;
  background: url("../assets/cover.jpg") center 32% / cover no-repeat;
  filter: blur(26px) brightness(0.32) saturate(0.3);
  opacity: 0.55;
}
.backdrop::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(58% 48% at 16% 4%, rgba(255, 240, 205, 0.1), rgba(255, 240, 205, 0) 70%);
}
.backdrop::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(115% 92% at 50% 42%, rgba(0, 0, 0, 0) 42%, rgba(6, 5, 3, 0.6) 100%);
}
.backdrop-grain { position: absolute; inset: 0; opacity: 0.07; background-image: var(--grain-img); }

/* ==========================================================================
   04. SIDENAV - slim icon rail on the left (becomes the app bar on mobile)
   ========================================================================== */
.sidenav {
  position: fixed; left: 18px; top: 50%; transform: translateY(-50%);
  width: 66px; z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 0;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
}
.logo {
  width: 42px; height: 42px; border-radius: 11px; margin-bottom: 10px;
  display: block; object-fit: cover;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}
.nav-btn {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid transparent;
  color: var(--muted); cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.nav-btn svg { width: 21px; height: 21px; }
.nav-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.nav-btn.active { color: var(--accent); background: rgba(127, 176, 141, 0.13); border-color: rgba(127, 176, 141, 0.35); }
.nav-btn:focus-visible, .tab:focus-visible, .arrow-btn:focus-visible,
.btn:focus-visible, .soc:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ==========================================================================
   05. THEME - light is the default look; dark is a deep-ink book
   ========================================================================== */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] body {
  background: radial-gradient(120% 90% at 28% 10%, #252a26 0%, #141716 48%, #070807 100%);
}
html[data-theme="dark"] .backdrop-img { filter: blur(26px) brightness(0.15) saturate(0.2); opacity: 0.5; }
html[data-theme="dark"] .backdrop::before {
  background: radial-gradient(58% 48% at 16% 4%, rgba(205, 224, 255, 0.05), rgba(205, 224, 255, 0) 70%);
}
html[data-theme="dark"] .backdrop::after {
  background: radial-gradient(115% 92% at 50% 42%, rgba(0, 0, 0, 0) 40%, rgba(2, 3, 2, 0.72) 100%);
}
html[data-theme="dark"] .page-left {
  background: linear-gradient(180deg, #0e120f 0%, #080a08 55%, #050605 100%);
}
html[data-theme="dark"] .page-right {
  background: linear-gradient(103deg, #151917 0%, #1e2422 34%, #1b201d 72%, #131613 100%);
}
/* --- Theme toggle (in the sidenav) --- */
.theme-btn {
  height: auto; margin-top: 10px; padding: 8px 0 7px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border-top: 1px solid var(--stroke); border-radius: 0 0 14px 14px;
}
.theme-btn svg { width: 19px; height: 19px; }
.theme-btn .ic-moon { display: none; }
html[data-theme="dark"] .theme-btn .ic-sun { display: none; }
html[data-theme="dark"] .theme-btn .ic-moon { display: block; }
.theme-label { font-size: 8.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; line-height: 1; }
/* --- Sound toggle (in the sidenav, styled like the theme toggle) --- */
.sound-btn {
  height: auto; margin-top: 10px; padding: 8px 0 7px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border-top: 1px solid var(--stroke);
}
.sound-btn svg { width: 19px; height: 19px; }
.sound-btn .ic-vol-off { display: none; }
.sound-btn.off .ic-vol-on { display: none; }
.sound-btn.off .ic-vol-off { display: block; }
.sound-label { font-size: 8.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; line-height: 1; }

/* ==========================================================================
   06. STAGE & BOOK - the book shell that both pages sit in
   ========================================================================== */
.stage {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px 52px 22px 118px;
}
.book {
  position: relative; display: flex;
  width: min(1180px, 100%);
  height: min(780px, calc(100vh - 110px)); min-height: 580px;
  background: #171410;
  border: 1px solid rgba(240, 232, 205, 0.14);
  border-radius: var(--radius);
  box-shadow: 0 44px 90px rgba(0, 0, 0, 0.6), 0 6px 22px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  perspective: 2400px;
}
/* stacked page edges on the outer right: kept on the page's own fore-edge,
   behind the page/tabs stack, so no striped dashes show in the tab gaps */
.book::after {
  content: ""; position: absolute; top: 12px; bottom: 12px; right: 0; width: 7px;
  border-radius: 0 4px 4px 0;
  background: repeating-linear-gradient(90deg, rgba(243, 236, 218, 0.55) 0 1px, rgba(243, 236, 218, 0.14) 1px 3px);
  pointer-events: none;
}
.spine {
  flex: none; width: 2px; position: relative; z-index: 3;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.16) 18%, rgba(255, 255, 255, 0.16) 82%, transparent);
}

/* ==========================================================================
   07. LEFT PAGE - static profile page
   ========================================================================== */
.page-left {
  width: var(--leftw); flex: none; position: relative;
  padding: 0;
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  background: linear-gradient(180deg, #14170f 0%, #0d0f0b 55%, #0a0c09 100%);
  border-radius: var(--radius) 0 0 var(--radius);
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.page-left::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 52px; z-index: 5;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.42));
  pointer-events: none;
}
/* --- Cover photo, chapter indicator, cursive signature --- */
.photo-hero { position: relative; flex: none; height: 344px; overflow: hidden; }
.photo-hero img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 0%;
  display: block;
}
.photo-hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(13, 15, 11, 0) 50%, rgba(13, 15, 11, 0.35) 76%, #0e100c 99%);
  pointer-events: none;
}
.photo-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; justify-content: flex-end; align-items: flex-start;
  padding: 12px 20px; color: #f2efe2;
  text-shadow: 0 1px 9px rgba(0, 0, 0, 0.55);
}
.pt-chapter { text-align: right; font-size: 10.5px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; line-height: 1.45; }
.pt-chapter span { display: block; }
.pt-chapter .pt-name { font-size: 12.5px; font-weight: 500; letter-spacing: 0.03em; text-transform: none; }
.signature {
  position: absolute; left: 22px; right: 16px; bottom: 6px; z-index: 3;
  font-family: "Great Vibes", "Segoe Script", cursive;
  font-size: 33px; line-height: 1; color: #fff; white-space: nowrap;
  transform: rotate(-4deg);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
/* --- Identity, mini stats, CTA buttons, social links --- */
.left-body { padding: 4px 30px 24px; display: flex; flex-direction: column; flex: 1; position: relative; z-index: 2; }
.identity { margin-top: 14px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}
.identity .role { margin: 8px 0 0; font-size: 13.5px; font-weight: 600; color: #dde6df; }
.tagline { margin: 13px 0 0; font-size: 13.5px; line-height: 1.68; color: var(--body); }
.identity .loc { margin: 13px 0 0; font-size: 13px; color: #cfd8d2; display: flex; align-items: center; gap: 6px; }
.identity .loc svg { width: 15px; height: 15px; color: #7fb08d; flex: none; }
.mini-stats { display: flex; margin-top: 20px; }
.mini-stats > div { flex: 1; padding: 0 9px; }
.mini-stats > div:first-child { padding-left: 0; }
.mini-stats > div + div { border-left: 1px dotted rgba(255, 255, 255, 0.3); }
.mini-stats b { display: block; font-size: 19px; font-weight: 900; line-height: 1.1; color: #fff; }
.mini-stats span { display: block; margin-top: 4px; font-size: 9px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); line-height: 1.5; }
.cta-row { display: flex; gap: 10px; margin-top: 20px; }
.btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 10px; border-radius: 12px; font-size: 13.5px; font-weight: 700;
  cursor: pointer; text-decoration: none; transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
  border: 1px solid transparent; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: linear-gradient(180deg, #2f5240, #254230); color: #fff; box-shadow: 0 10px 24px rgba(37, 66, 48, 0.45); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(37, 66, 48, 0.55); }
.btn-ghost { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.32); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }
.socials { display: flex; gap: 10px; margin-top: 18px; }
.soc {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e8ede9; text-decoration: none;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.soc svg { width: 17px; height: 17px; }
.soc:hover { background: rgba(127, 176, 141, 0.18); border-color: rgba(127, 176, 141, 0.5); transform: translateY(-2px); }

/* ==========================================================================
   08. RIGHT PAGE - the chapters
   ========================================================================== */
.page-right {
  flex: 1; position: relative; z-index: 8; display: flex; flex-direction: column; min-width: 0;
  background: linear-gradient(103deg, #f7f4ec 0%, #fefdf9 34%, #fdfcf8 72%, #f8f5ec 100%);
  color: var(--paper-ink);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.page-right::before {
  content: ""; position: absolute; top: 0; left: 0; bottom: 0; width: 56px; z-index: 2;
  background: linear-gradient(90deg, rgba(59, 48, 25, 0.14), rgba(59, 48, 25, 0.03) 55%, transparent);
  pointer-events: none;
}
.paper-grain {
  position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0.03;
  background-image: var(--grain-img);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.page-base {
  flex: 1; position: relative; z-index: 1;
  overflow-y: auto; overflow-x: hidden;
  padding: 28px 40px 20px;
  scrollbar-width: thin; scrollbar-color: rgba(120, 115, 95, 0.45) transparent;
  transition: opacity 0.16s ease;
}
.page-base::-webkit-scrollbar, .page-left::-webkit-scrollbar { width: 5px; }
.page-base::-webkit-scrollbar-thumb, .page-left::-webkit-scrollbar-thumb { background: rgba(140, 140, 140, 0.4); border-radius: 3px; }
/* --- Chapter header: label, title, rule, body copy --- */
.chapter { display: none; }
.chapter.active { display: block; }
.ch-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.3em; text-transform: uppercase; color: var(--accent); margin: 0; }
.ch-title {
  font-size: 34px; font-weight: 900; letter-spacing: -0.01em; line-height: 1.12;
  margin: 8px 0 0;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ch-rule { width: 58px; height: 3px; border-radius: 2px; background: var(--grad); margin: 14px 0 20px; }
.chapter p { font-size: 14.5px; line-height: 1.78; color: var(--body); margin: 0 0 14px; }
.dropcap::first-letter {
  font-size: 54px; font-weight: 900; float: left; line-height: 0.82;
  padding: 7px 11px 0 0; color: var(--accent);
}
.chapter h3.sub { font-size: 16px; font-weight: 700; margin: 26px 0 12px; color: var(--ink); }

/* --- About: stats --- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(98px, 1fr)); gap: 10px; margin: 20px 0 4px; }
.stat {
  background: var(--glass-card); border: 1px solid var(--stroke); border-radius: 14px;
  padding: 14px 8px 12px; text-align: center;
}
.stat b {
  display: block; font-size: 22px; font-weight: 900; line-height: 1.1;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat span { display: block; margin-top: 4px; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); line-height: 1.45; }

/* --- About: what-I-do grid --- */
.do-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.do-card { background: var(--glass-card); border: 1px solid var(--stroke); border-radius: 14px; padding: 16px; }
.do-card .ic {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: rgba(37, 66, 48, 0.12); border: 1px solid rgba(37, 66, 48, 0.3); color: var(--accent);
  margin-bottom: 10px;
}
.do-card .ic svg { width: 20px; height: 20px; }
.do-card h4 { margin: 0 0 5px; font-size: 15px; font-weight: 700; }
.do-card p { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }

/* --- Timeline (shared by Experience and Education) --- */
.tl { position: relative; padding-left: 24px; }
.tl::before {
  content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(180deg, rgba(37, 66, 48, 0.55), rgba(37, 66, 48, 0.08));
  border-radius: 2px;
}
.tl-item { position: relative; padding-bottom: 24px; }
.tl-item:last-child { padding-bottom: 4px; }
.tl-item::before {
  content: ""; position: absolute; left: -24px; top: 5px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--bg); border: 2.5px solid var(--accent);
}
.tl-dates { font-size: 11.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin: 0 0 3px; }
.tl-role { font-size: 16.5px; font-weight: 700; margin: 0; }
.tl-org { font-size: 13.5px; color: var(--muted); margin: 2px 0 0; }
.tl-item .tl-org { line-height: 1.5; }
.tl-item ul { margin: 9px 0 0; padding-left: 17px; }
.tl-item li { font-size: 13.5px; line-height: 1.65; color: var(--body); margin-bottom: 3px; }
.note-card { background: var(--glass-card); border: 1px solid var(--stroke); border-radius: 14px; padding: 16px 18px; margin-top: 6px; }
.note-card h4 { margin: 0 0 9px; font-size: 15px; font-weight: 700; }
.note-card ul { margin: 0; padding-left: 17px; }
.note-card li { font-size: 13.5px; line-height: 1.7; color: var(--body); }

/* --- Experience: role + right-aligned date pill, numbered cards --- */
.tl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; }
.tl-date {
  flex: none; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; white-space: nowrap;
  color: var(--accent-deep); background: rgba(37, 66, 48, 0.12);
  border: 1px solid rgba(37, 66, 48, 0.32); border-radius: 999px; padding: 3px 10px;
}
.tl-org b { font-weight: 700; color: var(--ink); }
.paper h3.sub { display: flex; align-items: center; gap: 12px; }
.paper h3.sub::after { content: ""; flex: 1; height: 1px; background: var(--stroke); }
.num-list { display: flex; flex-direction: column; gap: 10px; }
.num-card {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--glass-card); border: 1px solid var(--stroke); border-radius: 14px;
  padding: 14px 16px;
}
.num-card .num { flex: none; min-width: 30px; font-size: 20px; font-weight: 900; line-height: 1.15; color: var(--accent); opacity: 0.7; }
.num-card h4 { margin: 0 0 4px; font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.num-card p { margin: 0; font-size: 13px; line-height: 1.65; color: var(--muted); }
.badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; white-space: nowrap;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(37, 66, 48, 0.16); border: 1px solid rgba(37, 66, 48, 0.42); color: var(--accent-deep);
}

/* --- Skills --- */
.skill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.skill-group { background: var(--glass-card); border: 1px solid var(--stroke); border-radius: 14px; padding: 16px; }
.skill-group h4 { margin: 0 0 11px; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.skill-group h4 svg { width: 17px; height: 17px; color: var(--accent); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--stroke); color: var(--body);
}

/* --- Projects: image glance cards, hover reveals the details --- */
.proj-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.proj-filter {
  padding: 7px 15px; border-radius: 999px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em; cursor: pointer;
  background: transparent; border: 1px solid var(--stroke); color: var(--muted);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.proj-filter:hover { color: var(--ink); border-color: rgba(37, 66, 48, 0.55); }
.proj-filter.active { background: var(--sage); border-color: transparent; color: #f4f1e6; }
.proj-filter:focus-visible, .proj-btn:focus-visible, .lb-close:focus-visible {
  outline: 2px solid #254230; outline-offset: 2px;
}
.proj-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.proj {
  display: flex; flex-direction: column;
  background: var(--proj-bg, #fffdf6); border: 1px solid var(--stroke); border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(43, 36, 18, 0.1);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.proj:hover { transform: translateY(-3px); box-shadow: 0 14px 28px rgba(43, 36, 18, 0.18); }
.proj.hide { display: none; }
.proj-media { position: relative; aspect-ratio: 3 / 2; overflow: hidden; background: #f0ede2; cursor: pointer; }
.proj-media img {
  width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block;
  transition: transform 0.45s ease;
}
.proj:hover .proj-media img, .proj:focus-within .proj-media img { transform: scale(1.04); }
.proj-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 3px;
  padding: 15px 16px;
  background: linear-gradient(180deg, rgba(24, 30, 27, 0.34) 0%, rgba(24, 30, 27, 0.72) 52%, rgba(18, 23, 20, 0.9) 100%);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  color: #f2f5f1;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.proj:hover .proj-overlay, .proj:focus-within .proj-overlay, .proj.revealed .proj-overlay {
  opacity: 1; transform: translateY(0);
}
.proj-cat { font-size: 10px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: #a9cdb2; margin: 0; }
.proj-overlay h4 { font-size: 17px; font-weight: 800; line-height: 1.25; margin: 0; }
.proj-overlay .proj-type { font-size: 12.5px; line-height: 1.5; color: rgba(242, 245, 241, 0.86); margin: 0 0 9px; }
.proj-btn {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--sage); border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f4f8f5; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer; text-decoration: none;
  transition: background 0.2s;
}
.proj-btn:hover { background: #3e6b4f; }
.proj-btn svg { width: 14px; height: 14px; }
.proj-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; margin-top: auto;
}
.proj-name { font-size: 14px; font-weight: 800; line-height: 1.3; color: var(--proj-ink, #1e2420); }
.proj-tags { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
.proj-tag {
  padding: 3px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 600;
  background: rgba(37, 66, 48, 0.12); border: 1px solid rgba(37, 66, 48, 0.35); color: var(--sage-deep);
  white-space: nowrap;
}

/* --- Projects: preview lightbox --- */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 22px;
  background: rgba(16, 14, 9, 0.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.lightbox.open { display: flex; }
.lb-card {
  position: relative; width: min(680px, 100%); max-height: calc(100vh - 60px); overflow-y: auto;
  background: #fefdf9; color: #1e2420;
  border: 1px solid rgba(31, 38, 34, 0.16); border-radius: 16px;
  box-shadow: 0 34px 80px rgba(0, 0, 0, 0.5);
}
.lb-card > img { width: 100%; display: block; border-radius: 16px 16px 0 0; }
.lb-body { padding: 20px 24px 24px; }
.lb-body .proj-cat { color: #254230; }
.lb-body h3 { font-size: 22px; font-weight: 900; margin: 4px 0 8px; }
.lb-body p.lb-desc { font-size: 14px; line-height: 1.7; color: rgba(31, 38, 34, 0.82); margin: 0 0 14px; }
.lb-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.lb-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(253, 250, 241, 0.94); border: 1px solid rgba(31, 38, 34, 0.2);
  color: #1e2420; cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.lb-close svg { width: 16px; height: 16px; }

/* --- Reviews: 3-card slider --- */
.ref-slider { position: relative; }
.ref-stage { position: relative; margin: 0 28px; }
.ref-viewport { overflow: hidden; touch-action: pan-y; }
.ref-track {
  display: flex; gap: 12px;
  transition: transform 0.55s cubic-bezier(0.25, 0.9, 0.3, 1);
  will-change: transform;
}
.ref-track.dragging { transition: none; }
.ref {
  flex: 0 0 calc((100% - 24px) / 3);
  display: flex; flex-direction: column;
  background: var(--glass-card); border: 1px solid var(--stroke); border-radius: 14px; padding: 15px;
}
.ref-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 6;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 253, 246, 0.94); border: 1px solid rgba(37, 66, 48, 0.45);
  color: #1a2e22; cursor: pointer;
  box-shadow: 0 6px 16px rgba(43, 36, 18, 0.22);
  transition: background 0.2s, opacity 0.2s;
}
.ref-arrow svg { width: 17px; height: 17px; }
.ref-arrow:hover:not(:disabled) { background: #fffdf6; }
.ref-arrow:disabled { opacity: 0.3; cursor: default; box-shadow: none; }
.ref-arrow.prev { left: -28px; }
.ref-arrow.next { right: -28px; }
.ref-arrow:focus-visible, .ref-dot:focus-visible, .ref-more:focus-visible {
  outline: 2px solid #254230; outline-offset: 2px;
}
.ref-dots { display: flex; gap: 7px; justify-content: center; margin-top: 15px; }
.ref-dot {
  width: 8px; height: 8px; padding: 0; border: none; border-radius: 999px;
  background: rgba(31, 38, 34, 0.25); cursor: pointer;
  transition: width 0.3s, background 0.3s;
}
.ref-dot.active { width: 24px; background: #254230; }
.ref blockquote.clamped {
  display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
  /* hard cap at exactly 9 lines (9 x line-height 1.65) so the cut is
     clean: no half-height or faded ghost line of hidden text can peek
     below the ellipsis, and no fade or mask is applied */
  max-height: 14.85em;
  -webkit-mask-image: none; mask-image: none;
}
.ref-more[hidden] { display: none !important; }
.ref-more {
  align-self: flex-start; margin-top: 9px; padding: 0;
  background: none; border: none; cursor: pointer;
  font-size: 12px; font-weight: 700; color: #254230;
}
.ref-more:hover { text-decoration: underline; }
.stars { display: flex; gap: 2px; color: var(--gold); margin-bottom: 10px; }
.stars svg { width: 15px; height: 15px; }
.ref blockquote { margin: 0; flex: 1; font-size: 13px; line-height: 1.65; font-style: italic; color: var(--body); }
.ref .who { font-size: 13px; font-weight: 700; margin: 12px 0 0; padding-right: 24px; }
.ref .meta { font-size: 12px; color: var(--muted); margin: 2px 0 0; padding-right: 24px; }

/* --- Contact: ledger rows + message form --- */
.contact-rows { display: flex; flex-direction: column; gap: 9px; margin-bottom: 22px; }
.crow {
  display: flex; align-items: center; gap: 12px;
  background: var(--glass-card); border: 1px solid var(--stroke); border-radius: 12px;
  padding: 11px 14px; text-decoration: none; color: var(--ink);
  transition: border-color 0.2s, background 0.2s;
}
.crow:hover { border-color: rgba(37, 66, 48, 0.4); background: rgba(255, 255, 255, 0.07); }
.crow .ic { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; background: rgba(37, 66, 48, 0.12); border: 1px solid rgba(37, 66, 48, 0.3); color: var(--accent); }
.crow .ic svg { width: 17px; height: 17px; }
.crow small { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.crow b { font-size: 14px; font-weight: 700; word-break: break-all; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.field input, .field textarea {
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--stroke); border-radius: 12px;
  padding: 12px 14px; font: inherit; font-size: 14px; color: var(--ink); width: 100%;
}
.field textarea { resize: vertical; min-height: 96px; }
.field input::placeholder, .field textarea::placeholder { color: rgba(226, 234, 231, 0.35); }
.field input:focus, .field textarea:focus { border-color: rgba(37, 66, 48, 0.6); outline: none; background: rgba(255, 255, 255, 0.07); }
.form-note { font-size: 12px; color: var(--muted); margin: 10px 0 0; text-align: center; }

/* --- Page footer nav: Previous / indicator / Next --- */
.page-nav {
  flex: none; position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 24px; border-top: 1px solid var(--stroke);
}
.arrow-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--stroke);
  color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.arrow-btn svg { width: 15px; height: 15px; }
.arrow-btn:hover:not(:disabled) { background: rgba(37, 66, 48, 0.16); }
.arrow-btn:disabled { opacity: 0.32; cursor: default; }
.page-ind { font-size: 11.5px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); text-align: center; }
.page-ind b { color: var(--accent); font-weight: 700; }

/* Ink-settle reveal: applied by script only on chapter change */
@keyframes inkSettle {
  from { opacity: 0; filter: blur(4px); transform: translateY(5px); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}
.ink-anim { animation: inkSettle 380ms ease-out both; }
.ink-anim-d1 { animation: inkSettle 380ms ease-out 70ms both; }
.ink-anim-d2 { animation: inkSettle 380ms ease-out 140ms both; }
/* Primed state: identical to the keyframe's first frame. The script puts
   the incoming chapter into this state before it is ever made visible,
   and holds it there under the turning sheet, so the first painted frame
   of the new page is already unsettled. */
.ink-prime { opacity: 0 !important; filter: blur(4px); transform: translateY(5px); }
@media (prefers-reduced-motion: reduce) {
  .ink-anim, .ink-anim-d1, .ink-anim-d2 { animation: none !important; }
  .ink-prime { opacity: 1 !important; filter: none; transform: none; }
}

/* Present marker on the current role */
.present-mark { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 700; white-space: nowrap; }
.present-dot {
  width: 7px; height: 7px; flex: none; border-radius: 50%;
  background: #4c9468;
  animation: presentPulse 2.4s ease-in-out infinite;
}
html[data-theme="dark"] .present-dot { background: #7fb08d; }
@keyframes presentPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.78); }
}
@media (prefers-reduced-motion: reduce) {
  .present-dot { animation: none; }
}


/* ==========================================================================
   09. TURNING SHEET - 6 hinged paper slices built by script
   ========================================================================== */
.sheet {
  position: absolute; top: 0; bottom: 0; z-index: 30;
  left: 0; right: 0;
  perspective: 2600px;
  pointer-events: none;
  /* The sheet spans the whole book and is clipped to the book frame:
     one page wide from the spine, it can cover the left page as it
     lands but can never overshoot the book's outer border. */
  clip-path: inset(0 round var(--radius));
}
.slice {
  position: absolute; top: 0; bottom: 0; left: 100%;
  width: calc((100% - var(--leftw) - 2px) * 0.166667);
  transform-origin: left center;
  transform-style: preserve-3d;
  will-change: transform;
}
.slice.first { left: calc(var(--leftw) + 2px); }
.slice .slice { width: 100%; }
.sface {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  overflow: hidden;
  border-top: 1px solid rgba(31, 38, 34, 0.16);
  border-bottom: 1px solid rgba(31, 38, 34, 0.16);
  background: linear-gradient(100deg, #f8f5ec, #fefdf9 55%, #fbf9f1);
}
.sface::after {
  content: ""; position: absolute; inset: 0; z-index: 2;
  background-image: var(--grain-img); opacity: 0.03;
  pointer-events: none;
}
.slice.last .sface {
  border-right: 1px solid rgba(31, 38, 34, 0.2);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.sface.sback {
  transform: rotateY(180deg);
  background: linear-gradient(100deg, #f1eee1, #f8f5ec);
}
.scontent { position: absolute; top: 0; bottom: 0; padding: 28px 40px 20px; }
.scontent .chapter { display: block; }
/* --- Faint show-through ghost of the printed side, seen on the paper back --- */
.sback .scontent { opacity: 0.07; }
.sveil { position: absolute; inset: 0; z-index: 3; opacity: 0; pointer-events: none; }
.sfront .sveil { background: linear-gradient(90deg, rgba(59, 48, 25, 0.36), rgba(59, 48, 25, 0.05) 55%, rgba(255, 255, 255, 0.14)); }
.sback .sveil { background: linear-gradient(270deg, rgba(59, 48, 25, 0.36), rgba(59, 48, 25, 0.05) 55%, rgba(255, 255, 255, 0.12)); }
.crease {
  position: absolute; top: 0; bottom: 0; left: 0; width: 46px; z-index: 2;
  background: linear-gradient(90deg, rgba(59, 48, 25, 0.2), transparent);
  pointer-events: none;
}
.edge-hi {
  position: absolute; top: 0; bottom: 0; right: 0; width: 34px; z-index: 2;
  background: linear-gradient(270deg, rgba(255, 255, 255, 0.55), transparent);
  opacity: 0; pointer-events: none;
}
/* --- Shadows the turning sheet casts on the pages underneath --- */
.cast { position: absolute; top: 0; bottom: 0; z-index: 20; opacity: 0; pointer-events: none; }
.cast-r { left: calc(var(--leftw) + 2px); right: 0; background: linear-gradient(90deg, rgba(43, 36, 18, 0.27), rgba(43, 36, 18, 0) 62%); border-radius: 0 var(--radius) var(--radius) 0; }
.cast-l { left: 0; width: var(--leftw); background: linear-gradient(270deg, rgba(16, 14, 9, 0.45), rgba(16, 14, 9, 0) 62%); border-radius: var(--radius) 0 0 var(--radius); }
.book.is-flipping .tab, .book.is-flipping .arrow-btn { pointer-events: none; }

/* ==========================================================================
   10. PAPER SCOPE - variables for the right page + turning sheet faces
   ========================================================================== */
.paper {
  --ink: #1e2420;
  --body: rgba(31, 38, 34, 0.85);
  --muted: rgba(31, 38, 34, 0.58);
  --stroke: rgba(31, 38, 34, 0.14);
  --glass-card: rgba(31, 38, 34, 0.03);
  --accent: #254230;
  --accent-deep: #1a2e22;
  --accent-mid: #3e6b4f;
  --grad: linear-gradient(90deg, #1a2e22, #254230);
  --gold: #c08a1e;
  --page-solid: #fdfcf8;
  --card-bg: rgba(255, 255, 255, 0.92);
  --quote-bg: #fbf9f1;
  --proj-bg: #ffffff;
  --proj-ink: #1e2420;
  --field-bg: rgba(255, 255, 255, 0.9);
  --field-focus-bg: #ffffff;
  color: var(--ink);
}
html[data-theme="dark"] .paper {
  --ink: #f1ebdd;
  --body: rgba(241, 235, 221, 0.85);
  --muted: rgba(241, 235, 221, 0.58);
  --stroke: rgba(241, 235, 221, 0.16);
  --glass-card: rgba(255, 255, 255, 0.05);
  --accent: #7fb08d;
  --accent-deep: #a9cdb2;
  --accent-mid: #7fb08d;
  --grad: linear-gradient(90deg, #679a76, #7fb08d);
  --gold: #f5b942;
  --page-solid: #1e2422;
  --card-bg: rgba(255, 255, 255, 0.06);
  --quote-bg: #232b26;
  --proj-bg: #212824;
  --proj-ink: #f1ebdd;
  --field-bg: rgba(255, 255, 255, 0.06);
  --field-focus-bg: rgba(255, 255, 255, 0.1);
}
/* --- Paper-scoped component tweaks --- */
.paper .ch-title { background: none; -webkit-background-clip: initial; background-clip: initial; color: var(--ink); }
.paper .ch-label { display: flex; align-items: center; gap: 9px; }
.paper .ch-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; flex: none; }
.type-line { font-size: 14.5px; font-weight: 500; color: var(--muted); margin: 0 0 12px; }
.type-line b { color: var(--accent); font-weight: 700; }
.type-line .caret {
  display: inline-block; width: 2px; height: 1em; margin-left: 2px;
  vertical-align: -0.12em; background: var(--accent);
  animation: caretBlink 1.05s steps(1) infinite;
}
@keyframes caretBlink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
.stat span.note { text-transform: none; letter-spacing: 0; font-size: 11px; line-height: 1.55; margin-top: 6px; }
.paper .chip { background: var(--card-bg); border-color: var(--stroke); }
.paper .tl-item::before { background: var(--page-solid); }
.paper .do-card { background: transparent; border: none; padding: 8px 4px; }
.paper .do-card .ic { width: 44px; height: 44px; border-radius: 50%; background: transparent; border: 1.5px solid var(--accent); color: var(--accent); }
.paper .do-card p { color: var(--muted); }
.quote-card {
  margin-top: 20px; background: var(--quote-bg); border: 1px solid var(--stroke);
  border-radius: 14px; padding: 20px 22px; display: flex; gap: 16px; align-items: flex-start;
}
.quote-card .qmark { font-family: Georgia, "Times New Roman", serif; font-size: 58px; line-height: 0.55; color: var(--accent); margin-top: 12px; flex: none; }
.quote-card p { margin: 0; font-size: 15.5px; font-style: italic; line-height: 1.65; color: var(--body); }
.paper .crow:hover { background: var(--card-bg); border-color: rgba(37, 66, 48, 0.5); }
.paper .arrow-btn { background: var(--card-bg); }
.paper .arrow-btn:hover:not(:disabled) { background: rgba(37, 66, 48, 0.16); }
.paper .field input, .paper .field textarea { background: var(--field-bg); border-color: var(--stroke); color: var(--ink); }
.paper .field input::placeholder, .paper .field textarea::placeholder { color: var(--muted); }
.paper .field input:focus, .paper .field textarea:focus { border-color: rgba(37, 66, 48, 0.65); background: var(--field-focus-bg); }

/* ==========================================================================
   11. BOOK-NATIVE PASS - printed treatments replace UI-kit chrome
   ========================================================================== */
.paper {
  --serif: "EB Garamond", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --leader: rgba(31, 38, 34, 0.38);
  --frame: rgba(31, 38, 34, 0.55);
}
html[data-theme="dark"] .paper {
  --leader: rgba(241, 235, 221, 0.38);
  --frame: rgba(241, 235, 221, 0.5);
}
/* --- Chapter furniture: serif small-caps label, serif title, printed double rule --- */
.paper .ch-label { font-family: var(--serif); font-variant: small-caps; font-size: 15.5px; font-weight: 600; letter-spacing: 0.22em; }
.paper .ch-label::before { display: none; }
.paper .ch-title { font-family: var(--serif); font-size: 38px; font-weight: 600; letter-spacing: 0; }
.paper .ch-rule { width: 100%; height: 0; background: none; border-radius: 0; border-top: 3px solid var(--ink); margin: 15px 0 16px; opacity: 0.88; }
.paper .ch-rule::after { content: ""; display: block; border-top: 1px solid var(--ink); margin-top: 2.5px; }
.paper .dropcap::first-letter { font-family: var(--serif); font-weight: 600; font-size: 60px; line-height: 0.78; padding: 8px 12px 0 0; color: var(--accent-mid); }
.paper h3.sub { font-family: var(--serif); font-size: 21px; font-weight: 600; }
.paper .page-ind { font-family: var(--serif); font-variant: small-caps; font-size: 14.5px; letter-spacing: 0.1em; text-transform: none; }

/* --- Timeline as open entries on hairline rules; dates are plain small caps --- */
.paper .tl { padding-left: 0; }
.paper .tl::before { display: none; }
.paper .tl-item { padding: 15px 0 17px; border-top: 1px solid var(--stroke); }
.paper .tl-item:first-child { border-top: none; padding-top: 0; }
.paper .tl-item:last-child { padding-bottom: 2px; }
.paper .tl-item::before { display: none; }
.paper .tl-role { font-family: var(--serif); font-size: 20.5px; font-weight: 600; }
.paper .tl-date { background: none; border: none; border-radius: 0; padding: 1px 0 0; color: var(--muted); text-transform: uppercase; letter-spacing: 0.13em; font-size: 10.5px; font-weight: 600; }
.paper .tl-dates { color: var(--muted); letter-spacing: 0.16em; font-size: 11px; font-weight: 600; }

/* --- Numbered sections: open ruled entries, serif numerals and headings --- */
.paper .num-list { gap: 0; }
.paper .num-card { background: none; border: none; border-radius: 0; box-shadow: none; padding: 13px 2px 15px; border-top: 1px solid var(--stroke); }
.paper .num-list .num-card:first-child { border-top: none; padding-top: 2px; }
.paper .num-card .num { font-family: var(--serif); font-weight: 600; font-size: 22px; opacity: 1; color: var(--accent); }
.paper .num-card h4 { font-family: var(--serif); font-size: 17.5px; font-weight: 600; }
.paper .badge { background: none; border: none; border-radius: 0; padding: 0; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-size: 10.5px; font-weight: 600; font-family: "DM Sans", system-ui, sans-serif; }

/* --- About grid: plain green line icons at the top of each cell, no badge --- */
.paper .do-card .ic-glyph { color: var(--accent); margin-bottom: 9px; line-height: 0; }
.paper .do-card .ic-glyph svg { width: 27px; height: 27px; display: block; }
.paper .do-card h4 { font-family: var(--serif); font-size: 17.5px; font-weight: 600; }

/* --- Quote card: classic title-page inset frame, no shadow --- */
.paper .quote-card { margin-top: 12px; background: transparent; border: 1px solid var(--frame); border-radius: 0; box-shadow: inset 0 0 0 4px var(--page-solid), inset 0 0 0 5px var(--frame); padding: 22px 24px; }
.paper .quote-card .qmark { font-family: var(--serif); }
.paper .quote-card p { font-family: var(--serif); font-size: 17px; }

/* --- Skills as glossary entries ---
   Core-stack highlight, then specimen-size serif entries with a small
   green diamond marker; core technologies are set in semibold logo
   green so the main stack catches the eye. */
.paper .skill-grid { grid-template-columns: 1fr; gap: 0; }
.paper .skill-group { background: var(--card-bg); border: 1px solid var(--frame); border-radius: 3px; box-shadow: inset 0 0 0 3px var(--page-solid), inset 0 0 0 4px var(--frame); padding: 12px 14px 10px; }
.paper .skill-group h4 { display: block; text-align: center; font-family: var(--serif); font-variant: small-caps; letter-spacing: 0.06em; font-size: 19px; font-weight: 600; margin: 0 0 10px; }
.paper .skill-group h4::after { content: ""; display: block; width: 36px; height: 2px; background: var(--accent); margin: 6px auto 0; }
/* Core stack as a deep logo-green banner: cream Garamond italic terms
   separated by small gold diamonds, centred. */
.core-stack { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 5px; margin: 0 0 14px; padding: 13px 16px 14px; background: linear-gradient(135deg, #2f5240 0%, #254230 48%, #1a2e22 100%); border: 1px solid #1a2e22; border-radius: 6px; box-shadow: inset 0 0 0 3px rgba(253, 252, 248, 0.07), inset 0 0 0 4px rgba(217, 180, 92, 0.22), 0 8px 18px rgba(26, 46, 34, 0.18); }
.core-stack .cs-label { font-size: 10px; font-weight: 700; letter-spacing: 0.32em; text-transform: uppercase; color: #e3c878; }
.core-stack .cs-terms { font-family: var(--serif); font-style: italic; font-size: 20px; font-weight: 600; color: #f7f3e6; line-height: 1.3; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px; }
.core-stack .cs-dia { width: 6px; height: 6px; flex: none; background: #d9b45c; transform: rotate(45deg); }
.entries { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 40px; }
.entries li { display: flex; align-items: center; padding: 5px 0; break-inside: avoid; font-family: var(--serif); font-size: 18.5px; font-weight: 500; line-height: 1.3; color: var(--ink); }
.entries li::before { content: ""; flex: none; width: 6px; height: 6px; margin-right: 11px; background: var(--accent); transform: rotate(45deg); }
.entries li.core { color: var(--accent); font-weight: 600; }
html[data-theme="dark"] .paper .skill-group { border-color: rgba(127, 176, 141, 0.45); box-shadow: inset 0 0 0 3px var(--page-solid), inset 0 0 0 4px rgba(127, 176, 141, 0.45); }

/* Skills chapter only: compacted so all 7 groups fit the printed page
   with no clipping - groups flow in two columns, tighter group spacing,
   smaller entry leading. Other chapters untouched. */
.paper .skills-ch .ch-rule { margin: 10px 0 10px; }
.paper .skills-ch .core-stack { padding: 11px 14px 12px; gap: 4px; margin: 0 0 12px; }
.paper .skills-ch .core-stack .cs-terms { font-size: 18px; }
.paper .skills-ch .skill-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
.paper .skills-ch .skill-group { padding: 11px 12px 9px; }
.paper .skills-ch .skill-group h4 { font-size: 17px; margin: 0 0 7px; }
.paper .skills-ch .skill-group h4::after { margin-top: 4px; }
.paper .skills-ch .entries { columns: 2; column-gap: 14px; }
.paper .skills-ch .entries li { font-size: 15.5px; line-height: 1.25; padding: 2.5px 0; }
.paper .skills-ch .entries li::before { width: 5px; height: 5px; margin-right: 8px; }
.page-base:has(.skills-ch.active) { padding-top: 20px; }
@media (max-height: 760px) {
  .paper .skills-ch .ch-title { font-size: 32px; }
  .paper .skills-ch .core-stack .cs-terms { font-size: 17px; }
  .paper .skills-ch .core-stack { padding: 9px 12px 10px; margin-bottom: 10px; }
  .paper .skills-ch .skill-grid { gap: 9px; }
  .paper .skills-ch .skill-group { padding: 8px 10px 7px; }
  .paper .skills-ch .skill-group h4 { font-size: 16px; margin: 0 0 5px; }
  .paper .skills-ch .entries li { font-size: 14.5px; padding: 1.5px 0; }
}

/* --- Projects as plates: hairline-framed image, italic serif caption --- */
.paper .proj-grid { gap: 22px 16px; }
.paper .proj { background: transparent; border: none; border-radius: 0; box-shadow: none; overflow: visible; }
.paper .proj:hover { transform: none; box-shadow: none; }
.paper .proj-media { border: 1px solid var(--stroke); transition: border-color 0.25s ease, box-shadow 0.25s ease; }
.paper .proj:hover .proj-media, .paper .proj:focus-within .proj-media { border-color: rgba(37, 66, 48, 0.6); box-shadow: 0 10px 22px rgba(43, 36, 18, 0.16); }
.paper .proj:hover .plate-cap .pname { color: var(--accent); }
.paper .proj-overlay h4 { font-family: var(--serif); font-weight: 600; font-size: 19px; }
.plate-cap { padding: 10px 4px 2px; text-align: center; font-family: var(--serif); }
.plate-cap .pname { font-style: italic; font-size: 17.5px; font-weight: 600; color: var(--ink); }
.plate-cap .ptech { display: block; margin-top: 3px; font-family: "DM Sans", system-ui, sans-serif; font-variant: small-caps; letter-spacing: 0.14em; font-size: 11px; color: var(--muted); }
.lb-body h3 { font-family: "EB Garamond", Georgia, serif; font-weight: 600; }

/* --- Reviews as a praise page: open quotes divided by hairlines --- */
.paper .ref { background: none; border: none; border-radius: 0; box-shadow: none; padding: 8px 16px 4px; border-left: 1px solid var(--stroke); }
.paper .ref:first-child { border-left: none; }
.paper .stars { margin-bottom: 8px; }
.paper .stars svg { width: 13px; height: 13px; }
.paper .ref blockquote { font-family: var(--serif); font-size: 16px; line-height: 1.62; }
.paper .ref blockquote.clamped { max-height: 14.58em; /* 9 x 1.62 */ }
.paper .ref .who { font-family: var(--serif); font-size: 16.5px; font-weight: 600; letter-spacing: 0.02em; }
.paper .ref .meta { text-transform: uppercase; letter-spacing: 0.12em; font-size: 10.5px; }
.paper .ref-more { font-family: var(--serif); font-style: italic; font-size: 13.5px; }

/* --- Contact: ruled ledger rows and bottom-rule-only fields --- */
.paper .contact-rows { gap: 0; }
.paper .crow { background: none; border: none; border-radius: 0; border-bottom: 1px solid var(--stroke); padding: 13px 2px; }
.paper .crow .ic { display: none; }
.paper .crow > span { display: flex; align-items: baseline; gap: 18px; }
.paper .crow small { min-width: 76px; flex: none; font-size: 10.5px; letter-spacing: 0.14em; color: var(--muted); }
.paper .crow:hover { background: none; border-color: var(--stroke); }
.paper .crow:hover b { color: var(--accent-deep); }
.paper .field input, .paper .field textarea { background: transparent; border: none; border-bottom: 1.5px solid var(--stroke); border-radius: 0; padding: 10px 2px; }
.paper .field input:focus, .paper .field textarea:focus { border-bottom-color: var(--accent); background: transparent; box-shadow: 0 1px 0 var(--accent); }
/* --- Contact: the message form sits in its own bordered panel --- */
.paper #contactForm {
  margin-top: 34px; padding: 24px 26px 20px;
  background: #ffffff; border: 1px solid rgba(37, 66, 48, 0.35); border-radius: 12px;
  box-shadow: 0 10px 24px rgba(31, 38, 34, 0.07);
}
html[data-theme="dark"] .paper #contactForm {
  background: #232b26; border-color: rgba(127, 176, 141, 0.45);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.32);
}

/* --- Physical book: hardcover boards, page-edge stack, cloth spine, ribbon --- */
.book::before { content: ""; position: absolute; inset: -5px -5px -7px; z-index: -1; border-radius: calc(var(--radius) + 5px); background: linear-gradient(155deg, #1e3527 0%, #16261c 52%, #0f1b13 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.spine::after { content: ""; position: absolute; top: 0; bottom: 0; left: -8px; right: -8px; background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 2px, transparent 2px 4px), repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.06) 0 2px, transparent 2px 4px); pointer-events: none; }
/* Spiral binding: a vertical row of subtle steel rings straddling the
   centre gutter, each ring ending in a punched hole on both pages. One
   repeating SVG tile (ring + two holes) down the full page height. It
   sits above the static pages and above the turning sheet (z 30), so
   the sheet passes beneath the ring strip at the centre mid-flip. */
.spiral-binding {
  position: absolute; top: 132px; bottom: 16px; left: calc(var(--leftw) + 2px);
  width: 46px; transform: translateX(-50%); z-index: 45;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='46' height='54' viewBox='0 0 46 54'%3E%3Cellipse cx='23' cy='28.6' rx='16.5' ry='6.8' fill='none' stroke='rgba(0,0,0,0.38)' stroke-width='3'/%3E%3Cellipse cx='23' cy='27' rx='16.5' ry='6.8' fill='none' stroke='%23b7bcbe' stroke-width='2.6'/%3E%3Cellipse cx='23' cy='26.2' rx='16.5' ry='6.8' fill='none' stroke='rgba(255,255,255,0.35)' stroke-width='1'/%3E%3Ccircle cx='4.5' cy='27' r='3.4' fill='rgba(12,13,12,0.88)'/%3E%3Ccircle cx='41.5' cy='27' r='3.4' fill='rgba(12,13,12,0.88)'/%3E%3Ccircle cx='4.5' cy='28.2' r='3.4' fill='none' stroke='rgba(255,255,255,0.28)' stroke-width='0.8'/%3E%3Ccircle cx='41.5' cy='28.2' r='3.4' fill='none' stroke='rgba(0,0,0,0.18)' stroke-width='0.8'/%3E%3C/svg%3E");
  background-repeat: repeat-y;
  background-position: center top;
  background-size: 46px 54px;
}
.ribbon { position: absolute; top: 0; left: calc(var(--leftw) + 12px); width: 14px; height: 118px; z-index: 52; background: linear-gradient(90deg, #6e1a1f, #a02c31 48%, #6e1a1f); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 10px), 0 100%); filter: drop-shadow(2px 3px 3px rgba(20, 10, 5, 0.35)); pointer-events: none; }

/* --- Thumb-index tabs ---
   Every tab shares one uniform protrusion width on the shared attachment
   line tucked 10px under the page's fore-edge (the .tabs box begins 10px
   inside the book's right edge and sits below .page-right in the stack).
   Only the active tab stands out: logo green and 6px longer than the rest. */
.tabs .tab.active { width: 50px; }

/* --- Book-native pass: small-screen adjustments --- */
@media (max-width: 900px) {
  .entries { columns: 1; }
  .ribbon { display: none; }
  .paper .ref { border-left: none; }
  .paper .ch-title { font-size: 30px; }
  .book::before { inset: -4px -4px -5px; }
}

/* ==========================================================================
   12. DARK-MODE COMPONENT OVERRIDES - outside the .paper var scope
   ========================================================================== */
html[data-theme="dark"] .sface {
  background: linear-gradient(100deg, #171c19, #1e2422 55%, #1a201d);
  border-top-color: rgba(241, 235, 221, 0.16);
  border-bottom-color: rgba(241, 235, 221, 0.16);
}
html[data-theme="dark"] .sface.sback { background: linear-gradient(100deg, #141816, #1b201d); }
html[data-theme="dark"] .slice.last .sface { border-right-color: rgba(241, 235, 221, 0.2); }
html[data-theme="dark"] .tab {
  background: #22281f;
  border-color: rgba(241, 235, 221, 0.18);
  color: rgba(241, 235, 221, 0.55);
  box-shadow: 2px 3px 9px rgba(0, 0, 0, 0.55);
}
html[data-theme="dark"] .tab:hover { background: #2b332a; color: #f1ebdd; }
html[data-theme="dark"] .tab.active { background: #254230; color: #f4f1e6; border-color: transparent; }
html[data-theme="dark"] .proj-tag {
  background: rgba(127, 176, 141, 0.14); border-color: rgba(127, 176, 141, 0.4); color: #a9cdb2;
}
html[data-theme="dark"] .ref-arrow {
  background: rgba(33, 40, 36, 0.95); border-color: rgba(127, 176, 141, 0.45); color: #a9cdb2;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
html[data-theme="dark"] .ref-arrow:hover:not(:disabled) { background: #2b332d; }
html[data-theme="dark"] .ref-dot { background: rgba(241, 235, 221, 0.28); }
html[data-theme="dark"] .ref-dot.active { background: #7fb08d; }
html[data-theme="dark"] .ref-more { color: #7fb08d; }
html[data-theme="dark"] .lb-card {
  background: #212824; color: #f1ebdd;
  border-color: rgba(241, 235, 221, 0.18);
  box-shadow: 0 34px 80px rgba(0, 0, 0, 0.65);
}
html[data-theme="dark"] .lb-body p.lb-desc { color: rgba(241, 235, 221, 0.82); }
html[data-theme="dark"] .lb-body .proj-cat { color: #7fb08d; }
html[data-theme="dark"] .lb-close {
  background: rgba(33, 40, 36, 0.94); border-color: rgba(241, 235, 221, 0.25); color: #f1ebdd;
}

/* ==========================================================================
   13. EDGE TABS - desktop thumb-index on the book's right edge
   ========================================================================== */
.tabs {
  position: absolute; right: -58px; top: 14px; bottom: 14px; z-index: 6;
  width: 68px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
}
.tab {
  writing-mode: vertical-rl; text-orientation: mixed;
  flex: 1 1 0; min-height: 0;
  width: 44px;
  display: flex; align-items: center; justify-content: center;
  padding: 5px 7px; border-radius: 0 10px 10px 0;
  background: #faf7ee;
  border: 1px solid rgba(31, 38, 34, 0.18); border-left: none;
  box-shadow: 2px 3px 9px rgba(8, 6, 3, 0.4);
  color: #6d7268; font-size: 10px; font-weight: 700;
  letter-spacing: 0.11em; text-transform: uppercase; cursor: pointer; white-space: nowrap;
  transition: background 0.2s, color 0.2s, width 0.25s ease;
}
.tab:hover { color: #1e2420; background: #ffffff; }
.tab.active { background: #254230; color: #f4f1e6; border-color: transparent; }

/* --- Hover pass: unmistakable pointer feedback, site-wide ---
   The book's original hover states were near-invisible, so the site
   could read as having no hover effect at all. Interactive elements
   now answer the pointer clearly, in the book's own logo greens:
   controls fill or pull out, plates deepen their frame, ledger rows
   and skill entries wash green. This section deliberately contains
   no cursor rules: the pointer effect in effects.js is unchanged. */
.nav-btn:hover { color: #ffffff; background: rgba(127, 176, 141, 0.26); border-color: rgba(127, 176, 141, 0.55); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); }
.nav-btn svg { transition: transform 0.18s ease; }
.nav-btn:hover svg { transform: scale(1.14); }
.tab:hover { width: 54px; color: #14231a; background: #ffffff; box-shadow: 3px 4px 12px rgba(8, 6, 3, 0.5); }
.tab.active:hover { width: 58px; background: #2c4f3a; color: #f4f1e6; }
html[data-theme="dark"] .tab:hover { width: 54px; background: #39443a; color: #ffffff; }
html[data-theme="dark"] .tab.active:hover { width: 58px; background: #2c4f3a; color: #f4f1e6; }
.btn-primary:hover { background: linear-gradient(180deg, #3a6850, #2c4f3a); transform: translateY(-2px); box-shadow: 0 16px 32px rgba(37, 66, 48, 0.6); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.65); transform: translateY(-2px); }
.soc { transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s; }
.soc:hover { background: rgba(127, 176, 141, 0.3); border-color: rgba(127, 176, 141, 0.75); transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35); }
.arrow-btn { transition: background 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.2s; }
.paper .arrow-btn:hover:not(:disabled) { background: #254230; border-color: transparent; color: #f4f1e6; box-shadow: 0 8px 18px rgba(26, 46, 34, 0.35); }
html[data-theme="dark"] .paper .arrow-btn:hover:not(:disabled) { background: #7fb08d; color: #14231a; }
.proj-filter { transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.18s ease; }
.proj-filter:hover { background: rgba(37, 66, 48, 0.14); color: var(--ink); border-color: rgba(37, 66, 48, 0.65); transform: translateY(-1px); }
html[data-theme="dark"] .proj-filter:hover { background: rgba(127, 176, 141, 0.18); }
.proj-btn:hover { background: #3e6b4f; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35); }
.paper .proj:hover .proj-media { border-color: rgba(37, 66, 48, 0.8); box-shadow: 0 16px 30px rgba(43, 36, 18, 0.24); }
.paper .proj:hover .plate-cap .ptech { color: var(--accent); }
html[data-theme="dark"] .paper .proj:hover .proj-media { border-color: rgba(127, 176, 141, 0.75); box-shadow: 0 16px 30px rgba(0, 0, 0, 0.45); }
.ref-arrow { transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.18s ease, box-shadow 0.2s, opacity 0.2s; }
.ref-arrow:hover:not(:disabled) { background: #254230; border-color: transparent; color: #f4f1e6; transform: translateY(-50%) scale(1.1); box-shadow: 0 10px 22px rgba(26, 46, 34, 0.4); }
html[data-theme="dark"] .ref-arrow:hover:not(:disabled) { background: #7fb08d; color: #14231a; }
.ref-dot:hover { background: rgba(37, 66, 48, 0.6); }
.ref-dot.active:hover { background: #254230; }
html[data-theme="dark"] .ref-dot:hover { background: rgba(169, 205, 178, 0.65); }
html[data-theme="dark"] .ref-dot.active:hover { background: #7fb08d; }
.ref-more:hover { text-decoration: underline; text-underline-offset: 3px; }
html[data-theme="dark"] .ref-more:hover { color: #a9cdb2; }
.paper .crow { transition: background 0.2s, border-color 0.2s; }
.paper .crow:hover { background: rgba(37, 66, 48, 0.06); border-bottom-color: rgba(37, 66, 48, 0.45); }
html[data-theme="dark"] .paper .crow:hover { background: rgba(127, 176, 141, 0.1); border-bottom-color: rgba(127, 176, 141, 0.5); }
.paper .entries li { transition: background 0.18s ease, color 0.18s ease; border-radius: 3px; }
.paper .entries li:hover { background: rgba(37, 66, 48, 0.07); color: var(--accent-deep); }
html[data-theme="dark"] .paper .entries li:hover { background: rgba(127, 176, 141, 0.12); }
.paper .skill-group { transition: border-color 0.25s ease, box-shadow 0.25s ease; }
.paper .skill-group:hover { border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--page-solid), inset 0 0 0 4px var(--accent), 0 8px 18px rgba(26, 46, 34, 0.1); }
html[data-theme="dark"] .paper .skill-group:hover { border-color: #a9cdb2; box-shadow: inset 0 0 0 3px var(--page-solid), inset 0 0 0 4px #a9cdb2, 0 8px 18px rgba(0, 0, 0, 0.3); }
.paper .field input:hover, .paper .field textarea:hover { border-bottom-color: rgba(37, 66, 48, 0.55); }
html[data-theme="dark"] .paper .field input:hover, html[data-theme="dark"] .paper .field textarea:hover { border-bottom-color: rgba(127, 176, 141, 0.6); }
.lb-close { transition: background 0.2s, color 0.2s, transform 0.25s ease; }
.lb-close:hover { background: #254230; color: #ffffff; transform: rotate(90deg); }
html[data-theme="dark"] .lb-close:hover { background: #7fb08d; color: #14231a; }
.tstrip-btn:hover { background: rgba(37, 66, 48, 0.1); border-color: rgba(37, 66, 48, 0.55); }
.tstrip-btn.active:hover { background: #254230; color: #f7f3e6; }
html[data-theme="dark"] .tstrip-btn:hover { background: rgba(127, 176, 141, 0.16); }
html[data-theme="dark"] .tstrip-btn.active:hover { background: #2f5240; color: #f7f3e6; }

/* --- Mobile-edition pieces: hidden until the <=900px layout --- */
.brand-lockup { display: none; }
.tab-strip { display: none; }
.hint { margin: 16px 0 0; font-size: 12px; color: var(--muted); text-align: center; letter-spacing: 0.04em; }

/* ==========================================================================
   14. MOBILE EDITION - a clean mobile edition of the book (<=900px)
   At <=900px the book becomes three calm pieces floating on the warm
   charcoal backdrop: a deep-green app bar (logo + name, sound and theme
   only), the profile restyled as the desktop's dark left page, a sticky
   pill strip that is the ONE chapter menu, and each chapter on a clean
   paper sheet with a slim green spine accent.
   ========================================================================== */
@media (max-width: 900px) {
  /* --- 1 · App bar: deep logo green, brand lockup left, toggles right --- */
  .sidenav {
    top: 0; left: 0; right: 0; transform: none;
    width: auto; height: 64px;
    flex-direction: row; justify-content: flex-start; align-items: center;
    padding: 0 10px 0 12px; gap: 4px;
    background: #254230;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    border: none; border-bottom: 1px solid rgba(10, 20, 13, 0.55); border-radius: 0;
    box-shadow: 0 10px 24px rgba(8, 14, 10, 0.42);
  }
  html[data-theme="dark"] .sidenav { background: #1a2e22; }
  .logo { width: 34px; height: 34px; flex: none; border-radius: 9px; margin: 0; }
  .brand-lockup { display: flex; flex-direction: column; justify-content: center; margin-left: 6px; line-height: 1.2; min-width: 0; }
  .brand-name { font-family: "EB Garamond", Georgia, serif; font-size: 15px; font-weight: 600; letter-spacing: 0; color: #f7f3e6; white-space: nowrap; }
  .brand-role { margin-top: 1px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: rgba(247, 243, 230, 0.72); white-space: nowrap; }
  /* chapter icons leave the app bar - the pill strip is the only chapter menu */
  .sidenav .nav-btn[data-goto] { display: none; }
  .sidenav .sound-btn, .sidenav .theme-btn {
    width: 44px; height: 44px; flex: none;
    margin: 0; padding: 0;
    display: grid; place-items: center;
    border-top: none; border-radius: 12px; color: #f7f3e6;
  }
  .sidenav .sound-btn { margin-left: auto; }
  .sidenav .sound-btn svg, .sidenav .theme-btn svg { width: 20px; height: 20px; }
  .sidenav .sound-btn:hover, .sidenav .theme-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
  .sound-label, .theme-label { display: none; }
  .stage { padding: 84px 14px 22px; justify-content: flex-start; }

  /* --- The stacked book: chrome off, cards float on the backdrop --- */
  .book { flex-direction: column; height: auto; min-height: 0; background: transparent; border-color: transparent; box-shadow: none; }
  .book::before, .book::after { display: none; }
  .spine { display: none; }

  /* --- 2 · Profile card: the desktop left page, one dark card --- */
  .page-left {
    width: 100%; overflow: visible;
    /* the desktop left page carried onto mobile: a deep green-black
       gradient body under the photo (no glass, no blur), identical in
       both themes - the desktop page never changes with the theme */
    background: linear-gradient(180deg, #101d16 0%, #0c150f 55%, #0a120d 100%);
    border: 1px solid rgba(240, 232, 205, 0.14); border-radius: 20px;
    box-shadow: 0 18px 38px rgba(5, 8, 6, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }
  html[data-theme="dark"] .page-left {
    background: linear-gradient(180deg, #101d16 0%, #0c150f 55%, #0a120d 100%);
    border-color: rgba(240, 232, 205, 0.14);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }
  .page-left::after { display: none; }
  /* cover photo as a full-width banner across the top of the card, at
     the image's own ratio so nothing is squashed or cropped away; the
     cursive signature rides the photo's lower edge, as on desktop */
  .photo-hero {
    height: auto; aspect-ratio: 1147 / 1371;
    border-radius: 20px 20px 0 0;
  }
  .photo-hero img { object-position: 50% 50%; }
  /* the photo melts into the signature zone: a soft fade over only the
     bottom ~30%, deepening to the dark band the signature sits on, so
     there is no hard cut at the photo's lower edge */
  .photo-hero::after {
    background: linear-gradient(180deg, rgba(10, 13, 9, 0) 68%, rgba(10, 13, 9, 0.34) 82%, rgba(10, 13, 9, 0.72) 93%, rgba(10, 13, 9, 0.94) 100%);
  }
  /* the desktop chapter indicator rides the photo's top-right corner,
     updated by the same setActiveUI routine as on desktop */
  .photo-top { padding: 10px 16px; }
  /* clear air under the script: the rotated cursive's descenders and its
     low right end sit ~17px above the photo's bottom edge, never clipped */
  .signature { left: 20px; right: 14px; bottom: 17px; font-size: 28px; line-height: 1.3; }
  .left-body { padding: 18px 20px 22px; }
  .identity { margin-top: 0; }
  /* desktop text colours on the dark body: cream-white role line,
     soft off-white tagline, off-white location with the green pin */
  .identity .role { margin-top: 0; font-size: 14px; }
  .tagline { margin: 0; font-size: 14px; line-height: 1.65; }
  /* stats exactly as desktop: large white numerals, muted sage-grey
     caps labels, dotted vertical dividers between the four */
  .mini-stats { margin-top: 20px; }
  .mini-stats b { font-size: 20px; color: #fff; }
  .mini-stats span { font-size: 9.5px; }
  .cta-row { margin-top: 18px; }
  .cta-row .btn { min-height: 46px; border-radius: 12px; }
  .socials { margin-top: 16px; }
  .soc { width: 40px; height: 40px; }

  /* --- 3 · Chapter tab strip: the single chapter menu --- */
  .tab-strip {
    display: flex; gap: 8px;
    position: sticky; top: 64px; z-index: 55;
    margin: 16px -14px 0; padding: 10px 14px;
    overflow-x: auto; overscroll-behavior-x: contain;
    scrollbar-width: none;
    background: rgba(253, 252, 248, 0.94);
    backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
    border-bottom: 1px solid rgba(31, 38, 34, 0.09);
  }
  .tab-strip::-webkit-scrollbar { display: none; }
  html[data-theme="dark"] .tab-strip { background: rgba(22, 27, 24, 0.94); border-bottom-color: rgba(241, 235, 221, 0.1); }
  .tstrip-btn {
    flex: none; height: 44px; padding: 0 18px; border-radius: 999px;
    display: inline-flex; align-items: center;
    background: transparent; border: 1px solid rgba(31, 38, 34, 0.2);
    color: #2a332c; font-size: 13.5px; font-weight: 600; letter-spacing: 0.01em;
    cursor: pointer; white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
  }
  .tstrip-btn:focus-visible { outline: 2px solid #254230; outline-offset: 2px; }
  .tstrip-btn.active { background: #254230; border-color: transparent; color: #f7f3e6; box-shadow: 0 6px 14px rgba(24, 44, 31, 0.35); }
  html[data-theme="dark"] .tstrip-btn { border-color: rgba(241, 235, 221, 0.26); color: rgba(241, 235, 221, 0.85); }
  html[data-theme="dark"] .tstrip-btn.active { background: #2f5240; color: #f7f3e6; }

  /* --- 4 · Chapter sheet: clean paper card, slim green spine --- */
  .page-right {
    height: auto; min-height: 0; margin-top: 16px;
    border-radius: 20px; scroll-margin-top: 138px;
    border: 1px solid rgba(31, 38, 34, 0.07);
    box-shadow: 0 18px 38px rgba(9, 7, 3, 0.38);
  }
  html[data-theme="dark"] .page-right { border-color: rgba(241, 235, 221, 0.09); }
  .page-right::before {
    top: 16px; bottom: 16px; left: 0; width: 4px; z-index: 5;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, var(--accent-mid), var(--accent));
  }
  .paper-grain { border-radius: 20px; }
  .page-base { overflow: visible; padding: 24px 20px 10px 22px; }
  .chapter p { font-size: 15.5px; line-height: 1.7; }
  .paper .tl-item li, .paper .note-card li { font-size: 14.5px; }
  .paper .num-card p { font-size: 14px; }
  .do-grid, .skill-grid, .proj-grid { grid-template-columns: 1fr; }
  .paper .skills-ch .skill-grid { grid-template-columns: 1fr; }
  .paper .skills-ch .skill-group:nth-child(2) { padding-top: 11px; }
  .paper .skills-ch .entries { columns: 1; }
  .paper .skills-ch .entries li { font-size: 16.5px; padding: 3px 0; }
  .proj-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -2px 14px; padding: 2px 2px 6px; }
  .proj-filters::-webkit-scrollbar { display: none; }
  .proj-filter { flex: none; min-height: 40px; padding: 7px 16px; }
  .paper .ref { flex-basis: 100%; border-left: none; padding: 6px 4px 2px; }
  .paper .ref blockquote { font-size: 16.5px; }
  .ref-arrow.prev { left: -6px; }
  .ref-arrow.next { right: -6px; }
  .ref-stage { margin: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .paper #contactForm { margin-top: 26px; padding: 18px 16px 16px; }
  .page-nav { padding: 12px 16px 14px; }
  .arrow-btn { min-height: 46px; padding: 10px 18px; }
  .page-ind { font-size: 10.5px; }

  /* --- Desktop-only book furniture stays off the mobile edition --- */
  .tabs, .cast, .hint, .spiral-binding { display: none; }
  .sheet { display: none !important; }
}

/* ==========================================================================
   15. REDUCED MOTION - transitions and animations off on request
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .page-base { transition: none; }
  .ref-track { transition: none; }
  .type-line .caret { animation: none; }
  .proj, .proj-overlay, .proj-media img { transition: none; }
}

/* ==========================================================================
   16. CURSOR - custom dot + ring (added by js/effects.js on fine pointers)
   ========================================================================== */
.has-cursor, .has-cursor * { cursor: none !important; }
.has-cursor input, .has-cursor textarea { cursor: text !important; }
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 10000;
  pointer-events: none; border-radius: 50%;
  mix-blend-mode: difference;
  opacity: 0; transition: opacity 0.25s ease;
  will-change: transform;
}
.cursor-visible .cursor-dot, .cursor-visible .cursor-ring { opacity: 1; }
.cursor-dot { width: 6px; height: 6px; background: #fff; }
.cursor-ring {
  width: 34px; height: 34px;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  transition: opacity 0.25s ease, width 0.25s ease, height 0.25s ease,
              background-color 0.25s ease, border-color 0.25s ease, border-radius 0.25s ease;
}
.cursor-ring.is-hover { width: 58px; height: 58px; background-color: rgba(255, 255, 255, 0.9); border-color: transparent; }
.cursor-ring.is-text { width: 3px; height: 26px; border-radius: 2px; background-color: #fff; border-color: transparent; }
.cursor-ring.is-down { width: 24px; height: 24px; }
.cursor-ring.is-hover.is-down { width: 46px; height: 46px; }
