/* ==========================================================
   DIGI-MAN Official Site
   ========================================================== */
:root {
  --ink: #07080d;
  --ink-2: #0d0f18;
  --ink-3: #151826;
  --cream: #f3eee4;
  --cream-dim: rgba(243, 238, 228, 0.66);
  --gold: #d6b46a;
  --gold-2: #f1dca2;
  --gold-line: rgba(214, 180, 106, 0.38);
  --accent: #d6b46a;
  --serif: "Noto Serif TC", "Songti TC", serif;
  --sans: "Noto Sans TC", "PingFang TC", system-ui, sans-serif;
  --display: "Outfit", "Noto Sans TC", sans-serif;
  --latin-serif: "Cormorant Garamond", "Noto Serif TC", serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.eyebrow {
  font-family: var(--display);
  font-size: 0.75rem;
  letter-spacing: 0.42em;
  color: var(--gold);
  margin: 0 0 0.6rem;
}

/* ───────── NAV ───────── */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem clamp(1.2rem, 4vw, 3.5rem);
  transition: background 0.4s, padding 0.4s, border-color 0.4s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(7, 8, 13, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding-block: 0.7rem;
  border-color: var(--gold-line);
}
.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand-mark { display: flex; align-items: center; gap: 3px; height: 22px; }
.brand-mark i {
  width: 3px; background: var(--gold); border-radius: 2px;
  animation: eq 1.2s ease-in-out infinite alternate;
}
.brand-mark i:nth-child(1) { height: 40%; animation-delay: -0.2s; }
.brand-mark i:nth-child(2) { height: 80%; animation-delay: -0.6s; }
.brand-mark i:nth-child(3) { height: 100%; animation-delay: -0.1s; }
.brand-mark i:nth-child(4) { height: 65%; animation-delay: -0.9s; }
.brand-mark i:nth-child(5) { height: 35%; animation-delay: -0.4s; }
@keyframes eq { from { transform: scaleY(0.35); } to { transform: scaleY(1); } }
.brand-text {
  font-family: var(--display); font-weight: 800; letter-spacing: 0.18em; font-size: 1.15rem;
}
.brand-text b { color: var(--gold); font-weight: 300; }
.brand-text.small { font-size: 0.95rem; }
.nav-links { display: flex; gap: clamp(1rem, 3vw, 2.6rem); }
.nav-links a {
  font-family: var(--display); font-size: 0.8rem; letter-spacing: 0.28em;
  color: var(--cream-dim); position: relative; padding: 0.3rem 0;
  transition: color 0.3s;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--gold); transform: scaleX(0); transform-origin: left; transition: transform 0.4s var(--ease);
}
.nav-links a:hover { color: var(--cream); }
.nav-links a:hover::after { transform: scaleX(1); }

/* ───────── HERO ───────── */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center; overflow: hidden; isolation: isolate;
}
.hero-bg {
  position: absolute; inset: -4%; z-index: -3;
  background-size: cover; background-position: center 30%;
  animation: heroZoom 24s ease-in-out infinite alternate;
}
@keyframes heroZoom { from { transform: scale(1); } to { transform: scale(1.08); } }
.hero-veil {
  position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(7, 8, 13, 0.25), rgba(7, 8, 13, 0.82) 70%),
    linear-gradient(180deg, rgba(7, 8, 13, 0.55) 0%, rgba(7, 8, 13, 0.15) 40%, var(--ink) 100%);
}
.hero-rings {
  position: absolute; width: min(110vmin, 1000px); z-index: -1; opacity: 0.55;
  animation: spin 80s linear infinite;
}
.hero-rings circle, .stage-rings circle, .stage-rings line {
  fill: none; stroke: var(--gold-line); stroke-width: 1;
}
.hero-rings circle:nth-child(2) { stroke-dasharray: 2 10; }
@keyframes spin { to { transform: rotate(360deg); } }
.hero-inner { text-align: center; padding: 0 1.5rem; }
.hero-title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(3.6rem, 13vw, 11rem); line-height: 0.95; letter-spacing: 0.06em;
  margin: 0.2rem 0 1.2rem;
  background: linear-gradient(180deg, #fffaf0 10%, var(--gold-2) 55%, var(--gold) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 8px 40px rgba(214, 180, 106, 0.35));
}
.hero-title span { font-weight: 300; }
.hero-sub {
  font-family: var(--serif); font-size: clamp(1rem, 2vw, 1.25rem); color: var(--cream);
  margin: 0 auto 2.2rem; max-width: 34em; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.7);
}
.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.btn {
  font-family: var(--display); letter-spacing: 0.22em; font-size: 0.85rem;
  padding: 0.95rem 2.2rem; border-radius: 999px; transition: all 0.35s var(--ease);
}
.btn-gold { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--ink); font-weight: 600; }
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(214, 180, 106, 0.4); }
.btn-ghost { border: 1px solid var(--gold-line); color: var(--cream); backdrop-filter: blur(6px); }
.btn-ghost:hover { border-color: var(--gold); background: rgba(214, 180, 106, 0.1); }

