/* rambleday.com — 공유 계획 보기
 * 최신화 2026-09-21 — 썸네일 캡처 모드(html.og)
 *
 * 팔레트와 서체는 앱과 같은 값이다. 링크를 누른 사람이 나중에 앱을 깔았을 때
 * "그 페이지랑 같은 앱"이라고 읽혀야 한다. 값이 갈리면 그 연결이 끊긴다.
 *   #FFF8EE 크림 / #F3DDC2 양피지 / #5C4A2A 짙은갈색
 *   #9A7B5A 모카 / #D4B896 중간베이지 / #B85C38 테라코타 / #1A3A5C 네이비
 *
 * ⛔ 글자 크기는 **전부 rem 이다. px 로 쓰지 말 것.**
 *   카톡·인스타 인앱 브라우저는 안드로이드 WebView 의 textZoom 을 올려서 연다
 *   (기기 글꼴 크기 설정을 따라간다). 그러면 CSS px 글자가 통째로 2배가 되는데
 *   CSS 로 끄는 방법이 없다 — `-webkit-text-size-adjust` 는 이걸 못 막는다.
 *   s.js 가 시작할 때 배율을 재서 :root 의 font-size 를 그만큼 낮춘다.
 *   그 상쇄는 **rem 로 쓴 글자에만** 걸린다. px 로 쓰면 혼자 2배로 남는다.
 *   (지도 라벨은 canvas 라 애초에 영향을 안 받는다 — 그래서 HTML 글자만
 *    거대해 보였다.)
 */

:root {
  --cream: #fff8ee;
  --parchment: #f3ddc2;
  --dark-brown: #5c4a2a;
  --mocha: #9a7b5a;
  --mid-beige: #d4b896;
  --terracotta: #b85c38;
  --navy: #1a3a5c;

  --sheet-max: 420px;
  --radius: 18px;

  /* 하단 안전영역. 제스처 핸들 위로 올린다 — 앱에서 같은 문제를 이미 겪었다. */
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* s.js 가 배율을 재서 덮어쓴다. 기본은 브라우저 기본값. */
  font-size: 16px;

  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--parchment);
  color: var(--dark-brown);
  font-family: Georgia, 'Times New Roman', serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#map { position: fixed; inset: 0; background: var(--parchment); }

/* MapLibre 기본 칩은 팔레트와 안 맞는다. 저작권 표시는 남기되 톤만 맞춘다 —
   지우는 것은 타일 제공자 약관 위반이다. */
.maplibregl-ctrl-attrib {
  font-family: system-ui, sans-serif;
  font-size: 0.63rem;
  background: rgba(255, 248, 238, 0.82) !important;
}
.maplibregl-ctrl-attrib a { color: var(--mocha); }
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { z-index: 1; }

/* 시트가 덮는 자리라 컨트롤을 위로 올린다. */
.maplibregl-ctrl-bottom-right { bottom: 8px; }

/* ── 상단 바 ── */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 5;
  padding: max(env(safe-area-inset-top, 0px), 8px) 12px 8px;
  background: linear-gradient(to bottom, rgba(92, 74, 42, 0.28), transparent);
  pointer-events: none;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 900px;
  margin: 0 auto;
}
.topbar .btn { pointer-events: auto; flex: 0 0 auto; }

.brand {
  font-size: 1.19rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--cream);
  text-shadow: 0 1px 3px rgba(92, 74, 42, 0.55);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 버튼 ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 1.5px solid var(--mid-beige);
  border-radius: 999px;
  background: var(--cream);
  color: var(--dark-brown);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(92, 74, 42, 0.14);
}
.btn-sm { min-height: 2.13rem; padding: 0 0.88rem; font-size: 0.81rem; }
.btn-primary {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--cream);
}
.btn:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 2px; }

/* ── 바텀 시트 ──
 *
 * ⚠ 높이를 바꾸지 않고 **transform 으로만** 움직인다.
 *   높이를 바꾸면 매 프레임 리플로우가 나고, 목록이 길면 드래그가 끊긴다.
 *   그래서 시트는 항상 88dvh 로 서 있고 아래로 밀어 둔 만큼만 보인다.
 *
 * 스냅 세 자리: peek(손잡이+제목+Day칩) · half · full.
 * peek 에서 Day 칩이 보이는 것이 중요하다 — 지도를 보면서 날짜를 바꾸는 것이
 * 이 화면에서 제일 자주 하는 일이다.
 */

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  height: 88dvh;
  padding-bottom: var(--safe-b);
  background: rgba(255, 248, 238, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 2px solid var(--mid-beige);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -6px 28px rgba(92, 74, 42, 0.22);
  transform: translateY(var(--sheet-off, 40%));
  transition: transform 0.32s cubic-bezier(0.22, 0.8, 0.24, 1);
  will-change: transform;
}
.sheet.dragging { transition: none; }

