/* ════════════════════════════════════════════════════
   DESIGN TOKENS
════════════════════════════════════════════════════ */
:root {
  /* ── Color ── */
  --bg: #101116;
  --surface: #151517;
  --border: rgba(255, 255, 255, 0.06);
  --text: #ebebeb;
  --text-secondary: #8a8a8a;
  --muted: #555;
  --accent: #c8ee60;
  --accent-dim: rgba(200, 238, 96, 0.10);

  /* ── Typography ── */
  --font: 'Inter', sans-serif;
  --font-heading: 'Space Grotesk', sans-serif;
  --font-tc: 'Noto Sans TC', sans-serif;

  /* ── Fluid type scale ── */
  --text-xs: clamp(0.6rem, 0.55rem + 0.2vw, 0.72rem);
  --text-sm: clamp(0.7rem, 0.65rem + 0.25vw, 0.82rem);
  --text-base: clamp(0.8rem, 0.75rem + 0.25vw, 0.92rem);
  --text-lg: clamp(1rem, 0.9rem + 0.5vw, 1.2rem);
  --text-xl: clamp(1.6rem, 1.2rem + 2vw, 2.6rem);
  --text-hero: clamp(3.2rem, 2rem + 8vw, 9rem);

  /* ── Spacing ── */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 8rem;

  /* ── Layout ── */
  --nav-h: 48px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* ════════════════════════════════════════════════════
   CUSTOM CURSOR (desktop only)
════════════════════════════════════════════════════ */
@media (pointer: fine) {
  * {
    cursor: none !important;
  }

  body.hide-custom-cursor,
  body.hide-custom-cursor * {
    cursor: auto !important;
  }

  .cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 5px;
    height: 5px;
    background: var(--text);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: background 0.2s, width 0.2s, height 0.2s;
    will-change: transform;
  }

  .cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    transition: width 0.25s var(--ease), height 0.25s var(--ease), border-color 0.2s, background 0.2s;
    will-change: transform;
  }

  /* Hover state — ring expands + goes accent */
  .cursor-ring.hovering {
    width: 44px;
    height: 44px;
    border-color: var(--accent);
    background: rgba(200, 238, 96, 0.06);
  }

  /* On clickable: dot goes accent */
  .cursor-dot.hovering {
    background: var(--accent);
    width: 4px;
    height: 4px;
  }
}


html {
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-gutter: stable;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: hidden;
}

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

img {
  display: block;
  max-width: 100%;
}

ul {
  list-style: none;
}

button {
  font-family: var(--font);
  cursor: pointer;
}

/* ════════════════════════════════════════════════════
   NAV BAR
════════════════════════════════════════════════════ */
.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6%;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: height 0.4s var(--ease), background 0.4s, border-color 0.4s, backdrop-filter 0.3s;
}

@media (min-width: 800px) {
  .bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    padding: 0 8%;
    background: var(--bg);
    backdrop-filter: none;
  }

  .bar.scrolled {
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    height: 52px;
    border-bottom-color: rgba(200, 238, 96, 0.06);
  }
}

.title {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
  transition: color 0.3s;
}

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

/* Desktop menu */
.menu {
  display: none;
}

@media (min-width: 800px) {
  .menu {
    display: flex;
    gap: 2.8rem;
    font-size: var(--text-xs);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: 500;
  }
}

.menu_link {
  color: var(--text-secondary);
  transition: color 0.25s;
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  font-weight: inherit;
}

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

.menu_link.active {
  color: var(--accent);
}

/* Hamburger icon */
.menu_icon {
  display: flex;
  background: none;
  border: none;
  padding: 4px;
  width: 30px;
}

.menu_icon svg {
  width: 100%;
  display: block;
}

@media (min-width: 800px) {
  .menu_icon {
    display: none;
  }
}

/* ════════════════════════════════════════════════════
   MOBILE OVERLAY MENU
════════════════════════════════════════════════════ */
.menu_mobile {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  clip-path: circle(0% at calc(100% - 10%) 30px);
  transition: clip-path 0.5s var(--ease);
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.menu_mobile.open {
  clip-path: circle(150% at calc(100% - 10%) 30px);
  pointer-events: all;
}

.menu_mobile_inner {
  flex: 1;
  padding: 80px 8% 0;
}

.menu_mobile_copy {
  padding: 1.2rem 8%;
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  color: var(--muted);
  text-align: center;
}

.menu_close {
  position: absolute;
  top: 16px;
  right: 6%;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  line-height: 1;
  transition: color 0.2s;
}

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

.menu_mobile_list li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-base);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.menu_mobile_list button {
  color: var(--text-secondary);
  background: none;
  border: none;
  transition: color 0.25s;
  letter-spacing: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-transform: inherit;
}

