/* =====================================================================
   Atlas — travel journal. One stylesheet for every page.
   Concept: postcards, passport stamps and a boarding pass on warm paper
   (light) or a night-train cabin (dark). Glass header, soft gradients.
   ===================================================================== */

:root {
  color-scheme: light;
  --paper: 246 241 231;
  --paper-2: 239 232 218;
  --card: 255 252 246;
  --ink: 29 27 23;
  --ink-2: 74 69 60;
  --ink-3: 120 113 100;
  --line: 222 212 192;
  --accent: 194 65 12;      /* terracotta */
  --accent-2: 217 119 6;    /* saffron */
  --sea: 30 78 121;         /* sea blue */
  --stamp: 180 35 42;       /* stamp red */
  --good: 21 128 61;
  --shadow: 60 40 15;
  --radius: 14px;
  --radius-sm: 9px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --hand: "Caveat", "Segoe Print", cursive;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: 18 17 15;
    --paper-2: 26 24 21;
    --card: 31 29 26;
    --ink: 239 233 221;
    --ink-2: 205 197 182;
    --ink-3: 150 142 128;
    --line: 58 54 47;
    --accent: 240 138 75;
    --accent-2: 250 190 90;
    --sea: 120 170 220;
    --stamp: 240 100 100;
    --good: 74 222 128;
    --shadow: 0 0 0;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: 18 17 15;
  --paper-2: 26 24 21;
  --card: 31 29 26;
  --ink: 239 233 221;
  --ink-2: 205 197 182;
  --ink-3: 150 142 128;
  --line: 58 54 47;
  --accent: 240 138 75;
  --accent-2: 250 190 90;
  --sea: 120 170 220;
  --stamp: 240 100 100;
  --good: 74 222 128;
  --shadow: 0 0 0;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: rgb(var(--paper)); -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { overflow-x: clip; }
body {
  margin: 0;
  color: rgb(var(--ink));
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(70rem 40rem at 85% -10%, rgb(var(--accent) / .10), transparent 60%),
    radial-gradient(60rem 40rem at -10% 20%, rgb(var(--sea) / .08), transparent 60%),
    rgb(var(--paper));
  min-height: 100vh;
}
/* Subtle paper grain */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main, header, footer { position: relative; z-index: 1; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: rgb(var(--accent) / .22); }
:focus-visible { outline: 2px solid rgb(var(--accent)); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }
@media (max-width: 640px) { .wrap { width: calc(100% - 2rem); } }

.kicker {
  font: 500 11px/1.2 var(--mono); letter-spacing: .16em; text-transform: uppercase;
  color: rgb(var(--ink-3));
}
.serif { font-family: var(--serif); }
.muted { color: rgb(var(--ink-3)); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  padding: .7rem 1.15rem; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; text-decoration: none; transition: transform .15s, background .2s, border-color .2s, box-shadow .2s;
  background: rgb(var(--ink)); color: rgb(var(--paper));
  box-shadow: 0 8px 20px -10px rgb(var(--shadow) / .45);
}
.btn:hover { transform: translateY(-1px); }
.btn.accent { background: linear-gradient(135deg, rgb(var(--accent)), rgb(var(--accent-2))); color: #fff; }
.btn.ghost { background: rgb(var(--card) / .6); color: rgb(var(--ink)); border-color: rgb(var(--line)); box-shadow: none; backdrop-filter: blur(8px); }
.btn.ghost:hover { border-color: rgb(var(--accent) / .6); color: rgb(var(--accent)); }
.btn.danger { background: rgb(var(--stamp)); color: #fff; }
.btn.small { padding: .45rem .8rem; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: default; transform: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  border: 1px solid rgb(var(--line)); background: rgb(var(--card) / .6); color: rgb(var(--ink-2));
}
.icon-btn:hover { color: rgb(var(--accent)); border-color: rgb(var(--accent) / .6); }

/* ---------- Header (glass, full width) ---------- */
.top {
  position: sticky; top: 0; z-index: 50;
  background: rgb(var(--paper) / .72); backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid rgb(var(--line) / .7);
}
.top .wrap { display: flex; align-items: center; gap: 1rem; height: 64px; }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; font: 600 22px/1 var(--serif); letter-spacing: -.01em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: radial-gradient(circle at 30% 30%, rgb(var(--accent-2)), rgb(var(--accent)) 70%);
  box-shadow: 0 6px 16px -6px rgb(var(--accent));
}
.nav { display: flex; gap: .25rem; margin-left: 1rem; }
.nav a { text-decoration: none; padding: .4rem .8rem; border-radius: 999px; font-size: 14px; font-weight: 500; color: rgb(var(--ink-2)); }
.nav a:hover { color: rgb(var(--ink)); background: rgb(var(--ink) / .05); }
.nav a.active { color: rgb(var(--ink)); background: rgb(var(--ink) / .07); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; border: 1px solid rgb(var(--line)); background: rgb(var(--card) / .6); }
.seg button { border: 0; background: none; cursor: pointer; padding: .25rem .55rem; border-radius: 7px; font: 600 11px/1.4 var(--mono); color: rgb(var(--ink-3)); display: grid; place-items: center; }
.seg button[aria-pressed="true"] { background: rgb(var(--ink)); color: rgb(var(--paper)); }
@media (max-width: 720px) {
  .nav { margin-left: 0; }
  .nav a { padding: .4rem .55rem; }
  .brand-text { display: none; }
  .top-admin-label { display: none; }
}
@media (max-width: 520px) {
  .top .wrap { gap: .5rem; }
  .top-right { gap: .35rem; }
  #themeSeg button:not([aria-pressed="true"]) { display: none; }
  .seg button { padding: .25rem .45rem; }
  #newTripBtn { padding: .45rem .55rem; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(2.5rem, 6vw, 5rem) 0 2rem; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.hero h1 {
  font: 400 clamp(2.8rem, 6.4vw, 5.6rem)/0.98 var(--serif); letter-spacing: -.035em; margin: .9rem 0 1.2rem;
  font-variation-settings: "opsz" 144, "SOFT" 50;
}
.hero h1 em { font-style: italic; color: rgb(var(--accent)); }
.hero p.lead { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: rgb(var(--ink-2)); max-width: 34rem; margin: 0 0 1.75rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; }

.globe-wrap { position: relative; aspect-ratio: 1; width: min(100%, 520px); justify-self: center; }
.globe-wrap svg { position: relative; z-index: 1; width: 100%; height: 100%; overflow: visible; cursor: grab; touch-action: pan-y; }
.globe-wrap svg:active { cursor: grabbing; }
.globe-halo { position: absolute; inset: 6%; border-radius: 50%; filter: blur(40px); z-index: -1;
  background: radial-gradient(circle at 35% 30%, rgb(var(--accent-2) / .35), rgb(var(--sea) / .25) 60%, transparent 72%); }
.globe-ring { pointer-events: none; position: absolute; inset: -2%; border-radius: 50%; border: 1px dashed rgb(var(--ink) / .18); animation: spin 120s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.globe-tip {
  z-index: 2; position: absolute; pointer-events: none; transform: translate(-50%, -130%); white-space: nowrap;
  padding: .35rem .6rem; border-radius: 8px; font-size: 12px; font-weight: 600;
  background: rgb(var(--ink)); color: rgb(var(--paper)); opacity: 0; transition: opacity .15s;
}
.globe-tip.on { opacity: 1; }
.globe-caption { pointer-events: none; position: absolute; bottom: -.4rem; left: 50%; transform: translateX(-50%); white-space: nowrap; }

/* ---------- Passport stamps ---------- */
.stamps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0 0; }
@media (max-width: 760px) { .stamps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stamp {
  position: relative; padding: 1.1rem 1rem; text-align: center; border-radius: var(--radius);
  color: rgb(var(--stamp)); border: 2px solid rgb(var(--stamp) / .75);
  outline: 1px solid rgb(var(--stamp) / .45); outline-offset: -7px;
  transform: rotate(var(--r, -2deg)); background: rgb(var(--card) / .5); backdrop-filter: blur(6px);
  mix-blend-mode: normal;
}
.stamp:nth-child(2) { --r: 1.5deg; color: rgb(var(--sea)); border-color: rgb(var(--sea) / .75); outline-color: rgb(var(--sea) / .45); }
.stamp:nth-child(3) { --r: -1deg; color: rgb(var(--good)); border-color: rgb(var(--good) / .7); outline-color: rgb(var(--good) / .4); }
.stamp:nth-child(4) { --r: 2deg; color: rgb(var(--accent)); border-color: rgb(var(--accent) / .7); outline-color: rgb(var(--accent) / .4); }
.stamp b { display: block; font: 600 clamp(1.8rem, 3.6vw, 2.6rem)/1 var(--serif); letter-spacing: -.02em; }
.stamp span { font: 600 10.5px/1.3 var(--mono); letter-spacing: .18em; text-transform: uppercase; }

/* ---------- Sections ---------- */
.section { padding: clamp(2.5rem, 5vw, 4.5rem) 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.section-head h2 { font: 400 clamp(2rem, 4vw, 3rem)/1 var(--serif); letter-spacing: -.03em; margin: .35rem 0 0; }
.filters { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.chip {
  border: 1px solid rgb(var(--line)); background: rgb(var(--card) / .6); padding: .3rem .75rem; border-radius: 999px;
  font-size: 13px; cursor: pointer; color: rgb(var(--ink-2)); transition: all .15s;
}
.chip:hover { border-color: rgb(var(--accent) / .6); color: rgb(var(--accent)); }
.chip[aria-pressed="true"] { background: rgb(var(--ink)); color: rgb(var(--paper)); border-color: rgb(var(--ink)); }
.search {
  display: flex; align-items: center; gap: .4rem; border: 1px solid rgb(var(--line)); border-radius: 999px;
  padding: .35rem .8rem; background: rgb(var(--card) / .7);
}
.search input { border: 0; outline: 0; background: none; font: inherit; font-size: 14px; width: 11rem; color: inherit; }

/* ---------- Featured (latest trip) ---------- */
.featured {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); border-radius: calc(var(--radius) + 6px);
  overflow: hidden; text-decoration: none; min-height: 420px;
  background: rgb(var(--card)); border: 1px solid rgb(var(--line));
  box-shadow: 0 30px 60px -30px rgb(var(--shadow) / .45);
}
@media (max-width: 820px) { .featured { grid-template-columns: 1fr; } }
.featured .ph { position: relative; min-height: 280px; background-size: cover; background-position: center; }
.featured .ph::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 60%, rgb(var(--card) / .4)); }
.featured .body { padding: clamp(1.5rem, 3vw, 2.75rem); display: flex; flex-direction: column; gap: .9rem; justify-content: center; }
.featured h3 { font: 400 clamp(2rem, 3.5vw, 2.9rem)/1.02 var(--serif); letter-spacing: -.03em; margin: 0; }
.featured p { margin: 0; color: rgb(var(--ink-2)); }

/* ---------- Timeline + postcards ---------- */
.year { position: relative; padding-left: 2.25rem; margin-bottom: 2.75rem; }
.year::before { content: ""; position: absolute; left: .55rem; top: 2.6rem; bottom: -2.75rem; border-left: 2px dashed rgb(var(--accent) / .45); }
.year:last-child::before { bottom: 0; }
.year-label { position: relative; font: 400 2.2rem/1 var(--serif); letter-spacing: -.02em; margin: 0 0 1.25rem; }
.year-label::before {
  content: ""; position: absolute; left: -2.25rem; top: .55rem; width: 1.15rem; height: 1.15rem; border-radius: 50%;
  background: rgb(var(--paper)); border: 3px solid rgb(var(--accent)); box-shadow: 0 0 0 5px rgb(var(--accent) / .12);
}
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 1.75rem 1.5rem; }

.postcard {
  --tilt: 0deg;
  display: block; text-decoration: none; padding: 10px 10px 0; border-radius: 6px;
  background: rgb(var(--card)); border: 1px solid rgb(var(--line) / .8);
  box-shadow: 0 1px 1px rgb(var(--shadow) / .06), 0 18px 32px -18px rgb(var(--shadow) / .45);
  transform: rotate(var(--tilt)); transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s;
}
.postcard:nth-child(3n+1) { --tilt: -.8deg; }
.postcard:nth-child(3n+2) { --tilt: .6deg; }
.postcard:nth-child(3n) { --tilt: -.3deg; }
.postcard:hover { transform: rotate(0deg) translateY(-6px) scale(1.01); box-shadow: 0 2px 2px rgb(var(--shadow) / .06), 0 30px 50px -22px rgb(var(--shadow) / .55); }
.postcard .ph { position: relative; aspect-ratio: 4 / 3; border-radius: 3px; background-size: cover; background-position: center; overflow: hidden; }
.postcard .ph .placeholder { position: absolute; inset: 0; display: grid; place-items: center; font: italic 400 1.6rem var(--serif); color: rgb(255 255 255 / .9); text-shadow: 0 2px 12px rgb(0 0 0 / .25); padding: 1rem; text-align: center; }
.postcard .pc-stamp {
  position: absolute; top: 10px; right: 10px; padding: .3rem .45rem; border-radius: 4px; transform: rotate(4deg);
  font: 700 9.5px/1.25 var(--mono); letter-spacing: .12em; text-transform: uppercase; text-align: center;
  color: rgb(var(--stamp)); background: rgb(255 252 246 / .88); border: 1.5px dashed rgb(var(--stamp) / .8);
}
.postcard .meta { padding: .85rem .35rem 1rem; display: grid; gap: .2rem; }
.postcard h3 { margin: 0; font: 500 1.35rem/1.15 var(--serif); letter-spacing: -.015em; }
.postcard .where { font: italic 400 1.15rem/1.2 var(--hand); color: rgb(var(--sea)); }
.postcard .tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.tag { font: 500 11px/1 var(--mono); letter-spacing: .06em; padding: .3rem .45rem; border-radius: 5px; background: rgb(var(--ink) / .06); color: rgb(var(--ink-2)); }

/* ---------- Empty state ---------- */
.empty {
  display: grid; place-items: center; text-align: center; gap: .9rem; padding: 3.5rem 1.5rem; border-radius: calc(var(--radius) + 4px);
  border: 2px dashed rgb(var(--line)); background: rgb(var(--card) / .5);
}
.empty h3 { font: 400 1.9rem/1.1 var(--serif); margin: 0; }
.empty p { margin: 0; max-width: 30rem; color: rgb(var(--ink-2)); }

/* ---------- Trip page ---------- */
.trip-hero { position: relative; min-height: clamp(380px, 68vh, 720px); display: flex; align-items: end; color: #fff; overflow: hidden; }
.trip-hero .bg { position: absolute; inset: 0; background-size: cover; background-position: center; transform: scale(1.04); }
.trip-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgb(0 0 0 / .05) 30%, rgb(0 0 0 / .65)); }
.trip-hero .wrap { position: relative; z-index: 1; padding: 0 0 3rem; }
.trip-hero h1 { font: 400 clamp(2.6rem, 7vw, 5.8rem)/.95 var(--serif); letter-spacing: -.035em; margin: .6rem 0 .8rem; text-shadow: 0 4px 30px rgb(0 0 0 / .25); }
.trip-hero .kicker { color: rgb(255 255 255 / .85); }
.trip-hero .where { font: 400 1.6rem/1 var(--hand); color: rgb(255 255 255 / .92); }

