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

:root {
  --bg:           #f8fbff;
  --bg-surface:   #dbeafe;
  --bg-card:      #ffffff;
  --accent:       #2563eb;
  --accent-dim:   rgba(37, 99, 235, 0.08);
  --text-primary: #0f172a;
  --text-muted:   #475569;
  --text-dim:     #94a3b8;
  --border:       rgba(37, 99, 235, 0.15);
  --shadow:       0 1px 3px rgba(0,0,0,0.06), 0 4px 24px rgba(37,99,235,0.07);
  --shadow-hover: 0 4px 8px rgba(0,0,0,0.08), 0 12px 40px rgba(37,99,235,0.12);
  --font:         'Space Grotesk', sans-serif;
  --nav-h:        68px;
  --ease:         0.2s ease;
  --max-w:        1000px;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ===== Navbar ===== */
#navbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  z-index: 200;
  background: rgba(248, 251, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--ease);
}

#navbar.scrolled {
  border-bottom-color: var(--border);
}

.nav-inner {
  width: 100%;
  padding-left: max(2rem, calc(50vw - 650px));
  padding-right: max(2rem, calc(50vw - 650px));
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 3px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.83rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  transition: color var(--ease);
}

.nav-links a:hover {
  color: var(--accent);
}

.nav-resume {
  background: var(--accent) !important;
  color: #fff !important;
  padding: 0.38rem 1.1rem;
  border-radius: 4px;
  transition: opacity var(--ease) !important;
}

.nav-resume:hover {
  opacity: 0.88 !important;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: var(--ease);
}

/* ===== Hero ===== */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  padding: calc(var(--nav-h) + 3rem) 0 5rem;
  background: var(--bg);
  overflow: hidden;
}

.hero-inner {
  width: 100%;
  padding-left: max(2rem, calc(50vw - 650px));
  display: grid;
  grid-template-columns: minmax(0, 433px) 1fr;
  gap: 3.5rem;
  align-items: stretch;
}

.hero-text {
  position: relative;
  z-index: 1;
  align-self: center;
}

.hero-intro {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
  letter-spacing: 1px;
}

.hero-name {
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.05;
  margin-bottom: 0.3rem;
}

.hero-tagline {
  font-size: clamp(0.95rem, 1.5vw, 1.25rem);
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.3;
  margin-bottom: 1.25rem;
}

.hero-bio {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
  line-height: 1.65;
}

.hero-cta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Video panel */
.hero-video-wrap {
  overflow: hidden;
  position: relative;
  min-width: 0;
  margin-left: -4.5rem;
  /* L1: solid fill — restores full clean video beyond the dot zone
     L2: dot pattern
     L3: opacity envelope — controls how opaque the dots are across the edge
     L2 intersect L3 = dots that fade in opacity; L1 added on top = full video beyond */
  /* L1: solid fill — restores full clean video beyond the dot zone
     L2: dot pattern
     L3: opacity envelope — controls how opaque the dots are across the edge
     L2 intersect L3 = dots that fade in opacity; L1 added on top = full video beyond */
  /* L1: solid fill — restores full clean video beyond the dot zone
     L2: dot pattern
     L3: opacity envelope — controls how opaque the dots are across the edge
     L2 intersect L3 = dots that fade in opacity; L1 added on top = full video beyond */
  mask-image:
    linear-gradient(to right, transparent 6%, black 20%),
    radial-gradient(circle 1px at 2px 2px, black 100%, transparent 100%),
    linear-gradient(to right, transparent 0%, black 16%);
  mask-size: 100% 100%, 4px 4px, 100% 100%;
  mask-composite: add, intersect, add;
  -webkit-mask-image:
    linear-gradient(to right, transparent 6%, black 20%),
    radial-gradient(circle 1px at 2px 2px, black 100%, transparent 100%),
    linear-gradient(to right, transparent 0%, black 16%);
  -webkit-mask-size: 100% 100%, 4px 4px, 100% 100%;
  -webkit-mask-composite: source-over, source-in, source-over;
}

.hero-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-embed-wrap {
  position: relative;
  height: 100%;
  min-height: 300px;
}

.video-embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.video-embed-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.video-placeholder {
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: var(--bg-surface);
}

.video-play-icon {
  font-size: 2.5rem;
  color: var(--accent);
  opacity: 0.4;
}

