:root {
  --bg-black: #000000;
  --bg-main: #120d1f;
  --bg-soft: #1a1329;
  --purple-deep: #231332;
  --accent: #8b5cf6;
  --accent-dark: #6d28d9;
  --text: #f9fafb;
  --muted: #b3b0c5;
  --border: #332445;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --transition-fast: 180ms ease-out;
}

/* RESET */

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

html,
body {
  height: 100%;
}

/* LAYOUT */

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-black);
  color: var(--text);
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Remove default cursor everywhere */
* {
  cursor: none !important;
}

input, textarea {
  cursor: none !important;
}

input[type="text"],
input[type="email"],
textarea {
  width: 100%;              /* keeps layout intact */
  padding: 0.75rem 0.9rem;  /* increases box size */
  font-size: 0.95rem;       /* slightly larger text */
  border-radius: 10px;      /* matches your soft UI */
  box-sizing: border-box;   /* CRITICAL: prevents overflow */
}

textarea {
  min-height: 120px;
  resize: vertical; /* allow vertical resize only */
}

form > div {
  margin-bottom: 0.75rem;
}

/* Subtle 3D geometric background */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

/* Soft gradient "depth" blobs */
body::before {
  background:
    radial-gradient(circle at 18% 20%, rgba(139, 92, 246, 0.24), transparent 60%),
    radial-gradient(circle at 82% 70%, rgba(56, 189, 248, 0.16), transparent 60%);
  opacity: 0.8;
}

/* Very subtle grid / 3D plane feel */
body::after {
  background-image:
    linear-gradient(
      rgba(51, 36, 69, 0.4) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(51, 36, 69, 0.4) 1px,
      transparent 1px
    );
  background-size: 140px 140px;
  opacity: 0.18;
  mix-blend-mode: soft-light;
}

/* HEADER (transparent) */

.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.1rem 1.5rem 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/*.nav-logo {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--accent);
}*/