.wave {
  position: absolute; bottom: 9vh; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; align-items: center; height: 40px; opacity: 0.7;
}
.wave span {
  width: 2px; height: 100%; background: var(--gold); border-radius: 2px;
  animation: eq 1.4s ease-in-out infinite alternate;
}
.wave span:nth-child(3n) { animation-delay: -0.5s; animation-duration: 1.1s; }
.wave span:nth-child(3n + 1) { animation-delay: -0.9s; animation-duration: 1.7s; }
.wave span:nth-child(4n) { animation-delay: -0.2s; }
.scroll-cue {
  position: absolute; bottom: 2.4vh; left: 50%; transform: translateX(-50%);
  font-family: var(--display); font-size: 0.65rem; letter-spacing: 0.5em; color: var(--cream-dim);
  padding-bottom: 2.4rem;
}
.scroll-cue::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 1px; height: 2rem;
  background: linear-gradient(var(--gold), transparent); animation: drip 2s ease-in-out infinite;
}
@keyframes drip { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* ───────── SECTION HEAD ───────── */
.section-head { text-align: center; padding: 0 1.5rem; }
.section-title {
  font-family: var(--serif); font-weight: 900; font-size: clamp(2rem, 4.4vw, 3.2rem);
  margin: 0; letter-spacing: 0.12em;
}

/* ───────── ARTISTS ───────── */
.artists { padding: 7rem 0 3rem; position: relative; }
.unit-tabs {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 0.5rem;
  margin: 2.4rem auto 0; padding: 0 1rem; max-width: 1100px;
}
.unit-tab {
  appearance: none; border: 1px solid var(--gold-line); background: transparent; color: var(--cream-dim);
  font-family: var(--display); letter-spacing: 0.2em; font-size: 0.78rem; padding: 0.6rem 1.15rem;
  border-radius: 999px; cursor: pointer; transition: all 0.35s var(--ease);
  display: inline-flex; align-items: baseline; gap: 0.55rem;
}
.unit-tab small { font-family: var(--serif); letter-spacing: 0.1em; font-size: 0.78rem; opacity: 0.75; }
.unit-tab sup { font-size: 0.6rem; color: var(--gold); letter-spacing: 0; }
.unit-tab:hover { color: var(--cream); border-color: var(--gold); }
.unit-tab[aria-selected="true"] {
  background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--ink); border-color: transparent;
}
.unit-tab[aria-selected="true"] sup { color: var(--ink); }