.video-label {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.video-sub {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-family: monospace;
  letter-spacing: 1px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 0.7rem 1.6rem;
  border-radius: 4px;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all var(--ease);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-outline {
  border: 1.5px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent-dim);
}


.btn-large {
  padding: 0.9rem 2.5rem;
  font-size: 0.95rem;
}

/* ===== Section scaffold ===== */
section {
  padding: 5rem 2rem;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-title::after {
  content: '';
  display: block;
  height: 2px;
  background: var(--accent);
  flex: 1;
  min-width: 60px;
  opacity: 0.2;
}

.section-num {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 400;
  font-family: monospace;
}

/* ===== Experience ===== */
#experience {
  background: var(--bg-surface);
}

#experience .container,
#projects .container {
  max-width: 1400px;
}

#projects .projects-grid {
  grid-template-columns: repeat(3, 1fr);
}

.experience-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.experience-card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform var(--ease), box-shadow var(--ease);
  cursor: pointer;
}

.experience-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.exp-banner {
  position: relative;
  height: 280px;
  overflow: hidden;
  flex-shrink: 0;
}

.exp-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.12s ease-out;
}

.exp-banner-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

.exp-banner-placeholder span {
  color: var(--accent);
  font-size: 0.75rem;
  font-family: monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.5;
}

.exp-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.4) 55%, transparent 100%);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 1.75rem 2rem;
  gap: 1rem;
}

.exp-banner-info {
  min-width: 0;
}

.exp-banner-overlay .exp-game {
  color: #fff;
  text-shadow: 0 1px 8px rgba(0,0,0,0.9), 0 2px 20px rgba(0,0,0,0.6);
}

.exp-banner-overlay .exp-role {
  color: #93c5fd;
  text-shadow: 0 1px 6px rgba(0,0,0,0.9);
}

.exp-banner-overlay .exp-company {
  color: rgba(255,255,255,0.6);
}

.exp-banner-overlay .exp-date {
  color: rgba(255,255,255,0.6);
}

.exp-banner-overlay .exp-toggle {
  border-color: rgba(255,255,255,0.3);
  color: #fff;
}

.exp-game {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.exp-role {
  color: var(--accent);
  font-size: 1rem;
}

.exp-company {
  color: var(--text-muted);
}

.exp-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.exp-date {
  color: var(--text-dim);
  font-size: 0.82rem;
  font-family: monospace;
  white-space: nowrap;
}

.exp-toggle {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--accent);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  transition: transform 0.32s ease, background-color 0.2s;
  line-height: 1;
  padding: 0;
  padding-bottom: 1px;
  flex-shrink: 0;
}

.exp-toggle:hover {
  background: rgba(255,255,255,0.15);
}

.experience-card.expanded .exp-toggle {
  transform: rotate(180deg);
}

.experience-card.expanded .exp-banner {
  border-bottom: 2px solid var(--accent);
}

.exp-details {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.5s ease, opacity 0.3s ease;
  overflow-wrap: break-word;
  word-break: break-word;
}

.experience-card.expanded .exp-details {
  max-height: 5000px;
  opacity: 1;
}

.exp-details-inner {
  padding: 2rem;
}

.exp-summary {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.exp-sections-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  margin-bottom: 1.5rem;
}

.exp-details li {
  color: var(--text-muted);
  font-size: 0.93rem;
  margin-bottom: 0.5rem;
  padding-left: 1.25rem;
  position: relative;
}

.exp-details li::before {
  content: '▸';
  color: var(--accent);
  position: absolute;
  left: 0;
  top: 3px;
  font-size: 0.7rem;
}

.exp-details strong {
  color: var(--text-primary);
  font-weight: 600;
}

.exp-section {
  margin-bottom: 0;
}

.exp-section-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.exp-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  font-family: monospace;
  white-space: nowrap;
}

.exp-section-head::after {
  content: '';
  display: block;
  height: 1px;
  background: var(--border);
  flex: 1;
}

.exp-section-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.exp-section-body.no-image {
  /* no change needed — flex column already handles the no-image case */
}

.exp-section-body ul {
  display: flex;
  flex-direction: column;
}

