/* 홈(여행 일지) 전용 스타일 — 공통 헤더/푸터/토글은 chrome.css 참고 */

/* 히어로 — 여행 궤적 지도 + 여정 로그 */
.hero {
  max-width: 1180px;
  margin: var(--space-4) auto 0;
  padding: 0 var(--space-5);
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: stretch;
}
/* 카드는 티켓 높이에 맞춰 늘어나고, 지도(마커 기준면)는 자연 크기로 중앙 배치 */
.hero__map-cell {
  display: grid;
  place-items: center;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: #060b1a;
}
.hero__map {
  position: relative;
  width: 100%;
}
.hero__img {
  width: 100%;
  display: block;
}

/* 여행 항로 (곡선 + 비행기) */
.hero__route {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}
.route-faint {
  fill: none;
  stroke: color-mix(in srgb, var(--route-gold) 28%, transparent);
  stroke-width: 2;
}
.route-draw {
  fill: none;
  stroke: var(--route-gold);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--route-gold) 60%, transparent));
  animation: route-draw 4.5s ease forwards;
}
@keyframes route-draw {
  to {
    stroke-dashoffset: 0;
  }
}
.plane path {
  fill: #ffffff;
  stroke: var(--route-gold);
  stroke-width: 2;
  filter: drop-shadow(0 0 5px var(--contrail));
}

/* 도시 마커 */
.marker {
  position: absolute;
  z-index: 2;
  translate: -50% -50%;
  width: 15px;
  height: 15px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: currentColor;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.marker--trip {
  color: var(--route-gold);
}
.marker--home {
  color: var(--route-gold);
  width: 18px;
  height: 18px;
  border-width: 3px;
}
.marker--weather {
  color: var(--weather-cyan);
}
.marker::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid currentColor;
  animation: marker-pulse 2.2s ease-out infinite;
}
.marker:hover,
.marker:focus-visible {
  transform: scale(1.3);
}
.marker:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}
@keyframes marker-pulse {
  0% {
    transform: scale(1);
    opacity: 0.9;
  }
  70% {
    transform: scale(2.6);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .marker::after {
    animation: none;
  }
  .route-draw {
    animation: none;
    stroke-dashoffset: 0;
  }
}

/* 여정 로그 — 탑승권 */
.log-hint {
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--space-2);
  min-height: 22rem;
  height: 100%;
  padding: var(--space-5);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-muted);
  text-align: center;
  line-height: 1.7;
}
.bp {
  display: flex;
  height: 100%;
  min-height: 22rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
}
.bp__stub {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: var(--space-4) var(--space-2);
  background: var(--brand);
  color: #fff;
  font-size: var(--fs-300);
  font-weight: 700;
  letter-spacing: 0.15em;
  border-right: 2px dashed rgba(255, 255, 255, 0.5);
}
.bp__flight {
  font-family: ui-monospace, "SFMono-Regular", monospace;
  letter-spacing: 0.1em;
  opacity: 0.9;
}
.bp__body {
  flex: 1;
  min-width: 0;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
}
.bp__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  white-space: nowrap;
}
.bp__label {
  font-size: var(--fs-300);
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--color-muted);
}
.bp__tag {
  font-size: var(--fs-300);
  font-weight: 700;
  color: var(--brand);
}
.bp__route {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.bp__ep {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bp__ep small {
  font-size: var(--fs-300);
  color: var(--color-muted);
}
.bp__code {
  font: 800 1.4rem/1 ui-monospace, "SFMono-Regular", monospace;
  color: var(--color-text);
}
.bp__plane {
  color: var(--brand);
  font-size: 1.1rem;
}
.bp__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--color-border);
}
.bp__grid dt {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--color-muted);
}
.bp__grid dd {
  margin: 0;
  font-weight: 700;
  color: var(--color-text);
  font-family: ui-monospace, "SFMono-Regular", monospace;
}
.bp__view {
  width: 100%;
  margin-top: auto;
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(120deg, #e0a422, var(--route-gold));
  color: #3a2a06;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.bp__view:hover {
  filter: brightness(1.06);
}
.bp__view:active {
  transform: translateY(1px);
}
.bp__barcode {
  height: 34px;
  margin-top: auto;
  border-radius: 3px;
  opacity: 0.8;
  background: repeating-linear-gradient(
    90deg,
    var(--color-text) 0 2px,
    transparent 2px 4px,
    var(--color-text) 4px 7px,
    transparent 7px 9px,
    var(--color-text) 9px 10px,
    transparent 10px 13px
  );
}
.bp__weather {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.bp__weather > div {
  padding: var(--space-3) var(--space-2);
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm);
  text-align: center;
}
.bp__weather dt {
  font-size: var(--fs-300);
  color: var(--color-muted);
}
.bp__weather dd {
  margin: 0;
  font-weight: 700;
  color: var(--color-text);
}

/* 분할플랩 도시 코드 */
.flip {
  display: inline-flex;
  gap: 3px;
}
.flip__tile {
  position: relative;
  min-width: 1.3em;
  padding: 0.08em 0.14em;
  background: #11182b;
  color: var(--route-gold);
  font: 800 1.4rem/1 ui-monospace, "SFMono-Regular", monospace;
  text-align: center;
  border-radius: 5px;
}
.flip__tile::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(0, 0, 0, 0.5);
}

