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

/* ── VARIABLES ── */
:root {
  --bg: #F9F9F9;
  --ink: #2D2D2D;
  --muted: #555555;
  --border: rgba(28,27,24,0.1);
  --ease: cubic-bezier(0.76, 0, 0.24, 1);
  --p-bg: #F9F9F9;
  --p-ink: #2D2D2D;
  --p-accent: #00FF41;
  --p-muted: rgba(237,233,226,0.35);
  --font-body: 'Inter', 'PingFang SC', 'Noto Sans SC', sans-serif;
  font-size: 14px;
  --fs-index: 14px;
  --fs-title: 14px;
  --fs-meta: 14px;
  --ui-label-sz: 14px;
  --timeline-venue-sz: 12px;
  --work-desc-sz: 12px;
  --work-title-sz: 14px;
  --work-tab-sz: 12px;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
}

/* ── CUSTOM CURSOR (desktop only) ── */
@media (hover: hover) {
  body { cursor: none; }
  #cursor {
    position: fixed;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--ink);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.25s, height 0.25s, background 0.25s, opacity 0.25s;
    mix-blend-mode: multiply;
  }
  #cursor.big { width: 44px; height: 44px; background: rgba(28,27,24,0.1); }
  #cursor.hidden { opacity: 0; }
}

/* ══════════════════════════════════════
   DESKTOP LAYOUT (≥ 768px landscape)
══════════════════════════════════════ */
@media (min-width: 768px) and (orientation: landscape) {

  .shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    height: 100vh;
    overflow: hidden;
  }

  /* Sidebar */
  .sidebar {
    display: flex;
    flex-direction: column;
    padding: 2.5rem 2rem;
    border-right: 1px solid var(--border);
    background: var(--bg);
    transition: background 0.9s var(--ease);
    overflow: hidden;
    z-index: 10;
    position: relative;
  }

  .sidebar-name {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
    color: var(--ink);
    margin-bottom: 2rem;
    display: block;
  }

  .project-list {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
  }
  .project-list::-webkit-scrollbar { display: none; }

  .pl-item {
    padding: 0.9rem 0;
    padding-left: 10px;
    border-top: 1px solid var(--border);
    cursor: pointer;
    position: relative;
    user-select: none;
  }
  .pl-item:last-child { border-bottom: 1px solid var(--border); }

  .pl-accent {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    opacity: 0;
    transition: opacity 0.4s;
  }
  .pl-item.active .pl-accent {
    opacity: 1;
  }

  .pl-index {
    font-family: 'DM Mono', monospace;
    font-size: var(--fs-index);
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 0.25rem;
    transition: color 0.3s;
  }
  .pl-item.active .pl-index { color: var(--p-accent); }

  .pl-title {
    font-size: var(--fs-title);
    line-height: 1.25;
    color: var(--muted);
    font-style: normal;
    transition: color 0.4s var(--ease);
  }
  .pl-title em { font-style: normal; }
  .pl-item.active .pl-title { color: var(--ink); }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 2rem;
    flex-shrink: 0;
  }
  .sidebar-nav a {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.1em;
    color: var(--muted);
    text-decoration: none;
    text-transform: lowercase;
    transition: color 0.2s;
  }
  .sidebar-nav a:hover { color: var(--ink); }

  .sidebar-arrow {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 28px; flex-shrink: 0;
    background: none; border: none; cursor: pointer;
    color: var(--muted); font-size: 0.75rem;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s, color 0.2s;
    letter-spacing: 0.05em;
  }
  .sidebar-arrow.visible { opacity: 1; pointer-events: auto; }
  .sidebar-arrow:hover { color: var(--ink); }

  /* mobile-only elements hidden on desktop */
  .mobile-header, .mobile-nav-wrap, .mobile-project-view { display: none; }

}