.exp-section-image {
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.exp-section-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.exp-section-image span {
  color: var(--text-dim);
  font-size: 0.72rem;
  font-family: monospace;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.exp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.5rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.exp-tags span,
.project-tags span {
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.18rem 0.55rem;
  border-radius: 3px;
  font-family: monospace;
  font-weight: 600;
  letter-spacing: 0.4px;
}

/* ===== Tweet Carousel ===== */
.player-reactions-section {
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.reactions-sub-label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.7;
  margin-bottom: 1.5rem;
}

/* ── Video carousel ── */
.video-carousel-section {
  margin-bottom: 2.75rem;
}

.video-carousel-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.video-prev,
.video-next {
  position: relative;
  flex-shrink: 0;
  background: var(--accent);
  border: none;
  color: #0a0a0f;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease), transform var(--ease), opacity var(--ease);
  box-shadow: 0 2px 12px rgba(100, 255, 218, 0.35);
}

.video-prev svg,
.video-next svg {
  display: block;
  flex-shrink: 0;
}

.video-prev::before,
.video-next::before {
  content: '';
  position: absolute;
  inset: -14px;
}

.video-prev:hover,
.video-next:hover {
  background: #a0ffec;
  transform: scale(1.1);
}

.video-prev:disabled,
.video-next:disabled {
  opacity: 0.2;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.video-carousel {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  align-items: flex-start;
}

.video-carousel::-webkit-scrollbar {
  display: none;
}

.video-item {
  flex: 0 0 calc((100% - 1rem) / 2);
  scroll-snap-align: start;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.video-item .video-embed-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: auto;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #111;
}

.video-item .video-embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-item .video-embed-wrap::after {
  pointer-events: none;
}

.video-quote {
  font-size: 1rem;
  color: var(--text-muted, #8892b0);
  font-style: italic;
  line-height: 1.45;
  margin: 0;
  padding: 0 0.25rem;
  text-align: center;
}

/* ── Tweet carousel ── */
.tweet-carousel-section {
  /* no extra top margin — lives inside .player-reactions-section */
}

.tweet-carousel-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.tweet-prev,
.tweet-next {
  position: relative;
  flex-shrink: 0;
  background: var(--accent);
  border: none;
  color: #0a0a0f;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease), transform var(--ease), opacity var(--ease);
  box-shadow: 0 2px 12px rgba(100, 255, 218, 0.35);
}

.tweet-prev svg,
.tweet-next svg {
  display: block;
  flex-shrink: 0;
}

.tweet-prev::before,
.tweet-next::before {
  content: '';
  position: absolute;
  inset: -14px;
}

.tweet-prev:hover,
.tweet-next:hover {
  background: #a0ffec;
  transform: scale(1.1);
}

.tweet-prev:disabled,
.tweet-next:disabled {
  opacity: 0.2;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.tweet-carousel {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  align-items: stretch;
}

.tweet-carousel::-webkit-scrollbar {
  display: none;
}

.tweet-item {
  flex: 0 0 calc((100% - 2rem) / 3);
  scroll-snap-align: start;
  overflow: hidden;
  min-width: 0;
}

.tweet-item .twitter-tweet {
  margin: 0 !important;
}

/* Mobile tweet placeholder — holds exactly one tweet at a time */
.tweet-placeholder {
  width: 100%;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Projects ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
}

.project-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: var(--shadow);
  transition: transform var(--ease), box-shadow var(--ease);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.project-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.project-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.65;
  height: calc(3 * 1.65em);
  overflow: hidden;
}

.project-card-image {
  height: 180px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
  border: 1px dashed rgba(100, 255, 218, 0.15);
}

.project-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.project-tags {
  padding-top: 0.25rem;
}

.project-link {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.82rem;
  color: var(--accent);
  letter-spacing: 0.5px;
  transition: opacity var(--ease);
  font-weight: 600;
}

.project-link:hover {
  opacity: 0.7;
}

/* ===== Contact ===== */
#contact {
  background: var(--bg-surface);
}

#contact .section-title {
  justify-content: center;
}

#contact .section-title::before {
  content: '';
  display: block;
  height: 2px;
  background: var(--accent);
  flex: 1;
  min-width: 60px;
  opacity: 0.2;
}

.contact-inner {
  text-align: center;
  max-width: 540px;
  margin: 0 auto;
}

.contact-text {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 2rem;
  line-height: 1.7;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-top: 2rem;
}

.contact-links a {
  color: var(--text-muted);
  font-size: 0.87rem;
  letter-spacing: 0.5px;
  transition: color var(--ease);
}

.contact-links a:hover {
  color: var(--accent);
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

footer p {
  color: var(--text-dim);
  font-size: 0.82rem;
}

.footer-sub {
  margin-top: 0.3rem;
}

/* ===== Cursor glitch trail ===== */
.glitch-pixel {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  animation: glitch-pixel-fade linear forwards;
}

@keyframes glitch-pixel-fade {
  0%   { opacity: 1;   transform: translate(0, 0) scaleX(var(--sx, 1)); }
  35%  { opacity: 0.8; transform: translate(var(--dx), var(--dy)) scaleX(calc(var(--sx, 1) * 2.5)); }
  100% { opacity: 0;   transform: translate(calc(var(--dx) * 1.8), calc(var(--dy) * 1.3)) scaleX(0.5); }
}

@keyframes glitch-burst-fade {
  0%   { opacity: 1;   transform: translate(0, 0) scale(1.2); }
  50%  { opacity: 0.8; transform: translate(var(--dx), var(--dy)) scale(0.8); }
  100% { opacity: 0;   transform: translate(calc(var(--dx) * 1.5), calc(var(--dy) * 1.5)) scale(0.3); }
}

.glitch-burst {
  animation-name: glitch-burst-fade !important;
}

/* ===== Lightbox ===== */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

#lightbox.open {
  display: flex;
}

#lightbox-img {
  max-width: 90vw;
  max-height: 88vh;
  border-radius: 6px;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6);
  object-fit: contain;
  pointer-events: none;
}

