/* WeeMapper – page styling */

:root {
  --brand: #3BC7E0;     /* WeeMapper turquoise, sampled from the Figma splash screen */
  --ink: #1f2a2e;       /* main text colour */
  --muted: #5b6b70;     /* grey text */
  --cream: #FFF6E5;     /* card colours sampled from the Figma screens */
  --lavender: #C3BDED;
  --green: #ACDFB4;
  --peach: #FFC5A5;     /* the Collaborate card colour in the Figma */
  --blue: #A7CFF2;      /* soft blue for Download, alongside the other pastels */
  --yellow: #F6C9D6;    /* soft pastel pink for Save (name kept from an earlier colour) */
  --red: #d62828;
  --title-font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --text-font: "Merriweather Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--text-font);
  color: var(--ink);
  background: #ffffff;
}

/* Whole page: title, map, cards, stacked top to bottom, filling the screen */
.page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* better on phones, where the address bar comes and goes */
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}

/* ---------- Title and globe ---------- */

.trip-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 12px;
}

/* Looks like a heading, but can be typed over */
.trip-title {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font-family: var(--title-font);
  font-size: clamp(26px, 7vw, 40px);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
}

.trip-title::placeholder {
  color: #b5c0c3;
}

.trip-title:hover,
.trip-title:focus {
  outline: none;
  border-bottom-color: var(--brand);
}

.globe {
  flex: none;
  width: clamp(48px, 13vw, 64px);
  height: auto;
}

/* ---------- Map ---------- */

.trip-map {
  flex: 1;          /* takes all the space left between title and cards */
  min-height: 260px;
  border-radius: 12px;
  overflow: hidden;
}

.photo-count {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* Hides the plain browser file picker but keeps it working */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Cards under the map ---------- */

.cards {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.cards[hidden] {
  display: none;
}

.card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 132px;
  padding: 16px 12px;
  border: 0;
  border-radius: 24px;
  font-family: var(--text-font);
  color: var(--ink);
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.card[hidden] {
  display: none;
}

.card:hover {
  filter: brightness(0.97);
}

.card:active {
  transform: scale(0.98);
}

.card:focus-visible,
#photo-input:focus-visible ~ .cards #card-start {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.card--cream { background: var(--cream); }
.card--lavender { background: var(--lavender); }
.card--green { background: var(--green); }

.card-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.card-sub {
  font-size: 14px;
}

.next-note {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.next-note:empty {
  display: none;
}

/* ---------- Edit panel (slides up from the bottom) ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(20, 28, 31, 0.35);
}

.sheet-backdrop[hidden] {
  display: none;
}

.sheet {
  width: 100%;
  max-width: 560px;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.15);
  animation: sheet-up 0.2s ease-out;
}

@keyframes sheet-up {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet { animation: none; }
}

.sheet-heading {
  margin: 0 0 14px;
  font-family: var(--title-font);
  font-size: 22px;
  font-weight: 600;
}

.sheet-button {
  display: block;
  padding: 14px 20px;
  border-radius: 14px;
  background: var(--lavender);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.sheet-done {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 14px 20px;
  border: 0;
  border-radius: 14px;
  background: var(--green);
  font-family: var(--text-font);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}

/* Row of thumbnails that scrolls sideways */
.photo-strip {
  display: flex;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
}

.photo-strip:empty {
  display: none;
}

.photo-strip li {
  position: relative; /* lets the × sit in the corner */
  flex: none;
  width: 84px;        /* 30% bigger than the first version (64px) */
  height: 84px;
  border-radius: 10px;
  overflow: hidden;
  background: #eef3f4;
}

/* Small × in the top-right corner of each thumbnail */
.photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 28, 31, 0.65);
  color: #ffffff;
  font-size: 18px;
  line-height: 26px;
  text-align: center;
  cursor: pointer;
}

/* A bigger invisible area around the × so it's easy to tap */
.photo-remove::before {
  content: "";
  position: absolute;
  inset: -6px;
}

.photo-remove:hover {
  background: rgba(214, 40, 40, 0.9);
}

.photo-remove:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 1px;
}

/* Box with a + at the end of the row: adds more photos */
.photo-strip li.photo-add {
  background: #ffffff;
  border: 2px dashed #cfd8da;
}

