* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --border: #e9edf2;
  --border-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-soft: #3b82f6;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.02);
  --nav-bg: rgba(255, 255, 255, 0.78);
  --nav-border: rgba(0, 0, 0, 0.05);
  --radius: 28px;
  --notepad-bg: #fefef8;
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
}

body.dark {
  --bg: #0b1120;
  --surface: #142133;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --border: #1e2a3d;
  --border-strong: #2d3e52;
  --primary: #60a5fa;
  --primary-soft: #93bbfc;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  --nav-bg: rgba(20, 33, 51, 0.82);
  --nav-border: rgba(255, 255, 255, 0.05);
  --notepad-bg: #0f1729;
}

html { scroll-behavior: smooth; font-size: 62.5%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 110px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.5s ease, color 0.5s ease;
}

.page-tear-wrapper {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9999;
  overflow: hidden; opacity: 0; transition: opacity 0.01s;
}
.page-tear-wrapper.active { opacity: 1; pointer-events: all; }
.page-tear-wrapper .tear-paper {
  position: absolute; inset: 0;
  background: var(--notepad-bg);
  transform-origin: left center;
  will-change: transform, clip-path, opacity;
}
.page-tear-wrapper .tear-paper.show {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.page-tear-wrapper .tear-paper.tearing {
  animation: tearPageSmooth 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes tearPageSmooth {
  0%   { transform: scale(1) rotate(0deg) translateX(0); opacity: 1; clip-path: inset(0 0 0 0); }
  25%  { transform: scale(1.005) rotate(0.8deg) translateX(8px); opacity: 1; clip-path: inset(0 5% 0 0); }
  50%  { transform: scale(0.995) rotate(2deg) translateX(25px); opacity: 0.95; clip-path: inset(0 25% 0 0); }
  75%  { transform: scale(0.97) rotate(4deg) translateX(50px); opacity: 0.7; clip-path: inset(0 55% 0 0); }
  100% { transform: scale(0.92) rotate(6deg) translateX(90px); opacity: 0; clip-path: inset(0 85% 0 0); }
}

.container { max-width: 1000px; margin: 0 auto; padding: 0 2.4rem; position: relative; z-index: 1; }

.section {
  padding: 5rem 0 6rem;
  border-bottom: 1px solid var(--border);
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.section.visible { opacity: 1; transform: translateY(0); }
.section:last-of-type { border-bottom: none; }

.section-label {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.8rem;
  display: block;
}
.section-label .label-num { color: var(--primary); font-weight: 700; margin-right: 0.2rem; }
.section-label .label-dash { color: var(--text-faint); margin: 0 0.5rem; }

.section-heading {
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 0.8rem;
  display: block;
}
.section-sub {
  font-size: 1.5rem;
  color: var(--text-muted);
  margin-bottom: 2.8rem;
  max-width: 720px;
  line-height: 1.7;
}

.section-divider {
  border: 0; height: 1px;
  background: var(--border);
  margin: 0 auto 1.6rem;
  max-width: 1000px; width: 100%;
}

.section-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.4rem;
  margin-bottom: 2.8rem;
}
.section-header-row .section-label {
  margin-bottom: 0;
  padding-bottom: 0.2rem;
}

.all-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0;
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
}
.all-btn .arrow {
  display: inline-block;
  font-size: 1.5rem;
}

#home {
  padding: 3rem 0 4rem;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: none;
}
.hero {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 6rem;
  align-items: center;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}