/* ===== Project detail pages ===== */
.project-hero {
  padding: calc(var(--nav-h) + 4rem) 2rem 3rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.project-hero.has-banner {
  position: relative;
  overflow: hidden;
  padding-top: calc(var(--nav-h) + 6rem);
  padding-bottom: 5rem;
  background: var(--bg);
  border-bottom: none;
}

.proj-hero-bg {
  position: absolute;
  inset: -30% 0;   /* extra vertical space so the image never shows edges during parallax */
  z-index: 0;
  pointer-events: none;
}

.proj-hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  will-change: transform;
  display: block;
}

.proj-hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  /* dark left-to-right gradient keeps title text readable */
  background: linear-gradient(
    to right,
    rgba(10, 10, 15, 0.65) 35%,
    rgba(10, 10, 15, 0.35) 70%,
    rgba(10, 10, 15, 0.15) 100%
  );
}

.project-hero.has-banner .container {
  position: relative;
  z-index: 2;
}

.project-hero.has-banner .back-link {
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.project-hero.has-banner .proj-hero-title {
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.7);
}

.project-hero.has-banner .project-tags span {
  background: rgba(100, 255, 218, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  text-shadow: none;
}

.back-link {
  display: inline-block;
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  transition: opacity var(--ease);
  letter-spacing: 0.3px;
  font-weight: 600;
}

.back-link:hover {
  opacity: 0.7;
}

.proj-hero-title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  line-height: 1.1;
}

.project-body {
  padding: 4rem 2rem 6rem;
  background: var(--bg);
}

.proj-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4rem;
  align-items: start;
}

.proj-sidebar {
  display: none;
}

.proj-section {
  margin-bottom: 3rem;
}

.proj-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.proj-section p {
  color: var(--text-muted);
  font-size: 0.97rem;
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.proj-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.proj-section ul li {
  color: var(--text-muted);
  font-size: 0.93rem;
  padding-left: 1.2rem;
  position: relative;
}

.proj-section ul li::before {
  content: '▸';
  color: var(--accent);
  position: absolute;
  left: 0;
  top: 2px;
  font-size: 0.7rem;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.media-item {
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: 6px;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  font-family: monospace;
}

/* Natural-ratio images (screenshots, etc.) — overrides the 16/9 placeholder base */
.media-item.media-image {
  aspect-ratio: unset;
  height: auto;
  background: transparent;
  border: none;
  display: block;
}

.media-item.media-youtube {
  position: relative;
  height: 0;
  padding-top: 56.25%; /* 16:9 */
  aspect-ratio: unset;
  overflow: hidden;
  background: #000;
  border: none;
}

.media-item.media-youtube iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.media-item.media-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}

.media-carousel {
  position: relative;
  overflow: hidden;
  padding: 0;
  display: block; /* override flex so abs-positioned images fill correctly */
}

.carousel-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.carousel-img.active {
  opacity: 1;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(10, 10, 15, 0.6);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.carousel-btn:hover {
  background: rgba(100, 255, 218, 0.2);
}

.carousel-prev { left: 0.6rem; }
.carousel-next { right: 0.6rem; }

.carousel-counter {
  position: absolute;
  bottom: 0.5rem;
  right: 0.6rem;
  z-index: 2;
  font-size: 0.75rem;
  color: #fff;
  background: rgba(10, 10, 15, 0.6);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-family: monospace;
  letter-spacing: 0.5px;
}

.proj-sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 2rem);
}

.sidebar-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.sidebar-block h3 {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.75rem;
}