.unit-intro { text-align: center; margin: 1.6rem auto 0; max-width: 46rem; padding: 0 1.5rem; min-height: 5.2rem; }
.unit-intro h3 {
  font-family: var(--latin-serif); font-style: italic; font-weight: 500; font-size: 1.5rem;
  margin: 0; color: var(--gold-2); letter-spacing: 0.04em;
}
.unit-intro p { margin: 0.3rem 0 0; color: var(--cream-dim); font-size: 0.92rem; }
.unit-intro.swap { animation: fadeUp 0.6s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Stage */
.stage {
  position: relative; margin: 1rem auto 0; width: 100%;
  height: clamp(520px, 80vh, 900px);
  overflow: hidden; isolation: isolate;
  --spot-x: 50%;
  --accent: var(--gold);
}
.stage-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.stage-spot {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 22% 70% at var(--spot-x) 10%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(214, 180, 106, 0.10), transparent 70%);
  transition: background 0.6s var(--ease);
}
.stage-bigname {
  position: absolute; left: 0; right: 0; top: 6%;
  text-align: center; white-space: nowrap;
  font-family: var(--display); font-weight: 800; font-size: clamp(5rem, 18vw, 17rem); line-height: 1;
  letter-spacing: 0.08em; color: transparent;
  -webkit-text-stroke: 1px color-mix(in srgb, var(--accent) 45%, transparent);
  opacity: 0.55; transition: opacity 0.5s;
}
.stage-bigname.swap { animation: bigname 0.7s var(--ease); }
@keyframes bigname { from { opacity: 0; letter-spacing: 0.3em; } to { opacity: 0.55; letter-spacing: 0.08em; } }
.stage-rings {
  position: absolute; left: 50%; top: 50%; width: min(120vh, 1100px); transform: translate(-50%, -50%);
  opacity: 0.6;
}
.stage-rings circle:nth-child(1) { stroke-dasharray: 1 8; }
.stage-floor {
  position: absolute; left: 0; right: 0; bottom: 0; height: 22%;
  background:
    radial-gradient(ellipse 50% 60% at 50% 30%, rgba(214, 180, 106, 0.12), transparent 70%),
    linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  border-top: 1px solid rgba(214, 180, 106, 0.18);
}

.stage-figures { position: absolute; inset: 0; }
.fig {
  position: absolute; bottom: 7%;
  transform-origin: 50% 100%;
  transition: transform 0.7s var(--ease), filter 0.6s var(--ease), opacity 0.6s var(--ease);
  will-change: transform, filter;
  cursor: pointer;
  /* hit-testing is done in JS via alpha masks; the box itself is not interactive */
  pointer-events: none;
}
.fig-float {
  width: 100%; height: 100%;
  animation: float var(--dur, 5s) ease-in-out var(--delay, 0s) infinite;
}
.fig img {
  width: 100%; height: 100%; object-fit: contain; object-position: bottom center;
  user-select: none; -webkit-user-drag: none;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.55));
  transition: filter 0.6s var(--ease);
}
.fig-shadow {
  position: absolute; left: 18%; right: 18%; bottom: -2.2%; height: 4%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.75), transparent 70%);
  animation: shadow var(--dur, 5s) ease-in-out var(--delay, 0s) infinite;
  z-index: -1;
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(calc(var(--amp, 14px) * -1)) rotate(var(--tilt, 0.4deg)); }
}
@keyframes shadow {
  0%, 100% { transform: scaleX(1); opacity: 0.9; }
  50% { transform: scaleX(0.78); opacity: 0.5; }
}

/* entry animation when unit changes */
.fig.enter { opacity: 0; transform: translateY(40px) scale(var(--s, 1)); }

/* focus state: one active, others pushed back in greyscale */
.stage.has-focus .fig:not(.active) {
  filter: grayscale(1) brightness(0.42) contrast(0.95) blur(1.2px);
  transform: scale(calc(var(--s, 1) * 0.94));
}
.stage.has-focus .fig.active {
  transform: scale(calc(var(--s, 1) * 1.06));
}
.stage.has-focus .fig.active img {
  filter:
    drop-shadow(0 0 22px color-mix(in srgb, var(--accent) 55%, transparent))
    drop-shadow(0 18px 24px rgba(0, 0, 0, 0.55));
}
.stage.has-focus .stage-hint { opacity: 0; }

