/* ============ Lab Notebook — quiet study palette ============ */
:root {
  --paper: #F7F5F0;
  --card: #FFFDF8;
  --ink: #2B3A42;
  --ink-soft: #5A6B73;
  --sage: #8FA98F;
  --sage-deep: #6E8B6E;
  --amber: #D9A86C;
  --rose: #C98A8A;
  --grid: #E7E3D8;
  --shadow: 0 2px 6px rgba(43, 58, 66, .08), 0 10px 24px rgba(43, 58, 66, .07);
  --shadow-lift: 0 4px 10px rgba(43, 58, 66, .10), 0 18px 36px rgba(43, 58, 66, .12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  line-height: 1.6;
  overflow-x: hidden;
}

.mono { font-family: 'JetBrains Mono', monospace; }
.caveat { font-family: 'Caveat', cursive; }
h1, h2, h3 { font-family: 'Fraunces', serif; line-height: 1.15; }
a { color: var(--sage-deep); }

/* ============ Top bar ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .8rem clamp(1rem, 4vw, 3rem);
  background: rgba(247, 245, 240, .88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--grid);
}
.logo {
  font-family: 'Fraunces', serif; font-weight: 700; font-size: 1.25rem;
  color: var(--ink); text-decoration: none;
}
.logo-dot { color: var(--amber); }
.topnav { display: flex; gap: 1.1rem; flex-wrap: wrap; margin-right: auto; }
.topnav a {
  color: var(--ink-soft); text-decoration: none; font-size: .9rem; font-weight: 500;
  border-bottom: 2px solid transparent; padding-bottom: 2px;
  transition: color .2s, border-color .2s;
}
.topnav a:hover { color: var(--ink); border-color: var(--amber); }

/* recruiter switch */
.recruiter-switch { display: flex; align-items: center; gap: .5rem; cursor: pointer; user-select: none; }
.recruiter-switch input { position: absolute; opacity: 0; }
.rs-track {
  width: 38px; height: 21px; border-radius: 21px; background: var(--grid);
  display: inline-block; position: relative; transition: background .25s;
  border: 1px solid #d9d4c7;
}
.rs-thumb {
  position: absolute; top: 2px; left: 2px; width: 15px; height: 15px;
  border-radius: 50%; background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .25s;
}
.recruiter-switch input:checked + .rs-track { background: var(--sage); }
.recruiter-switch input:checked + .rs-track .rs-thumb { transform: translateX(17px); }
.recruiter-switch input:focus-visible + .rs-track { outline: 2px solid var(--sage-deep); outline-offset: 2px; }
.rs-label { font-size: .78rem; font-family: 'JetBrains Mono', monospace; color: var(--ink-soft); }

/* ============ Hero ============ */
.hero {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 2rem; align-items: center;
  max-width: 1100px; margin: 0 auto; padding: clamp(3rem, 9vh, 6rem) 1.5rem 3rem;
}
.eyebrow { color: var(--sage-deep); font-size: .85rem; letter-spacing: .02em; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.2rem); font-weight: 600; margin: .6rem 0 1rem; }