.hero-image { display: flex; justify-content: center; align-items: center; }
.profile-img {
  width: 340px; height: 340px;
  object-fit: cover;
  display: block;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.hero-content { display: flex; flex-direction: column; gap: 1.6rem; }
.hero-name h1 {
  font-size: 5.4rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
  color: var(--text);
}
.hero-name h1 span { color: var(--primary); }
.hero-description p {
  font-size: 1.55rem;
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 560px;
}

.hero-social {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 0.8rem 2.2rem; margin-top: 0.8rem;
  font-size: 1.25rem;
  color: var(--text-muted);
}
.hero-social a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 400;
  text-transform: lowercase;
  font-family: var(--mono);
}
.hero-social a::after {
  content: " \2197";
  color: var(--text-faint);
}
.hero-social .social-arrow {
  color: var(--text-faint);
  margin: 0 0.9rem;
  opacity: 0.7;
  user-select: none;
  font-size: 1.3rem;
  display: inline-block;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
.hero-stats .stat {
  display: flex; flex-direction: column; gap: 0.3rem;
  padding: 2rem 2rem 2rem 0;
  border-right: 1px solid var(--border);
}
.hero-stats .stat:last-child { border-right: none; }
.hero-stats .stat:not(:first-child) { padding-left: 2rem; }
.hero-stats .stat .num {
  font-family: var(--mono);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.hero-stats .stat .lbl {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 0.5rem;
}

.project-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.4rem; }
.project-card {
  background: var(--surface);
  border-radius: 24px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.project-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
  background: var(--border);
  display: block;
}
.project-card-body { padding: 1.6rem 1.8rem 2rem; flex: 1; display: flex; flex-direction: column; }
.card-top { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.card-title { font-size: 1.6rem; font-weight: 600; color: var(--text); }
.card-desc {
  font-size: 1.25rem; color: var(--text-muted);
  line-height: 1.6; margin: 0.4rem 0 0.8rem; flex: 1;
}
.card-checklist { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 0.4rem 0 0.8rem; }
.card-checklist span {
  font-size: 1.1rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 0.3rem;
}
.card-checklist i { color: var(--primary); font-size: 0.8rem; }
.card-tech { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0 1.2rem; }
.card-tech .tech-pill { font-size: 1rem; padding: 0.1rem 1rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: auto; }
.card-actions .btn-primary, .card-actions .btn-outline { padding: 0.4rem 1.4rem; font-size: 1.15rem; }

/* =========================================
   NEW INTERACTIVE PROJECT STACK
   ========================================= */
.project-stack-container {
  position: relative;
  width: 100%;
  max-width: 900px;
  height: 520px;
  margin: 3rem auto 0;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1200px;
  overflow-x: clip;
}

.project-card-stack {
  position: absolute;
  width: 360px; 
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 1.8rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.15);
  color: var(--text);
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), 
              opacity 0.5s ease, 
              filter 0.5s ease,
              box-shadow 0.5s ease;
  top: 50%;
  left: 50%;
  margin-top: -250px;
  margin-left: -180px;
  cursor: pointer;
}

body.dark .project-card-stack {
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  border-color: var(--border-strong);
}

.project-card-stack .card-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: bold;
  letter-spacing: 1px;
  padding: 0.3rem 0.8rem;
  border-radius: 50px;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  margin-right: 0.4rem;
  margin-bottom: 0.5rem;
}

.project-card-stack .card-badge.highlight {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(37,99,235,0.08);
}

body.dark .project-card-stack .card-badge.highlight {
  background: rgba(96,165,250,0.15);
}

.project-card-stack .stack-card-content {
  margin-top: 1rem;
}

