/* ============================================================
   Travel Journal — Digital Travel Scrapbook
   Visual language: warm paper, serif display, handwritten accents,
   restrained washi-tape / stamp / dashed-line scrapbook touches.
   ============================================================ */

:root {
  --paper: #faf6ef;
  --paper-2: #f4ecdd;
  --card: #fffdf8;
  --ink: #2c2722;
  --ink-soft: #6f655b;
  --ink-faint: #a89c8e;
  --accent: #bf5a3c;      /* terracotta */
  --accent-2: #2f6b5e;    /* deep teal */
  --gold: #c9a14a;
  --line: rgba(44, 39, 34, 0.12);
  --line-strong: rgba(44, 39, 34, 0.22);
  --shadow: 0 10px 30px rgba(44, 39, 34, 0.10);
  --shadow-sm: 0 3px 12px rgba(44, 39, 34, 0.10);
  --radius: 14px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --hand: 'Caveat', 'Comic Sans MS', cursive;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --maxw: 1040px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(191, 90, 60, 0.04), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(47, 107, 94, 0.05), transparent 45%);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

/* ---------- top nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 500;
  backdrop-filter: saturate(1.1) blur(8px);
  background: rgba(250, 246, 239, 0.82);
  border-bottom: 1px solid var(--line);
}
.site-header .inner {
  max-width: 1180px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .logo { font-family: var(--hand); font-size: 28px; font-weight: 700; color: var(--accent); line-height: 1; }
.brand .sub { font-family: var(--serif); font-style: italic; color: var(--ink-soft); font-size: 14px; }
.nav-links { display: flex; gap: 18px; align-items: center; }
.nav-links a { color: var(--ink-soft); font-size: 14px; font-weight: 500; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.nav-links .btn { color: #fff; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff; border: none;
  padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-sm); transition: transform .12s ease, filter .12s ease;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); box-shadow: none; }
.btn.ghost:hover { background: rgba(44,39,34,0.05); }
.btn.teal { background: var(--accent-2); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { background: #b23b3b; }

/* ---------- layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 32px 20px 80px; }
.wrap-wide { max-width: 1180px; margin: 0 auto; padding: 32px 20px 80px; }
.page-fade { animation: fade .4s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- homepage ---------- */
.hero {
  text-align: center; padding: 40px 16px 24px;
}
.hero h1 {
  font-family: var(--serif); font-weight: 600; font-size: clamp(34px, 6vw, 58px);
  margin: 0; letter-spacing: -0.01em; line-height: 1.05;
}
.hero .tagline {
  font-family: var(--serif); font-style: italic; color: var(--ink-soft);
  font-size: clamp(15px, 2.4vw, 19px); margin-top: 10px;
}
.stat-bar {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 26px;
  margin: 26px auto 8px; max-width: 760px;
}
.stat { text-align: center; }
.stat .num { font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--accent); line-height: 1; }
.stat .lbl { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); margin-top: 6px; }

.world-map {
  height: 440px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow); margin: 18px 0 36px;
  background: #dfeaf0;
}
.section-title {
  font-family: var(--serif); font-size: 24px; font-weight: 600;
  display: flex; align-items: center; gap: 12px; margin: 30px 0 16px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.trip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.trip-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .15s ease;
}
.trip-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.trip-card .cover { aspect-ratio: 16/10; object-fit: cover; width: 100%; background: var(--paper-2); }
.trip-card .body { padding: 16px 18px 20px; }
.trip-card .flag { font-size: 22px; }
.trip-card h3 { font-family: var(--serif); margin: 6px 0 4px; font-size: 20px; font-weight: 600; }
.trip-card .meta { color: var(--ink-soft); font-size: 13px; }
.trip-card .cities { font-family: var(--hand); font-size: 19px; color: var(--accent-2); margin-top: 8px; }

/* ---------- diary (scrapbook) ---------- */
.diary-hero { text-align: center; padding: 8px 0 18px; position: relative; }
.date-stamp {
  display: inline-block; font-family: var(--hand); color: var(--accent);
  border: 2px solid var(--accent); border-radius: 10px; padding: 4px 14px;
  transform: rotate(-3deg); font-size: 22px; font-weight: 700; letter-spacing: .02em;
  background: rgba(191,90,60,0.06);
}
.diary-hero h1 { font-family: var(--serif); font-size: clamp(30px, 5vw, 46px); margin: 14px 0 4px; font-weight: 600; }
.diary-hero .city { font-family: var(--serif); font-style: italic; color: var(--ink-soft); font-size: 18px; }
.diary-hero .summary { max-width: 640px; margin: 14px auto 0; color: var(--ink-soft); font-family: var(--serif); font-size: 17px; }

.day-map {
  height: 420px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow); margin: 22px 0 8px; background: #dfeaf0;
}
.map-cap { text-align: center; font-family: var(--hand); color: var(--ink-faint); font-size: 16px; margin-bottom: 18px; }

.route-divider {
  display: flex; align-items: center; gap: 14px; margin: 30px 0 18px; color: var(--ink-faint);
}
.route-divider::before, .route-divider::after { content: ""; flex: 1; border-top: 1.5px dashed var(--line-strong); }

