/* css/archive.css — 지난 기록 지도(archive/index.html) 전용.
   css/map.css의 지도 레이아웃 위에 시간줄·핀·그날 패널·가장자리 카드를 얹는다. */

/* ── 뉴스 핀 (js/mapview.js drawPins가 그린다) ── */
.news-pin { cursor: pointer; }
.news-pin .pin-dot {
  fill: var(--gold-bright); stroke: var(--ink); stroke-width: .6;
}
.news-pin .pin-halo {
  fill: var(--gold); opacity: .22;
}
.news-pin:hover .pin-halo, .news-pin.active .pin-halo {
  opacity: .45;
  animation: pin-pulse 1.6s ease-out infinite;
}
.news-pin.active .pin-dot { fill: #fff0d0; }
@keyframes pin-pulse {
  0%   { transform: scale(1);    opacity: .45; }
  70%  { transform: scale(1.9);  opacity: 0; }
  100% { transform: scale(1.9);  opacity: 0; }
}
.news-pin .pin-halo { transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: reduce) {
  .news-pin .pin-halo { animation: none !important; }
}

/* ── 그날의 기록 패널 ── */
.day-panel {
  position: absolute; top: 66px; right: 14px; bottom: 96px;
  width: min(330px, calc(100vw - 28px));
  background: rgba(30,27,22,.92); backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong); border-radius: 10px;
  display: flex; flex-direction: column; overflow: hidden; z-index: 500;
}
.dp-head { padding: 15px 17px 12px; border-bottom: 1px solid var(--line); }
.dp-issue { font-family: var(--mono); font-size: 10px; color: var(--gold); letter-spacing: .16em; }
.dp-date { font-family: var(--serif); font-weight: 700; font-size: 21px; margin-top: 5px; letter-spacing: -.02em; }
.dp-body { flex: 1; overflow-y: auto; padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 8px; }

.dp-item {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px;
  transition: border-color .15s, background .15s;
}
.dp-item:hover, .dp-item.active { border-color: var(--gold); background: rgba(184,152,96,.09); }
.dp-sec { display: block; font-family: var(--mono); font-size: 9.5px; color: var(--gold); letter-spacing: .1em; margin-bottom: 4px; }
.dp-title { display: block; font-family: var(--serif); font-weight: 700; font-size: 13.5px; line-height: 1.45; word-break: keep-all; }
.dp-place { display: block; font-size: 10.5px; color: var(--paper-dim); margin-top: 5px; }

.dp-malmoi { margin-top: 8px; padding-top: 11px; border-top: 1px solid var(--line); }
.dp-quote { padding: 7px 2px; }
.dq-text { display: block; font-family: var(--serif); font-size: 12.5px; line-height: 1.65; word-break: keep-all; }
.dq-who { display: block; font-size: 10.5px; color: var(--paper-dim); margin-top: 3px; }

/* ── 국제 기록 카드 ──
   한국 지도에 찍을 수 없는 기록. 예전에는 방위별로 화면 가장자리에 흩어
   놓았는데, 북쪽 카드가 육지·헤더와 겹쳐 읽기 어려웠다. 왼쪽 한 곳에
   세로로 모으고, 방위는 라벨로만 알린다. 줌 컨트롤 아래에서 시작한다. */
.edge-cards { position: absolute; inset: 0; pointer-events: none; z-index: 450; }
.edge-stack {
  position: absolute; left: 14px; top: 166px;
  width: min(226px, 42vw); pointer-events: auto;
  display: flex; flex-direction: column; gap: 8px;
  max-height: calc(100% - 290px); overflow-y: auto;
}
.edge-head {
  font-family: var(--mono); font-size: 9.5px; color: var(--gold);
  letter-spacing: .16em; padding-left: 2px;
}
.edge-card {
  cursor: pointer; text-align: left; font-family: inherit; width: 100%;
  background: rgba(24,21,17,.92); backdrop-filter: blur(6px);
  border: 1px dashed var(--line-strong); border-radius: 9px;
  padding: 11px 13px; color: var(--paper);
  transition: border-color .15s, background .15s;
}
.edge-card:hover, .edge-card.active {
  border-color: var(--gold); border-style: solid; background: var(--ink-soft);
}
.ec-dir {
  display: block; font-family: var(--mono); font-size: 9px; color: var(--gold);
  letter-spacing: .12em; margin-bottom: 5px;
}
.ec-sec { display: inline-block; font-family: var(--mono); font-size: 9.5px; color: var(--gold-bright); margin-bottom: 3px; }
.ec-title { display: block; font-family: var(--serif); font-weight: 700; font-size: 13px; line-height: 1.45; word-break: keep-all; }
.ec-place { display: block; font-size: 10.5px; color: var(--paper-dim); margin-top: 5px; }