.trip-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(1.5rem, 4vw, 3.5rem); margin-top: -2.5rem; position: relative; z-index: 2; }
@media (max-width: 960px) { .trip-layout { grid-template-columns: 1fr; } }
.trip-layout aside { display: grid; gap: 1.25rem; align-content: start; }
@media (min-width: 961px) { .trip-layout aside { position: sticky; top: 84px; } }

.paper {
  background: rgb(var(--card)); border: 1px solid rgb(var(--line)); border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 30px 60px -36px rgb(var(--shadow) / .5);
}
.story { padding: clamp(1.5rem, 4vw, 3.25rem); font-size: 1.12rem; line-height: 1.78; }
.story > :first-child { margin-top: 0; }
.story p:first-of-type::first-letter { float: left; font: 400 4.2em/.82 var(--serif); padding: .06em .12em 0 0; color: rgb(var(--accent)); }
.story h2, .story h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -.02em; line-height: 1.15; }
.story img { border-radius: var(--radius-sm); margin: 1.5rem 0; box-shadow: 0 20px 40px -24px rgb(var(--shadow) / .5); }
.story blockquote { margin: 1.5rem 0; padding: .25rem 0 .25rem 1.25rem; border-left: 3px solid rgb(var(--accent)); font: italic 1.3rem/1.5 var(--serif); color: rgb(var(--ink-2)); }
.story a { color: rgb(var(--accent)); }