.photo-add label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 34px;
  font-weight: 300;
  color: var(--muted);
  cursor: pointer;
}

.photo-add label:hover {
  background: #f4f7f7;
  color: var(--ink);
}

.photo-strip li {
  cursor: pointer;
}

.photo-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* fill the square without stretching */
  display: block;
}

/* Shown when a photo can't be previewed */
.photo-strip li.no-preview {
  display: flex;
  padding-right: 28px; /* room for the × */
  align-items: center;
  justify-content: center;
  padding: 4px;
  font-size: 10px;
  text-align: center;
  word-break: break-all;
}

/* ---------- Photos on the map ---------- */

/* Zero-size box placed exactly on the photo's location */
.photo-pin {
  width: 0;
  height: 0;
  cursor: pointer;
}

/* Red dot, centred on the location */
.photo-dot {
  position: absolute;
  left: -7px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d62828; /* red, as in the Faro print */
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

/* Thin line from the dot to the photo */
.photo-pin__line {
  position: absolute;
  top: 0;
  width: 26px;
  height: 1px;
  background: #1f2a2e;
}

/* Small framed photo, like a polaroid */
.photo-pin__frame {
  position: absolute;
  top: -30px;
  width: 60px;
  height: 60px;
  padding: 3px;
  border: 0;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.photo-pin__frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-pin__frame:focus-visible {
  outline: 3px solid var(--brand);
}

/* Photo to the right of the dot */
.photo-pin--right .photo-pin__line { left: 0; }
.photo-pin--right .photo-pin__frame { left: 26px; }

/* Photo to the left of the dot */
.photo-pin--left .photo-pin__line { right: 0; }
.photo-pin--left .photo-pin__frame { right: 26px; }

/* Smaller photos on phones */
@media (max-width: 600px) {
  .photo-pin__frame { width: 48px; height: 48px; top: -24px; }
  .photo-pin__line { width: 18px; }
  .photo-pin--right .photo-pin__frame { left: 18px; }
  .photo-pin--left .photo-pin__frame { right: 18px; }
}

/* ---------- Large photo view ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 28, 31, 0.9);
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border: 6px solid #ffffff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.lightbox p {
  margin: 14px 0 0;
  color: #ffffff;
  font-size: 15px;
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

/* Thumbnails of photos with no location are faded */
.photo-strip li.no-location img {
  opacity: 0.4;
}

/* ---------- "Follow streets" switch ---------- */

.street-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e6eced;
  cursor: pointer;
  font-size: 15px;
}

.street-toggle input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--brand);
}

.street-toggle small {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: #5b6b70;
  line-height: 1.4;
}

.route-status {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.route-status:empty {
  display: none;
}

/* ---------- Style step ---------- */

.style-step[hidden] {
  display: none;
}

/* Row of style tiles (scrolls sideways when there are many) */
.style-tiles {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  overflow-x: auto;
  padding: 4px 2px 6px;
}

.style-tile {
  flex: none;
  width: 104px;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--text-font);
  font-size: 14px;
  color: var(--ink);
  text-align: center;
  cursor: pointer;
}

/* Little drawing of the style's colours */
.style-tile svg {
  display: block;
  width: 104px;
  height: 80px;
  margin-bottom: 6px;
  border-radius: 14px;
  outline: 2px solid #e1e6e7;
  outline-offset: -2px;
}

