/* =========================================================
   지영's 꽃밭 — styles for the travelling journey
   ========================================================= */

:root {
  --ink: #4a3340;
  --ink-soft: #7a6470;
  --bloom: #ff7fa8;
  --bloom-deep: #e85d8a;
  --gold: #ffcf6e;
  --leaf: #8fc88a;
  --glass: rgba(255, 252, 250, 0.58);
  --glass-strong: rgba(255, 252, 250, 0.82);
  --glass-line: rgba(255, 255, 255, 0.72);
  --shadow: 0 18px 50px -20px rgba(120, 70, 95, 0.45);

  --serif: "Cormorant Garamond", "Gowun Batang", Georgia, serif;
  --kserif: "Gowun Batang", "Nanum Myeongjo", "Apple SD Gothic Neo", serif;
  --sans: "Gowun Dodum", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --hand: "Gaegu", "Gowun Dodum", cursive;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #ffe9f1;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

[hidden] { display: none !important; }

/* ---------- background ---------- */
#garden {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; z-index: 0; cursor: grab;
}
#garden:active { cursor: grabbing; }

.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.05; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 95% at 50% 20%, transparent 55%, rgba(80, 40, 65, 0.2) 100%);
}

/* ---------- top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px clamp(18px, 4vw, 48px); pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  background: none; border: 0; cursor: pointer; color: var(--ink);
  font-family: var(--serif); font-size: 20px; letter-spacing: 0.02em;
  opacity: 0; transform: translateY(-8px);
  animation: drop-in 1s var(--ease) 0.3s forwards;
}
.brand-mark { font-size: 18px; color: var(--bloom-deep); animation: spin-slow 14s linear infinite; }
.brand-name { font-weight: 500; }

.ghost-btn {
  background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--ink-soft); font-family: var(--sans); font-size: 13px;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  transition: transform 0.3s var(--ease), color 0.3s, background 0.3s;
}
.ghost-btn:hover { transform: translateY(-2px); color: var(--bloom-deep); }
#sound-btn { opacity: 0; animation: drop-in 1s var(--ease) 0.5s forwards; }

/* ---------- shared buttons / type ---------- */
.cta {
  position: relative; display: inline-flex; align-items: center; gap: 12px;
  padding: 15px 28px; border: 0; border-radius: 999px; cursor: pointer;
  font-family: var(--sans); font-size: clamp(15px, 1.8vw, 17px); color: #fff;
  background: linear-gradient(120deg, var(--bloom), var(--bloom-deep));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.4s var(--ease), filter 0.4s; overflow: hidden;
}
.cta::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 140% at 0% 0%, rgba(255, 255, 255, 0.5), transparent 50%);
  opacity: 0.6;
}
.cta:hover { transform: translateY(-3px) scale(1.02); filter: saturate(1.1); }
.cta:active { transform: translateY(-1px) scale(0.99); }
.cta-arrow { transition: transform 0.4s var(--ease); }
.cta:hover .cta-arrow { transform: translateX(5px); }

.eyebrow {
  font-size: clamp(12px, 1.4vw, 14px); letter-spacing: 0.42em;
  text-transform: uppercase; color: var(--ink-soft); margin: 0 0 26px;
}

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 35;
  display: flex; align-items: center; justify-content: center;
  padding: 90px clamp(20px, 5vw, 60px);
}

/* INTRO */
.intro {
  background: radial-gradient(90% 70% at 50% 45%, rgba(255, 248, 251, 0.35), transparent 70%);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.intro.leaving { opacity: 0; transform: scale(1.05); pointer-events: none; }
.intro-inner { width: min(720px, 100%); text-align: center; }

.hero-title {
  font-family: var(--serif); font-weight: 500; line-height: 1.02; margin: 0;
  font-size: clamp(48px, 11vw, 130px); letter-spacing: -0.01em;
}
.hero-title span { display: block; }
.hero-accent {
  font-family: var(--kserif); font-weight: 700;
  background: linear-gradient(100deg, var(--bloom-deep), var(--gold) 55%, var(--leaf));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 16px rgba(232, 93, 138, 0.25));
}
.hero-sub { margin: 26px 0 0; font-size: clamp(16px, 2.2vw, 21px); color: var(--ink-soft); font-family: var(--kserif); }
.intro .cta { margin-top: 40px; }
.scroll-hint {
  margin: 34px 0 0; font-size: 12px; letter-spacing: 0.32em;
  text-transform: uppercase; color: var(--ink-soft); opacity: 0.7;
  animation: breathe 2.6s ease-in-out infinite;
}

