/* ============================================================
   東京学生演劇祭 — Main Stylesheet
   ============================================================ */

/* ---- Custom Properties ---- */
:root {
  --bg: #07070f;
  --bg-2: #0d0d1a;
  --bg-3: #121220;
  --bg-card: #16162a;
  --bg-card-hover: #1c1c32;

  --gold: #c9a84c;
  --gold-light: #e0c06a;
  --gold-dim: rgba(201, 168, 76, 0.15);
  --gold-border: rgba(201, 168, 76, 0.25);

  --curtain: #4a0d14;
  --curtain-dark: #2a0709;

  --text: #f0ede8;
  --text-2: #b8b4ae;
  --text-3: #706c68;

  --border: rgba(255, 255, 255, 0.07);

  /* ---- 拡張変数（テーマファイルで上書き可・既定値は従来のダークテーマと同一） ---- */
  --accent-rgb: 201, 168, 76;              /* 差し色の RGB 成分（透過色の生成用） */
  --accent-2: #a090e0;                     /* 第2の差し色（エキシビション表記など） */
  --accent-2-soft: rgba(100, 80, 160, 0.18);
  --on-accent: #0a0810;                    /* 差し色ベタ面上の文字色 */
  --nav-bg: rgba(7, 7, 15, 0.92);
  --nav-bg-solid: rgba(7, 7, 15, 0.98);
  --footer-bg: #040408;
  --footer-text: #f0ede8;
  --footer-text-dim: #706c68;
  --footer-border: rgba(255, 255, 255, 0.07);
  --footer-border-hover: rgba(255, 255, 255, 0.2);
  --hero-text: #f0ede8;                    /* ヒーロー濃色面上の文字色 */
  --hero-overlay: rgba(7, 7, 15, 0.5);     /* ヒーロー背景画像上の可読性レイヤ */
  --ghost-border: rgba(240, 237, 232, 0.2);
  --ghost-border-hover: rgba(240, 237, 232, 0.4);
  --ghost-bg-hover: rgba(255, 255, 255, 0.05);
  --page-hero-tint: rgba(74, 13, 20, 0.5); /* 下層ページヒーローの放射色 */
  --shadow-card: none;                     /* カードの影（ライトテーマで使用） */
  --shadow-lift: 0 8px 24px rgba(201, 168, 76, 0.35);

  --font-sans: 'Noto Sans JP', -apple-system, sans-serif;
  --font-serif: 'Noto Serif JP', Georgia, serif;
  --font-display: var(--font-serif);       /* 見出し用（テーマで差し替え可） */

  --radius: 6px;
  --radius-lg: 12px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.75;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ---- Container ---- */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Section base ---- */
.section { padding: 100px 0; }

/* ============================================================
   Scroll Animations
   ============================================================ */
[data-animate] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--transition), transform 0.7s var(--transition);
}
[data-animate].is-visible {
  opacity: 1;
  transform: none;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--gold);
  color: var(--on-accent);
  font-weight: 700;
}
.btn--primary:hover {
  background: var(--gold-light);
  box-shadow: var(--shadow-lift);
}

.btn--outline {
  border: 1px solid var(--gold-border);
  color: var(--gold-light);
  background: transparent;
}
.btn--outline:hover {
  border-color: var(--gold);
  background: var(--gold-dim);
}

.btn--ghost {
  border: 1px solid var(--ghost-border);
  color: var(--text);
  background: transparent;
}
.btn--ghost:hover {
  border-color: var(--ghost-border-hover);
  background: var(--ghost-bg-hover);
}

/* ヒーロー内のゴーストボタンは、賑やかなコラージュ背景の上でも
   読めるよう半透明の濃色を敷いて視認性を上げる */
.hero-v2 .btn--ghost {
  background: rgba(30, 8, 0, 0.35);
  border-color: rgba(255, 248, 239, 0.85);
  color: var(--hero-text);
  font-weight: 700;
}
.hero-v2 .btn--ghost:hover {
  background: rgba(30, 8, 0, 0.5);
  border-color: #ffffff;
}

.btn--invert {
  background: var(--hero-text);
  color: var(--curtain);
  font-weight: 700;
}
.btn--invert:hover {
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(40, 10, 0, 0.25);
}