.project-card-stack .project-image-container {
  width: 100%;
  height: 200px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 1.2rem;
  background: var(--border);
  border: 1px solid var(--border);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.dark .project-card-stack .project-image-container {
  border-color: var(--border-strong);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.project-card-stack .project-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.project-card-stack h3 {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  line-height: 1.2;
}

.project-card-stack p {
  font-size: 1.2rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.project-card-stack .stack-card-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.project-card-stack .stack-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  border-radius: 40px;
  font-size: 1.1rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  flex: 1;
}

.project-card-stack .primary-btn {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
}

.project-card-stack .primary-btn:hover {
  opacity: 0.9;
}

.project-card-stack .outline-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

body.dark .project-card-stack .outline-btn {
  border-color: var(--border);
}

.project-card-stack .outline-btn:hover {
  background: var(--border);
}

/* Positions & Tilts */
/* Center card sits flat in front; side cards are the same size, tucked
   behind it, tilted on Z (and a little on Y) so only their edges peek out. */
.project-card-stack {
  transform-style: preserve-3d;
  backface-visibility: hidden;
  border-radius: 32px;
}

.project-card-stack.main-card {
  z-index: 20;
  transform: translateX(0) translateZ(0) scale(1);
  filter: none;
  opacity: 1;
  box-shadow: 0 30px 70px rgba(0,0,0,0.25);
  cursor: default;
}

body.dark .project-card-stack.main-card {
  box-shadow: 0 30px 70px rgba(0,0,0,0.85);
}

.project-card-stack.side-card {
  z-index: 5;
  opacity: 1;
  filter: brightness(0.7);
}

.project-card-stack.side-card.left {
  transform: translateX(-105px) translateY(18px) translateZ(-80px)
             rotateY(14deg) rotateZ(-7deg) scale(0.94);
}

.project-card-stack.side-card.right {
  transform: translateX(105px) translateY(18px) translateZ(-80px)
             rotateY(-14deg) rotateZ(7deg) scale(0.94);
}

/* Hover: side cards ease out a bit and brighten */
.project-card-stack.side-card.left:hover {
  filter: brightness(0.95);
  transform: translateX(-120px) translateY(10px) translateZ(-40px)
             rotateY(10deg) rotateZ(-5deg) scale(0.96);
}

.project-card-stack.side-card.right:hover {
  filter: brightness(0.95);
  transform: translateX(120px) translateY(10px) translateZ(-40px)
             rotateY(-10deg) rotateZ(5deg) scale(0.96);
}

.tech-pill {
  background: var(--border); color: var(--text);
  padding: 0.2rem 1.2rem; border-radius: 40px;
  font-size: 1.1rem; font-weight: 400;
}
body.dark .tech-pill { background: #1e2a3d; color: #e2e8f0; }

.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 1.2rem; font-weight: 500;
  padding: 0.2rem 1rem; border-radius: 40px;
  background: var(--border); color: var(--text-muted);
  letter-spacing: 0.2px;
}
.badge-live { background: #dcfce7; color: #166534; }
body.dark .badge-live { background: #1a3a2a; color: #86efac; }
.badge-mobile { background: #e0f2fe; color: #0369a1; }
body.dark .badge-mobile { background: #0a2a3a; color: #7dd3fc; }
.badge-web { background: #e0e7ff; color: #3730a3; }
body.dark .badge-web { background: #1e1b4b; color: #a5b4fc; }

.btn-primary, .btn-outline {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.7rem 1.8rem; border-radius: 40px;
  font-weight: 500; font-size: 1.3rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }

.btn {
  display: inline-block; background: var(--primary); color: white;
  padding: 1rem 3.2rem; border-radius: 40px;
  font-weight: 500; text-decoration: none; font-size: 1.5rem;
  border: none; cursor: pointer;
}

.contact-wrap {
  position: relative;
  display: inline-block;
  margin-top: 2rem;
}
.contact-bubble {
  position: absolute;
  bottom: calc(100% + 1.2rem);
  left: 50%;
  transform: translateX(-50%) translateY(8px) scale(0.96);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  padding: 1.6rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 50;
  width: max-content;
  max-width: min(340px, calc(100vw - 3.2rem));
}
body.dark .contact-bubble { box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55); }
.contact-bubble.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}
.contact-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: var(--surface);
}
.contact-bubble .email-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1.6rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 40px;
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.contact-bubble .email-btn i { font-size: 1.3rem; }
.contact-bubble .socials {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  width: 100%;
  justify-content: center;
}
.contact-bubble .socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.6rem;
  text-decoration: none;
}

.experience-timeline { display: flex; flex-direction: column; gap: 1.2rem; margin-top: 2.4rem; }
.exp-item {
  display: flex; align-items: baseline; gap: 1.6rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.exp-item:last-child { border-bottom: none; }
.exp-year { font-size: 1.5rem; font-weight: 600; color: var(--primary); min-width: 140px; }
.exp-detail { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1rem; }
.exp-title { font-size: 1.6rem; font-weight: 600; color: var(--text); }
.exp-badge {
  background: var(--border);
  padding: 0.2rem 1rem; border-radius: 40px;
  font-size: 1rem; font-weight: 500;
  color: var(--text-muted); letter-spacing: 0.2px;
}
body.dark .exp-badge { background: #1e2a3d; color: #94a3b8; }

.cert-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 4rem 2rem;
  border: 1px dashed var(--border-strong);
  border-radius: 24px;
  background: var(--surface);
  text-align: center;
}
.cert-empty i {
  font-size: 3rem;
  color: var(--text-faint);
  margin-bottom: 0.4rem;
}
.cert-empty p {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
}
.cert-empty span {
  font-size: 1.2rem;
  color: var(--text-muted);
}

/* CAROUSEL */

.outside-ide-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 4rem;
  align-items: center;
  margin-top: 1.6rem;
  margin-bottom: 1.6rem;
}

.outside-ide-text {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.outside-ide-text p {
  font-size: 1.4rem;
  color: var(--text-muted);
  line-height: 1.75;
}

.outside-ide-carousel {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.carousel-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface);
  border-radius: 24px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: grab;
}
.carousel-wrapper:active {
  cursor: grabbing;
}

.carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

.carousel-slide {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--border);
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--nav-bg);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: background 0.2s ease, transform 0.2s ease;
}
body.dark .carousel-arrow {
  background: rgba(20, 33, 51, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.carousel-arrow:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-50%) scale(1.05);
}
.carousel-arrow.prev { left: 12px; }
.carousel-arrow.next { right: 12px; }

   .project-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 2.6rem;
    padding-bottom: 1.4rem;
    border-bottom: 1px solid var(--border);
  }
  
  .project-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.6rem;
    border-radius: 40px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease,
      transform 0.2s ease;
  }
  
  .project-tab i {
    font-size: 1.2rem;
  }
  
  .project-tab:hover {
    color: var(--text);
    border-color: var(--border-strong);
  }
  
  .project-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: translateY(-1px);
  }
  
  .project-tab .tab-count {
    font-size: 1rem;
    opacity: 0.75;
  }
  
  .project-tab.active .tab-count {
    opacity: 0.9;
  }
  
  .project-card.filtered-out {
    display: none;
  }
  
  .project-card {
    animation: projectCardIn 0.35s ease;
  }
  
  @keyframes projectCardIn {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  @media (prefers-reduced-motion: reduce) {
    .project-card {
      animation: none;
    }
  }
  
  @media (max-width: 480px) {
    .project-tabs {
      gap: 0.6rem;
      margin-bottom: 2rem;
    }
    .project-tab {
      font-size: 1.05rem;
      padding: 0.7rem 1.2rem;
    }
    .project-tab i {
      font-size: 1.1rem;
    }
    .project-tab .tab-count {
      display: none;
    }
  }
  
.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1.2rem;
}
.carousel-indicators span {
  width: 10px;
  height: 10px;
  border-radius: 20px;
  background: var(--border-strong);
  transition: all 0.3s ease;
  cursor: pointer;
}
.carousel-indicators span.active {
  background: var(--primary);
  width: 28px;
}

