:root {
  --font-body: "Raleway", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --font-content: "Raleway", sans-serif;
  --color-bg: #0a0b0d;
  --color-text: #e0e0e0;
  --color-accent: #ffffff;
  --rail-width: 300px;
  --nav-width: 280px;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-weight: 300;
  height: 100vh;
  overflow: hidden;
}

.mobile-only { display: none !important; }
.desktop-only { display: flex !important; }
@media (max-width: 768px) {
  .mobile-only { display: flex !important; }
  .desktop-only { display: none !important; }
}

#background-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; }
#bg-image { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.6s ease; }
#pixel-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; mix-blend-mode: overlay; }
.overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px); }

.sidebar {
  padding: 4rem 60px 4rem 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  text-align: right;
  z-index: 100;
}
.nav-center { display: flex; flex-direction: column; gap: 0.8rem; }
.nav-link {
  color: var(--color-text);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.3s ease;
  opacity: 0.5;
  position: relative;
}
.nav-link::after {
  content: "";
  position: absolute;
  right: -25px;
  top: 50%;
  width: 4px;
  height: 4px;
  background: #99f3ff;
  opacity: 0;
  transform: translateY(-50%) rotate(45deg) scale(0);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  box-shadow: 0 0 10px rgba(153, 243, 255, 0.8);
}
.nav-link:hover, .nav-link.active {
  opacity: 1;
  color: #fff;
  transform: translateX(-5px);
}
.nav-link.active::after {
  opacity: 1;
  right: -15px;
  transform: translateY(-50%) rotate(225deg) scale(1);
  animation: pulseSquare 2s infinite alternate;
}

@keyframes pulseSquare {
  0% { box-shadow: 0 0 5px rgba(153, 243, 255, 0.5); transform: translateY(-50%) rotate(225deg) scale(1); }
  100% { box-shadow: 0 0 15px rgba(153, 243, 255, 1); transform: translateY(-50%) rotate(315deg) scale(1.2); }
}

.logo-area, .copyright { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; opacity: 0.5; }

.grid-layout {
  display: grid;
  grid-template-columns: var(--nav-width) 1fr var(--rail-width);
  height: 100vh;
  width: 100%;
  position: relative;
  z-index: 10;
  padding: 0 3vw;
}
.content-scroll { overflow-y: auto; padding: 15vh 10% 40vh 6%; scrollbar-width: none; scroll-behavior: smooth; }
.content-scroll::-webkit-scrollbar { display: none; }

.page-section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  display: none;
}
.page-section.hidden {
  display: none !important;
}
.page-section.active {
  display: block;
}
.page-section.visible {
  opacity: 1;
  transform: none;
}
.page-section.fading-out {
  opacity: 0;
  transform: translateY(-10px);
}