/* 활성 마커 */
.marker.is-active {
  background: #ffffff;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 55%, transparent),
    0 0 14px currentColor;
}
.marker.is-active::after {
  animation: none;
  opacity: 0;
}

/* 여행 사진 모달 (여권 스탬프 애니메이션) */
.photo-modal {
  width: min(560px, 92vw);
  margin: auto;
  padding: 0;
  border: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-lg);
}
.photo-modal::backdrop {
  background: rgba(4, 8, 20, 0.75);
  backdrop-filter: blur(4px);
}
.photo-modal[open] {
  animation: modal-pop 0.35s cubic-bezier(0.2, 1, 0.36, 1);
}
@keyframes modal-pop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.photo-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.photo-modal__close:hover {
  background: rgba(0, 0, 0, 0.75);
}
.photo-modal__fig {
  position: relative;
  margin: 0;
  overflow: hidden;
}
.photo-modal__fig img {
  width: 100%;
  max-height: 68vh;
  object-fit: cover;
  display: block;
}
.photo-modal[open] .photo-modal__fig img {
  animation: kenburns 6s ease-out both;
}
@keyframes kenburns {
  from {
    transform: scale(1.12);
  }
  to {
    transform: scale(1);
  }
}
.photo-modal__stamp {
  position: absolute;
  top: 12%;
  right: 8%;
  padding: 0.3rem 0.7rem;
  border: 3px solid #ff5a5a;
  border-radius: 10px;
  color: #ff5a5a;
  font: 800 1.05rem/1 ui-monospace, "SFMono-Regular", monospace;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}
.photo-modal[open] .photo-modal__stamp {
  animation: stamp-in 0.55s cubic-bezier(0.2, 1.3, 0.4, 1) 0.32s both;
}
@keyframes stamp-in {
  0% {
    opacity: 0;
    transform: rotate(-26deg) scale(2.4);
  }
  55% {
    opacity: 1;
  }
  100% {
    opacity: 0.92;
    transform: rotate(-12deg) scale(1);
  }
}
.photo-modal__cap {
  padding: var(--space-4);
  text-align: center;
  font-weight: 700;
}
@media (prefers-reduced-motion: reduce) {
  .photo-modal[open],
  .photo-modal[open] .photo-modal__fig img,
  .photo-modal[open] .photo-modal__stamp {
    animation: none;
  }
  .photo-modal__stamp {
    opacity: 0.92;
    transform: rotate(-12deg);
  }
}

/* 여정 재생 컨트롤 + 연도 타임라인 */
.hero__controls {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-5);
  margin-top: var(--space-2);
}
.btn-play {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.4rem;
  border: none;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.btn-play:hover {
  filter: brightness(1.08);
}
.timeline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
}
.timeline li:not(:first-child)::before {
  content: "";
  width: 1.2rem;
  height: 2px;
  background: var(--color-border);
}
.timeline button {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-muted);
  font-weight: 700;
  font-family: ui-monospace, "SFMono-Regular", monospace;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.timeline button:hover {
  color: var(--brand);
  border-color: var(--brand);
}

