/* ============================================================
   Raushan Zhandayeva — academic site
   Notebook style v3: more character
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --desk:        #e8dec7;
  --paper:       #f7ecce;
  --paper-edge:  #d8c89a;
  --rule-line:   #c5d4e8;
  --margin-red:  #e08585;

  --ink:         #1c2a52;
  --ink-deep:    #0e1a3a;
  --ink-soft:    #3c4a72;
  --pen-red:     #c92a2a;
  --pen-red-soft:#d35b5b;
  --pencil:      #5a5a5a;

  --hl-yellow:        #fff176;
  --hl-yellow-strong: #ffd60a;
  --hl-pink:  #f8bbd0;
  --hl-green: #c5e1a5;
  --hl-blue:  #b3e5fc;
  --hl-orange:#ffcc80;

  --max-width: 920px;
  --hand:  "Caveat", "Bradley Hand", cursive;
  --hand2: "Patrick Hand", "Comic Sans MS", cursive;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.55 0 0 0 0 0.45 0 0 0 0 0.30 0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");

  --paper-tex: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='340' height='340'><filter id='fb'><feTurbulence type='turbulence' baseFrequency='0.035 0.8' numOctaves='2' stitchTiles='stitch' seed='2'/><feColorMatrix values='0 0 0 0 0.40 0 0 0 0 0.30 0 0 0 0 0.18 0 0 0 0.05 0'/></filter><filter id='gn'><feTurbulence type='fractalNoise' baseFrequency='1.3' numOctaves='3' stitchTiles='stitch' seed='5'/><feColorMatrix values='0 0 0 0 0.55 0 0 0 0 0.42 0 0 0 0 0.25 0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23fb)'/><rect width='100%25' height='100%25' filter='url(%23gn)'/></svg>");

  --coffee: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><circle cx='100' cy='100' r='70' fill='none' stroke='%23a55a2c' stroke-width='6' stroke-dasharray='220 60' opacity='0.45'/><circle cx='100' cy='100' r='62' fill='none' stroke='%23a55a2c' stroke-width='3' stroke-dasharray='180 80' opacity='0.35'/></svg>");

  --arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 110'><path d='M10 70 Q 60 10 130 40 T 200 60' fill='none' stroke='%23c92a2a' stroke-width='3' stroke-linecap='round'/><path d='M188 50 L 205 60 L 188 72' fill='none' stroke='%23c92a2a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/></svg>");

  --squiggle: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14'><path d='M2 10 Q 15 2 30 10 T 60 10 T 90 10 T 120 10 T 150 10 T 180 10 T 198 10' fill='none' stroke='%23c92a2a' stroke-width='2.5' stroke-linecap='round'/></svg>");

  --squiggle-divider: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 8'><path d='M2 5 Q 12 1 24 5 T 48 5 T 72 5 T 96 5 T 120 5 T 144 5 T 168 5 T 192 5 T 198 5' fill='none' stroke='%231c2a52' stroke-width='1.2' stroke-opacity='0.4' stroke-linecap='round'/></svg>");
}

html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; }

body {
  background-color: #c6ad6e;
  background-image:
    /* fiber + grain + crinkle wrinkles */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='420' height='420'><filter id='fb'><feTurbulence type='turbulence' baseFrequency='0.018 0.55' numOctaves='2' stitchTiles='stitch' seed='3'/><feColorMatrix values='0 0 0 0 0.40  0 0 0 0 0.28  0 0 0 0 0.14  0 0 0 0.30 0'/></filter><filter id='gn'><feTurbulence type='fractalNoise' baseFrequency='1.0' numOctaves='3' stitchTiles='stitch' seed='6'/><feColorMatrix values='0 0 0 0 0.30  0 0 0 0 0.20  0 0 0 0 0.10  0 0 0 0.22 0'/></filter><filter id='crk'><feTurbulence type='fractalNoise' baseFrequency='0.012' numOctaves='3' stitchTiles='stitch' seed='9'/><feColorMatrix values='0 0 0 0 0.25  0 0 0 0 0.16  0 0 0 0 0.08  0 0 0 0.20 0'/></filter><rect width='100%25' height='100%25' filter='url(%23fb)'/><rect width='100%25' height='100%25' filter='url(%23gn)'/><rect width='100%25' height='100%25' filter='url(%23crk)'/></svg>"),
    /* warm light wash near the top */
    radial-gradient(ellipse 90% 80% at 50% 40%, rgba(255, 240, 200, 0.20), transparent 70%),
    /* darker vignette toward edges */
    radial-gradient(ellipse 100% 100% at 50% 50%, transparent 55%, rgba(80, 60, 30, 0.22)),
    /* visible folder edge band on the left */
    linear-gradient(to right,
      rgba(70, 50, 25, 0.50) 0,
      rgba(70, 50, 25, 0.28) 8px,
      rgba(70, 50, 25, 0.10) 24px,
      transparent 48px),
    /* visible folder edge band on the right */
    linear-gradient(to left,
      rgba(70, 50, 25, 0.50) 0,
      rgba(70, 50, 25, 0.28) 8px,
      rgba(70, 50, 25, 0.10) 24px,
      transparent 48px);
  background-attachment: fixed, fixed, fixed, fixed, fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--hl-yellow); color: var(--ink-deep); }

/* ---------- Hyperlinks: highlighter wipe ---------- */
a {
  color: var(--ink-deep);
  font-weight: 600;
  text-decoration: none;
  background-image: linear-gradient(transparent 50%, var(--hl-yellow) 50%, var(--hl-yellow) 92%, transparent 92%);
  padding: 0 0.12em;
  transition: background-color 0.2s ease, color 0.2s ease;
  word-break: break-word;
}

a:hover,
a:focus-visible {
  background-image: linear-gradient(var(--hl-yellow-strong), var(--hl-yellow-strong));
  color: var(--ink-deep);
  outline: none;
  animation: hl-wipe 0.35s ease-out;
}

@keyframes hl-wipe {
  from { background-size: 0 100%; background-repeat: no-repeat; }
  to   { background-size: 100% 100%; background-repeat: no-repeat; }
}

/* ===== Horizontal fold seam across the manila folder ===== */
body::before {
  content: "";
  position: fixed;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right,
    transparent 0,
    rgba(70, 50, 25, 0.18) 4%,
    rgba(60, 40, 20, 0.42) 50%,
    rgba(70, 50, 25, 0.18) 96%,
    transparent 100%);
  z-index: 0;
  pointer-events: none;
  box-shadow: 0 1px 0 rgba(255, 245, 220, 0.18);
}

/* ===== "Open the folder" entrance animation on the page ===== */
@keyframes folder-open {
  from {
    opacity: 0;
    transform: perspective(900px) rotateX(8deg) translateY(18px);
  }
  to {
    opacity: 1;
    transform: perspective(900px) rotateX(0) translateY(0);
  }
}

.page {
  animation: folder-open 0.55s cubic-bezier(0.4, 0, 0.2, 1) both;
  transform-origin: top center;
}