.nav-title {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.nav-title-main {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-title-sub {
  font-size: 0.75rem;
  color: var(--muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  font-size: 0.86rem;
}

.nav-link {
  color: var(--muted);
  padding-bottom: 0.15rem;
  border-bottom: 2px solid transparent;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast);
}

.nav-link:hover {
  color: var(--text);
  border-color: var(--border);
}

.nav-link.active {
  color: var(--text);
  border-color: var(--accent);
}

.nav-cta {
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  background: #22c55e;
  border: none;
  color: #020617;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition:
    background var(--transition-fast),
    transform var(--transition-fast);
}

.nav-cta:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

.nav-cta span {
  font-size: 0.9rem;
}

/* MAIN */

main {
  flex: 1; /* fills space between header and footer */
  display: flex;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 3rem; /* top: space below header */
  width: 100%;
  display: flex;
  align-items: center; /* vertically centers hero inside main area */
}

/* HERO */

.hero {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.1fr);
  gap: 3rem;
  align-items: center;
}

.hero-left {
  max-width: 640px;
}

.hero-eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.hero-main-heading {
  font-size: clamp(2.3rem, 4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero-main-heading span {
  color: var(--accent);
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--accent-dark);
  margin-bottom: 0.5rem;
}

.hero-description {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 1.4rem;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 1.6rem;
}

.badge {
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.button-primary,
.button-secondary {
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: none;
}

.button-primary {
  background: var(--accent);
  color: #020617;
  transition:
    background var(--transition-fast),
    transform var(--transition-fast);
}

.button-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.button-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.button-secondary:hover {
  background: var(--bg-soft);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--muted);
}

/* HERO CARD */

.hero-card {
  width: min(360px, 100%);
  border-radius: var(--radius-xl);
  padding: 1rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.hero-card-inner {
  border-radius: calc(var(--radius-xl) - 6px);
  border: 1px solid var(--border);
  padding: 1rem 1rem 0.9rem;
  background: #150f24;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.hero-card-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.avatar {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  background: #111827;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-inner {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.hero-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.hero-card-name {
  font-size: 0.96rem;
  font-weight: 600;
}

.hero-card-role {
  font-size: 0.8rem;
  color: var(--muted);
}

.hero-card-tag {
  margin-left: 0 auto;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  background: #052e16;
  color: #bbf7d0;
  border: 1px solid #15803d;
}

.hero-card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.hero-chip {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #111827;
  color: var(--text);
}

.hero-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
}

/* Resume Page */

.resume-item-title {
  color: var(--accent);
}

.resume-section-title1 {
  color: var(--accent);
}

.project-link:hover {
  color: var(--accent);
}

.project-link {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  transition: 
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.project-link:hover {
  background: var(--accent);
  color: #020617;
  transform: translateY(-1px);
}

/* FOOTER */

footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.7rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.footer-links a {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.18em;
}

/* ===== WORK PAGE ===== */

.page--work {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.work-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.1fr);
  gap: 2.8rem;
  align-items: center;
  width: 100%;
}

.page-heading {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.9rem;
}

.work-intro {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 1.3rem;
  max-width: 34rem;
}

.work-skills-list {
  list-style: disc;
  padding-left: 1.2rem;
  font-size: 0.95rem;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.work-skills-list li strong {
  color: var(--accent);
}

/* about page specific styles */

.about-layout{
  margin-right: 18px;
}

.section-title1 {
  color: var(--accent-dark);
}

/* Portfolio viewer "nested sub-site" */

/* Scrollable portfolio grid inside the viewer box */
.portfolio-viewer-body {
  max-height: 250px;         /* adjust based on your layout */
  overflow-y: auto;
  padding-right: 6px;        /* so content doesn't sit under scrollbar */
  padding-top: 2px;
}

/* 3 cards per row */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

/* Card style */
.portfolio-card {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.55);
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: border-color 160ms ease, transform 160ms ease;
}

.portfolio-card:hover {
  border-color: rgba(139, 92, 246, 0.9);
  transform: translateY(-1px);
}

/* Thumbnail block */
.portfolio-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(51, 36, 69, 0.8);
  background: var(--bg-soft);
}

.portfolio-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portfolio-card-title {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.25;
}

.portfolio-card-tags {
  font-size: 0.74rem;
  color: var(--muted);
}

/* Make the internal scrollbar look subtle */
.portfolio-viewer-body::-webkit-scrollbar {
  width: 8px;
}
.portfolio-viewer-body::-webkit-scrollbar-thumb {
  background: rgba(179, 176, 197, 0.18);
  border-radius: 999px;
}
.portfolio-viewer-body::-webkit-scrollbar-track {
  background: transparent;
}

.portfolio-viewer {
  border-radius: var(--radius-xl);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 1.2rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/*.portfolio-viewer-header h2 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.portfolio-viewer-header p {
  font-size: 0.86rem;
  color: var(--muted);
}

.portfolio-viewer-body {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.portfolio-placeholder h3 {
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

.portfolio-placeholder p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.portfolio-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.portfolio-tab {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #111827;
  color: var(--text);
  font-size: 0.8rem;
  cursor: default;
}*/

/* Scroll hint bubble near cursor */
#scroll-hint {
  position: fixed;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(26, 19, 41, 0.95);
  border: 1px solid rgba(139, 92, 246, 0.85);
  color: #f9fafb;
  font-size: 0.78rem;
  pointer-events: none;
  opacity: 0;
  transform: translate(0, 0);
  transition: opacity 200ms ease-out;
  z-index: 999;
}

#scroll-hint.visible {
  opacity: 1;
}

/* Custom cursor: dot + ring */
body {
  cursor: none; /* hide default cursor */
}

#cursor-dot,
#cursor-ring {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
}

/* Inner dot */
#cursor-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f9fafb;
}

/* Outer ring */
#cursor-ring {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(249, 250, 251, 0.7);
  transition:
    width 140ms ease-out,
    height 140ms ease-out,
    border-color 140ms ease-out,
    background-color 140ms ease-out,
    transform 140ms ease-out;
}

/* Hover state: ripple / emphasis */
#cursor-ring.cursor-ring-hover {
  width: 38px;
  height: 38px;
  border-color: rgba(139, 92, 246, 0.9);
  background-color: rgba(139, 92, 246, 0.16);
}

.case-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}

.case-modal.is-open { display: block; }

.case-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
}

.case-modal__panel {
  position: relative;
  width: min(980px, calc(100vw - 2rem));
  height: min(980px, calc(100vh - 2rem));
  margin: 1rem auto;
  border-radius: 16px;
  border: 1px solid rgba(51, 36, 69, 0.8);
  background: rgba(14, 11, 22, 0.96);
  overflow: hidden;
}