/* Responsive */
@media (max-width: 768px) {
  .outside-ide-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .outside-ide-text {
    order: 2;
  }
  .carousel-wrapper {
    aspect-ratio: 16 / 10;
  }
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2.8rem;
  margin-top: 1.6rem;
}
.service-card {
  padding: 3rem 2.8rem;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  display: flex; flex-direction: column;
  height: 100%;
}
.service-card .icon {
  font-size: 3rem; color: var(--primary);
  margin-bottom: 1rem; display: block; line-height: 1;
}
.service-card h3 {
  font-size: 2rem; font-weight: 600;
  margin-bottom: 0.8rem; color: var(--text);
}
.service-card p {
  font-size: 1.4rem; color: var(--text-muted);
  line-height: 1.7; margin-bottom: 1.6rem;
}
.service-card ul {
  list-style: none; margin-top: auto;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.3rem 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.service-card ul li {
  font-size: 1.2rem; color: var(--text-muted);
  padding: 0.2rem 0;
  display: flex; align-items: center; gap: 0.6rem;
}
.service-card ul li i { color: var(--primary); font-size: 0.8rem; }

/* TOOLS & SKILLS GRID */
.tools-tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.4rem;
  margin-top: 1.6rem;
}

.skill-card, .tool-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 2.4rem 2.2rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.tool-card.full-width {
  grid-column: 1 / -1;
}

.skill-card h4, .tool-card h4 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 1.6rem;
  display: flex; 
  align-items: center; 
  gap: 0.8rem;
  color: var(--text);
}

.skill-card h4 i, .tool-card h4 i { 
  color: var(--primary); 
  width: 2rem; 
  font-size: 1.8rem;
}

.skill-tag-group, .tool-tag-group {
  display: flex; 
  flex-wrap: wrap;
  gap: 0.8rem;
}

.skill-tag, .tool-tag {
  background: var(--bg); 
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.6rem 1.4rem; 
  border-radius: 8px;
  font-size: 1.2rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  cursor: default;
}

body.dark .skill-tag, body.dark .tool-tag { 
  background: #1e2a3d; 
  color: #e2e8f0; 
  border-color: #2d3e52;
}

/* FEEDBACKS & CONTACT */ 
.feedbacks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.4rem;
  margin-top: 1.6rem;
}
.feedback-card {
  padding: 2.4rem 2rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}
.feedback-card .quote {
  font-size: 1.5rem; color: var(--text-muted);
  font-style: italic;
  line-height: 1.7;
  margin-bottom: 1.2rem;
}
.feedback-card .author {
  font-size: 1.3rem; font-weight: 600;
  color: var(--primary);
}

.contact-cta {
  background: var(--surface);
  border-radius: 32px;
  padding: 4rem 3rem;
  text-align: center;
  border: 1px solid var(--border);
  margin-top: 2rem;
}
.contact-cta h2 { font-size: 2.8rem; font-weight: 600; }
.contact-cta p { color: var(--text-muted); font-size: 1.6rem; margin: 0.8rem 0 0; }

/* NAVIGATION */
.bottom-nav {
  position: fixed; bottom: 18px; left: 50%;
  transform: translateX(-50%);
  width: 92%; max-width: 560px; min-width: 280px;
  background: var(--nav-bg);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-radius: var(--radius);
  border: 1px solid var(--nav-border);
  box-shadow: 0 10px 40px rgba(0,0,0,0.06);
  padding: 6px 8px;
  display: flex; justify-content: space-around; align-items: center;
  z-index: 999;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}
