/* ==========================================================================
   The Adventure Box — Ink & Oak
   --------------------------------------------------------------------------
   The visual language borrows from the printed artefact: oxblood ink and brass
   on paper that has aged a little, a serif for anything that is someone's own
   words, and a great deal of quiet space. No framework.

   Colour roles are the contract. Never hard-code a hex outside :root.
   ========================================================================== */

/* fonts.css is linked directly from base.html, ahead of this file. An @import
   here would chain a second round-trip behind this stylesheet and delay the
   first paint of any text. */

:root {
  /* --- ground ------------------------------------------------------------ */
  --paper:        #F7F1E4;   /* the page */
  --paper-raised: #FFFDF8;   /* cards, panels, inputs */
  --paper-sunk:   #EFE6D4;   /* wells, hovers, thumbnails */
  --paper-deep:   #E7DCC5;   /* pressed states */

  /* --- ink --------------------------------------------------------------- */
  --ink:          #1F1810;   /* headings, primary text */
  --ink-soft:     #4A3E2E;   /* body copy */
  --ink-faint:    #78674E;   /* metadata, captions - 4.85:1 on paper, AA */

  /* --- rules ------------------------------------------------------------- */
  --rule:         #E3D8C2;
  --rule-strong:  #CDBD9C;

  /* --- brand ------------------------------------------------------------- */
  --accent:       #8C2F20;   /* oxblood — primary action, links, the pin */
  --accent-deep:  #6F231770;
  --accent-ink:   #6F2317;   /* oxblood on hover / pressed */
  --accent-soft:  #F3E4DF;
  --on-accent:    #FFF9EF;
  --brass:        #B08432;   /* secondary — rules, spines, small marks */
  --brass-soft:   #F4EBD8;

  /* --- status ------------------------------------------------------------ */
  --ok:      #41603C;  --ok-soft:   #E7EDE3;
  --warn:    #8A5A10;  --warn-soft: #FAEFD9;
  --err:     #8C2F20;  --err-soft:  #F6E5E1;

  /* --- type -------------------------------------------------------------- */
  --serif: 'Fraunces', Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  /* --- form -------------------------------------------------------------- */
  --radius:   3px;
  --radius-lg: 5px;
  --wrap:     1080px;

  /* Shadows are warm — a neutral grey shadow on cream paper reads as dirt. */
  --shadow:      0 1px 2px rgba(60, 42, 20, .05), 0 8px 24px rgba(60, 42, 20, .055);
  --shadow-lift: 0 2px 5px rgba(60, 42, 20, .07), 0 18px 44px rgba(60, 42, 20, .105);
  --shadow-deep: 0 3px 8px rgba(60, 42, 20, .09), 0 30px 70px rgba(60, 42, 20, .14);

  /* A woven paper grain. Baked-in opacity, tiled on the body background, so it
     sits under content without needing an overlay element. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image: var(--grain);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* A column the height of the screen, so a short page still has its footer
     at the bottom rather than halfway up. main takes up the slack. */
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
}

/* --------------------------------------------------------------- typography */

h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.012em;
  margin: 0 0 .5em;
  font-optical-sizing: auto;
}
h1 { font-size: 2.3rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; letter-spacing: -.006em; }
p  { margin: 0 0 1em; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(140, 47, 32, .3);
  text-underline-offset: 3px;
  transition: text-decoration-color .15s;
}
a:hover { text-decoration-color: currentColor; }

hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
strong, b { color: var(--ink); font-weight: 600; }

::selection { background: var(--accent-soft); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap        { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 680px;       margin: 0 auto; padding: 0 24px; }

.eyebrow {
  font-size: .7rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; margin: 0 0 .8rem;
}
.eyebrow a { color: inherit; text-decoration-color: var(--rule-strong); }
.lede   { font-size: 1.13rem; color: var(--ink-soft); line-height: 1.55; }
.muted  { color: var(--ink-faint); }
.small  { font-size: .875rem; }
.tiny   { font-size: .775rem; }
.serif  { font-family: var(--serif); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 1rem; }

/* ------------------------------------------------------------------ masthead */

.masthead {
  background: rgba(247, 241, 228, .88);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 40;
}
/* A brass hairline under the masthead — the one flourish the chrome gets. */
.masthead::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(176, 132, 50, .45) 22%,
              rgba(176, 132, 50, .45) 78%, transparent);
}
.masthead-inner {
  display: flex; align-items: center; gap: 28px;
  max-width: var(--wrap); margin: 0 auto; padding: 15px 24px;
}

.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: 1.16rem; font-weight: 600;
  letter-spacing: -.01em; color: var(--ink); text-decoration: none;
}
.logo:hover { color: var(--accent-ink); }
.logo svg { display: block; flex: none; }
/* The chest stands about 1.3 times the name's size - it sits with the name, not over it. */
.logo .mark { width: 1.95em; height: auto; }
.logo .lid { color: var(--accent); }

.nav { display: flex; gap: 22px; margin-left: auto; align-items: center; }
/* The exclusions matter: a bare `.nav a` rule outranks both `.btn` and
   `.credit-chip` on specificity and would strip the horizontal padding off any
   pill sitting in the masthead. */
.nav a:not(.btn):not(.credit-chip) {
  color: var(--ink-soft); text-decoration: none; font-size: .91rem;
  padding: 4px 0; border-bottom: 1.5px solid transparent; transition: color .15s;
}
.nav a:not(.btn):not(.credit-chip):hover { color: var(--ink); }
.nav a.is-active { color: var(--ink); border-bottom-color: var(--accent); }

.credit-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  border: 1px solid var(--rule-strong); border-radius: 999px;
  padding: 4px 13px; font-size: .8rem; color: var(--ink-faint);
  background: var(--paper-raised); text-decoration: none; transition: border-color .15s;
}
.credit-chip:hover { border-color: var(--brass); }
.credit-chip b { font-family: var(--serif); font-size: .96rem; color: var(--ink); }
.credit-chip.is-empty { border-color: var(--accent); color: var(--accent); }