/* scrapbook content */
.entry { font-family: var(--serif); font-size: 18px; line-height: 1.85; color: var(--ink); }
.entry p { margin: 0 0 18px; }
.entry h2 {
  font-family: var(--serif); font-weight: 600; font-size: 26px; margin: 34px 0 14px;
  position: relative; display: inline-block;
}
.entry h2::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 6px;
  background: linear-gradient(90deg, rgba(201,161,74,0.6), transparent); border-radius: 4px; }

/* photo collage */
.collage { display: grid; gap: 10px; margin: 22px 0; }
.collage.big img { width: 100%; border-radius: 10px; box-shadow: var(--shadow-sm); }
.collage.duo { grid-template-columns: 1fr 1fr; }
.collage.triple { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.collage.triple .ph:nth-child(1) { grid-row: 1 / 3; }
.collage.grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.collage .ph { position: relative; overflow: hidden; border-radius: 10px; box-shadow: var(--shadow-sm); background: var(--paper-2); }
.collage .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.collage .ph:hover img { transform: scale(1.03); }
.collage .ph .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 10px 8px;
  font-family: var(--hand); font-size: 16px; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
}
/* washi tape on collage */
.collage { position: relative; }
.collage::before {
  content: ""; position: absolute; top: -10px; left: 50%; transform: translateX(-50%) rotate(-2deg);
  width: 120px; height: 22px; background: rgba(191,90,60,0.35);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1); border-radius: 2px;
}

/* sticky note */
.note {
  font-family: var(--hand); font-size: 21px; line-height: 1.5; color: #4a4032;
  background: #fff4c2; padding: 22px 24px; border-radius: 4px; max-width: 460px; margin: 28px auto;
  transform: rotate(-1.2deg); box-shadow: var(--shadow-sm); position: relative;
}
.note::before {
  content: ""; position: absolute; top: -12px; left: 50%; transform: translateX(-50%) rotate(3deg);
  width: 90px; height: 24px; background: rgba(47,107,94,0.4); border-radius: 2px;
}

/* inline place card */
.place-card {
  display: flex; gap: 14px; align-items: flex-start; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 22px 0;
  box-shadow: var(--shadow-sm);
}
.place-card .pin {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  font-size: 20px; flex: none; color: #fff;
}
.place-card .pc-body { flex: 1; }
.place-card .pc-name { font-family: var(--serif); font-weight: 600; font-size: 18px; }
.place-card .pc-meta { font-size: 13px; color: var(--ink-soft); margin: 2px 0 6px; }
.place-card .pc-note { font-size: 15px; color: var(--ink); }
.place-card .pc-photos { display: flex; gap: 6px; margin-top: 10px; }
.place-card .pc-photos img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }

/* stickers / stamps row */
.stamp {
  display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  border: 2px dashed var(--accent); color: var(--accent); font-family: var(--hand); font-size: 13px;
  text-align: center; transform: rotate(-8deg); line-height: 1; padding: 4px;
}

/* share bar */
.share-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center;
  margin: 30px 0; padding: 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.share-bar .url { font-family: var(--sans); font-size: 13px; color: var(--ink-soft); background: var(--paper-2); padding: 8px 12px; border-radius: 8px; flex: 1; min-width: 200px; word-break: break-all; }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 14px; margin-bottom: 14px; }

/* ---------- trip page ---------- */
.trip-hero { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.trip-hero .cover { width: 260px; height: 170px; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
.day-list { display: grid; gap: 14px; margin-top: 18px; }
.day-row {
  display: flex; align-items: center; gap: 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 18px; box-shadow: var(--shadow-sm); transition: transform .12s ease;
}
.day-row:hover { transform: translateX(3px); }
.day-row .dnum { font-family: var(--hand); font-size: 26px; color: var(--accent); width: 70px; flex: none; }
.day-row .dinfo { flex: 1; }
.day-row .dinfo .t { font-family: var(--serif); font-weight: 600; font-size: 18px; }
.day-row .dinfo .m { color: var(--ink-soft); font-size: 13px; }
.day-row .badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--paper-2); color: var(--ink-soft); }
.day-row .badge.priv { background: #efe2d8; color: var(--accent); }

/* ---------- editor ---------- */
.editor { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
.editor-nav {
  position: sticky; top: 70px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm);
}
.editor-nav h4 { font-family: var(--serif); margin: 0 0 10px; font-size: 16px; }
.editor-nav a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink); font-size: 14px; margin-bottom: 4px; }
.editor-nav a:hover { background: var(--paper-2); text-decoration: none; }
.editor-nav a.active { background: var(--accent); color: #fff; }
.editor-main { min-width: 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.panel h3 { font-family: var(--serif); margin: 0 0 14px; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  font-family: inherit; font-size: 15px; color: var(--ink); background: #fff;
}
.field textarea { resize: vertical; min-height: 70px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid rgba(191,90,60,0.3); border-color: var(--accent); }

.dropzone {
  border: 2px dashed var(--line-strong); border-radius: 12px; padding: 26px; text-align: center;
  color: var(--ink-soft); background: var(--paper); transition: background .15s; cursor: pointer;
}
.dropzone.drag { background: rgba(191,90,60,0.08); border-color: var(--accent); }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; margin-top: 16px; }
.thumb { position: relative; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-sm); }
.thumb img { width: 100%; height: 110px; object-fit: cover; }
.thumb .cap { width: 100%; border: none; border-top: 1px solid var(--line); padding: 5px 6px; font-size: 11px; font-family: inherit; }
.thumb .x { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px; font-size: 13px; line-height: 1; }
.thumb .cover-badge { position: absolute; bottom: 4px; left: 4px; background: var(--accent-2); color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 6px; }

