:root {
  --bg: #f7f2ea;
  --surface: #fffaf3;
  --ink: #2b241c;
  --muted: #7a6c5c;
  --accent: #c0622f;
  --line: #e6dccd;
  --shadow: 0 1px 2px rgba(40, 30, 20, .06), 0 8px 24px rgba(40, 30, 20, .08);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --radius: 14px;
  color-scheme: light;
}
[data-theme="ocean"]  { --bg: #eef4f6; --surface: #f8fbfc; --ink: #12303b; --muted: #557280; --accent: #1f7a99; --line: #d3e2e8; }
[data-theme="forest"] { --bg: #eef1ea; --surface: #f8faf5; --ink: #1f2b1d; --muted: #5d6d57; --accent: #4c7a3a; --line: #d7dfcf; }
[data-theme="city"]   { --bg: #f1f1f1; --surface: #fafafa; --ink: #161616; --muted: #666; --accent: #d1342f; --line: #ddd; }
[data-theme="night"]  { --bg: #12141c; --surface: #1b1e29; --ink: #ece8e1; --muted: #9a98a3; --accent: #e5b45a; --line: #2c3040; color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); }
a { color: var(--accent); }
img { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; max-width: 1120px; margin: 0 auto; }
.brand { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--ink); text-decoration: none; }
.brand span { color: var(--accent); }
.topbar nav a { margin-left: 18px; color: var(--muted); text-decoration: none; font-size: 14px; }
.topbar nav a:hover { color: var(--ink); }

/* ---------- index ---------- */
.intro { padding: 48px 0 24px; }
.intro h1 { font-size: clamp(34px, 6vw, 60px); max-width: 14ch; }
.trip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; padding-bottom: 64px; }
.trip-card { position: relative; display: block; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 5; background: var(--line); box-shadow: var(--shadow); color: #fff; text-decoration: none; }
.trip-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.trip-card:hover img { transform: scale(1.04); }
.trip-card .meta { position: absolute; inset: auto 0 0 0; padding: 60px 20px 20px; background: linear-gradient(transparent, rgba(0, 0, 0, .72)); }
.trip-card h2 { font-size: 28px; margin: 0; }
.trip-card p { margin: 4px 0 0; opacity: .85; font-size: 14px; }
.empty { padding: 60px 24px; text-align: center; border: 1.5px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

/* ---------- trip page ---------- */
.cover { position: relative; min-height: 88vh; display: flex; align-items: flex-end; color: #fff; background: #222; overflow: hidden; }
.bgimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,0) 35%, rgba(0,0,0,.65)); }
.cover .wrap { position: relative; z-index: 1; padding-bottom: 64px; width: 100%; }
.cover h1 { font-size: clamp(40px, 8vw, 92px); max-width: 12ch; }
.cover .sub { font-size: clamp(17px, 2.2vw, 22px); opacity: .92; max-width: 40ch; }
.cover .dates { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; opacity: .85; margin-bottom: 12px; }
.cover .back { position: absolute; top: 18px; left: 20px; z-index: 2; color: #fff; text-decoration: none; font-size: 14px; opacity: .9; }
.summary { font-family: var(--serif); font-size: clamp(19px, 2.4vw, 24px); line-height: 1.55; max-width: 34em; margin: 72px auto 24px; padding: 0 20px; }

.chapters-nav { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.chapters-nav .wrap { display: flex; gap: 6px; overflow-x: auto; padding-top: 10px; padding-bottom: 10px; scrollbar-width: none; }
.chapters-nav a { flex: none; padding: 6px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 14px; white-space: nowrap; }
.chapters-nav a.active, .chapters-nav a:hover { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.section { padding: 72px 0 24px; scroll-margin-top: 56px; }
.section-head { max-width: 40em; margin-bottom: 28px; }
.section-head .kicker { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--accent); font-weight: 600; }
.section-head h2 { font-size: clamp(28px, 4vw, 44px); margin-top: 6px; }
.section-head .body p { margin: 0 0 .8em; font-size: 18px; }

figure { margin: 0; }
.ph { position: relative; border-radius: 10px; overflow: hidden; background: var(--line); cursor: zoom-in; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph figcaption { position: absolute; inset: auto 0 0 0; padding: 28px 12px 10px; font-size: 13px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.6)); opacity: 0; transition: opacity .2s; }
.ph:hover figcaption { opacity: 1; }
@media (hover: none) { .ph figcaption { opacity: 1; } }

.layout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.layout-grid .ph { aspect-ratio: 1; }
.layout-grid .ph.featured { grid-column: span 2; grid-row: span 2; }
@media (max-width: 560px) { .layout-grid { grid-template-columns: 1fr 1fr; } .layout-grid .ph.featured { grid-column: 1 / -1; grid-row: auto; aspect-ratio: 4/3; } }

.layout-mosaic { columns: 3 260px; column-gap: 10px; }
.layout-mosaic .ph { break-inside: avoid; margin-bottom: 10px; }
.layout-mosaic .ph img { height: auto; }

.layout-carousel { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
.layout-carousel .ph { flex: none; height: min(62vh, 520px); scroll-snap-align: center; }
.layout-carousel .ph img { width: auto; height: 100%; }

.layout-single .ph { max-height: 80vh; }
.layout-single .ph img { object-fit: contain; max-height: 80vh; background: var(--surface); }
.layout-single .caption { font-family: var(--serif); font-size: 18px; margin-top: 12px; color: var(--muted); }
.layout-single .rest { margin-top: 10px; }

.section.hero { padding: 0; margin-top: 72px; }
.hero-frame { position: relative; min-height: 80vh; display: flex; align-items: flex-end; color: #fff; background: #222; overflow: hidden; }
.hero-frame::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.7)); }
.hero-frame .wrap { position: relative; z-index: 1; padding-bottom: 56px; width: 100%; }
.hero-frame .section-head { margin: 0; }
.hero-frame .kicker { color: #fff; opacity: .85; }
.section.hero .rest { padding-top: 12px; }

.map { height: 420px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 12px; z-index: 0; }

.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(8, 8, 10, .94); display: none; align-items: center; justify-content: center; flex-direction: column; padding: 20px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 82vh; object-fit: contain; border-radius: 6px; }
.lightbox .lb-cap { color: #ddd; margin-top: 14px; text-align: center; max-width: 60ch; font-size: 15px; }
.lightbox button { position: absolute; background: none; border: 0; color: #fff; font-size: 34px; cursor: pointer; padding: 12px 18px; opacity: .8; }
.lightbox button:hover { opacity: 1; }
.lightbox .lb-close { top: 8px; right: 8px; }
.lightbox .lb-prev { left: 4px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 4px; top: 50%; transform: translateY(-50%); }

footer.site { padding: 64px 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- uploader / library ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 22px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
input[type=text], input[type=password] { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); min-width: 0; flex: 1; }
button.btn { font: inherit; font-size: 14px; padding: 9px 16px; border-radius: 8px; border: 0; background: var(--accent); color: #fff; cursor: pointer; }
button.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.btn:disabled { opacity: .5; cursor: default; }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 48px 20px; text-align: center; color: var(--muted); transition: background .2s, border-color .2s; cursor: pointer; }
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.drop strong { color: var(--ink); }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 14px; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.stat b { display: block; font-size: 24px; font-family: var(--serif); }
.stat span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.lib .item { background: var(--bg); border-radius: 10px; overflow: hidden; font-size: 12px; }
.lib .item img { aspect-ratio: 1; object-fit: cover; width: 100%; background: var(--line); }
.lib .item .cap { padding: 6px 8px 8px; line-height: 1.35; }
.lib .item.hidden { opacity: .45; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 11px; background: var(--line); color: var(--muted); }
.badge.done { background: #dbeedd; color: #2b6b33; }
.badge.error { background: #f5d9d6; color: #9b2c22; }
.badge.pending { background: #f3ead2; color: #8a6514; }
.log { font: 12px/1.5 ui-monospace, monospace; max-height: 160px; overflow: auto; margin-top: 12px; color: var(--muted); white-space: pre-wrap; }
table.trips { width: 100%; border-collapse: collapse; font-size: 14px; }
table.trips td, table.trips th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