/* 손잡이와 머리말이 드래그 영역이다. 목록은 그냥 스크롤한다 —
   둘을 겹치면 "스크롤하려는데 시트가 내려간다"가 된다. */
.grab-zone {
  flex: 0 0 auto;
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}
.sheet.dragging .grab-zone { cursor: grabbing; }

.grabber {
  appearance: none;
  border: 0;
  background: transparent;
  width: 100%;
  padding: 0.63rem 0 0.25rem;
  cursor: pointer;
}
.grabber-bar {
  display: block;
  width: 2.5rem; height: 4px;
  margin: 0 auto;
  border-radius: 999px;
  background: var(--mid-beige);
}

.sheet-head { padding: 0.25rem 1.13rem 0.63rem; }
.dest {
  margin: 0;
  font-size: 1.38rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--dark-brown);
  overflow-wrap: anywhere;
}

/* ⚠ 가운뎃점을 span 바깥에 두면 줄바꿈 때 점만 줄 끝에 남는다
   ("4 days ·" 에서 끊기는 모양). ::before 로 붙이면 점이 항상 뒤 항목을
   따라간다. */
.meta {
  margin: 0.31rem 0 0;
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--mocha);
}
.meta > span + span::before {
  content: '·';
  margin: 0 0.4em;
  opacity: 0.5;
}
.by { margin: 0.19rem 0 0; font-size: 0.78rem; color: var(--mocha); font-style: italic; }

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.75rem;
}

/* ── Day 칩 ── */

.daytabs {
  flex: 0 0 auto;
  display: flex;
  gap: 0.44rem;
  padding: 0.25rem 1.13rem 0.63rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.daytabs::-webkit-scrollbar { display: none; }

.daytab {
  flex: 0 0 auto;
  appearance: none;
  min-height: 2rem;
  padding: 0 0.81rem;
  border: 1.5px solid var(--mid-beige);
  border-radius: 999px;
  background: var(--cream);
  color: var(--dark-brown);
  font: inherit;
  font-size: 0.81rem;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.38rem;
}
.daytab[aria-selected='true'] {
  background: var(--dark-brown);
  border-color: var(--dark-brown);
  color: var(--cream);
}
.daytab .swatch {
  width: 0.56rem; height: 0.56rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 1.5px rgba(255, 248, 238, 0.7);
}

/* ── 장소 목록 ── */

.stops { padding: 0 0.75rem; }

/* ⚠ grid 자식은 min-width 가 auto 라 긴 이름이 칸을 밀어낸다 — 인앱 브라우저의
   큰 글자에서 이름이 가로로 잘려 나갔다. min-width:0 이 그걸 막는다. */
.stop {
  display: grid;
  grid-template-columns: 1.88rem minmax(0, 1fr);
  gap: 0.69rem;
  width: 100%;
  padding: 0.63rem 0.38rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  align-items: start;
}
.stop > * { min-width: 0; }
.stop:hover, .stop:focus-visible { background: rgba(212, 184, 150, 0.28); }
.stop + .stop { box-shadow: inset 0 1px 0 rgba(212, 184, 150, 0.45); }

.pin {
  width: 1.75rem; height: 1.75rem;
  margin-top: 1px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  color: var(--cream);
  background: var(--mocha);
  box-shadow: 0 1px 4px rgba(92, 74, 42, 0.3);
}
.pin.saved { background: transparent; color: var(--mocha); border: 1.5px dashed var(--mid-beige); }

.stop-name {
  display: block;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.stop-sub {
  display: flex;
  margin-top: 0.13rem;
  font-size: 0.78rem;
  color: var(--mocha);
  flex-wrap: wrap; gap: 0.31rem; align-items: center;
}
.cat { font-weight: 600; }
.stop-addr {
  display: block;
  margin-top: 0.13rem;
  font-size: 0.75rem;
  color: var(--mocha);
  opacity: 0.85;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-note {
  margin: 0;
  padding: 0.25rem 1.13rem 0.38rem;
  font-size: 0.78rem;
  color: var(--mocha);
  font-style: italic;
}

.empty { padding: 1rem 1.13rem; color: var(--mocha); font-style: italic; font-size: 0.84rem; }

/* 정제 고지 — 숨기지 않는다. 보는 사람이 "계획이 원래 이게 다"라고
   오해하면 안 된다. */
.redacted {
  margin: 0.63rem 0.75rem 0;
  padding: 0.56rem 0.75rem;
  border: 1px dashed var(--mid-beige);
  border-radius: 10px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--mocha);
  background: rgba(212, 184, 150, 0.16);
}

/* ── 지도 위 라벨 ── */

.mk {
  width: 1.63rem; height: 1.63rem;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: Georgia, serif;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  color: #fff8ee;
  border: 2px solid rgba(255, 248, 238, 0.92);
  box-shadow: 0 2px 6px rgba(92, 74, 42, 0.4);
  cursor: pointer;
}
.mk.saved {
  width: 0.81rem; height: 0.81rem;
  border-width: 2px;
  background: var(--cream);
}
.mk.on { transform: scale(1.22); z-index: 3; }

.maplibregl-popup-content {
  font-family: Georgia, serif;
  border-radius: 12px;
  border: 1.5px solid var(--mid-beige);
  background: var(--cream);
  color: var(--dark-brown);
  padding: 0.56rem 0.75rem;
  box-shadow: 0 4px 16px rgba(92, 74, 42, 0.22);
}
.maplibregl-popup-content b { font-size: 0.88rem; }
.maplibregl-popup-content small { font-size: 0.75rem; color: var(--mocha); }
.maplibregl-popup-tip { border-top-color: var(--cream) !important; }
.maplibregl-popup-close-button { color: var(--mocha); font-size: 1.06rem; }

/* ── 거부 · 오류 화면 ── */

.notice {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255, 248, 238, 0.9), transparent),
    var(--parchment);
}
.notice-card {
  width: min(440px, 100%);
  padding: 1.88rem 1.63rem;
  border: 2px solid var(--mid-beige);
  border-radius: 20px;
  background: var(--cream);
  box-shadow: 0 8px 30px rgba(92, 74, 42, 0.16);
  text-align: center;
}
.notice-card .brand { color: var(--mocha); text-shadow: none; font-size: 0.94rem; white-space: normal; }
.notice-card h1 { margin: 0.75rem 0 0.5rem; font-size: 1.31rem; line-height: 1.3; }
.notice-card p { margin: 0; color: var(--mocha); font-size: 0.91rem; line-height: 1.55; }
.notice-actions { margin-top: 1.25rem; display: flex; gap: 0.56rem; justify-content: center; flex-wrap: wrap; }