/* ── 핀 팝업 ──
   핀을 눌렀는데 강조만 바뀌면 눌린 줄도 모른다. 그 자리에서 무엇인지 보여준다. */
.pin-pop {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 620; width: min(330px, calc(100vw - 40px));
  background: rgba(24,21,17,.97); backdrop-filter: blur(10px);
  border: 1px solid var(--gold); border-radius: 11px;
  padding: 18px 20px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.62);
}
.pin-pop[hidden] { display: none; }
.pop-close {
  position: absolute; top: 9px; right: 11px; width: 26px; height: 26px;
  background: none; border: 0; border-radius: 5px;
  color: var(--paper-dim); font-size: 18px; cursor: pointer;
}
.pop-close:hover { background: rgba(184,152,96,.22); color: var(--paper); }
.pop-thumb {
  display: block; aspect-ratio: 16/9; overflow: hidden; margin-bottom: 13px;
  border-radius: 7px; border: 1px solid var(--line); background: var(--ink-soft);
}
.pop-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pop-sec { display: block; font-family: var(--mono); font-size: 9.5px; color: var(--gold); letter-spacing: .12em; margin-bottom: 6px; }
.pop-title { font-family: var(--serif); font-weight: 700; font-size: 16.5px; line-height: 1.45; letter-spacing: -.02em; word-break: keep-all; }
.pop-one { font-size: 12.5px; line-height: 1.75; color: var(--paper-dim); margin-top: 8px; word-break: keep-all; }
.pop-place { font-size: 11px; color: var(--paper-dim); margin-top: 8px; }
.pop-go {
  display: inline-block; margin-top: 14px; text-decoration: none;
  font-family: var(--mono); font-size: 11.5px; color: var(--gold-bright);
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 8px 14px;
}
.pop-go:hover { background: rgba(184,152,96,.16); }

body.theme-day .pin-pop { background: rgba(246,241,231,.97); }
body.theme-day .pop-title, body.theme-day .pop-close { color: #241f16; }
body.theme-day .pop-one, body.theme-day .pop-place { color: #6b6252; }

/* ── 시간줄 ── */
.timebar {
  position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 600;
  display: flex; align-items: center; gap: 10px;
  background: rgba(30,27,22,.92); backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 13px 15px 17px;
}
.tb-step {
  width: 30px; height: 30px; flex: 0 0 auto;
  background: none; border: 1px solid var(--line); border-radius: 6px;
  color: var(--paper); font-size: 16px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.tb-step:hover { background: rgba(184,152,96,.15); border-color: var(--gold); }

.tb-slider-wrap { position: relative; flex: 1; height: 30px; }
.tb-ticks { position: absolute; left: 0; right: 0; top: 0; height: 8px; }
.tick.has {
  position: absolute; top: 0; width: 3px; height: 8px; margin-left: -1.5px;
  background: var(--gold-bright); border-radius: 2px;
  box-shadow: 0 0 6px rgba(212,181,120,.5);
}
.tb-months { position: absolute; left: 0; right: 0; bottom: -6px; height: 12px; }
.tb-months .mo {
  position: absolute; transform: translateX(1px);
  font-family: var(--mono); font-size: 9px; color: var(--paper-dim); letter-spacing: .08em;
}

#tbRange {
  -webkit-appearance: none; appearance: none;
  position: absolute; left: 0; right: 0; top: 10px; width: 100%;
  height: 4px; background: var(--line); border-radius: 2px; outline-offset: 6px;
}
#tbRange::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--gold-bright); border: 2px solid var(--ink);
  box-shadow: 0 0 0 1px var(--gold), 0 2px 8px rgba(0,0,0,.5); cursor: grab;
}
#tbRange::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--gold-bright); border: 2px solid var(--ink);
  box-shadow: 0 0 0 1px var(--gold); cursor: grab;
}
#tbRange:active::-webkit-slider-thumb { cursor: grabbing; }

