/* ===== Design Tokens ===== */
:root {
  --accent: #E8651A;
  --accent-light: #F4943E;
  --accent-glow: rgba(232, 101, 26, 0.3);
  --overlay: rgba(20, 18, 16, 0.82);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a0f;
}

body {
  font-family: 'Noto Sans KR', sans-serif;
}

.hidden {
  display: none !important;
}

/* ===== Spline Canvas ===== */
#canvas3d {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ===== Scene Title ===== */
.scene-title {
  position: fixed;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-family: 'Noto Serif KR', serif;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 6px;
  color: #6B6B6B;
  white-space: nowrap;
  pointer-events: none;
  animation: fadeInUp 0.8s ease forwards;
}

/* ===== Loading Screen ===== */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0a0908;
  transition: opacity 1.2s ease, transform 1.2s ease;
}

.loading-screen.fade-out {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

/* -- Atmosphere -- */
.atmosphere {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.warm-glow {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(232, 101, 26, 0.08), transparent 70%);
  opacity: 0;
  animation: glow-breathe 6s ease-in-out infinite;
  animation-delay: 2s;
}

@keyframes glow-breathe {
  0%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
  pointer-events: none;
}

.snow-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* -- Horizon Line -- */
.horizon-line {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 236, 232, 0.12), transparent);
  animation: horizon-expand 4s ease-out 1s forwards;
}

@keyframes horizon-expand {
  0% { width: 0; }
  100% { width: min(500px, 70vw); }
}

/* -- Loading Content -- */
.loading-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
}

.kanji-deco {
  font-family: 'Noto Serif KR', serif;
  font-size: 11px;
  letter-spacing: 12px;
  color: rgba(240, 236, 232, 0.12);
  font-weight: 200;
  opacity: 0;
  animation: text-rise 2s ease-out 0.5s forwards;
  margin-bottom: 40px;
}

/* -- Title Lines -- */
.title-line {
  overflow: hidden;
  margin-bottom: 4px;
}

.title-line span {
  display: inline-block;
  transform: translateY(100%);
  opacity: 0;
}

.title-line-1 span {
  font-family: 'Noto Serif KR', serif;
  font-size: clamp(13px, 2.5vw, 16px);
  font-weight: 300;
  color: rgba(240, 236, 232, 0.4);
  letter-spacing: 8px;
  animation: text-slide-up 1.2s cubic-bezier(0.16, 1, 0.3, 1) 1.5s forwards;
}

.title-line-2 span {
  font-family: 'Noto Serif KR', serif;
  font-size: clamp(28px, 5.5vw, 44px);
  font-weight: 300;
  color: rgba(240, 236, 232, 0.9);
  letter-spacing: 6px;
  animation: text-slide-up 1.2s cubic-bezier(0.16, 1, 0.3, 1) 2s forwards;
  margin-top: 8px;
}

.title-line-3 span {
  font-family: 'Noto Serif KR', serif;
  font-size: clamp(28px, 5.5vw, 44px);
  font-weight: 300;
  color: rgba(240, 236, 232, 0.9);
  letter-spacing: 6px;
  animation: text-slide-up 1.2s cubic-bezier(0.16, 1, 0.3, 1) 2.3s forwards;
}