/* 섹션 공통 */
.deck,
.games {
  max-width: 1180px;
  margin: var(--space-7) auto 0;
  padding: 0 var(--space-5);
}
.deck h2,
.games h2 {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  font-size: var(--fs-700);
}
/* .eyebrow는 chrome.css에서 공용 정의 */

/* 둘러보기 카드 */
.deck__grid {
  list-style: none;
  margin: var(--space-5) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
}
.deck__grid li {
  margin: 0;
}
.deck__card a {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  height: 100%;
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.deck__card a:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--brand) 45%, var(--color-border));
  text-decoration: none;
}
.deck__card b {
  font-size: var(--fs-500);
}
.deck__card span {
  color: var(--color-muted);
  font-size: var(--fs-300);
}
.deck__card a::after {
  content: "→";
  align-self: flex-end;
  margin-top: auto;
  color: var(--brand);
  font-weight: 700;
  transition: transform 0.18s ease;
}
.deck__card a:hover::after {
  transform: translateX(4px);
}

/* 미니 게임 — 아케이드(게임 센터) */
.arcade__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-5);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: radial-gradient(
    120% 100% at 50% 0%,
    color-mix(in srgb, var(--brand) 16%, var(--color-surface)),
    var(--color-surface) 72%
  );
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--color-border));
  box-shadow: inset 0 0 40px color-mix(in srgb, var(--brand) 8%, transparent);
}
.cabinet {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  border-radius: var(--radius-md);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--brand) 13%, var(--color-surface)),
    var(--color-surface)
  );
  border: 1px solid color-mix(in srgb, var(--brand) 45%, transparent);
  color: var(--color-text);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.cabinet:hover,
.cabinet:focus-visible {
  transform: translateY(-5px);
  border-color: var(--route-gold);
  box-shadow: 0 0 26px color-mix(in srgb, var(--brand) 50%, transparent);
}
.cabinet:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}
.cabinet__icon {
  font-size: 2.6rem;
  line-height: 1;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--brand) 60%, transparent));
}
.cabinet__name {
  font-weight: 800;
  font-size: var(--fs-500);
}
.cabinet__cta {
  font: 700 var(--fs-300) / 1 ui-monospace, "SFMono-Regular", monospace;
  letter-spacing: 0.1em;
  color: var(--route-gold);
}

/* ── 반응형 (모니터 → 노트북 → 태블릿 → 폰 점진 대응) ── */

/* 노트북 — 지도 열을 살짝 줄여 티켓이 덜 좁아지게 */
@media (max-width: 1180px) {
  .hero {
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  }
}

/* 태블릿 이하 — 히어로를 세로 스택(지도 → 로그 → 컨트롤) */
@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .hero__log {
    justify-self: center;
    width: 100%;
    max-width: 30rem;
  }
}

/* 핸드폰 (강의 지정 786px 분기) — 둘러보기/게임 여백 확대 */
@media (max-width: 786px) {
  .deck,
  .games {
    margin-top: var(--space-6);
  }
}

/* 작은 폰 — 여백 축소 + 타임라인 줄바꿈 */
@media (max-width: 480px) {
  .hero,
  .deck,
  .games {
    padding-inline: var(--space-4);
  }
  .bp__body {
    padding: var(--space-4);
  }
  .timeline {
    flex-wrap: wrap;
    justify-content: center;
  }
  .timeline li:not(:first-child)::before {
    display: none;
  }
}


/* 미션6: 첫 방문 시 상단 타이틀이 부드럽게 페이드인 (index 전용, 세션당 1회 —
   theme.js가 html에 brand-in 클래스를 걸어줄 때만 재생) */
html.brand-in .site-header .brand {
  animation: brand-in 0.7s ease both;
}
@keyframes brand-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  html.brand-in .site-header .brand {
    animation: none;
  }
}

.log-hint__welcome {
  font-weight: 700;
  color: var(--color-text);
}