.stage-hint {
  position: absolute; left: 50%; bottom: 1.2rem; transform: translateX(-50%); margin: 0;
  font-size: 0.78rem; letter-spacing: 0.2em; color: var(--cream-dim); white-space: nowrap;
  transition: opacity 0.4s; pointer-events: none;
}

/* Profile panel */
.profile {
  position: absolute; z-index: 40; top: 50%;
  width: min(380px, 40vw);
  padding: 1.8rem 1.8rem 1.6rem;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--accent) 16%, rgba(13, 15, 24, 0.86)), rgba(9, 10, 16, 0.9) 60%);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--gold-line));
  border-radius: 4px;
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateY(-50%);
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s var(--ease), transform 0.5s var(--ease), left 0.5s var(--ease);
}
.profile.show { opacity: 1; pointer-events: auto; }
.profile.from-left { transform: translate(-18px, -50%); }
.profile.from-right { transform: translate(18px, -50%); }
.profile.show.from-left, .profile.show.from-right { transform: translate(0, -50%); }
.profile::before, .profile::after {
  content: ""; position: absolute; width: 18px; height: 18px; border: 1px solid var(--gold);
}
.profile::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.profile::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.p-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.p-no { font-family: var(--display); font-size: 0.72rem; letter-spacing: 0.35em; color: var(--gold); }
.p-unit {
  font-family: var(--display); font-size: 0.66rem; letter-spacing: 0.25em; color: var(--cream-dim);
  border: 1px solid var(--gold-line); padding: 0.15rem 0.6rem; border-radius: 999px;
}
.p-name { display: flex; align-items: baseline; gap: 0.9rem; flex-wrap: wrap; margin: 0; }
.p-name strong { font-family: var(--serif); font-weight: 900; font-size: 2.6rem; line-height: 1.1; letter-spacing: 0.08em; }
.p-name span {
  font-family: var(--display); font-weight: 300; letter-spacing: 0.32em; font-size: 0.86rem;
  color: color-mix(in srgb, var(--accent) 70%, white);
}
.p-meta { margin: 0.5rem 0 0; font-size: 0.86rem; color: var(--cream-dim); }
.p-meta b { color: var(--cream); font-weight: 500; }
.p-genre {
  display: flex; align-items: center; gap: 0.7rem; margin: 1rem 0 0;
  font-family: var(--latin-serif); font-style: italic; font-size: 1.1rem; color: var(--gold-2);
}
.p-eq { display: inline-flex; gap: 2px; height: 14px; align-items: center; }
.p-eq i { width: 2px; height: 100%; background: var(--accent); animation: eq 0.9s ease-in-out infinite alternate; }
.p-eq i:nth-child(2) { animation-delay: -0.3s; }
.p-eq i:nth-child(3) { animation-delay: -0.6s; }
.p-eq i:nth-child(4) { animation-delay: -0.15s; }
.p-desc { margin: 0.8rem 0 0; font-size: 0.92rem; line-height: 1.85; color: rgba(243, 238, 228, 0.86); }
.p-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.p-tags li {
  font-size: 0.74rem; padding: 0.18rem 0.65rem; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.p-palette { display: flex; gap: 6px; margin-top: 1.1rem; }
.p-palette i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.18); }
.p-foot {
  display: flex; justify-content: space-between; align-items: center; margin-top: 1.1rem;
  padding-top: 0.9rem; border-top: 1px solid var(--gold-line);
  font-size: 0.72rem; color: var(--cream-dim); letter-spacing: 0.08em;
}
.p-foot button {
  appearance: none; background: none; border: 0; color: var(--gold); cursor: pointer;
  font-family: var(--display); letter-spacing: 0.2em; font-size: 0.72rem; padding: 0;
}
.p-foot button:hover { color: var(--gold-2); }