/* ---------- travel hint toast ---------- */
.travel-hint {
  position: fixed; left: 50%; top: 16%; z-index: 32;
  transform: translate(-50%, -12px); text-align: center;
  opacity: 0; transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  pointer-events: none;
}
.travel-hint.show { opacity: 1; transform: translate(-50%, 0); }
.th-line {
  font-family: var(--serif); font-size: clamp(26px, 4.6vw, 46px);
  line-height: 1.18; margin: 0 0 4px; color: var(--ink);
  text-shadow: 0 2px 18px rgba(255, 250, 252, 0.6);
}
.th-line em { font-family: var(--kserif); font-style: normal; font-weight: 700; color: var(--bloom-deep); }
.th-controls {
  margin: 20px 0 0; font-family: var(--sans); font-size: 14px; color: var(--ink-soft);
  display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center;
}
.key {
  display: inline-block; padding: 3px 10px; border-radius: 8px;
  background: var(--glass-strong); border: 1px solid var(--glass-line);
  font-size: 12px; color: var(--ink); box-shadow: 0 2px 8px rgba(120, 70, 95, 0.15);
}

/* ---------- station panel ---------- */
.station-panel {
  position: fixed; left: 50%; top: 22%; z-index: 33;
  transform: translate(-50%, 14px) scale(0.96);
  width: min(440px, 86vw); text-align: center;
  padding: 30px 30px 26px; border-radius: 30px;
  background: var(--glass-strong); border: 1px solid var(--glass-line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.station-panel.show { opacity: 1; transform: translate(-50%, 0) scale(1); pointer-events: auto; }
.station-num {
  font-family: var(--serif); font-size: 16px; letter-spacing: 0.2em;
  color: var(--bloom-deep); opacity: 0.8;
}
.station-ko { font-family: var(--kserif); font-weight: 700; font-size: clamp(24px, 4vw, 34px); margin: 6px 0 10px; color: var(--ink); }
.station-en { font-family: var(--serif); font-style: italic; font-size: clamp(16px, 2.2vw, 20px); color: var(--ink-soft); margin: 0 0 22px; }

/* ---------- chapter overlay ---------- */
.chapter {
  align-items: flex-end; justify-content: center;
  background: rgba(70, 40, 60, 0.18);
  opacity: 0; transition: opacity 0.5s var(--ease-soft);
}
.chapter.show { opacity: 1; }
.chapter-inner {
  width: min(760px, 100%); max-height: 82vh; overflow: auto;
  text-align: left; padding: 36px clamp(26px, 4vw, 48px) 40px;
  border-radius: 34px 34px 0 0;
  background: var(--glass-strong); border: 1px solid var(--glass-line); border-bottom: 0;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 -20px 60px -24px rgba(90, 50, 70, 0.5);
  transform: translateY(40px); transition: transform 0.5s var(--ease);
}
.chapter.show .chapter-inner { transform: none; }

.back-btn {
  background: none; border: 0; color: var(--ink-soft); cursor: pointer;
  font-family: var(--sans); font-size: 14px; padding: 4px 0; margin-bottom: 18px;
  transition: color 0.3s, transform 0.3s;
}
.back-btn:hover { color: var(--bloom-deep); transform: translateX(-3px); }
.chapter-index { font-family: var(--serif); font-size: clamp(38px, 7vw, 70px); line-height: 1; margin: 0; color: var(--bloom); opacity: 0.55; }
.chapter-title { font-family: var(--kserif); font-weight: 700; font-size: clamp(26px, 4.6vw, 46px); margin: 4px 0 16px; color: var(--ink); }
.chapter-quote {
  font-family: var(--serif); font-style: italic; font-size: clamp(18px, 2.6vw, 26px);
  color: var(--bloom-deep); margin: 0 0 24px; padding-left: 18px; border-left: 3px solid var(--bloom);
}
.chapter-body { font-family: var(--kserif); font-size: clamp(15px, 1.9vw, 18px); line-height: 1.95; color: var(--ink-soft); }
.chapter-body p { margin: 0 0 1.1em; }
.chapter-placeholder {
  display: inline-block; margin-top: 6px; padding: 4px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.5); border: 1px dashed var(--bloom);
  color: var(--bloom-deep); font-family: var(--hand); font-size: 16px;
}
.chapter-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }

