/* =====================================================
   A Field Guide to Kalyani Ingole  -  book.css
   ===================================================== */

:root {
  --ink: #2b2118;
  --ink-soft: #5b4c3d;
  --paper: #fbf4e4;
  --paper-2: #f4e9cf;
  --line: rgba(43, 33, 24, .14);
  --desk: #e9dfc8;
  --desk-dot: rgba(43, 33, 24, .09);
  --leather: #6b2d3a;
  --leather-2: #4d1e29;
  --coral: #ff5d47;
  --teal: #1fb6a6;
  --violet: #7a5cff;
  --yellow: #ffd84d;
  --card: #ffffff;
  --shadow: 0 24px 60px -18px rgba(43, 24, 10, .45), 0 4px 0 rgba(0, 0, 0, .05);
  --radius: 22px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Caveat", "Comic Sans MS", cursive;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

:root[data-theme="night"] {
  --ink: #f3ead7;
  --ink-soft: #c8bca6;
  --paper: #1d1a2c;
  --paper-2: #262239;
  --line: rgba(243, 234, 215, .14);
  --desk: #121020;
  --desk-dot: rgba(243, 234, 215, .07);
  --leather: #2a2250;
  --leather-2: #1a1535;
  --card: #2a2640;
  --shadow: 0 24px 70px -18px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .04);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--desk);
  background-image: radial-gradient(var(--desk-dot) 1.4px, transparent 1.5px);
  background-size: 26px 26px;
  overflow-x: hidden;
  transition: background-color .4s, color .4s;
}
a { color: inherit; }
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 8px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; border-radius: 6px; }

/* ---------- desk doodles ---------- */
.desk { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.doodle { position: absolute; font-family: var(--hand); font-size: 2.2rem; color: var(--ink); opacity: .13; animation: drift 14s ease-in-out infinite; }
.d1 { left: 3%; top: 10%; font-size: 4rem; }
.d2 { right: 4%; top: 7%; animation-delay: -3s; }
.d3 { left: 5%; bottom: 8%; font-size: 3.4rem; animation-delay: -6s; }
.d4 { right: 6%; bottom: 10%; animation-delay: -2s; }
.d5 { left: 46%; top: 2%; font-family: var(--mono); font-size: 1.1rem; animation-delay: -8s; }
.d6 { right: 28%; bottom: 3%; font-size: 3rem; animation-delay: -10s; }
@keyframes drift { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-16px) rotate(5deg); } }

/* ---------- the book ---------- */
.book {
  position: relative;
  z-index: 1;
  width: min(1260px, 96vw);
  height: min(90vh, 920px);
  margin: 5vh auto;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  border-radius: 30px;
  background: linear-gradient(145deg, var(--leather), var(--leather-2));
  padding: 14px;
  box-shadow: var(--shadow);
  animation: bookIn .9s cubic-bezier(.2, .9, .25, 1.1) both;
}
@keyframes bookIn { from { opacity: 0; transform: translateY(40px) rotateX(10deg) scale(.96); } to { opacity: 1; transform: none; } }
.book::before { /* stitched edge */
  content: ""; position: absolute; inset: 7px; border-radius: 24px;
  border: 2px dashed rgba(255, 255, 255, .22); pointer-events: none;
}

