/* 타베타비 — 화면 가득한 일본 지도 + 지역색. 디자인 메모: site/DESIGN.md
   대담한 건 첫 화면의 큰 지도 하나, 나머지는 조용하게. */
:root {
  --paper: #f2f3ee;      /* 종이 */
  --sheet: #ffffff;      /* 역 이름판, 입력칸 */
  --ink: #20305c;        /* 남색 잉크 */
  --pencil: #626a7e;     /* 보조 글자 */
  --rule: #cdd1d9;       /* 괘선 */
  --land: #e1e2d8;
  --sea: #e7ebea;
  --danger: #b0331f;
  --ok: #3d7a3a;
  --wait: #8a5a12;
  --display: 'Black Han Sans', 'Gothic A1', sans-serif;
  --sans: 'Gothic A1', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --jp: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.6; word-break: keep-all; }
main { flex: 1 0 auto; width: 100%; }
main:focus { outline: none; }
a { color: var(--ink); text-underline-offset: 4px; text-decoration-thickness: 1px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
img { display: block; }
h1, h2 { font-weight: 400; }
.jp { font-family: var(--jp); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.loading { padding-top: 80px; padding-bottom: 80px; color: var(--pencil); }

/* ---------- 머리말 ---------- */
.site-head { border-bottom: 2px solid var(--ink); }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 14px; padding-bottom: 14px; }
.logo { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.logo .jp { font-size: 14px; font-weight: 700; color: var(--pencil); letter-spacing: .08em; }
.logo b { font-family: var(--display); font-weight: 400; font-size: 28px; letter-spacing: .01em; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 22px; font-size: 15px; font-weight: 700; }
.site-nav a { text-decoration: none; padding: 10px 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { border-bottom-color: var(--rule); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--ink); }
.site-nav a.admin-link { font-weight: 500; font-size: 14px; color: var(--pencil); }
@media (max-width: 600px) {
  .site-nav { width: 100%; gap: 0 18px; font-size: 14px; }
  .site-nav a.admin-link { margin-left: auto; }
}

/* ---------- 공통 ---------- */
.btn { min-height: 46px; padding: 0 20px; border: 1.5px solid var(--ink); border-radius: 8px; background: transparent; color: var(--ink); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { background: var(--sheet); }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:hover { background: #2b3f75; }
.btn.link { border: 0; padding: 0 2px; min-height: 40px; background: none; text-decoration: underline; text-underline-offset: 4px; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.empty { padding: 32px 28px; border: 1.5px dashed var(--rule); border-radius: 16px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.empty b { font-size: 18px; }
.empty p { margin: 0; color: var(--pencil); }
.notice { margin: 0; padding: 16px 20px; border: 1px solid var(--rule); border-radius: 12px; background: var(--sheet); }
.region { display: inline-flex; align-items: center; gap: 8px; }
.region::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }

/* ---------- 홈: 화면 가득 지도 + 서랍 ---------- */
/* 무대: 바다색 바탕 전체 폭. 왼쪽 글, 오른쪽 큰 지도. 서랍은 글 자리 위로 밀려 나온다 */
.stage { position: relative; background: var(--sea); border-bottom: 2px solid var(--ink); overflow: hidden; }
.stage-in { position: relative; display: flex; align-items: stretch; gap: 32px; height: clamp(600px, calc(100svh - 76px), 860px); padding-top: 32px; padding-bottom: 32px; }
.intro { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 20px; padding-bottom: 12px; transition: opacity .3s, transform .3s; }
.intro h1 { margin: 0; font-family: var(--display); font-size: clamp(44px, 4.8vw, 76px); line-height: 1.08; letter-spacing: -.01em; }
.intro p { margin: 0; max-width: 24em; font-size: 18px; color: var(--pencil); }
.intro p b { color: var(--ink); }
.map { flex: none; position: relative; container-type: size; height: 100%; aspect-ratio: 1 / 1; max-width: calc(100% - 440px); max-height: 100%; align-self: center; }
/* 지도 상자가 정사각형이 아니어도 지도 그림과 이름표가 같은 정사각형 안에서 함께 움직이게 */
.map-in { position: absolute; inset: 0; margin: auto; width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); container-type: inline-size; }
.map svg { width: 100%; height: 100%; display: block; overflow: visible; }
.map path { cursor: pointer; transition: fill .2s, fill-opacity .2s; }
/* 마우스를 올리면 어느 지역이든 그 지역색이 비친다 */
.map path.hover:not(.picked) { fill: var(--c); fill-opacity: .7; }

/* 서랍 */
.drawer { position: absolute; z-index: 5; top: 24px; max-height: calc(100% - 48px); left: 32px; width: min(440px, calc(100% - 64px)); display: flex; flex-direction: column; background: var(--sheet); border-radius: 16px; box-shadow: 0 0 0 1px var(--rule), 0 24px 60px -24px rgba(32, 48, 92, .45); overflow: auto; overscroll-behavior: contain;
  transform: translateX(calc(-100% - 48px)); transition: transform .34s cubic-bezier(.2, .8, .2, 1); }
.stage.open .drawer { transform: none; }
.stage.open .intro { opacity: 0; transform: translateX(-24px); pointer-events: none; }
.drawer-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 16px 14px 24px; background: color-mix(in srgb, var(--rc) 12%, var(--sheet)); }
.drawer-head h2 { margin: 0; font-family: var(--display); font-size: 34px; line-height: 1.15; display: flex; align-items: baseline; gap: 10px; }
.drawer-head h2:focus { outline: none; }
.drawer-head h2:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; border-radius: 4px; }
.drawer-head h2 .jp { font-size: 18px; font-weight: 700; color: var(--rc); }
.close { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: var(--paper); display: grid; place-items: center; }
.close:hover { background: var(--rule); }
.drawer-sub { margin: 0; padding: 0 24px 4px; color: var(--pencil); font-size: 15px; }
.drawer .post-list { padding: 0 24px; }
.drawer .empty { margin: 8px 24px 24px; }
.drawer .more { align-self: flex-start; margin: 8px 24px 24px; padding: 10px 0; border: 0; background: none; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }

/* 지역 이름표: 소개한 지역은 지역색으로 칠하고, 아직인 지역은 흰 바탕 */
.map .tag { position: absolute; transform: translate(-50%, -50%); min-height: 2.8em; padding: 0 1em; border-radius: 999px; border: 1px solid var(--rule); background: rgba(255, 255, 255, .92); color: var(--pencil); display: flex; align-items: center; gap: .4em; white-space: nowrap; font-size: clamp(9px, 2.5cqw, 14px); line-height: 1; transition: background .15s, border-color .15s, color .15s, transform .15s; }
.map .tag b { font-weight: 700; }
.map .tag .jp { font-size: .86em; font-weight: 500; opacity: .7; }
.map .tag small { min-width: 1.6em; height: 1.6em; padding: 0 .4em; margin-right: -.4em; border-radius: 999px; background: #fff; color: var(--c); font-size: .86em; font-weight: 800; display: grid; place-items: center; }
.map .tag:hover { border-color: var(--ink); color: var(--ink); }
.map .tag.hover { transform: translate(-50%, -50%) scale(1.2); z-index: 2; }
.map .tag.on { border-color: var(--c); background: var(--c); color: #fff; box-shadow: 0 8px 20px -10px var(--c); }
.map .tag.on b { font-weight: 800; }
.map .tag.on .jp { opacity: .85; }
.map .tag.on:hover { color: #fff; filter: brightness(1.08); }
.map .tag[aria-pressed="true"] { border-color: var(--c); color: #fff; background: var(--c); box-shadow: 0 0 0 3px var(--sea), 0 0 0 5px var(--ink); }
.map .tag.on[aria-pressed="true"] { color: #fff; background: var(--c); box-shadow: 0 0 0 3px var(--sea), 0 0 0 5px var(--ink); }

/* 좁은 화면: 글 → 지도 순서로 쌓고, 서랍은 아래에서 올라온다 */
@media (max-width: 900px) {
  .stage-in { flex-direction: column; height: auto; gap: 8px; padding-top: 36px; padding-bottom: 20px; }
  .intro { justify-content: flex-start; padding-bottom: 0; }
  .stage.open .intro { opacity: 1; transform: none; pointer-events: auto; }
  .intro h1 { font-size: clamp(38px, 9.6vw, 64px); }
  .intro p { font-size: 16px; }
  .map { width: 100%; height: auto; max-width: 560px; align-self: center; }
  .drawer { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: min(62svh, 520px); border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px -12px rgba(32, 48, 92, .45); transform: translateY(105%); }
  .drawer-head { padding: 18px 12px 10px 20px; }
  .drawer-head h2 { font-size: 28px; }
  .drawer-sub, .drawer .post-list { padding-left: 20px; padding-right: 20px; }
  .drawer .more { margin-left: 20px; margin-bottom: max(20px, env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) {
  .map .tag .jp { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .map .tag, .map path, .drawer, .intro { transition: none; }
}

/* 서랍·목록 공통 게시물 줄 */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li { border-bottom: 1px solid var(--rule); }
.post-list li:last-child { border-bottom: 0; }
.post-row { display: grid; grid-template-columns: 72px 1fr; gap: 16px; align-items: center; padding: 14px 0; text-decoration: none; }
.post-row img { width: 72px; height: 90px; object-fit: cover; border-radius: 4px; background: var(--land); }
.post-row .t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.post-row .place { font-size: 13px; font-weight: 700; color: var(--rc); }
.post-row b { font-size: 17px; font-weight: 800; line-height: 1.4; }
.post-row:hover b { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.post-row small { font-size: 14px; color: var(--pencil); display: flex; flex-wrap: wrap; gap: 0 12px; }

/* 최근 게시물: 카드 표지를 크게 가로로 */
.shelf { padding-top: 56px; padding-bottom: 112px; }
.shelf-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 20px; margin-bottom: 24px; }
.shelf-head h2 { margin: 0; font-family: var(--display); font-size: clamp(32px, 4vw, 44px); line-height: 1.15; }
.shelf-head a { font-weight: 700; padding: 8px 0; }
.covers { list-style: none; margin: 0; padding: 0 0 12px; display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 3 * 24px) / 4); gap: 24px; overflow-x: auto; scroll-snap-type: x mandatory; }
.covers > li { scroll-snap-align: start; min-width: 0; }
.cover { display: flex; flex-direction: column; gap: 4px; text-decoration: none; }
.cover img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 8px; background: var(--land); box-shadow: 0 0 0 1px var(--rule); margin-bottom: 10px; }
.cover .place { font-size: 13px; font-weight: 700; color: var(--rc); }
.cover b { font-size: 18px; font-weight: 800; line-height: 1.4; }
.cover:hover b { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.cover small { font-size: 14px; color: var(--pencil); display: flex; flex-wrap: wrap; gap: 0 12px; }
/* 다음 게시물 자리: 점선 빈칸 */
.cover-next { aspect-ratio: 4 / 5; border: 1.5px dashed #a3abb9; border-radius: 8px; padding: 24px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 14px; }
.cover-next p { margin: 0; color: var(--pencil); font-size: 15px; }
.cover-next p b { display: block; margin-bottom: 4px; color: var(--ink); font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.2; }
@media (max-width: 900px) { .covers { grid-auto-columns: calc((100% - 2 * 16px) / 2.6); gap: 16px; } }
@media (max-width: 600px) { .shelf { padding-top: 40px; } .covers { grid-auto-columns: 62%; } .cover b { font-size: 16px; } }

/* ---------- 게시판 ---------- */
.board { padding-top: 56px; padding-bottom: 112px; display: flex; flex-direction: column; gap: 24px; }
.board-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 20px; }
.board-head h1 { margin: 0; font-family: var(--display); font-size: clamp(40px, 5.4vw, 60px); line-height: 1.1; }
.board-head p { margin: 0; color: var(--pencil); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 42px; padding: 0 16px 0 14px; border-radius: 999px; border: 1.5px solid var(--rule); background: transparent; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.chip::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.chip span { font-weight: 500; color: var(--pencil); font-variant-numeric: tabular-nums; }
.chip[data-zero] { color: var(--pencil); font-weight: 500; }
.chip[data-zero]::before { background: transparent; box-shadow: inset 0 0 0 1.5px #a9b0bd; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.chip[aria-pressed="true"]::before { box-shadow: 0 0 0 2px var(--paper); }
.chip[aria-pressed="true"] span { color: var(--paper); }
.table-box { overflow-x: auto; }
table.list { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 15px; }
table.list th { padding: 12px; text-align: left; font-size: 13px; font-weight: 700; color: var(--pencil); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); }
table.list td { padding: 14px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.list td.id { font-weight: 800; font-variant-numeric: tabular-nums; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.list .thumb { width: 44px; height: 55px; object-fit: cover; border-radius: 3px; background: var(--land); }
table.list a.title { font-size: 17px; font-weight: 800; text-decoration: none; }
table.list a.title:hover { text-decoration: underline; }
table.list small { display: block; margin-top: 2px; font-size: 13px; color: var(--pencil); }

/* ---------- 게시물 보기 ---------- */
.post { padding-top: 24px; padding-bottom: 112px; display: flex; flex-direction: column; gap: 24px; }
.back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; font-weight: 700; text-decoration: none; }
.back:hover { text-decoration: underline; }
.post-body { display: flex; flex-wrap: wrap; gap: 56px; align-items: flex-start; }
.viewer { flex: 1 1 400px; max-width: 520px; display: flex; flex-direction: column; gap: 14px; }
.viewer .main { aspect-ratio: 4 / 5; background: var(--sheet); border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px var(--rule); }
.viewer .main img { width: 100%; height: 100%; object-fit: cover; }
.viewer .ctrl { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.round { width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid var(--ink); background: transparent; display: flex; align-items: center; justify-content: center; }
.round:hover { background: var(--sheet); }
.thumbs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.thumbs button { padding: 0; border: 0; border-radius: 4px; background: var(--sheet); aspect-ratio: 4 / 5; overflow: hidden; opacity: .55; }
.thumbs button:hover { opacity: .85; }
.thumbs button[aria-current="true"] { opacity: 1; outline: 2px solid var(--ink); outline-offset: 2px; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.post-text { flex: 999 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }

/* 역 이름판(駅名標): 흰 판, 지역색 띠, 아래에 옆 역 = 이전 편 / 다음 편 */
.sign { background: var(--sheet); border-radius: 14px; box-shadow: 0 0 0 1px var(--rule); overflow: hidden; }
.sign .place { display: block; padding: 24px 28px 0; font-size: 15px; font-weight: 700; color: var(--rc); }
.sign h1 { margin: 6px 0 0; padding: 0 28px; font-family: var(--display); font-size: clamp(32px, 4.4vw, 48px); line-height: 1.18; }
.sign .food { margin: 12px 0 0; padding: 0 28px 22px; color: var(--pencil); display: flex; flex-wrap: wrap; gap: 0 12px; }
.sign .food .jp { font-weight: 700; color: var(--ink); }
.neighbors { background: color-mix(in srgb, var(--rc) 12%, transparent); display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; }
.neighbors a { display: flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 8px; border-radius: 8px; text-decoration: none; font-weight: 800; }
.neighbors a:hover { background: var(--paper); }
.neighbors span { display: flex; flex-direction: column; line-height: 1.25; }
.neighbors .next span { text-align: right; }
.neighbors small { font-size: 12px; font-weight: 500; color: var(--pencil); }
@media (max-width: 600px) { .sign .place, .sign h1, .sign .food { padding-left: 20px; padding-right: 20px; } .neighbors { padding: 8px; } }

.facts { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; color: var(--pencil); }
.facts span:first-child { font-weight: 800; color: var(--ink); }
.caption { margin: 0; max-width: 40em; font-size: 17px; line-height: 1.9; white-space: pre-line; }
.tags { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; font-weight: 700; color: var(--pencil); }
.credit { border-top: 1px solid var(--rule); padding-top: 16px; }
.credit h2 { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--pencil); }
.credit p { margin: 0; font-size: 14px; line-height: 1.75; white-space: pre-line; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- 꼬리말 ---------- */
.site-foot { border-top: 1px solid var(--rule); }
.site-foot .wrap { padding-top: 24px; padding-bottom: 36px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font-size: 13px; color: var(--pencil); }
.site-foot a { color: var(--pencil); margin-left: 8px; }

/* ---------- 관리자 ---------- */
.admin { padding: 48px 0 112px; display: flex; flex-direction: column; gap: 24px; }
.admin h1 { margin: 0; font-family: var(--display); font-size: clamp(34px, 4.4vw, 46px); line-height: 1.15; }
.login { max-width: 420px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 14px; font-weight: 700; }
.field .hint { font-size: 13px; color: var(--pencil); }
.field input, .field select, .field textarea { min-height: 46px; padding: 10px 12px; border: 1.5px solid var(--rule); border-radius: 8px; background: var(--sheet); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); outline: none; }
.field textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px 24px; }
.form-grid .wide { grid-column: 1 / -1; }
.img-list { display: flex; flex-wrap: wrap; gap: 12px; }
.img-item { width: 120px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.img-item img { width: 120px; height: 150px; object-fit: cover; border-radius: 4px; box-shadow: 0 0 0 1px var(--rule); background: var(--sheet); }
.img-item .row { display: flex; gap: 4px; }
.img-item .row button { flex: 1; min-height: 36px; border: 1.5px solid var(--rule); border-radius: 6px; background: var(--sheet); }
.img-item .row button:hover { border-color: var(--ink); }
.badge { display: inline-block; padding: 1px 9px; font-size: 12px; font-weight: 700; border: 1.5px solid currentColor; border-radius: 999px; }
.badge.draft { color: var(--pencil); }
.badge.wait { color: var(--wait); }
.badge.live { color: var(--ok); }
.msg { padding: 12px 16px; border: 1px solid var(--rule); border-radius: 12px; background: var(--sheet); }
.msg.err { border-left-color: var(--danger); color: var(--danger); }