.sidebar-block ul {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-block ul li {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.sidebar-block ul li a {
  color: var(--text-muted);
  transition: color var(--ease);
}

.sidebar-block ul li a:hover {
  color: var(--accent);
}

.sidebar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ── Subproject layout (e.g. Fuzzy2D page) ─────────────────── */
.subproject {
  margin-bottom: 4rem;
}

.subproject-header {
  margin-bottom: 1.75rem;
}

.subproject-header h2 {
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.subproject-divider {
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.subproject-intro {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
  align-items: start;
}

.subproject-meta {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  align-self: start; /* don't stretch to fill grid row height */
}

.meta-row {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.meta-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.meta-row:first-child {
  padding-top: 0;
}

.meta-label {
  font-weight: 700;
  color: var(--text-primary);
}

.meta-value {
  color: var(--text-muted);
}

.meta-row a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity var(--ease);
}

.meta-row a:hover {
  opacity: 0.75;
}

.subproject-desc p {
  color: var(--text-muted);
  font-size: 0.97rem;
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.highlights-label {
  margin-top: 1rem;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
  font-size: 0.97rem;
}

.subproject-desc ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.subproject-desc ul li {
  color: var(--text-muted);
  font-size: 0.93rem;
  padding-left: 1.2rem;
  position: relative;
  line-height: 1.55;
}

.subproject-desc ul li::before {
  content: '▸';
  color: var(--accent);
  position: absolute;
  left: 0;
  top: 2px;
  font-size: 0.7rem;
}

.subproject-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
  align-items: start;
}

.subproject-row.row-media-only,
.subproject-row.row-text-only {
  grid-template-columns: 1fr;
}

.row-heading {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 0.75rem;
}

.row-text a,
.subproject-desc a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.row-text p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.row-text ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.row-text ul li {
  color: var(--text-muted);
  font-size: 0.93rem;
  padding-left: 1.2rem;
  position: relative;
  line-height: 1.55;
}

.row-text ul li::before {
  content: '▸';
  color: var(--accent);
  position: absolute;
  left: 0;
  top: 2px;
  font-size: 0.7rem;
}

.row-media {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.row-media-only .row-media {
  flex-direction: row;
  justify-content: center;
}

.row-media-only .row-media .media-item,
.row-media-only .row-media .media-item-wrap {
  flex: 1 1 0;
  max-width: 640px;
}

.media-item-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.media-caption {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.45;
  text-align: center;
  padding: 0 0.25rem;
  margin: 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: rgba(248, 251, 255, 0.97);
    flex-direction: column;
    padding: 2rem 1.5rem;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: flex;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .hero-video-wrap {
    display: none;
  }

  #hero {
    padding-top: calc(var(--nav-h) + 2rem);
  }

  .exp-banner {
    height: 220px;
  }

  section {
    padding: 4rem 1.5rem;
  }

  .proj-layout {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .proj-sidebar {
    position: static;
    order: -1;
  }

  .subproject-intro {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .subproject-row {
    grid-template-columns: 1fr;
  }

  .row-media-only .row-media {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .exp-banner {
    height: auto;
    display: flex;
    flex-direction: column;
  }

  .exp-banner img {
    height: 180px;
    flex-shrink: 0;
  }

  .exp-banner-overlay {
    position: static;
    background: var(--bg-card);
    align-items: center;
    padding: 1rem 1.25rem;
  }

  .exp-banner-overlay .exp-game {
    color: var(--text-primary);
    font-size: 1.1rem;
    text-shadow: none;
  }

  .exp-banner-overlay .exp-role {
    color: var(--accent);
    text-shadow: none;
  }

  .exp-banner-overlay .exp-company {
    color: var(--text-muted);
  }

  .exp-banner-overlay .exp-date {
    color: var(--text-dim);
  }

  .exp-banner-overlay .exp-toggle {
    border-color: var(--border);
    color: var(--accent);
  }

  .exp-details-inner {
    padding: 1.25rem;
  }

  .exp-section-title {
    white-space: normal;
  }

  .exp-sections-grid {
    grid-template-columns: 1fr;
  }

  .exp-section-body {
    grid-template-columns: 1fr;
  }

  .exp-section-image {
    width: 100%;
  }
}

@media (max-width: 600px) {
  #projects .projects-grid {
    grid-template-columns: 1fr;
  }

  .tweet-item {
    flex: 0 0 100%;
  }

  .tweet-carousel-row {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }

  .tweet-carousel {
    order: 0;
    flex: 0 0 100%;
  }

  .tweet-prev {
    order: 1;
  }

  .tweet-next {
    order: 2;
  }

  .video-item {
    flex: 0 0 100%;
  }

  .video-carousel-row {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }

  .video-carousel {
    order: 0;
    flex: 0 0 100%;
  }

  .video-prev {
    order: 1;
  }

  .video-next {
    order: 2;
  }
}

@media (max-width: 480px) {
  .contact-links {
    flex-wrap: wrap;
    gap: 1.25rem;
  }
}