.tb-label {
  flex: 0 0 auto; min-width: 96px; text-align: center;
  font-family: var(--mono); font-size: 12px; color: var(--gold-bright);
  letter-spacing: .04em;
}

/* ── 반응형 ── */
@media (max-width: 860px) {
  .day-panel {
    top: auto; right: 10px; left: 10px; bottom: 92px;
    max-height: 38vh; width: auto;
  }
  .edge-e { right: 14px; top: 30%; }
  .edge-w { top: 30%; }
  .timebar { left: 10px; right: 10px; bottom: 10px; padding: 11px 11px 15px; }
  .tb-label { min-width: 82px; font-size: 11px; }
  .map-hint { display: none; }
}

/* ── 지역 포털 추가 요소 ── */
.news-pin.dim .pin-dot { fill: var(--gold); opacity: .45; }
.news-pin.dim .pin-halo { opacity: .1; }
.news-pin.dim:hover .pin-dot, .news-pin.dim.active .pin-dot { opacity: 1; fill: var(--gold-bright); }

.lp-note { font-size: 11.5px; color: var(--paper-dim); line-height: 1.65; margin-top: 8px; word-break: keep-all; }
.lp-foot { padding: 11px 13px 13px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.lp-clear {
  font-family: var(--mono); font-size: 11px; letter-spacing: .05em;
  background: none; border: 1px solid var(--line-strong); border-radius: 6px;
  color: var(--gold-bright); padding: 8px 12px; cursor: pointer;
  transition: background .15s;
}
.lp-clear:hover { background: rgba(184,152,96,.15); }
.lp-about {
  background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit;
  font-size: 11px; color: var(--paper-dim); text-align: left;
  text-decoration: underline; text-underline-offset: 3px;
}
.lp-about:hover { color: var(--gold); }

.bc-panel {
  position: absolute; z-index: 700; top: 66px; left: 14px;
  width: min(360px, calc(100vw - 28px)); max-height: calc(100% - 180px); overflow-y: auto;
  background: rgba(30,27,22,.96); backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 18px 20px;
}
.bc-list { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.bc-group { font-size: 12px; line-height: 1.8; color: var(--paper-dim); word-break: keep-all; }
.bc-group b { display: block; color: var(--gold-bright); font-family: var(--serif); font-size: 13px; margin-bottom: 2px; }

@media (max-width: 860px) {
  .bc-panel { left: 10px; right: 10px; width: auto; top: 60px; }
}

/* ── 컨트롤 위치: 지도 페이지(지난 기록·지역) 전용 ──
   map.css 기본값(우측 상단)은 그날의 기록 패널과 겹친다. 이 페이지들에서는
   줌·낮밤 토글을 좌측 상단으로 옮긴다. era3 지도는 archive.css를 싣지
   않으므로 영향이 없다. */
.zoom-ctl { right: auto; left: 14px; }

/* ── 낮 지도 테마 ──
   map.css의 theme-day는 era3(색칠 지도)용으로만 짜여 있어, 여기의
   무채색 바탕·패널·시간줄은 따로 낮 옷을 입어야 한다. */
:root { --map-neutral: #26231d; }
body.theme-day { --map-neutral: #ddd5c0; }

body.theme-day .day-panel,
body.theme-day .timebar,
body.theme-day .bc-panel,
body.theme-day .edge-card {
  background: rgba(244,238,226,.94);
  border-color: rgba(120,100,64,.4);
  color: #241f16;
}
body.theme-day .dp-title, body.theme-day .ec-title,
body.theme-day .dp-date { color: #241f16; }
body.theme-day .dp-sec, body.theme-day .dp-issue,
body.theme-day .ec-dir, body.theme-day .ec-sec { color: #8a6f36; }
body.theme-day .dp-place, body.theme-day .dp-context,
body.theme-day .lp-note, body.theme-day .ec-place,
body.theme-day .dq-who, body.theme-day .quote-context,
body.theme-day .past-date { color: #6b6252; }
body.theme-day .dq-text { color: #241f16; }
body.theme-day .dp-item, body.theme-day .lp-clear, body.theme-day .tb-step {
  border-color: rgba(120,100,64,.4); color: #241f16;
}
body.theme-day .dp-item:hover, body.theme-day .dp-item.active {
  background: rgba(138,111,54,.12); border-color: #8a6f36;
}
body.theme-day .tb-step:hover, body.theme-day .lp-clear:hover {
  background: rgba(138,111,54,.15);
}
body.theme-day .lp-clear { color: #8a6f36; }
body.theme-day .tb-label { color: #8a6f36; }
body.theme-day .tb-months .mo { color: #6b6252; }
body.theme-day #tbRange { background: rgba(120,100,64,.3); }
body.theme-day .dp-head, body.theme-day .lp-foot,
body.theme-day .dp-malmoi, body.theme-day .quote-meta {
  border-color: rgba(120,100,64,.28);
}
body.theme-day .news-pin .pin-dot { stroke: #f2ece0; }
body.theme-day .empty-block { color: #6b6252; border-color: rgba(120,100,64,.4); }
body.theme-day .empty-block b { color: #241f16; }
body.theme-day .lp-about { color: #6b6252; }
body.theme-day .lp-about:hover { color: #8a6f36; }

/* ── 지역 포털 헤더 띠 ──
   이 페이지는 지도가 주인공이라 전체 배경을 깔 수 없다. 대신 상단 바에만
   갈래의 얼굴을 아주 옅게 얹어, 다른 포털과 한 가족으로 보이게 한다. */
body.local-page .site-head {
  position: relative; overflow: hidden;
  border-bottom-color: var(--line-strong);
}
body.local-page .site-head::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background: url('../../assets/sections/local.jpg') center 62% / cover no-repeat;
  opacity: .5;
}
body.local-page .site-head::after {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(90deg, rgba(21,19,15,.94) 0%, rgba(21,19,15,.72) 55%, rgba(21,19,15,.9) 100%);
}
body.local-page .site-head > * { position: relative; z-index: 2; }
body.theme-day.local-page .site-head::after {
  background: linear-gradient(90deg, rgba(242,236,224,.94) 0%, rgba(242,236,224,.74) 55%, rgba(242,236,224,.92) 100%);
}

/* ── 지역 포털: 지도 높이 ──
   map.css의 svg#map은 하단 시간줄(138px) 자리를 비워둔다. 지역 포털에는
   시간줄이 없으므로 그만큼 빈칸이 생긴다 — 화면 전체를 지도가 쓰게 한다. */
body.local-page svg#map { height: 100%; }

body.local-page .day-panel { bottom: 14px; }
body.local-page .bc-panel { max-height: calc(100% - 100px); }
@media (max-width: 860px) {
  body.local-page .day-panel { bottom: 10px; max-height: 44vh; }
}

/* 지도 패널의 작은 썸네일 */
.dp-item.has-thumb { display: grid; grid-template-columns: 62px 1fr; gap: 10px; align-items: start; }
.dp-thumb {
  display: block; aspect-ratio: 4/3; overflow: hidden;
  border-radius: 5px; border: 1px solid var(--line); background: var(--ink-soft);
}
.dp-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dp-body { display: block; min-width: 0; }

/* ── 방사형 펼침 리더선 · 클릭 과녁 ── */
.pin-leader { stroke: var(--gold); opacity: .42; pointer-events: none; }
.pin-anchor { fill: var(--gold); opacity: .5; pointer-events: none; }
.pin-hit { fill: transparent; cursor: pointer; }
.news-pin.active .pin-leader { opacity: .85; }
body.theme-day .pin-leader { stroke: #8a6f36; }
body.theme-day .pin-anchor { fill: #8a6f36; }

@media (max-width: 860px) {
  .edge-stack { left: 10px; top: 150px; width: min(200px, 52vw); max-height: 34vh; }
}