.place-item, .block-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: var(--paper);
}
.place-item .pi-top { display: flex; gap: 10px; align-items: center; }
.place-item .pi-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.place-item .pi-name { font-family: var(--serif); font-weight: 600; flex: 1; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.row2 input, .row2 select { padding: 7px 9px; font-size: 13px; }
.mini-btns { display: flex; gap: 6px; margin-top: 8px; }
.mini-btns button { font-size: 12px; padding: 4px 9px; border-radius: 7px; border: 1px solid var(--line-strong); background: #fff; }
.search-box { position: relative; }
.suggest { position: absolute; z-index: 20; left: 0; right: 0; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); max-height: 240px; overflow: auto; margin-top: 4px; }
.suggest div { padding: 9px 12px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--line); }
.suggest div:hover { background: var(--paper-2); }
.suggest .sub { color: var(--ink-faint); font-size: 11px; }

.block-item .b-tools { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.block-item .b-type { font-family: var(--hand); font-size: 16px; color: var(--accent); }
.block-item textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-family: inherit; font-size: 15px; }
.block-item .photo-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.block-item .pp { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; cursor: pointer; }
.block-item .pp.sel { border-color: var(--accent); }
.block-item .pp img { width: 100%; height: 100%; object-fit: cover; }

.editor-bar {
  position: sticky; top: 0; z-index: 600; background: rgba(250,246,239,0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: 12px 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.editor-bar .spacer { flex: 1; }
.save-state { font-size: 13px; color: var(--ink-soft); }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); }

/* ---------- misc ---------- */
.empty { text-align: center; color: var(--ink-faint); padding: 50px 20px; font-family: var(--serif); font-style: italic; }
.modal-back { position: fixed; inset: 0; background: rgba(20,16,12,0.5); display: grid; place-items: center; z-index: 1000; padding: 20px; }
.modal { background: var(--card); border-radius: 16px; padding: 26px; max-width: 420px; width: 100%; box-shadow: var(--shadow); }
.modal h3 { font-family: var(--serif); margin: 0 0 12px; }
.modal input { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; font-size: 15px; margin-bottom: 14px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); opacity: 0; transition: opacity .25s, transform .25s; z-index: 2000; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

.leaflet-popup-content { font-family: var(--sans); }
/* warm, paper-toned map tiles to match the scrapbook feel */
.leaflet-tile { filter: sepia(0.22) saturate(0.85) brightness(1.03) contrast(0.96); }
.leaflet-container { background: #e8e2d6; font-family: var(--sans); }
.lj-marker { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); color: #fff; font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,0.3); border: 2px solid #fff; }
.lj-marker span { transform: rotate(45deg); font-size: 13px; }
.lj-marker.sm { width: 18px; height: 18px; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .editor { grid-template-columns: 1fr; }
  .editor-nav { position: static; display: flex; gap: 8px; overflow-x: auto; }
  .editor-nav a { white-space: nowrap; }
  .editor-nav h4 { display: none; }
  .collage.triple { grid-template-columns: 1fr 1fr; }
  .collage.triple .ph:nth-child(1) { grid-row: auto; grid-column: 1 / 3; }
  .world-map { height: 320px; }
  .day-map { height: 320px; }
}
@media (max-width: 560px) {
  .site-header .inner { padding: 10px 14px; gap: 8px; }
  .brand .logo { font-size: 24px; }
  .nav-links { gap: 12px; }
  .brand .sub { display: none; }
  .collage.duo { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .trip-hero .cover { width: 100%; height: 180px; }
}

/* ============================================================
   V2 — Interactive Travel Journal refinements
   Editorial layout · Map as spine · restrained visuals
   ============================================================ */

/* ---- Trip overview ---- */
.trip-wrap { padding-top: 18px; }
.trip-overview {
  text-align: center; padding: 28px 0 18px; border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.to-eyebrow { font-family: var(--hand); font-size: 22px; color: var(--accent); letter-spacing: .03em; }
.to-title {
  font-family: var(--serif); font-weight: 600; font-size: clamp(34px, 6vw, 62px);
  margin: 6px 0 12px; letter-spacing: -0.01em; line-height: 1.03;
}
.to-cities { font-family: var(--serif); font-style: italic; color: var(--ink-soft); font-size: clamp(16px, 2.6vw, 22px); }
.to-dates { font-family: var(--sans); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); margin-top: 14px; }

.to-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(22px, 6vw, 76px); margin: 6px 0 4px; }
.to-stat { text-align: center; }
.to-stat .n { font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 5vw, 48px); color: var(--ink); line-height: 1; }
.to-stat .l { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint); margin-top: 9px; }

.trip-map {
  height: 520px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line);
  background: #dfeaf0; box-shadow: none;
}