.case-modal__content {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  gap: 0.75rem;
}

.case-modal__title { margin: 0; }
.case-modal__subtitle { margin: 0; opacity: 0.85; }

.case-modal__body {
  flex: 1;
  overflow: auto;          /* scrolling INSIDE modal */
  padding-right: 8px;
}

.case-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 1px solid rgba(51, 36, 69, 0.8);
  background: transparent;
  color: rgba(249,250,251,0.9);
  border-radius: 10px;
  padding: 0.4rem 0.6rem;
  cursor: none; /* keep your custom cursor */
}

/* Optional: lock page scroll when modal open */
body.modal-open {
  overflow: hidden;
}

/* =========================
   Case viewer layout (2-col)
   ========================= */

/* Wrapper for multiple rows */
.case-stack {
  display: grid;
  gap: 1.25rem; /* SPACE BETWEEN PROJECT ITEMS */
}

/* One project row: image (left) + text (right) */
.case-row {
  display: grid;
  grid-template-columns: 1fr 1fr; /* IMAGE HALF / TEXT HALF */
  gap: 1.25rem;                  /* GAP BETWEEN IMAGE + TEXT */
  align-items: start;
}

/* LEFT SIDE (IMAGE COLUMN) */
.case-media {
  margin: 0;
}

/* The image itself */
.case-img {
  width: 100%;
  height: auto;              /* prevents top cropping */
  display: block;            /* fixes weird gaps */
  border-radius: 12px;       /* consistent corners (fixes your sharp top issue) */
  border: 1px solid rgba(51, 36, 69, 0.8);
  background: rgba(14, 11, 22, 0.35); /* subtle frame */
}

/* RIGHT SIDE (TEXT COLUMN) */
.case-copy {
  display: grid;
  gap: 0.6rem;
}

.case-link {
  color: var(--accent);
}

.case-link:hover {
  color: var(--text);
}

/* Labels so you know exactly what to tweak */
.case-title {
  margin: 0;                 /* adjust title spacing */
  font-size: 1.05rem;        /* adjust title size */
  line-height: 1.25;
}

.case-desc {
  margin: 0;                 /* adjust paragraph spacing */
  opacity: 0.9;
  line-height: 1.55;
}

/* Bullet list */
.case-points {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
}

.case-points li {
  opacity: 0.95;
}

/* ================================
   MOBILE FULL-SCREEN MENU
================================== */

.nav-toggle {
  display: none;
  border: 0;
  background: transparent;
  padding: 10px;
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
}

.nav-toggle-lines {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  position: relative;
  border-radius: 999px;
}

.nav-toggle-lines::before,
.nav-toggle-lines::after {
  content: "";
  position: absolute;
  left: 0;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
}

.nav-toggle-lines::before { top: -7px; }
.nav-toggle-lines::after  { top: 7px; }

/* Full-screen overlay container */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(14px);
}

/* Inner panel */
.mobile-menu__panel {
  height: 100%;
  width: 100%;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: rgba(14, 11, 22, 0.92);
  border: 1px solid rgba(139, 92, 246, 0.18);
}

/* Top row */
.mobile-menu__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.mobile-menu__brand {
  display: grid;
  gap: 4px;
}

.mobile-menu__close {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: rgba(249,250,251,0.92);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

/* Links */
.mobile-menu__links {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.mobile-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px;
  border-radius: 14px;
  text-decoration: none;
  color: rgba(249,250,251,0.92);
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}

.mobile-link:active {
  transform: scale(0.99);
}

/* CTA inside menu */
.mobile-link--cta {
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.14);
  color: rgba(249,250,251,0.92);
  justify-content: flex-start;
  gap: 10px;
}

body.menu-open {
  overflow: hidden;
}

/* MOBILE rules (integrates with your existing @media max-width:900) */
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .nav-cta--desktop { display: none; } /* move CTA into hamburger */
}

/* Desktop: never show mobile overlay */
@media (min-width: 901px) {
  .mobile-menu { display: none !important; }
}

/* RESPONSIVE */

@media (max-width: 900px) {
  .nav-links {
    display: none;
  }

  .page {
    padding-inline: 1.25rem;
    padding-top: 2.5rem;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.4rem;
  }

  .hero-left {
    max-width: 100%;
  }

  .hero-card {
    max-width: 360px;
  }

  .page--work {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }

  .work-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }

}

