/* =====================================================================
   DEEPEST :: IMPACT — Variant 04 "Roster Stage"
   An interactive master-detail character viewer. Light, calm, friendly —
   rooted in studiomyo.com's minimal identity. Consumes window.MyoData.
   ===================================================================== */

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

:root {
  --paper: #ffffff;
  --paper-soft: #faf8f4;
  --paper-warm: #f5f1e9;
  --ink: #1a1a1f;
  --ink-soft: #585863;
  --ink-faint: #8b8b95;
  --line: #eceae5;
  --line-soft: #f2f0ea;

  --brand: #e0a32e;
  --brand-deep: #c4801a;
  --brand-tint: #fbf3e1;

  --radius: 24px;
  --radius-sm: 16px;
  --radius-xs: 11px;
  --shadow: 0 14px 38px rgba(24, 24, 34, .08);
  --shadow-lg: 0 30px 70px rgba(24, 24, 34, .13);
  --shadow-soft: 0 6px 18px rgba(24, 24, 34, .05);

  --maxw: 1180px;
  --gutter: clamp(18px, 4.5vw, 52px);
  --header-h: 70px;
  --ease: cubic-bezier(.22, .61, .36, 1);

  --font-display: 'Space Grotesk', 'Pretendard', sans-serif;
  --font: 'Pretendard', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.rank-S { --accent: #d2452f; --tint: #fdeeec; }
.rank-A { --accent: #c98a16; --tint: #fbf3e1; }
.rank-B { --accent: #9a4fc4; --tint: #f6edfb; }
.rank-C { --accent: #2f8fd0; --tint: #eaf4fb; }
.rank-D { --accent: #6b7585; --tint: #f1f3f6; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 14px); }
body {
  font-family: var(--font); color: var(--ink); background: var(--paper);
  line-height: 1.7; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.sr-only, .skip-link {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: 10px; left: 50%; width: auto; height: auto; margin: 0; clip: auto;
  transform: translateX(-50%) translateY(-160%); z-index: 200;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  transition: transform .2s var(--ease);
}
.skip-link:focus { transform: translateX(-50%) translateY(0); }

/* ============================ HEADER ============================ */
.site-header {
  position: sticky; top: 0; z-index: 100; height: var(--header-h);
  background: rgba(255, 255, 255, .8);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner {
  max-width: var(--maxw); height: 100%; margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--font-display); }
.brand-logo {
  display: grid; place-items: center; width: 36px; height: 36px;
  background: var(--ink); color: #fff; border-radius: 11px; font-weight: 700; font-size: 18px;
}
.brand-text { font-weight: 600; font-size: 17px; }
.brand-text b { font-weight: 700; }
.site-nav { display: flex; gap: 4px; }
.nav-link {
  padding: 8px 14px; border-radius: 999px; font-size: 15px; font-weight: 600; color: var(--ink-soft);
  transition: color .2s var(--ease), background .2s var(--ease);
}
.nav-link:hover { color: var(--ink); background: var(--paper-warm); }
.header-right { display: flex; align-items: center; gap: 12px; }
.lang-switch { display: flex; align-items: center; gap: 4px; background: var(--paper-warm); border-radius: 999px; padding: 4px; }
.lang-btn {
  padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--ink-faint);
  letter-spacing: .04em; transition: all .2s var(--ease);
}
.lang-btn.is-active { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-soft); }
.nav-toggle { display: none; flex-direction: column; gap: 5px; padding: 8px; }
.nav-toggle span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .25s var(--ease), opacity .2s var(--ease); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* shared bits */
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-display);
  font-size: 12.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint);
}
.eyebrow.center { justify-content: center; }
.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.rank-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px;
  background: var(--tint); color: var(--accent); font-weight: 700; font-size: 13px; font-family: var(--font-display);
}
.rank-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.rank-stars { color: var(--accent); font-size: 14px; letter-spacing: 2px; }

/* ============================ INTRO ============================ */
.intro { position: relative; padding: clamp(54px, 9vw, 96px) var(--gutter) clamp(30px, 4vw, 44px); overflow: hidden; }
.intro::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(55% 60% at 22% 8%, rgba(224, 163, 46, .12), transparent 70%),
    radial-gradient(45% 55% at 86% 12%, rgba(74, 163, 223, .10), transparent 70%);
}
.intro-inner { max-width: var(--maxw); margin: 0 auto; }
.intro-title {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; line-height: .98;
  font-size: clamp(44px, 10vw, 116px); margin: 16px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .18em;
}
.intro-title .t-sep { color: var(--brand); font-size: .7em; }
.intro-title .t-accent { color: var(--brand-deep); }
.intro-tagline { margin-top: 20px; max-width: 540px; font-size: clamp(16px, 2vw, 20px); color: var(--ink-soft); font-weight: 500; }
.scroll-cue {
  display: inline-flex; align-items: center; gap: 9px; margin-top: 28px;
  font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--ink);
  padding: 11px 20px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper);
  box-shadow: var(--shadow-soft); transition: transform .2s var(--ease), border-color .2s var(--ease);
}
.scroll-cue:hover { transform: translateY(-3px); border-color: var(--ink); }
.scroll-arrow { animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

/* ======================== ROSTER STAGE ======================== */
.roster-section { background: var(--paper-soft); padding: clamp(40px, 6vw, 72px) var(--gutter) clamp(56px, 8vw, 96px); }
.roster-head {
  max-width: var(--maxw); margin: 0 auto clamp(24px, 4vw, 36px);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.roster-h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; font-size: clamp(26px, 4vw, 40px); margin-top: 10px; }
.roster-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search {
  display: flex; align-items: center; gap: 9px; flex: 0 1 280px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px;
  box-shadow: var(--shadow-soft); transition: border-color .2s var(--ease);
}
.search:focus-within { border-color: var(--ink); }
.search-icon { font-size: 17px; color: var(--ink-faint); }
.search input { border: none; outline: none; background: none; width: 100%; font-size: 15px; color: var(--ink); }
.rank-filter { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  min-width: 40px; padding: 9px 15px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line);
  font-weight: 700; font-size: 14px; font-family: var(--font-display); color: var(--ink-soft); transition: all .2s var(--ease);
}
.chip:hover { border-color: var(--ink-soft); color: var(--ink); }
.chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