.btn--lg { padding: 14px 30px; font-size: 15px; }
.btn--full { width: 100%; justify-content: center; }
.btn--sm { padding: 8px 16px; font-size: 13px; }

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0;
  transition: background var(--transition), backdrop-filter var(--transition), box-shadow var(--transition);
}
.nav.is-scrolled {
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 32px;
  max-width: 1280px;
  margin: 0 auto;
}

.nav__logo {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.05em;
  transition: color var(--transition);
}
.nav__logo:hover { color: var(--gold-light); }

.nav__links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav__link {
  font-size: 13px;
  color: var(--text-2);
  letter-spacing: 0.03em;
  transition: color var(--transition);
  position: relative;
}
.nav__link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: width var(--transition);
}
.nav__link:hover,
.nav__link--active { color: var(--text); }
.nav__link:hover::after,
.nav__link--active::after { width: 100%; }

.nav__link--ext {
  font-size: 12px;
  color: var(--text-3);
  padding-left: 24px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
}
.nav__link--ext:hover { color: var(--gold-light); }
.nav__link--ext::after { display: none; }

.nav__right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* スクロールスパイ: 現在地のナビリンク */
.nav__link.is-current { color: var(--text); }
.nav__link.is-current::after { width: 100%; }

/* index（ヒーローが濃色面）用: スクロール前はナビを白文字で重ねる */
.nav--overlay:not(.is-scrolled) .nav__logo { color: var(--hero-text); }
.nav--overlay:not(.is-scrolled) .nav__logo:hover { color: #ffffff; }
.nav--overlay:not(.is-scrolled) .nav__links:not(.is-open) .nav__link { color: var(--hero-text); }
.nav--overlay:not(.is-scrolled) .nav__links:not(.is-open) .nav__link::after { background: var(--hero-text); }
.nav--overlay:not(.is-scrolled) .nav__links:not(.is-open) .nav__link--ext {
  color: rgba(255, 248, 239, 0.75);
  border-left-color: rgba(255, 248, 239, 0.3);
}
.nav--overlay:not(.is-scrolled) .nav__hamburger:not(.is-open) span { background: var(--hero-text); }

/* ハンバーガーメニュー展開中はヘッダー帯を必ず不透明にする
   （ヒーロー上でメニューを開いたとき、上部64pxだけ透けるのを防ぐ） */
.nav.is-menu-open {
  background: var(--nav-bg-solid);
  backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 var(--border);
}
.nav--overlay.is-menu-open .nav__logo { color: var(--text); }
.nav--overlay.is-menu-open .nav__logo:hover { color: var(--gold-light); }

.nav__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}
.nav__hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.nav__hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__hamburger.is-open span:nth-child(2) { opacity: 0; }
.nav__hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   Hero v2（コラージュ背景 + 重ね文字）
   背景画像は renderer.js が .hero-v2__bg に設定する。
   画像なし（heroImage / flyer とも null）でも
   朱赤の装飾背景でそのまま成立する。
   ============================================================ */
.hero-v2 {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 130px 24px 110px;
  overflow: hidden;
  background:
    repeating-linear-gradient(-36deg, transparent 0 18px, rgba(255, 255, 255, 0.04) 18px 19px),
    radial-gradient(ellipse 90% 70% at 50% 8%, rgba(255, 255, 255, 0.12) 0%, transparent 60%),
    linear-gradient(160deg, var(--curtain) 0%, var(--curtain-dark) 100%);
}
.hero-v2__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center 28%;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.hero-v2__bg.is-loaded { opacity: 1; }
.hero-v2::before { /* 背景画像の上に重ねる可読性オーバーレイ */
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse 78% 68% at 50% 48%, rgba(110, 28, 4, 0.48) 0%, transparent 76%),
    var(--hero-overlay);
}
.hero-v2::after { /* 下端を次セクションの紙色に溶かす */
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 96px;
  z-index: 2;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}
.hero-v2__inner {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  color: var(--hero-text);
  text-shadow: 0 1px 18px rgba(60, 10, 0, 0.45); /* 背景画像が賑やかでも読めるように */
}
.hero-v2__inner .btn { text-shadow: none; }