/* Boarding pass */
.pass { overflow: hidden; }
.pass-top {
  display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.2rem; color: #fff;
  background: linear-gradient(120deg, rgb(var(--sea)), rgb(var(--accent)));
}
.pass-top .kicker { color: rgb(255 255 255 / .85); }
.pass-body { padding: 1.1rem 1.2rem; display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1rem; }
.pass-body .f { display: grid; gap: .15rem; min-width: 0; }
.pass-body .f.full { grid-column: 1 / -1; }
.pass-body .f b { font: 600 .98rem/1.3 var(--sans); overflow-wrap: anywhere; }
.pass-cut { position: relative; border-top: 2px dashed rgb(var(--line)); margin: 0 14px; }
.pass-cut::before, .pass-cut::after { content: ""; position: absolute; top: -12px; width: 22px; height: 22px; border-radius: 50%; background: rgb(var(--paper)); border: 1px solid rgb(var(--line)); }
.pass-cut::before { left: -26px; } .pass-cut::after { right: -26px; }
.pass-foot { padding: 1rem 1.2rem 1.2rem; display: flex; align-items: center; gap: 1rem; }
.barcode { flex: 1; height: 38px; background: repeating-linear-gradient(90deg, rgb(var(--ink)) 0 2px, transparent 2px 4px, rgb(var(--ink)) 4px 5px, transparent 5px 8px, rgb(var(--ink)) 8px 11px, transparent 11px 12px); opacity: .85; border-radius: 2px; }
.minimap { height: 200px; border-radius: var(--radius); overflow: hidden; border: 1px solid rgb(var(--line)); }

