/* ===========================================================
   Shuoning Shi — Apple-style personal site
   Black & white themes via [data-theme]
   =========================================================== */

:root {
  --maxw: 1040px;
  --ease: cubic-bezier(0.28, 0.11, 0.32, 1);
  --nav-h: 72px;
  --radius: 22px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* ---- Dark (default) ---- */
html[data-theme="dark"] {
  --bg: #000000;
  --bg-elev: #0c0c0e;
  --card: #141416;
  --fg: #f5f5f7;
  --muted: #a1a1a6;
  --line: rgba(255, 255, 255, 0.10);
  --nav-bg: rgba(10, 10, 12, 0.72);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-nav: rgba(26, 26, 30, 0.50);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-hover: rgba(255, 255, 255, 0.12);
  --glass-edge: rgba(255, 255, 255, 0.55);
  --btn-fg: #000;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ---- Light ---- */
html[data-theme="light"] {
  --bg: #ffffff;
  --bg-elev: #fbfbfd;
  --card: #f5f5f7;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.10);
  --nav-bg: rgba(251, 251, 253, 0.72);
  --glass: rgba(255, 255, 255, 0.55);
  --glass-nav: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.75);
  --glass-hover: rgba(0, 0, 0, 0.05);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --btn-fg: #fff;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.10);
}

/* ===========================================================
   Base
   =========================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}

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

section { scroll-margin-top: var(--nav-h); }

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}
.section-lead {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--muted);
  margin: 0 0 2.5rem;
}

/* ===========================================================
   Nav — Apple "liquid glass" floating pill
   =========================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  padding: 0.7rem 1rem;
  background: transparent;
  pointer-events: none; /* clicks pass through the gutter; the pill re-enables */
}
.nav__inner {
  pointer-events: auto;
  position: relative;
  width: 100%;
  max-width: var(--maxw);
  min-height: 52px;
  margin: 0 auto;
  padding: 0 0.5rem 0 1.1rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  border-radius: 980px;
  overflow: hidden;        /* clip filter to the rounded shape — kills the ghost fringe */
  isolation: isolate;
  background: var(--glass-nav);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 var(--glass-edge);
  transition: background 0.5s var(--ease), border-color 0.5s var(--ease);
}
/* glossy top sheen */
.nav__inner::after {
  content: "";
  position: absolute;
  left: 6%; right: 6%; top: 0;
  height: 50%;
  border-radius: 980px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.nav__brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.nav__logo {
  width: 22px;
  height: 33px;
  display: block;
  margin-left: -2px;
  background: #3b5bdb;
  -webkit-mask: url(logo.svg) center / contain no-repeat;
  mask: url(logo.svg) center / contain no-repeat;
}
.nav__links {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: auto;
}
.nav__links a {
  position: relative;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.42rem 0.85rem;
  border-radius: 980px;
  border: 1px solid transparent;
  transition: color 0.25s var(--ease), background 0.25s var(--ease),
              transform 0.25s var(--ease), border-color 0.25s var(--ease);
}
/* hover: a glass lozenge expands behind the link */
.nav__links a:hover {
  color: var(--fg);
  background: var(--glass-hover);
  border-color: var(--glass-border);
  transform: scale(1.06);
  box-shadow: inset 0 1px 0 var(--glass-edge);
}

/* hamburger (injected on small screens) */
.nav__toggle {
  display: none;
  position: relative;
  z-index: 1;
  width: 34px; height: 34px;
  margin-left: auto;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  background: var(--glass-hover);
  color: var(--fg);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.nav__toggle:hover { border-color: var(--fg); }
.nav__toggle span {
  display: block;
  width: 15px; height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.nav--open .nav__toggle span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav--open .nav__toggle span:nth-child(2) { opacity: 0; }
.nav--open .nav__toggle span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* keep the theme toggle above the glass sheen layers */
.nav .theme-toggle { position: relative; z-index: 1; }

/* ---- mobile: collapse the menu into a glass dropdown ---- */
@media (max-width: 720px) {
  .nav__toggle { display: flex; }
  .nav__links {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: auto;
    min-width: 200px;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    margin: 0;
    padding: 0.5rem;
    border-radius: 22px;
    background: var(--glass-nav);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    box-shadow:
      0 16px 44px rgba(0, 0, 0, 0.28),
      inset 0 1px 0 var(--glass-edge);
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  }
  .nav--open .nav__links { opacity: 1; transform: none; pointer-events: auto; }
  .nav__links a { padding: 0.7rem 1rem; font-size: 0.95rem; }
  .nav__links a:hover { transform: none; }
}

/* ===========================================================
   Theme toggle
   =========================================================== */
.theme-toggle {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  color: var(--fg);
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.2s ease, border-color 0.3s var(--ease);
}
.theme-toggle:hover { transform: scale(1.1); border-color: var(--fg); }
.theme-toggle:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

/* ===========================================================
   Hero
   =========================================================== */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(5rem, 16vh, 11rem) 22px clamp(4rem, 10vh, 7rem);
  text-align: center;
}
.hero__eyebrow {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin: 0 0 1rem;
  text-transform: uppercase;
}
.hero__title {
  font-size: clamp(2.6rem, 7vw, 5rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 auto 1.5rem;
  max-width: 16ch;
}
.hero__sub {
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  font-weight: 400;
  color: var(--muted);
  max-width: 46ch;
  margin: 0 auto 2.5rem;
  line-height: 1.45;
}
.hero__cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border-radius: 980px;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.3s var(--ease);
}
.btn:hover { transform: scale(1.04); }
.btn--primary { background: var(--fg); color: var(--btn-fg); }
.btn--primary:hover { opacity: 0.85; }
.btn--ghost {
  color: var(--fg);
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}
.btn--ghost:hover { border-color: var(--fg); }

/* ===========================================================
   About
   =========================================================== */
.about {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(3rem, 8vh, 6rem) 22px;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.about__media img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.about__text p {
  font-size: clamp(1.05rem, 1.8vw, 1.2rem);
  color: var(--muted);
  margin: 0 0 1.1rem;
}
.about__text strong { color: var(--fg); font-weight: 600; }

/* ===========================================================
   Experience
   =========================================================== */
.experience {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vh, 5rem) 22px;
}
.experience .section-title { text-align: center; margin-bottom: 2.5rem; }
.exp-list { list-style: none; margin: 0; padding: 0; }
.exp {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 1.5rem;
  padding: 1.4rem 0;
  border-top: 1px solid var(--line);
}
.exp:last-child { border-bottom: 1px solid var(--line); }
.exp__when {
  font-size: 0.85rem;
  color: var(--muted);
  padding-top: 0.2rem;
}
.exp__role { font-size: 1.1rem; font-weight: 600; margin: 0 0 0.15rem; letter-spacing: -0.01em; }
.exp__org { font-size: 0.98rem; color: var(--fg); margin: 0 0 0.35rem; }
.exp__org a { color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--line); }
.exp__org a:hover { border-bottom-color: var(--fg); }
.exp__note { font-size: 0.92rem; color: var(--muted); margin: 0; line-height: 1.5; }

/* ===========================================================
   Work
   =========================================================== */
.work {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(3rem, 8vh, 6rem) 22px;
}
.work__header { text-align: center; margin-bottom: 3.5rem; }

/* ---- Featured project blocks ---- */
.feature {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: center;
  padding: clamp(2.5rem, 6vh, 5rem) 0;
}
.feature + .feature { border-top: 1px solid var(--line); }
.feature--reverse .feature__media { order: 2; }

.feature__media {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}
.feature__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
}
.feature:hover .feature__media img { transform: scale(1.03); }