/* ══════════════════════════════════════
   MOBILE LAYOUT (< 768px or portrait)
══════════════════════════════════════ */
@media (max-width: 767px), (orientation: portrait) {

  body { overflow: hidden; }

  .shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  /* desktop-only elements hidden on mobile */
  .sidebar, .featured { display: none; }

  /* Mobile header */
  .mobile-header {
    flex-shrink: 0;
    padding: 1.2rem 1.4rem 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    z-index: 10;
  }

  .mobile-name {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    color: var(--ink);
  }

  .mobile-nav-links {
    display: flex;
    gap: 1.2rem;
    align-items: center;
  }
  .mobile-nav-links a {
    font-family: 'DM Mono', monospace;
    font-size: var(--ui-label-sz);
    letter-spacing: 0.1em;
    color: var(--muted);
    text-decoration: none;
    text-transform: lowercase;
  }

  /* Swipeable project nav with arrows */
  .mobile-nav-wrap {
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
  }

  .mob-nav-arrow {
    flex-shrink: 0;
    width: 32px; height: 100%;
    min-height: 48px;
    background: none; border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--muted); font-size: 1rem;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s, color 0.2s;
    z-index: 2;
  }
  .mob-nav-arrow.show { opacity: 1; pointer-events: auto; }
  .mob-nav-arrow:hover { color: var(--ink); }

  .mob-nav-scroll {
    flex: 1;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .mob-nav-scroll::-webkit-scrollbar { display: none; }

  .mobile-nav-track {
    display: flex;
    padding: 0 0.6rem;
    min-width: max-content;
  }

  .mobile-nav-item {
    flex-shrink: 0;
    padding: 0.7rem 1rem 0.7rem 0;
    margin-right: 1.4rem;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
  }

  .mobile-nav-item::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 1rem;
    height: 1.5px;
    background: var(--p-accent);
    opacity: 0;
    transition: opacity 0.3s;
  }
  .mobile-nav-item.active::after { opacity: 1; }

  .mobile-nav-index {
    font-family: 'DM Mono', monospace;
    font-size: var(--fs-index);
    letter-spacing: 0.1em;
    color: var(--muted);
    display: block;
    margin-bottom: 0.15rem;
  }

  .mobile-nav-title {
    font-size: var(--fs-title);
    line-height: 1.2;
    color: var(--muted);
    font-style: normal;
    transition: color 0.3s;
  }
  .mobile-nav-title em { font-style: normal; }
  .mobile-nav-item.active .mobile-nav-title { color: var(--ink); }
  .mobile-nav-item.active .mobile-nav-index { color: var(--p-accent); }

  /* Mobile project view */
  .mobile-project-view {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: var(--p-bg);
    transition: background 0.7s var(--ease);
    display: flex;
    flex-direction: column;
  }

  .mobile-images {
    width: 100%;
    flex-shrink: 0;
  }

  .mobile-carousel {
    width: 100%;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--p-bg);
    transition: background 0.7s var(--ease);
    height: 85vw;
    display: flex;
    align-items: center;
  }

  .mobile-carousel-track {
    display: flex;
    width: 100%;
    align-self: stretch;
  }

  .mobile-carousel-arrow {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    background: rgba(28,27,24,0.45);
    border: none; color: rgba(255,255,255,0.9);
    width: 36px; height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.4rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    z-index: 3;
    transition: opacity 0.2s;
  }
  .mobile-carousel-arrow.hidden { opacity: 0; pointer-events: none; }
  .mobile-carousel-arrow-l { left: 0.6rem; }
  .mobile-carousel-arrow-r { right: 0.6rem; }

  .mobile-carousel-counter {
    position: absolute;
    bottom: 0.5rem; right: 0.75rem;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.6);
    z-index: 3;
  }

  .mobile-img-wrap {
    width: 100%;
    flex-shrink: 0;
    background: var(--p-bg);
    transition: background 0.7s var(--ease);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-img-wrap img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 85vw;
    object-fit: contain;
    object-position: center;
    opacity: 0;
    transition: opacity 0.6s ease;
  }

  .mobile-img-wrap img.portrait {
    max-height: 85vw;
    width: auto;
    max-width: 100%;
  }
  .mobile-img-wrap img.loaded { opacity: 1; }

  .mobile-info {
    padding: 2rem 1.4rem 3rem;
    background: var(--bg);
    flex-shrink: 0;
    border-top: 1px solid var(--border);
  }

  .mobile-feat-year {
    font-family: 'DM Mono', monospace;
    font-size: var(--fs-index);
    letter-spacing: 0.15em;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 0.8rem;
  }

  .mobile-feat-title {
    font-size: 2.2rem;
    font-weight: 400;
    line-height: 1.0;
    letter-spacing: -0.01em;
    margin-bottom: 0.4rem;
    color: var(--ink);
    font-style: normal;
  }
  .mobile-feat-title em { font-style: normal; }

  .mobile-feat-venue {
    font-family: 'DM Mono', monospace;
    font-size: var(--fs-meta);
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 1.2rem;
  }

  .mobile-feat-concept {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--ink);
    opacity: 1;
    margin-bottom: 0.8rem;
  }

  .mobile-feat-zh {
    font-style: italic;
    font-size: 0.9rem;
    color: var(--p-accent-static, #8B6B3D);
    display: block;
    margin-bottom: 1.5rem;
  }

  .mobile-feat-link {
    font-family: 'DM Mono', monospace;
    font-size: var(--ui-label-sz);
    letter-spacing: 0.12em;
    color: var(--ink);
    text-decoration: none;
    opacity: 0.45;
    transition: opacity 0.2s;
  }
  .mobile-feat-link:hover { opacity: 1; }

  .mobile-caption {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.05em;
    color: var(--muted);
    line-height: 1.9;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
  }

}

.sidebar-copyright {
  font-size: 10px;
  color: var(--muted);
  padding: 12px 16px;
  border-top: 0.5px solid var(--color-border, #e8e4dc);
}

.mob-more-caption {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.04em;
  line-height: 1.8;
  padding: 6px 5% 1.5rem;
  min-height: 1.2em;
  flex-shrink: 0;
}

.mobile-copyright {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  padding: 12px 0 16px;
}

/* WALL AURORA BUTTON */
@keyframes aurora-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
#ds-wall-btn,
#m-wall-btn {
  display: block;
  text-decoration: none;
}
#ds-wall-btn { margin-top: 14px; margin-bottom: 8px; }
.wall-aurora-btn {
  display: block;
  padding: 10px 20px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #1a1a1a;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  background: linear-gradient(120deg, #FFB3B3, #FFE899, #99DDA8, #FFE899, #FFB3B3);
  background-size: 300% 300%;
  animation: aurora-shift 9s ease infinite;
  font-family: inherit;
  width: 100%;
  text-align: center;
}
.wall-aurora-btn:hover { opacity: 0.9; }

/* ── AURORA TRANSITION OVERLAY ── */
#aurora-transition {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: linear-gradient(
    135deg,
    #FFB3B3 0%,
    #FFE899 25%,
    #99DDA8 50%,
    #b3d9ff 70%,
    #FFB3B3 85%,
    #FFE899 100%
  );
  background-size: 300% 300%;
  animation: aurora-shift 3s ease infinite;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
#aurora-transition.fade-in { opacity: 1; }