/* 산오름(가칭) — 화면 기준은 G:\workspace\UIUX.md. 토큰·대비는 docs/mockup/home.html 에서 그대로 옮겼다.
 *
 * 디자인 방향: 등고선 지도. 바탕은 흰 종이, 강조색은 지형도의 등고선 갈색, 글자는 짙은 솔잎 먹색.
 * 강조는 한 화면에 한 번 — 홈은 '산 찾기' 버튼, 산 상세는 시간 띠의 '출발 마감' 막대. 현재 위치 표시는 먹색이다.
 * 초록은 판정 '괜찮음' 전용이라 강조색에서 뺐다. 빨강(--crit)은 '가지 않는 편이 낫다'·오류 전용.
 *
 * 🔥 대비는 전부 계산한 값이다(WCAG 2.x 상대휘도). 라이트 순서: paper / sunken / topo.
 *    다크 순서: paper / surface / sunken / topo. 새 색을 만들면 같이 잰다. */
:root {
  --paper: #ffffff;
  --surface: #ffffff;
  --sunken: #f3f4f1;       /* 비텍스트 면 */
  --topo: #efe6da;         /* 비텍스트 면 — 시간 띠 바탕·등고선 */
  --ink: #1a1f1b;          /* 16.7 / 15.1 / 13.5 — 본문 */
  --ink-2: #3d463f;        /* 9.8 / 8.9 / 7.9  — 부제 */
  --muted: #5d665f;        /* 5.9 / 5.4 / 4.8  — 보조 설명 */
  --line: #e2e5e0;         /* 비텍스트 경계 */
  --line-strong: #c3c9c2;
  --accent: #8a4512;       /* 7.1 / 6.5 / 5.8 · --accent-soft 위 6.0 · 흰 글자 7.1 — 등고선 갈색 */
  --accent-soft: #f6e9dc;  /* 비텍스트 면 */
  --good: #1d6b45;         /* 6.5 / 5.9 / 5.2 — 판정 '괜찮음' 전용 */
  --warn: #7a5f00;         /* 6.1 / 5.5 / 4.9 — 판정 '주의' */
  --crit: #b3123a;         /* 6.9 / 6.2 / 5.5 — '가지 않는 편이 낫다'·오류 전용. 강조색으로 쓰지 않는다 */
  --on-accent: #ffffff;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121613;
    --surface: #1a201c;
    --sunken: #232a25;
    --topo: #2a2219;
    --ink: #edf0ec;        /* 15.9 / 14.4 / 12.8 / 13.6 */
    --ink-2: #cdd4ce;      /* 12.1 / 11.0 / 9.7 / 10.4 */
    --muted: #9ba59e;      /* 7.2 / 6.5 / 5.8 / 6.2 */
    --line: #2f3832;
    --line-strong: #4a554d;
    --accent: #e8a46a;     /* 8.7 / 7.9 / 7.0 / 7.4 · --accent-soft 위 6.8 · --on-accent 글자 8.7 */
    --accent-soft: #3a2616;
    --good: #5cc08e;       /* 8.2 / 7.4 / 6.6 / 7.0 */
    --warn: #d6bd4a;       /* 9.8 / 8.9 / 7.9 / 8.4 */
    --crit: #ff8a9e;       /* 8.2 / 7.4 / 6.6 / 7.0 */
    --on-accent: #121613;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.65 "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  overflow-wrap: break-word; -webkit-text-size-adjust: 100%;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 16px; top: 8px; z-index: 2000; background: var(--surface); padding: 8px 12px; min-height: 44px; display: inline-flex; align-items: center; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 머리 — 왼쪽 위 로고 = 홈. 현재 위치는 먹색 밑줄(강조색은 화면의 주 버튼에 남겨 둔다) */
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top .wrap { display: flex; align-items: center; gap: 24px; min-height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.logo:hover { text-decoration: none; }
.logo svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--ink); }