.feature__eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.6rem;
}
.feature__title {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0 0 0.5rem;
  line-height: 1.05;
}
.feature__tagline {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 500;
  color: var(--fg);
  margin: 0 0 1rem;
}
.feature__desc {
  font-size: 1.02rem;
  color: var(--muted);
  margin: 0 0 1.4rem;
  line-height: 1.6;
}

/* chips — frosted glass */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.3rem; }
.chip {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 980px;
  padding: 0.35rem 0.85rem;
  white-space: nowrap;
  background: var(--glass);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
}

/* stats */
.stats { display: flex; gap: 2.5rem; margin-bottom: 1.3rem; }
.stat { display: flex; flex-direction: column; }
.stat__num {
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.stat__label { font-size: 0.85rem; color: var(--muted); max-width: 16ch; }

.awards { font-size: 0.85rem; color: var(--muted); margin: 0; }

.group-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 3rem 0 1.25rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease),
              background 0.5s var(--ease);
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
}
.card--wide { grid-column: span 2; }
.card__media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-elev);
}
.card--wide .card__media { aspect-ratio: 16 / 9; }
.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.card:hover .card__media img { transform: scale(1.04); }
.card__body { padding: 1.25rem 1.4rem 1.5rem; }
.card__title { font-size: 1.2rem; font-weight: 600; margin: 0 0 0.3rem; }
.card__desc { font-size: 0.95rem; color: var(--muted); margin: 0; }