@keyframes text-slide-up {
  0% { transform: translateY(100%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* -- Accent Dot (loading) -- */
.loading-content .accent-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #E8651A;
  margin: 20px 0;
  opacity: 0;
  animation: dot-appear 0.8s ease 2.8s forwards;
  box-shadow: 0 0 12px #E8651A, 0 0 40px rgba(232, 101, 26, 0.15);
}

@keyframes dot-appear {
  0% { opacity: 0; transform: scale(0); }
  60% { transform: scale(1.5); }
  100% { opacity: 1; transform: scale(1); }
}

/* -- Loading Message -- */
.loading-message {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 13px;
  font-weight: 300;
  color: rgba(240, 236, 232, 0.4);
  letter-spacing: 3px;
  opacity: 0;
  animation: text-rise 1.5s ease-out 3.5s forwards;
  margin-top: 4px;
}

@keyframes text-rise {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

.ellipsis span {
  opacity: 0;
  animation: ellipsis-blink 1.5s ease-in-out infinite;
}
.ellipsis span:nth-child(1) { animation-delay: 0s; }
.ellipsis span:nth-child(2) { animation-delay: 0.3s; }
.ellipsis span:nth-child(3) { animation-delay: 0.6s; }

@keyframes ellipsis-blink {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

/* -- Bottom Info -- */
.bottom-info {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 0;
  animation: text-rise 1.5s ease-out 4.5s forwards;
}

.season-label {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 10px;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: rgba(240, 236, 232, 0.12);
  font-weight: 100;
}

.year-label {
  font-family: 'Noto Serif KR', serif;
  font-size: 12px;
  font-weight: 200;
  color: rgba(240, 236, 232, 0.12);
  letter-spacing: 4px;
}

/* -- Progress Bar -- */
.progress-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(240, 236, 232, 0.12);
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #E8651A, rgba(232, 101, 26, 0.3));
  box-shadow: 0 0 8px #E8651A;
  animation: progress-fill 7s cubic-bezier(0.4, 0, 0.2, 1) 1s forwards;
  transition: width 0.3s ease;
}

@keyframes progress-fill {
  0% { width: 0; }
  30% { width: 35%; }
  60% { width: 65%; }
  85% { width: 88%; }
  100% { width: 95%; }
}

@media (prefers-reduced-motion: reduce) {
  .loading-screen { transition: opacity 0.3s ease; }
  .title-line span { transform: none; opacity: 1; animation: none; }
  .kanji-deco, .loading-message, .bottom-info { opacity: 1; animation: none; }
  .loading-content .accent-dot { opacity: 1; animation: none; }
  .warm-glow { animation: none; }
  .horizon-line { animation: none; width: min(500px, 70vw); }
}

/* ===== Hint Text ===== */
#hint {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
  animation: fadeInUp 0.8s ease forwards;
}

.hint-mobile {
  display: none;
}

#hint p {
  color: rgba(60, 55, 50, 0.6);
  font-family: 'Noto Serif KR', serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-align: center;
  padding: 10px 28px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ===== Overlay ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.overlay.visible {
  opacity: 1;
  pointer-events: all;
}

/* ===== Floating Particles ===== */
.particles {
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease 0.3s;
}

.particles.visible {
  opacity: 1;
}

.particle {
  position: absolute;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: float-particle 4s ease-in-out infinite;
}

@keyframes float-particle {
  0%, 100% { opacity: 0; transform: translateY(0) scale(0); }
  20%       { opacity: 0.6; transform: translateY(-20px) scale(1); }
  80%       { opacity: 0.2; transform: translateY(-80px) scale(0.5); }
}

@media (prefers-reduced-motion: reduce) {
  .particle { animation: none; }
}

/* ===== Testimony Card (Unfolding) ===== */
.testimony-card {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  top: 50%;
  left: 50%;
  width: 80px;
  height: 28px;
  transform: translate(-50%, -50%);
  border-radius: 14px;
  background: var(--accent);
  overflow: hidden;
  transition: all 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.testimony-card.unfolding {
  opacity: 1;
  pointer-events: all;
  width: min(680px, 90vw);
  height: min(82vh, 760px);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 -2px 20px rgba(255, 255, 255, 0.05) inset;
}

/* Bottom fade — scroll hint */
.testimony-card.unfolding::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to top, rgba(30, 25, 20, 0.5), transparent);
  border-radius: 0 0 28px 28px;
  z-index: 5;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .testimony-card {
    transition: opacity 0.3s ease, width 0s, height 0s, border-radius 0s;
  }
}

/* ===== Card Inner Content ===== */
.testimony-inner {
  opacity: 0;
  transition: opacity 0.5s ease 0.4s;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.testimony-card.unfolding .testimony-inner {
  opacity: 1;
}

/* ===== Close Button ===== */
.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
  z-index: 10;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  transform: rotate(90deg);
}

/* ===== Profile Header ===== */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 36px 40px 28px;
  position: relative;
  flex-shrink: 0;
}

.profile-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 40px;
  right: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
}

.profile-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  position: relative;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.profile-photo .initials {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Noto Serif KR', serif;
  font-size: 24px;
  font-weight: 700;
  color: white;
}

.member-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.member-info h2 {
  font-family: 'Noto Serif KR', serif;
  font-size: 22px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.5px;
  line-height: 1.3;
}

.member-info p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ===== Accent Bar ===== */
.accent-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 40px;
  flex-shrink: 0;
}

.accent-line {
  width: 32px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.accent-label {
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent-light);
  font-weight: 500;
}

/* ===== Testimony Content ===== */
.testimony-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 40px 36px;
  scroll-behavior: smooth;
}