/* Gallery */
.gallery { columns: 3 220px; column-gap: 1rem; }
.gallery button { all: unset; display: block; margin: 0 0 1rem; break-inside: avoid; cursor: zoom-in; border-radius: var(--radius-sm); overflow: hidden; position: relative; }
.gallery img { width: 100%; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.gallery button:hover img { transform: scale(1.04); }
.gallery figcaption { position: absolute; inset: auto 0 0 0; padding: 1.5rem .8rem .6rem; color: #fff; font-size: 13px; background: linear-gradient(transparent, rgb(0 0 0 / .6)); }
.videos { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.videos iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); background: #000; }
.trip-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.trip-nav a { text-decoration: none; padding: 1.1rem 1.25rem; display: grid; gap: .2rem; }
.trip-nav a:hover { border-color: rgb(var(--accent) / .6); }
.trip-nav .next { text-align: right; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; background: rgb(10 9 8 / .92); backdrop-filter: blur(6px); }
.lightbox.on { display: flex; }
.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: 6px; box-shadow: 0 30px 80px rgb(0 0 0 / .5); }
.lightbox .cap { position: absolute; bottom: 1.5rem; left: 0; right: 0; text-align: center; color: rgb(255 255 255 / .85); font-size: 14px; }
.lightbox .lb-btn { position: absolute; border: 0; cursor: pointer; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgb(255 255 255 / .12); color: #fff; }
.lightbox .lb-btn:hover { background: rgb(255 255 255 / .22); }
.lightbox .lb-close { top: 1.25rem; right: 1.25rem; }
.lightbox .lb-prev { left: 1.25rem; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 1.25rem; top: 50%; transform: translateY(-50%); }

/* ---------- Map page ---------- */
.map-page { display: grid; grid-template-columns: 360px minmax(0, 1fr); height: calc(100vh - 65px); }
@media (max-width: 860px) { .map-page { grid-template-columns: 1fr; grid-template-rows: 55vh auto; height: auto; } .map-list { order: 2; } }
.map-list { overflow-y: auto; padding: 1.25rem; border-right: 1px solid rgb(var(--line)); display: grid; gap: .75rem; align-content: start; }
.map-item { display: grid; grid-template-columns: 64px 1fr; gap: .8rem; align-items: center; padding: .55rem; border-radius: var(--radius-sm); text-decoration: none; border: 1px solid transparent; cursor: pointer; background: none; text-align: left; }
.map-item:hover, .map-item.on { background: rgb(var(--card)); border-color: rgb(var(--line)); }
.map-item .th { width: 64px; height: 64px; border-radius: 8px; background-size: cover; background-position: center; }
.map-item b { font: 500 1.05rem/1.2 var(--serif); display: block; }
#mapHost { min-height: 360px; }
.photo-pin { width: 46px; height: 46px; border-radius: 50%; border: 3px solid #fff; background-size: cover; background-position: center; box-shadow: 0 6px 18px rgb(0 0 0 / .35); transition: transform .2s; }
.photo-pin:hover { transform: scale(1.12); }
.photo-pin.dot { width: 18px; height: 18px; background: rgb(var(--accent)); }
.leaflet-popup-content-wrapper { border-radius: 12px !important; }
.leaflet-popup-content { font-family: var(--sans) !important; margin: 12px 14px !important; }
.popup-card { display: grid; gap: .35rem; min-width: 190px; }
.popup-card img { border-radius: 8px; aspect-ratio: 4/3; object-fit: cover; }
.popup-card b { font: 500 1.05rem/1.2 var(--serif); }

/* ---------- Modal + editor ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 150; display: none; align-items: flex-start; justify-content: center; padding: 4vh 1rem; overflow-y: auto; background: rgb(15 12 8 / .55); backdrop-filter: blur(6px); }
.modal-bg.on { display: flex; }
.modal { width: min(560px, 100%); padding: 1.75rem; position: relative; }
.modal.wide { width: min(900px, 100%); }
.modal h2 { font: 400 2rem/1.05 var(--serif); letter-spacing: -.02em; margin: .3rem 0 1.25rem; }
.modal .close { position: absolute; top: 1rem; right: 1rem; }
.form { display: grid; gap: 1rem; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .form .row { grid-template-columns: 1fr; } }
.field { display: grid; gap: .35rem; }
.field label { font: 600 11px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: rgb(var(--ink-3)); }
.field input, .field textarea, .rich {
  width: 100%; font: inherit; font-size: 15px; color: inherit; padding: .7rem .85rem; border-radius: var(--radius-sm);
  border: 1px solid rgb(var(--line)); background: rgb(var(--paper) / .6); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .rich:focus { border-color: rgb(var(--accent)); box-shadow: 0 0 0 4px rgb(var(--accent) / .12); }
.field .hint { font-size: 12px; color: rgb(var(--ink-3)); }
.rich { min-height: 220px; line-height: 1.65; overflow-y: auto; max-height: 480px; }
.rich:empty::before { content: attr(data-placeholder); color: rgb(var(--ink-3)); }
.rich img { max-width: 100%; border-radius: 8px; }
.picker { height: 240px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid rgb(var(--line)); }
.drop { border: 2px dashed rgb(var(--line)); border-radius: var(--radius-sm); padding: 1.1rem; text-align: center; cursor: pointer; color: rgb(var(--ink-2)); transition: all .15s; }
.drop:hover, .drop.over { border-color: rgb(var(--accent)); color: rgb(var(--accent)); background: rgb(var(--accent) / .05); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .6rem; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 8px; background-size: cover; background-position: center; border: 2px solid transparent; }
.thumb.cover { border-color: rgb(var(--accent)); }
.thumb .t-actions { position: absolute; inset: auto 4px 4px 4px; display: flex; justify-content: space-between; }
.thumb .t-actions button { border: 0; cursor: pointer; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: rgb(0 0 0 / .6); color: #fff; font-size: 13px; }
.thumb .badge { position: absolute; top: 4px; left: 4px; font: 700 9px/1 var(--mono); letter-spacing: .1em; padding: .25rem .35rem; border-radius: 4px; background: rgb(var(--accent)); color: #fff; }
.form-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: .5rem; }
.form-error { color: rgb(var(--stamp)); font-size: 14px; min-height: 1.2em; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 300; display: grid; gap: .5rem; }
.toast { padding: .7rem 1.1rem; border-radius: 999px; font-size: 14px; font-weight: 500; background: rgb(var(--ink)); color: rgb(var(--paper)); box-shadow: 0 12px 30px -10px rgb(0 0 0 / .4); animation: rise .25s ease; }
.toast.err { background: rgb(var(--stamp)); color: #fff; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Footer ---------- */
.foot { border-top: 1px solid rgb(var(--line)); padding: 2rem 0 2.5rem; margin-top: 3rem; font-size: 13px; color: rgb(var(--ink-3)); }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .8, .2, 1); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Additions ---------- */
.featured .where, .hand { font: 400 1.45rem/1.1 var(--hand); color: rgb(var(--sea)); }
.tb-marker { width: 20px; height: 20px; border-radius: 50%; background: rgb(var(--accent)); border: 3px solid #fff; box-shadow: 0 0 0 6px rgb(var(--accent) / .25), 0 4px 10px rgb(0 0 0 / .3); }
.trip-actions { display: flex; gap: .5rem; margin-top: 1.25rem; }
.trip-actions .btn.ghost { background: rgb(255 255 255 / .14); color: #fff; border-color: rgb(255 255 255 / .35); }
.trip-actions .btn.ghost:hover { background: rgb(255 255 255 / .25); color: #fff; }
.trip-back { display: inline-flex; gap: .4rem; align-items: center; color: rgb(255 255 255 / .9); text-decoration: none; font-size: 14px; font-weight: 500; }
.trip-back:hover { color: #fff; }
.block-title { font: 400 1.9rem/1 var(--serif); letter-spacing: -.02em; margin: 3rem 0 1.25rem; display: flex; align-items: baseline; gap: .75rem; }
.block-title .kicker { font-size: 11px; }
.trip-tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.trip-tags a { text-decoration: none; }
.map-empty { padding: 1rem; }
.map-page .map-head { padding: .25rem .25rem .5rem; }
.map-page .map-head h1 { font: 400 2.2rem/1 var(--serif); letter-spacing: -.02em; margin: .3rem 0 0; }
.map-page + .foot { display: none; }
.leaflet-container { background: rgb(var(--paper-2)); font-family: var(--sans); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: rgb(var(--card)) !important; color: rgb(var(--ink)) !important; }
.popup-card a { color: rgb(var(--accent)); font-weight: 600; text-decoration: none; font-size: 13px; }
/* OSM tiles: warm them up in light mode, night-map them in dark mode */
.leaflet-tile-pane { filter: sepia(.18) saturate(.85); }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.6); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.6); }
}
/* Sortable photo thumbs */
.thumb { cursor: grab; touch-action: none; user-select: none; transition: box-shadow .15s; }
.thumbs.sorting .thumb:not(.dragging) { transition: transform .15s; }
.thumb.dragging { cursor: grabbing; z-index: 5; box-shadow: 0 16px 30px -10px rgb(0 0 0 / .5); opacity: .92; }
.thumb .t-num { position: absolute; top: 4px; right: 4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; display: grid; place-items: center; font: 700 10px/1 var(--mono); background: rgb(0 0 0 / .55); color: #fff; }