.menu_mobile_list button:hover,
.menu_mobile_list button.active {
  color: var(--text);
}

.menu_mobile_social {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 3rem;
}

.menu_mobile_social a {
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.25s;
}

.menu_mobile_social a:hover {
  color: var(--text);
}

/* ════════════════════════════════════════════════════
   SPA VIEWS
════════════════════════════════════════════════════ */
.view {
  display: none;
  opacity: 0;
  transform: translateY(12px);
}

.view.active {
  display: block;
  animation: viewIn 0.5s var(--ease) forwards;
}

.view.exiting {
  display: block;
  pointer-events: none;
  animation: viewOut 0.3s var(--ease) forwards;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes viewOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ════════════════════════════════════════════════════
   VIEW: HOME — Hero
════════════════════════════════════════════════════ */
#view-home {
  height: 100vh;
  height: 100dvh;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--nav-h) 6% 6vh;
  position: relative;
  overflow: hidden;
}

@media (min-width: 800px) {
  #view-home {
    height: calc(100dvh - 60px);
    padding: 0 8% 10vh;
  }
}

#view-home.active {
  display: flex;
  animation: viewIn 0.6s var(--ease) forwards;
}

#view-home::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 45% at 72% 18%, rgba(200, 238, 96, 0.06) 0%, transparent 65%),
    radial-gradient(ellipse 30% 25% at 15% 80%, rgba(200, 238, 96, 0.025) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  transform: translate(-20px, 20px);
}

.hero-copy {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--text-xs);
  color: var(--muted);
  letter-spacing: 0.1em;
  z-index: 1;
}

.hero-name {
  font-family: var(--font-heading);
  font-size: var(--text-hero);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.92;
  color: var(--text);
  margin-bottom: 1.6rem;
  overflow: hidden;
  text-transform: uppercase;
}

.hero-name span {
  display: block;
  opacity: 0;
  transform: translateY(60px) scale(1.04);
  filter: blur(6px);
}

#view-home.entered .hero-name span:nth-child(1) {
  animation: heroReveal 0.9s var(--ease) 0.05s forwards;
}

#view-home.entered .hero-name span:nth-child(2) {
  animation: heroReveal 0.9s var(--ease) 0.18s forwards;
}

#view-home.entered .hero-sub {
  animation: subtleFadeUp 0.7s var(--ease) 0.45s forwards;
}

#view-home.entered .hero-social {
  animation: subtleFadeUp 0.7s var(--ease) 0.6s forwards;
}

@keyframes heroReveal {
  40% {
    filter: blur(2px);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes subtleFadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.hero-sub {
  font-size: var(--text-xs);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 3.5rem;
  opacity: 0;
  transform: translateY(14px);
  font-weight: 400;
}

.hero-social {
  display: flex;
  align-items: center;
  gap: 2.2rem;
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(14px);
}

.hero-social a {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: var(--text-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text);
  /* Match the name prominence */
  transition: color 0.25s, transform 0.25s;
  font-weight: 500;
}

.hero-social a::before {
  content: '';
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--accent);
}

.hero-social a:hover {
  color: var(--accent);
  transform: translateX(3px);
}

.hero-social a svg {
  width: 14px;
  height: 14px;
  opacity: 0.35;
  transition: opacity 0.25s;
}

.hero-social a:hover svg {
  opacity: 0.9;
}

@media (max-width: 800px) {
  #view-home {
    padding-bottom: 14vh;
  }

  .hero-content {
    transform: translate(0, 0);
  }

  .hero-social {
    gap: 1.5rem;
  }
}

/* ════════════════════════════════════════════════════
   VIEW: PROJECTS
════════════════════════════════════════════════════ */
#view-projects {
  padding: var(--nav-h) 6% 2rem;
}

@media (min-width: 800px) {
  #view-projects {
    display: none;
    padding: 60px 8% 3rem;
  }

  #view-projects.active {
    display: block;
    animation: viewIn 0.45s var(--ease) forwards;
  }
}

/* Social list (sidebar & about shared) */
.social-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.8rem;
}