/* ===========================================================
   More Work
   =========================================================== */
.more {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2rem, 5vh, 4rem) 22px clamp(3rem, 8vh, 6rem);
}

/* ===========================================================
   Project case-study pages
   =========================================================== */
.proj-hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(3rem, 9vh, 6rem) 22px clamp(2rem, 5vh, 3.5rem);
  text-align: center;
}
.proj-hero__eyebrow {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}
.proj-hero__title {
  font-size: clamp(2.6rem, 7vw, 5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.04;
  margin: 0 0 1rem;
}
.proj-hero__tagline {
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  font-weight: 400;
  color: var(--muted);
  max-width: 40ch;
  margin: 0 auto 1.75rem;
}
.proj-hero .chips { justify-content: center; }
.proj-hero .awards { margin-top: 0.25rem; }

.proj-cover {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 22px clamp(2rem, 5vh, 3.5rem);
}
.proj-cover img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.proj-overview {
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(1rem, 4vh, 2.5rem) 22px clamp(2.5rem, 6vh, 4rem);
}
.proj-overview p {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  line-height: 1.6;
  color: var(--fg);
  margin: 0;
  text-align: center;
}

.gallery {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 22px clamp(3rem, 8vh, 6rem);
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2.5vw, 1.75rem);
}
.gallery__item {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}
.gallery__item img { width: 100%; display: block; }

.proj-footer-nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px clamp(3rem, 8vh, 5rem);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.proj-footer-nav a {
  color: var(--fg);
  text-decoration: none;
  font-size: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: border-color 0.2s ease;
}
.proj-footer-nav a:hover { border-bottom-color: var(--fg); }

/* link wrapper on home feature media */
.feature__link { display: block; border-radius: var(--radius); overflow: hidden; }
.feature__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.4rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  transition: gap 0.2s ease;
}
.feature__cta:hover { gap: 0.7rem; }

/* ===========================================================
   Awards page
   =========================================================== */
.awards-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 22px clamp(3rem, 8vh, 6rem);
}
.awards-list { list-style: none; margin: 0; padding: 0; }
.award {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
}
.award:last-child { border-bottom: 1px solid var(--line); }
.award__name { font-size: 1.15rem; font-weight: 600; margin: 0 0 0.2rem; letter-spacing: -0.01em; }
.award__meta { font-size: 0.9rem; color: var(--muted); margin: 0; }
.award__proj {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 980px;
  padding: 0.4rem 0.9rem;
  background: var(--glass);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
}

@media (max-width: 560px) {
  .award { grid-template-columns: 1fr; }
  .award__proj { grid-column: 1; justify-self: start; margin-top: 0.4rem; }
}

/* ===========================================================
   Playground — fullscreen bouncing ball + floating glass dashboard
   =========================================================== */
.play-body { overflow: hidden; height: 100vh; height: 100svh; }
.fs-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  display: block;
  z-index: 0;
  background: var(--bg);
}

.dashboard {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.1rem 2.1rem;
  padding: 0.95rem 1.5rem;
  border-radius: 26px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.22);
  transition: opacity 0.5s var(--ease), transform 0.35s var(--ease);
}
.dashboard.is-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}
.control {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--muted);
}
/* Scale only appears once Sound is on */
#scale-control { display: none; }
body.sound-on #scale-control { display: flex; }

/* minimal corner buttons (back / theme), replace the nav on the playground */
.corner-btn {
  position: fixed;
  top: 22px;
  z-index: 60;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--glass);
  color: var(--fg);
  text-decoration: none;
  font-size: 1rem; line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
  transition: opacity 0.5s var(--ease), transform 0.2s ease, border-color 0.2s ease;
}
.corner-btn:hover { border-color: var(--fg); transform: scale(1.08); }
.corner-btn--back { left: 22px; }
.corner-btn--theme { right: 22px; }