.style-tile[aria-checked="true"] svg {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.style-tile[aria-checked="true"] {
  font-weight: 700;
}

.style-tile:focus-visible {
  outline: none;
}

.style-tile:focus-visible svg {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

/* Back / Next */
.step-buttons {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.step-button {
  flex: 1;
  min-height: 56px;
  border: 0;
  border-radius: 16px;
  font-family: var(--text-font);
  font-size: 17px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink);
  cursor: pointer;
}

.step-button--back { background: var(--lavender); }
.step-button--next { background: var(--green); }

.step-button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- Print step ---------- */

/* On the print step, the page shows only the print (no title row or big map) */
body[data-step="print"] .trip-header,
body[data-step="print"] .trip-map,
body[data-step="print"] .photo-count,
body[data-step="print"] .route-status {
  display: none;
}

.print-step {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.print-step[hidden] {
  display: none;
}

/* Centres the print in the space between the buttons */
.poster-holder {
  flex: 1;
  min-height: 0;
  container-type: size; /* lets the print size itself to the space available */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 0 4px;
}

/* The print: portrait, A3/A2 proportions (1 : 1.414).
   As wide as fits, but never so tall that the buttons go off screen. */
.poster {
  --poster-page: #ffffff;
  --poster-title: #111111;
  --poster-text: #111111;
  position: relative;
  width: min(100cqw, calc(100cqh / 1.4142)); /* as big as fits, keeping A-series proportions */
  aspect-ratio: 1 / 1.4142;
  container-type: inline-size; /* lets text sizes follow the print's width */
  background: var(--poster-page);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 10px 30px rgba(0, 0, 0, 0.12);
  outline: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

/* The map, cropped to a circle.
   The circle is cut three ways, because Safari can ignore the rounded
   corners when the map inside is shrunk (Balanced and Detailed):
   border-radius + overflow (all browsers), clip-path (Safari respects it
   even then) and a mask (makes Safari treat the crop as a separate layer). */
.poster-circle {
  position: absolute;
  left: 12%;
  top: 5.5%;
  width: 76%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  clip-path: circle(50% at 50% 50%);
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  isolation: isolate;
}

/* Sits in the top-left corner and never changes the circle's size,
   even when drawn bigger for more detail */
.poster-map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Dots, lines and photo frames sit on top of the map and can spill outside the circle */
.poster-pins {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.poster-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.poster-lines line {
  stroke: #1f1f1f;
  stroke-width: 0.68; /* 15% thinner than first version (0.8) */
}

.poster-dot {
  position: absolute;
  width: 1.6cqw;
  height: 1.6cqw;
  margin: -0.8cqw 0 0 -0.8cqw;
  border-radius: 50%;
  background: #d62828;
}

/* White polaroid-style frame: thicker border at the bottom */
.poster-frame {
  position: absolute;
  width: 15.6cqw;           /* size set by print.js (FRAME), these are the defaults */
  height: 18.72cqw;
  padding: 0.91cqw 0.91cqw 3.12cqw;
  background: #ffffff;
  box-shadow: 0 0.3cqw 0.8cqw rgba(0, 0, 0, 0.25);
}

.poster-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* City, country and date under the circle */
.poster-text {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 66%;
  text-align: center;
}

.poster-city {
  margin: 0;
  font-family: "Libre Baskerville", Georgia, "Times New Roman", serif;
  font-size: 11cqw;
  font-weight: 400;
  line-height: 1.1;
  color: var(--poster-title);
  overflow-wrap: anywhere;
}

.poster-city.is-empty {
  opacity: 0.35;
}

.poster-country {
  margin: 1cqw 0 0;
  line-height: 1.35;
  font-family: "Libre Baskerville", Georgia, "Times New Roman", serif;
  font-size: 4.2cqw;
  color: var(--poster-text);
}

.poster-date {
  margin: 4cqw 0 0;
  line-height: 1.35;
  font-family: "Libre Baskerville", Georgia, "Times New Roman", serif;
  font-size: 3cqw;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--poster-text);
}

.poster-country:empty,
.poster-date:empty {
  display: none;
}

/* Postmark stamp: drawn on a see-through layer covering the whole print */
.poster-stamp {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Map data credit, required on the print */
.poster-credit {
  position: absolute;
  right: 3.6cqw;   /* at least 10 mm from the edges on A3 */
  bottom: 3.6cqw;
  margin: 0;
  text-align: right;
  color: var(--poster-text);
  pointer-events: none;
}

.poster-credit p {
  margin: 0;
  line-height: 1.25;
  white-space: nowrap;
}

/* "Made with WeeMapper": small, in the logo font (≈ 7 pt on A3) */
.poster-made {
  font-family: var(--title-font);
  font-size: 0.85cqw;
  font-weight: 500;
  opacity: 0.55;
}

/* Map data credit: as small as stays readable in print (≈ 5.5 pt on A3) */
.poster-data {
  font-family: var(--text-font);
  font-size: 0.65cqw;
  opacity: 0.45;
}

/* ---------- Text fields in the Edit text panel ---------- */

.field {
  display: block;
  margin-bottom: 12px;
}

.field span {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 700;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cfd8da;
  border-radius: 12px;
  font-family: var(--text-font);
  font-size: 16px; /* 16px stops phones zooming in when typing */
  color: var(--ink);
}

.field input:focus {
  outline: 3px solid var(--brand);
  outline-offset: 0;
  border-color: transparent;
}

/* ---------- Home page ---------- */

/* On the home page, show only the home section */
body[data-step="home"] .trip-header,
body[data-step="home"] .trip-map,
body[data-step="home"] .photo-count,
body[data-step="home"] .route-status,
body[data-step="home"] .cards {
  display: none;
}

.home-step {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 12px;
}

.home-step[hidden] {
  display: none;
}

/* Turquoise WeeMapper banner with the globe */
.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 14px 26px;
  border-radius: 28px;
  background: var(--brand);
}

.brand-name {
  font-family: var(--title-font);
  font-size: clamp(30px, 9vw, 44px);
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.brand-globe {
  width: clamp(52px, 14vw, 68px);
  height: auto;
}

.home-section-head {
  position: relative;
  margin-top: 22px;
  text-align: center;
}

.home-heading {
  margin: 0;
  font-family: var(--title-font);
  font-size: clamp(28px, 8vw, 38px);
  font-weight: 500;
  text-align: center;
}

.home-heading--big {
  margin: 28px 0 14px;
  font-size: clamp(32px, 9.5vw, 46px);
}

.home-section-head .home-heading--big {
  margin: 0;
}

.link-button {
  display: block;
  margin: 2px 0 0 auto;
  padding: 6px 2px;
  border: 0;
  background: none;
  font-family: var(--text-font);
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
}

.link-button:focus-visible {
  outline: 3px solid var(--brand);
}

/* Row of passport cards that scrolls sideways; "View all" shows them all in a grid */
.passport-list {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  padding: 2px 2px 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.passport-list.is-all {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  overflow-x: visible;
}

.passport-card,
.passport-empty {
  position: relative;
  flex: none;
  width: min(42vw, 210px);
  aspect-ratio: 0.87;
  border-radius: 26px;
  scroll-snap-align: start;
}

.passport-list.is-all .passport-card,
.passport-list.is-all .passport-empty {
  width: auto;
}

.passport-card {
  display: flex;               /* city and year at the top-left, like the Figma cards */
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  overflow: hidden;
  padding: 16px 18px;
  border: 0;
  background: var(--card-colour, #5C7BA1);
  color: #ffffff;
  text-align: left;
  cursor: pointer;
}

.passport-card:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.passport-city {
  display: block;
  font-family: var(--text-font);
  font-size: clamp(17px, 5vw, 22px);
  font-weight: 700;
  line-height: 1.15;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.passport-year {
  display: block;
  margin-top: 4px;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(17px, 5vw, 22px);
}

/* The stamp is drawn on a see-through layer covering the card */
.passport-stamp {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Empty box waiting for a saved map */
.passport-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border: 2px dashed #cfd8da;
  background: #f7f9f9;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.passport-note {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.passport-note:empty {
  display: none;
}

.home-cards {
  display: flex;
  gap: 12px;
}

.home-card {
  min-height: 170px;
}

/* Not live yet: the same light grey as Share (coming soon) */
.home-card.is-soon {
  cursor: default;
  background: #ECEEEF;
  color: #8A9497;
}

.home-card.is-soon .card-icon {
  filter: grayscale(1);
  opacity: 0.5;
}

.home-card.is-soon:hover {
  filter: none;
}

.home-card.is-soon:active {
  transform: none;
}

/* Globe on the trip pages: a button that goes home */
.globe-button {
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  line-height: 0;
}

.globe-button:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
  border-radius: 50%;
}

/* ---------- Print page buttons ---------- */

.step-buttons--top {
  margin-top: 0;
}

.step-button--cream { background: var(--cream); }
.step-button--peach { background: var(--peach); }
.step-button--blue { background: var(--blue); }
.step-button--yellow { background: var(--yellow); }

/* Features that aren't live yet: light grey */
.step-button--soon,
.step-button.step-button--soon:disabled {
  background: #ECEEEF;
  color: #8A9497;
  opacity: 1;
  cursor: default;
}

.step-button small {
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

#saved-actions[hidden],
#viewer-edit[hidden],
#viewer-edit-note[hidden] {
  display: none;
}

.viewer-edit {
  display: block;
  width: 100%;
  margin-top: 14px;
}
.step-button--danger { background: #f3c9c4; }

.step-button:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* ---------- Saved map viewer ---------- */

.viewer-backdrop {
  align-items: center;
  padding: 16px;
}

.viewer {
  width: 100%;
  max-width: 460px;
  max-height: 100%;
  overflow-y: auto;
  padding: 18px;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.viewer-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 58vh;
  margin: 0 auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.viewer-title {
  margin: 14px 0 0;
  text-align: center;
}

.viewer-saved {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.viewer-confirm[hidden],
#viewer-actions[hidden] {
  display: none;
}

.viewer-confirm p {
  margin: 14px 0 0;
  text-align: center;
}

.link-button[hidden] {
  display: none;
}

/* A link-style button inside a line of text (e.g. "View in passport") */
.inline-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* ---------- Editing directly on the print ---------- */

.print-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* Text and photos on the print can be tapped to edit them */
.poster-city,
.poster-country,
.poster-date,
.poster-frame {
  cursor: pointer;
}

.poster-frame {
  pointer-events: auto; /* the layer they sit on ignores taps; the frames don't */
}

@media (hover: hover) {
  .poster-city:hover,
  .poster-country:hover,
  .poster-date:hover {
    outline: 1px dashed currentColor;
    outline-offset: 0.6cqw;
  }

  .poster-frame:hover {
    outline: 0.4cqw solid var(--brand);
  }
}

/* Handwritten caption in the thick bottom border of a photo frame */
.poster-caption {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 0;
  overflow: hidden;
  font-family: "Architects Daughter", "Comic Sans MS", cursive;
  color: #2a2a2a;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Photo menu */
.photo-sheet-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.photo-sheet-img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border: 4px solid #ffffff;
  border-bottom-width: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.photo-sheet-time {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* ---------- Detail switch (print page) ---------- */

.detail-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 10px;
}

.detail-label {
  margin-right: 6px;
  font-size: 13px;
  font-weight: 700;
}

.detail-control button {
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid #d6dde0;
  border-radius: 999px;
  background: #ffffff;
  font-family: var(--text-font);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}

.detail-control button[aria-checked="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.detail-control button:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

/* The print map is drawn bigger for more detail, then shrunk from its top-left corner */
.poster-map {
  transform-origin: 0 0;
}

/* On the print page, keep a line free for messages so the print doesn't
   jump in size when one appears */
body[data-step="print"] .next-note,
body[data-step="print"] .next-note:empty {
  display: block;
  min-height: 2.8em;
}

/* Small × in the top-right corner of the saved-map pop-up */
.viewer {
  position: relative;
}

.viewer-x {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 28, 31, 0.08);
  color: var(--ink);
  font-size: 24px;
  line-height: 36px;
  text-align: center;
  cursor: pointer;
}

.viewer-x:hover {
  background: rgba(20, 28, 31, 0.15);
}

.viewer-x:focus-visible {
  outline: 3px solid var(--brand);
}

/* Map credits on the map page: small and see-through, so they don't
   distract. They show for a few seconds, then fold into the small (i). */
.trip-map .maplibregl-ctrl-attrib {
  background: rgba(255, 255, 255, 0.45);
  font-size: 9px;
  line-height: 1.3;
  opacity: 0.7;
}

.trip-map .maplibregl-ctrl-attrib a {
  color: inherit;
}

.trip-map .maplibregl-ctrl-attrib.maplibregl-compact {
  min-height: 18px;
  padding: 1px 20px 1px 6px;
}

.trip-map .maplibregl-ctrl-attrib-button {
  width: 18px;
  height: 18px;
  background-size: 14px;
  opacity: 0.6;
}

/* ---------- My Passport page: the wallet ---------- */

/* On this page, show only the wallet */
body[data-step="passport"] .trip-header,
body[data-step="passport"] .trip-map,
body[data-step="passport"] .photo-count,
body[data-step="passport"] .route-status,
body[data-step="passport"] .cards {
  display: none;
}

.wallet-step {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 16px;
}

.wallet-step[hidden] {
  display: none;
}

.wallet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.wallet-head .home-heading {
  flex: 1;
  font-size: clamp(26px, 7.5vw, 38px);
}

.wallet-back {
  flex: none;
  width: auto;
  min-height: 44px;
  padding: 0 16px;
  font-size: 14px;
}

.wallet-globe {
  flex: none;
  width: 44px;
  height: auto;
}

/* The stack of cards */
.wallet {
  display: flex;
  flex-direction: column;
}

.wallet-card {
  position: relative;
  display: block;
  width: 100%;
  height: 96px;              /* closed: only the top band shows */
  margin-top: -26px;         /* each card tucks under the one above */
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 28px;
  background: var(--card-colour, #5C7BA1);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
  color: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: height 0.25s ease;
}

.wallet-card:first-child {
  margin-top: 0;
}

/* The open card shows in full */
.wallet-card.is-open {
  height: clamp(250px, 62vw, 340px);
}

/* The card after the open one sits below it, instead of covering it */
.wallet-card.is-open + .wallet-card {
  margin-top: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .wallet-card { transition: none; }
}

.wallet-card:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* City and year along the top, in capitals like the Figma design
   (positioned, because buttons otherwise centre their contents) */
.wallet-band {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 20px 24px 0;
  font-family: "Libre Baskerville", Georgia, "Times New Roman", serif;
  font-size: clamp(18px, 5.4vw, 26px);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.wallet-city {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.wallet-year {
  flex: none;
}

/* Stamp bottom-left, tinted map circle bottom-right */
.wallet-stamp {
  position: absolute;
  left: 18px;
  bottom: 16px;
  width: 42%;
  height: 46%;
  pointer-events: none;
}

.wallet-circle {
  position: absolute;
  right: 18px;
  bottom: 16px;
  width: min(48%, 200px);
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
}

/* No saved maps yet */
.wallet-empty {
  padding: 30px 12px;
  border: 2px dashed #cfd8da;
  border-radius: 28px;
  text-align: center;
  color: var(--muted);
}

.wallet-empty[hidden] {
  display: none;
}

.wallet-start {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  padding: 0 24px;
  cursor: pointer;
}

/* ---------- Links at the bottom of the home page ---------- */

.home-links {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
  font-size: 13px;
  color: var(--muted);
}

.home-links a {
  color: var(--muted);
}

/* ---------- Information pages (How it works, Privacy) ---------- */

body.info-body {
  height: auto;
}

.info-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 20px 48px;
  font-size: 16px;
  line-height: 1.6;
}

.info-back {
  display: inline-block;
  margin-bottom: 14px;
  padding: 8px 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.info-back:hover {
  text-decoration: underline;
}

.info-page h1 {
  margin: 26px 0 6px;
  font-family: var(--title-font);
  font-size: clamp(32px, 8vw, 44px);
  font-weight: 600;
  line-height: 1.1;
}

.info-page h2 {
  margin: 28px 0 6px;
  font-family: var(--title-font);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.25;
}

.info-page p,
.info-page li {
  margin: 0 0 10px;
}

.info-page ul {
  padding-left: 20px;
}

.info-page a {
  color: var(--ink);
}

.info-lead {
  font-size: 18px;
  color: #3c4a4f;
}

/* Numbered steps */
.info-steps {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.info-steps li {
  position: relative;
  margin: 0 0 18px;
  padding: 16px 18px 6px 64px;
  border-radius: 20px;
  background: #F6F8F8;
  counter-increment: step;
}

.info-steps li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand);
  color: #ffffff;
  font-family: var(--title-font);
  font-weight: 600;
  line-height: 34px;
  text-align: center;
}

.info-steps li:nth-child(2)::before { background: #d62828; }
.info-steps li:nth-child(3)::before { background: #8F86C9; }
.info-steps li:nth-child(4)::before { background: #D99A5B; }
.info-steps li:nth-child(5)::before { background: #7FB28A; }

.info-steps h2 {
  margin: 4px 0 4px;
  font-size: 19px;
}

.info-credits {
  font-size: 14px;
  color: var(--muted);
}

.info-credits a {
  color: var(--muted);
}

.info-updated {
  margin-top: 30px;
  font-size: 13px;
  color: var(--muted);
}

/* Placeholder still to be filled in before launch */
.info-todo {
  padding: 0 4px;
  border-radius: 4px;
  background: #FFF1B8;
}