.social-list a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  /* 調亮：原本為 var(--muted) */
  transition: color 0.25s;
}

.social-list a:hover {
  color: var(--text);
}

.social-list a svg {
  width: 13px;
  height: 13px;
  opacity: 0.35;
  transition: opacity 0.25s;
  flex-shrink: 0;
}

.social-list a:hover svg {
  opacity: 0.9;
}

.sidebar-copy {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  /* 調亮：原本為 #2a2a2a */
  opacity: 0.5;
  /* 半透明維持低調 */
  letter-spacing: 0.08em;
}

/* Project Filter */
.proj-filter {
  position: sticky;
  top: 48px;
  background: var(--bg);
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
  padding: 1rem 0;
  gap: 0.5rem;
}

@media (min-width: 800px) {
  .proj-filter {
    top: 60px;
  }
}

.proj-filter-btn {
  background: none;
  border: none;
  padding: 0.5rem 1.2rem 0.5rem 0;
  font-size: var(--text-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  position: relative;
  transition: color 0.25s;
  font-weight: 500;
}

.proj-filter-btn::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 1px;
  width: 0;
  background: var(--text);
  transition: width 0.3s var(--ease), background 0.25s;
}

.proj-filter-btn:hover {
  color: var(--text-secondary);
}

.proj-filter-btn:hover::after {
  width: calc(100% - 1.2rem);
  background: var(--muted);
}

.proj-filter-btn.active {
  color: var(--text);
}

.proj-filter-btn.active::after {
  width: calc(100% - 1.2rem);
  background: var(--accent);
}

/* Works grid */
.proj-main {
  padding-top: 36px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 1200px);
}

.works-grid {
  display: flex;
  flex-wrap: wrap;
  column-gap: 3%;
  row-gap: 2.5rem;
  min-height: 65vh;
  /* 防止分類切換時高度坍塌與抖動 */
  transition: min-height 0.3s;
}

.work {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 0;
  cursor: pointer;
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
  box-sizing: border-box;
  transform-origin: top center;
  /* scroll-reveal: start hidden */
  opacity: 0;
  transform: translateY(20px);
}

.work.in-view {
  opacity: 1;
  transform: translateY(0);
}

.work.fade-out {
  opacity: 0 !important;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

/* stagger per card position in masonry column */
.work:nth-child(2n+2) {
  transition-delay: 0.08s;
}

.work.hidden {
  display: none !important;
}

@media (min-width: 800px) {
  .works-grid {
    column-count: auto;
    /* 重設原本的 column 屬性 */
  }

  .work {
    width: 48.5%;
  }
}

/* Work card inner */
.work-inner {
  position: relative;
  display: block;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 8/5;
  border-radius: 3px;
  transition: box-shadow 0.45s var(--ease);
}

.work:hover .work-inner {
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.45);
}

.work-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--surface);
  transition: transform 0.65s var(--ease), filter 0.65s var(--ease);
}

.work:hover .work-thumb {
  transform: scale(1.04);
  filter: brightness(0.8) saturate(1.1);
}

/* Specific image alignments */
[data-project="e1"] .work-thumb {
  object-position: center 7px;
}

/* Dark overlay */
.work-inner::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(16, 17, 22, 0.25);
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 1;
  pointer-events: none;
}

.work:hover .work-inner::after {
  opacity: 1;
}

/* Work info overlay */
.work-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  z-index: 2;
  pointer-events: none;
  transition: transform 0.3s var(--ease);
}

.work-title {
  font-family: var(--font-heading);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.3;
  transition: color 0.3s;
}

.work:hover .work-title {
  color: var(--accent);
}

.work-meta {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.06em;
  white-space: nowrap;
  margin-left: 15px;
}

@media (max-width: 799px) {
  .work-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .work-meta {
    margin-left: 0;
  }
}

/* Project footer */
.proj-footer {
  display: flex;
  justify-content: center;
  padding: var(--space-md) 0;
  border-top: 1px solid var(--border);
}

.proj-footer .social-list {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 0;
}

.proj-footer-copy {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--muted);
  letter-spacing: 0.08em;
}

@media (max-width: 799px) {
  .proj-footer {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }
}

/* ════════════════════════════════════════════════════
   VIEW: ABOUT
════════════════════════════════════════════════════ */
#view-about {
  padding: calc(var(--nav-h) + var(--space-md)) 6% var(--space-lg);
}