body.dark .bottom-nav { box-shadow: 0 10px 40px rgba(0,0,0,0.4); }
.bottom-nav.closed { transform: translateX(-50%) translateX(120px) scale(0.8); opacity: 0; pointer-events: none; }
.hide-nav-btn {
  background: transparent; border: none;
  color: var(--text-muted); font-size: 1.8rem;
  padding: 6px 10px; cursor: pointer;
  border-radius: 40px; min-width: 36px;
  display: flex; align-items: center; justify-content: center;
}
.show-nav-btn {
  position: fixed; bottom: 18px; left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: var(--primary); color: white;
  border: none; padding: 0.8rem 1.2rem;
  border-radius: 40px; font-size: 1.8rem;
  cursor: pointer; z-index: 1000;
  box-shadow: 0 4px 20px rgba(37,99,235,0.3);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
  display: none; align-items: center; justify-content: center;
  min-width: 56px; height: 52px;
  opacity: 0; pointer-events: none;
}
.show-nav-btn i { font-size: 1.8rem; }
.show-nav-btn.visible {
  display: flex;
  transform: translateX(-50%) scale(1);
  opacity: 1; pointer-events: auto;
}
.nav-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; padding: 6px 10px;
  border-radius: 40px;
  background: transparent; border: none;
  color: var(--text-muted);
  font-size: 1.1rem; font-weight: 500;
  cursor: pointer;
  flex: 1; min-width: 44px;
  position: relative; text-decoration: none;
}
.nav-item i { font-size: 1.8rem; line-height: 1; }
.nav-item span { font-size: 0.8rem; letter-spacing: -0.2px; opacity: 0.75; }
.nav-item.active { color: var(--primary); }
.nav-item.active i, .nav-item.active span { color: var(--primary); opacity: 1; }
.nav-item.active::before {
  content: ""; position: absolute; top: -4px; left: 50%;
  transform: translateX(-50%);
  width: 20px; height: 4px;
  background: var(--primary); border-radius: 20px; opacity: 0.6;
}
.theme-toggle-nav {
  background: transparent; border: none;
  color: var(--text-muted); font-size: 1.8rem;
  padding: 6px 10px; cursor: pointer;
  border-radius: 40px;
  display: flex; align-items: center; justify-content: center;
}
.more-btn.active, .more-btn.active i, .more-btn.active span { color: var(--primary); }

.more-popup {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: var(--nav-bg);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-radius: var(--radius);
  border: 1px solid var(--nav-border);
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  padding: 1.5rem 1.8rem;
  z-index: 1001;
  opacity: 0; pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 220px;
}
.more-popup.active {
  opacity: 1; pointer-events: auto;
  transform: translateX(-50%) scale(1);
}
.more-popup-content { position: relative; display: flex; flex-direction: column; gap: 0.6rem; }
.more-popup-close {
  position: absolute; top: -8px; right: -8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 50%; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted);
  font-size: 1.2rem;
}
.more-popup-items { display: flex; flex-direction: column; gap: 0.4rem; width: 100%; }
.more-popup-item {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  background: transparent; border: none;
  color: var(--text-muted);
  font-size: 1.3rem; font-weight: 500;
  cursor: pointer;
  width: 100%; text-align: left;
  text-decoration: none;
}
.more-popup-item i { font-size: 1.4rem; width: 24px; text-align: center; }
.more-popup-item.active { color: var(--primary); background: rgba(37,99,235,0.08); }

/* PAGE HEADERS*/
.page-header { padding: 6rem 0 2rem; }
.page-header .back-link {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--mono);
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 2.4rem;
}
.page-header h1 {
  font-size: 4.8rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 1rem;
}
.page-header p {
  font-size: 1.55rem;
  color: var(--text-muted);
  max-width: 620px;
  line-height: 1.7;
}

.gears-intro { padding: 6rem 0 0; }
.gears-intro .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 2.4rem;
}
.gears-intro h1 {
  font-size: 4.8rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 1rem;
  color: var(--text);
}
.gears-intro p {
  font-size: 1.55rem;
  color: var(--text-muted);
  max-width: 620px;
  line-height: 1.7;
}

.gear-section-label {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 4rem 0 2rem;
  display: block;
}
.gear-section-label .label-num { color: var(--primary); font-weight: 700; margin-right: 0.2rem; }
.gear-section-label .label-dash { color: var(--text-faint); margin: 0 0.5rem; }

.gears-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2.4rem;
  margin-bottom: 1.6rem;
}

.gear-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  position: relative;
}