a:focus-visible { outline: 2px dashed var(--ink); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #c6ad6e;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='420' height='420'><filter id='fb'><feTurbulence type='turbulence' baseFrequency='0.018 0.55' numOctaves='2' stitchTiles='stitch' seed='3'/><feColorMatrix values='0 0 0 0 0.40  0 0 0 0 0.28  0 0 0 0 0.14  0 0 0 0.30 0'/></filter><filter id='gn'><feTurbulence type='fractalNoise' baseFrequency='1.0' numOctaves='3' stitchTiles='stitch' seed='6'/><feColorMatrix values='0 0 0 0 0.30  0 0 0 0 0.20  0 0 0 0 0.10  0 0 0 0.22 0'/></filter><filter id='crk'><feTurbulence type='fractalNoise' baseFrequency='0.012' numOctaves='3' stitchTiles='stitch' seed='9'/><feColorMatrix values='0 0 0 0 0.25  0 0 0 0 0.16  0 0 0 0 0.08  0 0 0 0.20 0'/></filter><rect width='100%25' height='100%25' filter='url(%23fb)'/><rect width='100%25' height='100%25' filter='url(%23gn)'/><rect width='100%25' height='100%25' filter='url(%23crk)'/></svg>"),
    radial-gradient(ellipse 90% 80% at 50% 40%, rgba(255, 240, 200, 0.20), transparent 70%),
    radial-gradient(ellipse 100% 100% at 50% 50%, transparent 55%, rgba(80, 60, 30, 0.22)),
    linear-gradient(to right,
      rgba(70, 50, 25, 0.50) 0,
      rgba(70, 50, 25, 0.28) 8px,
      rgba(70, 50, 25, 0.10) 24px,
      transparent 48px),
    linear-gradient(to left,
      rgba(70, 50, 25, 0.50) 0,
      rgba(70, 50, 25, 0.28) 8px,
      rgba(70, 50, 25, 0.10) 24px,
      transparent 48px);
  background-attachment: fixed, fixed, fixed, fixed, fixed;
  border-bottom: none;
  box-shadow: none;
}

.site-header::before { content: none; }
.site-header::after { content: none; }

.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.6rem 1.5rem 0;
  text-align: center;
}

.site-title {
  font-family: "Permanent Marker", "Caveat", cursive;
  font-weight: 400;
  font-size: clamp(2.4rem, 5.2vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: var(--ink-deep);
  text-decoration: none;
  /* yellow highlighter swatch covering the text */
  background: var(--hl-yellow);
  background-image: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.18) 0,
    rgba(255, 255, 255, 0) 18%,
    rgba(0, 0, 0, 0.04) 88%,
    rgba(0, 0, 0, 0.08) 100%
  );
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.06),
    2px 4px 0 rgba(0, 0, 0, 0.04);
  display: inline-block;
  margin-bottom: 0.4rem;
  padding: 0.18em 0.45em 0.22em;
  transform: rotate(-1.2deg);
  transform-origin: 0 100%;
}

.site-title:hover, .site-title:focus-visible {
  background: var(--hl-yellow);
  color: var(--ink-deep);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  margin-top: 0.6rem;
  margin-bottom: -2px;
  padding-left: 0;
}

.site-nav a {
  font-family: var(--hand2);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-deep);
  background-color: var(--paper);
  /* layered: subtle side shading + light-from-above + very light fiber */
  background-image:
    /* side-edge thickness (very faint vertical shading) */
    linear-gradient(to right,
      rgba(0, 0, 0, 0.04) 0,
      rgba(0, 0, 0, 0) 8%,
      rgba(0, 0, 0, 0) 92%,
      rgba(0, 0, 0, 0.04) 100%),
    /* top highlight + bottom shade */
    linear-gradient(to bottom,
      rgba(255, 255, 255, 0.65) 0,
      rgba(255, 255, 255, 0.25) 10%,
      rgba(255, 255, 255, 0.06) 26%,
      rgba(0, 0, 0, 0) 55%,
      rgba(0, 0, 0, 0.03) 88%,
      rgba(0, 0, 0, 0.06) 100%),
    /* very subtle fiber grain only */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='gn'><feTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='2' stitchTiles='stitch' seed='8'/><feColorMatrix values='0 0 0 0 0.40  0 0 0 0 0.30  0 0 0 0 0.16  0 0 0 0.12 0'/></filter><rect width='100%25' height='100%25' filter='url(%23gn)'/></svg>");
  background-size: auto, auto, 160px 160px;
  background-blend-mode: normal, normal, multiply;
  border: 1.5px solid var(--ink);
  border-bottom: none;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  padding: 0.85rem 1.55rem 1.05rem;
  margin: 0 -3px 0 0;
  text-decoration: none;
  display: inline-block;
  line-height: 1;
  transition: transform 0.18s ease, padding 0.18s ease, box-shadow 0.18s ease;
  animation: none;
  position: relative;
  z-index: 1;
  /* paper thickness + 3D depth: top edge highlight, side hints, bottom shade, lifted drop shadow */
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.78),
    inset 1px 0 0 rgba(255, 255, 255, 0.28),
    inset -1px 0 0 rgba(0, 0, 0, 0.06),
    inset 0 -12px 14px -9px rgba(0, 0, 0, 0.13),
    0 1.5px 0 rgba(0, 0, 0, 0.07),
    0 4px 6px -2px rgba(0, 0, 0, 0.10),
    0 9px 16px -5px rgba(0, 0, 0, 0.12);
}

/* tiny "tab fold" highlight at the very top — paper catches light along its top edge */
.site-nav a::before {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: -1px;
  height: 4px;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0));
  pointer-events: none;
  z-index: 1;
}

/* each tab a different pastel — like color-coded folder tabs */
.site-nav a:nth-of-type(1) { background-color: var(--hl-yellow); z-index: 6; }
.site-nav a:nth-of-type(2) { background-color: var(--hl-pink);   z-index: 5; }
.site-nav a:nth-of-type(3) { background-color: var(--hl-green);  z-index: 4; }
.site-nav a:nth-of-type(4) { background-color: var(--hl-blue);   z-index: 3; }
.site-nav a:nth-of-type(5) { background-color: var(--hl-orange); z-index: 2; }
.site-nav a:nth-of-type(6) { background-color: #d6c4f0;          z-index: 1; }

.site-nav a:hover, .site-nav a:focus-visible {
  transform: translateY(-3px);
  outline: none;
  text-decoration: none;
  color: var(--ink-deep);
  animation: none;
  z-index: 8;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.82),
    inset 1px 0 0 rgba(255, 255, 255, 0.32),
    inset -1px 0 0 rgba(0, 0, 0, 0.06),
    inset 0 -12px 14px -9px rgba(0, 0, 0, 0.13),
    0 2px 0 rgba(0, 0, 0, 0.08),
    0 7px 11px -3px rgba(0, 0, 0, 0.16),
    0 14px 20px -6px rgba(0, 0, 0, 0.16);
}

/* active tab — sticks up taller, reads as the "current divider" out front
   and gets a subtle dark wash so it reads slightly muted (like the sheet you've pulled up) */
.site-nav a[aria-current="page"] {
  font-weight: 800;
  padding-top: 1.2rem;
  padding-bottom: 1.15rem;
  color: var(--ink-deep);
  z-index: 9;
  border-width: 2px;
  box-shadow:
    inset 0 2.5px 0 rgba(255, 255, 255, 0.55),
    inset 1px 0 0 rgba(255, 255, 255, 0.20),
    inset -1px 0 0 rgba(0, 0, 0, 0.10),
    inset 0 0 0 1000px rgba(0, 0, 0, 0.20),
    inset 0 -14px 18px -10px rgba(0, 0, 0, 0.18),
    0 2.5px 0 rgba(0, 0, 0, 0.10),
    0 6px 10px -3px rgba(0, 0, 0, 0.18),
    0 12px 18px -6px rgba(0, 0, 0, 0.16);
}