/* ---------- intro alt link ---------- */
.intro-alt { margin-top: 18px; }
.text-link {
  background: none; border: 0; cursor: pointer;
  font-family: var(--sans); font-size: 14px; color: var(--ink-soft);
  border-bottom: 1px dashed currentColor; padding: 2px 2px 3px;
  transition: color 0.3s, transform 0.3s;
}
.text-link:hover { color: var(--bloom-deep); transform: translateY(-1px); }

/* ---------- map overlay (free navigation) ---------- */
.map-overlay {
  z-index: 38; background: rgba(70, 40, 60, 0.22);
  opacity: 0; transition: opacity 0.45s var(--ease-soft);
}
.map-overlay.show { opacity: 1; }
.map-inner {
  position: relative; width: min(900px, 100%); max-height: 84vh; overflow: auto;
  text-align: center; padding: 38px clamp(22px, 4vw, 44px) 32px;
  border-radius: 32px;
  background: var(--glass-strong); border: 1px solid var(--glass-line);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  transform: translateY(28px) scale(0.98); transition: transform 0.45s var(--ease);
}
.map-overlay.show .map-inner { transform: none; }
.map-close {
  position: absolute; top: 16px; right: 18px; width: 34px; height: 34px;
  border-radius: 50%; border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, 0.6); color: var(--ink-soft);
  font-size: 15px; cursor: pointer; transition: transform 0.3s, color 0.3s, background 0.3s;
}
.map-close:hover { transform: rotate(90deg); color: var(--bloom-deep); background: #fff; }
.map-eyebrow {
  font-family: var(--sans); letter-spacing: 0.3em; text-transform: uppercase;
  font-size: 12px; color: var(--ink-soft); margin: 0 0 8px;
}
.map-title { font-family: var(--kserif); font-weight: 700; font-size: clamp(26px, 4.4vw, 40px); margin: 0 0 8px; color: var(--ink); }
.map-sub { font-family: var(--kserif); font-size: 14px; color: var(--ink-soft); margin: 0 0 26px; }

.map-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(134px, 1fr));
  gap: clamp(12px, 1.6vw, 18px);
}
.map-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 22px 14px 18px; border-radius: 22px; cursor: pointer; text-align: center;
  background: var(--glass); border: 1px solid var(--glass-line);
  box-shadow: 0 12px 30px -20px rgba(90, 50, 70, 0.5);
  transition: transform 0.45s var(--ease), box-shadow 0.45s, background 0.45s;
}
.map-card:hover { transform: translateY(-7px); background: rgba(255, 255, 255, 0.78); box-shadow: 0 22px 44px -22px rgba(90, 50, 70, 0.55); }
.map-card:focus-visible { outline: 3px solid var(--bloom); outline-offset: 3px; }
.map-num { position: absolute; top: 10px; left: 14px; font-family: var(--serif); font-size: 13px; color: var(--ink-soft); opacity: 0.7; }
.map-flower { width: 56px; height: 56px; filter: drop-shadow(0 6px 12px rgba(120, 70, 95, 0.28)); transition: transform 0.45s var(--ease); }
.map-card:hover .map-flower { transform: scale(1.14) rotate(-6deg); }
.map-flower svg { width: 100%; height: 100%; overflow: visible; }
.map-ko { font-family: var(--kserif); font-weight: 700; font-size: 16px; color: var(--ink); line-height: 1.3; }
.map-en { font-family: var(--serif); font-style: italic; font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }

