/* ============================================================
   IDRIZ ZUNCHESKI — Portfolio
   ============================================================ */

:root {
  --bg-0: #07080a;
  --bg-1: #0e1014;
  --bg-2: #161a20;
  --steel-0: #1a1d23;
  --steel-1: #2a2e36;
  --steel-2: #3a3f48;
  --steel-3: #5a6068;
  --steel-edge: #8a9098;

  --paper: #f4f3ee;
  --paper-2: #e8e6df;
  --ink: #0e1014;
  --ink-2: #2a2e36;
  --ink-3: #5a6068;

  --accent: #3b9eff;
  --accent-glow: oklch(0.72 0.15 240);

  --hinge: #14171c;

  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

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

html, body {
  background: var(--bg-0);
  color: var(--paper);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  /* total scroll length controls reveal duration */
  min-height: 300vh;
  overflow-x: hidden;
}

/* The fixed stage where the whole experience plays out */
.stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 20%, #1a1d23 0%, #07080a 60%),
    var(--bg-0);
  perspective: 2200px;
  perspective-origin: 50% 30%;
}

.theme-navy .stage  { background: radial-gradient(ellipse at 50% 20%, #0f1626 0%, #050810 60%), #050810; }
.theme-black .stage { background: radial-gradient(ellipse at 50% 20%, #111 0%, #000 60%), #000; }

/* ===== Top panel (the hood that lifts) ===== */
.hood {
  position: absolute;
  inset: 0;
  transform-origin: 50% 0%;
  transform-style: preserve-3d;
  will-change: transform;
  z-index: 30;
}

.hood-face {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(59,158,255,0.06) 0%, transparent 50%),
    linear-gradient(180deg, #0c0e12 0%, #14171c 100%);
  overflow: hidden;
  backface-visibility: hidden;
}

/* Hood bottom lip — thick metal edge, gives the hood real depth */
.hood-face::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18px;
  background:
    /* highlight along the very top edge of the lip */
    linear-gradient(180deg,
      rgba(255,255,255,0.18) 0%,
      rgba(255,255,255,0.05) 8%,
      rgba(0,0,0,0)        12%,
      rgba(0,0,0,0.45)     55%,
      rgba(0,0,0,0.85)     100%),
    /* metal panel */
    linear-gradient(180deg, #2a2f37 0%, #161a20 60%, #0a0c0f 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),     /* top highlight */
    inset 0 -1px 0 rgba(0,0,0,0.85),          /* bottom shadow */
    0 4px 10px rgba(0,0,0,0.65);              /* drop below */
  z-index: 2;
  pointer-events: none;
}

/* Hood underside — visible after lift, ribbed black with side hinges */
.hood-underside {
  position: absolute;
  inset: 0;
  transform: rotateX(180deg);
  background:
    linear-gradient(180deg, #050608 0%, #0a0c10 30%, #0e1014 100%);
  border-top: 2px solid #1a1d23;
  box-shadow: inset 0 40px 80px rgba(0,0,0,0.9), inset 0 -20px 40px rgba(0,0,0,0.7);
  backface-visibility: hidden;
  overflow: hidden;
}
.hood-underside::before {
  /* ribbed/slatted texture */
  content: "";
  position: absolute;
  inset: 24px 80px;
  background:
    repeating-linear-gradient(180deg,
      rgba(255,255,255,0.04) 0 1px,
      transparent 1px 24px),
    repeating-linear-gradient(180deg,
      transparent 0 22px,
      rgba(0,0,0,0.5) 22px 24px);
}
.hood-underside::after {
  /* side hinge arms (visible struts on left and right of underside) */
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 30px; right: 30px;
  pointer-events: none;
  background:
    linear-gradient(90deg,
      rgba(50,55,62,0.8) 0 8px, transparent 8px 100%),
    linear-gradient(270deg,
      rgba(50,55,62,0.8) 0 8px, transparent 8px 100%);
}

/* hinge bar on top */
.hinge {
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 12px;
  background: linear-gradient(180deg, #2a2e36 0%, #14171c 50%, #0a0c10 100%);
  border-bottom: 1px solid #000;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8%;
}

.hinge-bolt {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #6a7078 0%, #2a2e36 60%, #0a0c10 100%);
  box-shadow: 0 0 0 1px #000, inset 0 -1px 2px rgba(0,0,0,0.6);
}

/* ===== Hero content on hood face ===== */
.hero {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 32px 56px;
  z-index: 5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: var(--paper);
  display: flex;
  align-items: center;
  gap: 2px;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.brand-slash { color: var(--accent); }

/* nav lives in two places — top + bottom — and pieces flip between */
.nav {
  display: flex;
  gap: 36px;
  align-items: center;
  perspective: 800px;
}

.nav-item {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(244,243,238,0.72);
  cursor: pointer;
  background: none;
  border: 0;
  padding: 6px 2px;
  position: relative;
  transition: color 160ms ease;
  transform-style: preserve-3d;
}

.nav-item:hover { color: var(--paper); }

.nav-item.active { color: var(--paper); }
.nav-item.active::after {
  content: "";
  position: absolute;
  left: 0; right: 50%;
  bottom: -4px;
  height: 2px;
  background: var(--accent);
}

/* paper flip animation when nav item is clicked */
.nav-item.flipping {
  animation: paperFlip 600ms cubic-bezier(0.65, 0, 0.35, 1);
}

@keyframes paperFlip {
  0%   { transform: rotateX(0deg) translateY(0); opacity: 1; }
  40%  { transform: rotateX(-90deg) translateY(-8px); opacity: 0.4; }
  60%  { transform: rotateX(90deg) translateY(8px); opacity: 0.4; }
  100% { transform: rotateX(0deg) translateY(0); opacity: 1; }
}

.hero-body {
  align-self: center;
  max-width: 560px;
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 28px;
}

.headline {
  font-family: var(--font-display);
  font-size: clamp(48px, 6vw, 84px);
  line-height: 0.96;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-bottom: 28px;
}
.headline span { display: block; }

/* ===== Hero entrance — staggered fade-up, one-time on load ===== */
@keyframes heroFadeUp {
  0%   { opacity: 0; transform: translateY(18px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes heroFadeIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
.hero .brand            { animation: heroFadeIn 600ms ease-out 100ms both; }
.hero .eyebrow          { animation: heroFadeUp 700ms cubic-bezier(0.2,0.8,0.2,1) 250ms both; }
.hero .headline span:nth-child(1) { animation: heroFadeUp 800ms cubic-bezier(0.2,0.8,0.2,1) 380ms both; }
.hero .headline span:nth-child(2) { animation: heroFadeUp 800ms cubic-bezier(0.2,0.8,0.2,1) 500ms both; }
.hero .headline span:nth-child(3) { animation: heroFadeUp 800ms cubic-bezier(0.2,0.8,0.2,1) 620ms both; }
.hero .subhead          { animation: heroFadeUp 700ms cubic-bezier(0.2,0.8,0.2,1) 780ms both; }
.hero .hero-body .btn   { animation: heroFadeUp 700ms cubic-bezier(0.2,0.8,0.2,1) 920ms both; }
.hero .scroll-cue       { animation: heroFadeIn 800ms ease-out 1100ms both; }
.hand-layer             { animation: heroFadeIn 900ms ease-out 700ms both; }

/* Continuous gentle float on the arm */
.arm-rig {
  animation: armFloat 4s ease-in-out 1600ms infinite;
}
@keyframes armFloat {
  0%, 100% { transform: translate(-50%, 0); }
  50%      { transform: translate(-50%, -16px); }
}

.subhead {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(244,243,238,0.62);
  max-width: 380px;
  margin-bottom: 36px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  background: transparent;
  border: 1px solid rgba(244,243,238,0.2);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 200ms ease;
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-arrow {
  width: 24px; height: 1px; background: currentColor; position: relative;
}
.btn-arrow::after {
  content: ""; position: absolute; right: 0; top: -3px;
  width: 7px; height: 7px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
}

/* technical grid placeholder right side */
.tech-grid {
  position: absolute;
  right: 56px;
  top: 38%;
  width: 120px;
  height: 120px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  opacity: 0.5;
}
.tech-grid div {
  border: 1px solid #3a3f48;
  background: transparent;
}
.tech-grid div.lit {
  border-color: var(--accent);
  background: rgba(59,158,255,0.1);
}

/* page index marks */
.page-marks {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 6;
}
.page-mark {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(244,243,238,0.2);
}
.page-mark.active { background: var(--accent); width: 8px; height: 8px; }

/* scroll indicator at bottom of hero */
.scroll-cue {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(244,243,238,0.4);
  z-index: 6;
}
.scroll-cue-line {
  width: 1px;
  height: 24px;
  background: linear-gradient(180deg, transparent, var(--accent));
  animation: scrollPulse 1.6s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.6); }
  50%      { opacity: 1; transform: scaleY(1); transform-origin: top; }
}

/* ===== Hydraulic struts (visible during reveal) ===== */
.strut {
  position: absolute;
  z-index: 25;
  pointer-events: none;
  transform-origin: bottom center;
}
.strut-left  { left: 4%; }
.strut-right { right: 4%; }

.strut-piston {
  width: 14px;
  background: linear-gradient(90deg, #2a2e36 0%, #5a6068 30%, #8a9098 50%, #5a6068 70%, #2a2e36 100%);
  border-radius: 7px;
  box-shadow: 0 0 0 1px #000 inset, 0 4px 8px rgba(0,0,0,0.6);
  position: relative;
}
.strut-piston::before {
  /* shaft inside */
  content: "";
  position: absolute;
  inset: 6px 4px;
  background: repeating-linear-gradient(180deg, #6a7078 0 4px, #4a4f58 4px 8px);
  border-radius: 3px;
}
.strut-mount {
  position: absolute;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #6a7078, #14171c 70%);
  box-shadow: 0 0 0 1px #000;
  left: 50%; transform: translateX(-50%);
}
.strut-mount-top    { top: -10px; }
.strut-mount-bottom { bottom: -10px; }

/* ===== Bottom (revealed) content ===== */
.revealed {
  position: absolute;
  inset: 0;
  z-index: 10;
  background:
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  color: var(--ink);
  overflow: hidden;
  padding: 18vh 56px 96px; /* top padding leaves room for the open-lid strip; bottom clears the nav strip */
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* top edge inside cavity — rim of the case */
.case-rim {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 32px;
  background: linear-gradient(180deg, #000 0%, #14171c 60%, transparent 100%);
  z-index: 5;
  pointer-events: none;
}
.case-rim::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: var(--steel-edge);
  opacity: 0.3;
}

.revealed-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(14,16,20,0.08);
}
.revealed-topbar .brand { color: var(--ink); }
.revealed-topbar .brand-slash { color: var(--accent); }

.nav-bottom .nav-item {
  color: rgba(14,16,20,0.62);
}
.nav-bottom .nav-item:hover { color: var(--ink); }
.nav-bottom .nav-item.active { color: var(--ink); }

/* Project grid */
.projects-section {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 24px;
  align-content: start;
}

.section-label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-top: 8px;
  max-width: 760px;
}

.projects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 24px;
}

.project {
  background: #fff;
  border: 1px solid rgba(14,16,20,0.06);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto;
  cursor: pointer;
  transition: transform 220ms ease, box-shadow 220ms ease;
}
.project:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(14,16,20,0.08);
}

.project-media {
  aspect-ratio: 16 / 6;
  background:
    repeating-linear-gradient(135deg, #ececec 0 8px, #f4f4f0 8px 16px),
    #ececec;
  position: relative;
  overflow: hidden;
}
.project-media::after {
  content: attr(data-tag);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: rgba(14,16,20,0.35);
  text-transform: uppercase;
}

.project-meta {
  padding: 18px 20px 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 16px;
}
.project-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin-bottom: 6px;
}
.project-tags {
  font-family: var(--font-body);
  font-size: 12px;
  color: rgba(14,16,20,0.55);
}
.project-arrow {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(14,16,20,0.15);
  display: grid;
  place-items: center;
  font-size: 14px;
  color: var(--ink);
  transition: all 200ms ease;
}
.project:hover .project-arrow {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ==========================================================
   STATS section (About page lower) — 2x2 grid of big numbers
   ========================================================== */
.stats-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.stat-card {
  background: rgba(14,16,20,0.04);
  border: 1px solid rgba(14,16,20,0.08);
  padding: 22px 20px 20px;
  border-radius: 4px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.stat-title {
  margin-top: 12px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.stat-note {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.4;
}

/* ==========================================================
   SKILLS section (Skills page lower) — 4 columns of chip groups
   ========================================================== */
.skills-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.skill-group-title {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.skill-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(14,16,20,0.05);
  border: 1px solid rgba(14,16,20,0.10);
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--ink-2);
  white-space: nowrap;
}

/* ==========================================================
   TIMELINE section (Experience page lower) — vertical list
   ========================================================== */
.timeline-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
}
.timeline-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding: 16px 0;
  border-top: 1px solid rgba(14,16,20,0.08);
}
.timeline-item:first-child {
  border-top: none;
  padding-top: 4px;
}
.timeline-period {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.timeline-role {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
}
.timeline-org {
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 2px;
}
.timeline-note {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 6px;
  line-height: 1.5;
}

/* ==========================================================
   CONTACT section (Contact page lower) — list of channels
   ========================================================== */
.contact-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.contact-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 18px 0;
  border-top: 1px solid rgba(14,16,20,0.08);
  align-items: center;
}
.contact-row:first-child {
  border-top: none;
}
.contact-method {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
.contact-value {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
}
a.contact-value:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* skills strip / nav strip at the bottom of the case */
.case-base {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(180deg, #14171c 0%, #07080a 100%);
  padding: 4px 56px 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(244,243,238,0.7);
  border-top: 1px solid #2a2e36;
  z-index: 5;
}
.case-base-label {
  color: var(--accent);
  margin-right: 28px;
}
.case-base-items {
  display: flex;
  flex: 1;
  justify-content: space-around;
  gap: 24px;
}

.case-base-nav {
  justify-content: center;
}
.case-base-nav .nav {
  gap: 48px;
}
.case-base-nav .nav-item {
  color: rgba(244,243,238,0.72);
}
.case-base-nav .nav-item:hover { color: var(--paper); }
.case-base-nav .nav-item.active { color: var(--accent); }
.case-base-nav .nav-item.active::after {
  background: var(--accent);
}
.case-base-item {
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.case-base-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: rgba(244,243,238,0.4);
}

/* About section — left text, right placeholder visual */
.about-section {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 48px;
  align-items: center;
  flex-shrink: 0;
}
.about-text {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 460px;
}
.about-text .section-title {
  margin-top: 0;
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1.05;
}
.about-body {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(14,16,20,0.65);
  margin-bottom: 4px;
}
.about-visual {
  aspect-ratio: 16/6;
  background:
    /* faint isometric grid like the schematic in the reference */
    linear-gradient(180deg, rgba(59,158,255,0.04), transparent),
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(59,158,255,0.08) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, rgba(59,158,255,0.08) 23px 24px),
    #ececec;
  border: 1px solid rgba(14,16,20,0.06);
  position: relative;
  overflow: hidden;
}
.about-visual::before {
  /* subtle dimension marks at corners */
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px dashed rgba(59,158,255,0.25);
}
.about-visual::after {
  content: attr(data-tag);
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: rgba(14,16,20,0.35);
  text-transform: uppercase;
}

.btn-light {
  border-color: rgba(14,16,20,0.2);
  color: var(--ink);
  align-self: start;
}
.btn-light:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Paper page flip — re-mounts when activeNav changes */
.paper-page-wrap {
  flex: 1;
  min-height: 0;
  perspective: 1400px;
  perspective-origin: 50% 0%;
  display: flex;
  flex-direction: column;
}
.paper-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
  transform-origin: 50% 0%;
  transform-style: preserve-3d;
  animation: paperPageIn 400ms cubic-bezier(0.22, 0.61, 0.36, 1);
  backface-visibility: hidden;
  position: relative;
}
/* Curl shadow — a horizontal band that travels down the page as it unrolls,
   simulating the shadow cast by the curling edge */
.paper-page::before {
  content: "";
  position: absolute;
  left: -4%;
  right: -4%;
  top: 0;
  height: 140px;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(0,0,0,0.55) 0%,
    rgba(0,0,0,0.30) 35%,
    rgba(0,0,0,0.10) 70%,
    rgba(0,0,0,0)    100%
  );
  filter: blur(6px);
  transform-origin: 50% 0%;
  animation: paperCurlShadow 400ms cubic-bezier(0.22, 0.61, 0.36, 1);
  z-index: 5;
  opacity: 0;
}
/* Highlight on the curling edge — a thin bright line that fades as the page settles */
.paper-page::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.35) 20%,
    rgba(255,255,255,0.55) 50%,
    rgba(255,255,255,0.35) 80%,
    rgba(255,255,255,0) 100%
  );
  animation: paperCurlEdge 400ms cubic-bezier(0.22, 0.61, 0.36, 1);
  z-index: 6;
  opacity: 0;
}
@keyframes paperPageIn {
  0%   {
    transform: rotateX(92deg) translateZ(-30px) translateY(-8px);
    opacity: 0;
  }
  35%  {
    transform: rotateX(55deg) translateZ(-10px) translateY(-2px);
    opacity: 1;
  }
  70%  {
    transform: rotateX(12deg) translateZ(0) translateY(0);
    opacity: 1;
  }
  85%  {
    transform: rotateX(-4deg) translateZ(0) translateY(0);
  }
  100% {
    transform: rotateX(0deg) translateZ(0) translateY(0);
    opacity: 1;
  }
}
@keyframes paperCurlShadow {
  0%   { transform: translateY(0);    opacity: 0;   }
  20%  { transform: translateY(40px); opacity: 0.9; }
  60%  { transform: translateY(70%);  opacity: 0.5; }
  100% { transform: translateY(110%); opacity: 0;   }
}
@keyframes paperCurlEdge {
  0%   { transform: translateY(0);    opacity: 0;   }
  15%  { transform: translateY(20px); opacity: 0.8; }
  50%  { transform: translateY(60%);  opacity: 0.6; }
  100% { transform: translateY(110%); opacity: 0;   }
}

/* Section label spacing tweak */
.projects-section .section-label { margin-bottom: 16px; }
.density-cozy .revealed { padding: 28px 40px 60px; gap: 12px; }
.density-cozy .projects { gap: 14px; }
.density-spacious .revealed { padding: 72px 72px 110px; gap: 44px; }

/* ===== Open lid — visible at top of viewport when hood is lifted ===== */
.open-lid {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 18vh;
  z-index: 20;
  background:
    linear-gradient(180deg, #050608 0%, #0a0c10 60%, #0e1014 100%);
  border-bottom: 1px solid #000;
  box-shadow: 0 12px 30px rgba(0,0,0,0.7);
  pointer-events: none;
  overflow: hidden;
}
.open-lid::before {
  /* ribbed underside texture */
  content: "";
  position: absolute;
  inset: 12px 80px;
  background:
    repeating-linear-gradient(180deg,
      rgba(255,255,255,0.05) 0 1px,
      transparent 1px 18px),
    repeating-linear-gradient(180deg,
      transparent 0 16px,
      rgba(0,0,0,0.6) 16px 18px);
}
.open-lid::after {
  /* highlight on top edge */
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}
.open-lid-hinge-l, .open-lid-hinge-r {
  position: absolute;
  bottom: 0;
  width: 60px; height: 60px;
  background:
    radial-gradient(circle at 50% 100%, #4a4f58 0%, #14171c 50%, #050608 100%);
  border: 1px solid #000;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.8);
}
.open-lid-hinge-l { left: 6%; }
.open-lid-hinge-r { right: 6%; }

.open-lid-strut-l, .open-lid-strut-r {
  position: absolute;
  bottom: -120px;
  width: 8px; height: 160px;
  background: linear-gradient(180deg, #6a7078 0%, #2a2e36 50%, #14171c 100%);
  border-radius: 4px;
  border: 1px solid #000;
  transform-origin: top center;
}
.open-lid-strut-l { left: calc(6% + 26px); transform: rotate(8deg); }
.open-lid-strut-r { right: calc(6% + 26px); transform: rotate(-8deg); }

.open-lid-arm {
  /* the dark forearm/segment hanging down from middle (visible in ref) */
  position: absolute;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px; height: 100px;
  background:
    radial-gradient(ellipse at 50% 0%, #4a4f58 0%, #14171c 60%, #050608 100%);
  border: 1px solid #000;
  border-radius: 50% 50% 8px 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.8);
}
.open-lid-arm::before {
  content: "";
  position: absolute;
  inset: 6px 12px;
  background: repeating-linear-gradient(180deg, #2a2e36 0 8px, #14171c 8px 12px);
  border-radius: inherit;
}

/* ===== Robotic arm — frame-stack PNG animation ===== */
.arm-rig {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 264px;
  z-index: 35;
  pointer-events: none;
  will-change: transform, top;
}
.arm-stack {
  position: relative;
  width: 100%;
  filter:
    drop-shadow(0 18px 24px rgba(0,0,0,0.65))
    drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}
.arm-stack .arm-img:first-child {
  position: relative; /* first frame establishes height */
}
.arm-stack .arm-img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  position: absolute;
  inset: 0;
  transition: opacity 80ms linear;
}

/* placeholder zone for swapping in real render */
.hand-swap-note {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: rgba(244,243,238,0.5);
  white-space: nowrap;
  text-transform: uppercase;
}

/* ===== Tweaks-mode tools ===== */
.iris-mask, .unfold-mask { display: none; }

/* iris mode: hood fades + circular wipe */
.reveal-iris .hood-face::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 100%, transparent 0, transparent var(--iris-r, 0%), #000 calc(var(--iris-r, 0%) + 1%));
  pointer-events: none;
}

/* unfold mode: hood splits in two halves opening sideways */
.reveal-unfold .hood-half-l, .reveal-unfold .hood-half-r {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  background: inherit;
  z-index: 10;
}

/* ============================================================
   MOBILE — ≤ 760px
   Tighten paddings, shrink type, stack project grid + about,
   collapse nav strip into 2 rows, scale arm down.
   ============================================================ */
@media (max-width: 760px) {
  /* Hero face — tighter padding */
  .hood-face {
    padding: 20px 22px;
  }
  .hero-content {
    padding: 20px 22px;
  }
  .hero-body {
    max-width: 100%;
  }
  .eyebrow {
    font-size: 11px;
    letter-spacing: 0.22em;
  }
  .headline {
    font-size: clamp(38px, 11vw, 56px);
    line-height: 0.98;
    margin-bottom: 22px;
  }
  .subhead {
    font-size: 14px;
    max-width: 100%;
    margin-bottom: 28px;
  }
  .brand {
    font-size: 13px;
  }
  .scroll-cue {
    font-size: 10px;
  }

  /* Hide decorative grid in top-right of hood — clutters small screens */
  .hood-grid {
    display: none;
  }

  /* Top nav-bar in hood: hide the long nav, keep only brand + indicator */
  .hood .nav-bar .nav {
    display: none;
  }

  /* Robotic arm — scale down AND shift to right edge so it doesn't
     overlap the headline / button on narrow viewports. */
  .arm-rig {
    width: 168px;   /* was 264 */
    left: auto;
    right: -16px;
    transform: translateX(0);
    animation-name: armFloatMobile;
  }
  @keyframes armFloatMobile {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-16px); }
  }

  /* Hero button: smaller and pinned to LEFT on mobile so it doesn't
     overlap the scroll-cue. The scroll-cue itself goes to the RIGHT. */
  .hero .hero-body .btn {
    font-size: 11px;
    padding: 9px 14px;
    align-self: flex-start;
  }
  .hero-body {
    align-items: flex-start;
  }

  /* Scroll cue — bottom-RIGHT corner, BELOW the button level. Compact. */
  .scroll-cue {
    left: auto;
    right: 18px;
    transform: none;
    align-items: flex-end;
    bottom: 6px;
    font-size: 8.5px;
    flex-direction: row;
    gap: 6px;
  }
  .scroll-cue-line {
    align-self: center;
    height: 12px;
  }

  /* Bottom case-base nav-strip: collapse to compact 2-row layout */
  .case-base {
    padding: 6px 10px 8px;
    font-size: 10px;
    letter-spacing: 0.08em;
    flex-wrap: wrap;
    justify-content: center;
  }
  .case-base-nav .nav,
  .nav-bottom-bar,
  .case-base .nav {
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 4px;
    column-gap: 12px;
    width: 100%;
  }
  .case-base .nav-item {
    font-size: 9.5px;
    letter-spacing: 0.06em;
    white-space: nowrap;
  }
  .case-base-label {
    margin-right: 12px;
  }
  .case-base-items {
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
  }

  /* Revealed area — tighter side padding. The .revealed container itself
     stays static; only the .paper-page-wrap inner area scrolls so that
     the bottom nav-strip (case-base) remains pinned. */
  .revealed {
    padding: 14vh 18px 60px;
    gap: 14px;
  }
  .density-cozy .revealed {
    padding: 13vh 16px 56px;
    gap: 12px;
  }
  .density-spacious .revealed {
    padding: 16vh 22px 64px;
    gap: 18px;
  }
  /* The scrollable content region — paper-page-wrap holds about + projects */
  .paper-page-wrap {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    min-height: 0;
  }

  /* About visual placeholder — slim down so projects fit below */
  .about-visual {
    min-height: 140px;
    aspect-ratio: 16 / 9;
  }

  /* Revealed topbar — drop the long nav, keep brand + section indicator */
  .revealed-topbar {
    padding: 0 0 12px;
  }
  .revealed-topbar .nav {
    display: none;
  }

  /* About section — stack vertically, hide schematic visual */
  .about-section {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .about-text {
    max-width: 100%;
  }
  .about-text .section-title {
    font-size: clamp(28px, 8vw, 40px);
    line-height: 1.05;
  }
  .about-body {
    font-size: 14px;
    max-width: 100%;
  }
  /* About visual already overridden above */
  .about-visual { /* see above */ }

  /* Projects — single column on phone, two-up on small tablets */
  .projects {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 14px;
  }
  .projects-section {
    gap: 16px;
  }

  /* Stats — 2 cols on tablet, 1 col on phone */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat-card {
    padding: 16px 14px 14px;
  }
  .stat-value {
    font-size: 32px;
  }

  /* Skills — 2 cols on tablet/phone */
  .skills-grid {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }

  /* Timeline — stack period above role */
  .timeline-item {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 14px 0;
  }
  .timeline-role {
    font-size: 16px;
  }

  /* Contact — narrower method col */
  .contact-row {
    grid-template-columns: 100px 1fr;
    gap: 14px;
    padding: 14px 0;
  }
  .contact-value {
    font-size: 12px;
    word-break: break-all;
  }
  .project-meta {
    padding: 14px 16px 16px;
    grid-template-columns: 1fr auto;
    gap: 10px;
  }
  .section-title {
    font-size: clamp(28px, 8vw, 40px);
  }
  .section-label {
    font-size: 10px;
    letter-spacing: 0.18em;
  }

  /* Buttons */
  .btn {
    font-size: 12px;
    padding: 10px 18px;
  }
}

/* Smaller phones — extra trim */
@media (max-width: 420px) {
  .headline {
    font-size: clamp(32px, 12vw, 44px);
  }
  .arm-rig {
    width: 144px;
  }
  .case-base-nav .nav,
  .nav-bottom-bar,
  .case-base .nav {
    gap: 8px;
    column-gap: 8px;
    font-size: 9px;
  }
  .case-base .nav-item {
    font-size: 8.5px;
  }
  .revealed {
    padding: 13vh 16px 84px;
  }
}


/* ==========================================================
   SUBPAGES — full-screen overlays (About / Projects / Detail / Skills / Resume)
   Light "paper" theme to match the revealed content underneath.
   ========================================================== */
.page-shell {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  color: var(--ink);
  overflow-y: auto;
  overflow-x: hidden;
  animation: page-in 380ms cubic-bezier(.2,.7,.2,1);
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px 32px;
  background: rgba(244,243,238,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(14,16,20,0.08);
}
.page-back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 1px solid rgba(14,16,20,0.18);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}
.page-back:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.page-back-arrow { font-size: 16px; line-height: 1; }
.page-back-x { font-size: 18px; line-height: 1; margin-left: 4px; }
.page-close { justify-self: end; }
.page-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.page-brand .brand-slash { color: var(--accent); }

.page-body {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 56px 120px;
}
.page-header {
  margin-bottom: 48px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(14,16,20,0.1);
}
.page-eyebrow { color: var(--accent); }
.page-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.02;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 12px 0 0;
}
.page-lede {
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 720px;
  margin: 0 0 40px;
}

/* ---------- About page ---------- */
.about-page-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 56px;
  margin-bottom: 64px;
}
.about-page-lede p {
  font-size: 18px;
  line-height: 1.65;
  color: var(--ink-2);
  margin: 0 0 22px;
  max-width: 60ch;
}
.about-page-side {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-left: 28px;
  border-left: 1px solid rgba(14,16,20,0.1);
}
.about-fact-k {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.about-fact-v {
  font-size: 15px;
  color: var(--ink);
}
.about-page-numbers .stats-grid { margin-top: 18px; }

/* ---------- Projects index ---------- */
.projects-grid-page {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}
.project-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: rgba(255,255,255,0.5);
  border: 1px solid rgba(14,16,20,0.08);
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.project-card:hover {
  transform: translateY(-3px);
  border-color: rgba(14,16,20,0.2);
  box-shadow: 0 18px 40px rgba(14,16,20,0.08);
}
.project-card-media {
  position: relative;
  aspect-ratio: 16/10;
  background:
    repeating-linear-gradient(0deg,  rgba(14,16,20,0.04) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(90deg, rgba(14,16,20,0.04) 0 1px, transparent 1px 32px),
    var(--paper);
  border: 1px dashed rgba(14,16,20,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-card-media::before {
  content: attr(data-tag);
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(14,16,20,0.36);
  letter-spacing: 0.06em;
}
.project-card-year {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  background: var(--paper);
  padding: 4px 8px;
}
.project-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.project-card-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.project-card-tags {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

/* ---------- Project detail ---------- */
.project-detail-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  padding: 24px 0;
  border-top: 1px solid rgba(14,16,20,0.1);
  border-bottom: 1px solid rgba(14,16,20,0.1);
  margin-bottom: 40px;
}
.project-detail-hero {
  position: relative;
  aspect-ratio: 16/9;
  margin-bottom: 32px;
  background:
    repeating-linear-gradient(0deg,  rgba(14,16,20,0.04) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(90deg, rgba(14,16,20,0.04) 0 1px, transparent 1px 40px),
    var(--paper);
  border: 1px dashed rgba(14,16,20,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-detail-hero::before {
  content: attr(data-tag);
  font-family: var(--font-mono);
  font-size: 13px;
  color: rgba(14,16,20,0.32);
  letter-spacing: 0.06em;
}
.project-detail-summary {
  font-size: 22px;
  line-height: 1.5;
  color: var(--ink);
  font-weight: 400;
  letter-spacing: -0.005em;
  max-width: 760px;
  margin: 0 0 40px;
}
.project-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: rgba(14,16,20,0.1);
  border: 1px solid rgba(14,16,20,0.1);
  margin-bottom: 56px;
}
.pdetail-stat {
  background: var(--paper);
  padding: 22px 20px;
}
.pdetail-stat-k {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.pdetail-stat-v {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.project-detail-sections {
  display: flex;
  flex-direction: column;
  gap: 36px;
  margin-bottom: 64px;
}
.pdetail-section .section-label { color: var(--accent); margin-bottom: 12px; }
.pdetail-section p {
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 70ch;
  margin: 0;
}

.pdetail-next-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
}
.pdetail-next-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  background: transparent;
  border: 1px solid rgba(14,16,20,0.12);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.pdetail-next-card:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
  transform: translateY(-2px);
}
.pdetail-next-card:hover .project-arrow {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
}
.pdetail-next-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
}
.pdetail-next-tags {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 2px;
}

/* ---------- Skills page ---------- */
.skills-page-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 48px 64px;
}
.skill-page-group-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(14,16,20,0.12);
}
.skill-page-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.skill-page-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(14,16,20,0.06);
}
.skill-page-row:last-child { border-bottom: none; }
.skill-page-name {
  font-size: 15px;
  color: var(--ink);
}
.skill-page-bar {
  display: inline-flex;
  gap: 4px;
}
.skill-page-pip {
  width: 18px;
  height: 4px;
  background: rgba(14,16,20,0.12);
}
.skill-page-pip.filled { background: var(--accent); }

/* ---------- Resume page ---------- */
.resume-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 48px;
}
.resume-section {
  margin-bottom: 56px;
}
.resume-section .section-label {
  margin-bottom: 18px;
  color: var(--accent);
}
.resume-bullets {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.resume-bullets li {
  position: relative;
  padding-left: 16px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
}
.resume-bullets li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--ink-3);
}
.resume-pubs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.resume-pubs li {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 24px;
  padding: 14px 0;
  border-top: 1px solid rgba(14,16,20,0.08);
  font-size: 15px;
  color: var(--ink);
  line-height: 1.5;
}
.resume-pubs li:first-child { border-top: none; }
.resume-pub-year {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

/* ---------- Project tile clickability (homepage) ---------- */
.project { cursor: pointer; outline: none; }
.project:focus-visible { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .page-body { padding: 40px 24px 96px; }
  .page-topbar { padding: 14px 18px; }
  .about-page-grid,
  .projects-grid-page,
  .skills-page-grid,
  .pdetail-next-grid { grid-template-columns: 1fr; gap: 28px; }
  .about-page-side { padding-left: 0; border-left: none; padding-top: 24px; border-top: 1px solid rgba(14,16,20,0.1); }
  .project-detail-meta { grid-template-columns: 1fr; gap: 18px; }
  .project-detail-stats { grid-template-columns: repeat(2, 1fr); }
}


/* ==========================================================
   IN-PAPER SUB-VIEWS — render INSIDE the paper page (not full-screen)
   ========================================================== */
.subview {
  display: flex;
  flex-direction: column;
  gap: 28px;
  animation: subview-in 360ms cubic-bezier(.2,.7,.2,1);
}
@keyframes subview-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.subview-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(14,16,20,0.1);
  margin-bottom: 8px;
}
.subview-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid rgba(14,16,20,0.18);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
  margin-bottom: 6px;
}
.subview-back:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.subview-eyebrow { color: var(--accent); }
.subview-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
}

/* Tighten the originally page-sized blocks when used in the paper */
.subview .about-page-grid { grid-template-columns: 2fr 1fr; gap: 36px; margin-bottom: 0; }
.subview .stats-grid { margin-top: 12px; }
.subview .skills-page-grid { grid-template-columns: repeat(2, 1fr); gap: 28px 40px; }
.subview .project-detail-meta { margin-bottom: 24px; padding: 18px 0; }
.subview .project-detail-hero { aspect-ratio: 16/8; margin-bottom: 22px; }
.subview .project-detail-summary { font-size: 18px; margin-bottom: 24px; }
.subview .project-detail-stats { margin-bottom: 32px; }
.subview .project-detail-sections { gap: 24px; margin-bottom: 36px; }
.subview .pdetail-section p { font-size: 15px; }
.subview .resume-actions { margin-bottom: 20px; }
.subview .timeline-item { padding: 16px 0; }

/* All-projects grid (Projects nav) — 3 cols */
.projects-all { grid-template-columns: repeat(3, 1fr) !important; }

@media (max-width: 980px) {
  .subview .about-page-grid { grid-template-columns: 1fr; }
  .subview .skills-page-grid { grid-template-columns: 1fr; }
  .projects-all { grid-template-columns: 1fr !important; }
}


/* Make the in-paper sub-view scroll within the paper area instead of
   pushing the bottom nav off-screen. The .paper-page-wrap is the
   constrained box; we let .subview overflow and become the scroller. */
.paper-page-wrap { overflow: hidden; }
.paper-page { min-height: 0; }

.subview {
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  /* leave a touch of bottom padding so the last item doesn't kiss the nav */
  padding-bottom: 24px;
  /* nice paper-tone scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(14,16,20,0.25) transparent;
}
.subview::-webkit-scrollbar { width: 8px; }
.subview::-webkit-scrollbar-track { background: transparent; }
.subview::-webkit-scrollbar-thumb {
  background: rgba(14,16,20,0.18);
  border-radius: 4px;
}
.subview::-webkit-scrollbar-thumb:hover { background: rgba(14,16,20,0.35); }

/* Keep the sub-view header visible while scrolling */
.subview-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, var(--paper) 75%, rgba(244,243,238,0) 100%);
  padding-top: 4px;
  margin-top: -4px;
}