/* ---------- Page shell ---------- */
.page {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 1.5rem auto;
  min-height: calc(100vh - 10rem);
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 31px,
      var(--rule-line) 31px,
      var(--rule-line) 32px
    ),
    radial-gradient(ellipse 75% 60% at 50% 40%, rgba(255, 252, 240, 0.55), transparent 75%),
    radial-gradient(circle at 100% 50%, rgba(120, 100, 60, 0.06), transparent 25%),
    radial-gradient(circle at 0% 50%, rgba(120, 100, 60, 0.04), transparent 20%),
    var(--paper-tex);
  background-position: 0 1.5rem, 0 0, 0 0, 0 0, 0 0;
  border: 1px solid var(--paper-edge);
  box-shadow:
    0 18px 38px -10px rgba(0, 0, 0, 0.22),
    0 6px 14px -2px rgba(0, 0, 0, 0.10),
    inset 0 0 30px rgba(0, 0, 0, 0.025);
}

/* Red margin line */
.page::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 4rem;
  width: 0;
  border-left: 1.5px solid var(--margin-red);
  pointer-events: none;
  z-index: 0;
}

/* Spiral binding — wire wraps around the page edge and threads through punched holes */
.page::after {
  content: "";
  position: absolute;
  top: 22px;
  bottom: 22px;
  left: -28px;
  width: 52px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='52' height='40' viewBox='0 0 52 40'><defs><radialGradient id='h' cx='50%25' cy='35%25' r='65%25'><stop offset='0%25' stop-color='%23080b14'/><stop offset='55%25' stop-color='%23131826'/><stop offset='100%25' stop-color='%23232a3c'/></radialGradient><linearGradient id='w' x1='0%25' y1='0%25' x2='0%25' y2='100%25'><stop offset='0%25' stop-color='%233a3f4d'/><stop offset='28%25' stop-color='%239ea2ad'/><stop offset='52%25' stop-color='%23eef0f5'/><stop offset='75%25' stop-color='%239ea2ad'/><stop offset='100%25' stop-color='%233a3f4d'/></linearGradient><radialGradient id='hl' cx='50%25' cy='15%25' r='55%25'><stop offset='0%25' stop-color='rgba(255,255,255,0.20)'/><stop offset='100%25' stop-color='rgba(255,255,255,0)'/></radialGradient></defs><path d='M 28 12 Q 0 20 28 28 Q 33 26 40 23' fill='none' stroke='rgba(0,0,0,0.34)' stroke-width='4.8' stroke-linecap='round' transform='translate(0.7,1.6)'/><path d='M 28 12 Q 0 20 28 28 Q 33 26 40 23' fill='none' stroke='url(%23w)' stroke-width='3.2' stroke-linecap='round'/><path d='M 28 12 Q 14 14 6 20' fill='none' stroke='%23fbfcfe' stroke-width='1' stroke-linecap='round' transform='translate(0,-0.7)' opacity='0.55'/><ellipse cx='40' cy='20.6' rx='6.7' ry='6.5' fill='rgba(0,0,0,0.22)' transform='translate(0.6,1.4)'/><circle cx='40' cy='20' r='6.5' fill='url(%23h)' stroke='%23000' stroke-width='0.5'/><circle cx='40' cy='20' r='6.5' fill='none' stroke='rgba(0,0,0,0.55)' stroke-width='1' opacity='0.75'/><line x1='40' y1='14' x2='40' y2='23' stroke='url(%23w)' stroke-width='2.4' stroke-linecap='round' opacity='0.6'/><circle cx='40' cy='20' r='6.5' fill='url(%23hl)'/><ellipse cx='40' cy='15' rx='4.5' ry='0.9' fill='rgba(255,255,255,0.08)'/></svg>");
  background-size: 52px 40px;
  background-repeat: repeat-y;
  pointer-events: none;
}

/* Dog-eared corner (decorative wrapper) — grows to fill page height */
.page-content {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.page-content > main {
  flex: 1;
}

.page-content::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 44px;
  height: 44px;
  background:
    linear-gradient(135deg,
      transparent 0,
      transparent 50%,
      var(--paper-edge) 50%,
      var(--paper) 52%,
      var(--paper) 100%);
  box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.08);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  pointer-events: none;
}

/* Date stamp + sticky-note pin (top right) */
.page-meta {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 3;
  text-align: right;
  pointer-events: none;
}

.date-stamp {
  display: inline-block;
  font-family: var(--hand);
  font-size: 1.3rem;
  color: var(--pen-red-soft);
  transform: rotate(2deg);
  border-bottom: 1.5px solid var(--pen-red-soft);
  padding: 0 0.35rem 0.05rem;
  line-height: 1;
}

.sticky-note {
  position: absolute;
  top: 8px;
  right: 22px;
  width: 150px;
  padding: 14px 14px 16px;
  background: var(--hl-yellow);
  font-family: var(--hand2);
  font-size: 0.95rem;
  color: var(--ink-deep);
  box-shadow:
    2px 4px 10px rgba(0, 0, 0, 0.18),
    inset 0 0 20px rgba(255, 220, 0, 0.3);
  transform: rotate(var(--rot, 4deg));
  transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.3, 1),
              box-shadow 0.32s cubic-bezier(0.2, 0.7, 0.3, 1);
  z-index: 4;
  line-height: 1.35;
  transform-origin: top center;
}

@media (hover: hover) {
  .sticky-note:hover {
    transform: rotate(calc(var(--rot, 4deg) - 1.5deg)) translate(-3px, -6px) scale(1.03);
    box-shadow:
      6px 14px 22px rgba(0, 0, 0, 0.22),
      2px 4px 10px rgba(0, 0, 0, 0.10),
      inset 0 0 20px rgba(255, 220, 0, 0.35);
    z-index: 6;
  }
}

.sticky-note::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  width: 14px;
  height: 14px;
  background: radial-gradient(circle at 35% 35%, #ff8a80 0, #c62828 70%, #7f0000 100%);
  border-radius: 50%;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
}

.sticky-note .sticky-title {
  display: block;
  font-family: var(--hand);
  font-size: 1.25rem;
  color: var(--pen-red);
  margin-bottom: 0.2rem;
  line-height: 1;
}

main {
  padding: 3rem 1.5rem 4.5rem 6.5rem;
  position: relative;
  z-index: 1;
}

main > * { position: relative; z-index: 1; }

/* ---------- Headings ---------- */
h1.page-title {
  font-family: var(--hand);
  font-weight: 700;
  font-size: clamp(3.4rem, 7vw, 4.8rem);
  line-height: 1;
  letter-spacing: 0;
  color: var(--ink-deep);
  margin-bottom: 1.2rem;
  display: table;
  position: relative;
  transform: rotate(-1.5deg);
}

h1.page-title::after {
  content: "";
  position: absolute;
  left: 0.3em;
  right: 0.3em;
  bottom: -0.18em;
  height: 14px;
  background: var(--squiggle) center/200px 14px repeat-x;
  opacity: 0.8;
  pointer-events: none;
}

h2 {
  font-family: var(--hand);
  font-weight: 700;
  font-size: clamp(1.9rem, 3.5vw, 2.4rem);
  line-height: 1.1;
  margin: 2.6rem 0 1rem;
  color: var(--ink-deep);
  display: table;
  background: linear-gradient(transparent 55%, var(--hl-blue) 55%, var(--hl-blue) 92%, transparent 92%);
  padding: 0 0.35em 0 0.2em;
  border-bottom: none;
  transform: rotate(-0.5deg);
  position: relative;
}

/* alternate highlighter colors per section */
h2:nth-of-type(2) { background: linear-gradient(transparent 55%, var(--hl-pink) 55%, var(--hl-pink) 92%, transparent 92%); }
h2:nth-of-type(3) { background: linear-gradient(transparent 55%, var(--hl-green) 55%, var(--hl-green) 92%, transparent 92%); }
h2:nth-of-type(4) { background: linear-gradient(transparent 55%, var(--hl-orange) 55%, var(--hl-orange) 92%, transparent 92%); }


h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.4;
  margin-bottom: 0.25rem;
  color: var(--ink-deep);
}

