/* ==========================================================================
   Portfolio - Matthew Nguyen
   Handwritten Notebook Styling & Doodle Aesthetic
   ========================================================================== */

/* --------------------------------------------------------------------------
   Variables & Theming
   -------------------------------------------------------------------------- */
:root {
  /* Core palette: single source of truth. Alpha variants use rgba(var(--x-rgb), a). */
  --paper-rgb: 250, 246, 234;
  --ink-rgb: 38, 40, 58;
  --red-rgb: 155, 44, 58;
  --blue-rgb: 31, 64, 168;
  --pencil-rgb: 74, 77, 99;
  --lime-rgb: 211, 236, 69;        /* highlighter */
  --lime-soft-rgb: 224, 243, 98;
  --tape-rgb: 232, 214, 128;       /* yellow tape */
  --sticky-rgb: 253, 241, 163;     /* sticky note */
  --amber-rgb: 245, 158, 11;
  --shadow-rgb: 50, 35, 10;        /* warm brown shadows */
  --shadow-warm-rgb: 70, 50, 10;
  --paper-edge-rgb: 150, 115, 50;  /* inner page shading */
  --hole-rgb: 110, 100, 70;        /* binder-hole outline */
  --grid-rgb: 110, 165, 215;       /* ruled grid lines */
  --white-rgb: 255, 255, 255;
  --black-rgb: 0, 0, 0;

  --paper: rgb(var(--paper-rgb));
  --ink: rgb(var(--ink-rgb));
  --red: rgb(var(--red-rgb));
  --blue: rgb(var(--blue-rgb));
  --pencil: rgb(var(--pencil-rgb));
  --hl-color: rgba(var(--lime-rgb), 0.92);
  --hl-color-soft: rgba(var(--lime-soft-rgb), 0.85);
  --tape-color: rgba(var(--tape-rgb), 0.6);

  /* One-off solid colors */
  --paper-bright: #fffdf4;
  --paper-hole: #ece6d2;           /* inside of the binder holes */
  --sticky: #fdf1a3;
  --sticky-light: #fff9c4;
  --pin-light: #d9626f;
  --pin-dark: #6e1824;
  --amber: #b45309;

  --ml: clamp(44px, 9vw, 130px);
  --container-max: 1080px;
}

/* --------------------------------------------------------------------------
   Base & Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 30px;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: 'Patrick Hand', 'Caveat', cursive, -apple-system, sans-serif;
  font-size: 22px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Notebook Page Container (.pg)
   Simulates ruled notebook paper with left red margin & punched binder holes
   -------------------------------------------------------------------------- */
.pg {
  position: relative;
  overflow-x: clip;
  min-height: 100vh;
  box-sizing: border-box;
  padding: 0 clamp(20px, 5vw, 64px) 60px var(--ml);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(var(--grid-rgb), 0.42) 1.5px, transparent 1.5px),
    linear-gradient(90deg, rgba(var(--grid-rgb), 0.42) 1.5px, transparent 1.5px);
  background-size: 30px 30px;
  box-shadow: inset 0 0 140px rgba(var(--paper-edge-rgb), 0.14);
}

/* Double Red Margin Line (Notebook margin guide) */
.pg::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--ml) - 24px);
  width: 7px;
  border-left: 2px solid rgba(var(--red-rgb), 0.5);
  border-right: 2px solid rgba(var(--red-rgb), 0.5);
  pointer-events: none;
  z-index: 2;
}

/* Binder Holes along the left margin */
.pg::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--ml) * 0.2);
  width: 26px;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(circle at 13px 13px, var(--paper-hole) 0 9px, rgba(var(--hole-rgb), 0.55) 10px 11px, transparent 12px) 0 110px / 26px 1440px repeat-y,
    radial-gradient(circle at 13px 13px, var(--paper-hole) 0 9px, rgba(var(--hole-rgb), 0.55) 10px 11px, transparent 12px) 0 570px / 26px 1440px repeat-y,
    radial-gradient(circle at 13px 13px, var(--paper-hole) 0 9px, rgba(var(--hole-rgb), 0.55) 10px 11px, transparent 12px) 0 1030px / 26px 1440px repeat-y;
}

/* Grainy Paper Texture Overlay */
.paper-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.36;
  mix-blend-mode: multiply;
  z-index: 1;
}

.wrap {
  position: relative;
  max-width: var(--container-max);
  margin: 0 auto;
  z-index: 10;
}

/* --------------------------------------------------------------------------
   Typography & Accents
   -------------------------------------------------------------------------- */
.hw {
  font-family: 'Caveat', cursive;
  font-weight: 700;
}

.note {
  font-family: 'Reenie Beanie', cursive;
  color: var(--blue);
  font-size: 32px;
  line-height: 30px;
}

.red { color: var(--red); }
.blue { color: var(--blue); }