@media (max-width: 640px) {
  .page {
    padding-inline: 1rem;
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }

  .footer-inner {
    padding-inline: 1rem;
  }
}

/* ================================
   MOBILE (<=800px) — unified + stable
   - normal page scroll (no hard locks)
   - modal scroll contained (no background scroll)
   - cursor disabled
   - case rows stack
================================== */
@media (max-width: 800px) {

  /* Stack image above text for case rows */
  .case-row {
    grid-template-columns: 1fr;
  }

  /* Your resume padding fix (kept) */
  .page .resume-grid {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }

  /* Allow normal page scrolling on mobile */
  html, body {
    height: auto;
    overflow: auto;
  }

  body {
    position: static;
    inset: auto;
    width: auto;
  }

  /* Let pages grow with content (prevents clipping) */
  .page {
    height: auto;
    min-height: 100svh;
    overflow: visible;
    padding: 18px 16px;
    padding-bottom: 2.5rem;
    box-sizing: border-box;
  }

  main {
    overflow: visible;
    min-height: auto;
    flex: initial;
  }

  /* Footer behaves normally after content */
  footer, .site-footer {
    margin-top: 2rem;
    margin-bottom: 0;
    padding-bottom: 0;
  }

  /* Portfolio viewer: inner scroll stays smooth */
  .portfolio-viewer { padding: 14px; }

  .portfolio-viewer-body {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-right: 8px;
  }

  /* Optional grid tightening (keeps it neat) */
  .portfolio-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  /* Slight mobile type scaling */
  html { font-size: 14px; }

  /* Disable custom cursor on mobile */
  body, a, button, input, textarea, select, label {
    cursor: auto !important;
  }
  .custom-cursor,
  .cursor,
  .cursor-dot,
  .cursor-outline,
  .cursor-ring,
  #cursor-dot,
  #cursor-ring {
    display: none !important;
  }

  /* ================================
     CASE MODAL — scroll inside modal only
     Works with your actual HTML:
     <div class="case-modal" id="caseModal">
       <div class="case-modal__panel">...
       <div class="case-modal__body" id="caseBody">...
  ================================== */

  /* Overlay fits the viewport */
  .case-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    padding: 14px;
    box-sizing: border-box;
    overflow: hidden;
    overscroll-behavior: contain;
  }

  /* Panel fits screen */
  .case-modal__panel {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    max-height: calc(100svh - 28px);
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr; /* header + body */
    border-radius: 18px;
  }

  /* Scroll happens INSIDE body */
  .case-modal__body,
  #caseBody {
    min-height: 0; /* critical for grid scrolling */
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .case-modal__body img,
  #caseBody img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
  }

  /* Background lock only when modal is open (your JS already toggles .modal-open) */
  body.modal-open {
    overflow: hidden;
    height: 100%;
    touch-action: none;
  }

  /* Overlay stays fixed */
  #caseModal.case-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;           /* your .is-open should override this */
    padding: 14px;
    box-sizing: border-box;
    overflow: hidden;        /* prevent page scroll */
    overscroll-behavior: contain;
  }

  /* When open */
  #caseModal.case-modal.is-open {
    display: block;
  }

  /* Center panel + set a real height constraint */
  #caseModal .case-modal__panel {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    max-height: calc(100svh - 28px);
    height: calc(100svh - 28px);
    overflow: hidden;        /* IMPORTANT: panel itself doesn't scroll */
    border-radius: 18px;
    display: flex;
    flex-direction: column;
  }

  /* Make the content area a flex column so the body can scroll */
  #caseModal .case-modal__content {
    display: flex;
    flex-direction: column;
    min-height: 0;           /* CRITICAL */
    height: 100%;
  }

  /* The scroll area (this is the key) */
  #caseModal .case-modal__body,
  #caseBody {
    flex: 1;
    min-height: 0;           /* CRITICAL */
    overflow-y: auto;        /* modal scroll happens here */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 16px;
    touch-action: pan-y;
  }

  /* Images behave nicely */
  #caseModal .case-modal__body img,
  #caseBody img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
  }

  /* Lock background scroll when modal open (your JS already adds modal-open) */
  body.modal-open {
    overflow: hidden;
    height: 100%;
    position: fixed;
    width: 100%;
  }
}