.trip-chips-wrap { margin-top: 16px; }
.trip-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  font-family: var(--sans); font-size: 13px; padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--ink-soft);
  cursor: pointer; transition: all .16s ease;
}
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.city { font-family: var(--serif); font-style: italic; }
.chip.day { font-family: var(--hand); font-size: 17px; }

/* editorial day list — fine lines, no cards */
.day-list { display: grid; gap: 0; margin-top: 10px; }
.day-row {
  display: flex; align-items: baseline; gap: 18px; background: transparent;
  border: none; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none;
  padding: 18px 4px; transition: background .2s ease;
}
.day-row:hover { background: rgba(191,90,60,.05); transform: none; }
.day-row .dnum { font-family: var(--hand); font-size: 24px; color: var(--accent); width: auto; flex: none; }
.day-row .dinfo { flex: 1; }
.day-row .dinfo .t { font-family: var(--serif); font-weight: 600; font-size: clamp(17px, 2.4vw, 21px); }
.day-row .dinfo .m { color: var(--ink-soft); font-size: 13px; margin-top: 3px; }
.day-row .badge { font-size: 10px; padding: 3px 9px; border-radius: 999px; background: var(--paper-2); color: var(--ink-faint); letter-spacing: .04em; }
.day-row .badge.priv { background: #efe2d8; color: var(--accent); }

/* ---- Diary ---- */
.diary-wrap { padding-top: 14px; }
.day-kicker { font-family: var(--hand); font-size: 26px; color: var(--accent); text-align: center; }
.diary-hero { text-align: center; padding: 2px 0 4px; }
.diary-hero .summary.intro {
  font-family: var(--serif); font-size: clamp(18px, 2.6vw, 22px); line-height: 1.7;
  color: var(--ink-soft); max-width: 680px; margin: 16px auto 0; font-style: italic;
}
.day-map { height: 480px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); box-shadow: none; background: #dfeaf0; }

.story { max-width: 720px; margin: 0 auto; }
.story.reveal .story-seg { opacity: 0; transform: translateY(16px); }
.story-seg { opacity: 1; transform: none; transition: opacity .7s ease, transform .7s ease; margin: 0 0 4px; }
.story.reveal .story-seg.in { opacity: 1; transform: none; }
.story p { font-family: var(--serif); font-size: clamp(17px, 2.2vw, 19px); line-height: 1.9; color: var(--ink); margin: 0 0 22px; }
.story h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(22px, 3vw, 28px); margin: 32px 0 14px; position: relative; display: inline-block; }
.story h2::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 6px; background: linear-gradient(90deg, rgba(201,161,74,0.6), transparent); border-radius: 4px; }