/* 表示時のフェードイン（CSSのみ・JSに依存しない） */
@keyframes hero-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}
.hero-v2__inner > * { animation: hero-in 0.65s cubic-bezier(0.4, 0, 0.2, 1) both; }
.hero-v2__inner > *:nth-child(2) { animation-delay: 0.07s; }
.hero-v2__inner > *:nth-child(3) { animation-delay: 0.14s; }
.hero-v2__inner > *:nth-child(4) { animation-delay: 0.21s; }
.hero-v2__inner > *:nth-child(5) { animation-delay: 0.28s; }
.hero-v2__inner > *:nth-child(6) { animation-delay: 0.35s; }
.hero-v2__inner > *:nth-child(7) { animation-delay: 0.42s; }
.hero-v2__inner > *:nth-child(8) { animation-delay: 0.49s; }

.hero-v2__edition {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.28em;
  padding: 7px 18px 6px;
  border: 1.5px solid rgba(255, 248, 239, 0.65);
  border-radius: 999px;
  margin-bottom: 26px;
}
.hero-v2__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(42px, 9.5vw, 92px);
  line-height: 1.12;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  text-shadow: 0 3px 26px rgba(80, 20, 0, 0.35);
}
.hero-v2__subtitle {
  font-size: 11px;
  letter-spacing: 0.32em;
  font-weight: 500;
  color: rgba(255, 248, 239, 0.85);
  margin-bottom: 34px;
}
.hero-v2__theme {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(19px, 3vw, 27px);
  line-height: 1.75;
  margin-bottom: 30px;
}
.hero-v2__meta {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 26px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 30px;
}
.hero-v2__meta-item { display: inline-flex; align-items: center; gap: 8px; }
.hero-v2__meta-item svg { flex-shrink: 0; opacity: 0.9; }
.hero-v2__actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 34px;
}
.hero-v2__share-row { margin-top: 20px; }
.hero-v2__share-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: rgba(255, 248, 239, 0.8);
  transition: color var(--transition);
}
.hero-v2__share-btn:hover { color: var(--hero-text); }

/* ヒーロー内カウントダウン（濃色面用の白文字 + 中央寄せ） */
.hero-v2 .countdown { justify-content: center; }
.hero-v2 .countdown__num { color: var(--hero-text); }
.hero-v2 .countdown__label { color: rgba(255, 248, 239, 0.75); }
.hero-v2 .countdown__sep { color: rgba(255, 248, 239, 0.55); }
.hero-v2 .countdown__message { color: var(--hero-text); }

/* Countdown */
.countdown {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 0;
  flex-wrap: wrap;
}
.countdown__items {
  display: flex;
  align-items: center;
  gap: 4px;
}
.countdown__items[hidden] { display: none; } /* 開幕後は数字を隠しメッセージのみ表示 */
.countdown__message {
  font-family: var(--font-serif);
  font-size: clamp(16px, 2.2vw, 22px);
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.08em;
}
.countdown__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
}
.countdown__num {
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--text);
  font-family: var(--font-sans);
  letter-spacing: -0.02em;
}
.countdown__label {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--gold);
  margin-top: 6px;
  font-weight: 500;
}
.countdown__sep {
  font-size: 24px;
  color: var(--text-3);
  line-height: 1;
  margin-bottom: 16px;
  font-weight: 300;
}

/* ============================================================
   Section headers
   ============================================================ */
.section-header {
  margin-bottom: 56px;
}
.section-eyebrow {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--gold);
  font-weight: 500;
  margin-bottom: 12px;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
.section-desc {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-2);
  max-width: 560px;
}

/* ============================================================
   Ticket Banner（大きなチケット導線）
   ============================================================ */
.ticket-banner {
  position: relative;
  background:
    repeating-linear-gradient(-36deg, transparent 0 18px, rgba(255, 255, 255, 0.035) 18px 19px),
    linear-gradient(135deg, var(--curtain) 0%, var(--curtain-dark) 100%);
  padding: 84px 0;
  overflow: hidden;
}
.ticket-banner__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 48px;
  align-items: center;
}
.ticket-banner__eyebrow {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: rgba(255, 248, 239, 0.8);
  font-weight: 700;
  margin-bottom: 12px;
}
.ticket-banner__title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 12px;
  color: var(--hero-text);
}
.ticket-banner__desc {
  font-size: 14px;
  color: rgba(255, 248, 239, 0.88);
  line-height: 1.85;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--footer-border);
  padding-top: 60px;
  padding-bottom: 0;
}

.footer__inner {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 48px;
}