@media (min-width: 800px) {
  #view-about {
    padding: calc(60px + var(--space-md)) 8% var(--space-lg);
    display: none;
  }

  #view-about.active {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 0 70px;
    align-items: start;
    animation: viewIn 0.45s var(--ease) forwards;
  }
}

/* About left column */
.about-left {
  padding-top: 8px;
}

.about-photo {
  width: 100%;
  max-width: 170px;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  color: #222;
  letter-spacing: 0.06em;
  margin-bottom: 1.8rem;
  border-bottom: 2px solid var(--accent);
  box-shadow: 0 8px 32px rgba(200, 238, 96, 0.08);
}

@media (max-width: 799px) {
  .about-photo {
    max-width: 110px;
    margin-bottom: 1.2rem;
  }

  .about-left .social-list {
    display: none;
  }

  .about-left .sidebar-copy {
    display: none;
  }
}

/* About right column */
.about-right {
  margin-top: 1.5rem;
}

@media (min-width: 800px) {
  .about-right {
    margin-top: 0;
    padding-top: 8px;
  }
}

.about-name {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.about-role {
  font-size: var(--text-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  font-weight: 400;
}

/* ── Tab (Bio / CV) ── */
.tab-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  gap: 0;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.55rem 1.3rem 0.55rem 0;
  font-size: var(--text-lg);
  font-family: var(--font-heading);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  position: relative;
  transition: color 0.25s;
  font-weight: 600;
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 1px;
  width: 0;
  background: var(--text);
  transition: width 0.3s var(--ease);
}

.tab-btn.active {
  color: var(--text);
}

.tab-btn.active::after {
  width: calc(100% - 1.3rem);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Lang switch */
.lang-switches {
  display: flex;
}

.lang-switch {
  display: none;
  gap: 1rem;
}

.lang-switch.active {
  display: flex;
}

.lang-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  /* 調亮：原本為 #333 */
  transition: color 0.25s;
  font-weight: 500;
}

.lang-btn.active {
  color: var(--text);
}

/* Bio text */
.bio-text {
  display: none;
}

.bio-text.active {
  display: block;
}

.bio-text p {
  font-size: var(--text-base);
  line-height: 2;
  color: var(--text-secondary);
  margin-bottom: 1.2em;
}

.bio-text.zh p {
  font-family: var(--font-tc);
  font-size: var(--text-sm);
}

/* CV */
.cv-content {
  display: none;
}

.cv-content.active {
  display: block;
}

.cv-section {
  margin-bottom: 2.4rem;
}

.cv-section-title {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 1.2rem;
  font-weight: 600;
}

.cv-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0 1rem;
  margin-bottom: 0.75rem;
  align-items: baseline;
}

.cv-year {
  font-size: var(--text-xs);
  color: var(--muted);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.cv-detail {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.65;
}

.cv-detail.zh {
  font-family: var(--font-tc);
  font-size: 0.76rem;
}

.cv-bold {
  color: var(--text);
  font-weight: 500;
}

/* Link style */
.text-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 1px;
  transition: color 0.25s, border-color 0.25s;
  cursor: pointer;
}

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

.cv-sub {
  color: var(--muted);
  font-size: var(--text-xs);
  opacity: 0.7;
}

.cv-edu {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.4rem;
}

.cv-edu.zh {
  font-family: var(--font-tc);
  font-size: 0.76rem;
}

/* About mobile social */
.about-mobile-social {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: var(--space-md) 0 var(--space-xs);
  border-top: 1px solid var(--border);
  margin-top: var(--space-md);
}

.about-mobile-social a {
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.25s;
}

.about-mobile-social a:hover {
  color: var(--text);
}

@media (min-width: 800px) {
  .about-mobile-social {
    display: none;
  }
}

/* ════════════════════════════════════════════════════
   VIEW: PROJECT DETAIL
════════════════════════════════════════════════════ */
#view-project-detail {
  padding: calc(var(--nav-h) + var(--space-sm)) 0 0;
  max-width: 100%;
  margin: 0 auto;
}

.p-content,
.project-header,
.project-info {
  padding-left: 6%;
  padding-right: 6%;
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
  margin-left: 6%;
  transition: color 0.25s;
  font-weight: 500;
}

.btn-back:hover {
  color: var(--text);
}

.detail-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 1rem;
}

.detail-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  margin-bottom: 1rem;
  background: var(--surface);
}