main { padding: 32px 0 48px; }
h1, h2, h3 { line-height: 1.3; letter-spacing: -.02em; }
h1 { font-size: 28px; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 44px 0 8px; }    /* 제목은 자기 본문에 붙인다: 위 44 > 아래 8 */
h3 { font-size: 17px; margin: 24px 0 8px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.lede { color: var(--ink-2); margin: 0 0 16px; max-width: 40em; }
.cap { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.more-link { display: inline-flex; align-items: center; min-height: 44px; }
/* 문장 속 링크 — 줄 흐름은 그대로 두고 위아래 여백으로 누르는 면만 44px 로 넓힌다(인라인 padding 은 줄 높이를 바꾸지 않는다) */
p > a, dd > a, .prose li > a { padding-block: 14px; }
.empty { padding: 16px; background: var(--sunken); border-radius: 8px; color: var(--ink-2); margin: 0; }

/* 판정 — 색 + 모양 + 낱말. 색만으로 구분하지 않는다 */
.v { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.v::before { content: ""; width: 10px; height: 10px; flex: none; background: currentColor; }
.v-ok { color: var(--good); }   .v-ok::before { border-radius: 50%; }
.v-warn { color: var(--warn); } .v-warn::before { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.v-no { color: var(--crit); }   .v-no::before { border-radius: 1px; }
.v-none { color: var(--muted); font-weight: 400; } .v-none::before { background: none; border: 1.5px dashed currentColor; border-radius: 50%; }

/* 폼·버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border: 0; border-radius: 8px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); min-height: 44px; }
.field { min-height: 48px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; width: 100%; }

/* 목록 줄 — 줄 전체가 링크(앵커를 처음부터 grid 로 깐다, intype .plist__i a 방식) */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rows li { border-bottom: 1px solid var(--line); }
.rows a { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; align-items: center; min-height: 64px; padding: 12px 4px; color: var(--ink); text-decoration: none; }
.rows a:hover { background: var(--sunken); }
.rows .name { font-weight: 700; font-size: 17px; }
.rows .name small { font-weight: 400; color: var(--muted); font-size: 14px; margin-left: 6px; }
.rows .meta { grid-column: 1; color: var(--muted); font-size: 14px; }
.rows .when { grid-column: 2; grid-row: 1 / span 2; text-align: right; }
.rows .when b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.rows .when span { color: var(--muted); font-size: 13px; }
.rows [hidden] { display: none; }

/* 칩(필터·코스 고르기) — 링크, 상태는 URL. 현재는 먹색 테두리 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.chips a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 22px; color: var(--ink-2); text-decoration: none; font-size: 15px; }
.chips a:hover { color: var(--ink); text-decoration: none; }
.chips a[aria-current="true"] { border: 2px solid var(--ink); color: var(--ink); font-weight: 700; padding: 0 13px; }
.filter-label { font-size: 14px; color: var(--muted); margin: 16px 0 4px; }

/* 표 — td 를 44px 로 맞춘다(행을 덮지 않는다: 숫자를 읽는 표) */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl caption { text-align: left; color: var(--muted); font-size: 14px; padding-bottom: 8px; caption-side: top; }
.tbl th, .tbl td { height: 44px; padding: 0 8px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl thead th { font-size: 13px; color: var(--muted); font-weight: 400; }
.tbl tbody th { font-weight: 700; white-space: nowrap; }
.tbl td a, .tbl th a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }

/* 푸터 — 소개·방침·약관은 여기에만 */
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; padding: 24px 0 32px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 0 8px; }
.foot a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 8px; color: var(--ink-2); }
.foot p { margin: 8px 8px 0; }

/* 모바일 하단 탭바 5칸 (fish site.css 와 같은 구조) */
.tabbar { display: none; }
@media (max-width: 720px) {
  .nav { display: none; }
  body { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100;
            background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; color: var(--muted); font-size: 12px; text-decoration: none; }
  .tabbar a:focus-visible { outline-offset: -4px; }
  .tabbar a[aria-current="page"] { color: var(--ink); font-weight: 700; }
  .tabbar svg { width: 22px; height: 22px; }
  main { padding-top: 24px; }
}

/* ── 홈 ── */
.hero { position: relative; isolation: isolate; overflow: hidden; padding: 8px 4px; margin: 0 -4px; }   /* 4px 는 입력 칸 포커스 링 자리, overflow 는 등고선이 가로 스크롤을 만들지 않게 */
.hero__contour { position: absolute; right: -40px; top: 0; width: 420px; height: 260px; color: var(--topo); z-index: -1; }
.hero h1 { font-size: clamp(28px, 6vw, 40px); margin: 0 0 8px; max-width: 16em; }
.hero p { color: var(--ink-2); margin: 0 0 20px; max-width: 34em; }
.find { display: grid; grid-template-columns: 1fr auto; gap: 8px; max-width: 560px; }
.find label { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.basis { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.basis button { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 44px; }
.fire { list-style: none; margin: 0; padding: 0; }
.fire li { display: grid; grid-template-columns: 1fr auto; align-items: center; min-height: 44px; border-bottom: 1px solid var(--line); }
.learn { list-style: none; margin: 0; padding: 0; }
.learn a { display: flex; align-items: center; min-height: 44px; }
@media (max-width: 720px) {
  .hero__contour { width: 260px; height: 170px; right: -60px; }
  .find { grid-template-columns: 1fr; }
  .find .btn { width: 100%; }            /* 폰에서 주 버튼은 폭을 채운다 */
  .cols { grid-template-columns: 1fr; }
}

/* ── 산 상세 ── */
.crumb { font-size: 14px; color: var(--muted); margin: -12px 0 0; }
.crumb a { display: inline-flex; align-items: center; min-height: 44px; }
.head h1 { font-size: clamp(30px, 7vw, 44px); margin: 0; }
.head p { margin: 4px 0 0; color: var(--ink-2); }
.badge { display: inline-block; font-size: 13px; padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--ink-2); margin-left: 4px; vertical-align: 2px; }
.courses { margin: 20px 0 0; }

/* 출발 마감 — 이 화면의 큰 숫자는 이것 하나. 사람이 이 숫자를 보고 알람을 맞추거나 코스를 바꾼다 */
.plan { margin: 8px 0 0; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.plan__t { margin: 0 0 8px; font-size: 16px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.plan__big { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.plan__big b { font-size: clamp(56px, 16vw, 88px); line-height: 1; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.plan__big span { font-size: 22px; font-weight: 700; }
.plan__late { margin: 0; font-size: 22px; font-weight: 700; }
.plan__how { margin: 8px 0 0; color: var(--ink-2); font-size: 15px; }

/* 시간 띠 — 06:00~20:00 를 한 줄에. 위치(%)는 서버가 계산해 style 로 넣는다(timing.ribbon).
   산행 = --line-strong 면, 여유 = 빗금, 일몰 뒤 = --muted 빗금. 강조색은 '출발 마감' 막대 하나. 비텍스트 대비: 막대 --accent 는 --topo 위 5.8 */
.ribbon { position: relative; margin: 44px 0 36px; height: 20px; border-radius: 4px; background: var(--topo); }
.ribbon > span { position: absolute; top: 0; bottom: 0; }
.ribbon .hike { background: var(--line-strong); }
.ribbon .spare { background: repeating-linear-gradient(135deg, var(--line-strong) 0 2px, transparent 2px 6px); }
.ribbon .dark { background: repeating-linear-gradient(90deg, var(--muted) 0 1px, transparent 1px 4px); border-radius: 0 4px 4px 0; right: 0; }
.ribbon .mark { width: 0; }
.ribbon .mark::before { content: ""; position: absolute; top: -6px; bottom: -6px; left: -1px; width: 2px; background: var(--ink-2); }
.ribbon .mark--deadline::before { left: -2px; width: 4px; background: var(--accent); }
.ribbon .lab { position: absolute; white-space: nowrap; font-size: 13px; color: var(--ink-2); transform: translateX(-50%); }
.ribbon .lab--up { bottom: calc(100% + 8px); font-weight: 700; color: var(--ink); }
.ribbon .lab--down { top: calc(100% + 8px); }
.ribbon .lab--end { transform: translateX(-100%); }
.ribbon .lab--start { transform: none; }

.verdict { margin: 0; padding-top: 16px; border-top: 1px solid var(--line); }
.verdict .v { font-size: 18px; }
.verdict ul { margin: 8px 0 0; padding-left: 20px; color: var(--ink-2); }
.verdict .miss { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.disclaim { margin: 12px 0 0; font-size: 14px; color: var(--muted); }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 44px; }
.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.profile { width: 100%; height: 140px; color: var(--ink-2); display: block; }
.profile .fill { fill: var(--sunken); }
.mapbox { margin: 12px 0 0; height: 280px; border-radius: 8px; background: var(--topo); border: 1px solid var(--line); }
@media (max-width: 720px) {
  .plan { padding: 16px; }
  .two { grid-template-columns: 1fr; }
  .tbl th, .tbl td { padding: 0 4px; font-size: 15px; }
}

/* ── 지도 ── 필터 칸은 하나(판정). 지역은 지도를 움직이면 된다 */
.layout { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
.map { position: relative; height: 620px; border-radius: 12px; overflow: hidden; background: var(--topo); border: 1px solid var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }   /* 지도 점(circleMarker)과 같은 모양 — 범례만 다른 모양이면 거짓말이다 */
.dot.ok { background: var(--good); } .dot.warn { background: var(--warn); } .dot.no { background: var(--crit); } .dot.none { background: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); max-height: 620px; overflow-y: auto; }
.list li { border-bottom: 1px solid var(--line); }
.list a { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; align-items: center; min-height: 56px; padding: 8px 4px; color: var(--ink); text-decoration: none; }
.list a:hover { background: var(--sunken); }
.list small { color: var(--muted); font-size: 13px; grid-column: 1; }
.list .v { grid-column: 2; grid-row: 1 / span 2; }
.leaflet-container { font: inherit; background: var(--topo); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--ink); }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; line-height: 1.5; }
.leaflet-popup-content b { font-size: 16px; }
.leaflet-popup-content a.go { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.leaflet-container a.leaflet-popup-close-button { width: 44px; height: 44px; font: 24px/44px sans-serif; color: var(--muted); }
.leaflet-container .leaflet-bar.leaflet-control a { width: 44px; height: 44px; line-height: 44px; font-size: 22px; }
.leaflet-bar a { background: var(--surface); color: var(--ink); border-color: var(--line); }
.leaflet-control-attribution { background: var(--surface) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--ink-2); }
@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  .map { height: 56vh; min-height: 320px; order: -1; }
  .list { max-height: none; }
}

/* ── 배우기·법적 페이지 ── */
.prose { max-width: 42em; }
.prose p, .prose li { color: var(--ink); }
.prose h2 { font-size: 20px; }
.src { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.src a { display: inline-flex; align-items: center; min-height: 44px; }
.formula { background: var(--sunken); border-radius: 8px; padding: 12px 16px; font-weight: 700; margin: 0 0 12px; }

/* ── 더보기 — 제목 있는 두 묶음 ── */
.mgroup { margin-top: 32px; }
.mgrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.mgrid a { display: flex; align-items: center; min-height: 56px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); text-decoration: none; }
.mgrid a:hover { background: var(--sunken); }

/* ── 쿠팡 칸(스위치 기본 끔) ── */
.cpn { margin: 44px 0 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.cpn__h { margin: 0; font-weight: 700; }
.cpn__d { margin: 4px 0 12px; font-size: 13px; color: var(--muted); }
.cpn__l { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cpn__l a { display: inline-flex; align-items: center; min-height: 44px; }
.cpn__l img { width: 88px; height: 88px; object-fit: cover; border-radius: 8px; }