.nav-menu { position: relative; }
.nav-menu summary { list-style: none; cursor: pointer; font-size: .91rem; color: var(--ink-soft); }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu[open] summary { color: var(--ink); }
.nav-menu-panel {
  position: absolute; right: 0; top: calc(100% + 13px); min-width: 234px;
  background: var(--paper-raised); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lift); padding: 8px; z-index: 50;
}
.nav-menu-panel a, .nav-menu-panel button {
  display: block; width: 100%; text-align: left; padding: 9px 12px;
  color: var(--ink-soft); text-decoration: none; font-size: .9rem;
  background: none; border: 0; cursor: pointer; font-family: inherit; border-radius: 2px;
}
.nav-menu-panel a:hover, .nav-menu-panel button:hover { background: var(--paper-sunk); color: var(--ink); }
.nav-menu-panel hr { margin: 6px 0; }

/* -------------------------------------------------------------------- layout */

main { flex: 1 0 auto; padding: 46px 0 84px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 26px; flex-wrap: wrap; margin-bottom: 32px;
}
.page-head h1 { margin: 0; }
.page-head .lede { margin: .45rem 0 0; }

.grid   { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); }
.split  { display: grid; grid-template-columns: 1.62fr 1fr; gap: 42px; align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; gap: 30px; } }

.card {
  background: var(--paper-raised); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); padding: 22px;
}
.card-flush { padding: 0; overflow: hidden; }
.card-link {
  display: block; color: inherit; text-decoration: none;
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.card-link:hover {
  box-shadow: var(--shadow-lift); transform: translateY(-2px);
  border-color: var(--rule-strong);
}

.panel {
  background: var(--paper-raised); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); padding: 26px 30px; margin-bottom: 22px;
}
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }

.section-rule {
  display: flex; align-items: center; gap: 16px; margin: 0 0 22px;
  font-size: .72rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600;
}
.section-rule::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* ------------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: .92rem; font-weight: 500; line-height: 1;
  padding: 12px 21px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  text-decoration: none;
  transition: background .16s, color .16s, border-color .16s, box-shadow .16s, transform .08s;
}
.btn:hover { background: #150F09; border-color: #150F09; box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); box-shadow: none; }

.btn-secondary { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn-secondary:hover { background: var(--paper-sunk); border-color: var(--ink-faint); box-shadow: none; }

.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--accent-ink); border-color: var(--accent-ink); }

.btn-danger { background: transparent; color: var(--err); border-color: rgba(140, 47, 32, .34); }
.btn-danger:hover { background: var(--err-soft); border-color: var(--err); box-shadow: none; }

.btn-small { padding: 8px 14px; font-size: .84rem; }
.btn-block { display: flex; width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .42; pointer-events: none; }