.detail-thumb[src=""],
.detail-thumb:not([src]) {
  display: none;
}

.detail-meta {
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
}

/* .detail-video is an alias for .yt-wrapper — see YouTube wrapper section below */

/* ── Project detail utility classes (replaces inline styles) ── */
.detail-info-header {
  text-align: left;
  margin-bottom: 5px;
}

.detail-info-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.detail-info-value {
  font-size: var(--text-sm);
  color: var(--text);
  margin-bottom: 4px;
}

.detail-info-value a {
  transition: color 0.25s;
}

.detail-info-value a:hover {
  color: var(--accent);
}

.detail-info-block {
  margin-bottom: 20px;
}

.detail-banner {
  display: block;
  width: 100%;
  margin-top: 5px;
  background: var(--surface);
}

.detail-video-wrap {
  margin-top: 5px;
}

.detail-text-block {
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
}

.detail-text-block p {
  font-size: var(--text-sm);
  line-height: 1.9;
  color: var(--text-secondary);
}

.detail-text-block strong {
  color: var(--text);
  font-weight: 600;
}

.detail-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
  margin-top: 5px;
}

.detail-grid-3 img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.detail-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 5px;
}

.detail-grid-2 img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.detail-grid-3.portrait img {
  aspect-ratio: 3/4;
}

.detail-grid-2.portrait img {
  aspect-ratio: 3/4;
}

.credits-section {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.credits-section h3 {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text);
}

.credits-section p {
  font-size: var(--text-sm);
  margin-bottom: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.credits-section .text-link {
  color: var(--text);
}

.detail-footer {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: var(--space-md) 0;
}

.detail-footer p {
  font-size: var(--text-xs);
  color: var(--muted);
  margin: 0;
}

.scroll-top-wrapper {
  position: absolute;
  right: 0;
}

.scroll-top {
  display: inline-flex;
  padding: 10px;
  color: var(--text-secondary);
  transition: color 0.25s;
}

.scroll-top:hover {
  color: var(--text);
}

@media (min-width: 800px) {
  #view-project-detail {
    padding: calc(60px + var(--space-sm)) 5% 0;
    max-width: 1400px;
  }

  .p-content,
  .project-header,
  .project-info {
    padding-left: 0;
    padding-right: 0;
  }

  .btn-back {
    margin-left: 0;
  }
}

.detail-gallery {
  margin-top: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.detail-gallery img {
  width: 100%;
  height: auto;
}

/* ════════════════════════════════════════════════════
   YouTube responsive wrapper  (.yt-wrapper + .detail-video)
════════════════════════════════════════════════════ */
.yt-wrapper,
.detail-video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  background: var(--surface);
}

.yt-wrapper iframe,
.detail-video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ════════════════════════════════════════════════════
   SCROLL-TRIGGERED REVEAL
════════════════════════════════════════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s var(--ease), transform 0.65s var(--ease);
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* stagger children */
.reveal-stagger>.reveal:nth-child(1) {
  transition-delay: 0s;
}

.reveal-stagger>.reveal:nth-child(2) {
  transition-delay: 0.07s;
}

.reveal-stagger>.reveal:nth-child(3) {
  transition-delay: 0.14s;
}

.reveal-stagger>.reveal:nth-child(4) {
  transition-delay: 0.21s;
}

.reveal-stagger>.reveal:nth-child(5) {
  transition-delay: 0.28s;
}

.reveal-stagger>.reveal:nth-child(6) {
  transition-delay: 0.35s;
}

.reveal-stagger>.reveal:nth-child(7) {
  transition-delay: 0.42s;
}

.reveal-stagger>.reveal:nth-child(8) {
  transition-delay: 0.49s;
}

.reveal-stagger>.reveal:nth-child(9) {
  transition-delay: 0.56s;
}

.reveal-stagger>.reveal:nth-child(10) {
  transition-delay: 0.63s;
}

.reveal-stagger>.reveal:nth-child(11) {
  transition-delay: 0.70s;
}

.reveal-stagger>.reveal:nth-child(12) {
  transition-delay: 0.77s;
}


/* ════════════════════════════════════════════════════
   VIEW: MUSIC STYLES
   ════════════════════════════════════════════════════ */
#view-music {
  display: none;
  width: 100%;
  min-height: calc(100vh - var(--nav-h));
  padding: 60px 6% var(--space-lg);
}