/* ---------- sidebar / TOC ---------- */
.toc {
  position: relative;
  display: flex; flex-direction: column;
  padding: 18px 14px 14px 10px;
  color: #fff;
  min-height: 0;
}
.toc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 4px 8px 12px; }
.brand { text-decoration: none; display: block; }
.brand-title { display: block; font-family: var(--serif); font-weight: 900; font-size: 1.5rem; line-height: 1.05; letter-spacing: -.01em; color: #fff; }
.brand-sub { display: block; font-family: var(--hand); font-size: 1.25rem; color: var(--yellow); margin-top: 2px; }
.toc-label { margin: 6px 10px 8px; font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: rgba(255, 255, 255, .6); }
.toc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tab {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px 9px 12px;
  text-decoration: none;
  color: rgba(255, 255, 255, .88);
  border-radius: 14px 0 0 14px;
  transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), background .2s, color .2s;
}
.tab:hover { background: rgba(255, 255, 255, .1); transform: translateX(5px); }
.tab-icon { font-size: 1.35rem; width: 32px; text-align: center; filter: drop-shadow(0 2px 0 rgba(0,0,0,.25)); }
.tab-text { display: flex; flex-direction: column; line-height: 1.15; }
.tab-num { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; opacity: .65; }
.tab-label { font-weight: 800; font-size: 1.02rem; }
.tab.active {
  background: var(--paper); color: var(--ink);
  transform: translateX(14px);       /* sticks out into the page like a tab */
  margin-right: -14px; padding-right: 26px;
  box-shadow: -4px 4px 0 rgba(0, 0, 0, .18);
  z-index: 2;
}
.tab.active .tab-num { color: var(--coral); opacity: 1; }
.tab.active::after { /* a little page-curl notch */
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 10px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .06));
}

.toc-foot { margin-top: auto; padding: 10px 8px 0; display: flex; justify-content: flex-start; }
.pill-btn {
  border: 2px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .08); color: #fff;
  border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 700; font-size: .85rem;
  transition: background .2s, transform .2s;
}
.pill-btn:hover { background: rgba(255, 255, 255, .2); transform: rotate(-2deg) scale(1.04); }
.when-night { display: none; }
:root[data-theme="night"] .when-night { display: inline; }
:root[data-theme="night"] .when-day { display: none; }
.icon-btn { display: none; border: 2px solid rgba(255, 255, 255, .4); background: rgba(255, 255, 255, .1); color: #fff; border-radius: 12px; width: 44px; height: 44px; font-size: 1.3rem; cursor: pointer; }

/* ---------- Ping (mascot) ---------- */
.ping-wrap { position: relative; margin: 12px 4px 0; padding-top: 4px; }
.bubble {
  position: relative;
  background: #fff; color: #2b2118;
  font-family: var(--hand); font-size: 1.22rem; line-height: 1.15;
  padding: 10px 14px; border-radius: 16px;
  border: 3px solid #2b2118;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .3);
  min-height: 64px;
  animation: pop .5s cubic-bezier(.3, 1.8, .5, 1) both;
}
.bubble::after {
  content: ""; position: absolute; left: 42px; bottom: -13px; width: 18px; height: 18px;
  background: #fff; border-right: 3px solid #2b2118; border-bottom: 3px solid #2b2118;
  transform: rotate(45deg);
}
@keyframes pop { from { transform: scale(.7) rotate(-3deg); opacity: 0; } to { transform: none; opacity: 1; } }
.ping { display: block; width: 138px; margin: 8px 0 0 12px; color: var(--yellow); overflow: visible; cursor: pointer; animation: bob 3.4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-6px) rotate(1.5deg); } }
.ping .w { opacity: 0; animation: wave 2.4s infinite; }
.ping .w2 { animation-delay: .35s; } .ping .w3 { animation-delay: .7s; }
@keyframes wave { 0%, 15% { opacity: 0; } 35% { opacity: 1; } 70%, 100% { opacity: 0; } }
.ping .eyes { transform-origin: 80px 80px; animation: blink 5s infinite; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }
.ping.talking .mouth { animation: chat .22s ease-in-out 8; transform-origin: 80px 108px; }
@keyframes chat { 50% { transform: scaleY(1.9); } }
.ping.dance { animation: dance .4s ease-in-out infinite; }
@keyframes dance { 0%,100% { transform: rotate(-12deg) translateY(0); } 50% { transform: rotate(12deg) translateY(-14px); } }