/* idle auto-hide: everything fades when the pointer rests */
body.idle .dashboard,
body.idle .dash-show,
body.idle .corner-btn {
  opacity: 0;
  pointer-events: none;
}
.control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 4px;
  border-radius: 4px;
  background: var(--line);
  outline: none;
}
.control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--fg); cursor: pointer;
}
.control input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border: none; border-radius: 50%;
  background: var(--fg); cursor: pointer;
}
.control input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 30px; height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none; cursor: pointer; padding: 0;
}
.control input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.control input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }

/* Apple-style toggle switch (the whole thing is a <label> so it's clickable) */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  position: absolute; inset: 0;
  background: var(--line); border-radius: 980px;
  transition: background 0.25s var(--ease);
}
.switch__track::before {
  content: ""; position: absolute; height: 20px; width: 20px;
  left: 3px; top: 3px; border-radius: 50%; background: #fff;
  transition: transform 0.25s var(--ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.switch input:checked + .switch__track { background: #34c759; }
.switch input:checked + .switch__track::before { transform: translateX(18px); }

/* segmented shape picker */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 980px;
  border: 1px solid var(--line);
  background: var(--glass);
}
.seg__btn {
  border: none;
  background: transparent;
  color: var(--muted);
  width: 28px; height: 24px;
  border-radius: 980px;
  cursor: pointer;
  font-size: 0.85rem; line-height: 1;
  display: grid; place-items: center;
  transition: background 0.2s ease, color 0.2s ease;
}
.seg__btn:hover { color: var(--fg); }
.seg__btn.is-active { background: var(--fg); color: var(--bg); }
.seg__btn--txt { width: auto; padding: 0 9px; font-size: 0.72rem; font-weight: 600; }

/* hide / show controls */
.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  font-size: 0.9rem; line-height: 1;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.icon-btn:hover { border-color: var(--fg); transform: scale(1.08); }

.dash-show {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  z-index: 60;
  width: 40px; height: 40px;
  display: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--fg);
  cursor: pointer;
  font-size: 1rem;
  background: var(--glass);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.dash-show.is-visible { display: grid; }
.dash-show:hover { border-color: var(--fg); transform: translateX(-50%) scale(1.08); }

/* ===========================================================
   Play hub
   =========================================================== */
.hub {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px clamp(3rem, 8vh, 6rem);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.hub-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 320px;
  padding: 1.75rem;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--fg);
  overflow: hidden;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.hub-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.hub-card__art { position: absolute; inset: 0; overflow: hidden; }
.hub-card__art canvas { width: 100%; height: 100%; display: block; }
.hub-card__body { position: relative; z-index: 1; }
.hub-card__title { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 0.3rem; }
.hub-card__desc { font-size: 0.95rem; color: var(--muted); margin: 0; }

@media (max-width: 720px) { .hub { grid-template-columns: 1fr; } }

/* ===========================================================
   Photo Framer
   =========================================================== */
.framer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px clamp(3rem, 8vh, 6rem);
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}
.framer__stage {
  position: relative;
  min-height: 60vh;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  overflow: hidden;
  padding: 1.5rem;
}
.framer__stage canvas { max-width: 100%; max-height: 72vh; border-radius: 4px; box-shadow: var(--shadow); }
.framer__drop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s ease;
}
.framer__drop.is-over { background: var(--glass-hover); }
.framer__drop span { pointer-events: none; }

.panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.4rem;
  border-radius: 22px;
  background: var(--glass-nav);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.20), inset 0 1px 0 var(--glass-edge);
}
.panel__group { display: flex; flex-direction: column; gap: 0.5rem; }
.panel__label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.panel input[type="text"],
.panel textarea {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  color: var(--fg);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.5rem 0.7rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.panel textarea { resize: vertical; min-height: 2.4em; line-height: 1.3; }
.panel input[type="text"]:focus,
.panel textarea:focus { outline: none; border-color: var(--fg); }
.panel input[type="range"] {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 4px; border-radius: 4px; background: var(--line); outline: none;
}
.panel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--fg); cursor: pointer;
}
.panel input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: none; border-radius: 50%; background: var(--fg); cursor: pointer; }
.panel input[type="color"] {
  -webkit-appearance: none; appearance: none;
  width: 30px; height: 30px; border: 1px solid var(--glass-border); border-radius: 50%;
  background: none; cursor: pointer; padding: 0;
}
.panel input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.panel input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }
.swatch-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.swatch-head { display: flex; align-items: center; gap: 0.5rem; }
.swatch-count { font-size: 0.8rem; color: var(--muted); min-width: 1.2em; text-align: center; }
.swatch-head .mini-btn { width: 28px; padding: 0.2rem 0; text-align: center; }
.panel__sub { display: flex; flex-direction: column; gap: 0.5rem; }
.panel__sub.is-collapsed { display: none; }
.sw-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sw-pick {
  width: 26px; height: 18px;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  background: var(--glass);
  color: var(--muted);
  font-size: 0.7rem; line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.sw-pick:hover { color: var(--fg); border-color: var(--fg); }
.logo-ctl { display: inline-flex; gap: 0.4rem; }
.mini-btn {
  font: inherit; font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--glass-border);
  border-radius: 980px;
  background: var(--glass);
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.mini-btn:hover { border-color: var(--fg); }
.framer__hint { text-align: center; font-size: 0.78rem; color: var(--muted); margin: 0.7rem 0 0; }
.framer__stage canvas { cursor: grab; }
.framer__stage canvas:active { cursor: grabbing; }
.framer__stage canvas.is-picking { cursor: crosshair; }
.seg--frame { flex-wrap: wrap; }
.seg--frame .seg__btn { width: auto; padding: 0 0.7rem; font-size: 0.72rem; height: 28px; }
.seg--size { margin-top: 0.1rem; }
.seg--size .seg__btn { font-size: 0.7rem; }
.framer-toggle { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; font-size: 0.85rem; color: var(--fg); }
.framer-toggle input[type="range"] { width: 120px; flex: 0 0 auto; }
.btn-export {
  margin-top: 0.25rem;
  font: inherit; font-size: 0.95rem; font-weight: 500;
  padding: 0.7rem 1rem;
  border-radius: 980px;
  border: none;
  background: var(--fg);
  color: var(--btn-fg);
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.btn-export:hover { opacity: 0.85; transform: scale(1.02); }

@media (max-width: 820px) {
  .framer { grid-template-columns: 1fr; }
  .panel { order: 2; }
}
.research {
  max-width: 800px;
  margin: 0 auto;
  padding: clamp(3rem, 8vh, 6rem) 22px;
}
.pubs { list-style: none; margin: 2rem 0 0; padding: 0; counter-reset: pub; }
.pub {
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
}
.pub:last-child { border-bottom: 1px solid var(--line); }
.pub__cite { margin: 0 0 0.5rem; font-size: 1.05rem; line-height: 1.5; }
.pub__cite em { color: var(--fg); font-style: italic; }
.pub__doi {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.pub__doi:hover { color: var(--fg); border-bottom-color: var(--fg); }

/* ===========================================================
   Contact
   =========================================================== */
.contact {
  text-align: center;
  padding: clamp(4rem, 12vh, 8rem) 22px;
}
.contact__title {
  font-size: clamp(1.9rem, 5vw, 3.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 auto 2rem;
  max-width: 18ch;
}
.contact__links {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}
.contact__links a {
  font-size: 1.1rem;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}
.contact__links a:hover { border-bottom-color: var(--fg); }

/* ===========================================================
   Footer
   =========================================================== */
.footer {
  border-top: 1px solid var(--line);
  padding: 2rem 22px;
  text-align: center;
}
.footer p { margin: 0; font-size: 0.8rem; color: var(--muted); }

/* ===========================================================
   Scroll reveal
   =========================================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ===========================================================
   Responsive
   =========================================================== */
/* ===========================================================
   Intro animation — "SS" rings draw, bloom, then glass clears
   =========================================================== */
.intro {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: var(--nav-bg);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  transition: opacity 0.9s var(--ease), visibility 0.9s var(--ease);
}
.intro.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.intro__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
}
.intro__logo {
  width: 150px;
  height: 213px;
  overflow: visible;
  animation: introFloat 5.5s ease-in-out 2.6s infinite alternate;
}
@keyframes introFloat {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(-7px) scale(1.012); }
}

/* the logo is written in ONE continuous S-stroke; outer rings stay consistent */
.intro__write {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: introDraw 2.7s cubic-bezier(0.62, 0.04, 0.34, 1) 0.4s forwards;
}
@keyframes introDraw { to { stroke-dashoffset: 0; } }

/* light theme — symmetric shading + lighter shadow, and drop the top highlight
   band so both sides read at the same weight on white */
html[data-theme="light"] .intro__write {
  stroke: url(#introTubeLight);
  filter: url(#introDepthLight);
}
html[data-theme="light"] .intro__hi {
  animation: none;
  opacity: 0;
}

/* after writing, the light blooms and spreads out softly */
.intro__halo,
.intro__glow,
.intro__hi { opacity: 0; }
.intro__halo {
  animation: introHalo 1.8s ease 3.2s forwards;
  transform-box: fill-box;
  transform-origin: center;
}
.intro__glow { animation: introBloom 1.5s ease 3.1s forwards; }
.intro__hi   { animation: introBloom 1.6s ease 3.3s forwards; }
@keyframes introBloom { to { opacity: 1; } }
@keyframes introHalo {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 0.6; transform: scale(1.1); }
}

.intro__word {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin: 0;
  opacity: 0;
  transform: translateY(14px);
  animation: introWord 1.1s var(--ease) 3.8s forwards;
}
@keyframes introWord { to { opacity: 1; transform: none; } }

.intro__skip {
  position: absolute;
  bottom: 1.75rem;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  opacity: 0;
  animation: introWord 0.8s ease 4.4s forwards;
}

@media (prefers-reduced-motion: reduce) {
  .intro { display: none; }
}

@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; text-align: center; }
  .about__media { max-width: 380px; margin: 0 auto; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .card--wide { grid-column: span 2; }
  .feature { grid-template-columns: 1fr; gap: 1.5rem; }
  .feature--reverse .feature__media { order: 0; }
}
@media (max-width: 560px) {
  .nav__links { display: none; }
  .grid { grid-template-columns: 1fr; }
  .card--wide { grid-column: span 1; }
  .card--wide .card__media { aspect-ratio: 4 / 3; }

  /* playground dashboard packs tighter on phones */
  .dashboard { gap: 0.7rem 1.1rem; padding: 0.7rem 1rem; max-width: 94vw; border-radius: 20px; }
  .play-stage .dashboard,
  .play-stage .dash-show { bottom: 74px; }
  .control { font-size: 0.76rem; gap: 0.45rem; }
  .control input[type="range"] { width: 78px; }
  .feature__title { font-size: clamp(1.8rem, 8vw, 2.4rem); }
  .timeline__when, .exp__when { font-size: 0.8rem; }
}

@media (max-width: 380px) {
  .dashboard { gap: 0.55rem 0.8rem; padding: 0.6rem 0.8rem; }
  .control input[type="range"] { width: 64px; }
  .control input[type="color"] { width: 26px; height: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ===========================================================
   Glowing blue cursor orb
   =========================================================== */
.has-orb, .has-orb * { cursor: none !important; }
.cursor-dot, .cursor-glow {
  position: fixed; left: 0; top: 0; z-index: 99999; pointer-events: none;
  border-radius: 50%; opacity: 0; will-change: transform;
}
.cursor-dot {
  width: 8px; height: 8px; background: #7cc4ff;
  box-shadow: 0 0 6px 1px rgba(90,170,255,.9);
  transition: width .15s ease, height .15s ease, opacity .25s ease;
}
.cursor-dot.down { width: 5px; height: 5px; }
.cursor-glow {
  width: 30px; height: 30px;
  background: radial-gradient(circle at 50% 50%, rgba(120,200,255,.5), rgba(60,140,255,.28) 45%, rgba(60,140,255,0) 72%);
  box-shadow: 0 0 22px 8px rgba(70,160,255,.28);
  transition: width .2s ease, height .2s ease, opacity .3s ease;
}
.cursor-glow.hot { width: 54px; height: 54px; }
.cursor-glow.down { width: 22px; height: 22px; }
@media (pointer: coarse) { .cursor-dot, .cursor-glow { display: none !important; } }