/* editorial location anchor woven into the story */
.loc-anchor { position: relative; padding: 26px 0 24px; border-top: 1px solid var(--line); margin: 22px 0; transition: background .25s ease; }
.loc-anchor.active { background: rgba(191,90,60,.06); border-radius: 8px; }
.loc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.loc-kicker { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint); }
.loc-num {
  font-family: var(--serif); font-weight: 600; font-size: 19px; color: #fff; background: var(--c, var(--accent));
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  box-shadow: 0 2px 5px rgba(0,0,0,.18);
}
.loc-name { font-family: var(--serif); font-weight: 600; font-size: clamp(23px, 3vw, 30px); line-height: 1.18; }
.loc-anchor.reading .loc-name { color: var(--accent); }
.loc-meta { font-size: 13px; color: var(--ink-soft); margin: 5px 0; }
.loc-coords { font-family: var(--sans); font-size: 12px; letter-spacing: .06em; color: var(--ink-faint); }
.loc-note { font-family: var(--serif); font-size: 17px; color: var(--ink); margin-top: 12px; max-width: 62ch; line-height: 1.7; }
.loc-thumbs { display: flex; gap: 6px; margin-top: 14px; }
.loc-thumbs img { width: 62px; height: 62px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.loc-view {
  margin-top: 12px; background: none; border: none; color: var(--accent); font-family: var(--sans);
  font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; letter-spacing: .02em;
}
.loc-view:hover { text-decoration: underline; }

/* photos kept secondary — lighter, smaller, less shadow */
.collage.big { max-width: 540px; margin: 24px auto; }
.collage.big img { border-radius: 8px; box-shadow: none; border: 1px solid var(--line); }
.collage .ph { box-shadow: none; border: 1px solid var(--line); }
.collage .ph img { transition: transform .5s ease; }
.collage::before { opacity: .5; }

/* ---- leaflet markers (V2) ---- */
.lj-pin-wrap, .leaflet-div-icon.lj-pin-wrap { background: transparent !important; border: none !important; }
.lj-pin { --c: var(--accent); width: 44px; height: 44px; opacity: 0; transform: scale(.5); transition: opacity .5s ease, transform .5s cubic-bezier(.2,.8,.3,1.25); overflow: visible; }
.lj-pin.in { opacity: 1; transform: scale(1); }
.lj-dot {
  width: 30px; height: 30px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.28); border: 2px solid #fff; margin: 7px auto 0;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}
.lj-pin .num { font-family: var(--serif); font-weight: 600; font-size: 14px; }
.lj-pin .lbl {
  position: absolute; left: 50%; top: 42px; transform: translateX(-50%) translateY(4px);
  background: var(--paper); color: var(--ink); font-family: var(--serif); font-size: 12px; white-space: nowrap;
  padding: 3px 9px; border-radius: 7px; border: 1px solid var(--line); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; box-shadow: var(--shadow-sm);
}
.lj-pin.active { z-index: 1000; }
.lj-pin.active .lj-dot { transform: scale(1.38); background: var(--accent); box-shadow: 0 6px 16px rgba(191,90,60,.45); animation: pinPulse 2.2s ease-out infinite; }
.lj-pin.active .lbl { opacity: 1; transform: translateX(-50%) translateY(0); }
.lj-pin.dim { opacity: .26; filter: grayscale(.35); }
@keyframes pinPulse {
  0% { box-shadow: 0 0 0 0 rgba(191,90,60,.5); }
  70% { box-shadow: 0 0 0 13px rgba(191,90,60,0); }
  100% { box-shadow: 0 0 0 0 rgba(191,90,60,0); }
}

/* ---- inline map frame + expand / collapse ---- */
.map-frame { position: relative; z-index: 1; }
.map-frame .day-map, .map-frame .trip-map { width: 100%; }
.map-toggle {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right));
  z-index: 1200; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(250,246,239,.92); color: var(--ink); border: 1px solid var(--line-strong);
  padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-sm); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform .12s ease, background .12s ease, color .12s ease;
}
.map-toggle:hover { transform: translateY(-1px); }
.map-toggle:active { transform: translateY(0); }
.map-toggle .mt-ico { font-size: 15px; line-height: 1; }
.map-toggle.is-expanded { background: var(--accent); color: #fff; border-color: var(--accent); }

/* expanded: same map instance, fills the viewport (mobile-first: dvh + safe-area, no re-init) */
.map-frame.expanded {
  position: fixed; inset: 0; z-index: 1500; opacity: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  animation: mapFade .26s ease forwards;
}
@keyframes mapFade { to { opacity: 1; } }
.map-frame.expanded .day-map,
.map-frame.expanded .trip-map { height: 100%; border-radius: 12px; }
.map-frame.expanded .map-toggle {
  top: calc(14px + env(safe-area-inset-top)); right: calc(14px + env(safe-area-inset-right));
}

/* ---- location card actions (功能五) ---- */
.loc-city { font-family: var(--serif); font-style: italic; color: var(--ink-soft); font-size: 16px; margin-top: 2px; }
.loc-actions { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; }
.loc-read {
  margin-top: 0; background: none; border: none; color: var(--accent-2); font-family: var(--sans);
  font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; letter-spacing: .02em;
}
.loc-read:hover { text-decoration: underline; }

@media (max-width: 820px) {
  .trip-map { height: 360px; }
  .day-map { height: 330px; }
  .to-stats { gap: 22px 30px; }
  .story { padding-top: 8px; }
  /* keep content clear of the sticky header on small screens */
  .diary-wrap, .trip-wrap { padding-top: 60px; }
}

/* ============================================================
   Postcard preview — paper transition layer between Trip & Day
   ============================================================ */
body.pc-lock { overflow: hidden; }

.pc-scrim {
  position: fixed; inset: 0; z-index: 1600;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  padding-top: calc(24px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background: rgba(41, 32, 25, 0.46);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  opacity: 0; transition: opacity .28s ease;
}
.pc-scrim.open { opacity: 1; }
.pc-scrim.pc-out { opacity: 0; transition: opacity .42s ease; }

.pc-card {
  position: relative;
  width: min(960px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(191, 90, 60, 0.035), transparent 38%),
    radial-gradient(circle at 90% 95%, rgba(47, 107, 94, 0.04), transparent 42%);
  border: 1px solid rgba(148, 110, 84, 0.28);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(28, 20, 12, 0.38), 0 4px 18px rgba(28, 20, 12, 0.18);
  transform: translateY(16px) scale(0.965);
  opacity: 0;
  transition: transform .42s cubic-bezier(.22, .8, .3, 1), opacity .3s ease;
}
.pc-scrim.open .pc-card { transform: none; opacity: 1; }
.pc-card.pc-leaving {
  transform: scale(1.035);
  opacity: 0;
  transition: transform .42s cubic-bezier(.22, .8, .3, 1), opacity .4s ease;
}
.pc-card.pc-leave { transform: scale(0.97); opacity: 0; transition: transform .26s ease, opacity .26s ease; }

.pc-body { padding: 22px 30px 20px; transition: opacity .19s ease; }
.pc-body.pc-fade { opacity: 0; }

/* top strip */
.pc-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding-right: 46px; }
.pc-top-no {
  font-size: 13px; letter-spacing: 0.18em; color: var(--ink-soft);
  text-transform: uppercase; white-space: nowrap; font-weight: 600;
}
.pc-top-line { flex: 1; border-top: 1px solid var(--line-strong); }
.pc-top-date { font-size: 15px; color: var(--ink); white-space: nowrap; font-weight: 500; }

/* main split */
.pc-main { display: grid; grid-template-columns: 42% 1fr; gap: 30px; align-items: stretch; }

.pc-art {
  position: relative;
  align-self: start;
  aspect-ratio: 1 / 1.02;
  border-radius: 6px;
  background: #fffdf8;
  padding: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.pc-img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 3px; display: block; background: var(--paper-2);
}
.pc-art-fallback {
  background:
    radial-gradient(circle at 30% 25%, rgba(191, 90, 60, 0.10), transparent 45%),
    linear-gradient(160deg, #f7efe0 0%, #f1e6d2 55%, #ece0ca 100%);
}
.pc-art-fallback::before {
  content: ''; position: absolute; inset: 14px; border: 1.5px dashed rgba(148, 110, 84, 0.4);
  border-radius: 4px; pointer-events: none;
}
.pc-art-fallback::after {
  content: '✦ 〜 ✦'; position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  color: rgba(148, 110, 84, 0.55); font-size: 20px; letter-spacing: 0.4em;
}
.pc-stamp {
  position: absolute; left: 14px; bottom: 16px; width: 74px; height: 74px;
  border: 1.5px solid rgba(148, 110, 84, 0.5); border-radius: 50%;
  color: rgba(148, 110, 84, 0.6);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  transform: rotate(-12deg); pointer-events: none;
  mix-blend-mode: multiply;
}
.pc-stamp::before { content: '✈'; font-size: 20px; }

/* right column */
.pc-right { display: flex; flex-direction: column; min-width: 0; padding: 6px 0 2px; }
.pc-kicker {
  font-size: 14px; font-weight: 700; letter-spacing: 0.16em;
  color: var(--accent); text-transform: uppercase; margin-bottom: 8px;
}
.pc-title {
  font-family: var(--serif); font-weight: 600; color: var(--ink);
  font-size: 34px; line-height: 1.15; margin: 0 0 8px; overflow-wrap: anywhere;
}
.pc-place { font-size: 15px; color: var(--ink-soft); margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }
.pc-pin { display: inline-flex; color: var(--accent); flex: none; }
.pc-rule { border-top: 1px solid var(--line); margin-bottom: 14px; }
.pc-note-label {
  font-size: 14px; letter-spacing: 0.12em; color: var(--ink-soft);
  margin-bottom: 10px; font-weight: 600;
}
.pc-excerpt {
  font-size: 21px; line-height: 1.8; color: var(--ink);
  margin: 0 0 22px; overflow-wrap: anywhere;
}

/* primary CTA */
.pc-actions { margin-top: auto; padding-top: 8px; }
.pc-cta {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 54px; padding: 12px 32px;
  background: var(--accent); color: #fff;
  font-size: 22px; font-weight: 600; letter-spacing: 0.04em;
  font-family: var(--sans);
  border: none; border-radius: 10px; cursor: pointer;
  box-shadow: 0 6px 16px rgba(191, 90, 60, 0.32);
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.pc-cta:hover { background: #a94c31; transform: translateY(-1px); box-shadow: 0 9px 20px rgba(191, 90, 60, 0.38); }
.pc-cta:active { transform: translateY(0); box-shadow: 0 3px 10px rgba(191, 90, 60, 0.3); }
.pc-cta:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; background: #a94c31; }
.pc-cta-sub {
  margin-top: 8px; font-size: 13px; color: var(--ink-faint);
  letter-spacing: 0.08em; text-align: center;
}

/* foot strip */
.pc-foot { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.pc-foot-brand {
  font-size: 12px; letter-spacing: 0.2em; color: var(--ink-faint);
  text-transform: uppercase; white-space: nowrap;
}
.pc-foot-line { flex: 1; border-top: 1px solid var(--line); }
.pc-foot-city {
  font-size: 12px; letter-spacing: 0.2em; color: var(--ink-soft);
  text-transform: uppercase; white-space: nowrap;
}

/* close + prev/next */
.pc-close {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--paper);
  color: var(--ink); font-size: 16px; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .15s ease, transform .15s ease;
}
.pc-close:hover { background: var(--paper-2); transform: scale(1.05); }
.pc-close:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pc-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--paper);
  color: var(--ink); font-size: 24px; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, opacity .15s ease, transform .15s ease;
}
.pc-nav:hover:not(:disabled) { background: var(--paper-2); }
.pc-nav:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pc-nav:disabled { opacity: 0.25; cursor: default; }
.pc-prev { left: calc(16px + env(safe-area-inset-left, 0px)); }
.pc-next { right: calc(16px + env(safe-area-inset-right, 0px)); }

/* ---- mobile: vertical layout, art on top ---- */
@media (max-width: 760px) {
  .pc-scrim { padding: 12px 10px; align-items: stretch; }
  .pc-card {
    width: 100%; margin: auto 0;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 12px;
  }
  .pc-body { padding: 16px 18px 16px; }
  .pc-main { display: flex; flex-direction: column; gap: 16px; }
  .pc-art {
    aspect-ratio: 16 / 10;
    max-height: 34vh; max-height: 34dvh;
    width: 100%;
  }
  .pc-stamp { width: 58px; height: 58px; left: 10px; bottom: 10px; }
  .pc-title { font-size: 28px; }
  .pc-excerpt { font-size: 19px; line-height: 1.75; margin-bottom: 18px; }
  .pc-note-label { font-size: 14px; }
  .pc-cta { width: 100%; font-size: 22px; min-height: 56px; }
  .pc-nav {
    top: auto; bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    transform: none; width: 44px; height: 44px;
    background: rgba(250, 246, 239, 0.92);
  }
  .pc-prev { left: calc(10px + env(safe-area-inset-left, 0px)); }
  .pc-next { right: calc(10px + env(safe-area-inset-right, 0px)); }
  .pc-card { padding-bottom: 6px; }
}

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .pc-scrim, .pc-card, .pc-body, .pc-cta, .pc-close, .pc-nav { transition: none !important; }
  .pc-scrim { opacity: 1; }
  .pc-card, .pc-scrim.open .pc-card { transform: none; opacity: 1; }
}

/* ============================================================
   Mobile-first optimization pass
   (appended so these rules win over the earlier base/media blocks)
   ============================================================ */

/* respect larger system / accessibility font sizes; keep iOS from inflating text unpredictably */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-wrap: break-word; word-break: normal; }

