/* ============================================================
   MAIN — base, layout, header, footer, modal, shared UI
   ============================================================ */

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

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-base);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.45s var(--ease-soft), color 0.45s var(--ease-soft);
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s var(--ease-soft), opacity 0.2s var(--ease-soft);
}
a:hover { opacity: 0.85; }

h1, h2, h3, p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ------------- Skip link ------------- */
.skip-link {
  position: absolute;
  top: -100px;
  right: var(--space-4);
  background: var(--accent);
  color: var(--accent-contrast);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 1000;
  font-weight: 700;
  transition: top 0.25s var(--ease);
}
.skip-link:focus { top: var(--space-4); }

/* ------------- Header / Nav ------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  background: var(--glass);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: var(--maxw);
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover { opacity: 1; }
.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.7);
}

.nav-links {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.nav-links a {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: background 0.2s var(--ease-soft), color 0.2s var(--ease-soft);
}
.nav-links a:hover { color: var(--text); background: var(--surface); opacity: 1; }
.nav-links a.active {
  color: var(--accent-contrast);
  background: var(--accent);
}

/* ------------- Theme toggle ------------- */
.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease-soft);
}
.theme-toggle:hover { transform: rotate(20deg) scale(1.06); background: var(--surface-strong); }
.theme-toggle:active { transform: scale(0.94); }

/* ------------- Footer ------------- */
.site-footer {
  margin-top: auto;
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

/* ------------- Page layout ------------- */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--space-7) var(--space-5) var(--space-8);
  width: 100%;
}
.page-head {
  text-align: center;
  margin-bottom: var(--space-7);
}
.page-title {
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2);
}
.page-sub { color: var(--text-muted); font-size: 1.05rem; }

.empty-state {
  text-align: center;
  color: var(--text-faint);
  padding: var(--space-8) var(--space-4);
  font-size: 1.1rem;
}

/* ============================================================
   MODAL (shared by video / image / voice)
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: var(--space-5);
}
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  animation: fadeIn 0.3s var(--ease) both;
}

.modal-box {
  position: relative;
  z-index: 1;
  width: min(900px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: popIn 0.4s var(--ease) both;
}

.modal-close {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 3;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--bg-elev-2);
  color: var(--text);
  font-size: 1.05rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease-soft);
}
.modal-close:hover { transform: scale(1.1) rotate(90deg); background: var(--accent); color: var(--accent-contrast); }

.modal-media {
  background: #000;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
}
.modal-video, .modal-image {
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  background: #000;
}

.modal-media--audio {
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  padding: var(--space-7) var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
}
.modal-audio { width: 100%; }

.audio-visual {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 70px;
}
.audio-visual span {
  width: 8px;
  border-radius: 6px;
  background: var(--accent);
  animation: wave 1.1s ease-in-out infinite;
}
.audio-visual span:nth-child(1) { height: 30%; animation-delay: 0s; }
.audio-visual span:nth-child(2) { height: 65%; animation-delay: 0.1s; }
.audio-visual span:nth-child(3) { height: 100%; animation-delay: 0.2s; }
.audio-visual span:nth-child(4) { height: 50%; animation-delay: 0.3s; }
.audio-visual span:nth-child(5) { height: 80%; animation-delay: 0.4s; }
.audio-visual span:nth-child(6) { height: 40%; animation-delay: 0.5s; }
.audio-visual span:nth-child(7) { height: 90%; animation-delay: 0.6s; }
.audio-visual span:nth-child(8) { height: 55%; animation-delay: 0.7s; }
.audio-visual span:nth-child(9) { height: 70%; animation-delay: 0.8s; }
.audio-visual span:nth-child(10){ height: 35%; animation-delay: 0.9s; }

.modal-info { padding: var(--space-5) var(--space-6) var(--space-6); }
.modal-title { font-size: 1.5rem; font-weight: 800; margin-bottom: var(--space-2); }
.modal-desc { color: var(--text-muted); font-size: 1rem; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes wave {
  0%, 100% { transform: scaleY(0.4); }
  50%      { transform: scaleY(1); }
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ------------- Responsive ------------- */
@media (max-width: 640px) {
  .nav { padding: 0 var(--space-4); }
  .nav-links { gap: 0; }
  .nav-links a { padding: var(--space-2); font-size: 0.85rem; }
  .brand { font-size: 1rem; }
  .modal { padding: var(--space-3); }
}