/* Projects nav: dedicated grid view that takes over the paper area */
.projects-grid-view {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.projects-grid-view-header {
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(14,16,20,0.1);
}
.projects-grid-view-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 8px 0 12px;
}
.projects-grid-view-body {
  max-width: 60ch;
  margin: 0;
}
.projects-grid-view .projects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 980px) {
  .projects-grid-view .projects { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .projects-grid-view .projects { grid-template-columns: 1fr; }
}


/* Experience nav — compact timeline so all items fit in viewport without scrolling */
.timeline-section { gap: 6px; }
.timeline-item { padding: 12px 0 !important; gap: 18px; }
.timeline-role { font-size: 16px !important; }
.timeline-org { font-size: 12px !important; }
.timeline-note { font-size: 12px !important; margin-top: 2px !important; }
.timeline-period { font-size: 11px !important; }

/* Tighten the about-section spacing on the Experience-style pages */
.about-section { gap: 28px; }
.about-text { gap: 10px; }
.about-body { font-size: 14px !important; line-height: 1.55 !important; }

/* Slightly smaller about-visual to give the lower section breathing room */
.density-cozy .about-visual { min-height: 180px; }


/* Allow the regular paper-page (non-subview) to scroll its overflow so
   nothing gets clipped. The bottom nav strip lives outside paper-page so
   it stays pinned. */
.paper-page {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(14,16,20,0.25) transparent;
}
.paper-page::-webkit-scrollbar { width: 8px; }
.paper-page::-webkit-scrollbar-track { background: transparent; }
.paper-page::-webkit-scrollbar-thumb {
  background: rgba(14,16,20,0.18);
  border-radius: 4px;
}
.paper-page::-webkit-scrollbar-thumb:hover { background: rgba(14,16,20,0.35); }