.map-rec {
  margin-top: 24px; background: linear-gradient(120deg, var(--bloom), var(--bloom-deep));
  color: #fff; border: 0; border-radius: 999px; padding: 11px 24px; cursor: pointer;
  font-family: var(--sans); font-size: 14px; box-shadow: var(--shadow);
  transition: transform 0.3s var(--ease), filter 0.3s;
}
.map-rec:hover { transform: translateY(-2px); filter: saturate(1.1); }

/* ---------- HUD ---------- */
.hud {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 36;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 0 clamp(16px, 5vw, 60px) 22px;
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  pointer-events: none;
}
.hud.show { opacity: 1; transform: none; }
.hud > * { pointer-events: auto; }

.recommend {
  background: var(--glass-strong); border: 1px solid var(--glass-line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--bloom-deep); font-family: var(--sans); font-size: 14px;
  padding: 9px 20px; border-radius: 999px; cursor: pointer;
  box-shadow: var(--shadow); transition: transform 0.3s var(--ease), background 0.3s;
}
.recommend:hover { transform: translateY(-2px); background: #fff; }

.trail-wrap {
  display: flex; align-items: center; gap: 12px;
  width: min(760px, 100%);
  background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: 999px; padding: 10px 16px;
}
.travel-arrow {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--glass-line); background: rgba(255, 255, 255, 0.6);
  color: var(--bloom-deep); font-size: 20px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; transition: transform 0.3s var(--ease), background 0.3s;
}
.travel-arrow:hover { transform: scale(1.12); background: #fff; }

/* trail line + nodes */
.trail { position: relative; flex: 1; height: 30px; }
.trail-line {
  position: absolute; left: 0; right: 0; top: 50%; height: 3px; transform: translateY(-50%);
  background: rgba(120, 70, 95, 0.18); border-radius: 3px;
}
.trail-fill {
  position: absolute; left: 0; top: 50%; height: 3px; width: 0; transform: translateY(-50%);
  background: linear-gradient(90deg, var(--bloom), var(--bloom-deep)); border-radius: 3px;
  transition: width 0.1s linear;
}
.trail-marker {
  position: absolute; top: 50%; left: 0; width: 14px; height: 14px;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: #fff; border: 2px solid var(--bloom-deep);
  box-shadow: 0 2px 10px rgba(232, 93, 138, 0.5); z-index: 3;
  transition: left 0.1s linear;
}
.trail-node {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 22px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; z-index: 2;
}
.trail-dot {
  display: block; width: 11px; height: 11px; margin: auto; border-radius: 50%;
  background: var(--c, var(--bloom)); border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 5px rgba(120, 70, 95, 0.35);
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
}
.trail-node:hover .trail-dot { transform: scale(1.4); }
.trail-node.seen .trail-dot { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5), 0 1px 6px rgba(120, 70, 95, 0.4); }
.trail-node.active .trail-dot { transform: scale(1.7); box-shadow: 0 0 14px 2px var(--c); }
.trail-node.pulse .trail-dot { animation: node-pulse 0.6s ease-out 2; }
.trail-tip {
  position: absolute; bottom: 150%; left: 50%; transform: translateX(-50%) translateY(4px);
  white-space: nowrap; font-family: var(--kserif); font-size: 12px; color: var(--ink);
  background: var(--glass-strong); border: 1px solid var(--glass-line);
  padding: 3px 9px; border-radius: 8px; opacity: 0; pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
.trail-node:hover .trail-tip, .trail-node.active .trail-tip {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ---------- reveal helper ---------- */
.reveal { opacity: 0; transform: translateY(22px); filter: blur(4px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease), filter 0.9s var(--ease); }
.reveal.show { opacity: 1; transform: none; filter: blur(0); }

/* ---------- keyframes ---------- */
@keyframes drop-in { to { opacity: 1; transform: none; } }
@keyframes spin-slow { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.85; } }
@keyframes node-pulse { 0% { box-shadow: 0 0 0 0 var(--c); } 100% { box-shadow: 0 0 0 16px transparent; } }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .topbar { padding: 16px 18px; }
  .th-controls .key { font-size: 11px; }
  .trail-tip { display: none; }
  .chapter-inner { max-height: 86vh; }
  .recommend { font-size: 13px; padding: 8px 16px; }
}

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