/* amber marker underline, draws in */
.marker { position: relative; white-space: nowrap; }
.marker::after {
  content: ""; position: absolute; left: -1%; right: auto; bottom: .06em;
  width: 102%; height: .28em; z-index: -1;
  background: linear-gradient(100deg, var(--amber), #e6bf8b);
  border-radius: 3px; opacity: .55; transform: skewX(-8deg) scaleX(0);
  transform-origin: left; animation: markerDraw .9s .5s ease forwards;
}
@keyframes markerDraw { to { transform: skewX(-8deg) scaleX(1); } }

.hero-sub { font-size: 1.15rem; color: var(--ink-soft); max-width: 34rem; }
.hero-sub em { color: var(--ink); font-style: normal; border-bottom: 2px dotted var(--amber); }
.hero-stats { margin-top: 1.1rem; font-size: .85rem; color: var(--sage-deep); }
.hero-cta { display: flex; gap: .8rem; margin-top: 1.6rem; flex-wrap: wrap; }
.hero-note {
  display: inline-block; margin-top: 1.4rem; font-size: 1.25rem; color: var(--ink-soft);
  transform: rotate(-2deg);
}
.hero-note::after { content: ""; display: inline-block; width: .6em; animation: dots 1.6s steps(3) infinite; }

/* hero doodle: taped-in notebook page */
.hero-doodle { position: relative; }
.hero-doodle img {
  max-width: 100%; height: auto; display: block;
  border-radius: 4px; transform: rotate(1.6deg);
  box-shadow: var(--shadow-lift); border: 1px solid #EAE4D5;
}
.hero-doodle::before, .hero-doodle::after {
  content: ""; position: absolute; width: 74px; height: 26px; z-index: 2;
  background: rgba(217, 168, 108, .45); border-radius: 2px;
  box-shadow: 0 1px 2px rgba(43,58,66,.12);
}
.hero-doodle::before { top: -10px; left: 14%; transform: rotate(-5deg); }
.hero-doodle::after { bottom: -8px; right: 12%; transform: rotate(4deg); }
.hero-doodle.fallback::before, .hero-doodle.fallback::after { display: none; }
.hero-doodle .nn-fallback { display: none; }
.hero-doodle.fallback img { display: none; }
.hero-doodle.fallback .nn-fallback { display: block; width: 100%; color: var(--ink-soft); }
.nn-nodes circle { fill: var(--card); stroke: var(--ink-soft); stroke-width: 1.5; animation: nodePulse 3s ease-in-out infinite; }
.nn-nodes circle:nth-child(2n) { animation-delay: .8s; }
.nn-nodes circle:nth-child(3n) { animation-delay: 1.6s; }
@keyframes nodePulse { 0%,100% { fill: var(--card); } 50% { fill: #EDE7D9; } }
.caveat-svg { font-family: 'Caveat', cursive; font-size: 15px; fill: var(--ink-soft); }

/* ============ Buttons ============ */
.btn {
  display: inline-block; padding: .65rem 1.25rem; border-radius: 8px;
  font-weight: 600; font-size: .92rem; text-decoration: none;
  transition: transform .18s, box-shadow .18s, background .18s;
}
.btn-primary { background: var(--ink); color: var(--paper); box-shadow: var(--shadow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.btn-ghost { color: var(--ink); border: 1.5px solid #cfc9ba; background: var(--card); }
.btn-ghost:hover { border-color: var(--sage); transform: translateY(-2px); }

/* ============ Sections ============ */
.section { max-width: 1100px; margin: 0 auto; padding: clamp(3rem, 8vh, 5rem) 1.5rem; }
.section-head { max-width: 44rem; margin-bottom: 2.2rem; position: relative; }
.section-icon {
  height: 46px; width: auto; display: block; margin-bottom: .5rem;
  transform: rotate(-4deg); filter: drop-shadow(1px 2px 2px rgba(43,58,66,.15));
}
.section-head h2 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); font-weight: 600; margin: .5rem 0; }
.section-sub { color: var(--ink-soft); }

/* ============ Skills bars ============ */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1.4rem 2.5rem; }
.skill-top { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: .45rem; }
.skill-pct { color: var(--sage-deep); }
.bar { height: 10px; border-radius: 6px; background: #EAE6DA; border: 1px solid #E0DBCC; overflow: hidden; }
.bar-fill {
  height: 100%; width: 0; border-radius: 6px;
  background: linear-gradient(90deg, var(--sage), var(--sage-deep));
  transition: width 1.1s cubic-bezier(.25,.7,.3,1);
}
.skill.in .bar-fill { width: var(--w); }
.skill-note { font-size: .82rem; color: var(--ink-soft); margin-top: .35rem; }
.skill-ships { font-size: .7rem; color: var(--sage-deep); margin-top: .25rem; }

/* ============ Experiment board ============ */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.4rem; }
.board-title { font-size: .85rem; color: var(--ink-soft); margin-bottom: 1rem; letter-spacing: .04em; }
.sticky {
  padding: 1rem 1.1rem; margin-bottom: 1rem; border-radius: 4px;
  font-size: .92rem; box-shadow: var(--shadow); position: relative;
  transition: transform .2s;
}
.sticky:hover { transform: scale(1.02) rotate(0deg) !important; }
.board-col .sticky:nth-child(2) { transform: rotate(-1.2deg); }
.board-col .sticky:nth-child(3) { transform: rotate(.9deg); }
.board-col .sticky:nth-child(4) { transform: rotate(-.7deg); }
.s-sage { background: #E9EFE6; border-top: 3px solid var(--sage); }
.s-amber { background: #F5EBDC; border-top: 3px solid var(--amber); }
.s-rose { background: #F3E4E4; border-top: 3px solid var(--rose); }

/* ============ Project cards ============ */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 1.8rem; }
.card {
  background: var(--card); border-radius: 6px; padding: 1.6rem 1.5rem 1.3rem;
  box-shadow: var(--shadow); position: relative; border: 1px solid #EFEAE0;
  transition: transform .25s ease, box-shadow .25s ease;
}
.card:nth-child(odd) { transform: rotate(-.8deg); }
.card:nth-child(even) { transform: rotate(.7deg); }
.card:hover { transform: rotate(0) translateY(-5px); box-shadow: var(--shadow-lift); }

.pin {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #eec687, var(--amber) 55%, #b07f42);
  box-shadow: 0 3px 4px rgba(43,58,66,.28);
}
.card h3 { font-size: 1.25rem; margin-bottom: .2rem; }
.card-tag { font-size: .74rem; color: var(--sage-deep); margin-bottom: .7rem; letter-spacing: .03em; }
.card p { font-size: .92rem; color: var(--ink-soft); }
.card > p:nth-of-type(2) { color: var(--ink); opacity: .85; }

/* flip card (RAG project) */
.card-flip { perspective: 1200px; cursor: pointer; outline-offset: 4px; }
.cardflip-inner {
  position: relative; transform-style: preserve-3d;
  transition: transform .65s cubic-bezier(.4,.1,.2,1);
}
.card-flip.flipped .cardflip-inner { transform: rotateY(180deg); }
.cardflip-front { backface-visibility: hidden; }
.cardflip-back {
  position: absolute; inset: 0; backface-visibility: hidden; transform: rotateY(180deg);
  display: flex; flex-direction: column; gap: .5rem;
}
.cardflip-back .rag-sketch {
  width: 100%; height: auto; flex: none; margin: auto 0;
  border: 1px solid #EAE4D5; border-radius: 4px;
}
.cardflip-back .cardflip-links { margin-top: auto; }
.cardflip-links { font-size: .78rem; }
.cardflip-links a { color: var(--sage-deep); text-decoration: none; border-bottom: 1px dotted var(--sage); }
.rag-title { font-size: 26px; fill: var(--ink); }
.rag-sketch .caveat-svg { font-size: 19px; }
.rag-sketch .rag-title { font-size: 26px; }
.rag-mono { font-family: 'JetBrains Mono', monospace; font-size: 15px; fill: var(--ink); }
.rag-box rect { fill: #FFFEFA; stroke: var(--ink-soft); stroke-width: 1.5; }
.rag-arrow { stroke: var(--sage-deep); stroke-width: 1.8; stroke-linecap: round; marker-end: url(#ragArrowhead); }

/* pipeline chips */
.pipeline { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: .9rem 0 .6rem; font-size: .7rem; }
.pipeline span {
  background: #EFEBDF; border: 1px solid #E3DECE; color: var(--ink-soft);
  padding: .18rem .5rem; border-radius: 20px; position: relative;
  transition: background .3s, color .3s;
}
.pipeline span:not(:last-child)::after { content: "→"; position: absolute; right: -14px; color: var(--sage); }
.pipeline span { margin-right: 12px; }
.card.in .pipeline span { animation: chipLight .5s ease forwards; animation-delay: calc(var(--i, 0) * .18s + .3s); }
@keyframes chipLight { to { background: #E5EDE2; color: var(--sage-deep); border-color: var(--sage); } }
.card-stack { font-size: .72rem; color: #9AA5A0; }

/* more projects */
.more-projects { margin-top: 2.6rem; background: var(--card); border: 1px dashed #D8D2C2; border-radius: 6px; padding: 1.4rem 1.6rem; }
.more-title { color: var(--sage-deep); font-size: .82rem; margin-bottom: .8rem; }
.more-projects ul { list-style: none; }
.more-projects li { font-size: .82rem; color: var(--ink-soft); padding: .28rem 0; border-bottom: 1px dotted var(--grid); }
.more-projects li:last-child { border-bottom: none; }
.more-projects strong { color: var(--ink); font-weight: 500; }

/* ============ App windows (macOS-style cards) ============ */
.app-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.app-window {
  background: var(--card); border: 1px solid #E7E1D2; border-radius: 10px;
  box-shadow: var(--shadow); overflow: hidden;
  transition: transform .22s, box-shadow .22s;
}
.app-window:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.app-titlebar {
  display: flex; align-items: center; gap: .7rem; padding: .5rem .8rem;
  background: #F0EBDE; border-bottom: 1px solid #E7E1D2; font-size: .74rem; color: var(--ink-soft);
}
.app-name { font-weight: 600; color: var(--ink); }
.app-platform {
  margin-left: auto; font-size: .66rem; padding: .1rem .5rem; border-radius: 10px;
  background: #E5EDE2; color: var(--sage-deep); border: 1px solid #D5E0D1;
}
.app-body { padding: 1rem 1.1rem 1.1rem; }
.app-body p { font-size: .88rem; color: var(--ink-soft); }
.app-body code { font-family: 'JetBrains Mono', monospace; font-size: .8em; background: #F1ECDD; padding: 0 .3em; border-radius: 3px; }
.app-body .card-stack { margin-top: .6rem; }
.app-count { margin-top: 2rem; font-size: .78rem; color: var(--sage-deep); }
/* featured apps: full-width windows with feature lists */
.app-featured { grid-column: 1 / -1; }
.app-featured .app-titlebar { background: #EBE4D2; }
.app-features { list-style: none; margin: .7rem 0; columns: 2; column-gap: 2.2rem; }
.app-features li {
  font-size: .85rem; color: var(--ink-soft); padding: .25rem 0 .25rem 1.1rem;
  position: relative; break-inside: avoid;
}
.app-features li::before { content: "→"; position: absolute; left: 0; color: var(--sage); }
.app-features b { color: var(--ink); font-weight: 600; }
@media (max-width: 820px) { .app-features { columns: 1; } }

/* ============ Value / what I bring ============ */
.value-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.6rem 2.4rem; }
.value-item { border-left: 3px solid var(--sage); padding-left: 1rem; }
.value-k { color: var(--sage-deep); font-size: .82rem; margin-bottom: .35rem; letter-spacing: .02em; }
.value-item p:last-child { font-size: .92rem; color: var(--ink-soft); }

/* ============ Research wall (flip cards) ============ */
.papers { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.8rem; }
.paper-flip { perspective: 1200px; cursor: pointer; min-height: 270px; outline-offset: 4px; }
.paper-inner {
  position: relative; width: 100%; height: 100%; min-height: 270px;
  transform-style: preserve-3d; transition: transform .65s cubic-bezier(.4,.1,.2,1);
}
.paper-flip.flipped .paper-inner { transform: rotateY(180deg); }
.paper-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  background: var(--card); border-radius: 6px; padding: 1.7rem 1.5rem;
  box-shadow: var(--shadow); border: 1px solid #EFEAE0;
  display: flex; flex-direction: column;
}
.paper-front { transform: rotate(-.6deg); }
/* folded corner */
.paper-front::after {
  content: ""; position: absolute; top: 0; right: 0; width: 26px; height: 26px;
  background: linear-gradient(225deg, var(--paper) 0 50%, #EDE7D8 50% 100%);
  border-bottom-left-radius: 4px; box-shadow: -1px 1px 2px rgba(43,58,66,.08);
}
.paper-back { transform: rotateY(180deg); background: #FBF7EC; }
.paper-status { font-size: .72rem; color: var(--amber); margin-bottom: .8rem; }
.paper-face h3 { font-size: 1.2rem; margin-bottom: .5rem; }
.paper-venue { font-size: .88rem; color: var(--ink-soft); }
.flip-hint { margin-top: auto; font-size: .75rem; color: var(--sage-deep); }
.paper-back h4 { font-size: .78rem; color: var(--sage-deep); margin-bottom: .6rem; letter-spacing: .05em; }
.paper-back p { font-size: .88rem; color: var(--ink-soft); margin-bottom: .6rem; }
.paper-metrics { font-size: .74rem; color: var(--ink); background: #F1ECDD; padding: .4rem .6rem; border-radius: 4px; }
.paper-learned { margin-top: auto; font-size: .88rem; }
.paper-learned .caveat { font-size: 1.15rem; color: var(--sage-deep); }

/* ============ Git log timeline ============ */
.gitlog { border-left: 2px solid #D8D2C2; margin-left: .4rem; padding-left: 0; }
.commit {
  display: grid; grid-template-columns: 90px 90px 1fr; gap: 1rem; align-items: baseline;
  padding: .55rem 0 .55rem 1.6rem; position: relative; font-size: .86rem;
}
.commit::before {
  content: ""; position: absolute; left: -7px; top: 1.05em;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--sage); border: 2.5px solid var(--paper);
}
.c-head::before { background: var(--amber); animation: headPulse 2s ease-in-out infinite; }
@keyframes headPulse { 50% { box-shadow: 0 0 0 6px rgba(217,168,108,.25); } }
.c-hash { color: var(--sage-deep); }
.c-date { color: #9AA5A0; }
.c-msg { color: var(--ink-soft); }
.c-head .c-msg { color: var(--ink); font-weight: 500; }

/* ============ Contact ============ */
.contact { text-align: left; padding-bottom: 5rem; }
.contact-row { display: flex; gap: .8rem; flex-wrap: wrap; }
.footer-joke { margin-top: 3rem; font-size: .74rem; color: #A8A296; }

/* ============ Companion robot (free-roaming) ============ */
.companion {
  position: fixed; left: 0; top: 0; z-index: 60; cursor: pointer;
  width: 74px; height: 74px; /* box = robot only; bubble floats outside the flow */
  will-change: transform; touch-action: none;
}
.companion.dragging { cursor: grabbing; }
.companion-panel {
  position: absolute; bottom: calc(100% + 10px); right: 0;
  display: flex; flex-direction: column; align-items: flex-end; gap: .45rem;
  width: max-content;
}
.companion.on-left .companion-panel { right: auto; left: 0; align-items: flex-start; }
.companion.on-left .bubble { border-radius: 12px 12px 12px 2px; }
.robot { width: 74px; height: 74px; animation: bob 3.2s ease-in-out infinite; position: relative; }
.robot img {
  width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(43,58,66,.2));
  transform: scaleX(var(--fx, 1));
  -webkit-user-drag: none; user-select: none; pointer-events: none;
}
.robot.walking { animation: none; }
/* glide: gentle lean into the direction of travel */
.robot.walking img { transform: scaleX(var(--fx, 1)) rotate(calc(var(--fx, 1) * -5deg)); transition: transform .3s; }
.robot-emoji {
  display: none; font-size: 2.6rem; line-height: 74px;
  filter: grayscale(.25) drop-shadow(0 4px 6px rgba(43,58,66,.2));
}
.robot.fallback img { display: none; }
.robot.fallback .robot-emoji { display: block; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.bubble {
  background: var(--card); border: 1px solid #E3DECE; border-radius: 12px 12px 2px 12px;
  padding: .6rem .9rem; margin-bottom: .55rem; font-size: .84rem; color: var(--ink);
  box-shadow: var(--shadow); max-width: 230px; text-align: left;
  opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s;
}
.bubble.show { opacity: 1; transform: translateY(0); }

/* ============ Notebook page card (hero) ============ */
.notebook-card {
  display: inline-block; background: var(--card); border: 1px solid #E3DECE;
  border-radius: 6px; box-shadow: var(--shadow); padding: .7rem .95rem;
  font-size: .74rem; color: var(--ink-soft); margin-bottom: 1.1rem;
  transform: rotate(-1.2deg);
}
.nc-head {
  display: flex; gap: 1.4rem; justify-content: space-between;
  color: var(--sage-deep); border-bottom: 1px dashed #DDD7C6;
  padding-bottom: .4rem; margin-bottom: .45rem;
}
.nc-label { color: var(--amber); margin-bottom: .15rem; }
.nc-body p { margin: 0; line-height: 1.6; }

/* ============ Margin notes & highlights ============ */
.margin-note {
  font-size: 1.05rem; color: var(--sage-deep); font-weight: 500;
  white-space: nowrap; margin-left: .5rem; display: inline-block; transform: rotate(-2deg);
}
mark.hl {
  background: linear-gradient(100deg, transparent 2%, rgba(217,168,108,.42) 8%, rgba(217,168,108,.42) 92%, transparent 98%);
  color: inherit; padding: 0 .15em; border-radius: 2px;
}
.paper-note {
  position: absolute; bottom: 2.4rem; right: 1.2rem;
  font-size: 1.05rem; color: var(--amber); transform: rotate(-4deg);
}

/* ============ Engineering principles (index cards) ============ */
.principles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.4rem; }
.index-card {
  background: repeating-linear-gradient(var(--card), var(--card) 26px, #F0EBDD 27px);
  border: 1px solid #EFEAE0; border-top: 3px solid var(--sage);
  border-radius: 4px; padding: 1.1rem 1.2rem; box-shadow: var(--shadow);
  transition: transform .2s;
}
.index-card:nth-child(odd) { transform: rotate(-.7deg); }
.index-card:nth-child(even) { transform: rotate(.6deg); }
.index-card:hover { transform: rotate(0) translateY(-4px); }
.index-card h3 { font-size: 1.45rem; color: var(--ink); margin-bottom: .3rem; font-weight: 600; }
.index-card p { font-size: .88rem; color: var(--ink-soft); }

/* ============ End of notebook / gh live ============ */
.end-note { font-size: 1.25rem; color: var(--ink-soft); margin-bottom: 1.2rem; transform: rotate(-1deg); display: inline-block; }
.gh-live { font-size: .78rem; color: var(--sage-deep); margin-bottom: 1rem; }

/* ============ Typewriter ============ */
.typewriter { font-size: .95rem; color: var(--sage-deep); margin: -.4rem 0 1rem; min-height: 1.5em; }
.caret { animation: blink 1s steps(1) infinite; color: var(--amber); }
@keyframes blink { 50% { opacity: 0; } }

/* ============ Terminal button ============ */
.terminal-btn {
  background: var(--ink); color: var(--paper); border: none; border-radius: 6px;
  padding: .4rem .7rem; font-size: .76rem; cursor: pointer;
  transition: transform .15s, background .15s;
}
.terminal-btn:hover { transform: translateY(-1px); background: #3d4f59; }

/* ============ Terminal overlay ============ */
.terminal-overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(43, 58, 66, .45); backdrop-filter: blur(3px);
}
.terminal-overlay[hidden] { display: none; }
.terminal {
  width: min(760px, 94vw); height: min(480px, 80vh);
  background: #1E2A31; border-radius: 10px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(20, 30, 36, .5);
  display: flex; flex-direction: column;
  animation: termIn .25s ease;
}
@keyframes termIn { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.term-titlebar {
  display: flex; align-items: center; gap: 1rem; padding: .55rem .9rem;
  background: #162026; color: #8FA3AD; font-size: .74rem;
}
.term-dots { display: flex; gap: 6px; }
.term-dots i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.term-dots i:nth-child(1) { background: #E0756A; }
.term-dots i:nth-child(2) { background: var(--amber); }
.term-dots i:nth-child(3) { background: var(--sage); }
.term-close { margin-left: auto; background: none; border: none; color: #8FA3AD; cursor: pointer; font-size: .8rem; }
.term-close:hover { color: #fff; }
.term-body {
  flex: 1; overflow-y: auto; padding: 1rem 1.1rem; font-size: .82rem; line-height: 1.55;
  color: #D7E0D7; cursor: text;
}
.term-body .t-dim { color: #7C8F98; }
.term-body .t-sage { color: #A8C5A8; }
.term-body .t-amber { color: #E2BC85; }
.term-body .t-err { color: #E0968D; }
.term-body pre { font-family: inherit; white-space: pre-wrap; word-break: break-word; margin: 0; }
.term-inputline { display: flex; gap: .5rem; align-items: center; }
.term-prompt { color: var(--sage); white-space: nowrap; }
#termInput {
  flex: 1; background: none; border: none; outline: none;
  color: #D7E0D7; font: inherit; caret-color: var(--amber);
}

/* ============ Dataset shelf ============ */
.bookshelf {
  display: flex; align-items: flex-end; gap: .5rem; padding: 0 1rem 14px;
  position: relative; max-width: 720px; min-height: 220px;
}
.shelf-plank {
  position: absolute; left: 0; right: 0; bottom: 0; height: 12px;
  background: linear-gradient(#C9BFA8, #B5AA90); border-radius: 3px;
  box-shadow: 0 6px 10px rgba(43,58,66,.15);
}
.book {
  width: 56px; height: 190px; border-radius: 4px 8px 8px 4px; position: relative;
  cursor: pointer; transition: transform .25s ease;
  box-shadow: inset -6px 0 8px rgba(0,0,0,.12), 2px 3px 6px rgba(43,58,66,.2);
  outline-offset: 4px;
}
.book:hover, .book:focus-visible { transform: translateY(-14px) rotate(-2deg); }
.b1 { background: #8FA98F; height: 200px; }
.b2 { background: #C9A57A; height: 185px; }
.b3 { background: #7E93A0; height: 195px; }
.b4 { background: #C98A8A; height: 178px; }
.b5 { background: #A99BC0; height: 188px; }
.b6 { background: #B98F6E; height: 198px; }
.book-spine {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: 'Fraunces', serif; font-size: .82rem; font-weight: 600; color: rgba(255,253,248,.92);
  letter-spacing: .04em; padding: .6rem 0;
}
.book-info {
  position: absolute; bottom: calc(100% + 22px); left: 50%; transform: translateX(-50%) translateY(6px);
  background: var(--card); color: var(--ink-soft); border: 1px solid #E3DECE;
  padding: .5rem .7rem; border-radius: 8px; font-size: .74rem; width: 190px; text-align: center;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  font-family: 'JetBrains Mono', monospace;
}
.book:hover .book-info, .book:focus-visible .book-info { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ Companion panel ============ */
.ask-form { opacity: 0; transform: translateY(4px); transition: opacity .3s, transform .3s; pointer-events: none; }
.companion.open .ask-form { opacity: 1; transform: none; pointer-events: auto; }
#askInput {
  width: 210px; padding: .45rem .7rem; border-radius: 18px; border: 1px solid #D8D2C2;
  background: var(--card); font: .8rem 'JetBrains Mono', monospace; color: var(--ink);
  outline: none; box-shadow: var(--shadow);
}
#askInput:focus { border-color: var(--sage); }

/* ============ Gradient-descent rain (konami) ============ */
#rain { position: fixed; inset: 0; z-index: 200; pointer-events: none; }

/* recruiter mode hides new toys too */
body.recruiter .terminal-btn { display: none; }

/* ============ Scroll reveal — premium blur fade-up ============ */
.reveal {
  opacity: 0; transform: translateY(26px); filter: blur(6px);
  transition: opacity .9s cubic-bezier(.22,1,.36,1), transform .9s cubic-bezier(.22,1,.36,1), filter .9s cubic-bezier(.22,1,.36,1);
}
.reveal.in { opacity: 1; transform: translateY(0); filter: blur(0); }
/* orchestrated hero load */
.hero .reveal:nth-child(2) { transition-delay: .08s; }
.hero .reveal:nth-child(3) { transition-delay: .16s; }
.hero .reveal:nth-child(4) { transition-delay: .24s; }
.hero .reveal:nth-child(5) { transition-delay: .32s; }
.hero .reveal:nth-child(6) { transition-delay: .40s; }
.card.reveal.in:nth-child(odd) { transform: rotate(-.8deg); }
.card.reveal.in:nth-child(even) { transform: rotate(.7deg); }
.card.reveal.in:hover { transform: rotate(0) translateY(-5px); }

/* ============ Recruiter mode: flatten everything ============ */
body.recruiter { background-image: none; }
body.recruiter .card, body.recruiter .sticky, body.recruiter .paper-front,
body.recruiter .card.reveal.in { transform: none !important; }
body.recruiter .pin, body.recruiter .companion, body.recruiter .margin-note,
body.recruiter .paper-note, body.recruiter .end-note,
body.recruiter .hero-doodle, body.recruiter .footer-joke { display: none; }
body.recruiter .notebook-card, body.recruiter .index-card { transform: none; }
body.recruiter .marker::after { animation: none; opacity: 0; }
body.recruiter .robot { animation: none; }
body.recruiter .reveal { opacity: 1; transform: none; filter: none; transition: none; }
body.recruiter .board-col.reveal .sticky,
body.recruiter .bookshelf.reveal .book,
body.recruiter .gitlog.reveal .commit { opacity: 1; translate: none; transition: none; }

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; filter: none; }
  .board-col.reveal .sticky, .bookshelf.reveal .book, .gitlog.reveal .commit { opacity: 1; translate: none; }
  .skill .bar-fill { width: var(--w); }
}

/* ============ Responsive ============ */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding-top: 2.5rem; }
  .hero-doodle { max-width: 380px; }
  .topnav { display: none; }
  .commit { grid-template-columns: 74px 1fr; }
  .commit .c-date { display: none; }
  .bookshelf { overflow-x: auto; }
  .book { flex-shrink: 0; }
}
@keyframes dots { 0% { content: ""; } 33% { content: "."; } 66% { content: ".."; } 100% { content: "..."; } }

/* ================================================================
   Premium motion layer — additions
   html.premium is set by script.js when GSAP is active; those rules
   hand transform control to GSAP (magnetic buttons, 3D tilt).
   ================================================================ */

/* staggered children: sticky notes settle in one by one */
.board-col.reveal .sticky { opacity: 0; translate: 0 16px; transition: opacity .6s ease, translate .6s cubic-bezier(.22,1,.36,1); }
.board-col.reveal.in .sticky { opacity: 1; translate: 0 0; }
.board-col.reveal.in .sticky:nth-child(2) { transition-delay: .1s; }
.board-col.reveal.in .sticky:nth-child(3) { transition-delay: .22s; }
.board-col.reveal.in .sticky:nth-child(4) { transition-delay: .34s; }

/* books rise off the plank */
.bookshelf.reveal .book { opacity: 0; translate: 0 26px; transition: opacity .55s ease, translate .55s cubic-bezier(.22,1,.36,1); }
.bookshelf.reveal.in .book { opacity: 1; translate: 0 0; }
.bookshelf.reveal.in .b2 { transition-delay: .08s; }
.bookshelf.reveal.in .b3 { transition-delay: .16s; }
.bookshelf.reveal.in .b4 { transition-delay: .24s; }
.bookshelf.reveal.in .b5 { transition-delay: .32s; }
.bookshelf.reveal.in .b6 { transition-delay: .40s; }

/* commits type themselves into the log */
.gitlog.reveal .commit { opacity: 0; translate: -14px 0; transition: opacity .5s ease, translate .5s cubic-bezier(.22,1,.36,1); }
.gitlog.reveal.in .commit { opacity: 1; translate: 0 0; }
.gitlog.reveal.in .commit:nth-child(2) { transition-delay: .09s; }
.gitlog.reveal.in .commit:nth-child(3) { transition-delay: .18s; }
.gitlog.reveal.in .commit:nth-child(4) { transition-delay: .27s; }
.gitlog.reveal.in .commit:nth-child(5) { transition-delay: .36s; }
.gitlog.reveal.in .commit:nth-child(6) { transition-delay: .45s; }
.gitlog.reveal.in .commit:nth-child(7) { transition-delay: .54s; }

/* ============ App shelf (pinned horizontal) ============ */
.apps-section { overflow: clip; }
.apps-pin { padding: clamp(3rem, 8vh, 5rem) 0 2.5rem; }
.apps-head { max-width: 1100px; margin: 0 auto 1.6rem; padding: 0 1.5rem; }
.shelf { display: flex; gap: 1.4rem; padding: 1rem 1.5rem 1.4rem; width: max-content; }
.shelf .app-window { width: clamp(280px, 30vw, 350px); flex-shrink: 0; display: flex; flex-direction: column; }
.shelf .app-body { flex: 1; display: flex; flex-direction: column; }
.shelf .app-body .card-stack { margin-top: auto; padding-top: .6rem; }
.shelf .app-features { columns: 1; }
.app-count { max-width: 1100px; margin: .4rem auto 0; padding: 0 1.5rem; }

/* fallbacks: shelf becomes a swipeable strip when the pin is off */
@media (max-width: 820px) {
  .shelf { width: auto; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .shelf .app-window { scroll-snap-align: start; width: min(84vw, 330px); }
  .shelf-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .shelf { width: auto; overflow-x: auto; }
}
body.recruiter .shelf { width: auto; overflow-x: auto; }
body.recruiter .shelf-hint { display: none; }

/* GSAP owns transforms on these while premium is on */
html.premium .btn { transition: box-shadow .18s, background .18s, border-color .18s; }
html.premium .btn-primary:hover { transform: none; }
html.premium .btn-ghost:hover { transform: none; }
html.premium .terminal-btn { transition: background .15s; }
html.premium body:not(.recruiter) .card,
html.premium body:not(.recruiter) .index-card,
html.premium body:not(.recruiter) .app-window { transition: box-shadow .25s ease; }

/* ============ Notebook cursor — ink dot + sketch ring ============ */
body.nbc-on, body.nbc-on * { cursor: none !important; }
.nbc-dot, .nbc-ring {
  position: fixed; top: 0; left: 0; z-index: 300; pointer-events: none;
  opacity: 0; transition: opacity .25s ease;
}
body.nbc-on .nbc-dot, body.nbc-on .nbc-ring { opacity: 1; }
.nbc-dot {
  width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px;
  border-radius: 50%; background: var(--ink);
}
.nbc-ring {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  will-change: transform, width, height;
}
.nbc-ring::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  border: 1.5px dashed var(--ink-soft); opacity: .75;
  animation: nbcSpin 14s linear infinite;
  transition: border-color .2s, border-style .2s, background .2s, opacity .2s;
}
@keyframes nbcSpin { to { transform: rotate(360deg); } }
.nbc-label {
  font-family: 'Caveat', cursive; font-size: 1.05rem; color: var(--ink);
  white-space: nowrap; opacity: 0; transform: scale(.6) rotate(-4deg);
  transition: opacity .2s ease, transform .25s cubic-bezier(.34,1.4,.4,1);
}

/* states (classes live on the ring; dot follows suit) */
.nbc-ring, .nbc-ring::before, .nbc-dot { transition: opacity .25s ease, scale .3s cubic-bezier(.22,1,.36,1), background .2s, border-color .2s; }
.nbc-ring.is-link { scale: .68; }
.nbc-ring.is-link::before { border-color: var(--amber); border-style: solid; opacity: 1; animation-play-state: paused; }
.nbc-dot.is-link { scale: 1.5; background: var(--amber); }
.nbc-ring.is-label { scale: 2.15; }
.nbc-ring.is-label::before { border-color: var(--sage-deep); background: rgba(255, 253, 248, .9); opacity: 1; }
.nbc-ring.is-label .nbc-label { opacity: 1; transform: scale(.58) rotate(-4deg); }
.nbc-dot.is-label { scale: 0; }
/* button-shape: ring conforms to the button's box (JS sets width/height/radius) */
.nbc-ring.is-shape::before {
  border-style: solid; border-color: var(--amber); border-width: 1.5px;
  opacity: 1; background: rgba(217, 168, 108, .12);
  animation: none; transform: none; /* unrotate: a spun rounded-rect looks tall */
}
.nbc-dot.is-shape { scale: 1.3; background: var(--amber); }

.nbc-ring.is-down { scale: .5; }
.nbc-dot.is-down { scale: .8; }
.nbc-ring.is-shape.is-down { scale: .96; }
body.recruiter .nbc-dot, body.recruiter .nbc-ring { opacity: 0; }