.gear-card-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 2rem;
}
body.dark .gear-card-image { background: #f5f5f7; }

.gear-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.gear-card-body {
  padding: 1.6rem 1.8rem 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.gear-card-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}
.gear-card-name .ext-icon {
  font-size: 1.1rem;
  color: var(--text-faint);
  opacity: 0.5;
  flex-shrink: 0;
}

.gear-card-desc {
  font-size: 1.2rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.gears-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 1.6rem;
}

.gear-preview-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.gear-preview-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.6rem;
  overflow: hidden;
}
body.dark .gear-preview-image { background: #f5f5f7; }

.gear-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.gear-preview-body {
  padding: 1.2rem 1.4rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.gear-preview-name {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.gear-preview-name .ext-icon {
  font-size: 1rem;
  color: var(--text-faint);
  opacity: 0.5;
}

.gear-preview-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.4;
}

@media (max-width: 1024px) {
  .hero { grid-template-columns: 280px 1fr; gap: 4rem; max-width: 100%; }
  .profile-img { width: 280px; height: 280px; }
}
@media (max-width: 768px) {
  .container { padding: 0 2rem; }
  .project-grid { grid-template-columns: 1fr 1fr; }
  .outside-ide-grid { grid-template-columns: 1fr; gap: 2rem; }
  .outside-ide-text { order: 2; }
  .hero { grid-template-columns: 260px 1fr; gap: 3rem; max-width: 100%; }
  .profile-img { width: 260px; height: 260px; }
  .hero-name h1 { font-size: 4rem; }
  .page-header h1 { font-size: 3.4rem; }
  .gears-intro h1 { font-size: 3.4rem; }
  .gears-intro p { font-size: 1.4rem; }
  .gears-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.8rem; }
  .gears-preview-grid { grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
}

/* =========================================
   MOBILE 3D STACK OVERRIDES (True Peeking Effect)
   ========================================= */
   @media (max-width: 580px) {
    .project-stack-container {
      height: 480px;
      margin: 1rem auto 0;
      overflow: hidden; /* side cards get cropped at the screen edge */
      perspective: 1200px;
    }

    .project-card-stack {
      width: 78vw;          /* big center card, like the reference */
      max-width: 320px;
      padding: 1.4rem;
      border-radius: 28px;
      margin-top: -210px;
      margin-left: 0;       /* centering is done with translateX(-50%) below */
      left: 50%;
      transform-origin: center center;
      transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1),
                  filter 0.5s ease;
    }

    /* Center card: flat, in front */
    .project-card-stack.main-card {
      z-index: 20;
      transform: translateX(-50%) translateZ(0) scale(1);
      box-shadow: 0 25px 50px rgba(0,0,0,0.45);
    }

    /* Side cards: same card, tucked behind, tilted, only the edges peek out */
    .project-card-stack.side-card {
      z-index: 10;
      filter: brightness(0.65);
      box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    }

    .project-card-stack.side-card.left {
      transform: translateX(calc(-50% - 20%)) translateY(24px) translateZ(-80px)
                 rotateY(16deg) rotateZ(-7deg) scale(0.92);
    }

    .project-card-stack.side-card.right {
      transform: translateX(calc(-50% + 20%)) translateY(24px) translateZ(-80px)
                 rotateY(-16deg) rotateZ(7deg) scale(0.92);
    }

    /* no hover state on touch screens */
    .project-card-stack.side-card.left:hover {
      filter: brightness(0.65);
      transform: translateX(calc(-50% - 20%)) translateY(24px) translateZ(-80px)
                 rotateY(16deg) rotateZ(-7deg) scale(0.92);
    }
    .project-card-stack.side-card.right:hover {
      filter: brightness(0.65);
      transform: translateX(calc(-50% + 20%)) translateY(24px) translateZ(-80px)
                 rotateY(-16deg) rotateZ(7deg) scale(0.92);
    }
  
    /* Adjust inner elements for the smaller card */
    .project-card-stack .project-image-container {
      height: 130px;
      margin-bottom: 0.8rem;
    }
  
    .project-card-stack h3 {
      font-size: 1.4rem;
    }
  
    .project-card-stack p {
      font-size: 1rem;
      line-height: 1.4;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
  
    .project-card-stack .stack-card-actions {
      margin-top: 1rem;
      gap: 0.5rem;
    }
  
    .project-card-stack .stack-btn {
      padding: 0.5rem 0.8rem;
      font-size: 0.9rem;
    }
  }
  /* END MOBILE OVERRIDES */

@media (max-width: 480px) {
  .container { padding: 0 1.6rem; }
  #home { min-height: 100dvh; padding: 3rem 0 6rem; align-items: flex-start; }

  /* Hero: stacked mobile layout — photo on top, then name, bio, links */
  .hero {
    grid-template-columns: 1fr;
    gap: 3.2rem;
    max-width: 100%;
    align-items: start;
  }
  .hero-image { justify-content: center; }
  .profile-img {
    width: 100%;
    max-width: 340px;
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
  }
  .hero-content { gap: 2rem; text-align: left; }
  .hero-name h1 { font-size: 4.4rem; line-height: 1.1; letter-spacing: -0.03em; }
  .hero-description p {
    font-size: 1.7rem;
    line-height: 1.8;
    max-width: none;
  }

  /* Links: plain mono text with a ↗ arrow, no pipe separators */
  .hero-social {
    margin-top: 0.4rem;
    font-size: 1.5rem;
    gap: 0.8rem 2.2rem;
  }
  .hero-social .social-arrow { display: none; }
  .hero-social a { border-bottom: none; padding-bottom: 0; }
  .hero-social a::after { content: " \2197"; }
  .hero-stats { grid-template-columns: 1fr 1fr; margin-top: 2.5rem; }
  .hero-stats .stat { padding: 1.6rem 1.6rem 1.6rem 0; }
  .hero-stats .stat:not(:first-child) { padding-left: 1.6rem; }
  .hero-stats .stat:nth-child(2) { border-right: none; }
  .hero-stats .stat:nth-child(3) {
    border-top: 1px solid var(--border);
    padding-top: 1.6rem; padding-left: 0;
  }
  .hero-stats .stat .num { font-size: 2rem; }
  .feedbacks-grid { grid-template-columns: 1fr; }
  .tools-tools-grid { 
    grid-template-columns: 1fr; 
  }

  .services-grid { grid-template-columns: 1fr !important; gap: 1.8rem !important; }
  .service-card { padding: 2rem 1.6rem !important; }
  .service-card h3 { font-size: 1.6rem !important; }
  .service-card p { font-size: 1.2rem !important; }
  .service-card ul li { font-size: 1rem !important; }
  .contact-cta { padding: 2.4rem 1.6rem; }
  .contact-cta h2 { font-size: 2.2rem; }
  .contact-cta p { font-size: 1.3rem; }
  .btn { padding: 0.8rem 2.2rem; font-size: 1.3rem; }
  .section { padding: 3rem 0 3.6rem; }
  .section-label { font-size: 1rem; }
  .project-grid { grid-template-columns: 1fr; gap: 1.8rem; }
  .project-card img { aspect-ratio: 16 / 9; }
  .bottom-nav { width: 96% !important; padding: 6px 8px !important; min-width: auto !important; }
  .nav-item { min-width: 40px !important; padding: 6px 6px !important; }
  .nav-item i { font-size: 1.6rem !important; }
  .nav-item span { font-size: 0.6rem !important; }
  .more-popup-item span { display: inline !important; font-size: 1.1rem !important; }
  .more-popup-item i { font-size: 1.6rem !important; width: 24px !important; }
  .more-popup-item { padding: 0.8rem 1.2rem !important; }
  .more-popup { padding: 1rem 1.2rem !important; min-width: 200px !important; }
  .more-popup-close { width: 28px !important; height: 28px !important; font-size: 1rem !important; }
  .exp-item { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .exp-year { min-width: auto; }
  .carousel-arrow { width: 34px; height: 34px; font-size: 1.3rem; }
  .carousel-arrow.prev { left: 8px; }
  .carousel-arrow.next { right: 8px; }
  .section-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 1.2rem;
    margin-bottom: 2.2rem;
  }
  .all-btn { font-size: 1.15rem; }
  .all-btn .arrow { font-size: 1.3rem; }
  .page-header { padding: 4rem 0 1rem; }
  .page-header h1 { font-size: 2.6rem; }
  .page-header p { font-size: 1.35rem; }
  .contact-bubble { padding: 1.4rem 1.2rem; }
  .contact-bubble .email-btn { font-size: 1.05rem; padding: 0.8rem 1.2rem; }
  .contact-bubble .socials a { width: 38px; height: 38px; font-size: 1.5rem; }
  .gears-intro { padding: 4rem 0 0; }
  .gears-intro h1 { font-size: 2.6rem; }
  .gears-intro p { font-size: 1.3rem; }
  .gears-grid { grid-template-columns: 1fr; gap: 1.6rem; }
  .gear-card-image { aspect-ratio: 16 / 9; padding: 1.6rem; }
  .gear-card-body { padding: 1.4rem 1.4rem 1.6rem; }
  .gear-card-name { font-size: 1.4rem; }
  .gear-card-desc { font-size: 1.1rem; }
  .gears-preview-grid { grid-template-columns: 1fr; gap: 1.4rem; }
  .gear-preview-image { aspect-ratio: 16 / 9; padding: 1.4rem; }
}
@media (max-width: 380px) {
  .nav-item { min-width: 32px !important; padding: 4px 4px !important; }
  .nav-item i { font-size: 1.4rem !important; }
  .bottom-nav { padding: 4px 4px !important; height: 52px !important; }
  .hide-nav-btn { font-size: 1.2rem !important; min-width: 28px !important; }
  .theme-toggle-nav { font-size: 1.2rem !important; }
  .show-nav-btn { min-width: 44px !important; height: 44px !important; }
  .hero { gap: 2.6rem; }
  .hero-name h1 { font-size: 3.8rem; }
  .hero-description p { font-size: 1.55rem; }
  .hero-social { font-size: 1.35rem; gap: 0.6rem 1.8rem; }
  .hero-stats .stat .num { font-size: 1.8rem; }
}
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* PROJECT CASE STUDY */
.card-preview {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0.4rem 0 1rem;
  padding: 0.9rem 1rem;
  border-left: 2px solid var(--primary);
  background: var(--bg);
  border-radius: 0 10px 10px 0;
}
body.dark .card-preview { background: rgba(96, 165, 250, 0.06); }

.card-preview > span {
  display: block;
}

.card-preview .preview-label {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  margin-right: 0.6rem;
}

.btn-case-study {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 1.4rem;
  border-radius: 40px;
  font-size: 1.15rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--primary);
  background: transparent;
  border: 1px dashed var(--primary);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn-case-study:hover,
.btn-case-study:focus-visible {
  background: var(--primary);
  color: #fff;
  border-style: solid;
  outline: none;
}
.btn-case-study i { font-size: 1rem; }

.badge-progress { background: #fef3c7; color: #92400e; }
body.dark .badge-progress { background: #3a2a10; color: #fcd34d; }

.case-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.case-modal.open {
  opacity: 1;
  pointer-events: auto;
}
.case-modal[hidden] { display: none; }

.case-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
body.dark .case-modal-backdrop { background: rgba(0, 0, 0, 0.7); }

.case-modal-panel {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
  overscroll-behavior: contain;
}
.case-modal.open .case-modal-panel {
  transform: translateY(0) scale(1);
}

.case-modal-close {
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  z-index: 2;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.case-modal-close:hover,
.case-modal-close:focus-visible {
  color: var(--primary);
  border-color: var(--primary);
  outline: none;
}

.case-modal-header {
  padding: 2.6rem 2.8rem 1.6rem;
  border-bottom: 1px solid var(--border);
}
.case-modal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}
.case-modal-title {
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.6rem;
}
.case-modal-sub {
  font-size: 1.35rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 60ch;
}

.case-modal-body {
  padding: 2rem 2.8rem 2.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

.case-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.case-section-label {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
}
.case-section p {
  font-size: 1.35rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 65ch;
}
.case-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.case-section ul li {
  position: relative;
  padding-left: 1.6rem;
  font-size: 1.3rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.case-section ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  transform: translateY(-50%);
}

.case-tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.case-tech-list .tech-pill {
  background: var(--border);
  color: var(--text);
  padding: 0.3rem 1.1rem;
  border-radius: 40px;
  font-size: 1.1rem;
}
body.dark .case-tech-list .tech-pill { background: #1e2a3d; color: #e2e8f0; }

.case-modal-footer {
  padding: 1.6rem 2.8rem 2.4rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

body.modal-open { overflow: hidden; }

@media (max-width: 640px) {
  .case-modal { padding: 1rem; }
  .case-modal-panel { max-height: calc(100vh - 2rem); border-radius: 20px; }
  .case-modal-header { padding: 2.2rem 1.8rem 1.4rem; }
  .case-modal-title { font-size: 1.9rem; }
  .case-modal-sub { font-size: 1.25rem; }
  .case-modal-body { padding: 1.6rem 1.8rem 2rem; gap: 1.5rem; }
  .case-section p { font-size: 1.25rem; }
  .case-section ul li { font-size: 1.2rem; }
  .case-modal-footer { padding: 1.4rem 1.8rem 2rem; }
  .case-modal-close { top: 1rem; right: 1rem; width: 32px; height: 32px; font-size: 1.05rem; }
  .card-preview { font-size: 1.05rem; padding: 0.8rem 0.9rem; }
}

#projectGrid .project-card img {
  width: 100%;
  height: 160px;
  aspect-ratio: auto;
  object-fit: cover;
  object-position: top center;
}

@media (prefers-reduced-motion: reduce) {
  .case-modal,
  .case-modal-panel,
  .btn-case-study {
    transition: none !important;
  }
}