/* ---------- the page ---------- */
.page {
  position: relative;
  min-width: 0; min-height: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .13), transparent 28px),     /* gutter shadow */
    repeating-linear-gradient(0deg, transparent 0 31px, var(--line) 31px 32px),
    var(--paper);
  background-blend-mode: normal;
  border-radius: 14px 22px 22px 14px;
  box-shadow: inset 0 0 0 1px var(--line), -6px 0 0 -2px var(--paper-2), -10px 0 0 -4px var(--line);
  perspective: 2200px;
  overflow: hidden;
  transition: background-color .4s;
}
.page:focus { outline: none; }
.ribbon {
  position: absolute; top: -4px; right: 38px; width: 30px; height: 74px; z-index: 5;
  background: var(--coral);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
  box-shadow: 0 6px 10px rgba(0, 0, 0, .25);
  animation: ribbon 3s ease-in-out infinite; transform-origin: top;
}
@keyframes ribbon { 0%,100% { transform: rotate(-1.5deg); } 50% { transform: rotate(2deg); } }

.page-scroll { height: 100%; overflow-y: auto; overflow-x: hidden; padding: 38px clamp(22px, 4vw, 64px) 30px 52px; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: var(--coral) transparent; }
.page-inner { transform-origin: left center; backface-visibility: hidden; }
.page-inner.out-fwd  { animation: outFwd .32s cubic-bezier(.5, 0, .9, .4) forwards; }
.page-inner.in-fwd   { animation: inFwd .42s cubic-bezier(.2, .8, .3, 1) both; }
.page-inner.out-back { animation: outBack .3s ease-in forwards; }
.page-inner.in-back  { animation: inBack .42s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes outFwd { to { transform: rotateY(-70deg) skewY(2deg); opacity: 0; filter: brightness(.7); } }
@keyframes inFwd { from { transform: translateX(34px) rotateY(8deg); opacity: 0; } }
@keyframes outBack { to { transform: translateX(40px) rotateY(10deg); opacity: 0; } }
@keyframes inBack { from { transform: rotateY(-60deg); opacity: 0; filter: brightness(.7); } }

/* page-turn bookmark curl in the bottom-right corner */
.page::after {
  content: ""; position: absolute; right: 0; bottom: 0; width: 54px; height: 54px; pointer-events: none;
  background: linear-gradient(315deg, var(--leather) 0 50%, var(--paper-2) 50% 100%);
  border-top-left-radius: 14px; box-shadow: -3px -3px 8px rgba(0, 0, 0, .2);
  transition: width .3s, height .3s;
}

/* ---------- typography ---------- */
h1, h2, h3 { font-family: var(--serif); line-height: 1.12; letter-spacing: -.015em; margin: 0; }
.chapter-head { margin-bottom: 14px; }
.chapter-no { margin: 0 0 4px; font-family: var(--hand); font-size: 1.7rem; color: var(--coral); transform: rotate(-2deg); display: inline-block; }
.chapter-head h1 { font-size: clamp(2rem, 4.2vw, 3.3rem); font-weight: 900; }
.chapter-head h1::after { content: ""; display: block; width: 120px; height: 10px; margin-top: 10px; border-radius: 99px; background: var(--yellow); transform: rotate(-1deg); animation: grow .8s .2s cubic-bezier(.2, 1, .3, 1) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0) rotate(-1deg); } }
.lead { font-family: var(--serif); font-size: clamp(1.15rem, 2vw, 1.45rem); font-weight: 500; font-style: italic; color: var(--ink); margin: 14px 0 20px; max-width: 46ch; }
.sec { font-size: 1.7rem; margin: 38px 0 14px; display: flex; align-items: baseline; gap: 10px; }
.sec small { font-family: var(--hand); font-size: 1.2rem; font-weight: 500; color: var(--ink-soft); }
.sec::before { content: "§"; color: var(--coral); font-weight: 900; }
.prose p { max-width: 62ch; margin: 0 0 1em; }
.prose p:first-child::first-letter { font-family: var(--serif); font-weight: 900; font-size: 3.4em; float: left; line-height: .85; padding: 4px 10px 0 0; color: var(--coral); }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--coral); color: #fff; text-decoration: none; font-weight: 800;
  padding: 12px 22px; border-radius: 999px; border: 3px solid var(--ink); cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .15s, box-shadow .15s;
  position: relative; overflow: hidden;
}
.btn:hover { transform: translate(-2px, -2px) rotate(-1deg); box-shadow: 7px 7px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn span { transition: transform .2s; }
.btn:hover span { transform: translateX(4px); }
.btn.ghost { background: var(--paper); color: var(--ink); }
.btn.small { padding: 8px 16px; font-size: .9rem; box-shadow: 3px 3px 0 var(--ink); }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin: 22px 0 6px; }