.btn-link {
  background: none; border: 0; color: var(--accent); padding: 0;
  font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------------- forms */

label, .label {
  display: block; font-size: .8rem; font-weight: 600; letter-spacing: .01em;
  color: var(--ink-soft); margin-bottom: 6px;
}
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; font: inherit; font-size: .95rem; color: var(--ink);
  padding: 11px 13px; background: var(--paper-raised);
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: #A8997F; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(140, 47, 32, .12);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--paper-sunk); color: var(--ink-faint); cursor: not-allowed;
}
/* Writing surfaces get the serif — this is where people's own words go. */
textarea {
  min-height: 150px; resize: vertical; line-height: 1.6;
  font-family: var(--serif); font-size: 1.02rem;
}
select {
  appearance: none; padding-right: 38px; background-repeat: no-repeat;
  background-position: calc(100% - 15px) 55%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7' viewBox='0 0 11 7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' fill='none' stroke='%2378674E' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.field { margin-bottom: 20px; }
.field-hint { font-size: .8rem; color: var(--ink-faint); margin: 6px 0 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 620px) { .field-row { grid-template-columns: 1fr; } }

.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { margin-top: 4px; width: auto; flex: none; accent-color: var(--accent); }
.check label { margin: 0; font-weight: 400; color: var(--ink); font-size: .92rem; }

.file-drop {
  position: relative;
  border: 1.5px dashed var(--rule-strong); border-radius: var(--radius-lg);
  padding: 30px; text-align: center; background: var(--paper-sunk);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.file-drop:hover, .file-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
/* Hidden but still in the page: display:none would make a required photo
   field block the form with no message. This way the browser's own
   "please choose a file" appears on the drop zone. */
.file-drop input {
  position: absolute; left: 50%; bottom: 8px; width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
}

/* ------------------------------------------------------------------- notices */

.flashes { max-width: var(--wrap); margin: 22px auto -6px; padding: 0 24px; }
.flash {
  border: 1px solid var(--rule); border-left-width: 3px; border-radius: var(--radius);
  padding: 13px 17px; margin-bottom: 10px; font-size: .92rem; background: var(--paper-raised);
}
.flash-success { border-left-color: var(--ok);  background: var(--ok-soft);  color: #2C4428; }
.flash-error   { border-left-color: var(--err); background: var(--err-soft); color: #6F2317; }
.flash-info    { border-left-color: var(--brass); background: var(--brass-soft); color: var(--ink-soft); }

.notice {
  border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 16px 19px; background: var(--paper-sunk); font-size: .92rem;
}
.notice-warn { background: var(--warn-soft); border-color: #E8D5AB; color: var(--warn); }
.notice a:not(.btn) { color: inherit; }

.badge {
  display: inline-block; font-size: .68rem; letter-spacing: .11em; text-transform: uppercase;
  font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--paper-sunk); color: var(--ink-faint); border: 1px solid var(--rule);
}
.badge-ok     { background: var(--ok-soft);     color: var(--ok);     border-color: #C6D8C1; }
.badge-warn   { background: var(--warn-soft);   color: var(--warn);   border-color: #E8D5AB; }
.badge-err    { background: var(--err-soft);    color: var(--err);    border-color: #E5C6BE; }
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: #E5C6BE; }

/* ---------------------------------------------------------------- story cards */

.story-card .thumb {
  aspect-ratio: 4 / 3; background: var(--paper-sunk); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--rule);
}
.story-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-card .thumb .placeholder {
  font-size: .72rem; letter-spacing: .15em; text-transform: uppercase; color: var(--ink-faint);
}
.story-card .body { padding: 17px 19px 19px; }
.story-card h3 { font-size: 1.08rem; margin: 0 0 5px; }
.story-card .meta {
  font-size: .775rem; color: var(--ink-faint); display: flex; gap: 8px;
  flex-wrap: wrap; align-items: center;
}
.story-card .excerpt {
  font-family: var(--serif); font-size: .94rem; line-height: 1.5; color: var(--ink-soft);
  margin: 10px 0 0; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}

.season-card { display: flex; flex-direction: column; height: 100%; }
/* Oxblood into brass — the spine of a bound book. */
.season-card .spine { height: 4px; background: linear-gradient(90deg, var(--accent), var(--brass)); }
.season-card .body { padding: 21px 23px; flex: 1; display: flex; flex-direction: column; }
.season-card .count { margin-top: auto; padding-top: 15px; font-size: .8rem; color: var(--ink-faint); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo-tile {
  position: relative; aspect-ratio: 1; overflow: hidden;
  border: 1px solid var(--rule); border-radius: var(--radius);
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile .photo-open {
  display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none;
  cursor: zoom-in;
}
.photo-tile .photo-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* A story's photo, full size. */
.lightbox {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: #0C0E0D; color: #F4EFE6;
}
.lightbox::backdrop { background: rgba(12, 14, 13, .94); }
.lightbox[open] { display: flex; flex-direction: column; }
.lightbox-stage {
  position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: calc(16px + env(safe-area-inset-top)) 12px 8px;
}
.lightbox-img {
  max-width: 100%; max-height: 100%; object-fit: contain; display: block;
  border-radius: 2px; transition: opacity .2s;
}
.lightbox.is-loading .lightbox-img { opacity: .35; }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 64px; border: 0; border-radius: 8px; cursor: pointer;
  background: rgba(0, 0, 0, .35); color: #fff; font-size: 2.2rem; line-height: 1;
}
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }
.lightbox-nav:hover { background: rgba(0, 0, 0, .55); }
.lightbox-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
}
.lightbox-text { min-width: 0; font-size: .86rem; color: rgba(244, 239, 230, .8); }
.lightbox-count { margin-right: 10px; color: rgba(244, 239, 230, .55); }
.lightbox-actions { display: flex; gap: 8px; margin-left: auto; }
.lightbox-action, .lightbox-close {
  min-height: 44px; padding: 0 14px; border-radius: 8px; cursor: pointer; font: inherit;
  font-size: .86rem; color: #F4EFE6; background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .2);
}
.lightbox-action[hidden] { display: none; }
.lightbox-close { width: 44px; padding: 0; font-size: 1.5rem; line-height: 1; }
.lightbox-action:hover, .lightbox-close:hover { background: rgba(255, 255, 255, .2); }
/* On a phone, swiping is the way through; the arrows only cover the photo. */
@media (pointer: coarse) { .lightbox-nav { display: none; } }
.photo-tile .tools {
  position: absolute; inset: auto 0 0 0; display: flex; gap: 4px; padding: 7px;
  background: linear-gradient(transparent, rgba(31, 24, 16, .72)); opacity: 0; transition: opacity .15s;
}
.photo-tile:hover .tools, .photo-tile:focus-within .tools { opacity: 1; }
.photo-tile .tools button {
  font: inherit; font-size: .7rem; padding: 5px 9px; border-radius: 2px; cursor: pointer;
  background: rgba(255, 253, 248, .94); border: 0; color: var(--ink);
}
.photo-tile .cover-flag {
  position: absolute; top: 7px; left: 7px; font-size: .6rem; letter-spacing: .11em;
  text-transform: uppercase; background: var(--accent); color: var(--on-accent);
  padding: 3px 8px; border-radius: 2px; font-weight: 600;
}

/* --------------------------------------------------------------- data tables */

table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th {
  text-align: left; font-size: .7rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; padding: 0 14px 11px; border-bottom: 1px solid var(--rule);
}
table.data td { padding: 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; }

.empty {
  text-align: center; padding: 70px 24px; border: 1px dashed var(--rule-strong);
  border-radius: var(--radius-lg); background: var(--paper-raised);
}
.empty h3 { margin-bottom: .35em; }
.empty p { color: var(--ink-faint); max-width: 44ch; margin: 0 auto 1.5em; }

/* ------------------------------------------------------------------- landing */

.hero { padding-block: 86px 70px; }
.hero h1 { font-size: clamp(2.5rem, 5.6vw, 3.75rem); max-width: 15ch; margin-bottom: .32em; }
.hero .lede { max-width: 52ch; font-size: 1.22rem; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 32px; }

/* A drawn postcard, so the idea lands before the words do. */
.postcard-demo {
  background: #FFFDF8; border: 1px solid var(--rule-strong); border-radius: 2px;
  box-shadow: var(--shadow-deep); padding: 22px; aspect-ratio: 148 / 105;
  display: flex; flex-direction: column; position: relative;
}
.postcard-demo .pc-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--rule); padding-bottom: 9px;
  font-size: .6rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft);
}
.postcard-demo .pc-boxes { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8%; }
.pc-box {
  width: 20%; aspect-ratio: 1; border: 1px solid var(--ink); background: #fff;
  outline: 1px dashed var(--rule-strong); outline-offset: 5px;
  overflow: hidden; display: flex; flex-direction: column;
}
.pc-box img { width: 100%; height: 100%; object-fit: cover; }
.pc-box-text { padding: 7% 8%; font-family: var(--serif); font-size: .5rem; line-height: 1.32; text-align: left; color: var(--ink); }
.pc-box-text b { display: block; font-size: .58rem; margin-bottom: 3px; }
.pc-box-photo { background: linear-gradient(#9DB2C4, #C3CCD4 52%, #4A5340 52%, #3A4234); }
.pc-box-map {
  background: repeating-linear-gradient(0deg, #EFE9DC 0 1px, transparent 1px 14px),
              repeating-linear-gradient(90deg, #EFE9DC 0 1px, transparent 1px 14px), #FBF7EE;
  position: relative;
}
.pc-box-map::after {
  content: ""; position: absolute; left: 50%; top: 46%; width: 22%; aspect-ratio: 1;
  background: var(--accent); border-radius: 50% 50% 50% 0;
  transform: translate(-50%, -50%) rotate(-45deg);
}
.postcard-demo .pc-foot {
  text-align: center; font-size: .55rem; letter-spacing: .15em;
  text-transform: uppercase; color: var(--ink-faint);
}

.steps { counter-reset: step; display: grid; gap: 30px; }
.step { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: start; }
.step::before {
  counter-increment: step; content: counter(step);
  font-family: var(--serif); font-size: 1.05rem; width: 42px; height: 42px;
  border: 1px solid var(--brass); color: var(--brass); background: var(--paper-raised);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.step h3 { margin-bottom: .25em; }
.step p { margin: 0; color: var(--ink-soft); }

.price-card {
  border: 1px solid var(--ink); border-radius: var(--radius-lg); padding: 36px;
  background: var(--paper-raised); text-align: center; max-width: 420px; margin: 0 auto;
  box-shadow: var(--shadow);
}
.price-figure { font-family: var(--serif); font-size: 3.3rem; line-height: 1; color: var(--ink); }
.price-figure span { font-size: 1rem; color: var(--ink-faint); }
.price-list { list-style: none; padding: 0; margin: 26px 0; text-align: left; }
.price-list li { padding: 10px 0 10px 28px; position: relative; border-bottom: 1px solid var(--rule); font-size: .93rem; }
.price-list li:last-child { border-bottom: 0; }
.price-list li::before {
  content: ""; position: absolute; left: 5px; top: 18px; width: 10px; height: 5px;
  border-left: 1.6px solid var(--accent); border-bottom: 1.6px solid var(--accent);
  transform: rotate(-45deg);
}

/* ----------------------------------------------------------------------- map */

#map, .map-embed { height: 560px; border: 1px solid var(--rule); border-radius: var(--radius-lg); }
#pin-map { height: 300px; border: 1px solid var(--rule-strong); border-radius: var(--radius); }
/* Leaflet stacks its panes and controls at z-index 400-1000, which put the map
   above the sticky masthead (40) as the page scrolled. `isolation` keeps all
   of that inside the map's own stacking context. */
.leaflet-container { font-family: var(--sans); background: var(--paper-sunk); isolation: isolate; z-index: 0; }

/* Working on it: a spinner inside a button that has been pressed. */
.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.is-busy::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 1.1em; height: 1.1em;
  margin: -.55em 0 0 -.55em; border-radius: 50%;
  border: 2px solid currentColor; border-color: rgba(255, 255, 255, .45) rgba(255, 255, 255, .45) #fff #fff;
  animation: spin .7s linear infinite;
}
.btn-secondary.is-busy::after, .btn-link.is-busy::after {
  border-color: var(--rule-strong) var(--rule-strong) var(--ink) var(--ink);
}

/* The next page is on its way. */
.page-progress {
  position: fixed; top: 0; left: 0; z-index: 100; height: 3px; width: 0;
  background: var(--accent); opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.page-progress.is-on { opacity: 1; animation: page-progress 8s cubic-bezier(.1, .7, .3, 1) forwards; }
@keyframes page-progress { from { width: 0; } to { width: 92%; } }

/* Saving a story with photos: what's happening, and how far along. */
.upload-veil {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(245, 239, 230, .86); backdrop-filter: blur(3px);
}
.upload-veil[hidden] { display: none; }
.upload-card {
  width: min(340px, 100%); padding: 26px 24px; text-align: center;
  background: var(--paper-raised); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
}
.upload-card .spinner { display: inline-block; }
.upload-title { margin: 14px 0 12px; font-weight: 600; color: var(--ink); }
.upload-bar { height: 6px; border-radius: 3px; background: var(--paper-sunk); overflow: hidden; }
.upload-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.upload-note { margin: 10px 0 0; min-height: 1.2em; font-size: .84rem; color: var(--ink-faint); }
@media (prefers-reduced-motion: reduce) {
  .is-busy::after { animation-duration: 2s; }
  .page-progress.is-on { animation: none; width: 92%; }
}

/* "Please confirm your email" - above the page until they do. */
.confirm-banner { background: var(--accent-soft); border-bottom: 1px solid var(--rule); font-size: .88rem; }
.confirm-banner-inner { display: flex; gap: 12px; align-items: center; justify-content: space-between;
  flex-wrap: wrap; padding-top: 9px; padding-bottom: 9px; }
.confirm-banner form { margin: 0; }

/* The Terms, Privacy and Cookies pages: plain, readable text. */
.legal h2 { font-size: 1.3rem; margin: 2rem 0 .6rem; }
.legal p, .legal li { max-width: 68ch; }
.legal ul { padding-left: 1.2rem; }
.legal li { margin-bottom: .45rem; }
.legal table.data { margin: 1rem 0 1.4rem; }
.legal code { font-size: .85em; overflow-wrap: anywhere; }

/* Read out by screen readers, not shown. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* The story form's latitude and longitude, folded away under the map. */
details.coords { margin: 4px 0 10px; }
details.coords > summary { cursor: pointer; padding: 6px 0; }
details.coords[open] > summary { margin-bottom: 8px; }

/* The type-ahead above the pin map. */
.place-search { position: relative; }
.place-results {
  position: absolute; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px;
  list-style: none; z-index: 30; max-height: 300px; overflow-y: auto;
  background: var(--paper-raised); border: 1px solid var(--rule-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lift);
}
.place-results li { padding: 8px 10px; border-radius: 2px; cursor: pointer; line-height: 1.35; }
.place-results li strong { display: block; font-weight: 600; color: var(--ink); }
.place-results li span { display: block; font-size: .82rem; color: var(--ink-faint); }
.place-results li[aria-selected="true"] { background: var(--paper-sunk); }
.place-results li.place-empty { cursor: default; color: var(--ink-faint); font-size: .88rem; }
.place-results[aria-busy="true"] { opacity: .7; }

/* --------------------------------------------------- postcard preview / meter */

.preview-frame {
  width: 100%; aspect-ratio: 6.25 / 4.25; border: 1px solid var(--rule-strong);
  border-radius: 2px; box-shadow: var(--shadow-deep); background: #fff; overflow: hidden;
}
.preview-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* A postcard that turns over. Both faces sit in one grid cell; the card rotates
   about its vertical axis, as a real card does when you flip it in your hand -
   which is why the keepsake is on the right of the front and the left of the back. */
.postcard-flip { perspective: 1800px; }
.postcard-flip-card {
  display: grid; position: relative; cursor: pointer;
  transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3, .7, .2, 1);
}
.postcard-flip-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.postcard-flip[data-side="back"] .postcard-flip-card { transform: rotateY(180deg); }
.postcard-face {
  grid-area: 1 / 1; position: relative;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.postcard-back { transform: rotateY(180deg); }
/* Where PostGrid prints the address and stamp - bare on our artwork. */
.postcard-address-zone {
  position: absolute; top: 8%; bottom: 8%; left: 54%; right: 5%;
  border: 1px dashed var(--rule-strong); border-radius: 2px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: .78rem; line-height: 1.5; color: var(--ink-faint); pointer-events: none;
}
.is-loading > .postcard-address-zone { display: none; }
.postcard-flip-controls {
  display: flex; justify-content: center; gap: 0; margin-top: 16px;
}
.flip-tab {
  font: inherit; font-size: .84rem; padding: 6px 18px; cursor: pointer;
  background: var(--paper-raised); color: var(--ink-soft);
  border: 1px solid var(--rule-strong);
}
.flip-tab:first-child { border-radius: 999px 0 0 999px; }
.flip-tab:last-child { border-radius: 0 999px 999px 0; border-left: 0; }
.flip-tab.is-active { background: var(--ink); color: var(--paper-raised); border-color: var(--ink); }
@media (prefers-reduced-motion: reduce) {
  .postcard-flip-card { transition: none; }
}

.credit-meter { display: flex; gap: 5px; margin: 10px 0 0; flex-wrap: wrap; }
.credit-meter span { width: 26px; height: 8px; border-radius: 2px; background: var(--rule-strong); }
.credit-meter span.on { background: var(--accent); }

/* -------------------------------------------------------------------- footer */

.footer {
  flex-shrink: 0;
  border-top: 1px solid var(--rule); padding: 38px 0; margin-top: 44px;
  font-size: .86rem; color: var(--ink-faint); background: var(--paper-sunk);
}
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer a { color: var(--ink-soft); text-decoration: none; }
.footer a:hover { color: var(--ink); text-decoration: underline; }

/* ------------------------------------------------------------------- details */

details.reveal { border-top: 1px solid var(--rule); padding: 15px 0; }
details.reveal summary { cursor: pointer; font-weight: 600; font-size: .92rem; color: var(--ink); }
details.reveal[open] summary { margin-bottom: 10px; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 21px 27px; border-left: 1px solid var(--rule); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -4.5px; top: 7px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--rule-strong);
}
.timeline li.is-done::before { background: var(--accent); }
.timeline .when { font-size: .78rem; color: var(--ink-faint); }

/* The quiet "add to home screen" nudge on the dashboard. */
.install-hint {
  display: flex; align-items: center; gap: 10px; margin: -10px 0 24px;
  padding: 6px 4px 6px 8px; border-radius: var(--radius-lg); background: var(--paper-sunk);
}
.install-hint[hidden] { display: none; }
.install-hint img { flex: none; border-radius: 7px; }
.install-hint-text { flex: 1; min-width: 0; margin: 0; font-size: .8rem; line-height: 1.4; color: var(--ink-faint); }
.install-hint-text strong { display: block; color: var(--ink-soft); font-weight: 500; }
.install-hint-add {
  flex: none; min-height: 36px; padding: 0 12px; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: .84rem; font-weight: 600; color: var(--accent);
}
.install-hint-text svg { width: 15px; height: 15px; vertical-align: -2px; }
.install-hint-close {
  flex: none; width: 36px; height: 36px; border: 0; background: none; cursor: pointer;
  font-size: 1.2rem; line-height: 1; color: var(--ink-faint); border-radius: 50%;
}
.install-hint-close:hover { background: var(--paper-sunk); color: var(--ink); }

/* A postcard on its way: thumbnail, a line of words, four steps. */
.post-list { display: grid; gap: 14px; }
.post-item {
  display: grid; grid-template-columns: 108px 1fr; grid-template-areas: "thumb head" "thumb track";
  column-gap: 18px; padding: 18px; text-decoration: none; color: inherit;
}
.post-thumb {
  grid-area: thumb; width: 100%; aspect-ratio: 4 / 3; border-radius: 2px; overflow: hidden;
  background: var(--paper-sunk); border: 1px solid var(--rule);
}
.post-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-head { grid-area: head; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.post-track { grid-area: track; min-width: 0; }
.post-title { font-family: var(--serif); font-size: 1.06rem; color: var(--ink); }

.tracker {
  list-style: none; padding: 0; margin: 12px 0 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
}
.tracker li {
  position: relative; display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 3px; font-size: .74rem; color: var(--ink-faint);
}
/* The line to the previous step, drawn from each step back to the last. */
.tracker li + li::before {
  content: ""; position: absolute; top: 6px; right: 50%; width: 100%; height: 2px;
  background: var(--rule-strong);
}
.tracker li.is-done + li::before { background: var(--accent); }
.tracker-dot {
  position: relative; z-index: 1; width: 14px; height: 14px; border-radius: 50%;
  background: var(--paper-raised); border: 2px solid var(--rule-strong);
}
.tracker li.is-done .tracker-dot { background: var(--accent); border-color: var(--accent); }
.tracker li.is-current .tracker-dot {
  border-color: var(--accent); box-shadow: 0 0 0 4px rgba(140, 47, 32, .15);
  animation: tracker-pulse 2s ease-in-out infinite;
}
.tracker li.is-current .tracker-label { color: var(--ink); font-weight: 600; }
.tracker-when { font-size: .7rem; }
@keyframes tracker-pulse { 50% { box-shadow: 0 0 0 7px rgba(140, 47, 32, .05); } }
@media (prefers-reduced-motion: reduce) { .tracker li.is-current .tracker-dot { animation: none; } }
@media (max-width: 520px) {
  /* Thumbnail beside the words, the four steps full width beneath. */
  .post-item { grid-template-columns: 72px 1fr; grid-template-areas: "thumb head" "track track"; column-gap: 14px; padding: 16px; }
}

/* ---------------------------------------------------------------- responsive */

/* Grid and flex children default to min-width:auto, so a wide table inside
   one widened the whole page instead of scrolling in its own box. */
.split > *, .grid > * { min-width: 0; }

.show-sm { display: none; }

/* The tab bar is for phones; wider screens use the masthead. */
.tabbar { display: none; }

@media (max-width: 700px) {
  .wrap, .wrap-narrow { padding: 0 18px; }
  .masthead-inner { padding: 10px 18px; gap: 12px; }
  .logo { font-size: 1.02rem; white-space: nowrap; min-width: 0; }
  /* Signed out the masthead also carries Sign in and a button: give way. */
  body:not(.has-tabbar) .logo { font-size: .94rem; gap: 7px; }
  body.has-tabbar .logo { font-size: .96rem; gap: 7px; }
  .nav { gap: 12px; flex: none; }
  .nav a { white-space: nowrap; }
  .nav .btn-small { padding: 8px 12px; }
  .nav a.hide-sm, .nav a.nav-link { display: none; }
  .nav-menu-panel a.show-sm { display: block; }
  /* Columns a phone can live without; the story page has them all. */
  table.data .col-wide { display: none; }
  .nav-menu summary {
    padding: 10px 2px; max-width: 5.5em;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .credit-chip { padding: 6px 11px; }

  main { padding: 26px 0 48px; }
  h1 { font-size: 1.85rem; }
  .hero { padding-block: 48px 44px; }
  /* Legal tables: one row per block on a phone - three narrow columns put a
     word on each line and pushed the page sideways. */
  .legal table.data, .legal table.data tbody, .legal table.data tr,
  .legal table.data td { display: block; width: auto; }
  .legal table.data tr:first-child { display: none; }
  .legal table.data tr { padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .legal table.data td { padding: 2px 0; border: 0; }
  .legal table.data td.nowrap { white-space: normal; font-weight: 600; }
  .panel { padding: 20px 18px; }
  .page-head { margin-bottom: 24px; gap: 16px; }
  .page-head .btn-row { width: 100%; }

  /* Fingers, not pointers: nothing tappable under about 44px. */
  .btn, .btn-small { min-height: 44px; }
  .check input { width: 22px; height: 22px; margin-top: 0; }
  .footer a { display: inline-block; padding: 8px 0; }
  .leaflet-container.leaflet-touch .leaflet-bar a { width: 40px; height: 40px; line-height: 40px; }
  .nav-menu-panel a, .nav-menu-panel button { padding: 12px 12px; }
  details.reveal > summary { padding: 10px 0; }
  .btn-link { padding: 10px 2px; }

  /* Under 16px, iOS zooms the page in when a field is tapped, and leaves it there. */
  input[type=text], input[type=email], input[type=password], input[type=date],
  input[type=number], input[type=search], input[type=url], select, textarea { font-size: 16px; }

  body.has-tabbar { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  body.has-tabbar .footer { margin-top: 24px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: rgba(251, 247, 240, .96); backdrop-filter: saturate(150%) blur(10px);
    border-top: 1px solid var(--rule);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    min-height: 50px; justify-content: flex-end;
    font-size: .7rem; letter-spacing: .02em; color: var(--ink-faint); text-decoration: none;
  }
  .tabbar svg {
    width: 23px; height: 23px; fill: none; stroke: currentColor;
    stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round;
  }
  .tabbar a.is-active { color: var(--accent); }
  .tabbar-write span {
    display: flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; margin-top: -18px; border-radius: 50%;
    background: var(--accent); color: #fff; box-shadow: var(--shadow-lift);
  }
  .tabbar-write span svg { stroke-width: 2.2; }
  .tabbar a.tabbar-write { color: var(--ink-soft); }
  .tabbar a.tabbar-write.is-active { color: var(--accent); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .card-link:hover { transform: none; }
}

/* Leaflet's divIcon carries a white box and border by default; the pin supplies
   its own shape. See web/static/js/pin.js. */
.leaflet-div-icon.sb-pin, .sb-pin { background: none; border: 0; }
.leaflet-popup-content-wrapper {
  border-radius: var(--radius); font-family: var(--sans);
  background: var(--paper-raised); color: var(--ink-soft);
  box-shadow: var(--shadow-lift);
}
.leaflet-popup-content { margin: 12px 15px; line-height: 1.5; }
.leaflet-popup-content strong { font-family: var(--serif); font-size: 1rem; }
.leaflet-popup-tip { background: var(--paper-raised); }
.leaflet-container a.leaflet-popup-close-button { color: var(--ink-faint); }

/* Range controls inherit the browser's blue otherwise, which is the one place
   a stray system colour shows through the palette. */
input[type=range] { accent-color: var(--accent); width: 100%; }

/* ---- landing: the single cut-out card, drawn rather than photographed ---- */
.pc-single { flex: 1; display: flex; gap: 6%; align-items: stretch; padding: 4% 0 2%; }
.pc-note {
  flex: 1; font-size: .52rem; line-height: 1.5; color: var(--ink-soft);
  display: flex; align-items: center;
}
.pc-cut { width: 46%; padding: 3%; border: 1px dashed var(--rule-strong); }
.pc-face {
  height: 100%; border: 1px solid var(--ink); background: #fff;
  display: flex; flex-direction: column; overflow: hidden;
}
.pc-photo {
  flex: 1;
  background: linear-gradient(#9DB2C4, #C3CCD4 54%, #4A5340 54%, #3A4234);
}
.pc-caption {
  padding: 5% 6%; font-family: var(--serif); font-size: .46rem;
  line-height: 1.3; color: var(--ink); background: #fff;
}
.pc-caption b { display: block; font-size: .56rem; margin-bottom: 2px; }

/* Only the adventure theme renders a bitmap mark; see theme-adventure.css. */

/* ---- waiting for something slow to render -------------------------------- */
/* The postcard preview rasterises two 300dpi faces and fetches map tiles, so it
   takes a couple of seconds. Show that it is working rather than an empty box. */
.is-loading { position: relative; }
.is-loading > img { opacity: 0; }
.loading-veil {
  position: absolute; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: var(--paper-sunk); color: var(--ink-faint);
  font-size: .82rem; letter-spacing: .1em; text-transform: uppercase;
}
.is-loading > .loading-veil { display: flex; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--rule-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; border-top-color: var(--rule-strong); }
}

/* Small phones: iPhone SE and mini are 375px wide. */
@media (max-width: 380px) {
  .logo, body.has-tabbar .logo, body:not(.has-tabbar) .logo { font-size: .86rem; gap: 6px; }
  .masthead-inner { padding: 10px 14px; gap: 8px; }
  .credit-chip { padding: 5px 9px; font-size: .72rem; }
  .nav { gap: 8px; }
}
/* Narrower still, signed in: the mark alone, so the credits and menu fit. */
@media (max-width: 350px) {
  body.has-tabbar .logo-text { display: none; }
}

/* The invitation link on the membership page. */
.invite-link { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.invite-link input { flex: 1 1 220px; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: .88rem; }

/* The cancel page: reasons and the break offer. */
.choice-list { border: 0; margin: 0 0 6px; padding: 0; display: grid; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent, #93563C); }
.break-options { display: flex; flex-wrap: wrap; gap: 10px; }
.break-options .btn { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.break-dates { font-size: .8rem; font-weight: 400; opacity: .85; }

/* Monthly or yearly, on the membership page. */
.plan-choice { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.plan-choice .btn { display: inline-flex; flex-direction: column; justify-content: center; gap: 2px; }
.plan-note { font-size: .8rem; font-weight: 400; opacity: .85; }

/* Sending a postcard to someone: pick adventures, then who and what. */
.adventure-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.adventure-pick { position: relative; display: grid; gap: 6px; padding: 8px; border: 1px solid var(--rule, #e2d8c9);
                  border-radius: 8px; background: var(--paper-raised, #fff); cursor: pointer; }
.adventure-pick input { position: absolute; top: 14px; left: 14px; width: 20px; height: 20px; margin: 0; z-index: 1;
                        accent-color: var(--accent, #93563C); }
.adventure-pick-photo { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 5px; background: #eee; }
.adventure-pick-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.adventure-pick-text { display: grid; gap: 2px; font-size: .9rem; line-height: 1.3; }
.adventure-pick:has(input:checked) { border-color: var(--accent, #93563C); box-shadow: 0 0 0 2px var(--accent, #93563C) inset; }
.adventure-pick:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.greeting-preview { max-width: 620px; margin: 0 auto 10px; }
.greeting-send { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 18px; }
.contact-entry summary { cursor: pointer; }
.contact-entry form { margin-top: 12px; }
.new-contact { margin-top: 10px; }
.choice-list .choice { font-weight: 400; font-size: .95rem; }

/* A photo still being processed by the worker, or one that couldn't be read. */
.photo-waiting { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
                 aspect-ratio: 1; background: var(--paper-raised, #fff); border: 1px dashed var(--rule-strong, #ccc);
                 border-radius: 6px; text-align: center; padding: 10px; }

/* The admin's messages: a small card in the corner, above the phone tab bar. */
.notice-pop { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 60;
              width: min(380px, calc(100vw - 32px)); }
.notice-pop-card { background: var(--paper-raised, #fff); border: 1px solid var(--rule, #e2d8c9);
                   border-left: 4px solid var(--accent, #93563C); border-radius: 8px; padding: 14px 16px;
                   box-shadow: 0 14px 40px rgba(20, 16, 10, .18); display: grid; gap: 8px; }
.notice-pop-warning { border-left-color: #b4761f; }
.notice-pop-good { border-left-color: #4F624C; }
.notice-pop-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.notice-pop-body { margin: 0; font-size: .92rem; line-height: 1.5; white-space: pre-line; }
.notice-pop-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 700px) { .notice-pop { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); } }

/* Supply notices on the sign-up, pricing and membership pages. */
.supply-notice { margin: 0 0 20px; }

/* ------------------------------------------------------------ photo import */
/* A tile per photo: on the import page while it uploads, on the sorting page
   once it's in. Flags under the photo say what it didn't tell us. */
.import-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.import-tiles.is-strip { display: flex; overflow-x: auto; padding-bottom: 6px; }
.import-tiles.is-strip .import-tile { flex: 0 0 120px; }
.import-tile { position: relative; display: grid; gap: 5px; align-content: start; min-width: 0; }
.import-tile .frame {
  position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden;
  background: var(--paper-sunk); border: 1px solid var(--rule);
}
.import-tile .frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.import-tile .frame .name {
  position: absolute; inset: auto 6px 6px; font-size: .68rem; color: var(--ink-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.import-tile .state {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  font-size: .72rem; color: var(--ink-soft); padding: 8px;
}
.import-tile .state .spinner { width: 26px; height: 26px; }
.import-tile.is-waiting .frame { opacity: .55; }
.import-tile.is-working .state, .import-tile.is-processing .state { background: rgba(247, 241, 228, .72); }
.import-tile.is-done .state, .import-tile.is-ready .state { display: none; }
.import-tile .tick {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--ok); color: #fff; display: none; place-items: center; font-size: .8rem; font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.import-tile.is-done .tick { display: grid; }
.import-tile.is-failed .frame { border-color: var(--err); }
.import-tile.is-failed .state { background: var(--err-soft); color: var(--err); font-weight: 600; }
.import-tile .drop-photo {
  position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border-radius: 50%; border: 0;
  background: rgba(31, 24, 16, .62); color: #fff; font-size: .95rem; line-height: 1; cursor: pointer;
}
.import-tile .drop-photo:hover { background: var(--accent); }
.import-tile.is-picked .frame { outline: 3px solid var(--accent); outline-offset: -3px; }
.import-tile.is-picked::after {
  content: "✓"; position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: .8rem;
}

.flags { display: flex; flex-wrap: wrap; gap: 4px; }
/* On a photo: tucked into its corner, so they stay with it and never spill. */
.import-tile .frame .flags {
  position: absolute; left: 5px; bottom: 5px; right: 5px; flex-direction: column; align-items: flex-start; gap: 3px;
}
.import-tile .frame .flag { background: rgba(250, 239, 217, .94); box-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
.import-tile .frame .flag.is-quiet { background: rgba(239, 230, 212, .94); }
.import-tile .frame .flag.is-bad { background: rgba(246, 229, 225, .95); }
.flag {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 7px; border-radius: 10px;
  font-size: .68rem; font-weight: 600; line-height: 1.6; white-space: nowrap;
  background: var(--warn-soft); color: var(--warn); border: 1px solid #E8D5AB;
}
.flag.is-quiet { background: var(--paper-sunk); color: var(--ink-faint); border-color: var(--rule); }
.flag.is-bad { background: var(--err-soft); color: var(--err); border-color: #E5C6BE; }
.flag .why, .why {
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid currentColor; background: none;
  color: inherit; font: italic 700 .62rem/1 var(--serif); display: inline-grid; place-items: center;
  cursor: pointer; padding: 0;
}
.tip {
  max-width: min(360px, calc(100vw - 32px)); border: 1px solid var(--rule-strong); border-radius: var(--radius-lg);
  background: var(--paper-raised); color: var(--ink-soft); padding: 16px 18px; box-shadow: var(--shadow-deep);
  font-size: .9rem; line-height: 1.5;
}
.tip h4 { margin: 0 0 6px; font-size: 1rem; color: var(--ink); }
.tip p { margin: 0 0 8px; }
.tip button { margin-top: 4px; }
.tip::backdrop { background: rgba(20, 16, 10, .2); }

.import-status { display: flex; align-items: center; gap: 12px; }
.import-status .spinner { width: 22px; height: 22px; flex: none; }
.import-status.is-done .spinner { display: none; }
.import-status .done-mark {
  display: none; width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #fff;
  place-items: center; font-size: .8rem; font-weight: 700; flex: none;
}
.import-status.is-done .done-mark { display: grid; }

/* the date wizard and the map picker */
.sheet {
  border: 1px solid var(--rule-strong); border-radius: var(--radius-lg); padding: 0;
  width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  background: var(--paper-raised); color: var(--ink); box-shadow: var(--shadow-deep);
}
.sheet::backdrop { background: rgba(20, 16, 10, .5); }
.sheet-body { padding: 20px 22px; display: grid; gap: 14px; }
.sheet-head h2 { margin: 0 0 4px; font-size: 1.35rem; }
.sheet-head p { margin: 0; color: var(--ink-soft); font-size: .92rem; }
.sheet .import-tiles { max-height: 46vh; overflow-y: auto; padding: 2px; }
.sheet .import-tile { cursor: pointer; }
.sheet-foot {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-top: 1px solid var(--rule); background: var(--paper);
}
.sheet-foot .field { margin: 0; }
.hint-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hint-chips button {
  border: 1px dashed var(--rule-strong); background: var(--paper); border-radius: 14px; padding: 3px 10px;
  font-size: .8rem; color: var(--ink-soft); cursor: pointer;
}
.hint-chips button:hover { border-color: var(--accent); color: var(--accent); }
#place-dialog #pin-map { height: 300px; }

/* the sorting page */
.draft { scroll-margin-top: 90px; display: grid; gap: 14px; }
.draft > * { min-width: 0; }        /* the photo strip scrolls inside; it never widens the page */
.draft.is-saved { opacity: .55; pointer-events: none; transition: opacity .3s; }
.draft-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.draft-head h3 { margin: 0; }
.draft-fields { display: grid; grid-template-columns: 1fr 190px; gap: 0 14px; }
.draft-fields .wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .draft-fields { grid-template-columns: 1fr; } }
.draft-place { display: flex; gap: 8px; align-items: center; }
.draft-place input { flex: 1; min-width: 0; }
.draft-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.draft-actions .grow { flex: 1; }
.draft-actions form { margin: 0; }
.draft-note { font-size: .82rem; color: var(--ink-faint); min-height: 1.2em; }
.draft-note.is-error { color: var(--err); font-weight: 600; }
.required-mark { color: var(--accent); }
input.is-missing { border-color: var(--err); background: var(--err-soft); }

/* More than one place on a story (the story form). */
.extra-places { margin: 4px 0 14px; display: grid; gap: 8px; justify-items: start; }
.extra-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; width: 100%; }
.extra-place { display: flex; align-items: center; gap: 8px; }
.extra-place input[type=text] { flex: 1; min-width: 0; }
.extra-place.is-active input[type=text] { border-color: var(--accent); }
.pin-num {
  flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; font-size: .78rem; font-weight: 700;
}
.story-places { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.story-places li { display: flex; gap: 8px; align-items: center; font-size: .9rem; }
.story-places .pin-num { width: 20px; height: 20px; font-size: .7rem; }

.import-tile.is-duplicate .frame img { opacity: .45; }

/* Years: a few of the year's photos across the top of its card. */
.year-covers { display: grid; aspect-ratio: 16 / 10; background: var(--paper-sunk); overflow: hidden; gap: 2px; }
.year-covers img { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 0; }
.year-covers-2 { grid-template-columns: 1fr 1fr; }
.year-covers-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.year-covers-3 img:first-child { grid-row: span 2; }
.year-covers-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.year-covers .placeholder { display: grid; place-items: center; color: var(--ink-faint); font-size: .85rem; }
.year-card { display: flex; flex-direction: column; height: 100%; }
.year-card .body { padding: 17px 19px 19px; flex: 1; display: flex; flex-direction: column; }
.year-card h3 { font-size: 1.5rem; margin: 0 0 4px; }
.year-card .count { font-size: .82rem; color: var(--ink-faint); }