/* ───────── ROSTER ───────── */
.roster { padding: 6rem clamp(1rem, 4vw, 3.5rem) 4rem; }
.roster-grid {
  display: grid; gap: 1px; margin: 3rem auto 0; max-width: 1400px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  background: var(--gold-line); border: 1px solid var(--gold-line);
}
.r-card {
  position: relative; aspect-ratio: 3 / 4.4; background: var(--ink-2); overflow: hidden; cursor: pointer;
  appearance: none; border: 0; padding: 0; color: inherit; text-align: left; font: inherit;
}
.r-card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 70% 55% at 50% 35%, color-mix(in srgb, var(--c) 30%, transparent), transparent 70%);
  opacity: 0.5; transition: opacity 0.5s;
}
.r-card img {
  position: absolute; left: 50%; top: 6%; height: 150%; width: auto; max-width: none;
  transform: translateX(-50%); transition: transform 0.6s var(--ease), filter 0.6s;
  filter: grayscale(0.35) brightness(0.9);
}
.r-card:hover img, .r-card:focus-visible img { transform: translateX(-50%) translateY(-3%) scale(1.04); filter: none; }
.r-card:hover::before { opacity: 1; }
.r-card .r-info {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2.4rem 0.9rem 0.8rem;
  background: linear-gradient(transparent, rgba(7, 8, 13, 0.95));
}
.r-card .r-no { font-family: var(--display); font-size: 0.62rem; letter-spacing: 0.3em; color: var(--gold); }
.r-card .r-name { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; display: block; line-height: 1.3; }
.r-card .r-roman { font-family: var(--display); font-size: 0.62rem; letter-spacing: 0.25em; color: var(--cream-dim); }

/* ───────── ABOUT ───────── */
.about { padding: 6rem 1.5rem; border-top: 1px solid var(--gold-line); background: linear-gradient(var(--ink), var(--ink-2)); }
.about-inner { max-width: 760px; margin: 0 auto; text-align: center; }
.about-inner p { color: var(--cream-dim); font-size: 1rem; line-height: 2; }
.about-inner p strong { color: var(--cream); font-weight: 500; }
.about-inner .section-title { margin-bottom: 1.6rem; }
.about-stats { display: flex; justify-content: center; gap: clamp(2rem, 8vw, 6rem); margin-top: 3rem; }
.about-stats b { display: block; font-family: var(--display); font-weight: 800; font-size: 2.8rem; color: var(--gold-2); line-height: 1; }
.about-stats span { font-family: var(--display); font-size: 0.68rem; letter-spacing: 0.4em; color: var(--cream-dim); }

.footer {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;
  padding: 2rem clamp(1.2rem, 4vw, 3.5rem); border-top: 1px solid var(--gold-line);
  font-size: 0.75rem; color: var(--cream-dim);
}
.footer p { margin: 0; }

/* ───────── LIGHTBOX ───────── */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(5, 6, 10, 0.92); backdrop-filter: blur(8px); padding: 4vh 4vw;
  animation: fadeIn 0.35s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } }
.lightbox figure { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; }
.lightbox img { max-height: 84vh; width: auto; border: 1px solid var(--gold-line); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.lightbox figcaption { margin-top: 1rem; font-family: var(--serif); letter-spacing: 0.15em; color: var(--cream-dim); }
.lightbox-close {
  position: absolute; top: 1.2rem; right: 1.4rem; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--gold-line); background: transparent; color: var(--cream); font-size: 1rem; cursor: pointer;
}
.lightbox-close:hover { border-color: var(--gold); color: var(--gold); }

/* ───────── RESPONSIVE ───────── */
@media (max-width: 820px) {
  .nav-links a { letter-spacing: 0.15em; font-size: 0.7rem; }
  .stage { height: 68vh; min-height: 460px; }
  .stage-hint { white-space: normal; text-align: center; width: 90%; }
  .profile {
    position: fixed; top: auto; bottom: 0; left: 0 !important; right: 0; width: auto;
    max-height: 62vh; overflow-y: auto; border-radius: 14px 14px 0 0;
    transform: translateY(30px); padding: 1.4rem 1.3rem 1.3rem;
  }
  .profile.show, .profile.show.from-left, .profile.show.from-right { transform: none; }
  .profile.from-left, .profile.from-right { transform: translateY(30px); }
  .p-name strong { font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
}
