/* ============================================================
   heritage.css — 世界遺産図鑑（/heritage/）共通スタイル
   トークンは /design-system/colors_and_type.css + /site-tokens.css を参照
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans JP', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  line-height: 1.75;
}

/* 固定背景（WebGL失敗時の土台） */
.scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 55% 45% at 85%  8%, rgba(154,243,171,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 40% 35% at  5% 85%, rgba(110,231,183,0.07) 0%, transparent 60%),
    linear-gradient(160deg, #070E09 0%, #0C1A0F 50%, #070E09 100%);
}

/* ========== NAV（本体と同型） ========== */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 48px;
  background: rgba(7, 14, 9, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--glass-border);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-mid));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo img { width: 32px; height: 32px; }
.nav-links { display: flex; gap: 36px; list-style: none; }
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--brand); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  width: 40px; height: 40px;
  padding: 0 8px;
  background: transparent;
  border: none;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease;
}
.nav-toggle span + span { margin-top: 6px; }
nav.open .nav-toggle span:first-child { transform: translateY(4px) rotate(45deg); }
nav.open .nav-toggle span:last-child  { transform: translateY(-4px) rotate(-45deg); }
.nav-menu {
  display: none;
  position: absolute;
  top: 100%; left: 0; right: 0;
  flex-direction: column;
  padding: 6px 24px 18px;
  background: rgba(7, 14, 9, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--glass-border);
}
nav.open .nav-menu { display: flex; }
.nav-menu a {
  padding: 13px 0;
  color: var(--text);
  text-decoration: none;
  font-size: 14.5px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.nav-menu a:last-child { border-bottom: none; }

/* ========== HERO（図鑑トップ） ========== */
.dex-hero {
  position: relative;
  min-height: 78vh;
  min-height: 78svh;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.hero-gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.8s ease;
  pointer-events: none;
}
html.gl .hero-gl { opacity: 1; }
.dex-hero-inner {
  position: relative;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 150px 48px 90px;
}
.dex-hero h1 {
  font-size: clamp(38px, 6.4vw, 78px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}
.grad {
  background: linear-gradient(130deg, var(--brand) 0%, var(--brand-mid) 60%, #5EEAD4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.dex-thesis {
  font-size: clamp(14.5px, 1.5vw, 16.5px);
  color: var(--text);
  font-weight: 500;
  margin-bottom: 14px;
}
.dex-lead {
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.9;
  max-width: 640px;
  margin-bottom: 44px;
}

/* 進捗カウンター */
.dex-counters {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.dex-counter {
  padding: 20px 26px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-s);
  backdrop-filter: blur(16px);
  min-width: 168px;
}
.dex-counter-n {
  font-family: var(--font-num);
  font-size: clamp(28px, 3.1vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--brand), var(--brand-mid));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-variant-numeric: tabular-nums;
}
.dex-counter-n small { font-size: 0.52em; color: var(--text-muted); -webkit-text-fill-color: var(--text-muted); font-family: var(--font-num); }
.dex-counter-l { font-size: 11px; color: var(--text-muted); margin-top: 6px; letter-spacing: 0.04em; }

/* ========== セクション共通 ========== */
.section {
  padding: 84px 48px;
  max-width: 1160px;
  margin: 0 auto;
}
.label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--brand);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.s-title {
  font-size: clamp(24px, 3.2vw, 38px);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.015em;
  margin-bottom: 10px;
}
.s-sub {
  font-size: 14.5px;
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: 44px;
  line-height: 1.8;
}
.rule {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
  max-width: 1160px;
  margin: 0 auto;
}

/* ========== 並べ替えトグル ========== */
.sort-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  margin-bottom: 32px;
}
.sort-btn {
  padding: 7px 18px;
  border: none;
  border-radius: 100px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.sort-btn:hover:not(.active) { color: var(--text); }
.sort-btn.active { background: var(--brand); color: var(--text-dark); }

/* ========== 国カードグリッド ========== */
.country-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.country-card {
  display: block;
  padding: 16px 18px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-s);
  backdrop-filter: blur(16px);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
}
.country-card:hover {
  background: var(--glass-bg-hover);
  border-color: rgba(154,243,171,0.32);
  transform: translateY(-3px);
}
.country-name {
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 3px;
}
.country-name .flag { margin-right: 0.4em; font-size: 1.05em; }
.country-en {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.country-count {
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ========== 国別ページ ========== */
.crumbs {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 26px;
}
.crumbs a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.crumbs a:hover { color: var(--brand); }
.crumbs .sep { margin: 0 8px; opacity: 0.5; }

.country-hero {
  position: relative;
  overflow: hidden;
  padding-top: 108px;
}
.country-hero .section { padding-top: 40px; padding-bottom: 48px; }
.country-hero h1 {
  font-size: clamp(34px, 5vw, 60px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.12;
  margin-bottom: 6px;
}
.country-hero h1 .flag {
  display: inline-block;
  -webkit-text-fill-color: initial;
  font-size: 0.82em;
  margin-right: 0.18em;
  transform: translateY(-0.02em);
}
.country-hero .en-sub {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 26px;
}
.country-hero .dex-counters { margin-top: 8px; }

/* エントリカード（訪問済み） */
.entries { display: flex; flex-direction: column; gap: 16px; }
.entry {
  display: grid;
  grid-template-columns: 340px 1fr;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-m);
  backdrop-filter: blur(20px);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.entry:hover { background: var(--glass-bg-hover); border-color: rgba(154,243,171,0.26); }
.entry.no-video { grid-template-columns: 1fr; }

.entry-body { padding: 26px 30px 24px; min-width: 0; }
.entry-title {
  font-size: clamp(17px, 1.9vw, 21px);
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 3px;
}
.entry-en {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}
.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.entry-meta .cat { color: var(--brand); font-weight: 600; }
.entry-meta .danger { color: var(--brand); border: 1px solid rgba(154,243,171,0.35); border-radius: 100px; padding: 0 9px; font-size: 10px; }
.entry-cta { display: inline-block; font-size: 11.5px; color: var(--brand); font-weight: 500; }
.entry:hover .entry-cta { text-decoration: underline; }
.entry-soon {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  padding: 2px 11px;
  margin-bottom: 12px;
}

/* YouTubeサムネ（.entry がリンク全体なので再生アイコンは装飾のみ） */
.yt-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background-color: rgba(255,255,255,0.03);
  background-size: cover;
  background-position: center;
  border-right: 1px solid var(--glass-border);
  min-height: 190px;
}
.yt-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7,14,9,0.05), rgba(7,14,9,0.35));
  transition: background 0.3s ease;
}
.entry:hover .yt-thumb::before { background: rgba(7,14,9,0.05); }
.yt-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: center / 64px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Ccircle cx='32' cy='32' r='32' fill='%23000000' fill-opacity='.45'/%3E%3Cpath d='M25 18 L47 32 L25 46 Z' fill='%23ffffff' stroke='%23ffffff' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
  filter: drop-shadow(0 4px 18px rgba(0,0,0,0.3));
  transition: transform 0.25s ease;
}
.entry:hover .yt-thumb::after { transform: scale(1.06); }