/* clear, consistent keyboard focus everywhere (touch + a11y) */
a:focus-visible,
button:focus-visible,
.chip:focus-visible,
.day-row:focus-visible,
.back-link:focus-visible,
.loc-view:focus-visible,
.loc-read:focus-visible,
.map-toggle:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
  text-decoration: none;
}

/* ---------- Home ---------- */
.tc-top { display: flex; align-items: center; gap: 10px; }
.tc-year {
  font-family: var(--serif); font-weight: 600; font-size: 13px; letter-spacing: .12em;
  color: #fff; background: var(--accent); padding: 2px 10px; border-radius: 999px;
  white-space: nowrap;
}
.tc-enter {
  margin-top: 12px; font-family: var(--sans); font-size: 14px; font-weight: 600;
  color: var(--accent); letter-spacing: .02em;
}
.trip-card:hover .tc-enter,
.trip-card:focus-visible .tc-enter { text-decoration: underline; }

@media (max-width: 820px) {
  .hero { padding: 22px 16px 6px; }
  .hero h1 { font-size: clamp(30px, 9.5vw, 46px); }
  .hero .tagline { font-size: 15px; margin-top: 8px; }
  .stat-bar { gap: 16px 20px; margin-top: 20px; }
  .stat .num { font-size: 25px; }
  .stat .lbl { font-size: 11px; }
  .world-map { height: 300px; margin: 14px 0 28px; }
  .section-title { font-size: 21px; margin: 22px 0 12px; }
  .trip-grid { grid-template-columns: 1fr; gap: 16px; }
  .trip-card .cover { aspect-ratio: 16 / 10; }
  .trip-card .body { padding: 14px 16px 18px; }
}