p { margin-bottom: 1.1rem; color: var(--ink); }
p:last-child { margin-bottom: 0; }
em { font-style: italic; }
strong { font-weight: 700; color: var(--ink-deep); }

ul.plain { list-style: none; }
ul.plain li { margin-bottom: 0.55rem; color: var(--ink); }

/* ---------- About: polaroid + arrow doodle + coffee stain ---------- */
.about-wrap {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 2.75rem;
  align-items: start;
  margin-top: 1.5rem;
  position: relative;
}

.about-left {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

/* Quick-facts card under the polaroid */
.quick-facts {
  position: relative;
  font-family: var(--hand2);
  margin-top: 0.2rem;
}

.quick-facts__title {
  font-family: var(--hand);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink-deep);
  margin: 0 0 0.6rem 0.3rem;
  display: inline-block;
  background: linear-gradient(transparent 55%, var(--hl-yellow) 55%, var(--hl-yellow) 92%, transparent 92%);
  padding: 0 0.35em;
  transform: rotate(-1.5deg);
}

.quick-facts ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.quick-facts li {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
  font-size: 1rem;
  color: var(--ink-deep);
  line-height: 1.3;
}

.fact-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}

.quick-facts li:nth-child(1) .fact-icon { color: var(--pen-red); }
.quick-facts li:nth-child(2) .fact-icon { color: #2a4a8e; }
.quick-facts li:nth-child(3) .fact-icon { color: #7a3a8a; }
.quick-facts li:nth-child(4) .fact-icon { color: #1f7a4d; }
.quick-facts li:nth-child(5) .fact-icon { color: #c97a1a; }

.quick-facts li strong {
  display: block;
  font-family: var(--hand2);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--pen-red);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.05rem;
}

.quick-facts li:nth-child(2) strong { color: #2a4a8e; }
.quick-facts li:nth-child(3) strong { color: #7a3a8a; }
.quick-facts li:nth-child(4) strong { color: #1f7a4d; }
.quick-facts li:nth-child(5) strong { color: #c97a1a; }

.about-photo-frame {
  position: relative;
  padding: 12px 12px 14px;
  background: #fff;
  box-shadow: 1px 3px 10px rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.1);
  transform: rotate(-3deg);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Polaroid hover shake — like a hand bumping the photo */
@keyframes polaroidShake {
  0%   { transform: rotate(-3deg); }
  15%  { transform: rotate(-1.5deg) translate(2px, -1px); }
  30%  { transform: rotate(-4.2deg) translate(-2px, 1px); }
  45%  { transform: rotate(-2deg)   translate(2px, -1px); }
  60%  { transform: rotate(-3.6deg) translate(-1px, 1px); }
  78%  { transform: rotate(-2.6deg) translate(1px, 0); }
  100% { transform: rotate(-3deg); }
}

@media (hover: hover) {
  .about-photo-frame:hover {
    animation: polaroidShake 0.55s ease-in-out;
  }
}

.about-photo-frame:hover { animation: polaroid-wiggle 0.6s ease-in-out; }

@keyframes polaroid-wiggle {
  0%   { transform: rotate(-3deg); }
  25%  { transform: rotate(0.5deg) translateY(-2px); }
  50%  { transform: rotate(-3.5deg); }
  75%  { transform: rotate(-1deg); }
  100% { transform: rotate(-3deg); }
}

.about-photo-frame::before,
.about-photo-frame::after {
  content: "";
  position: absolute;
  top: -10px;
  width: 70px;
  height: 22px;
  background: rgba(255, 235, 100, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.06);
  z-index: 2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.about-photo-frame::before { left: 14px;  transform: rotate(-5deg); }
.about-photo-frame::after  { right: 14px; transform: rotate(5deg); }

.about-photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  background: #f1f1f1;
  object-fit: cover;
  display: block;
  filter: grayscale(15%) sepia(8%);
}

.about-photo--placeholder {
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  font-family: var(--hand2);
  font-size: 0.95rem;
  color: var(--pencil);
  padding: 1rem;
  filter: none;
}

.polaroid-caption {
  position: absolute;
  bottom: 14px; left: 0; right: 0;
  text-align: center;
  font-family: var(--hand);
  font-size: 1.5rem;
  color: var(--ink-deep);
  line-height: 1;
  transform: rotate(-1deg);
}

/* hand-drawn arrow doodle — points from text to polaroid */
.about-arrow {
  position: absolute;
  top: 30px;
  left: 240px;
  width: 130px;
  height: 80px;
  background: var(--arrow) center/contain no-repeat;
  transform: rotate(8deg) scaleX(-1);
  pointer-events: none;
  opacity: 0.85;
}

.about-arrow-label {
  position: absolute;
  top: 0;
  left: 290px;
  font-family: var(--hand);
  font-size: 1.45rem;
  color: var(--pen-red);
  transform: rotate(-3deg);
  pointer-events: none;
}

/* coffee ring */
.coffee-ring {
  position: absolute;
  width: 130px;
  height: 130px;
  background: var(--coffee) center/contain no-repeat;
  pointer-events: none;
  z-index: 0;
}

@media (max-width: 720px) {
  /* layout: tighter side padding so content has room next to the binding */
  .about-wrap { grid-template-columns: 1fr; gap: 1.6rem; }
  .about-photo-frame { max-width: 240px; }
  main { padding: 2rem 1.1rem 3.5rem 4.2rem; }
  .page { margin: 1rem auto; }
  .page::before { left: 2rem; }
  .page::after  { left: -20px; width: 38px; background-size: 38px 32px; }
  .site-header__inner { padding: 1.1rem 1rem 0; }
  .about-arrow, .about-arrow-label { display: none; }

  /* nav: comfortable tap targets, smaller font, tabs touch each other */
  .site-nav { gap: 0; margin-top: 0.5rem; }
  .site-nav a {
    font-size: 0.95rem;
    padding: 0.6rem 0.8rem 0.7rem;
    margin: 0 -2px 0 0;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
  }
  .site-nav a[aria-current="page"] {
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
  }

  /* site title — much smaller on mobile so it fits one line, marker font is wide */
  .site-title {
    font-size: 1.7rem;
    padding: 0.16em 0.4em 0.2em;
  }

  /* page title (h1 inside main) — smaller on mobile */
  h1.page-title { font-size: 2.6rem; }

  /* sticky notes — smaller, tucked corners */
  .sticky-note {
    width: 110px;
    font-size: 0.78rem;
    padding: 10px 8px 12px;
    top: 8px;
    right: 10px;
  }
  .sticky-note.welcome-note {
    width: 96px;
    padding: 12px 8px 10px;
  }
  .welcome-text { font-size: 1.3rem; }
  /* contact-page sticky: pin to bottom of page so it can't overlap email/links */
  .sticky-note.bottom-right {
    top: auto;
    bottom: 50px;
    right: 14px;
    width: 100px;
    font-size: 0.74rem;
  }

  /* doodles smaller and slightly faded so they don't fight content */
  .scribble {
    transform: rotate(var(--rot, 0deg)) scale(0.82);
    opacity: 0.65;
  }

  /* doc viewer (cv/resume) — replace iframe with two PDF-link buttons on mobile.
     Use higher specificity so we win against the baseline rules later in the file. */
  .doc-mobile { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
  .doc-viewer .doc-control { display: none; }
  .doc-viewer .doc-frame { display: none; }

  /* contact list — stack the blue label above the link on mobile (higher specificity) */
  .page .contact-list strong {
    display: block;
    margin-right: 0;
    margin-bottom: 0.2rem;
    min-width: 0;
  }
  .page .contact-list li {
    margin-bottom: 1.25rem;
  }

  /* sticky note on contact: pin to bottom of page (higher specificity beats the baseline) */
  .page .sticky-note.bottom-right {
    top: auto;
    bottom: 50px;
    right: 14px;
    width: 100px;
    font-size: 0.74rem;
  }
}

/* very small phones (≤ 420px) — iPhone SE, narrow Androids */
@media (max-width: 420px) {
  main { padding: 1.6rem 0.85rem 3rem 3.5rem; }
  .page::before { left: 1.5rem; }
  .page::after  { left: -16px; width: 32px; background-size: 32px 32px; }
  .site-header__inner { padding: 0.85rem 0.7rem 0; }

  .site-title {
    font-size: 1.4rem;
    padding: 0.14em 0.36em 0.18em;
  }
  h1.page-title { font-size: 2.2rem; }
  .site-nav a {
    font-size: 0.85rem;
    padding: 0.5rem 0.6rem 0.6rem;
  }
  .site-nav a[aria-current="page"] {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
  }

  /* hide all but the most minimal scribbles on tiny screens */
  .scribble:not(.scribble--book):not(.scribble--coffee):not(.scribble--asterisk) {
    display: none;
  }

  /* even smaller stickies */
  .sticky-note      { width: 90px;  font-size: 0.72rem; padding: 8px 6px 10px; }
  .sticky-note.welcome-note { width: 80px; padding: 10px 6px 8px; }
  .welcome-text     { font-size: 1.05rem; }
  .page .sticky-note.bottom-right { width: 88px; top: auto; bottom: 40px; right: 10px; font-size: 0.7rem; }

  /* page title slightly smaller */
  h1.page-title { font-size: clamp(2.4rem, 10vw, 3rem); }

  /* doc-frame already hidden via 720px breakpoint; keep buttons in place */
}

/* ---------- Item lists ---------- */
.item-list {
  list-style: none;
  margin-top: 0.5rem;
  counter-reset: notebook-item;
}

.item-list li {
  padding: 1.1rem 0 1.4rem;
  border-bottom: none;
  color: var(--ink);
  position: relative;
  counter-increment: notebook-item;
}

.item-list li::marker { content: ""; }

/* Handwritten numbered counter — sits between the red margin line and the text */
.item-list li::before {
  content: counter(notebook-item) ".";
  position: absolute;
  left: -1.9rem;
  top: 1.25rem;
  font-family: var(--hand);
  font-weight: 700;
  font-size: 1.55rem;
  color: var(--pen-red);
  line-height: 1;
  width: 1.5rem;
  text-align: right;
  pointer-events: none;
}

/* Featured items already have margin note — hide the counter there */
.item-list li.featured::before { content: none; }

.item-list li:last-child { padding-bottom: 0.8rem; }

@media (max-width: 720px) {
  .item-list li::before { left: -1.5rem; font-size: 1.2rem; width: 1.2rem; }
}

.item-list .title {
  display: block;
  font-weight: 700;
  color: var(--ink-deep);
  margin-bottom: 0.15rem;
  font-size: 1.05rem;
}

.item-list .meta {
  display: block;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.97rem;
}

.item-list .authors {
  display: block;
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 0.15rem;
}

.item-list .links {
  display: block;
  font-size: 0.93rem;
  margin-top: 0.5rem;
}

/* Featured item — used as a positioning anchor for marginalia */
.item-list .featured { position: relative; }

.item-list .marginalia {
  position: absolute;
  left: -8rem;
  top: 1.3rem;
  font-family: var(--hand);
  font-size: 1.3rem;
  color: var(--pen-red);
  transform: rotate(-6deg);
  width: 5rem;
  text-align: right;
  line-height: 1.05;
  pointer-events: none;
}

@media (max-width: 720px) {
  .item-list .marginalia { display: none; }
}

/* ---------- Sticky-note tags ---------- */
.tag {
  display: inline-block;
  font-family: var(--hand2);
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--hl-orange);
  border: 1px dashed rgba(28, 42, 82, 0.5);
  color: var(--ink-deep);
  padding: 0.05rem 0.5rem;
  margin-right: 0.4rem;
  vertical-align: 0.05em;
  transform: rotate(-1.5deg);
}

.tag:nth-child(even) { background: var(--hl-green); transform: rotate(1.5deg); }

.tag.green  { background: var(--hl-green);  }
.tag.pink   { background: var(--hl-pink);   }
.tag.yellow { background: var(--hl-yellow); }
.tag.blue   { background: var(--hl-blue);   }

/* ---------- Stamp ---------- */
.stamp {
  display: inline-block;
  font-family: var(--hand);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.18em;
  color: var(--pen-red);
  border: 2.5px double var(--pen-red);
  padding: 0.05rem 0.55rem 0.1rem;
  margin-left: 0.4rem;
  transform: rotate(-7deg);
  opacity: 0.85;
  vertical-align: middle;
  text-shadow: 0 0 1px rgba(201, 42, 42, 0.4);
  background: transparent;
  pointer-events: none;
}

.stamp.draft {
  color: #5a6e8e;
  border-color: #5a6e8e;
  text-shadow: 0 0 1px rgba(90, 110, 142, 0.4);
  transform: rotate(5deg);
}

.stamp.revise {
  color: #c47a2c;
  border-color: #c47a2c;
  text-shadow: 0 0 1px rgba(196, 122, 44, 0.4);
  transform: rotate(-3deg);
}

/* sticky note color variants */
.sticky-note.pink   { background: var(--hl-pink); }
.sticky-note.green  { background: var(--hl-green); }
.sticky-note.blue   { background: var(--hl-blue); }
.sticky-note.orange { background: var(--hl-orange); }

/* welcome sticky — bigger, dark blue text, no subtitle */
.sticky-note.welcome-note {
  width: 180px;
  padding: 28px 14px 24px;
  text-align: center;
}

.welcome-text {
  display: block;
  font-family: var(--hand);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--ink-deep);
  line-height: 1;
  letter-spacing: 0.01em;
}

/* sticky note position variant — bottom-right (sits high above the page bottom) */
.sticky-note.bottom-right {
  top: 240px;
  bottom: auto;
  right: 60px;
  transform: rotate(-3deg);
}

/* paperclipped attachment (e.g. syllabus link) */
.attachment {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.55rem;
  padding: 0.35rem 0.85rem 0.35rem 1.55rem;
  font-family: var(--hand2);
  font-size: 1rem;
  background: var(--paper);
  background-image: none;
  border: 1.5px solid var(--ink);
  color: var(--ink-deep);
  text-decoration: none;
  position: relative;
  transform: rotate(-1deg);
  transition: transform 0.18s ease, background-color 0.18s ease;
  box-shadow: 1px 2px 0 rgba(28, 42, 82, 0.4);
}

.attachment:hover, .attachment:focus-visible {
  background-color: var(--hl-yellow);
  background-image: none;
  transform: rotate(0) translateY(-1px);
  color: var(--ink-deep);
}

.attachment::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 8px;
  width: 16px;
  height: 30px;
  border: 2px solid #8a8e9c;
  border-bottom: none;
  border-radius: 7px 7px 1px 1px;
  background: transparent;
  pointer-events: none;
  transform: rotate(-12deg);
}

.attachment::after {
  content: "";
  position: absolute;
  top: -2px;
  left: 13px;
  width: 6px;
  height: 16px;
  border-left: 2px solid #8a8e9c;
  pointer-events: none;
  transform: rotate(-12deg);
}

/* Page number in the bottom-right corner */
.page-number {
  position: absolute;
  bottom: 14px;
  right: 60px;
  font-family: var(--hand);
  font-size: 1.05rem;
  color: var(--pencil);
  transform: rotate(-2deg);
  z-index: 2;
  pointer-events: none;
  letter-spacing: 0.05em;
}


/* ---------- Buttons ---------- */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin: 1.5rem 0 2rem;
}

.btn {
  display: inline-block;
  font-family: var(--hand2);
  font-weight: 400;
  font-size: 1.1rem;
  padding: 0.55rem 1.2rem;
  border-radius: 0;
  text-decoration: none;
  background: var(--paper);
  cursor: pointer;
  border: 2px solid var(--ink);
  color: var(--ink-deep);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  animation: none;
  transform: rotate(-0.5deg);
}

.btn:nth-child(even) { transform: rotate(0.5deg); }

.btn:hover, .btn:focus-visible {
  transform: rotate(0) translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
  background: var(--hl-yellow);
  animation: none;
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.btn-primary { background: var(--hl-yellow); }
.btn-primary:hover, .btn-primary:focus-visible { background: var(--hl-yellow-strong); }

/* ---------- CV embed ---------- */
.cv-embed {
  width: 100%;
  height: 80vh;
  min-height: 600px;
  border: 2px solid var(--ink);
  margin-top: 1rem;
  background: #fff;
  box-shadow: 4px 4px 0 var(--ink);
}

/* ---------- Document viewer (CV / Resume) — handwritten "flip" toggle ---------- */
.doc-viewer {
  margin-top: 1.5rem;
  perspective: 1600px;
}

/* ---------- Mobile-only PDF buttons (hidden on desktop) ---------- */
@media (min-width: 721px) {
  .doc-mobile { display: none; }
}

.doc-btn {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  padding: 1rem 1.1rem;
  background: var(--paper);
  background-image:
    linear-gradient(to bottom, rgba(255,255,255,0.45), rgba(255,255,255,0) 30%, rgba(0,0,0,0.04));
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  text-decoration: none;
  color: var(--ink-deep);
  font-family: var(--hand2);
  box-shadow: 3px 3px 0 var(--ink), inset 0 1.5px 0 rgba(255,255,255,0.6);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.doc-btn:hover, .doc-btn:focus-visible {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink), inset 0 1.5px 0 rgba(255,255,255,0.6);
  background-color: var(--hl-yellow);
  outline: none;
}
.doc-btn__icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  color: var(--pen-red);
}
.doc-btn__icon svg { width: 100%; height: 100%; }
.doc-btn__label {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.doc-btn__label strong {
  font-family: var(--hand);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--ink-deep);
  letter-spacing: 0.01em;
}
.doc-btn__label em {
  font-style: normal;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-top: 1px;
}

.doc-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin: 0 0.4rem 0.85rem;
}

.doc-status {
  display: inline-block;
  font-family: var(--hand);
  font-size: 1.45rem;
  color: var(--ink-soft);
  line-height: 1.1;
  margin: 0;
}

.doc-status strong {
  font-weight: 700;
  color: var(--ink-deep);
  background: linear-gradient(transparent 55%, var(--hl-yellow) 55%, var(--hl-yellow) 92%, transparent 92%);
  padding: 0 0.25em;
  margin-left: 0.15em;
}

.doc-frame {
  display: block;
  width: 100%;
  height: 80vh;
  min-height: 620px;
  border: 2px solid var(--ink);
  background: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  position: relative;
  z-index: 0;
  transform-origin: left center;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.doc-frame.is-flipping {
  opacity: 0;
  transform: rotateY(-18deg) translateX(-12px);
}

.doc-flip-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--hand);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  padding: 0.25rem 1.05rem 0.4rem;
  background-color: var(--paper);
  background-image: none;
  border: 1.8px solid var(--ink);
  color: var(--ink-deep);
  cursor: pointer;
  text-decoration: none;
  position: relative;
  transform: rotate(-1.5deg);
  box-shadow: 2.5px 3px 0 var(--ink);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
  line-height: 1.1;
  flex-shrink: 0;
}

.doc-flip-button:hover, .doc-flip-button:focus-visible {
  background-image: none;
  background-color: var(--hl-yellow);
  transform: rotate(0) translate(-1px, -1px);
  box-shadow: 3.5px 4px 0 var(--ink);
  outline: none;
  color: var(--ink-deep);
}

.doc-flip-button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.doc-flip-arrow {
  font-size: 1.7rem;
  color: var(--pen-red);
  display: inline-block;
  transition: transform 0.4s ease;
  font-weight: 400;
  line-height: 1;
}

.doc-flip-button:hover .doc-flip-arrow,
.doc-flip-button:focus-visible .doc-flip-arrow {
  transform: rotate(180deg);
}

.doc-flip-text em {
  font-style: normal;
  font-weight: 700;
}

/* ---------- Contact ---------- */
.contact-list { list-style: none; margin-top: 1.5rem; }

.contact-list li {
  margin-bottom: 1rem;
  color: var(--ink);
  font-size: 1.05rem;
}

.contact-list strong {
  font-family: var(--hand2);
  color: #2a4a8e;
  font-weight: 400;
  font-size: 1.15rem;
  margin-right: 0.5rem;
  display: inline-block;
  min-width: 6.5rem;
}

/* Contact links — dark navy text with muted red wavy underline */
.contact-list a {
  background-image: none;
  background-color: transparent;
  color: var(--ink-deep);
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-color: #a8323a;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.contact-list a:hover,
.contact-list a:focus-visible {
  background-image: none;
  background-color: transparent;
  color: #a8323a;
  text-decoration-color: #a8323a;
  animation: none;
  outline: none;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 2px solid rgba(80, 60, 30, 0.45);
  padding: 2.4rem 1.5rem 1.6rem;
  text-align: center;
  font-family: var(--hand2);
  font-size: 1rem;
  color: var(--pencil);
  margin-top: auto;
  background:
    linear-gradient(to bottom,
      rgba(150, 130, 80, 0.10) 0%,
      rgba(120, 100, 60, 0.20) 40%,
      rgba(120, 100, 60, 0.32) 100%);
  border-radius: 50% 50% 0 0 / 18px 18px 0 0;
  position: relative;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.18) inset, 0 -1px 0 rgba(0, 0, 0, 0.06);
}

/* paper strip sticking out of the manila pocket */
.site-footer::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 65%;
  max-width: 480px;
  height: 8px;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-bottom: none;
  border-radius: 3px 3px 0 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.05);
}