.noscript { position: fixed; inset: 0; z-index: 9; background: var(--parchment); padding: 1.75rem; }

/* ── 넓은 화면 ──
   여기서는 시트가 아니라 왼쪽 사이드다. 드래그도 스냅도 없다. */

@media (min-width: 820px) {
  .sheet {
    left: 18px;
    top: 74px;
    bottom: 18px;
    right: auto;
    width: var(--sheet-max);
    height: auto;
    padding-bottom: 0;
    border: 2px solid var(--mid-beige);
    border-radius: var(--radius);
    transform: none !important;
    transition: none;
  }
  .grab-zone { touch-action: auto; cursor: default; }
  .grabber { display: none; }
  .sheet-head { padding-top: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet { transition: none; }
}

/* 지도를 못 띄운 경우. 목록은 그대로 쓸 수 있어야 한다 —
   이 페이지의 본문은 일정이지 지도가 아니다. */
body.map-down #map {
  background:
    repeating-linear-gradient(45deg, rgba(212,184,150,.18) 0 12px, transparent 12px 24px),
    var(--parchment);
}
body.map-down .sheet {
  height: calc(100dvh - 60px);
  transform: none !important;
}
body.map-down .grabber { visibility: hidden; }
body.map-down .stop { cursor: default; }

/* ── 썸네일 캡처 모드 (html.og) ──
 * 워커가 헤드리스 브라우저로 1200×630 을 찍는다. 지도만 남긴다.
 * ⚠ 저작권 표기(attrib)는 숨기지 않는다 — MapTiler·OSM 조건이다.
 * ⚠ 워드마크는 좌상단. 카톡은 카드 이미지를 가운데 기준으로 잘라 쓰므로
 *   가장자리에 붙이되 48px 안쪽에 둔다. */
html.og .topbar,
html.og .sheet,
html.og .maplibregl-ctrl-top-right { display: none !important; }
html.og #map { inset: 0; }
html.og .og-mark {
  position: fixed; left: 48px; top: 40px; z-index: 5;
  padding: 0.4rem 0.85rem; border-radius: 999px;
  background: rgba(255, 248, 238, 0.92);
  color: var(--dark-brown); font-size: 1.25rem; font-weight: 700; line-height: 1;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 10px rgba(60, 40, 20, 0.12);
}
.og-mark { display: none; }
html.og .og-mark { display: block; }
