/* The site's look (specs/pages.md, "Look and feel"): colours from the book
   Well-Being, Luminari for the name and headings (as on the book's title),
   Baskerville for everything else.  Macs have both, iPhones only
   Baskerville; elsewhere the free look-alikes stored in vendor/fonts stand in.  Phone first; wider
   screens get room. */

@font-face {
  font-family: "Uncial Antiqua";
  src: url("../../vendor/fonts/UncialAntiqua-Regular.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Libre Baskerville";
  src: url("../../vendor/fonts/LibreBaskerville.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Libre Baskerville";
  src: url("../../vendor/fonts/LibreBaskerville-Italic.woff2") format("woff2");
  font-style: italic;
  font-display: swap;
}

:root {
  --turquoise: #3FB8A6;
  --turquoise-strong: #1F8C7D;
  --gold: #C9A15B;
  --gold-deep: #8C6A2E;
  --well-dark: #121A16;
  --moss: #5E7A3A;
  --stone: #E9E6DF;
  --ink: #1E2622;

  --bg: var(--stone);
  --surface: #F7F5F0;
  --text: var(--ink);
  --muted: #5B645F;
  --line: #D3CEC3;
  --link: var(--turquoise-strong);
  --heading: var(--gold-deep);
  --button-bg: var(--turquoise-strong);
  --button-text: #fff;
  --private-bg: #F6E9D6;
  --private-line: #C9A15B;
  --public-bg: #DDEFE9;
  --public-line: var(--turquoise);
  --focus: #1F8C7D;
  --radius: 12px;
  --gap: 16px;
  --title-font: Luminari, "Uncial Antiqua", Georgia, serif;
  --text-font: Baskerville, "Libre Baskerville", "Baskerville Old Face", Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--well-dark);
    --surface: #1B2520;
    --text: #E6EAE7;
    --muted: #9AA7A0;
    --line: #2E3B35;
    --link: #6FD3C3;
    --heading: var(--gold);
    --button-bg: var(--turquoise);
    --button-text: #0C1411;
    --private-bg: #2E2718;
    --private-line: #8C6A2E;
    --public-bg: #16302B;
    --public-line: var(--turquoise-strong);
    --focus: #6FD3C3;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--text-font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--link); text-underline-offset: 2px; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1, h2 { font-family: var(--title-font); font-weight: 400; color: var(--heading); }
h1 { font-size: 2rem; }
h2 { font-size: 1.45rem; margin-top: 1.4em; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }

.muted { color: var(--muted); }
.small { font-size: .88rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; color: var(--muted); margin-bottom: .2em; }
.clip { overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- the header bar ------------------------------------------------------ */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px calc(8px) 16px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--well-dark); color: #fff;
  position: sticky; top: 0; z-index: 1000;
}
.brand { font-family: var(--title-font); color: var(--gold); text-decoration: none; font-size: 1.05rem; white-space: nowrap; }
.bar nav { display: flex; gap: 2px; flex-wrap: nowrap; overflow-x: auto; }
.bar nav a {
  color: #E6EAE7; text-decoration: none; padding: 0 10px; border-radius: 8px;
  font-size: .92rem; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center;
}
.bar nav a:hover, .bar nav a[aria-current="page"] { background: #24322B; color: #fff; }
@media (max-width: 420px) {
  .brand { font-size: .95rem; }
  .bar nav a { padding: 0 7px; font-size: .86rem; }
}

.foot {
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line);
}

/* --- page frames ----------------------------------------------------------- */
.page { max-width: 820px; margin: 0 auto; padding: 20px 16px 32px; }
.page.narrow { max-width: 620px; }

/* --- controls ---------------------------------------------------------------- */
.button, button.button, input[type=submit] {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: 999px; border: 0;
  background: var(--button-bg); color: var(--button-text); text-decoration: none;
  font: 600 1rem/1.2 var(--text-font); cursor: pointer;
}
.button.small { min-height: 40px; padding: 8px 14px; font-size: .9rem; }
.button.quiet { background: transparent; color: var(--link); border: 1px solid var(--line); }
.button.gold { background: var(--gold); color: #1B1407; }
.button.danger { background: #A33A2E; color: #fff; }
.button:disabled { opacity: .55; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

label { display: block; font-weight: 600; margin: 14px 0 6px; }
.hint { font-weight: 400; color: var(--muted); font-size: .88rem; }
input[type=text], input[type=email], input[type=search], input[type=number], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
textarea { min-height: 140px; resize: vertical; }
input.code { font: 700 1.6rem/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .3em; text-align: center; max-width: 12em; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px 14px; margin: 14px 0; }
legend { font-weight: 600; padding: 0 6px; }
.choice { display: flex; align-items: center; gap: 10px; font-weight: 400; margin: 6px 0; min-height: 40px; }
.choice input { width: 22px; height: 22px; accent-color: var(--turquoise-strong); }

.status { min-height: 1.5em; margin: 10px 0; font-weight: 600; }
.status.error { color: #B3372B; }
@media (prefers-color-scheme: dark) { .status.error { color: #FF8A7A; } }

/* --- cards, notices ------------------------------------------------------------ */
.card {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin: 0 0 10px;
}
.card .thumb { width: 88px; height: 66px; object-fit: cover; border-radius: 8px; flex: none; background: var(--line); }
.card-title { font-weight: 700; text-decoration: none; }
.card p { margin: 2px 0; }
.report-list { list-style: none; padding: 0; margin: 16px 0; }

.notice { border-left: 5px solid var(--line); background: var(--surface); padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.notice.private { border-color: var(--private-line); background: var(--private-bg); }
.notice.public { border-color: var(--public-line); background: var(--public-bg); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.badge.confirmed { background: var(--moss); color: #fff; }
.badge.unconfirmed { background: transparent; border: 1px solid var(--muted); color: var(--muted); }

/* --- the well page -------------------------------------------------------------- */
.well-head h1 { margin-bottom: .2em; overflow-wrap: anywhere; }
.names { color: var(--muted); }
.name { color: var(--text); }
.lang, .count { color: var(--muted); font-size: .9em; }
.support { font-weight: 700; margin: 6px 0; }
.support.confirmed { color: var(--moss); }
@media (prefers-color-scheme: dark) { .support.confirmed { color: #9CC26A; } }
.support.unconfirmed { color: var(--muted); }
.well-map { height: 280px; border-radius: var(--radius); border: 1px solid var(--line); z-index: 0; }
@media (min-width: 700px) { .well-map { height: 380px; } }
.coords { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-top: 8px; font-size: .92rem; }
.coords .actions { display: flex; gap: 8px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin: 18px 0; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; display: block; }
.add-row { margin: 20px 0; }
.person { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.person h3 a { text-decoration: none; }
.report { margin: 8px 0 16px; }
.report .text { overflow-wrap: anywhere; }
.report-photos { display: flex; gap: 6px; flex-wrap: wrap; }
.report-photos img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; display: block; }
.report-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.report-actions button { background: none; border: 0; color: var(--link); font: inherit; padding: 0; cursor: pointer; text-decoration: underline; }
.same ul { padding-left: 1.2em; }

.viewer { padding: 0; border: 0; background: #000; color: #fff; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.viewer::backdrop { background: rgba(0, 0, 0, .9); }
.viewer img { width: 100%; height: calc(100% - 120px); object-fit: contain; display: block; margin-top: 48px; }
.viewer .close { position: absolute; top: 6px; right: 10px; font-size: 2rem; background: none; border: 0; color: #fff; width: 48px; height: 48px; cursor: pointer; }
.viewer .caption { padding: 6px 16px; margin: 0; font-size: .92rem; }
.viewer .nav { position: absolute; top: 50%; width: 100%; display: flex; justify-content: space-between; pointer-events: none; }
.viewer .nav button { pointer-events: auto; background: rgba(0, 0, 0, .45); color: #fff; border: 0; font-size: 2.2rem; width: 52px; height: 72px; cursor: pointer; }

/* --- map markers ------------------------------------------------------------------ */
.well-pin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--turquoise-strong); background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
.well-pin.confirmed { background: var(--turquoise); border-color: #fff; }
.leaflet-container { font: inherit; }
.leaflet-popup-content { margin: 12px 14px; min-width: 180px; }
.popup-card img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.popup-card strong { display: block; font-size: 1rem; }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background-color: rgba(63, 184, 166, .35) !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background-color: rgba(31, 140, 125, .85) !important; color: #fff; font-weight: 700; }

/* narrow phones: the brand becomes its icon so the three links fit */
.brand .brand-icon { display: none; width: 30px; height: 30px; vertical-align: middle; }
[data-me] { max-width: 10em; overflow: hidden; text-overflow: ellipsis; display: inline-block !important; line-height: 44px; height: 44px; }
@media (max-width: 600px) {
  .brand { font-size: 0; }
  .brand .brand-icon { display: inline-block; }
  .bar { padding-left: 12px; }
  .bar nav a { font-size: .9rem; padding: 0 8px; }
  [data-me] { max-width: 8.5em; }
}