.testimony-content::-webkit-scrollbar {
  width: 4px;
}

.testimony-content::-webkit-scrollbar-track {
  background: transparent;
}

.testimony-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.quote-mark {
  font-family: 'Noto Serif KR', serif;
  font-size: 64px;
  line-height: 1;
  color: var(--accent);
  opacity: 0.3;
  margin-bottom: -12px;
  display: block;
}

.testimony-text {
  font-family: 'Noto Serif KR', serif;
  font-size: 16px;
  line-height: 2;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 400;
  word-break: keep-all;
}

.testimony-text p {
  margin-bottom: 1.5em;
}

.testimony-text p:last-child {
  margin-bottom: 0;
}

/* ===== Navigation Dots ===== */
.nav-dots {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.5s ease 0.6s;
  pointer-events: none;
}

.nav-dots.visible {
  opacity: 1;
  pointer-events: all;
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.nav-dot.active {
  background: var(--accent);
  width: 24px;
  border-radius: 4px;
}

.nav-dot:hover:not(.active) {
  background: rgba(255, 255, 255, 0.4);
}

/* ===== Navigation Arrows ===== */
.nav-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 250;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(232, 101, 26, 0.3);
  background: rgba(232, 101, 26, 0.1);
  backdrop-filter: blur(10px);
  color: var(--accent);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s ease 0.5s;
}

.nav-arrow.visible {
  opacity: 1;
  pointer-events: all;
}

.nav-arrow:hover {
  background: rgba(232, 101, 26, 0.2);
  color: var(--accent-light);
  border-color: rgba(232, 101, 26, 0.5);
}

.nav-arrow.prev { left: max(20px, calc(50% - 400px)); }
.nav-arrow.next { right: max(20px, calc(50% - 400px)); }

/* ===== backdrop-filter fallback ===== */
@supports not (backdrop-filter: blur(1px)) {
  .testimony-card.unfolding {
    background: rgba(20, 18, 16, 0.95);
  }
  .overlay {
    background: rgba(10, 9, 8, 0.92);
  }
}

/* ===== Cursor for clickable objects ===== */
canvas {
  cursor: default;
}

canvas.hovered {
  cursor: pointer;
}

/* ===== Notion Link ===== */
.notion-link {
  position: fixed;
  bottom: 32px;
  right: 20px;
  z-index: 10;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: rgba(0, 0, 0, 0.18);
  text-decoration: none;
  padding: 8px 20px;
  border-radius: 100px;
  transition: color 0.3s ease, background 0.3s ease;
}

.notion-link:hover {
  color: rgba(0, 0, 0, 0.45);
  background: rgba(0, 0, 0, 0.04);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .kanji-deco { letter-spacing: 8px; font-size: 10px; margin-bottom: 28px; }
  .bottom-info { bottom: 28px; }
  .warm-glow { width: 350px; height: 350px; }
  .grain { display: none; }
  .loading-screen { will-change: opacity, transform; }
  .snow-canvas { will-change: transform; }

  .scene-title {
    font-size: 14px;
    top: 80px;
  }

  .hint-desktop {
    display: none !important;
  }

  .hint-mobile {
    display: inline-block !important;
    font-size: 10px;
    padding: 6px 16px;
    white-space: nowrap;
    width: auto;
  }

  .notion-link {
    bottom: 12px;
    right: 12px;
    font-size: 10px;
    padding: 4px 8px;
  }

  .nav-dots.visible {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .nav-dots.visible.at-bottom {
    opacity: 1;
    pointer-events: all;
  }

  .testimony-card.unfolding {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    padding-top: env(safe-area-inset-top, 0px);
  }

  .testimony-card.unfolding::before {
    border-radius: 0;
  }

  .profile-header {
    padding: 36px 24px 20px;
  }

  .profile-header::after {
    left: 24px;
    right: 24px;
  }

  .profile-photo {
    width: 56px;
    height: 56px;
  }

  .profile-photo .initials {
    font-size: 20px;
  }

  .member-info h2 {
    font-size: 18px;
  }

  .accent-bar {
    padding: 16px 24px;
  }

  .testimony-content {
    padding: 0 24px 80px;
  }

  .testimony-text {
    font-size: 15px;
    line-height: 1.9;
  }

  .nav-arrow {
    background: transparent;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .nav-arrow:hover {
    background: transparent;
    border: none;
  }

  .nav-arrow.prev { left: 0; }
  .nav-arrow.next { right: 0; }
}