/* Highlighter effect */
.hl {
  background: linear-gradient(100deg, rgba(var(--lime-rgb), 0) 0%, var(--hl-color) 2%, var(--hl-color-soft) 96%, rgba(var(--lime-rgb), 0) 100%);
  padding: 0 0.22em;
  margin: 0 -0.08em;
  border-radius: 4px 10px 5px 9px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Ink bleed filter */
.ink {
  filter: url(#ink);
}

/* Links */
a {
  color: var(--blue);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

/* Wavy underline for text emphasis */
.u {
  position: relative;
  display: inline-block;
}

.u::after {
  content: "";
  position: absolute;
  left: -4px;
  right: -3px;
  bottom: -1px;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(-0.7deg);
  filter: url(#wob2);
  pointer-events: none;
  opacity: 0.9;
}

/* Hand-drawn link underline */
.lk {
  position: relative;
  display: inline-block;
  color: var(--blue);
}

.lk::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: 1px;
  border-bottom: 2px solid var(--blue);
  transform: rotate(-0.6deg);
  filter: url(#wob2);
  pointer-events: none;
}

.lk:hover {
  background: linear-gradient(100deg, rgba(var(--lime-rgb), 0), rgba(var(--lime-rgb), 0.9) 6%, rgba(var(--lime-soft-rgb), 0.85) 94%, rgba(var(--lime-rgb), 0));
}

/* Circled text annotation */
.circ {
  position: relative;
  display: inline-block;
  color: var(--blue);
}

.circ::before {
  content: "";
  position: absolute;
  inset: -5px -13px -3px -13px;
  border: 2.5px solid var(--blue);
  border-radius: 52% 48% 55% 45% / 58% 52% 48% 42%;
  transform: rotate(-3deg);
  filter: url(#wob2);
  pointer-events: none;
}

/* Torn piece of yellow tape */
.tape {
  position: absolute;
  top: -17px;
  left: 50%;
  width: 96px;
  height: 30px;
  margin-left: -48px;
  background: var(--tape-color);
  transform: rotate(-3deg);
  clip-path: polygon(
    0 8%, 4% 0, 8% 10%, 12% 0, 88% 0, 92% 10%, 96% 0, 100% 8%,
    100% 92%, 96% 100%, 92% 90%, 88% 100%, 12% 100%, 8% 90%, 4% 100%, 0 92%
  );
  box-shadow: 0 1px 3px rgba(var(--black-rgb), 0.08);
  pointer-events: none;
  z-index: 5;
}

/* --------------------------------------------------------------------------
   Header & Navigation
   -------------------------------------------------------------------------- */
header {
  padding-top: 24px;
}

.header-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 30px;
}

.logo-text {
  font-size: 40px;
  line-height: 60px;
}

/* --------------------------------------------------------------------------
   Sticky Navigation Yellow Note with Red Pushpin (.stickwrap & .stick)
   -------------------------------------------------------------------------- */
.stickwrap {
  position: sticky;
  top: 14px;
  height: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
  will-change: transform;
}

.stick {
  pointer-events: auto;
  position: relative;
  margin-top: 14px;
  width: 730px;
  max-width: 100%;
  height: 72px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 16px;
  padding: 20px 24px 12px;
  background: linear-gradient(180deg, rgba(var(--white-rgb), 0.35), rgba(var(--white-rgb), 0) 40%), var(--sticky);
  transform: rotate(1.3deg);
  border-radius: 2px 2px 8px 2px;
  box-shadow: 0 8px 16px rgba(var(--shadow-warm-rgb), 0.22), 0 1px 2px rgba(var(--black-rgb), 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stick:hover {
  transform: rotate(0.8deg) scale(1.01);
  box-shadow: 0 10px 20px rgba(var(--shadow-warm-rgb), 0.26), 0 2px 4px rgba(var(--black-rgb), 0.18);
}

/* Red spherical 3D pushpin / thumbtack */
.stick::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  margin-left: -9px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--pin-light), var(--red) 60%, var(--pin-dark));
  box-shadow: 0 3px 4px rgba(var(--black-rgb), 0.3);
  pointer-events: none;
  z-index: 2;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
}

.nav a {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 32px;
  color: var(--red);
  position: relative;
  display: inline-block;
  padding: 0 4px;
  line-height: 1;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1px;
  border-bottom: 3px solid var(--red);
  transform: rotate(-1deg) scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease-out;
  filter: url(#wob2);
}

.nav a:hover::after,
.nav a:focus-visible::after,
.nav a.on::after,
.nav a.active::after {
  transform: rotate(-1deg) scaleX(1);
}

/* --------------------------------------------------------------------------
   Hand-Drawn Rectangle Boxes (.rbox)
   -------------------------------------------------------------------------- */
.rbox {
  --stroke: var(--pencil);
  position: relative;
  background-color: rgba(var(--paper-rgb), 0.4);
}

.rbox.r {
  --stroke: var(--red);
}

.rbox::before,
.rbox::after {
  content: "";
  position: absolute;
  pointer-events: none;
  filter: url(#wob);
}

.rbox::before {
  left: -9px;
  right: -5px;
  top: 0;
  bottom: 0;
  border-top: 2.5px solid var(--stroke);
  border-bottom: 2px solid var(--stroke);
  transform: rotate(-0.25deg);
  opacity: 0.88;
}

.rbox::after {
  top: -7px;
  bottom: -10px;
  left: 0;
  right: 0;
  border-left: 2px solid var(--stroke);
  border-right: 2.5px solid var(--stroke);
  transform: rotate(0.3deg);
  opacity: 0.88;
}

.rbox.alt::before {
  transform: rotate(0.3deg);
  left: -5px;
  right: -10px;
}

.rbox.alt::after {
  transform: rotate(-0.35deg);
  top: -10px;
  bottom: -6px;
}

/* Call to action buttons */
.btn {
  display: inline-block;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 34px;
  line-height: 36px;
  padding: 12px 32px;
  color: var(--red) !important;
  transition: background 0.2s ease, transform 0.15s ease;
  cursor: pointer;
}

.btn:hover {
  background: rgba(var(--lime-rgb), 0.55);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(1px);
}

/* --------------------------------------------------------------------------
   Hero Section
   -------------------------------------------------------------------------- */
.hero-content {
  display: flex;
  flex-wrap: wrap;
  gap: 36px 64px;
  align-items: flex-start;
  padding: 60px 0 30px;
}

.hero-main {
  flex: 1 1 540px;
  min-width: 0;
}

.hero-greeting {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.hero-title {
  margin: 6px 0 0;
  font-size: clamp(64px, 10vw, 116px);
  line-height: 1.02;
  font-weight: 700;
}

.hero-subtitle {
  margin: 24px 0 0;
  font-size: clamp(34px, 4vw, 46px);
  line-height: 60px;
  font-weight: 500;
}

.hero-desc {
  margin: 24px 0 0;
  max-width: 600px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 30px 40px;
  margin-top: 48px;
}

/* Notebook card on the hero right side */
.notebook-card-wrapper {
  flex: 0 1 380px;
  min-width: 260px;
  margin: 12px auto 0;
  transform: rotate(2deg);
  transition: transform 0.3s ease;
}

.notebook-card-wrapper:hover {
  transform: rotate(0deg) scale(1.02);
}

.notebook-card {
  padding: 36px 32px 30px;
}

.fill {
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.fill b {
  font-weight: 400;
  color: var(--red);
  flex: 0 0 auto;
}

.fill span {
  flex: 1;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 32px;
  color: var(--blue);
  border-bottom: 2px dashed rgba(var(--pencil-rgb), 0.5);
  line-height: 34px;
}

/* --------------------------------------------------------------------------
   Sections General
   -------------------------------------------------------------------------- */
.sec {
  position: relative;
  padding: 60px 0 30px;
  scroll-margin-top: 96px;
}

.sec-title {
  position: relative;
  display: inline-block;
  margin: 0 0 42px;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 62px;
  line-height: 60px;
  color: var(--red);
  filter: url(#ink);
}

.sec-title .n {
  font-size: 34px;
  color: var(--blue);
  margin-right: 12px;
  vertical-align: top;
}

.sec-title::after {
  content: "";
  position: absolute;
  left: -8px;
  right: -18px;
  bottom: -9px;
  height: 9px;
  border-top: 2.5px solid var(--red);
  border-bottom: 2px solid var(--red);
  transform: rotate(-0.35deg);
  filter: url(#wob);
  opacity: 0.85;
}

/* Dash bullet lists */
.dash {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dash li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 6px;
}

.dash li::before {
  content: "–";
  position: absolute;
  left: 4px;
  color: var(--red);
  font-weight: 700;
}

/* General Notebook Cards */
.card {
  padding: 36px 30px 30px;
  background-color: rgba(var(--paper-rgb), 0.6);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  box-shadow: 2px 4px 15px rgba(var(--ink-rgb), 0.08);
}

.card h3 {
  margin: 0;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 40px;
  line-height: 42px;
  color: var(--ink);
}

.card .tag {
  font-family: 'Reenie Beanie', cursive;
  font-size: 30px;
  line-height: 30px;
  color: var(--red);
}

.card:nth-child(odd) {
  transform: rotate(-0.6deg);
}

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

.card:hover {
  transform: rotate(0deg) scale(1.015);
}

/* --------------------------------------------------------------------------
   About Section
   -------------------------------------------------------------------------- */
.enjoy-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.enjoy-item {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  user-select: none;
}

.enjoy-item input[type="checkbox"] {
  display: none;
}

.enjoy-item .check-box {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
}

.enjoy-item input[type="checkbox"]:not(:checked) + .check-box svg path:last-child {
  display: none;
}

/* --------------------------------------------------------------------------
   AI Section Card (.ai-card)
   -------------------------------------------------------------------------- */
.ai-card {
  margin-top: 66px;
  transform: rotate(-0.4deg);
  padding: 36px 36px 32px;
}

.ai-card:hover {
  transform: rotate(0deg) scale(1.008);
}

.ai-features-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 36px 40px;
}

.ai-feature-col {
  flex: 1 1 220px;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   Articles & Article Detail Styles
   -------------------------------------------------------------------------- */
.articles-grid {
  display: flex;
  flex-direction: column;
  gap: 36px;
  margin-top: 32px;
}

.article-card {
  padding: 32px 36px 28px;
  background-color: rgba(var(--paper-rgb), 0.7);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.article-card:hover {
  transform: translateY(-3px) rotate(0.4deg);
  box-shadow: 2px 6px 18px rgba(var(--ink-rgb), 0.1);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  font-family: 'Reenie Beanie', cursive;
  font-size: 28px;
  color: var(--pencil);
  margin-bottom: 8px;
}

.article-meta .dot {
  color: var(--red);
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* the two doodles are grouped on the right of the Read note button */
.card-doodles {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-right: 6px;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.article-tag {
  font-family: 'Reenie Beanie', cursive;
  font-size: 26px;
  line-height: 24px;
  color: var(--blue);
  padding: 2px 12px;
  position: relative;
  isolation: isolate;
  --stroke: rgba(var(--blue-rgb), 0.55);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.article-tag:hover {
  transform: translateY(-1px);
}

.article-tag:hover::before {
  background: rgba(var(--blue-rgb), 0.18);
}

/* --------------------------------------------------------------------------
   Articles Filter Bar (Categories & Tag Filtering)
   -------------------------------------------------------------------------- */
.load-more {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

.articles-filter-wrap {
  margin: 28px 0 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.type-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.type-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(var(--paper-rgb), 0.7);
  border: 1.5px solid var(--pencil);
  border-radius: 6px 14px 4px 10px;
  padding: 8px 18px;
  font-family: 'Patrick Hand', 'Caveat', cursive;
  font-size: 22px;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  transform: rotate(-0.4deg);
  user-select: none;
}

.type-tab-btn:hover {
  background: rgba(var(--sticky-rgb), 0.7);
  transform: scale(1.03) rotate(-0.8deg);
  border-color: var(--red);
}

.type-tab-btn.active {
  background: linear-gradient(180deg, var(--sticky-light), var(--sticky));
  border: 2px solid var(--red);
  box-shadow: 0 4px 12px rgba(var(--red-rgb), 0.16);
  transform: scale(1.04) rotate(-1deg);
  color: var(--red);
  font-weight: 700;
}

.tab-icon {
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
}

/* Hand-drawn doodle icons (svgdoodles.com): inherit the text colour */
.dd-inline {
  display: inline-block;
  vertical-align: middle;
}

.doodle-ic {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  overflow: visible;
  flex: 0 0 auto;
}

.type-tab-btn .doodle-ic {
  width: 24px;
  height: 24px;
  color: var(--blue);
}

.type-tab-btn.active .doodle-ic {
  color: var(--red);
}

.article-type-badge .doodle-ic {
  width: 20px;
  height: 20px;
}

.tab-count {
  font-family: 'Caveat', cursive;
  font-size: 18px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  background: rgba(var(--ink-rgb), 0.08);
  color: var(--pencil);
  min-width: 18px;
  text-align: center;
  line-height: 1.2;
}

.type-tab-btn.active .tab-count {
  background: var(--red);
  color: #ffffff;
}

.tag-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 18px;
  background: rgba(var(--white-rgb), 0.45);
  border: 1.5px dashed rgba(var(--pencil-rgb), 0.35);
  border-radius: 6px;
  transform: rotate(0.2deg);
}

.tag-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-filter-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--pencil);
  font-size: 24px;
}

.clear-filter-btn {
  background: none;
  border: none;
  font-family: 'Patrick Hand', cursive;
  font-size: 17px;
  color: var(--red);
  text-decoration: underline;
  cursor: pointer;
  padding: 2px 6px;
  transition: opacity 0.15s ease;
}

.clear-filter-btn:hover {
  opacity: 0.75;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tag-pill {
  font-family: 'Patrick Hand', cursive;
  font-size: 18px;
  line-height: 1.2;
  color: var(--ink);
  background: rgba(var(--paper-rgb), 0.9);
  border: 1px solid var(--pencil);
  border-radius: 14px;
  padding: 3px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.tag-pill:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(var(--blue-rgb), 0.08);
  transform: translateY(-1px);
}

.tag-pill.active {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
  box-shadow: 0 2px 8px rgba(var(--blue-rgb), 0.28);
  transform: scale(1.05) rotate(-0.5deg);
}

.tag-pill .tag-pill-count {
  font-size: 14px;
  opacity: 0.75;
  margin-left: 3px;
}

/* Category badge on article card */
.article-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  padding: 2px 10px;
  border-radius: 4px;
  border: 1px solid currentColor;
  margin-left: auto;
  cursor: pointer;
  transition: transform 0.15s ease;
  user-select: none;
}

.article-type-badge:hover {
  transform: scale(1.08) rotate(-1deg);
}

.article-type-badge.technicals {
  color: var(--blue);
  background: rgba(var(--blue-rgb), 0.08);
}

.article-type-badge.opinions {
  color: var(--red);
  background: rgba(var(--red-rgb), 0.08);
}

.article-type-badge.random-thoughts {
  color: var(--amber);
  background: rgba(var(--amber-rgb), 0.12);
}

/* --------------------------------------------------------------------------
   Hand-drawn borders for the article filters (tabs, topic box, tag pills, category badge).
   Straight CSS borders are replaced by pseudo-element strokes: two offset, slightly rotated
   line pairs (like .rbox) run through the wobble filter so no edge is ever perfectly straight.
   -------------------------------------------------------------------------- */
.type-tab-btn,
.tag-filter-bar,
.tag-pill,
.article-type-badge {
  --stroke: var(--pencil);
  position: relative;
  isolation: isolate;
  border: 0;
}

.type-tab-btn.active,
.tag-pill.active {
  border: 0;
}

.type-tab-btn::before,
.type-tab-btn::after,
.tag-filter-bar::before,
.tag-filter-bar::after,
.article-type-badge::before,
.article-type-badge::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border: 0 solid var(--stroke, currentColor);
  filter: url(#wob2);
  opacity: 0.9;
}

/* horizontal strokes, running a little past the corners */
.type-tab-btn::before,
.article-type-badge::before {
  left: -5px;
  right: -3px;
  top: 0;
  bottom: 0;
  border-top-width: 2px;
  border-bottom-width: 1.5px;
  transform: rotate(-0.6deg);
}

/* vertical strokes, crossing the horizontal ones */
.type-tab-btn::after,
.article-type-badge::after {
  top: -4px;
  bottom: -5px;
  left: 0;
  right: 0;
  border-left-width: 1.5px;
  border-right-width: 2px;
  transform: rotate(0.7deg);
}

.type-tab-btn:nth-child(even)::before,
.article-type-badge::before {
  left: -3px;
  right: -6px;
  transform: rotate(0.5deg);
}

.type-tab-btn:nth-child(even)::after,
.article-type-badge::after {
  top: -6px;
  bottom: -3px;
  transform: rotate(-0.6deg);
}

.type-tab-btn:hover,
.type-tab-btn.active {
  --stroke: var(--red);
}

.type-tab-btn.active::before {
  border-top-width: 2.5px;
  border-bottom-width: 2.5px;
}

.type-tab-btn.active::after {
  border-left-width: 2.5px;
  border-right-width: 2.5px;
}

/* The topic box: dashed pencil outline, drawn the same way */
.tag-filter-bar {
  --stroke: rgba(var(--pencil-rgb), 0.6);
}

.tag-filter-bar::before {
  left: -4px;
  right: -2px;
  top: 0;
  bottom: 0;
  border-top: 1.5px dashed var(--stroke);
  border-bottom: 1.5px dashed var(--stroke);
  transform: rotate(-0.25deg);
  filter: url(#wob);
}

.tag-filter-bar::after {
  top: -3px;
  bottom: -4px;
  left: 0;
  right: 0;
  border-left: 1.5px dashed var(--stroke);
  border-right: 1.5px dashed var(--stroke);
  transform: rotate(0.3deg);
  filter: url(#wob);
}

/* Tag pills: one loose, irregular loop each, like a quick pencil circle */
.tag-pill::before,
.article-tag::before,
.rx-btn::before {
  content: "";
  z-index: -1;
  position: absolute;
  inset: -1px -2px;
  border: 1.3px solid var(--stroke);
  border-radius: 55% 45% 50% 50% / 60% 55% 45% 40%;
  transform: rotate(-0.8deg);
  filter: url(#wob2);
  pointer-events: none;
}

.tag-pill:nth-child(even)::before,
.article-tag:nth-child(even)::before,
.rx-btn:nth-child(even)::before {
  border-radius: 45% 55% 52% 48% / 50% 60% 40% 55%;
  transform: rotate(0.9deg);
}

.tag-pill:hover {
  --stroke: var(--blue);
}

.rx-btn::before {
  inset: -2px -4px;
  border-width: 1.6px;
  background: rgba(var(--white-rgb), 0.6);
}

.rx-btn:hover::before,
.rx-btn:focus-visible::before {
  background: rgba(var(--lime-rgb), 0.5);
}

.rx-btn.on::before {
  background: rgba(var(--lime-rgb), 0.85);
}

.article-tag::before {
  background: rgba(var(--blue-rgb), 0.08);
}

.rx-btn.on::before {
  border-width: 2.2px;
}

.rx-btn:hover,
.rx-btn:focus-visible {
  --stroke: var(--red);
}

.tag-pill.active {
  --stroke: var(--ink);
}

/* Category badge keeps its own colour for the strokes */
.article-type-badge {
  --stroke: currentColor;
}

/* Empty notes state */
.empty-notes {
  text-align: center;
  padding: 56px 24px;
  background-color: rgba(var(--paper-rgb), 0.6);
  position: relative;
  --stroke: rgba(var(--pencil-rgb), 0.6);
  margin: 32px 0;
}

.empty-notes::before,
.empty-notes::after {
  content: "";
  position: absolute;
  pointer-events: none;
  filter: url(#wob);
}

.empty-notes::before {
  left: -4px;
  right: -2px;
  top: 0;
  bottom: 0;
  border-top: 2px dashed var(--stroke);
  border-bottom: 2px dashed var(--stroke);
  transform: rotate(-0.3deg);
}

.empty-notes::after {
  top: -3px;
  bottom: -4px;
  left: 0;
  right: 0;
  border-left: 2px dashed var(--stroke);
  border-right: 2px dashed var(--stroke);
  transform: rotate(0.4deg);
}

.article-detail-wrap {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  padding-top: 36px;
}

/* Decorative doodles in the side margins, spread down the article (percent of the page height) */
.article-detail-wrap > .dd.abs { z-index: 3; }
.art-dd-1 { top: 3%;  right: -52px; transform: rotate(10deg); }
.art-dd-2 { top: 16%; left: -50px;  transform: rotate(-12deg); }
.art-dd-3 { top: 31%; right: -54px; transform: rotate(-6deg); }
.art-dd-4 { top: 46%; left: -56px;  transform: rotate(14deg); }
.art-dd-5 { top: 61%; right: -48px; transform: rotate(8deg); }
.art-dd-6 { top: 76%; left: -50px;  transform: rotate(-10deg); }
.art-dd-7 { top: 90%; right: -52px; transform: rotate(6deg); }

.article-content {
  font-size: 23px;
  line-height: 1.65;
  margin-top: 30px;
}

.article-content h1 {
  font-family: 'Caveat', cursive;
  font-size: clamp(38px, 6vw, 56px);
  color: var(--ink);
  margin: 36px 0 16px;
  line-height: 1.15;
}

.article-content h2 {
  font-family: 'Caveat', cursive;
  font-size: 38px;
  color: var(--red);
  margin: 32px 0 14px;
  line-height: 1.2;
  position: relative;
  display: inline-block;
}

.article-content h3 {
  font-family: 'Caveat', cursive;
  font-size: 32px;
  color: var(--blue);
  margin: 24px 0 10px;
}

/* Markdown body elements (previously styled with inline style attributes in js/articles.js) */
.article-content p {
  margin: 16px 0;
  line-height: 1.6;
}

.article-content pre {
  padding: 16px 20px;
  overflow-x: auto;
  background: rgba(var(--white-rgb), 0.6);
  margin: 24px 0;
}

.article-content :not(pre) > code {
  background: rgba(var(--lime-rgb), 0.3);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.9em;
}

.article-content blockquote {
  margin: 24px 0;
  padding: 18px 24px;
  font-family: 'Patrick Hand', cursive;
  font-size: 24px;
  line-height: 32px;
  color: var(--blue);
}

.article-content img {
  max-width: 100%;
  border-radius: 4px;
  margin: 20px 0;
  box-shadow: 0 2px 8px rgba(var(--black-rgb), 0.15);
}

.article-content ul.dash {
  margin: 16px 0;
}

.article-content .num-item {
  margin-left: 24px;
  margin-bottom: 8px;
}

.article-content ol {
  margin: 16px 0;
  padding-left: 16px;
}

.article-back-nav {
  margin-bottom: 36px;
}

.article-back-nav a {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 30px;
  color: var(--red);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Work Section
   -------------------------------------------------------------------------- */
.job {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 36px;
}

.when {
  flex: 0 0 190px;
  font-size: 34px;
  line-height: 36px;
  color: var(--red);
}

.what {
  flex: 1 1 420px;
  min-width: 0;
}

.what h3 {
  margin: 0 0 6px;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 44px;
  line-height: 48px;
}

.rule {
  height: 0;
  border-top: 2px solid var(--pencil);
  opacity: 0.55;
  margin: 36px 0;
  transform: rotate(-0.15deg);
  filter: url(#wob2);
}

.stack {
  margin: 12px 0 0;
}

/* --------------------------------------------------------------------------
   Projects Section
   -------------------------------------------------------------------------- */
.projects-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 54px 44px;
}

.project-card {
  flex: 1 1 300px;
  position: relative;
}

/* Screenshot pinned to the bottom-right corner like a torn-out photo taped on the note */
.project-card.has-shot {
  padding-bottom: 132px;
}

.proj-shot {
  position: absolute;
  right: -8px;
  bottom: -14px;
  z-index: 6;
  width: 190px;
  display: block;
  transform: rotate(3deg);
  filter: drop-shadow(2px 4px 4px rgba(var(--shadow-rgb), 0.32));
  transition: transform 0.25s ease, filter 0.25s ease;
}

.proj-shot::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 14px;
  z-index: 2;
  width: 46px;
  height: 16px;
  background: var(--tape-color);
  transform: rotate(-12deg);
  clip-path: polygon(0 10%, 5% 0, 10% 12%, 90% 0, 95% 10%, 100% 0, 100% 90%, 95% 100%, 90% 88%, 10% 100%, 5% 90%, 0 100%);
}

.proj-shot img {
  display: block;
  width: 100%;
  height: auto;
  padding: 6px 6px 7px;
  background: var(--paper-bright);
  /* irregular, hand-torn paper edge */
  clip-path: polygon(
    0 3%, 5% 0.5%, 11% 3.5%, 18% 1%, 26% 3%, 34% 0%, 43% 2.5%, 52% 0.5%, 61% 3%, 70% 0.5%, 79% 2.5%, 88% 0%, 95% 2%, 100% 0.5%,
    99% 12%, 100% 24%, 98.5% 37%, 100% 50%, 99% 63%, 100% 76%, 98.5% 88%, 100% 99%,
    93% 100%, 86% 97.5%, 77% 100%, 68% 97%, 59% 99.5%, 50% 97.5%, 41% 100%, 32% 97%, 23% 99.5%, 14% 97.5%, 6% 100%, 0 98%,
    1.2% 86%, 0 74%, 1% 62%, 0 50%, 1.2% 38%, 0 26%, 1% 14%
  );
}

.project-card.alt .proj-shot {
  transform: rotate(-3.5deg);
  right: -6px;
}

.project-card.alt .proj-shot::before {
  left: auto;
  right: 12px;
  transform: rotate(10deg);
}

.proj-shot:hover {
  transform: rotate(0deg) scale(1.05);
  filter: drop-shadow(3px 6px 6px rgba(var(--shadow-rgb), 0.38));
}

/* --------------------------------------------------------------------------
   School & Achievements Section
   -------------------------------------------------------------------------- */
.achieve-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.achieve-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.achieve-item svg {
  flex: 0 0 auto;
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   Contact Section
   -------------------------------------------------------------------------- */
.contact-card {
  max-width: 720px;
  padding: 36px 40px 30px;
  transform: rotate(-0.5deg);
}

.footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 60px;
  gap: 20px;
  flex-wrap: wrap;
}

/* Article reactions */
.reactions {
  position: relative;
  margin-top: 44px;
  padding-top: 22px;
}

/* wobbly dashed pencil divider instead of a ruler-straight border */
.reactions::before {
  content: "";
  position: absolute;
  top: 0;
  left: -4px;
  right: -2px;
  border-top: 2px dashed rgba(var(--pencil-rgb), 0.45);
  transform: rotate(-0.25deg);
  filter: url(#wob2);
  pointer-events: none;
}

.reactions-prompt {
  margin: 0 0 12px;
  font-size: 30px;
  line-height: 30px;
}

.reactions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.rx-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 16px;
  background: none;
  border: 0;
  position: relative;
  isolation: isolate;
  --stroke: var(--pencil);
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 24px;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.rx-btn:nth-child(odd) { transform: rotate(-0.8deg); }
.rx-btn:nth-child(even) { transform: rotate(0.7deg); }

.rx-btn:hover,
.rx-btn:focus-visible {
  transform: rotate(0deg) translateY(-2px);
}

.rx-btn:focus-visible {
  outline: 2px dashed var(--red);
  outline-offset: 2px;
}

.rx-btn.on {
  --stroke: var(--red);
  color: var(--red);
}

.rx-emoji {
  display: inline-flex;
  font-size: 22px;
  color: var(--blue);
}

.rx-emoji .doodle-ic {
  width: 26px;
  height: 26px;
}

.rx-btn[data-type="love"] .rx-emoji,
.rx-btn.on .rx-emoji {
  color: var(--red);
}

.rx-count {
  min-width: 1ch;
  color: var(--blue);
}

.rx-count:empty {
  display: none;
}

.rx-btn.pop .rx-emoji {
  animation: heart-pop 0.4s ease;
}

/* Heart button + visit counter in footer */
.heart-widget {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.heart-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 4px 0;
  background: none;
  border: 0;
  font: inherit;
  color: var(--blue);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.heart-btn .heart-label {
  font-family: 'Reenie Beanie', cursive;
  font-size: 28px;
  line-height: 28px;
}

.heart-btn:hover .heart-label,
.heart-btn:focus-visible .heart-label {
  background: linear-gradient(100deg, rgba(var(--lime-rgb), 0), rgba(var(--lime-rgb), 0.8) 6%, rgba(var(--lime-soft-rgb), 0.8) 94%, rgba(var(--lime-rgb), 0));
}

.heart-btn:focus-visible {
  outline: 2px dashed var(--red);
  outline-offset: 2px;
}

.heart-btn .dd {
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.heart-btn:hover .dd {
  transform: scale(1.15) rotate(-6deg);
}

.heart-btn.liked .dd {
  color: var(--red);
}

.heart-btn.liked .dd use {
  fill: rgba(var(--red-rgb), 0.55);
}

.heart-btn.pop .dd {
  animation: heart-pop 0.4s ease;
}

@keyframes heart-pop {
  40% { transform: scale(1.45) rotate(8deg); }
}

.visit-label {
  font-family: 'Reenie Beanie', cursive;
  font-size: 26px;
  line-height: 26px;
  color: var(--pencil);
}

/* --------------------------------------------------------------------------
   Doodle Icons (.dd)
   -------------------------------------------------------------------------- */
.dd {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: url(#wob2);
  overflow: visible;
  flex: 0 0 auto;
}

.dd .f {
  fill: rgba(var(--lime-rgb), 0.75);
  stroke: none;
}

.dd.b { color: var(--blue); }
.dd.r { color: var(--red); }
.dd.p { color: var(--pencil); }

.dd.abs {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  transition: transform 0.3s ease;
}

/* Floating interactive back-to-top button */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 52px;
  height: 52px;
  background: var(--paper);
  border: 2px solid var(--red);
  border-radius: 50%;
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  box-shadow: 2px 3px 10px rgba(var(--ink-rgb), 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) rotate(-4deg);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background 0.2s ease;
  filter: url(#wob2);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) rotate(-4deg);
}

.back-to-top:hover {
  background: rgba(var(--lime-rgb), 0.4);
  transform: translateY(-3px) rotate(0deg);
}

/* --------------------------------------------------------------------------
   Layout helpers & utilities (replace the old inline style attributes)
   Kept after the components so they win at equal specificity.
   -------------------------------------------------------------------------- */
.svg-defs { position: absolute; }
.wob2 { filter: url(#wob2); }

/* spacing: top margin only (other sides 0) */
.mt-6  { margin: 6px 0 0; }
.mt-10 { margin: 10px 0 0; }
.mt-12 { margin: 12px 0 0; }
.mt-18 { margin: 18px 0 0; }
.mt-20 { margin: 20px 0 0; }
.mt-36 { margin: 36px 0 0; }
.mb-30 { margin: 0 0 30px; }

/* type */
.fs-34 { font-size: 34px; }
.fs-42 { font-size: 42px; }
.hand-34 { font-size: 34px; line-height: 36px; }
.c-ink { color: var(--ink); }
.card .h3-red { color: var(--red); }
.wrap-anywhere { overflow-wrap: anywhere; }

/* flex columns */
.col-280 { flex: 1 1 280px; }
.col-400 { flex: 1 1 400px; min-width: 0; }

/* rotations */
.card.rot-0_6 { transform: rotate(0.6deg); }
.rot-5 { transform: rotate(5deg); }
.rot-6 { transform: rotate(6deg); }
.rot-n4 { transform: rotate(-4deg); }
.rot-8 { transform: rotate(8deg); }
.rot-12 { transform: rotate(12deg); }
.rot-n12 { transform: rotate(-12deg); }
.rot-n6 { transform: rotate(-6deg); }
.rot-n8 { transform: rotate(-8deg); }

/* home page blocks */
.notebook-card-title { font-size: 36px; line-height: 42px; text-align: center; margin-bottom: 12px; }
.doodle-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 24px 0 0 18px; }
.icon-row { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 18px; }
.skills-grid { display: flex; flex-wrap: wrap; gap: 48px 44px; }
.school-grid { display: flex; flex-wrap: wrap; gap: 48px 56px; }
.ai-intro { margin: 8px 0 22px; max-width: 760px; }
.ai-nutshell-title { margin: 0 0 6px; }
.ai-nutshell { margin: 0 0 34px; }
.ai-nutshell li { break-inside: avoid; }

/* Hero second row: buttons on the left half, "Things I enjoy" on the right half */
.hero-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 36px 56px; align-items: start; padding-bottom: 20px; }
.hero-bottom .hero-actions { margin-top: 0; }
.enjoy-mobile { display: none; }
.sec-note { display: flex; align-items: center; gap: 10px; margin: -12px 0 30px; }
.sec-note.sec-note-lg { margin-bottom: 36px; }
.school-heading { margin: 0 0 18px; font-size: 42px; line-height: 48px; }
.sec.sec-last { padding-bottom: 90px; }
.contact-lead { margin: 0; font-size: 46px; line-height: 60px; font-weight: 500; }
.note-row { display: inline-flex; align-items: center; gap: 12px; }
.card-desc { margin: 6px 0 12px; }

/* articles pages */
.stick.stick-sm { width: 480px; }
.page-intro { padding: 48px 0 20px; }
.page-kicker { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.page-title { font-size: clamp(54px, 8vw, 84px); line-height: 1.05; margin: 0 0 16px; color: var(--ink); }
.page-lede { font-size: 24px; line-height: 34px; max-width: 680px; margin: 0; }
.card-excerpt { margin: 12px 0 16px; font-size: 22px; line-height: 30px; }
.btn.btn-sm { font-size: 26px; padding: 6px 20px; }
.btn.btn-xs { font-size: 22px; padding: 6px 20px; }
.site-footer { margin-top: 80px; padding-bottom: 60px; }
.rbox.card.article-sheet { position: relative; padding: 48px 44px 40px; background: rgba(var(--paper-rgb), 0.85); }
.article-footer-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 40px; gap: 20px; flex-wrap: wrap; }
.not-found { text-align: center; padding: 40px 0; }
.empty-icon { font-size: 52px; color: var(--red); display: block; margin-bottom: 12px; }
.empty-icon .doodle-ic { width: 1em; height: 1em; }
.empty-notes .empty-title { font-size: 36px; margin: 0 0 8px; }
.empty-text { font-size: 22px; color: var(--pencil); max-width: 480px; margin: 0 auto 20px; }
.is-hidden { display: none; }

/* doodles that fill the empty corner of each skill card */
.skill-doodles { position: absolute; right: 18px; bottom: 16px; display: flex; align-items: flex-end; gap: 10px; pointer-events: none; }

/* hand-placed floating doodles, per section (were inline right/top/rotate) */
#about > .dd.abs:nth-of-type(1) { right: 20px; top: 30px; transform: rotate(8deg); }
#about > .dd.abs:nth-of-type(2) { right: 140px; top: 58px; }
#skills > .dd.abs:nth-of-type(1) { right: 30px; top: 20px; transform: rotate(-6deg); }
#skills > .dd.abs:nth-of-type(2) { right: 150px; top: 70px; transform: rotate(10deg); }
#work > .dd.abs:nth-of-type(1) { right: 20px; top: 10px; transform: rotate(14deg); }
#work > .dd.abs:nth-of-type(2) { right: 150px; top: 90px; }
#projects > .dd.abs:nth-of-type(1) { right: 24px; top: 20px; transform: rotate(-8deg); }
#projects > .dd.abs:nth-of-type(2) { right: 150px; top: 90px; transform: rotate(-10deg); }
#school > .dd.abs:nth-of-type(1) { right: 24px; top: 20px; transform: rotate(6deg); }
#school > .dd.abs:nth-of-type(2) { right: 150px; top: 44px; transform: rotate(-8deg); }
#contact > .dd.abs:nth-of-type(1) { right: 30px; top: 90px; transform: rotate(-8deg); }
#contact > .dd.abs:nth-of-type(2) { right: 170px; top: 60px; transform: rotate(10deg); }
#contact > .dd.abs:nth-of-type(3) { right: 60px; top: 230px; }

/* --------------------------------------------------------------------------
   Responsive Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .dd.abs {
    display: none;
  }
}

@media (min-width: 900px) {
  .ai-nutshell {
    columns: 2;
    column-gap: 44px;
  }
}

@media (max-width: 768px) {
  /* "Things I enjoy" leaves the hero and shows above Skills instead (enjoy -> skills -> contact) */
  .hero-bottom {
    grid-template-columns: 1fr;
  }

  .enjoy-hero {
    display: none;
  }

  .enjoy-mobile {
    display: block;
  }

  .header-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Nav takes real space (no overlap with logo) and scrolls sideways on one row */
  .stickwrap {
    height: auto;
    top: 6px;
    justify-content: center;
  }

  .stick {
    width: 100%;
    height: auto;
    margin-top: 12px;
    flex-wrap: nowrap;
    justify-content: space-around;
    transform: rotate(0.6deg);
  }

  .nav {
    flex-wrap: nowrap;
  }

  /* Keep only the key links (About, Work, Articles, Contact) so nothing scrolls or clips the pin */
  .nav a.nav-minor {
    display: none;
  }

  .nav a {
    flex: 0 0 auto;
    padding: 6px 4px;
  }
  
  .hero-actions {
    margin-top: 32px;
  }
  
  .job {
    flex-direction: column;
    gap: 8px;
  }
  
  .when {
    flex: auto;
  }
}

@media (max-width: 640px) {
  .pg::after {
    display: none;
  }
  
  .pg {
    font-size: 20px;
    padding-left: clamp(24px, 6vw, 44px);
  }
  
  .pg::before {
    left: 12px;
  }

  .nav a {
    font-size: 26px;
  }

  .stick {
    height: auto;
    padding: 18px 14px 8px;
    gap: 0 8px;
  }
  
  .sec-title {
    font-size: 48px;
    line-height: 50px;
  }
  
  .sec-title .n {
    font-size: 28px;
  }
  
  .card {
    padding: 24px 20px;
  }
  
  .contact-card {
    padding: 24px 20px;
  }
  
  .btn {
    font-size: 28px;
    padding: 8px 20px;
  }

  .back-to-top {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
  }

  /* Tighter vertical rhythm on phones */
  header {
    padding-top: 8px;
  }

  .logo-text {
    font-size: 34px;
    line-height: 44px;
  }

  .hero-content {
    padding: 12px 0 16px;
    gap: 24px;
  }

  .hero-subtitle {
    margin-top: 14px;
    line-height: 46px;
  }

  .hero-desc {
    margin-top: 14px;
  }

  .hero-actions {
    margin-top: 24px;
    gap: 20px 28px;
  }

  .sec {
    padding: 32px 0 12px;
    scroll-margin-top: 84px;
  }

  .sec-title {
    margin-bottom: 28px;
  }

  .ai-card {
    margin-top: 36px;
  }

  .footer-bar {
    margin-top: 36px;
  }

  .page-intro {
    padding: 20px 0 12px;
  }

  /* The "My Notebook" card (name, subject, class, city) is hidden on phones */
  .notebook-card-wrapper {
    display: none;
  }

  .project-card.has-shot {
    padding-bottom: 112px;
  }

  .proj-shot {
    width: 156px;
  }
}

/* --------------------------------------------------------------------------
   Page-turn transition (cross-document View Transitions; direction from js/page-flip.js)
   Forward: the current page turns away around the binder on the left, revealing the next one.
   Back: the previous page turns back in over the current one. The yellow nav note stays put.
   Unsupported browsers just navigate normally.
   -------------------------------------------------------------------------- */
@view-transition {
  navigation: auto;
}

.stick {
  view-transition-name: pin-note;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.75s;
  animation-timing-function: cubic-bezier(0.55, 0.05, 0.25, 1);
  animation-fill-mode: both;
  mix-blend-mode: normal;
  transform-origin: left center;
}

:root:active-view-transition-type(page-forward)::view-transition-old(root) {
  z-index: 3;
  animation-name: page-turn-away;
}

:root:active-view-transition-type(page-forward)::view-transition-new(root) {
  z-index: 1;
  animation-name: page-uncover;
}

:root:active-view-transition-type(page-back)::view-transition-old(root) {
  z-index: 1;
  animation-name: page-cover;
}

:root:active-view-transition-type(page-back)::view-transition-new(root) {
  z-index: 3;
  animation-name: page-turn-in;
}

@keyframes page-turn-away {
  from { transform: perspective(2400px) rotateY(0deg); filter: drop-shadow(0 0 0 rgba(var(--shadow-rgb), 0)); }
  60%  { filter: drop-shadow(14px 0 22px rgba(var(--shadow-rgb), 0.35)); }
  to   { transform: perspective(2400px) rotateY(-100deg); opacity: 0.15; filter: drop-shadow(0 0 0 rgba(var(--shadow-rgb), 0)); }
}

@keyframes page-uncover {
  from { filter: brightness(0.86); }
  to   { filter: brightness(1); }
}

@keyframes page-cover {
  from { filter: brightness(1); }
  to   { filter: brightness(0.86); }
}

@keyframes page-turn-in {
  from { transform: perspective(2400px) rotateY(-100deg); opacity: 0.15; filter: drop-shadow(0 0 0 rgba(var(--shadow-rgb), 0)); }
  40%  { filter: drop-shadow(14px 0 22px rgba(var(--shadow-rgb), 0.35)); }
  to   { transform: perspective(2400px) rotateY(0deg); opacity: 1; filter: drop-shadow(0 0 0 rgba(var(--shadow-rgb), 0)); }
}

@media (max-width: 640px) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.55s;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* --------------------------------------------------------------------------
   Scroll Reveal - "written on the page" (js/reveal.js; scoped to .rv-ready)
   -------------------------------------------------------------------------- */
.rv-ready .rv-w {
  display: inline-block;
  clip-path: inset(-25% 100% -25% -6%);
  opacity: 0;
  translate: 0 0.12em;
  transition: clip-path 0.45s cubic-bezier(0.25, 0.7, 0.3, 1),
              opacity 0.35s ease-out,
              translate 0.45s cubic-bezier(0.25, 0.7, 0.3, 1);
  transition-delay: calc(var(--base, 0ms) + var(--i, 0) * var(--step, 40ms));
}

.rv-ready .rv.rv-on .rv-w {
  clip-path: inset(-25% -6% -25% -6%);
  opacity: 1;
  translate: 0 0;
}

/* Blocks under an SVG filter (titles) appear as ONE piece (fade + small rise): animating many
   children inside a filtered element would re-run the filter on every frame and stutter.
   Do NOT use clip-path on these: they are IntersectionObserver targets, and Chrome treats a
   fully clipped target as not intersecting, so the title would never show up. */
.rv-ready .rv-whole {
  opacity: 0;
  translate: 0 0.2em;
  transition: opacity 0.6s ease-out, translate 0.6s cubic-bezier(0.25, 0.7, 0.3, 1);
  transition-delay: var(--base, 0ms);
}

.rv-ready .rv-whole.rv-on {
  opacity: 1;
  translate: 0 0;
}

/* Steady state after the reveal: nothing left on the filtered title (Safari/iOS can drop
   filtered layers while momentum-scrolling, which made section numbers vanish). */
.rv-ready .rv-whole.rv-fin {
  opacity: 1;
  translate: none;
  transition: none;
}

/* Touch & Mobile devices: faster reveal transitions to keep pace with rapid flick scrolling */
@media (max-width: 768px), ((hover: none) and (pointer: coarse)) {
  .rv-ready .rv-w {
    transition: clip-path 0.25s cubic-bezier(0.25, 0.7, 0.3, 1),
                opacity 0.2s ease-out,
                translate 0.25s cubic-bezier(0.25, 0.7, 0.3, 1);
  }

  .rv-ready .rv-whole {
    translate: 0 0.15em;
    transition: opacity 0.3s ease-out, translate 0.3s ease-out;
    transition-delay: var(--base, 0ms);
  }

  .rv-ready .rv-whole.rv-on {
    translate: 0 0;
  }

  .rv-ready .rv-box {
    transition: opacity 0.3s ease-out, translate 0.3s cubic-bezier(0.25, 0.7, 0.3, 1);
  }

  .rv-ready .rv.rv-on .hl {
    transition: background-size 0.35s ease-out 0.15s;
  }

  .rv-ready .rv.rv-on .u::after,
  .rv-ready .rv.rv-on .lk::after {
    transition: transform 0.3s ease-out 0.15s;
  }

  .rv-ready .sec-title.rv-on::after {
    transition: transform 0.35s ease-out 0.15s;
  }
}

/* Highlighter marker is painted after the words are written */
.rv-ready .rv .hl {
  background-repeat: no-repeat;
  background-size: 0% 100%;
}

.rv-ready .rv.rv-on .hl {
  background-size: 100% 100%;
  transition: background-size 0.6s ease-out 0.5s;
}

/* Hand-drawn underlines and circles are drawn after the words */
.rv-ready .rv .u::after,
.rv-ready .rv .lk::after {
  transform-origin: left;
  transform: rotate(-0.7deg) scaleX(0);
}

.rv-ready .rv.rv-on .u::after,
.rv-ready .rv.rv-on .lk::after {
  transform: rotate(-0.7deg) scaleX(1);
  transition: transform 0.45s ease-out 0.5s;
}

.rv-ready .rv .circ::before {
  opacity: 0;
}

.rv-ready .rv.rv-on .circ::before {
  opacity: 1;
  transition: opacity 0.5s ease 0.6s;
}

.rv-ready .dash li.rv::before {
  opacity: 0;
}

.rv-ready .dash li.rv.rv-on::before {
  opacity: 1;
  transition: opacity 0.2s ease var(--base, 0ms);
}

/* Section title underline is drawn last */
.rv-ready .sec-title.rv::after {
  transform: rotate(-0.35deg) scaleX(0);
  transform-origin: left;
}

.rv-ready .sec-title.rv-on::after {
  transform: rotate(-0.35deg) scaleX(1);
  transition: transform 0.5s ease-out 0.45s;
}

.rv-ready .rv-box {
  opacity: 0;
  translate: 0 14px;
  transition: opacity 0.5s ease-out, translate 0.5s cubic-bezier(0.25, 0.7, 0.3, 1),
              transform 0.25s ease, box-shadow 0.25s ease;
  transition-delay: var(--base, 0ms), var(--base, 0ms), 0s, 0s;
}

.rv-ready .rv-box.rv-on {
  opacity: 1;
  translate: 0 0;
}

/* The article card is thousands of px tall. Filtering its full-size pseudo borders is very
   costly, so it draws four THIN edge elements instead (the wobble filter only has to process
   a few pixels of width) and the full-size pseudo borders are switched off. */
.article-detail-wrap > .rbox::before,
.article-detail-wrap > .rbox::after {
  display: none;
}

.rbox-edge {
  position: absolute;
  pointer-events: none;
  border: 0 solid var(--pencil);
  opacity: 0.88;
}

.rbox-edge.t, .rbox-edge.b {
  filter: url(#wob-h);
  height: 0;
}

.rbox-edge.l, .rbox-edge.r {
  filter: url(#wob-v);
  width: 0;
}

.rbox-edge.t { top: 0; left: -9px; right: -5px; border-top-width: 2.5px; transform: rotate(-0.25deg); }
.rbox-edge.b { bottom: 0; left: -5px; right: -9px; border-top-width: 2px; transform: rotate(0.3deg); }
.rbox-edge.l { left: 0; top: -7px; bottom: -10px; border-left-width: 2px; transform: rotate(0.25deg); }
.rbox-edge.r { right: 0; top: -10px; bottom: -6px; border-left-width: 2.5px; transform: rotate(-0.3deg); }

/* Floating doodles fade in */
.rv-ready .rv-doodle {
  opacity: 0;
  transition: opacity 0.6s ease 0.2s, transform 0.3s ease;
}

.rv-ready .rv-doodle.rv-on {
  opacity: 1;
}

@media print {
  .rv-ready .rv-w, .rv-ready .rv-whole, .rv-ready .rv-box, .rv-ready .rv-doodle {
    clip-path: none !important;
    opacity: 1 !important;
    translate: none !important;
  }
  .rv-ready .rv .hl { background-size: 100% 100% !important; }
  .rv-ready .sec-title.rv::after { transform: rotate(-0.35deg) !important; }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
  body, .pg {
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  
  .pg::before, .pg::after, .paper-overlay, .back-to-top {
    display: none !important;
  }
  
  .sec {
    page-break-inside: avoid;
    padding: 20px 0 !important;
  }
}