/* 未訪問（locked）行 */
.locked-head {
  margin-top: 56px;
  margin-bottom: 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.locked-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}
.locked-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 12.5px;
  color: var(--text-muted);
  opacity: 0.62;
}
.locked-item .y { font-family: var(--font-num); font-size: 11.5px; white-space: nowrap; }

/* 図鑑トップへ戻る・本体への導線 */
.backlink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 48px;
  color: var(--brand);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.backlink:hover { text-decoration: underline; }

/* ========== FOOTER ========== */
footer {
  border-top: 1px solid var(--glass-border);
  padding: 0 48px;
  color: var(--text-muted);
  font-size: 12.5px;
  margin-top: 60px;
}
.footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 32px 0 22px;
}
.footer-nav { display: flex; gap: 28px; list-style: none; }
.footer-nav a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.footer-nav a:hover { color: var(--brand); }
.footer-copy {
  max-width: 1160px;
  margin: 0 auto;
  text-align: center;
  font-size: 11.5px;
  padding: 16px 0 26px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

/* ========== SCROLL REVEAL ========== */
html.anim .country-card,
html.anim .entry,
html.anim .dex-counter,
html.anim .s-title,
html.anim .label,
html.anim .s-sub {
  opacity: 0;
  transform: translateY(20px);
}
.reveal {
  transition: opacity 0.8s cubic-bezier(.2,.8,.2,1),
              transform 0.8s cubic-bezier(.2,.8,.2,1);
  will-change: opacity, transform;
}
html.anim .reveal.is-visible { opacity: 1; transform: none; }

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .country-grid { grid-template-columns: repeat(3, 1fr); }
  .entry { grid-template-columns: 1fr; }
  .yt-thumb { border-right: none; border-bottom: 1px solid var(--glass-border); }
  .locked-list { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  nav { padding: 12px 16px 12px 24px; }
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .section { padding-left: 24px; padding-right: 24px; }
  .dex-hero-inner { padding: 118px 24px 70px; }
  .country-grid { grid-template-columns: repeat(2, 1fr); }
  .dex-counter { min-width: calc(50% - 8px); flex: 1; padding: 16px 18px; }
  footer { padding-left: 24px; padding-right: 24px; }
  .footer-inner { flex-direction: column; text-align: center; justify-content: center; }
}