.switcher-rail {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.progress-container {
  position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  width: 1px; height: 140px; background: rgba(255, 255, 255, 0.1); z-index: 20;
}
.progress-bar-fill { width: 100%; height: 0%; background: #fff; }

.rail-container {
  width: 100%; height: 100vh; position: relative; perspective: 1000px;
  display: flex; align-items: center; justify-content: center;
}
.carousel-track { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.5s ease; }
.carousel-item {
  position: absolute; top: 50%; left: 60px; width: 180px; height: 135px; background: #000;
  transform: translateY(-50%); transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 4px; overflow: hidden; opacity: 0; z-index: 0; cursor: pointer;
}
.carousel-item img { width: 100%; height: 100%; object-fit: cover; opacity: 0.5; transition: opacity 0.3s; }
.carousel-item.active { opacity: 1; z-index: 10; transform: translateY(-50%) scale(1.3); border-color: #ffffff; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.carousel-item.active img { opacity: 1; }
.carousel-item.prev { opacity: 0.8; z-index: 5; transform: translateY(-170%) scale(1.1); filter: blur(1px) brightness(0.7); }
.carousel-item.next { opacity: 0.8; z-index: 5; transform: translateY(70%) scale(1.1); filter: blur(1px) brightness(0.7); }

.lock-toggle-container {
  position: fixed; top: 4rem; right: 3vw; width: var(--rail-width); display: flex; justify-content: center; z-index: 1000;
}
.lock-button {
  width: 60px; height: 30px; background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 20px; display: flex; align-items: center; padding: 0 4px; cursor: pointer; position: relative; transition: all 0.3s ease;
}
.lock-knob {
  width: 22px; height: 22px; background: rgba(255, 255, 255, 0.4); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1); color: #000;
}
.lock-button.locked .lock-knob { transform: translateX(30px); background: #99f3ff; }
.lock-button svg { width: 12px; height: 12px; }
.lock-button .icon-locked { opacity: 0; position: absolute; }
.lock-button.locked .icon-unlocked { opacity: 0; position: absolute; }
.lock-button.locked .icon-locked { opacity: 1; position: static; }

.hero-title { font-family: var(--font-mono); font-size: 2rem; font-weight: 400; line-height: 1.1; margin-bottom: 2rem; color: var(--color-accent); letter-spacing: -0.03em; }
.intro-text { font-family: var(--font-content); font-size: 1.15rem; line-height: 1.6; color: #eee; max-width: 650px; }
.inline-link {
  color: #99f3ff;
  text-decoration: none;
  position: relative;
  cursor: pointer;
  transition: color 0.3s ease;
  background-image: linear-gradient(#99f3ff, #99f3ff);
  background-position: 0% 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: background-size 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}
.inline-link:hover {
  background-size: 100% 1px;
}
.section-title { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; margin-bottom: 3rem; color: #888; letter-spacing: 0.1em; border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding-bottom: 1rem; width: 100px; }
.item-card { position: relative; margin-bottom: 5rem; }
.item-header { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.2rem; }
.item-logo { width: 50px; height: 50px; object-fit: contain; background: rgba(255, 255, 255, 0.05); padding: 5px; border-radius: 8px; }
.item-info { flex: 1; }
.item-card .meta { font-family: var(--font-mono); font-size: 0.65rem; color: #888; margin-bottom: 0.2rem; text-transform: uppercase; letter-spacing: 0.05em; }
.item-card .item-title { font-family: var(--font-content); font-size: 1.4rem; font-weight: 300; margin-bottom: 0.2rem; color: #fff; }
.item-subtitle { font-family: var(--font-content); font-size: 1rem; color: #99f3ff; font-weight: 300; }
.item-list { list-style: none; padding-left: 40px; }
.item-list li { font-family: var(--font-content); font-size: 1rem; color: #ccc; line-height: 1.6; margin-bottom: 0.6rem; padding-left: 0.5rem; }

.social-links-fixed {
  position: fixed; bottom: 4rem; right: 3vw; width: var(--rail-width); display: flex; justify-content: center; gap: 1.5rem; z-index: 100;
}
.social-links-fixed a { color: var(--color-text); opacity: 0.8; transition: all 0.3s ease; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.social-links-fixed a:hover { opacity: 1; transform: translateY(-5px); }

.item-tags {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: auto; max-width: 350px; display: none; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.8rem; padding: 1.2rem 1.8rem;
  background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(15px); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2); opacity: 0; transition: opacity 0.3s cubic-bezier(0.23, 1, 0.32, 1); pointer-events: none; z-index: 1000;
}

.personal-content-spacer { height: 4rem; }
.personal-container { display: block; width: 100%; }
.personal-item {
  position: relative; margin-bottom: 2rem; padding: 1.5rem;
  border-radius: 12px; background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05); transition: all 0.3s ease;
}
.personal-title-mono {
  font-family: var(--font-mono); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.1em; color: #fff;
}
.personal-meta {
  font-family: var(--font-mono); font-size: 0.6rem;
  color: #666; margin-top: 0.3rem; text-transform: uppercase;
}
.personal-card-header { display: flex; justify-content: space-between; align-items: center; }
.clickable-card { cursor: pointer; }
.clickable-card:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(153, 243, 255, 0.2); }
.personal-indicator { width: 18px; height: 18px; flex-shrink: 0; color: #444; transition: all 0.3s ease; }
.personal-indicator svg { width: 100%; height: 100%; display: block; }
.clickable-card:hover .personal-indicator { color: #99f3ff; }
.clickable-card.expanded .personal-indicator { transform: rotate(45deg); color: #99f3ff; }
.personal-expand-content {
  display: none;
  margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.clickable-card.expanded .personal-expand-content {
  display: block;
}
.personal-description { font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.6; color: #aaa; }
#personal .intro-text { font-family: var(--font-mono); font-size: 0.85rem; }
#personal .section-title { font-size: 0.7rem; margin-bottom: 2rem; padding-bottom: 0.5rem; width: 80px; }

.personal-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-top: 2rem; }
.gallery-item { aspect-ratio: 1/1; overflow: hidden; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.05); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; opacity: 0.8; transition: all 0.4s ease; }
.gallery-item:hover img { opacity: 1; transform: scale(1.05); }

.item-tags.has-image { width: 320px; flex-direction: row; flex-wrap: nowrap; gap: 1.2rem; padding: 1.2rem; }
.hover-card-img { width: 80px; height: 80px; object-fit: contain; border-radius: 6px; background: rgba(255, 255, 255, 0.03); padding: 5px; flex-shrink: 0; }
.hover-card-divider { width: 1px; height: 60px; background: rgba(255, 255, 255, 0.1); flex-shrink: 0; }
.skill-tag { font-family: var(--font-body); font-size: 0.75rem; font-weight: 400; color: #fff; display: flex; align-items: center; position: relative; white-space: nowrap; }
.item-tags.has-image .skill-tag { display: block; margin: 0.2rem 0; }
.item-tags:not(.has-image) .skill-tag:not(:last-child)::after { content: ""; width: 3px; height: 3px; background: rgba(255, 255, 255, 0.3); border-radius: 50%; margin-left: 0.8rem; display: inline-block; }
.item-tags-inner { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.item-tags:not(.has-image) .item-tags-inner { display: contents; }

#personal { overflow: visible !important; }
.group-header { display: block !important; font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; color: #666; margin: 4rem 0 2rem 0; letter-spacing: 0.15em; border-bottom: 1px solid rgba(255, 255, 255, 0.05); padding-bottom: 0.4rem; }

/* ── Awards layout ─────────────────────────────── */
#awards .section-title { display: none; }
.aw-layout { padding-top: 12vh; }
.aw-cat-label { font-family: var(--font-mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.2em; color: #999; margin-bottom: 1.5rem; }
.aw-logos { display: flex; gap: 1.2rem; margin-bottom: 2.5rem; }
.aw-logo-btn { width: 82px; height: 82px; border-radius: 6px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s cubic-bezier(.23,1,.32,1); position: relative; }
.aw-logo-btn img { width: 58px; height: 58px; object-fit: contain; opacity: 0.45; transition: opacity 0.3s ease; }
.aw-logo-btn:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.12); transform: translateY(-3px); }
.aw-logo-btn:hover img { opacity: 0.9; }
.aw-logo-btn.active { border-color: rgba(153,243,255,0.3); background: rgba(153,243,255,0.04); }
.aw-logo-btn.active img { opacity: 1; }
.aw-detail-area { min-height: 100px; position: relative; }
.aw-detail { opacity: 0; position: absolute; top: 0; left: 0; right: 0; pointer-events: none; transition: opacity 0.3s cubic-bezier(.2,.8,.2,1); }
.aw-detail.visible { opacity: 1; pointer-events: auto; position: relative; }
.aw-detail-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1.2rem; padding-bottom: 0.8rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
.aw-detail-org { font-family: var(--font-mono); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: #99f3ff; }
.aw-detail-date { font-family: var(--font-mono); font-size: 0.65rem; color: #999; text-transform: uppercase; text-align: right; }
.aw-detail-award { padding: 1.2rem 0; }
.aw-detail-award + .aw-detail-award { border-top: 1px solid rgba(255,255,255,0.04); }
.aw-detail-title { font-family: var(--font-body); font-size: 1.15rem; font-weight: 300; color: #fff; margin-bottom: 0.7rem; }
.aw-detail-note { font-family: var(--font-body); font-size: 1rem; font-weight: 300; color: #ccc; line-height: 1.6; max-width: 500px; }
.aw-detail-shared-note { font-family: var(--font-body); font-size: 0.95rem; font-weight: 300; color: #999; line-height: 1.5; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.04); }
.aw-detail-empty { font-family: var(--font-mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.15em; color: #999; padding-top: 0.5rem; }
.aw-sep { height: 1px; background: rgba(255,255,255,0.04); margin: 3rem 0 2rem; }


/* ── Projects split-pane layout ───────────────── */
#projects.active { display: grid; grid-template-columns: 55% 45%; height: 100vh; overflow: hidden; margin: -15vh -10% 0 -6%; width: calc(100% + 16%); }
#projects .section-title { display: none; }
.proj-detail { position: relative; overflow: hidden; display: flex; flex-direction: column; }
.proj-detail .detail-empty { position: absolute; top: 50%; left: 6%; transform: translateY(-50%); font-family: var(--font-mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.2em; color: #999; transition: opacity 0.3s ease; }
.proj-detail.active .detail-empty { opacity: 0; pointer-events: none; }
.proj-d { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.35s cubic-bezier(.2,.8,.2,1); }
.proj-d.visible { opacity: 1; pointer-events: auto; }
.proj-d-text { padding: 0 8% 0 6%; }
.proj-d-award { font-family: var(--font-mono); font-size: 0.55rem; text-transform: uppercase; letter-spacing: 0.18em; color: #99f3ff; margin-bottom: 0.7rem; text-decoration: none; display: block; transition: opacity 0.3s ease; }
a.proj-d-award:hover { opacity: 0.7; }
.proj-d-title { font-family: var(--font-body); font-size: 1.4rem; font-weight: 300; color: #fff; line-height: 1.15; margin-bottom: 0.5rem; }
.proj-d-date { font-family: var(--font-mono); font-size: 0.65rem; color: #999; letter-spacing: 0.06em; margin-bottom: 1.2rem; text-transform: uppercase; }
.proj-d-desc { font-family: var(--font-body); font-size: 1rem; font-weight: 300; color: #ccc; line-height: 1.6; max-width: 480px; margin-bottom: 1.2rem; }
.proj-d-links { display: flex; gap: 1.8rem; }
.proj-d-link { font-family: var(--font-mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em; color: #888; text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem; transition: color 0.3s ease; position: relative; padding-bottom: 2px; }
.proj-d-link::after { content: ""; position: absolute; bottom: 0; left: 0; width: 0; height: 1px; background: #99f3ff; transition: width 0.3s cubic-bezier(.2,.8,.2,1); }
.proj-d-link:hover { color: #99f3ff; }
.proj-d-link:hover::after { width: 100%; }
.proj-d-link svg { width: 13px; height: 13px; }

.proj-rail { overflow-y: auto; scrollbar-width: none; border-left: 1px solid rgba(255,255,255,0.07); display: flex; flex-direction: column; justify-content: center; padding: 8vh 0; }
.proj-rail::-webkit-scrollbar { display: none; }
.proj-name { display: flex; align-items: center; padding: 1.6rem 8%; cursor: pointer; position: relative; transition: all 0.3s cubic-bezier(.2,.8,.2,1); }
.proj-name::before { content: ""; position: absolute; left: 0; top: 0; width: 2px; height: 100%; background: #99f3ff; transform: scaleY(0); transition: transform 0.3s cubic-bezier(.2,.8,.2,1); transform-origin: center; }
.proj-name:hover::before, .proj-name.active::before { transform: scaleY(1); }
.proj-name-text { font-family: var(--font-body); font-size: 1.4rem; font-weight: 200; color: #fff; opacity: 0.55; transition: all 0.35s cubic-bezier(.2,.8,.2,1); letter-spacing: -0.01em; flex: 1; }
.proj-name:hover .proj-name-text, .proj-name.active .proj-name-text { opacity: 1; transform: translateX(0.6rem); }
.proj-name.active .proj-name-text { color: #99f3ff; }
.proj-rail:hover .proj-name:not(:hover):not(.active) .proj-name-text { opacity: 0.2; }
.proj-name + .proj-name { border-top: none; }
.proj-name.highlighted .proj-name-text { opacity: 0.7; }
.proj-name.highlighted .proj-name-text::after { content: ""; display: inline-block; width: 5px; height: 5px; background: #99f3ff; border-radius: 50%; margin-left: 0.7rem; vertical-align: middle; box-shadow: 0 0 6px rgba(153,243,255,0.5); }
.proj-m-detail { display: none; }

/* hover image */
.proj-hover-img { position: fixed; width: 220px; height: 150px; pointer-events: none; z-index: 9999; opacity: 0; overflow: hidden; border-radius: 4px; border: 1px solid rgba(255,255,255,0.08); transition: opacity 0.2s ease; will-change: transform; }
.proj-hover-img.visible { opacity: 1; }
.proj-hover-img img { width: 100%; height: 100%; object-fit: cover; }
.proj-hover-img.contain-mode img { object-fit: contain; padding: 1.5rem; background: rgba(255,255,255,0.03); }

/* tech modal */
.tech-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; visibility: hidden; opacity: 0; transition: opacity 0.3s ease, visibility 0.3s ease; }
.tech-modal.active { visibility: visible; opacity: 1; }
.tech-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(6px); }
.tech-panel { position: relative; width: 90%; max-width: 560px; max-height: 75vh; overflow-y: auto; background: rgba(255,255,255,0.03); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 2.5rem 2.5rem 2rem; scrollbar-width: none; }
.tech-panel::-webkit-scrollbar { display: none; }
.tech-panel-title { font-family: var(--font-mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.15em; color: #99f3ff; margin-bottom: 0.6rem; }
.tech-panel-name { font-family: var(--font-body); font-size: 1.2rem; font-weight: 200; color: #fff; margin-bottom: 1.5rem; }
.tech-panel-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.tech-tag { font-family: var(--font-mono); font-size: 0.55rem; letter-spacing: 0.04em; color: #ddd; padding: 0.3rem 0.7rem; border: 1px solid rgba(255,255,255,0.1); border-radius: 3px; }
.tech-panel-list { list-style: none; padding: 0; }
.tech-panel-list li { font-family: var(--font-body); font-size: 0.85rem; font-weight: 300; color: #ccc; line-height: 1.6; padding: 0.6rem 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.tech-panel-list li:last-child { border-bottom: none; }
.tech-panel-list b { color: #fff; font-weight: 500; }
.tech-close { position: absolute; top: 1.2rem; right: 1.2rem; background: none; border: none; color: #666; font-size: 1.4rem; cursor: pointer; transition: color 0.3s ease; line-height: 1; }
.tech-close:hover { color: #fff; }

/* ── Coursework layout ────────────────────────── */
.cw-group { display: grid; grid-template-columns: 90px 1fr; margin-bottom: 0; position: relative; }
.cw-label { position: sticky; top: 15vh; align-self: start; padding-top: 1.6rem; font-family: var(--font-mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.12em; color: #fff; opacity: 0.35; line-height: 1.4; }
.cw-list { border-left: 1px solid rgba(255,255,255,0.06); }
.cw-row { display: grid; grid-template-columns: 110px 1fr; align-items: baseline; padding: 1.4rem 0 1.4rem 1.8rem; border-bottom: 1px solid rgba(255,255,255,0.03); position: relative; transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1); cursor: pointer; }
.cw-row::before { content: ""; position: absolute; left: -1px; top: 0; width: 1px; height: 100%; background: #99f3ff; opacity: 0; transition: opacity 0.3s ease; }
.cw-row:hover { background: rgba(255,255,255,0.02); padding-left: 2.2rem; }
.cw-row:hover::before { opacity: 1; }
.cw-code { font-family: var(--font-mono); font-size: 0.75rem; color: #99f3ff; letter-spacing: 0.04em; white-space: nowrap; }
.cw-name { font-family: var(--font-body); font-size: 1.05rem; font-weight: 300; color: #ddd; line-height: 1.3; transition: color 0.3s ease; }
.cw-row:hover .cw-name { color: #fff; }
.cw-desc { grid-column: 1 / -1; max-height: 0; overflow: hidden; opacity: 0; margin-top: 0; transition: max-height 0.4s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.3s ease, margin 0.3s ease; }
.cw-row.expanded .cw-desc { max-height: 200px; opacity: 1; margin-top: 1rem; }
.cw-desc p { font-family: var(--font-body); font-size: 0.85rem; font-weight: 300; line-height: 1.6; color: #ccc; padding-left: 110px; padding-right: 1rem; }
.cw-row.expanded { background: rgba(255,255,255,0.02); padding-bottom: 1.6rem; }
.cw-expand { position: absolute; right: 1rem; top: 1.4rem; width: 14px; height: 14px; color: #333; transition: all 0.3s ease; }
.cw-expand svg { width: 100%; height: 100%; display: block; }
.cw-row:hover .cw-expand { color: #666; }
.cw-row.expanded .cw-expand { color: #99f3ff; transform: rotate(45deg); }
.cw-gap { height: 3rem; }

@media (max-width: 768px) {
  body { overflow-y: auto; overflow-x: hidden; }
  .grid-layout { display: flex; flex-direction: column; height: auto; min-height: 100vh; padding: 0; overflow-x: hidden; }

  .mobile-header {
    display: flex; justify-content: space-between; align-items: center; padding: 0.8rem 1.2rem;
    position: fixed; top: 1rem; left: 5%; width: 90%; z-index: 2000;
    background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px;
  }
  .mobile-header .logo { font-family: var(--font-mono); font-size: 0.8rem; color: #fff; text-transform: uppercase; }
  #menu-toggle { background: rgba(255, 255, 255, 0.1); border: none; color: #fff; font-family: var(--font-mono); font-size: 0.65rem; padding: 0.4rem 0.8rem; border-radius: 8px; }

  .sidebar {
    position: fixed; top: 5.5rem; left: 5%; width: 90%; height: auto; max-height: 60vh;
    background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px;
    padding: 2rem 1rem; display: flex; flex-direction: column; align-items: center; text-align: center;
    z-index: 1500; opacity: 0; pointer-events: none; transform: translateY(-20px); transition: all 0.4s ease;
  }
  .sidebar.open { opacity: 1 !important; pointer-events: all !important; transform: translateY(0) !important; }
  .nav-center { width: 100%; gap: 1rem; display: flex; flex-direction: column; align-items: center; }
  .nav-link { font-size: 1rem; opacity: 0.6; position: relative; transition: all 0.3s ease; transform: none !important; }
  .nav-link.active { opacity: 1; color: #fff; }
  .nav-link::after { right: -12px !important; }
  .nav-link.active::after { right: -8px !important; }

  .content-scroll { padding: 6rem 1.5rem 12rem; height: auto; overflow-x: hidden; }


  .switcher-rail {
    position: fixed; bottom: 4rem; left: 5%; width: 90%; height: 60px; z-index: 2000;
    background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px;
    display: flex; align-items: center; padding: 0;
  }
  .rail-container { width: 100%; height: 100%; display: flex; flex-direction: row; align-items: center; position: relative; overflow: hidden; border-radius: 16px; }

  .mobile-progress-container {
    position: absolute; top: -10px; left: 0; width: 100%; height: 2px;
    background: rgba(255, 255, 255, 0.1); transform: none; z-index: 2100;
  }
  .mobile-progress-container .progress-bar-fill { background: #fff; height: 100%; }

  .carousel-track {
    display: flex; flex-direction: row; align-items: center; gap: 0.8rem; height: 100%;
    padding: 0 50%; transform: none; transition: transform 0.5s ease; top: auto; left: auto;
  }
  .carousel-item {
    position: relative; top: auto !important; left: auto !important; width: 34px !important; height: 34px !important; transform: none !important;
    opacity: 0.3; display: block !important; flex-shrink: 0;
  }
  .carousel-item img { opacity: 1; }
  .carousel-item.active { opacity: 1; border: 1.5px solid #fff; width: 40px !important; height: 40px !important; }

  .mobile-lock-area {
    display: flex; align-items: center; height: 100%; padding: 0 0.6rem;
    background: rgba(255, 255, 255, 0.03); border-left: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0; z-index: 5;
  }
  .mobile-lock-area .lock-button { background: transparent; border: none; padding: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; box-shadow: none; }
  .lock-knob { width: 20px; height: 20px; color: #fff; background: transparent; }
  .lock-button.locked .lock-knob { transform: none; background: transparent; }

  .social-links-fixed {
    position: fixed; bottom: 1.2rem; left: 0; right: auto; width: 100%;
    display: flex !important; justify-content: center; gap: 1.2rem; z-index: 2001; align-items: center;
  }
  .social-links-fixed a { width: 24px; height: 24px; }
  .social-links-fixed svg { width: 24px; height: 24px; display: block; stroke: #e0e0e0; }

  .copyright-mobile { display: block; font-family: var(--font-mono); font-size: 0.65rem; color: #fff; opacity: 0.4; }

  .item-tags.has-image, .item-tags:not(.has-image) {
    width: 260px; background: rgba(10, 11, 13, 0.9); position: absolute; top: 0; left: 50%; transform: translate(-50%, -105%); pointer-events: none;
  }

  .cw-group { grid-template-columns: 1fr; }
  .cw-label { position: static; padding-top: 0; margin-bottom: 1rem; font-size: 0.55rem; }
  .cw-row { grid-template-columns: 90px 1fr; padding: 1.2rem 0 1.2rem 1.2rem; }
  .cw-desc p { padding-left: 90px; }
  .cw-expand { right: 0.5rem; }

  /* ── Projects mobile: vertical list, no split pane ── */
  #projects.active {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    margin: 0 !important;
    width: 100% !important;
  }
  .proj-detail { display: none !important; }
  .proj-hover-img { display: none !important; }
  .proj-rail {
    border-left: none !important;
    padding: 0 !important;
    display: block !important;
    height: auto !important;
  }
  .proj-name {
    padding: 1.2rem 0 !important;
    margin-bottom: 0;
    flex-direction: column;
    align-items: flex-start !important;
    cursor: pointer;
  }
  .proj-name::before { display: none !important; }
  .proj-name-text {
    font-size: 1.1rem !important;
    opacity: 1 !important;
    transform: none !important;
    color: #fff !important;
    display: flex !important;
    align-items: center;
    width: 100%;
    gap: 0.6rem;
  }
  .proj-name-text::after { display: none !important; }
  /* dot on right for highlighted */
  .proj-name.highlighted .proj-name-text::before {
    content: "";
    display: inline-block;
    width: 5px; height: 5px;
    background: #99f3ff;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(153,243,255,0.5);
    flex-shrink: 0;
    order: 99;
    margin-left: 0.6rem;
  }
  /* "tap to expand" hint — small + icon on right */
  .proj-name::after {
    content: "+";
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: #555;
    position: absolute;
    right: 0;
    top: 1.3rem;
    transition: all 0.3s ease;
    line-height: 1;
  }
  .proj-name.m-open::after {
    content: "−";
    color: #99f3ff;
  }
  .proj-name.m-open .proj-name-text { color: #99f3ff !important; }
  .proj-rail:hover .proj-name:not(:hover):not(.active) .proj-name-text { opacity: 1 !important; }

  /* mobile: inline detail */
  .proj-m-detail {
    display: block;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(.23,1,.32,1), opacity 0.3s ease;
    opacity: 0;
    width: 100%;
  }
  .proj-name.m-open .proj-m-detail {
    max-height: 600px;
    opacity: 1;
  }
  .proj-m-detail-inner {
    padding: 0.8rem 0 0.5rem 1rem;
    border-left: 2px solid rgba(153,243,255,0.2);
    margin-top: 0.8rem;
  }
  .proj-m-award {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #99f3ff;
    margin-bottom: 0.5rem;
  }
  .proj-m-date {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 0.8rem;
  }
  .proj-m-desc {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 300;
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 1.2rem;
  }
  .proj-m-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
  }
  .proj-m-link {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #99f3ff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
  }
  .proj-m-link svg { width: 14px; height: 14px; }

  /* ── Awards mobile ── */
  .aw-layout { padding-top: 0 !important; }
  .aw-logos { flex-wrap: wrap; gap: 0.8rem; }
  .aw-logo-btn { width: 60px !important; height: 60px !important; }
  .aw-logo-btn img { width: 40px !important; height: 40px !important; }
}

/* Project hints */
.project-hints {
  display: flex; gap: 1.5rem; align-items: center;
  margin-top: 1.2rem; margin-left: 40px;
}
.project-hint {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: #666; cursor: pointer; transition: color 0.3s ease;
}
.project-hint svg { width: 14px; height: 14px; flex-shrink: 0; }
.project-hint:hover { color: #99f3ff; }

/* Writeup modal */
.writeup-modal {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  visibility: hidden; opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1), visibility 0.4s;
}
.writeup-modal.active { visibility: visible; opacity: 1; }

.writeup-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px);
}

.writeup-panel {
  position: relative; width: 90%; max-width: 680px; max-height: 85vh;
  display: flex; flex-direction: column;
  background: rgba(255, 255, 255, 0.03); backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 16px;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}
.writeup-modal.active .writeup-panel { transform: scale(1) translateY(0); }

.writeup-close {
  position: absolute; top: 1.5rem; right: 1.5rem;
  background: none; border: none; color: #fff; font-size: 1.5rem;
  cursor: pointer; opacity: 0.5; transition: opacity 0.3s;
  z-index: 2; line-height: 1;
}
.writeup-close:hover { opacity: 1; }

.writeup-scroll {
  padding: 3rem; overflow-y: auto; scrollbar-width: none;
}
.writeup-scroll::-webkit-scrollbar { display: none; }

.writeup-title {
  font-family: var(--font-mono); font-size: 0.85rem; font-weight: 400;
  color: #fff; line-height: 1.5; text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 2rem; padding-bottom: 1rem; padding-right: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.writeup-scroll p {
  font-family: var(--font-content); font-size: 1rem;
  line-height: 1.75; color: #ccc; margin-bottom: 1.5rem;
}
.writeup-scroll p:last-child { margin-bottom: 0; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  visibility: hidden; opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1), visibility 0.4s;
}
.lightbox.active { visibility: visible; opacity: 1; }

.lightbox-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px);
}

.lightbox-content {
  position: relative; max-width: 85vw; max-height: 85vh;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}
.lightbox.active .lightbox-content { transform: scale(1) translateY(0); }

.lightbox-img {
  display: block; max-width: 85vw; max-height: 85vh;
  object-fit: contain; border-radius: 8px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute; top: -40px; right: -10px;
  background: none; border: none; color: #fff; font-size: 2rem;
  cursor: pointer; opacity: 0.7; transition: opacity 0.3s;
  line-height: 1; padding: 0.25rem 0.5rem;
}
.lightbox-close:hover { opacity: 1; }

@media (max-width: 768px) {
  .lightbox-content { max-width: 95vw; max-height: 80vh; }
  .lightbox-img { max-width: 95vw; max-height: 80vh; }
  .lightbox-close { top: -36px; right: 0; font-size: 1.75rem; }
}