#view-music.active {
  display: block;
}

@media (min-width: 800px) {
  #view-music {
    min-height: calc(100vh - 60px);
    padding: 80px 8% var(--space-lg);
  }
}

.music-container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.music-header {
  margin-bottom: var(--space-lg);
  text-align: left;
}

.music-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: var(--space-xs);
}

.music-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
}

/* Music grid layout */
.music-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  width: 100%;
  margin-bottom: var(--space-lg);
}

@media (min-width: 768px) {
  .music-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 40px 30px;
  }
}

@media (min-width: 1024px) {
  .music-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 50px 40px;
  }
}

/* Music card styling */
.music-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.3s, transform 0.3s var(--ease);
  position: relative;
}

.music-card:hover {
  border-color: rgba(200, 238, 96, 0.2);
  transform: translateY(-4px);
}

/* Vinyl envelope wrapper */
.vinyl-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow: visible;
  /* To allow the vinyl to slide out */
}

/* Disc Sleeve */
.vinyl-sleeve {
  width: 82%;
  height: 82%;
  position: relative;
  z-index: 2;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  overflow: hidden;
  background: #000;
  transition: transform 0.3s var(--ease);
}

.sleeve-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.3s;
}

/* Hover overlay play button */
.music-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-size: 1.2rem;
  opacity: 0;
  transition: opacity 0.3s var(--ease), transform 0.2s var(--ease);
  z-index: 3;
}

.vinyl-sleeve:hover .music-play-btn {
  opacity: 1;
}

.music-play-btn:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: #fff;
}

.vinyl-sleeve:hover .sleeve-img {
  filter: brightness(0.4);
}

/* Play state active: button stays visible but translucent */
.music-card.playing .music-play-btn {
  opacity: 0.8;
  background: var(--accent);
}

.music-card.playing .vinyl-sleeve:hover .music-play-btn {
  opacity: 1;
}

/* Vinyl Disc */
.vinyl-disc {
  width: 80%;
  height: 80%;
  border-radius: 50%;
  position: absolute;
  top: 10%;
  left: 10%;
  z-index: 1;
  background: radial-gradient(circle,
      #18181c 0%,
      #09090b 25%,
      #1d1d23 35%,
      #09090b 45%,
      #25252b 55%,
      #09090b 65%,
      #131317 75%,
      #000 100%);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8), 0 5px 15px rgba(0, 0, 0, 0.3);
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Circular groove textures */
.vinyl-grooves {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.03);
  pointer-events: none;
}

.vinyl-grooves::before,
.vinyl-grooves::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.02);
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
}

.vinyl-grooves::after {
  top: 25px;
  left: 25px;
  right: 25px;
  bottom: 25px;
}

/* Center vinyl label */
.vinyl-label {
  width: 32%;
  height: 32%;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  position: relative;
  border: 2px solid #000;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Spindle hole */
.vinyl-label::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Sliding actions */
.vinyl-wrapper:hover .vinyl-disc {
  transform: translate(18%, 0);
}

.music-card.playing .vinyl-disc {
  transform: translate(22%, 0);
  animation: spin 4s linear infinite;
}

@keyframes spin {
  from {
    transform: translate(22%, 0) rotate(0deg);
  }

  to {
    transform: translate(22%, 0) rotate(360deg);
  }
}

/* Track info metadata */
.track-info {
  margin-bottom: 15px;
}

.track-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.track-year {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Sliding player drawer container */
.sc-player-container {
  width: 100%;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease), opacity 0.4s var(--ease), margin-top 0.4s var(--ease);
  border-radius: 8px;
}

.music-card.playing .sc-player-container {
  max-height: 125px;
  opacity: 1;
  margin-top: 10px;
}

.music-footer {
  margin-top: var(--space-lg);
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.music-footer-copy {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* ────────────────────────────────────────
   SCROLL TO TOP BUTTON
──────────────────────────────────────── */
.scroll-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(16, 17, 22, 0.85);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  cursor: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease), background 0.3s, border-color 0.3s, color 0.3s;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.scroll-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-to-top svg {
  transition: transform 0.3s var(--ease);
}

.scroll-to-top:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}

.scroll-to-top:hover svg {
  transform: translateY(-2px);
}

.scroll-to-top:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  .scroll-to-top {
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
  }
}

/* ════════════════════════════════════════════════════
   ACCESSIBILITY: REDUCED MOTION
════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}