/* ---------- Utility ---------- */
.lead { font-size: 1.12rem; color: var(--ink); line-height: 1.7; }

.section-note {
  font-family: var(--hand2);
  font-size: 1.05rem;
  color: var(--pencil);
  margin-top: -0.25rem;
  margin-bottom: 1rem;
}

/* ---------- Lab notebook code cell ---------- */
.lab-cell {
  margin: 1.5rem 0 2rem;
  background: #fefcf5;
  border: 1.5px solid var(--ink);
  border-left: 6px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  font-family: "JetBrains Mono", "Fira Code", Menlo, Monaco, "Courier New", monospace;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-deep);
  position: relative;
  transform: rotate(-0.3deg);
}

.lab-cell__header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.9rem;
  border-bottom: 1px dashed var(--ink-soft);
  background: rgba(28, 42, 82, 0.05);
  font-size: 12px;
  flex-wrap: wrap;
}

.lab-cell__prompt {
  color: var(--pen-red);
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  white-space: nowrap;
}

.lab-cell__lang {
  background: var(--ink);
  color: var(--paper);
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  font-size: 11px;
  letter-spacing: 0.06em;
  font-weight: 700;
  text-transform: uppercase;
}

.lab-cell__title {
  color: var(--ink-soft);
  flex: 1;
  font-family: "JetBrains Mono", monospace;
}