/* ---------- Trip page ---------- */
@media (max-width: 820px) {
  .trip-map { height: 340px; }              /* moderate default height (not full, not tiny) */
  .to-cities { font-size: 16px; line-height: 1.5; }
  .to-dates { letter-spacing: .08em; line-height: 1.6; max-width: 100%; overflow-wrap: anywhere; }
  .to-stats { gap: 20px 26px; }
  .day-row { padding: 16px 2px; gap: 14px; }
  .day-row .dnum { font-size: 22px; }
  .day-row .dinfo .t { font-size: 17px; }
  .day-row .dinfo .m { font-size: 12.5px; }
  /* keep the expand control clear of the sticky header */
  .map-toggle {
    top: calc(64px + env(safe-area-inset-top));
    right: calc(12px + env(safe-area-inset-right));
    min-height: 42px; padding: 9px 14px; font-size: 14px;
  }
  /* zoom control must not hide behind the sticky nav on the inline (collapsed) map */
  .map-frame:not(.expanded) .leaflet-top.leaflet-left {
    top: calc(60px + env(safe-area-inset-top));
  }
  .map-frame:not(.expanded) .leaflet-bottom.leaflet-right {
    bottom: calc(6px + env(safe-area-inset-bottom));
  }
}

/* ---------- Diary ---------- */
.story p { font-size: clamp(18px, 2.4vw, 20px); line-height: 1.85; }
@media (max-width: 820px) {
  .diary-hero .summary.intro { font-size: 17px; line-height: 1.7; }
  .day-kicker { font-size: 22px; }
  .story { padding-top: 4px; }
  .loc-anchor { padding: 22px 0 20px; }
  .loc-thumbs img { width: 54px; height: 54px; }
  .place-card { gap: 12px; padding: 12px 14px; }
  .place-card .pc-photos img { width: 56px; height: 56px; }
  .share-bar { padding: 14px; gap: 8px; }
  .share-bar .btn { flex: 1 1 auto; justify-content: center; }
}

/* ---------- Postcard (mobile vertical) ---------- */
@media (max-width: 760px) {
  .pc-title { font-size: clamp(26px, 8vw, 30px); }
  .pc-art { aspect-ratio: 16 / 10; max-height: 30dvh; width: 100%; }
  .pc-excerpt { font-size: 19px; line-height: 1.78; margin-bottom: 14px; }
  .pc-cta { font-size: 21px; min-height: 52px; }
  /* keep the primary "open" CTA always reachable without a long scroll */
  .pc-actions {
    position: sticky; bottom: 0; margin-top: 10px; padding-top: 10px;
    background: linear-gradient(to top, var(--paper) 72%, rgba(250, 246, 239, 0));
  }
}