/* ---------- reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(26px) scale(.98); transition: opacity .6s ease, transform .7s cubic-bezier(.2, .9, .3, 1.1); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- tilt cards ---------- */
.tilt { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .15s ease-out; will-change: transform; }
.js .reveal.tilt { transition: opacity .6s ease, transform .15s ease-out; }
.js .reveal.tilt:not(.in) { transform: translateY(26px) scale(.98); }

/* ---------- COVER ---------- */
.cover { display: grid; grid-template-columns: minmax(250px, 360px) 1fr; gap: clamp(22px, 4vw, 48px); align-items: center; min-height: 58vh; }
.cover-card {
  position: relative; aspect-ratio: 3 / 4; border-radius: 10px 24px 24px 10px;
  padding: 26px 24px; color: #fff;
  background: linear-gradient(150deg, var(--leather), var(--leather-2));
  border: 4px solid var(--ink);
  box-shadow: 10px 12px 0 rgba(0, 0, 0, .22), inset 10px 0 0 rgba(0, 0, 0, .25), inset 14px 0 0 rgba(255, 255, 255, .06);
  display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
}
:root[data-theme="night"] .cover-card { background: linear-gradient(150deg, #3b2f78, #231b4f); }
.cover-card::before { content: ""; position: absolute; inset: 12px 12px 12px 22px; border: 2px dashed rgba(255, 216, 77, .55); border-radius: 6px 16px 16px 6px; pointer-events: none; }
.cover-vol { margin: 0; font-family: var(--hand); font-size: 1.35rem; color: var(--yellow); padding-left: 10px; }
.cover-card .kicker { display: none; }
.cover-title { margin: 0; padding-left: 10px; }
.ct-small { display: block; font-family: var(--hand); font-size: 1.7rem; color: var(--yellow); font-weight: 500; }
.ct-name { display: block; font-size: clamp(2.2rem, 4.4vw, 3.3rem); font-weight: 900; line-height: .95; text-shadow: 3px 3px 0 rgba(0, 0, 0, .3); }
.cover-sub { margin: 0; padding-left: 10px; font-size: .95rem; opacity: .92; }
.cover-sub .dot { margin: 0 6px; color: var(--yellow); }
.cover-radio { position: absolute; right: 22px; top: 22px; width: 56px; height: 56px; }
.cover-radio i { position: absolute; inset: 0; border: 3px solid var(--yellow); border-radius: 50%; opacity: 0; animation: ring 3s infinite; }
.cover-radio i:nth-child(2) { animation-delay: .6s; } .cover-radio i:nth-child(3) { animation-delay: 1.2s; } .cover-radio i:nth-child(4) { animation-delay: 1.8s; } .cover-radio i:nth-child(5) { animation-delay: 2.4s; }
@keyframes ring { 0% { transform: scale(.1); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }

.headline { font-size: clamp(1.9rem, 3.6vw, 3rem); font-weight: 900; }
.typed { font-size: 1.3rem; margin: 16px 0 10px; font-weight: 700; min-height: 2em; }
.typed-text { color: var(--coral); font-family: var(--mono); font-weight: 600; background: linear-gradient(transparent 60%, color-mix(in srgb, var(--yellow) 70%, transparent) 60%); padding: 0 4px; }
.caret { animation: caret 1s steps(2) infinite; color: var(--coral); font-weight: 300; }
@keyframes caret { 50% { opacity: 0; } }
.intro { max-width: 52ch; color: var(--ink-soft); }
.kicker { font-family: var(--hand); font-size: 1.5rem; color: var(--coral); margin: 0 0 6px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin: 34px 0 10px; }
.stat { background: var(--card); border: 3px solid var(--ink); border-radius: 18px; padding: 14px 16px; box-shadow: 4px 4px 0 var(--ink); text-align: center; }
.stat:nth-child(odd) { transform: rotate(-1.2deg); } .stat:nth-child(even) { transform: rotate(1.2deg); }
.stat b { display: block; font-family: var(--serif); font-size: 2.4rem; font-weight: 900; color: var(--violet); line-height: 1; }
.stat span { font-size: .85rem; color: var(--ink-soft); }
.howto { margin-top: 28px; background: color-mix(in srgb, var(--yellow) 35%, var(--paper)); border: 3px dashed var(--ink); border-radius: 18px; padding: 16px 22px; transform: rotate(-.6deg); }
.howto h3 { font-family: var(--hand); font-size: 1.7rem; font-weight: 700; }
.howto ul { margin: 6px 0 0; padding-left: 20px; }
.howto li { margin: 3px 0; }

/* ---------- ABOUT ---------- */
.fact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.fact { background: var(--card); border: 3px solid var(--ink); border-radius: 18px; padding: 16px 18px; box-shadow: 5px 5px 0 var(--ink); }
.fact:nth-child(3n+1) { box-shadow: 5px 5px 0 var(--coral); } .fact:nth-child(3n+2) { box-shadow: 5px 5px 0 var(--teal); } .fact:nth-child(3n) { box-shadow: 5px 5px 0 var(--violet); }
.fact-icon { font-size: 1.8rem; display: inline-block; transition: transform .3s cubic-bezier(.3, 1.8, .5, 1); }
.fact:hover .fact-icon { transform: scale(1.3) rotate(-10deg); }
.fact h3 { font-size: 1.05rem; margin: 4px 0 2px; }
.fact p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.edu { list-style: none; padding: 0; margin: 0; border-left: 4px solid var(--teal); }
.edu li { display: flex; flex-direction: column; padding: 4px 0 18px 20px; position: relative; }
.edu li::before { content: ""; position: absolute; left: -11px; top: 6px; width: 18px; height: 18px; border-radius: 50%; background: var(--paper); border: 4px solid var(--teal); }
.edu b { font-family: var(--serif); font-size: 1.15rem; }
.edu em { font-family: var(--mono); font-size: .8rem; color: var(--coral); font-style: normal; }

/* ---------- WORK / timeline ---------- */
.timeline { list-style: none; margin: 26px 0 0; padding: 0 0 0 30px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 4px; background: repeating-linear-gradient(180deg, var(--ink) 0 8px, transparent 8px 14px); opacity: .45; }
.tl-item { position: relative; margin-bottom: 22px; }
.tl-dot { position: absolute; left: -29px; top: 16px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); border: 4px solid var(--violet); z-index: 1; }
.tl-item.now .tl-dot { background: var(--coral); border-color: var(--ink); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 93, 71, .65); } 100% { box-shadow: 0 0 0 16px rgba(255, 93, 71, 0); } }
.tl-card { position: relative; background: var(--card); border: 3px solid var(--ink); border-radius: 18px; padding: 16px 20px; box-shadow: 5px 5px 0 var(--ink); }
.tl-item.now .tl-card { box-shadow: 6px 6px 0 var(--coral); }
.tl-card h3 { font-size: 1.3rem; }
.tl-when { margin: 0 0 4px; font-family: var(--mono); font-size: .78rem; color: var(--violet); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tl-org { margin: 2px 0 8px; color: var(--ink-soft); }
.tl-card ul { margin: 0; padding-left: 20px; }
.tl-card li { margin: 4px 0; }
.badge { position: absolute; top: -14px; right: 16px; background: var(--yellow); color: #2b2118; border: 3px solid var(--ink); font-family: var(--hand); font-size: 1.2rem; padding: 0 12px; border-radius: 999px; transform: rotate(3deg); }

/* ---------- PROJECTS / flip cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; margin-top: 18px; }
.flip { perspective: 1200px; height: 340px; cursor: pointer; outline-offset: 6px; }
.flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .75s cubic-bezier(.3, 1.3, .4, 1); }
.flip.is-flipped .flip-inner { transform: rotateY(180deg); }
@media (hover: hover) { .flip:hover:not(.is-flipped) .flip-inner { transform: rotateY(14deg) rotateX(4deg) translateY(-4px); } }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 3px solid var(--ink); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; box-shadow: 6px 6px 0 var(--ink); }
.flip-face.front { color: #2b2118; }
.flip-face.back { transform: rotateY(180deg); background: var(--card); justify-content: space-between; }
.flip.coral .front { background: #ff9b8c; } .flip.teal .front { background: #7be0d4; } .flip.violet .front { background: #b8a8ff; } .flip.yellow .front { background: #ffe58a; }
.flip-emoji { font-size: 3rem; display: block; margin-bottom: 10px; }
.flip .front h3 { font-size: 1.5rem; }
.flip .front p { margin: 10px 0 0; font-weight: 700; }
.flip-hint { margin-top: auto; font-family: var(--hand); font-size: 1.3rem; }
.details { margin: 0 0 10px; font-size: .96rem; }
.tags { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-family: var(--mono); font-size: .72rem; padding: 3px 9px; border-radius: 999px; border: 2px solid var(--ink); background: var(--paper-2); }

/* ---------- RESEARCH ---------- */
.paper-list { display: grid; gap: 16px; }
.paper { display: flex; gap: 16px; align-items: flex-start; background: var(--card); border: 3px solid var(--ink); border-radius: 18px; padding: 16px 20px; box-shadow: 5px 5px 0 var(--ink); }
.paper-emoji { font-size: 2.4rem; }
.paper h3 { font-size: 1.15rem; }
.paper-sub { margin: 4px 0 0; font-family: var(--mono); font-size: .8rem; color: var(--coral); }
.paper p:last-child { margin: 6px 0 0; color: var(--ink-soft); }
.trophies { display: flex; flex-wrap: wrap; gap: 16px; }
.trophy { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border: 3px solid var(--ink); border-radius: 999px; background: linear-gradient(135deg, var(--yellow), #ffb84d); color: #2b2118; box-shadow: 4px 4px 0 var(--ink); transition: transform .25s; }
.trophy span { font-size: 2rem; }
.trophy:hover { transform: rotate(-3deg) scale(1.05); }
.trophy:hover span { animation: wiggle .5s; }
@keyframes wiggle { 25% { transform: rotate(-18deg); } 75% { transform: rotate(18deg); } }
.cert-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.cert-list li { padding: 10px 14px 10px 44px; position: relative; border: 2px solid var(--line); border-radius: 12px; background: var(--card); }
.cert-list li::before { content: "✓"; position: absolute; left: 12px; top: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 900; font-size: .85rem; display: grid; place-items: center; }

/* ---------- SKILLS / COEX toy ---------- */
.coex { background: #14121f; color: #f3ead7; border: 3px solid var(--ink); border-radius: 20px; padding: 16px; box-shadow: 6px 6px 0 var(--violet); }
.coex-bar { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.switch { display: flex; align-items: center; gap: 12px; background: none; border: 0; cursor: pointer; color: inherit; text-align: left; padding: 0; }
.track { position: relative; flex: none; width: 64px; height: 34px; border-radius: 99px; background: #3a3552; border: 3px solid #f3ead7; transition: background .3s; }
.knob { position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #f3ead7; transition: transform .3s cubic-bezier(.3, 1.8, .5, 1), background .3s; }
.switch[aria-checked="true"] .track { background: var(--teal); }
.switch[aria-checked="true"] .knob { transform: translateX(30px); background: #fff; }
.switch-text { display: flex; flex-direction: column; line-height: 1.15; }
.switch-text small { opacity: .6; font-size: .75rem; }
.coex-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-chip { font-family: var(--mono); font-size: .85rem; padding: 5px 12px; border-radius: 99px; border: 2px solid currentColor; }
.stat-chip.ok { color: #6ef0c4; } .stat-chip.bad { color: #ff8a7a; }
.stat-chip b { font-size: 1.05rem; }
#coexCanvas { width: 100%; height: 300px; display: block; border-radius: 12px; background: #0b0a14; }
.coex-caption { margin: 10px 2px 0; font-family: var(--hand); font-size: 1.3rem; color: var(--yellow); min-height: 1.4em; }
.skill-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.skill-group { background: var(--card); border: 3px solid var(--ink); border-radius: 18px; padding: 16px 18px; }
.skill-group h3 { font-size: 1.1rem; margin-bottom: 10px; color: var(--violet); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 4px 12px; border-radius: 99px; border: 2px solid var(--ink); background: var(--paper); font-weight: 700; font-size: .9rem; transition: transform .2s cubic-bezier(.3, 1.8, .5, 1), background .2s; cursor: default; }
.chips li:hover { transform: translateY(-3px) rotate(-3deg); background: var(--yellow); color: #2b2118; }

/* ---------- HOBBIES ---------- */
.sticky-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; margin: 22px 0 10px; }
.sticky { position: relative; background: #fff1a8; color: #2b2118; padding: 28px 20px 22px; transform: rotate(var(--tilt, -2deg)); box-shadow: 8px 10px 0 rgba(0, 0, 0, .15); border-radius: 4px 4px 28px 4px; transition: transform .25s; }
.sticky:nth-child(2) { background: #c9f2ea; } .sticky:nth-child(3) { background: #ffd0c8; }
.sticky:hover { transform: rotate(0) scale(1.04); }
.sticky .pin { position: absolute; top: -12px; left: 50%; font-size: 1.6rem; transform: translateX(-50%) rotate(15deg); }
.sticky-emoji { font-size: 2.2rem; display: block; }
.sticky h3 { font-family: var(--hand); font-size: 1.9rem; font-weight: 700; }
.sticky p { margin: 4px 0 0; }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.lang { perspective: 800px; background: none; border: 0; padding: 0; cursor: pointer; height: 120px; text-align: left; }
.lang-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3, 1.4, .4, 1); }
.lang.flipped .lang-inner { transform: rotateX(180deg); }
.lang-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 3px solid var(--ink); border-radius: 16px; padding: 14px 16px; background: var(--card); box-shadow: 4px 4px 0 var(--ink); display: flex; flex-direction: column; justify-content: center; }
.lang-face b { font-family: var(--serif); font-size: 1.3rem; }
.lang-face small { color: var(--ink-soft); }
.lf-back { transform: rotateX(180deg); background: var(--teal); color: #fff; align-items: center; }
.hello { font-family: var(--serif); font-weight: 900; font-size: 2rem; text-shadow: 2px 2px 0 rgba(0, 0, 0, .25); }
.meter { display: block; height: 10px; border-radius: 99px; border: 2px solid var(--ink); margin-top: 8px; overflow: hidden; background: var(--paper-2); }
.meter i { display: block; height: 100%; background: var(--coral); }

/* ---------- CONTACT ---------- */
.contact-card { position: relative; margin: 10px 0 24px; padding: 30px 28px; background: var(--card); border: 3px solid var(--ink); border-radius: 22px; box-shadow: 8px 8px 0 var(--coral); text-align: center; background-image: repeating-linear-gradient(135deg, transparent 0 18px, color-mix(in srgb, var(--coral) 14%, transparent) 18px 28px); }
.envelope { font-size: 4rem; display: inline-block; animation: bob 3s ease-in-out infinite; }
.contact-note { max-width: 46ch; margin: 6px auto 0; font-size: 1.1rem; }
.contact-card .cta-row { justify-content: center; }
.email-line code { font-family: var(--mono); background: var(--paper-2); border: 2px solid var(--ink); border-radius: 8px; padding: 3px 10px; font-size: .9rem; word-break: break-all; }
.link-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.link-card { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center; text-decoration: none; background: var(--card); border: 3px solid var(--ink); border-radius: 18px; padding: 14px 18px; box-shadow: 5px 5px 0 var(--ink); transition: transform .2s, box-shadow .2s; }
.link-card span { grid-row: span 2; font-size: 2.2rem; }
.link-card b { font-family: var(--serif); font-size: 1.2rem; }
.link-card small { color: var(--ink-soft); }
.link-card:hover { transform: translate(-3px, -3px) rotate(-1deg); box-shadow: 8px 8px 0 var(--violet); }
.the-end { text-align: center; font-family: var(--hand); font-size: 2.4rem; color: var(--coral); margin: 36px 0 0; line-height: 1.1; }
.the-end small { font-size: 1.3rem; color: var(--ink-soft); }

/* ---------- pager ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 46px; padding-top: 18px; border-top: 3px double var(--line); }
.pager-link { display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 8px 16px; border: 3px solid var(--ink); border-radius: 16px; background: var(--card); box-shadow: 4px 4px 0 var(--ink); transition: transform .15s, box-shadow .15s; }
.pager-link small { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-soft); line-height: 1.1; }
.pager-link b { font-family: var(--serif); font-size: 1.05rem; }
.pager-link .arrow { font-size: 1.5rem; font-weight: 900; color: var(--coral); transition: transform .2s; }
.pager-link.next { text-align: right; margin-left: auto; }
a.pager-link:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--coral); }
a.pager-link.next:hover .arrow { transform: translateX(6px); } a.pager-link.prev:hover .arrow { transform: translateX(-6px); }
.pager-link.end { border-style: dashed; box-shadow: none; margin-left: auto; }
.pager-mid { font-family: var(--mono); font-size: .85rem; color: var(--ink-soft); order: 2; }
.colophon { flex-basis: 100%; order: 5; text-align: center; margin: 14px 0 0; font-size: .8rem; color: var(--ink-soft); font-family: var(--mono); }

/* ---------- fx: ripples & confetti ---------- */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.ripple { position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; border: 3px solid var(--coral); animation: rip .8s ease-out forwards; }
.ripple.r2 { border-color: var(--teal); animation-delay: .12s; } .ripple.r3 { border-color: var(--violet); animation-delay: .24s; }
@keyframes rip { from { transform: scale(.2); opacity: 1; } to { transform: scale(6); opacity: 0; } }
.confetti { position: absolute; top: -20px; width: 10px; height: 16px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(900deg); } }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 20px; border-radius: 999px; font-weight: 800; z-index: 60; animation: toast 2.6s forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 20px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* ---------- 404 ---------- */
body.lost { display: grid; place-items: center; padding: 24px; }
.lost-card { position: relative; z-index: 1; max-width: 520px; background: var(--paper); border: 4px solid var(--ink); border-radius: 26px; padding: 34px; text-align: center; box-shadow: 10px 10px 0 var(--coral); animation: bookIn .7s both; }
.lost-code { font-family: var(--serif); font-weight: 900; font-size: 6rem; line-height: 1; margin: 0; color: var(--violet); }
.lost-card h1 { font-size: 2rem; margin-bottom: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .cover { grid-template-columns: 1fr; }
  .cover-card { aspect-ratio: auto; min-height: 280px; max-width: 420px; }
}
@media (max-width: 860px) {
  body { font-size: 16px; }
  .book { height: auto; width: 100%; margin: 0; border-radius: 0; padding: 0; display: block; animation: none; }
  .book::before { display: none; }
  .toc { position: sticky; top: 0; z-index: 30; padding: 10px 14px; background: linear-gradient(145deg, var(--leather), var(--leather-2)); }
  .toc-head { padding: 0; align-items: center; }
  .brand-title { font-size: 1.25rem; } .brand-sub { font-size: 1.05rem; }
  .icon-btn { display: grid; place-items: center; }
  .toc nav, .ping-wrap, .toc-foot { display: none; }
  .toc.open nav, .toc.open .toc-foot { display: block; }
  .toc.open { max-height: 100vh; overflow-y: auto; }
  .toc.open .toc-list { margin-top: 6px; }
  .tab, .tab.active { border-radius: 14px; margin-right: 0; transform: none; }
  .tab.active { box-shadow: 3px 3px 0 rgba(0, 0, 0, .25); }
  .tab:hover { transform: none; }
  .page { border-radius: 0; overflow: visible; }
  .page::after, .ribbon { display: none; }
  .page-scroll { height: auto; overflow: visible; padding: 28px 18px 28px; }
  .flip { height: 360px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
}
