.trip-view-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 24px 0;
}
.trip-view-nav button {
  min-height: 44px;
  padding: 8px 16px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  font: inherit;
  cursor: pointer;
}
.trip-view-nav [aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
.trip-timeline[hidden],
.trip-discoveries[hidden] {
  display: none !important;
}
body:has(.photo-viewer[open]) {
  overflow: hidden;
}
.discovery-entry {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  text-align: left;
  width: 100%;
  margin: 24px 0;
  padding: 20px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--hairline);
  font: inherit;
  cursor: pointer;
}
.discovery-entry img {
  grid-row: 1 / 3;
  width: 120px;
  height: 100px;
  object-fit: cover;
}
.discovery-entry span,
.discovery-entry strong {
  grid-column: 2;
  overflow-wrap: anywhere;
}
.discovery-entry strong {
  font-family: var(--heading-font);
  font-size: 22px;
  font-weight: 400;
}
.discovery-entry[hidden] {
  display: none;
}
@media (max-width: 600px) {
  .discovery-entry {
    grid-template-columns: 80px 1fr;
  }
  .discovery-entry img {
    width: 80px;
    height: 80px;
  }
  .discovery-entry strong {
    font-size: 18px;
  }
}
/* The reusable dialog is mounted on body, outside the composition root. */
.photo-viewer button {
  min-width: 44px;
  min-height: 44px;
  color: inherit;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  font: inherit;
  cursor: pointer;
}
.photo-viewer button:disabled {
  opacity: 0.4;
  cursor: default;
}
.photo-viewer :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
/* A journal masthead and a quiet dock keep every reading view grounded. */
.trip-masthead {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 76px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--hairline);
  color: var(--text);
  background: var(--bg);
  position: relative;
  z-index: 502;
}
.trip-masthead-brand {
  font-family: var(--heading-font);
  font-size: 32px;
  color: inherit;
  text-decoration: none;
}
.trip-masthead > div {
  display: grid;
  gap: 4px;
  text-align: center;
  flex: 1;
  min-width: 0;
}
.trip-masthead strong {
  font-family: var(--heading-font);
  font-size: 20px;
  font-weight: 400;
  overflow-wrap: anywhere;
}
.trip-masthead small {
  font-size: 12px;
  color: var(--meta);
}
.trip-view-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 0;
  margin: 0;
  width: min(100%, 960px);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--hairline);
  z-index: 900;
}
.trip-view-nav[hidden] {
  display: none !important;
}
.trip-view-nav button {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 0;
  padding: 8px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 12px;
}
.trip-view-nav button svg {
  flex-shrink: 0;
}
.trip-view-nav [aria-pressed="true"] {
  color: var(--accent);
  box-shadow: inset 0 -2px var(--accent);
}
.trip-view-nav :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}
body:has(.trip-view-nav:not([hidden])) .wrap {
  padding-bottom: max(96px, calc(84px + env(safe-area-inset-bottom)));
}
@media (max-width: 600px) {
  .trip-masthead {
    padding: 12px 16px;
    gap: 16px;
  }
  .trip-masthead-brand {
    font-size: 28px;
  }
  .trip-masthead strong {
    font-size: 18px;
  }
}
.trip-view-nav button[hidden] {
  display: none !important;
}
@media (min-width: 1000px) {
  .trip-view-nav {
    width: 440px;
    bottom: 16px;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    padding: 4px 8px;
  }
  .trip-view-nav button {
    min-height: 52px;
  }
}

@media (max-width: 360px) {
  .trip-masthead {
    gap: 12px;
  }
  .trip-masthead-brand {
    font-size: 24px;
  }
}

@media (max-width: 999px) {
  body:has(.trip-map.is-city:not([hidden])) .trip-view-nav { display: none; }
}

/* Expand only the discoveries canvas; Timeline and map keep their own geometry. */
.trip-discoveries { width:min(1440px,calc(100vw - 48px)); position:relative; left:50%; transform:translateX(-50%); }
@media(max-width:720px) { .trip-discoveries { width:calc(100vw - 2px); } }

/* Discoveries own the reading canvas; the site shell belongs to Timeline. */
body:has(.trip-discoveries:not([hidden])) .wrap {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}
body:has(.trip-discoveries:not([hidden])) .wrap > .shell,
body:has(.trip-discoveries:not([hidden])) .share-bar,
body:has(.trip-discoveries:not([hidden])) .share-invite,
body:has(.trip-discoveries:not([hidden])) .trip-masthead {
  display: none;
}
body:has(.trip-discoveries:not([hidden])) .trip-discoveries {
  width: 100%;
  left: auto;
  transform: none;
}
body:has(.trip-discoveries:not([hidden])) .wrapped-content {
  width: 100%;
  max-width: 1280px;
  padding-bottom: max(96px, calc(84px + env(safe-area-inset-bottom)));
}
/* All reading views reuse the existing discoveries floating view switch. */
.trip-view-nav {
  width: min(360px, calc(100% - 32px));
  bottom: max(12px, env(safe-area-inset-bottom));
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 4px 12px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 24px #0002;
}
.trip-view-nav button {
  min-height: 48px;
  font-size: 11px;
}
.trip-view-nav button svg {
  width: 20px;
  height: 20px;
}
.trip-view-nav [aria-pressed="true"] {
  box-shadow: none;
}

/* The head script sets this before the first paint, until view selection settles. */
html[data-discovery-pending="true"] .wrap > .shell,
html[data-discovery-pending="true"] .share-bar,
html[data-discovery-pending="true"] .share-invite,
html[data-discovery-pending="true"] .trip-masthead {
  display: none;
}
html[data-discovery-pending="true"] .wrap {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}