.viewer {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr); gap: clamp(20px, 3vw, 40px); align-items: start;
}

/* --- STAGE (sticky detail) --- */
.stage { position: sticky; top: calc(var(--header-h) + 22px); }
.stage-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: grid; grid-template-columns: 1fr 1fr;
}
.stage-art { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: linear-gradient(165deg, var(--tint, #f1f3f6), var(--paper-soft)); }
.stage-wash { position: absolute; inset: 0; background: radial-gradient(75% 65% at 50% 32%, var(--tint, #f1f3f6), transparent 78%); }
/* Rank now lives in the bottom-left caption pill; keep the node for JS, hide the corner mark. */
.stage-rankmark { display: none; }
.stage-art img {
  position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; object-position: center top;
  transition: opacity .35s var(--ease), transform .5s var(--ease);
}
.stage.is-swapping .stage-art img { opacity: 0; transform: scale(1.02); }
.stage.is-swapping .stage-caption { opacity: 0; }
/* Left column: portrait on top, identity caption directly beneath it (never over the art). */
.stage-left { display: flex; flex-direction: column; min-width: 0; }
.stage-caption {
  padding: clamp(15px, 1.9vw, 20px) clamp(18px, 2.2vw, 26px) clamp(17px, 2.2vw, 22px);
  border-top: 1px solid var(--line); transition: opacity .35s var(--ease);
}
.stage-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#stage-name {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; line-height: 1.12;
  font-size: clamp(22px, 2.6vw, 30px); margin: 11px 0 2px; overflow-wrap: anywhere;
}
.stage-id { font-family: var(--font-display); font-size: 12.5px; color: var(--ink-faint); letter-spacing: .05em; }
.stage-info { padding: clamp(20px, 2.4vw, 30px); display: flex; flex-direction: column; min-width: 0; }
.stage-rule { display: flex; align-items: center; gap: 11px; margin: 18px 0 14px; color: var(--ink-faint); font-size: 10.5px; letter-spacing: .2em; font-family: var(--font-display); }
.stage-rule::before, .stage-rule::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.stage-story {
  color: var(--ink-soft); font-size: 14.5px; line-height: 1.82; white-space: pre-line;
  overflow-y: auto; max-height: 280px; padding-right: 6px; flex: 1;
}
.stage-story::-webkit-scrollbar { width: 6px; }
.stage-story::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
.stage-nav { display: flex; align-items: center; gap: 14px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.stage-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper);
  font-size: 17px; color: var(--ink); display: grid; place-items: center;
  transition: transform .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.stage-btn:hover { transform: translateY(-2px); border-color: var(--ink); }
.stage-btn:active { transform: translateY(0); }
.stage-counter { font-family: var(--font-display); font-size: 13px; color: var(--ink-faint); font-weight: 600; }

/* --- ROSTER LIST --- */
.roster-group { margin-bottom: 26px; }
.roster-group:last-child { margin-bottom: 0; }
.roster-group-head { display: flex; align-items: center; gap: 11px; margin: 0 4px 12px; }
.roster-group-badge {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--tint); color: var(--accent); font-family: var(--font-display); font-weight: 700; font-size: 14px;
}
.roster-group-title { font-family: var(--font-display); font-weight: 600; font-size: 14.5px; color: var(--ink); }
.roster-group-title span { color: var(--ink-faint); font-weight: 500; margin-left: 6px; }
.roster-group-line { flex: 1; height: 1px; background: var(--line); }

.roster-items { display: flex; flex-direction: column; gap: 7px; }
.r-item {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: var(--radius-xs); border: 1px solid transparent; background: var(--paper);
  transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.r-item:hover { transform: translateX(3px); box-shadow: var(--shadow-soft); border-color: var(--line); }
.r-item.is-active { border-color: transparent; background: var(--tint); box-shadow: inset 3px 0 0 var(--accent); }
.r-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.r-thumb {
  flex: none; width: 50px; height: 50px; border-radius: 11px; overflow: hidden;
  background: linear-gradient(160deg, var(--tint), var(--paper-soft)); border: 1px solid var(--line-soft);
}
.r-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.r-meta { min-width: 0; flex: 1; }
.r-name { font-weight: 700; font-size: 14.5px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-sub { font-family: var(--font-display); font-size: 11.5px; color: var(--ink-faint); }
.r-rank { flex: none; font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--accent); }

.roster-status { text-align: center; color: var(--ink-faint); padding: 30px 0; }

/* ============================ SECTIONS ============================ */
.section { padding: clamp(64px, 10vw, 120px) var(--gutter); }
.section-soft { background: var(--paper-soft); }
.section-inner { max-width: var(--maxw); margin: 0 auto; }
.section-head { max-width: 660px; margin: 0 auto clamp(36px, 5vw, 56px); text-align: center; }
.section-title { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; font-size: clamp(27px, 4.4vw, 44px); line-height: 1.14; margin: 14px 0 0; }
.section-sub { margin-top: 13px; color: var(--ink-soft); font-size: clamp(15px, 1.8vw, 18px); }

/* WORLD */
.world-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(30px, 5vw, 68px); align-items: center; }
.world-copy .section-title { text-align: left; }
.world-copy .eyebrow { margin-bottom: 6px; }
.world-body { margin-top: 20px; color: var(--ink-soft); font-size: clamp(15px, 1.8vw, 17.5px); }
.world-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 9px; margin-top: 26px; }
.world-tags li { padding: 8px 16px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.world-art { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); background: var(--paper-warm); aspect-ratio: 16 / 11; }
.world-art img { width: 100%; height: 100%; object-fit: cover; }

/* GAME */
.game-feature { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(26px, 5vw, 56px); align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(26px, 5vw, 54px); box-shadow: var(--shadow); }
.game-feature-art { position: relative; display: grid; place-items: center; min-height: 220px; background: radial-gradient(60% 60% at 50% 45%, var(--brand-tint), transparent 72%); border-radius: var(--radius-sm); }
.game-logo { width: min(78%, 360px); height: auto; }
.game-mascot { position: absolute; right: clamp(6px, 4%, 26px); bottom: -6px; height: clamp(92px, 16vw, 150px); width: auto; filter: drop-shadow(0 14px 22px rgba(224, 163, 46, .25)); }
.release-badge { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: var(--brand-tint); color: var(--brand-deep); font-size: 12.5px; font-weight: 700; letter-spacing: .08em; font-family: var(--font-display); }
.release-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px rgba(224, 163, 46, .2); }
.release-year { font-family: var(--font-display); font-weight: 700; font-size: clamp(26px, 4vw, 40px); margin: 16px 0 12px; }
.release-year span { font-size: .5em; color: var(--ink-faint); letter-spacing: .12em; }
.game-desc { color: var(--ink-soft); font-size: 15.5px; }
.platforms { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.platforms li { padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); font-size: 13.5px; font-weight: 700; font-family: var(--font-display); color: var(--ink); }
.platform-soon { background: var(--ink); color: #fff !important; border-color: var(--ink) !important; }
.media-strip { margin-top: clamp(18px, 3vw, 28px); display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 15px; }
.shot { border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-soft); aspect-ratio: 4 / 3; background: var(--paper-warm); }
.shot-wide { aspect-ratio: 16 / 9; }
.shot img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.shot:hover img { transform: scale(1.05); }

/* STUDIO */
.timeline { list-style: none; max-width: 760px; margin: 0 auto; position: relative; }
.timeline::before { content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--brand), var(--line)); border-radius: 2px; }
.tl-item { position: relative; padding: 0 0 34px 50px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: 6px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); border: 3px solid var(--brand); box-shadow: 0 0 0 4px var(--paper-soft); }
.tl-year { font-family: var(--font-display); font-weight: 700; font-size: 22px; margin-bottom: 11px; }
.tl-list { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.tl-list li { position: relative; padding-left: 18px; color: var(--ink-soft); font-size: 15.5px; }
.tl-list li::before { content: "—"; position: absolute; left: 0; color: var(--brand); }

/* FOOTER */
.site-footer { background: var(--paper); border-top: 1px solid var(--line); padding: clamp(46px, 7vw, 72px) var(--gutter) 38px; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; }
.footer-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; flex-wrap: wrap; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-name { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.footer-slogan { color: var(--ink-soft); font-size: 14.5px; margin-top: 2px; }
.footer-contact { font-size: 14px; color: var(--ink-soft); display: flex; flex-direction: column; gap: 7px; max-width: 460px; }
.footer-contact a { color: var(--brand-deep); font-weight: 600; }
.footer-contact a:hover { text-decoration: underline; }
.footer-contact .fc-addr { font-size: 12.5px; color: var(--ink-faint); line-height: 1.55; }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 22px; font-size: 13px; color: var(--ink-faint); }
.footer-bottom a { font-weight: 600; }
.footer-bottom a:hover { color: var(--ink); }

/* REVEAL */
.reveal { opacity: 0; transform: translateY(22px); }
.reveal.is-in { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform .7s var(--ease); }

/* RESPONSIVE */
@media (max-width: 940px) {
  .viewer { grid-template-columns: 1fr; }
  .stage { position: static; }
  .stage-card { max-width: 560px; margin: 0 auto; }
  .world-grid { grid-template-columns: 1fr; }
  .game-feature { grid-template-columns: 1fr; }
  .media-strip { grid-template-columns: 1fr 1fr; }
  .shot-wide { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .site-nav {
    position: absolute; top: calc(100% + 1px); left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
    padding: 8px var(--gutter) 16px; display: none;
  }
  .site-nav.is-open { display: flex; }
  .nav-link { padding: 12px 8px; border-radius: 10px; }
  .nav-toggle { display: flex; }
}
@media (max-width: 560px) {
  .stage-card { grid-template-columns: 1fr; }
  .stage-art { aspect-ratio: 4 / 5; }
  .stage-story { max-height: none; }
  .stage-caption { padding: 14px 16px 16px; }
  #stage-name { font-size: clamp(20px, 6vw, 26px); }
  .roster-head { flex-direction: column; align-items: stretch; }
  .search { flex-basis: auto; }
}

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