.footer__logo {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--footer-text);
}
.footer__tagline {
  font-size: 12px;
  color: var(--footer-text-dim);
}

.footer__nav ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer__nav a {
  font-size: 13px;
  color: var(--footer-text-dim);
  transition: color var(--transition);
}
.footer__nav a:hover { color: var(--footer-text); }

.footer__social-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--footer-text-dim);
  margin-bottom: 12px;
}
.footer__social-links { display: flex; gap: 12px; }
.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--footer-border);
  border-radius: var(--radius);
  color: var(--footer-text-dim);
  transition: color var(--transition), border-color var(--transition);
}
.social-btn:hover {
  color: var(--footer-text);
  border-color: var(--footer-border-hover);
}

.footer__bottom {
  border-top: 1px solid var(--footer-border);
  padding: 20px 0;
  text-align: center;
}
.footer__bottom p {
  font-size: 11px;
  color: var(--footer-text-dim);
  letter-spacing: 0.05em;
}

/* ============================================================
   Responsive
   ============================================================ */
/* ナビはアンカー項目が多いため、タブレット幅からハンバーガーに切り替える */
@media (max-width: 920px) {
  .nav__links { display: none; }
  .nav__links.is-open {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    /* bottom: 0 は使わない：親の .nav に backdrop-filter が付くと
       fixed の基準が .nav（高さ64px）になり、パネルが高さ0に潰れるため */
    height: calc(100vh - 64px);
    height: calc(100dvh - 64px);
    background: var(--nav-bg-solid);
    backdrop-filter: blur(16px);
    padding: 32px 24px;
    z-index: 99;
    overflow-y: auto;
  }
  /* li を全幅にしないと、リンクの区切り線とタップ領域が文字幅だけになってしまう */
  .nav__links.is-open li { width: 100%; }
  .nav__links.is-open .nav__link {
    display: block;
    padding: 16px 0;
    font-size: 18px;
    width: 100%;
    border-bottom: 1px solid var(--border);
  }
  .nav__links.is-open .nav__link--ext {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
    font-size: 18px;
  }
  .nav__hamburger { display: flex; }
}

@media (max-width: 768px) {
  .section { padding: 72px 0; }

  .nav__inner { padding: 0 20px; }

  .countdown__item { min-width: 56px; }
  .countdown__sep { font-size: 18px; }

  .ticket-banner__inner {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
  }

  .footer__inner { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 480px) {
  .container { padding: 0 20px; }
  .section { padding: 56px 0; }
  .section-header { margin-bottom: 36px; }

  .hero-v2 { padding: 108px 20px 96px; }
  .hero-v2__edition { margin-bottom: 20px; }
  .hero-v2__subtitle { margin-bottom: 26px; }
  .hero-v2__meta { flex-direction: column; gap: 8px; }
  .hero-v2__actions { flex-direction: column; width: 100%; }
  .hero-v2__actions .btn { width: 100%; justify-content: center; }
  .countdown { gap: 2px; }
  .countdown__item { min-width: 48px; }
  .countdown__sep { font-size: 16px; }

  .ticket-banner { padding: 56px 0; }

  .footer { padding-top: 48px; }
  .footer__inner { gap: 32px; padding-bottom: 32px; }
}

@media (max-width: 360px) {
  .container { padding: 0 16px; }
  .nav__inner { padding: 0 16px; }
  .nav__logo { font-size: 14px; }
}

/* ============================================================
   Skip Link（キーボードナビゲーション用）
   ============================================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: 12px 24px;
  background: var(--gold);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 14px;
  z-index: 200;
  border-radius: 0 0 var(--radius) 0;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ============================================================
   Focus Visible（キーボードフォーカス輪郭）
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: var(--radius);
}
:focus:not(:focus-visible) { outline: none; }

/* ============================================================
   Back to Top Button
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 50;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--gold-border);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), opacity var(--transition);
  opacity: 0.85;
}
.back-to-top:hover {
  background: var(--bg-card-hover);
  border-color: var(--gold);
  transform: translateY(-3px);
  opacity: 1;
}
.back-to-top[hidden] { display: none; }

@media (max-width: 480px) {
  .back-to-top { bottom: 20px; right: 20px; }
}

/* ============================================================
   prefers-reduced-motion（アニメーション軽減）
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  [data-animate] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