/* ---------- Collage image failure fallback ---------- */
.collage .ph-broken { background: var(--paper-2); }
.collage .ph-broken::after {
  content: '✦'; display: flex; align-items: center; justify-content: center;
  height: 100%; min-height: 80px; color: var(--ink-faint); font-size: 22px;
}

/* ---------- Reduced motion: kill the continuous marker pulse ---------- */
@media (prefers-reduced-motion: reduce) {
  .lj-pin.active .lj-dot { animation: none !important; box-shadow: 0 6px 16px rgba(191, 90, 60, .45); }
}

/* ---------- Scroll-aware illustrated reading background (diary pages) ---------- */
#app { position: relative; z-index: 1; }

/* Depth is a single data-attribute on the layer; every visual knob below is
   scoped to .reading-bg only — body text, buttons, map and cards are never
   touched. Levels 1–5 = 极浅 / 浅色 / 中度 / 清晰 / 浓郁. */
.reading-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  /* keep the layer out of the accessibility tree entirely */
  user-select: none;
  /* L3 中度 is the site default */
  --rb-o: .42;                                        /* illustration presence   */
  --rb-f: saturate(1.08) contrast(1.05);              /* watercolor richness     */
}
.reading-bg[data-depth="1"] { --rb-o: .10; --rb-f: saturate(.78) contrast(.94); }
.reading-bg[data-depth="2"] { --rb-o: .22; --rb-f: saturate(.94) contrast(.98); }
.reading-bg[data-depth="4"] { --rb-o: .58; --rb-f: saturate(1.18) contrast(1.10); }
.reading-bg[data-depth="5"] { --rb-o: .74; --rb-f: saturate(1.28) contrast(1.16); }

.reading-bg .rb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 72% 62%;
  opacity: 0;
  filter: var(--rb-f);
  transition: opacity .32s ease, filter .26s ease;
  will-change: opacity;
}
.reading-bg .rb-img.is-show { opacity: calc(var(--rb-o) + var(--rb-boost, 0)); }
.reading-bg .rb-veil {
  position: absolute;
  inset: 0;
  /* ivory protection band over the reading column; illustration breathes at the edges */
  background: linear-gradient(180deg,
    rgba(250, 246, 239, .78) 0%,
    rgba(250, 246, 239, .62) 30%,
    rgba(250, 246, 239, .66) 68%,
    rgba(250, 246, 239, .88) 100%);
}

/* Desktop: a little more immersion, wider visible art, centred protection */
@media (min-width: 900px) {
  .reading-bg { --rb-boost: .04; }
  .reading-bg .rb-img { object-position: 62% 45%; }
  .reading-bg .rb-veil {
    background: linear-gradient(90deg,
      rgba(250, 246, 239, .42) 0%,
      rgba(250, 246, 239, .84) 26%,
      rgba(250, 246, 239, .84) 74%,
      rgba(250, 246, 239, .42) 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reading-bg .rb-img { transition: none; }
}

/* ---------- Background-illustration depth control (diary pages) ---------- */
.rb-fab {
  position: fixed;
  right: 14px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 55;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(191, 90, 60, .35);
  background: rgba(250, 246, 239, .92);
  color: var(--accent, #bf5a3c);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(66, 45, 30, .16);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: transform .18s ease, box-shadow .18s ease;
}
.rb-fab:active { transform: scale(.94); }
.rb-fab.is-open { box-shadow: 0 4px 14px rgba(66, 45, 30, .24); }

.rb-panel {
  position: fixed;
  right: 14px;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  z-index: 55;
  width: min(320px, calc(100vw - 28px));
  background: var(--paper, #faf6ef);
  border: 1px solid rgba(191, 90, 60, .28);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(66, 45, 30, .22);
  padding: 14px 14px 12px;
  font-family: var(--serif, Georgia, serif);
}
.rb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.rb-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink, #42352e);
  letter-spacing: .04em;
}
.rb-close {
  width: 32px; height: 32px;
  border: none; background: transparent;
  color: var(--ink-faint, #a09488);
  font-size: 20px; line-height: 1;
  cursor: pointer; border-radius: 8px;
}
.rb-close:focus-visible, .rb-reset:focus-visible, .rb-opt:focus-visible, .rb-fab:focus-visible {
  outline: 2px solid var(--accent, #bf5a3c);
  outline-offset: 2px;
}
.rb-seg {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.rb-opt {
  height: 46px;
  border-radius: 10px;
  border: 1px solid rgba(66, 45, 30, .18);
  background: rgba(255, 253, 248, .9);
  color: var(--ink, #42352e);
  font-family: var(--serif, Georgia, serif);
  font-size: 14px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.rb-opt.active {
  background: var(--accent, #bf5a3c);
  border-color: var(--accent, #bf5a3c);
  color: #fff8f0;
  font-weight: 700;
}
.rb-desc {
  margin: 10px 2px 10px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-faint, #a09488);
  min-height: 1.6em;
}
.rb-reset {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px dashed rgba(191, 90, 60, .45);
  background: transparent;
  color: var(--accent, #bf5a3c);
  font-family: var(--hand, cursive);
  font-size: 14px;
  cursor: pointer;
}
.rb-reset:hover { background: rgba(191, 90, 60, .07); }

@media (prefers-reduced-motion: reduce) {
  .rb-fab, .rb-opt { transition: none; }
}
