/* Wanderlust — iPhone-first editorial UI */
@font-face { font-family: "Crimson"; src: url(/fonts/CrimsonText-Regular.ttf) format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Crimson"; src: url(/fonts/CrimsonText-Italic.ttf) format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Crimson"; src: url(/fonts/CrimsonText-SemiBold.ttf) format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Crimson"; src: url(/fonts/CrimsonText-SemiBoldItalic.ttf) format("truetype"); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: "Crimson"; src: url(/fonts/CrimsonText-Bold.ttf) format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url(/fonts/DMSans.ttf) format("truetype"); font-weight: 100 1000; font-display: swap; }

:root {
  --paper: #F6F1E9; --card: #FFFDF9; --ink: #1D1A16; --soft: #4B443B; --muted: #8A7F71;
  --line: #E4D9CA; --accent: #A4462A; --accent-ink: #fff; --tint: #EFE6D8; --ok: #3F6B4F; --warn: #A4462A;
  --shadow: 0 1px 2px rgba(40,30,20,.06), 0 8px 24px rgba(40,30,20,.08);
  --serif: "Crimson", "Iowan Old Style", Georgia, serif;
  --sans: "DM Sans", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --tabbar: calc(58px + env(safe-area-inset-bottom));
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: light;
}
:root[data-theme="night"] {
  --paper: #0F1214; --card: #171B1E; --ink: #EEE7DB; --soft: #C9C0B3; --muted: #8E8679;
  --line: #2A2F33; --accent: #E0895F; --accent-ink: #1A0F09; --tint: #1E2428; --ok: #7FB38F; --warn: #E0895F;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
img { display: block; max-width: 100%; }

/* ---------- structure ---------- */
#app { min-height: 100dvh; }
.view { padding: calc(env(safe-area-inset-top) + 14px) 18px calc(var(--tabbar) + 28px); max-width: 720px; margin: 0 auto; animation: viewIn .35s var(--ease); }
.view.flush { padding: 0 0 calc(var(--tabbar) + 28px); max-width: none; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tabbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: var(--tabbar); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(18px); -webkit-backdrop-filter: saturate(1.4) blur(18px); border-top: .5px solid var(--line); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 10.5px; font-weight: 500; letter-spacing: .02em; }
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.on { color: var(--ink); }
.tabbar a.on svg { color: var(--accent); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.kicker { font: 600 11px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 40px; line-height: 1.02; }
h2 { font-size: 27px; line-height: 1.1; }
h3 { font-size: 20px; line-height: 1.2; font-weight: 600; }
p { line-height: 1.55; color: var(--soft); }
.lede { font-family: var(--serif); font-size: 20px; line-height: 1.45; color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.rule { height: 1px; background: var(--line); margin: 22px 0; border: 0; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- controls ---------- */
.btn { appearance: none; border: 0; border-radius: 999px; padding: 12px 18px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; transition: transform .15s var(--ease), opacity .15s; }
.btn:active { transform: scale(.97); }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.small { min-height: 36px; padding: 8px 14px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }
.iconbtn { width: 42px; height: 42px; border-radius: 50%; border: 0; display: inline-grid; place-items: center; background: var(--card); color: var(--ink); box-shadow: var(--shadow); cursor: pointer; }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn.glass { background: rgba(20,18,16,.35); color: #fff; box-shadow: none; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.iconbtn.on { color: var(--accent); }
.field { display: block; }
.field > span { display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px 2px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 13px 14px; font-size: 16px; outline: none; }
.input:focus { border-color: var(--accent); }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.5; }
.searchbox { position: relative; }
.searchbox svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 19px; color: var(--muted); }
.searchbox .input { padding-left: 42px; border-radius: 999px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 13px; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--tint); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 8px 6px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.card.pad { padding: 18px; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; letter-spacing: .04em; padding: 4px 9px; border-radius: 999px; background: var(--tint); color: var(--soft); }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge svg { width: 12px; height: 12px; }
.empty { text-align: center; padding: 48px 18px; }
.empty h2 { margin-bottom: 8px; }

/* ---------- Discover feed (full-screen vertical swipe) ---------- */
.feed { height: calc(100dvh - var(--tabbar)); overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; }
.slide { position: relative; height: calc(100dvh - var(--tabbar)); scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; background: #1b1f22; color: #fff; }
.slide .ph { position: absolute; inset: 0; background: linear-gradient(135deg, #3b4a4f, #8a7b66); }
.slide .ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.06); transition: opacity 1s var(--ease), transform 7s ease-out; }
.slide .ph img.in { opacity: 1; transform: scale(1); }
.slide .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,0) 22%, rgba(0,0,0,0) 42%, rgba(0,0,0,.78) 100%); }
.slide .meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 20px 22px; }
.slide .meta h1 { font-size: 46px; color: #fff; text-shadow: 0 2px 18px rgba(0,0,0,.35); }
.slide .meta .where { font: 600 11.5px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; opacity: .9; margin-bottom: 8px; }
.slide .meta p { color: rgba(255,255,255,.92); font-family: var(--serif); font-size: 18px; line-height: 1.4; margin: 10px 0 12px; }
.slide .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.slide .tags span { font-size: 11.5px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.16); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.slide .actions { display: flex; gap: 10px; align-items: center; }
.slide .actions .btn { background: #fff; color: #111; }
.slide .top { position: absolute; top: calc(env(safe-area-inset-top) + 10px); left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; }
.slide .credit { position: absolute; right: 10px; top: calc(env(safe-area-inset-top) + 62px); font-size: 10px; opacity: .7; writing-mode: vertical-rl; max-height: 40%; overflow: hidden; }
.slide.intro { background: var(--paper); color: var(--ink); display: flex; align-items: stretch; }
.slide.intro .inner { padding: calc(env(safe-area-inset-top) + 18px) 20px 24px; overflow-y: auto; width: 100%; max-width: 720px; margin: 0 auto; }

/* ---------- Destination profile ---------- */
.hero { position: relative; height: min(68vh, 620px); background: #222; color: #fff; overflow: hidden; }
.hero .strip { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.hero .strip::-webkit-scrollbar { display: none; }
.hero .strip figure { margin: 0; flex: 0 0 100%; height: 100%; scroll-snap-align: start; position: relative; }
.hero .strip img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s var(--ease); }
.hero .strip img.in { opacity: 1; }
.hero .shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.4), rgba(0,0,0,0) 25%, rgba(0,0,0,0) 50%, rgba(0,0,0,.75)); }
.hero .title { position: absolute; left: 20px; right: 20px; bottom: 22px; pointer-events: none; }
.hero .title h1 { font-size: 50px; color: #fff; }
.hero .title .where { font: 600 11.5px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; margin-bottom: 8px; opacity: .9; }
.hero .nav { position: absolute; top: calc(env(safe-area-inset-top) + 10px); left: 14px; right: 14px; display: flex; justify-content: space-between; }
.hero .dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.hero .dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.45); }
.hero .dots i.on { background: #fff; }
.hero .credit { position: absolute; right: 12px; bottom: 34px; font-size: 10px; opacity: .75; max-width: 60%; text-align: right; }
.profile { padding: 22px 20px 0; max-width: 720px; margin: 0 auto; }
.place { display: grid; grid-template-columns: 34px 1fr; gap: 4px 12px; padding: 16px 0; border-top: 1px solid var(--line); }
.place .n { font: italic 400 24px/1 var(--serif); color: var(--accent); }
.place h3 { margin-bottom: 4px; }
.place p { margin: 4px 0 8px; font-size: 15px; }
.place .meta { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.place .row { margin-top: 10px; }
.weather { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; align-items: end; height: 150px; padding-top: 18px; }
.weather div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 9.5px; color: var(--muted); position: relative; }
.weather .bar { width: 9px; border-radius: 6px; background: #C8B9A4; position: relative; }
.weather .best .bar { background: var(--accent); }
.weather .hi { font-weight: 700; color: var(--ink); font-size: 10px; margin-bottom: 3px; }
.weather .lbl { margin-top: 6px; font-weight: 600; }
.sources a { display: block; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; }
.sources a small { display: block; color: var(--muted); margin-top: 2px; }
.sticky-cta { position: sticky; bottom: calc(var(--tabbar) + 12px); z-index: 5; display: flex; gap: 10px; padding: 0 20px; max-width: 720px; margin: 24px auto 0; }
.sticky-cta .btn { flex: 1; box-shadow: 0 10px 30px rgba(0,0,0,.25); }

/* ---------- photo grid & viewer ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.grid button { border: 0; padding: 0; aspect-ratio: 4/5; border-radius: 12px; overflow: hidden; background: var(--tint); cursor: pointer; position: relative; }
.grid button:nth-child(5n+1) { grid-column: span 2; aspect-ratio: 16/10; }
.grid img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s var(--ease); }
.grid img.in { opacity: 1; }
.grid .sel { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.viewer { position: fixed; inset: 0; z-index: 60; background: #000; color: #fff; display: flex; flex-direction: column; animation: fadeIn .25s ease; touch-action: none; }
@keyframes fadeIn { from { opacity: 0; } }
.viewer .stage { flex: 1; position: relative; overflow: hidden; }
.viewer .stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity .35s var(--ease); transform-origin: center; will-change: transform; }
.viewer .bar { position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 10px 14px; z-index: 2; }
.viewer .bar.top { top: 0; padding-top: calc(env(safe-area-inset-top) + 10px); background: linear-gradient(rgba(0,0,0,.6), transparent); }
.viewer .bar.bottom { bottom: 0; padding-bottom: calc(env(safe-area-inset-bottom) + 14px); background: linear-gradient(transparent, rgba(0,0,0,.75)); flex-direction: column; align-items: stretch; }
.viewer .cap { font-family: var(--serif); font-size: 16px; line-height: 1.35; }
.viewer .cred { font-size: 11px; opacity: .75; }
.viewer .cred a { color: #fff; }

/* ---------- lists ---------- */
.tile { display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; align-items: center; padding: 10px; text-decoration: none; color: inherit; }
.tile img, .tile .ph { width: 92px; height: 92px; border-radius: 14px; object-fit: cover; background: var(--tint); }
.tile h3 { font-size: 19px; }
.list > * + * { margin-top: 10px; }

/* ---------- system check ---------- */
.check { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line); }
.check .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--tint); color: var(--muted); }
.check.pass .dot { background: var(--ok); color: #fff; }
.check.fail .dot { background: var(--warn); color: #fff; }
.check.run .dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.check pre { white-space: pre-wrap; font-size: 11.5px; color: var(--muted); margin: 6px 0 0; font-family: ui-monospace, Menlo, monospace; }

/* ---------- sheets, toasts, loading ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.35); animation: fadeIn .2s; }
.sheet { position: fixed; z-index: 51; left: 0; right: 0; bottom: 0; max-height: 88dvh; overflow-y: auto; background: var(--paper); border-radius: 24px 24px 0 0; padding: 10px 20px calc(env(safe-area-inset-bottom) + 20px); animation: up .35s var(--ease); max-width: 720px; margin: 0 auto; }
.sheet .sheet-x { position: absolute; top: 12px; right: 14px; width: 36px; height: 36px; box-shadow: none; background: var(--tint); }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
@keyframes up { from { transform: translateY(100%); } }
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(var(--tabbar) + 16px); translate: -50% 0; background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 14px; font-size: 14px; max-width: calc(100vw - 32px); box-shadow: var(--shadow); animation: up .3s var(--ease); }
.loading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 64px 20px; text-align: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--tint), var(--line), var(--tint)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.notice { border-left: 3px solid var(--accent); background: var(--tint); padding: 12px 14px; border-radius: 4px 12px 12px 4px; font-size: 14px; line-height: 1.5; color: var(--soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .slide .ph img { transform: none !important; }
}
@media (min-width: 900px) {
  .slide .meta, .hero .title { max-width: 720px; left: 50%; translate: -50% 0; width: 100%; }
}

/* ---------- welcome tour ---------- */
.tour { position: fixed; inset: 0; z-index: 90; background: var(--paper); display: flex; flex-direction: column; animation: fadeIn .3s ease; }
.tour-track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.tour-track::-webkit-scrollbar { display: none; }
.tour-card { flex: 0 0 100%; scroll-snap-align: start; padding: calc(env(safe-area-inset-top) + 64px) 26px 20px; overflow-y: auto; max-width: 620px; margin: 0 auto; }
.tour-card h1 { margin: 10px 0 12px; }
.tour-card .lede { margin: 0 0 18px; }
.tour-card ul { list-style: none; padding: 0; margin: 0; }
.tour-card li { position: relative; padding: 12px 0 12px 20px; border-top: 1px solid var(--line); line-height: 1.5; color: var(--soft); font-size: 15.5px; }
.tour-card li::before { content: ""; position: absolute; left: 2px; top: 21px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.tour-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--tint); color: var(--accent); margin-bottom: 22px; }
.tour-icon svg { width: 32px; height: 32px; }
.tour-skip { position: absolute; z-index: 2; top: calc(env(safe-area-inset-top) + 14px); right: 18px; border: 0; background: none; color: var(--muted); font-weight: 600; padding: 8px; cursor: pointer; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px calc(env(safe-area-inset-bottom) + 18px); }
.tour-dots { display: flex; gap: 6px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: width .25s var(--ease), background .25s; }
.tour-dots i.on { width: 22px; border-radius: 4px; background: var(--accent); }