.lab-cell__view {
  font-family: var(--hand2);
  font-size: 14px;
  color: var(--pen-red);
  background: none;
  background-image: none;
  padding: 0 0.2rem;
  font-weight: 400;
}

.lab-cell__view:hover, .lab-cell__view:focus-visible {
  background-image: none;
  background-color: var(--hl-yellow);
  color: var(--ink-deep);
  animation: none;
}

.lab-cell__code {
  padding: 0.95rem 1.1rem;
  white-space: pre;
  overflow-x: auto;
  margin: 0;
  background: #fefcf5;
  font-family: inherit;
  font-size: inherit;
  color: var(--ink-deep);
  tab-size: 2;
}

.lab-cell__code .kw   { color: #2858b6; font-weight: 700; }
.lab-cell__code .str  { color: #2e7d32; }
.lab-cell__code .comm { color: #888; font-style: italic; }
.lab-cell__code .num  { color: #b85c00; }
.lab-cell__code .fn   { color: #0e1a3a; font-weight: 600; }
.lab-cell__code .op   { color: var(--ink-soft); }

.lab-cell__output {
  border-top: 1px dashed var(--ink-soft);
  padding: 0.85rem 1.1rem 1.2rem;
  background: #fdfaee;
}

.lab-cell__output .lab-cell__prompt {
  font-size: 12px;
  display: inline-block;
  margin-bottom: 0.4rem;
}

.lab-cell__caption {
  font-family: var(--hand2);
  font-size: 0.95rem;
  color: var(--pencil);
  margin: 0.1rem 0 0.55rem;
}

.lab-cell__chart {
  width: 100%;
  max-width: 420px;
  display: block;
  height: auto;
}

/* ---------- Replication / code badges ---------- */
.repl-badges {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.repl-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--hand2);
  font-size: 0.88rem;
  font-weight: 400;
  padding: 0.12rem 0.55rem;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  background-image: none;
  color: var(--ink-deep);
  text-decoration: none;
  transform: rotate(-1deg);
  transition: transform 0.15s ease, background-color 0.15s ease;
  line-height: 1.3;
}

.repl-badge:nth-of-type(even) { transform: rotate(1deg); }

.repl-badge:hover, .repl-badge:focus-visible {
  background-image: none;
  background-color: var(--hl-yellow);
  transform: rotate(0) translateY(-1px);
  color: var(--ink-deep);
  animation: none;
}

.repl-badge svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Scattered scribbles — small decorative doodles around the page */
.scribble {
  position: absolute;
  z-index: 0;
  color: var(--pen-red);
  opacity: 0.85;
  transform: rotate(var(--rot, 0deg));
  transition: transform 0.2s ease-out;
  cursor: default;
}

/* Hover wobble — only on devices that can hover (skip touch) */
@keyframes scribbleWobble {
  0%   { transform: rotate(var(--rot, 0deg)) scale(1); }
  16%  { transform: rotate(calc(var(--rot, 0deg) + 14deg)) scale(1.10); }
  34%  { transform: rotate(calc(var(--rot, 0deg) - 10deg)) scale(1.08); }
  52%  { transform: rotate(calc(var(--rot, 0deg) + 7deg))  scale(1.05); }
  72%  { transform: rotate(calc(var(--rot, 0deg) - 3deg))  scale(1.02); }
  100% { transform: rotate(var(--rot, 0deg)) scale(1); }
}

@media (hover: hover) {
  .scribble:hover {
    animation: scribbleWobble 0.7s ease-out;
    z-index: 5;
  }
}

.scribble svg {
  width: 100%;
  height: 100%;
}

.scribble--book      { width: 36px; height: 30px; color: var(--pen-red); }
.scribble--star      { width: 30px; height: 30px; color: #2a4a8e; }
.scribble--swirl     { width: 44px; height: 36px; color: #5a5a5a; }
.scribble--magnifier { width: 32px; height: 32px; color: #1f7a4d; }
.scribble--burst     { width: 36px; height: 36px; color: #c97a1a; }
.scribble--pencil    { width: 32px; height: 32px; color: #2a4a8e; }
.scribble--asterisk  { width: 28px; height: 28px; color: var(--pen-red); }
.scribble--document  { width: 30px; height: 32px; color: #7a3a8a; }
.scribble--quote     { width: 32px; height: 24px; color: #5a5a5a; }
.scribble--glasses   { width: 38px; height: 22px; color: var(--ink-deep); }
.scribble--quill     { width: 34px; height: 34px; color: #1f7a4d; }
.scribble--coffee    { width: 28px; height: 30px; color: #8a4d20; }
.scribble--brackets  { width: 28px; height: 32px; color: var(--pen-red); }

/* Washi tape — patterned decorative tape strips */
.washi-tape {
  display: inline-block;
  position: absolute;
  width: 80px;
  height: 22px;
  transform: rotate(var(--rot, 0deg));
  background-color: var(--hl-pink);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0) 6px,
    rgba(255, 255, 255, 0.55) 6px,
    rgba(255, 255, 255, 0.55) 10px
  );
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  opacity: 0.92;
  z-index: 4;
  pointer-events: none;
}

.washi-tape--blue {
  background-color: var(--hl-blue);
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0) 5px,
    rgba(255, 255, 255, 0.5) 5px,
    rgba(255, 255, 255, 0.5) 9px
  );
}

/* WIP page corner washi tape — pinned far enough out that it never touches the page title */
.washi-tape--wip-corner {
  top: 36px;
  right: 70px;
  width: 80px;
  --rot: -15deg;
}
@media (max-width: 720px) {
  .washi-tape--wip-corner {
    top: 14px;
    right: 8px;
    width: 60px;
    height: 18px;
    --rot: -22deg;
  }
}

.washi-tape--dot {
  background-color: var(--hl-yellow);
  background-image: radial-gradient(
    circle at 6px 6px,
    rgba(120, 80, 40, 0.32) 1.5px,
    transparent 2px
  );
  background-size: 12px 12px;
}

.washi-tape--green {
  background-color: var(--hl-green);
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0) 4px,
    rgba(255, 255, 255, 0.5) 4px,
    rgba(255, 255, 255, 0.5) 8px
  );
}

/* "what i study" — hand-drawn research doodles (sized for narrow left column) */
.research-doodles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
  gap: 1.2rem 0.5rem;
  margin: 1.4rem 0 0.5rem;
  padding: 1.7rem 0 1rem;
  position: relative;
  border-top: 1.5px dashed rgba(28, 42, 82, 0.3);
  border-bottom: 1.5px dashed rgba(28, 42, 82, 0.3);
}

.research-doodles__title {
  position: absolute;
  top: -0.78em;
  left: 0.4rem;
  background-color: var(--hl-yellow);
  padding: 0.1rem 0.55rem;
  font-family: var(--hand);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink-deep);
  line-height: 1;
  transform: rotate(-1.5deg);
  border-radius: 2px;
}

.doodle {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  color: var(--pen-red);
}

/* alternate ink colors — like switching between pens in a journal */
.doodle:nth-of-type(2) { color: #2a4a8e; }
.doodle:nth-of-type(4) { color: #2a4a8e; }
.doodle:nth-of-type(5) { color: #1f7a4d; }

.doodle svg {
  width: 44px;
  height: 44px;
  transform: rotate(-4deg);
  transition: transform 0.3s ease;
}

.doodle:nth-of-type(odd) svg { transform: rotate(3deg); }
.doodle:nth-of-type(3) svg { transform: rotate(-2deg); }
.doodle:nth-of-type(5) svg { transform: rotate(5deg); }

.doodle:hover svg {
  transform: rotate(0) scale(1.12);
}

.doodle-label {
  font-family: var(--hand2);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-deep);
  line-height: 1.15;
}

/* "see all publications" — notebook-themed inked button */
.see-all-row {
  margin-top: 0.4rem;
  margin-bottom: 1.1rem;
}

.see-all {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--hand);
  font-size: 1.45rem;
  font-weight: 700;
  padding: 0.2rem 1rem 0.45rem;
  background-image: none;
  background-color: var(--paper);
  border: 1.8px solid var(--ink);
  color: var(--ink-deep);
  text-decoration: none;
  position: relative;
  transform: rotate(-1deg);
  box-shadow: 2.5px 3px 0 var(--ink);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
  line-height: 1.05;
}

.see-all:hover, .see-all:focus-visible {
  background-image: none;
  background-color: var(--hl-yellow);
  transform: rotate(0) translate(-1px, -1px);
  box-shadow: 3.5px 4px 0 var(--ink);
  color: var(--ink-deep);
  animation: none;
  outline: none;
}

.see-all:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.see-all__arrow {
  display: inline-block;
  font-family: var(--hand);
  font-weight: 700;
  font-size: 1.2em;
  color: var(--pen-red);
  transition: transform 0.2s ease;
}

.see-all:hover .see-all__arrow,
.see-all:focus-visible .see-all__arrow {
  transform: translateX(4px);
}

/* "read" button — small notebook-themed inked card */
.read-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin: 0 0 0 0.5rem;
  vertical-align: 0.15em;
  font-style: normal;
  font-family: var(--hand);
  font-size: 1.15rem;
  font-weight: 700;
  background-image: none;
  background-color: var(--paper);
  border: 1.5px solid var(--ink);
  color: var(--ink-deep);
  text-decoration: none;
  position: relative;
  transform: rotate(-1deg);
  padding: 0.18rem 0.85rem 0.3rem;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
  line-height: 1.1;
  white-space: nowrap;
}

.read-btn:hover, .read-btn:focus-visible {
  background-image: none;
  background-color: var(--hl-yellow);
  transform: rotate(0) translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink-deep);
  outline: none;
  animation: none;
}

.read-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}

.read-btn__arrow {
  color: var(--pen-red);
  font-size: 1.2em;
  transition: transform 0.2s ease;
  display: inline-block;
  font-weight: 700;
}

.read-btn:hover .read-btn__arrow,
.read-btn:focus-visible .read-btn__arrow {
  transform: translateX(4px);
}

/* abstract reveal — handwritten toggle that expands a highlighted block */
.abstract {
  margin-top: 0.6rem;
}

.abstract summary {
  cursor: pointer;
  font-family: var(--hand2);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--pen-red);
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.18rem 0.65rem 0.22rem;
  border: 1.5px dashed var(--pen-red);
  border-radius: 3px;
  list-style: none;
  user-select: none;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, border-style 0.18s ease;
  background: transparent;
  background-image: none;
}

.abstract summary::-webkit-details-marker { display: none; }
.abstract summary::marker { content: ""; }

.abstract summary::before {
  content: "↓";
  font-weight: 700;
  display: inline-block;
  transition: transform 0.25s ease;
}

.abstract summary:hover,
.abstract summary:focus-visible {
  background-color: rgba(201, 42, 42, 0.07);
  outline: none;
  transform: translateY(-1px);
}

.abstract[open] > summary {
  background-color: var(--hl-yellow);
  border-style: solid;
  border-color: var(--ink);
  color: var(--ink-deep);
}

.abstract[open] > summary::before {
  content: "↑";
}

.abstract-content {
  margin-top: 0.55rem;
  padding: 1rem 1.2rem;
  background: rgba(255, 235, 130, 0.18);
  border-left: 3px solid var(--ink);
  border-radius: 0 4px 4px 0;
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.6;
  position: relative;
  font-style: italic;
  animation: abstract-in 0.28s ease-out;
}

@keyframes abstract-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.abstract-content::before { content: none; }

.abstract-content p {
  margin: 0 0 0.85rem;
  font-style: inherit;
  color: inherit;
  line-height: inherit;
}

.abstract-content p:last-child {
  margin-bottom: 0;
}

/* solo-authored badge — inline visible label next to author */
.solo-badge {
  display: inline-block;
  font-family: var(--hand2);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pen-red);
  border: 1.5px solid var(--pen-red);
  background: rgba(201, 42, 42, 0.06);
  padding: 0.08rem 0.45rem;
  margin-left: 0.35rem;
  border-radius: 2px;
  vertical-align: 0.08em;
  white-space: nowrap;
}

/* inline syllabus link — small paperclipped slip of paper next to course title */
.syllabus-inline {
  display: inline-flex;
  align-items: center;
  font-family: var(--hand2);
  font-size: 0.92rem;
  font-weight: 400;
  margin-left: 0.5rem;
  padding: 0.18rem 0.7rem 0.22rem 0.7rem;
  background-image: none;
  background-color: var(--paper);
  border: 1.5px solid var(--ink);
  color: var(--ink-deep);
  text-decoration: none;
  position: relative;
  transform: rotate(-1.5deg);
  vertical-align: 0.18em;
  box-shadow: 1px 2px 0 rgba(28, 42, 82, 0.35);
  transition: transform 0.18s ease, background-color 0.18s ease;
  white-space: nowrap;
}

/* Paperclip — actual SVG paperclip clipping the slip to the page */
.syllabus-inline::before {
  content: "";
  position: absolute;
  top: -14px;
  left: -2px;
  width: 24px;
  height: 24px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a7e8a' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'><path d='M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(1px 1.5px 0.5px rgba(0, 0, 0, 0.18));
}

.syllabus-inline::after { content: none; }

.syllabus-inline:hover, .syllabus-inline:focus-visible {
  background-image: none;
  background-color: var(--hl-yellow);
  color: var(--ink-deep);
  transform: rotate(0) translateY(-1px);
  animation: none;
}

/* highlight specific phrases inline (use <mark> tags) */
mark {
  background: var(--hl-pink);
  padding: 0 0.15em;
  color: var(--ink-deep);
  border-radius: 1px;
}
mark.green  { background: var(--hl-green); }
mark.blue   { background: var(--hl-blue); }
mark.orange { background: var(--hl-orange); }
mark.yellow { background: var(--hl-yellow); }

/* ---------- 404 / Not-found ---------- */
.not-found {
  text-align: center;
  padding: 1rem 0 2rem;
}

.not-found__heading {
  font-family: var(--hand);
  font-size: clamp(5rem, 14vw, 9rem);
  font-weight: 700;
  color: var(--pen-red);
  line-height: 1;
  margin: 0.5rem 0 1.4rem;
  transform: rotate(-3deg);
  letter-spacing: -0.02em;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.06);
}

.not-found__torn {
  max-width: 360px;
  margin: 0 auto 2rem;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,0.16));
  transform: rotate(-1.5deg);
}

.not-found__torn svg {
  width: 100%;
  height: auto;
}

.not-found__lead {
  font-family: var(--hand2);
  font-size: 1.25rem;
  color: var(--ink);
  margin-bottom: 1.2rem;
}

.not-found__nav {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 1.2rem;
  padding: 0;
  margin: 0 auto;
  max-width: 520px;
}

.not-found__nav a {
  font-family: var(--hand2);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink-deep);
  background-image: none;
  text-decoration: underline;
  text-decoration-color: rgba(28, 42, 82, 0.35);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  padding: 0;
}

.not-found__nav a:hover,
.not-found__nav a:focus-visible {
  color: var(--pen-red);
  text-decoration-color: var(--pen-red);
  background-image: none;
}

/* Reduce motion if user prefers */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
  h1.page-title { transform: none; }
  .site-title { transform: none; }
}
