:root {
  --bg: #0f0f11;
  --bg-raised: #18181c;
  --bg-hover: #222228;
  --line: #2a2a31;
  --text: #ececf1;
  --text-dim: #9a9aa6;
  --accent: #e8b04b;
  --accent-text: #1a1408;
  --danger: #ef6b6b;
  --radius: 10px;
  --gap: 4px;
  --pad: clamp(16px, 4vw, 40px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { display: block; }
button { font: inherit; color: inherit; }

/* ---------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 14px var(--pad);
  padding-top: max(14px, env(safe-area-inset-top));
  background: rgba(15, 15, 17, .82);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.brand { font-weight: 650; letter-spacing: .01em; text-decoration: none; font-size: 16px; }
.topbar .spacer { flex: 1; }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-raised);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  font-size: 14px; font-weight: 500;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--bg-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--bg-raised); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- album page */
.album { padding: 8px var(--pad) 64px; max-width: 2200px; margin: 0 auto; }
.crumbs { font-size: 14px; color: var(--text-dim); margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { text-decoration: none; color: var(--text-dim); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { opacity: .5; }
.album-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin: 10px 0 24px;
}
.album-head h1 { font-size: clamp(26px, 4vw, 40px); line-height: 1.15; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.album-head .meta { color: var(--text-dim); margin: 6px 0 0; font-size: 14px; }
.album-head .desc { margin: 10px 0 0; max-width: 70ch; color: #cfcfd8; }
.empty { color: var(--text-dim); padding: 40px 0; }

/* ---------- album cards */
.cards {
  display: grid; gap: 20px 16px; margin-bottom: 36px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}
.card { text-decoration: none; display: block; }
.card-img {
  aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden;
  background: var(--bg-raised); display: grid; place-items: center; color: var(--text-dim);
}
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-img img { transform: scale(1.035); }
.card-text { display: flex; flex-direction: column; padding: 10px 2px 0; }
.card-title { font-weight: 600; }
.card-sub { color: var(--text-dim); font-size: 13px; }

/* ---------- justified photo grid */
.grid { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; gap: var(--gap); justify-content: center; }
.tile {
  position: relative; overflow: hidden; background: var(--bg-raised); cursor: zoom-in;
  border-radius: 3px; flex: none;
}
.tile img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s ease, transform .4s ease; }
.tile img.loaded { opacity: 1; }
.tile:hover img { transform: scale(1.02); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- message pages (404, password) */
.center-page { min-height: 100vh; display: flex; flex-direction: column; }
.message { margin: auto; padding: 40px var(--pad); text-align: center; max-width: 440px; width: 100%; }
.message h1 { font-size: 26px; margin: 8px 0; }
.message p { color: var(--text-dim); }
.lock-icon { color: var(--accent); }
.pw-form { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.pw-form .error { color: var(--danger); margin: 4px 0 0; }

input[type=text], input[type=password], input[type=search], textarea, select {
  font: inherit; color: var(--text);
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

/* ---------- viewer */
.viewer {
  position: fixed; inset: 0; z-index: 100; background: #000;
  display: none; user-select: none; -webkit-user-select: none; touch-action: none;
}
.viewer.open { display: block; }
.viewer .stage { position: absolute; inset: 0; overflow: hidden; }
.viewer .slide {
  position: absolute; inset: 0; display: grid; place-items: center;
  will-change: transform;
}
.viewer .slide img {
  grid-area: 1 / 1; max-width: 100%; max-height: 100%; object-fit: contain;
  width: auto; height: auto;
}
.viewer .slide img.low { filter: blur(0); }
.viewer .slide img.high { opacity: 0; transition: opacity .25s; }
.viewer .slide img.high.loaded { opacity: 1; }
.viewer .bar {
  position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 4px;
  padding: 10px 12px; transition: opacity .25s; z-index: 2;
}
.viewer .bar.top {
  top: 0; padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(rgba(0,0,0,.6), transparent);
}
.viewer .bar.bottom {
  bottom: 0; padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,.6));
  justify-content: center; color: #ddd; font-size: 13px; pointer-events: none;
}
.viewer .counter { font-size: 14px; color: #ddd; padding: 0 8px; font-variant-numeric: tabular-nums; }
.viewer .grow { flex: 1; }
.viewer .ibtn {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 999px; background: transparent; cursor: pointer; color: #fff;
  text-decoration: none;
}
.viewer .ibtn:hover { background: rgba(255,255,255,.12); }
.viewer .ibtn.on { color: var(--accent); }
/* Previous/next: full-height areas along the left and right edges; the round icon sits in the middle. */
.viewer .nav {
  position: absolute; top: 0; bottom: 0; z-index: 2;
  width: clamp(64px, 12vw, 170px); border: 0; padding: 0; cursor: pointer;
  background: transparent; color: #fff; display: flex; align-items: center;
  transition: opacity .25s;
}
.viewer .nav.prev { left: 0; justify-content: flex-start; padding-left: 16px; }
.viewer .nav.next { right: 0; justify-content: flex-end; padding-right: 16px; }
.viewer .nav span {
  width: 52px; height: 52px; border-radius: 999px; display: grid; place-items: center;
  background: rgba(20,20,20,.45); transition: background .15s;
}
.viewer .nav:hover span { background: rgba(60,60,60,.75); }
.viewer .nav:focus-visible { outline: none; }
.viewer .nav:focus-visible span { outline: 2px solid var(--accent); }
.viewer .bar.top { z-index: 3; }
.viewer .slide img { transform-origin: 0 0; -webkit-user-drag: none; }
.viewer .slide img.orig { opacity: 0; transition: opacity .25s; }
.viewer .slide img.orig.loaded { opacity: 1; }
.viewer.zooming, .viewer.zooming * { cursor: move !important; }
.viewer .hint { margin-left: 14px; opacity: .55; }
@media (hover: none), (pointer: coarse) { .viewer .hint { display: none; } }
.viewer .nav[hidden] { display: none; }
.viewer.idle .bar, .viewer.idle .nav { opacity: 0; }
.viewer.idle .bar { pointer-events: none; }
.viewer.idle { cursor: none; }
.viewer .spinner {
  position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px;
  border: 2px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%;
  animation: spin .8s linear infinite; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.viewer.loading .spinner { opacity: 1; transition-delay: .4s; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (hover: none) {
  .viewer .nav { display: none; }
}
@media (max-width: 600px) {
  :root { --gap: 3px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 16px 10px; }
  .card-sub { font-size: 12px; }
  .album-head { margin-bottom: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- viewer: caption and info panel (1.3) */
.viewer .cap {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: max(40px, calc(env(safe-area-inset-bottom) + 34px));
  z-index: 2; max-width: min(760px, calc(100% - 160px)); max-height: 30vh; overflow: auto;
  padding: 8px 14px; border-radius: 10px; background: rgba(0,0,0,.55);
  color: #f2f2f2; font-size: 15px; line-height: 1.45; text-align: center; white-space: pre-line;
  text-shadow: 0 1px 2px rgba(0,0,0,.6); transition: opacity .25s;
}
.viewer .cap[hidden] { display: none; }
.viewer.zooming .cap { opacity: 0; }

.viewer .info {
  position: absolute; top: 0; right: 0; bottom: 0; width: 340px; z-index: 4;
  background: #141417; border-left: 1px solid #26262c; color: var(--text);
  display: none; flex-direction: column; overflow: auto; user-select: text; -webkit-user-select: text;
}
.viewer.info-open .info { display: flex; }
.viewer .info-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 4px 20px; font-weight: 600; }
.viewer .info-list { margin: 0; padding: 4px 20px 24px; display: grid; grid-template-columns: 1fr; }
.viewer .info-list dt { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin-top: 14px; }
.viewer .info-list dd { margin: 2px 0 0; font-size: 14px; word-break: break-word; }
.viewer .info-list a { color: var(--accent); }
@media (min-width: 761px) {
  .viewer.info-open .stage, .viewer.info-open .bar { right: 340px; }
  .viewer.info-open .nav.next { right: 340px; }
  .viewer.info-open .cap { left: calc(50% - 170px); max-width: min(760px, calc(100% - 500px)); }
  .viewer.info-open .spinner { left: calc(50% - 170px); }
}
@media (max-width: 760px) {
  .viewer .cap { max-width: calc(100% - 24px); font-size: 14px; bottom: max(34px, calc(env(safe-area-inset-bottom) + 30px)); }
  .viewer .info { top: auto; left: 0; width: auto; max-height: 55vh; border-left: 0; border-top: 1px solid #26262c; border-radius: 14px 14px 0 0; }
}

/* ---------- walk route map (1.4) */
/* isolation: Leaflet's panes and controls use z-index 400-1000; keep them inside the map so the
   photo viewer (z-index 100) always covers it. */
.walk { margin: 0 0 28px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-raised); position: relative; z-index: 0; isolation: isolate; }
.walkmap { height: clamp(260px, calc(var(--vh, 1vh) * 42), 460px); background: #20242a; }
/* Phones: about 60% of that, so there is page left below the map for a thumb to scroll with. */
@media (max-width: 760px) { .walkmap { height: clamp(156px, calc(var(--vh, 1vh) * 25), 276px); } }
.leaflet-bar a.walk-recenter { display: flex; align-items: center; justify-content: center; }
.leaflet-bar a.walk-recenter svg { width: 18px; height: 18px; display: block; }
.walkinfo { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.walk-row { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; }
.walk-name { font-weight: 600; }
.walk-sub { color: var(--text-dim); font-size: 14px; flex: 1; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.leaflet-container { font: 13px/1.4 var(--font); }
.photo-tip { padding: 4px; border-radius: 8px; }
.photo-tip .tip-cap { max-width: 160px; white-space: normal; font-size: 12px; margin-top: 4px; color: #222; }

/* ---------- touch zoom (1.5): controls out of the way while zoomed in */
.viewer.zoomed .bar, .viewer.zoomed .nav, .viewer.zoomed .cap { opacity: 0; pointer-events: none; }
@media (max-width: 760px) { .viewer.zoomed .info { display: none; } }

/* ---------- album layout: text blocks and highlighted photos (1.7) */
.rows { display: flex; flex-direction: column; gap: var(--gap); }
.hl-wide { display: flex; justify-content: center; margin: calc(var(--gap) * 3) 0; }
.hl-split { display: flex; gap: var(--gap); align-items: flex-start; }
.hl-split.side-right { flex-direction: row-reverse; }
.hl-col { flex: none; }
.tile.hl-tile { border-radius: 4px; }
.tile.hl-tile img { object-fit: cover; }

.tb {
  max-width: 72ch; padding: 26px 0 22px; color: #e4e4ea;
  font-size: 17px; line-height: 1.65; overflow-wrap: break-word;
}
.tb.align-center { width: 100%; margin-left: auto; margin-right: auto; text-align: center; }
.tb.size-small { font-size: 15px; }
.tb.size-large { font-size: 20px; }
.tb.font-serif { font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif; }
.tb.font-script { font-family: 'Segoe Script', 'Bradley Hand', 'Snell Roundhand', 'Brush Script MT', 'Dancing Script', cursive; }
.tb h1, .tb h2, .tb h3 { line-height: 1.2; margin: .25em 0 .45em; font-weight: 700; color: var(--text); }
.tb h1 { font-size: 2em; letter-spacing: -.01em; }
.tb h2 { font-size: 1.5em; }
.tb h3 { font-size: 1.2em; }
.tb p { margin: 0 0 .8em; }
.tb ul, .tb ol { margin: 0 0 .8em; padding-left: 1.4em; }
.tb.align-center ul, .tb.align-center ol { display: inline-block; text-align: left; }
.tb blockquote { margin: .4em 0 .9em; padding: .1em 0 .1em 1em; border-left: 3px solid var(--accent); color: #cfcfd8; font-style: italic; }
.tb.align-center blockquote { border-left: 0; padding-left: 0; }
.tb a { color: var(--accent); }
.tb > :first-child { margin-top: 0; }
.tb > :last-child { margin-bottom: 0; }
@media (max-width: 600px) {
  .tb { padding: 18px 2px 14px; font-size: 16px; }
  .tb.size-large { font-size: 18px; }
  .tb.size-small { font-size: 14px; }
}

/* A photo that is still loading shimmers softly instead of looking like an empty box. */
.tile:has(> img:not(.loaded))::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.06) 50%, transparent 70%) 0 0 / 250% 100%;
  animation: tile-wait 1.6s ease-in-out infinite;
}
@keyframes tile-wait { from { background-position: 120% 0; } to { background-position: -120% 0; } }
