/* ------------------------------------------------------------------------- *
 * IDMe -- dark forest field journal.
 *
 * Mobile-first. Palette is deliberately narrow: charcoal-green ground,
 * parchment ink, moss for controls, copper for rules and emphasis, amber used
 * sparingly for a single highlight per view. No neon, no gradients pretending
 * to be glass.
 * ------------------------------------------------------------------------- */

:root {
  --ink:          #0c0f0c;
  --ink-2:        #121711;
  --ink-3:        #181f16;
  --ink-4:        #202818;
  --parchment:    #e9e3d1;
  --parchment-2:  #c3bda8;
  --parchment-3:  #8f8b77;
  --moss:         #7b9c58;
  --moss-2:       #5c7a3f;
  --moss-3:       #38492a;
  --sage:         #a3b28c;
  --copper:       #b5713c;
  --copper-2:     #8a5229;
  --amber:        #d8a04a;
  --rust:         #9c4f38;
  --rule:         rgba(181, 113, 60, 0.26);
  --rule-soft:    rgba(233, 227, 209, 0.10);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  color-scheme: dark;

  --r: 3px;
  --pad: 1rem;
  --header-h: 3.25rem;
  --nav-h: 3.65rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--ink);
  /* Faint paper grain: two offset dot fields, low enough contrast to be felt
     rather than seen. Never over text. */
  background-image:
    radial-gradient(rgba(233,227,209,0.022) 1px, transparent 1px),
    radial-gradient(rgba(181,113,60,0.018) 1px, transparent 1px);
  background-size: 17px 17px, 29px 29px;
  background-position: 0 0, 8px 11px;
  background-attachment: fixed;
  color: var(--parchment);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  overflow-wrap: break-word;
}

i, em, .sci { font-style: italic; }

a { color: var(--sage); text-decoration: none; }
a:hover { color: var(--amber); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.4em;
  letter-spacing: 0.01em;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }

.mono, code, kbd { font-family: var(--mono); font-size: 0.8125rem; letter-spacing: -0.01em; }

/* --- structure ----------------------------------------------------------- */

.wrap { max-width: 1140px; margin: 0 auto; padding: var(--pad); }

.masthead {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 0.75rem;
  height: var(--header-h);
  padding: 0 var(--pad);
  background: linear-gradient(180deg, rgba(12,15,12,0.97), rgba(12,15,12,0.88));
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.masthead .mark {
  font-family: var(--serif); font-size: 1.16rem; font-weight: 600;
  color: var(--parchment); letter-spacing: 0.06em;
}
.masthead .mark b { color: var(--copper); font-weight: 600; }
.masthead .tagline {
  font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase;
  letter-spacing: 0.18em; color: var(--parchment-3); display: none;
}
.masthead .spacer { flex: 1; }

.desknav { display: none; gap: 1.1rem; }
.desknav a {
  font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--parchment-2); padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.desknav a:hover { color: var(--parchment); }
.desknav a.on { color: var(--amber); border-bottom-color: var(--copper); }

/* Thumb-reachable bottom bar; the primary navigation outdoors. */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(10,13,10,0.97);
  border-top: 1px solid var(--rule);
  backdrop-filter: blur(8px);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.18rem; color: var(--parchment-3);
  font-family: var(--mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.1em;
}
.tabbar a .ic { font-size: 1.16rem; line-height: 1; }
.tabbar a.on { color: var(--amber); }
.tabbar a.on .ic { filter: drop-shadow(0 0 6px rgba(216,160,74,0.35)); }
.tabbar a.add .ic { color: var(--moss); font-size: 1.5rem; }

/* --- specimen plate: the core card ------------------------------------- */

.plate {
  position: relative;
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  overflow: hidden;
}
.plate::before {
  /* hairline inner rule, like a mounted herbarium sheet */
  content: ""; position: absolute; inset: 3px; pointer-events: none;
  border: 1px solid var(--rule-soft); border-radius: 1px;
}
.plate > * { position: relative; }

.plate-head {
  display: flex; align-items: baseline; gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, rgba(123,156,88,0.07), transparent);
}
.plate-head h2, .plate-head h3 { margin: 0; }
.plate-body { padding: 0.75rem; }

.acc {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em;
  color: var(--copper); text-transform: uppercase; white-space: nowrap;
}

/* --- observation card --------------------------------------------------- */

.grid {
  display: grid; gap: 0.85rem;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.card { display: block; color: inherit; }
.card:hover { color: inherit; }
.card:hover .plate { border-color: var(--copper-2); }
.card .shot {
  position: relative; display: block; width: 100%; aspect-ratio: 1 / 1;
  background: var(--ink-3) center/cover no-repeat;
  border-bottom: 1px solid var(--rule);
}
.card .shot.empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem; color: var(--moss-3);
}
.card .meta { padding: 0.5rem 0.6rem 0.6rem; }
.card .name { font-family: var(--serif); font-size: 0.95rem; line-height: 1.25; }
.card .name.none { color: var(--parchment-3); font-style: normal; }
.card .common { font-size: 0.78rem; color: var(--parchment-2); margin-top: 0.1rem; }
.card .foot {
  display: flex; align-items: center; justify-content: space-between; gap: 0.4rem;
  margin-top: 0.4rem; font-family: var(--mono); font-size: 0.64rem;
  color: var(--parchment-3); letter-spacing: 0.04em;
}

.chip {
  display: inline-flex; align-items: center; gap: 0.28rem;
  padding: 0.08rem 0.36rem; border: 1px solid var(--rule); border-radius: 2px;
  font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--sage); background: rgba(123,156,88,0.07);
}
.chip.copper { color: var(--copper); border-color: var(--copper-2); background: rgba(181,113,60,0.08); }
.chip.warn { color: var(--amber); border-color: rgba(216,160,74,0.4); background: rgba(216,160,74,0.08); }
.chip.dim { color: var(--parchment-3); background: transparent; }

.badge-photos {
  position: absolute; right: 0.35rem; bottom: 0.35rem;
  padding: 0.05rem 0.3rem; border-radius: 2px;
  background: rgba(10,13,10,0.78); border: 1px solid var(--rule);
  font-family: var(--mono); font-size: 0.6rem; color: var(--parchment-2);
}

/* --- compact list ------------------------------------------------------- */

.rows { display: flex; flex-direction: column; gap: 1px; background: var(--rule-soft); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.row {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 0.65rem; align-items: center;
  padding: 0.5rem 0.6rem; background: var(--ink-2); color: inherit;
}
.row:hover { background: var(--ink-3); }
.row .tn { width: 44px; height: 44px; border-radius: 2px; background: var(--ink-3) center/cover no-repeat; border: 1px solid var(--rule); }
.row .tn.empty { display: flex; align-items: center; justify-content: center; color: var(--moss-3); }
.row .nm { font-family: var(--serif); font-size: 0.9rem; line-height: 1.2; }
.row .nm { display: block; }
.row .sub { display: block; font-family: var(--mono); font-size: 0.64rem; color: var(--parchment-3); margin-top: 0.15rem; }
.row .rt { text-align: right; font-family: var(--mono); font-size: 0.66rem; color: var(--parchment-2); }

/* --- stats -------------------------------------------------------------- */

.stats { display: grid; gap: 0.6rem; grid-template-columns: repeat(2, 1fr); }
.stat {
  padding: 0.6rem 0.7rem; background: var(--ink-2);
  border: 1px solid var(--rule); border-radius: var(--r);
  border-left: 2px solid var(--moss-2);
}
.stat .n { font-family: var(--serif); font-size: 1.55rem; line-height: 1; color: var(--parchment); }
.stat .k {
  display: block; margin-top: 0.25rem; font-family: var(--mono); font-size: 0.6rem;
  text-transform: uppercase; letter-spacing: 0.13em; color: var(--parchment-3);
}
.stat.copper { border-left-color: var(--copper); }
.stat.amber { border-left-color: var(--amber); }

/* --- taxonomy ladder ---------------------------------------------------- */

.taxo { display: grid; grid-template-columns: auto 1fr; gap: 0 0.7rem; align-items: baseline; }
.taxo dt {
  font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--parchment-3);
  padding: 0.22rem 0; white-space: nowrap;
}
.taxo dd {
  margin: 0; padding: 0.22rem 0; font-size: 0.9rem; color: var(--parchment);
  border-bottom: 1px dotted var(--rule-soft);
}
.taxo dd:last-child { border-bottom: 0; }
/* Rank indentation, so the hierarchy reads as a hierarchy. */
.taxo dd.r1 { padding-left: 0; }
.taxo dd.r2 { padding-left: 0.4rem; }
.taxo dd.r3 { padding-left: 0.8rem; }
.taxo dd.r4 { padding-left: 1.2rem; }
.taxo dd.r5 { padding-left: 1.6rem; }
.taxo dd.r6 { padding-left: 2rem; }
.taxo dd.r7 { padding-left: 2.4rem; color: var(--amber); }

/* --- metadata table ----------------------------------------------------- */

.fields { display: grid; grid-template-columns: 1fr; gap: 0; }
.field { display: flex; gap: 0.6rem; padding: 0.4rem 0; border-bottom: 1px dotted var(--rule-soft); }
.field:last-child { border-bottom: 0; }
.field .lbl {
  flex: 0 0 7.5rem; font-family: var(--mono); font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--parchment-3);
  padding-top: 0.15rem;
}
.field .val { flex: 1; min-width: 0; font-size: 0.9rem; }
.field .val.mono { font-size: 0.78rem; color: var(--parchment-2); }

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

label.lab {
  display: block; margin-bottom: 0.25rem;
  font-family: var(--mono); font-size: 0.64rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--sage);
}
.fieldset { margin-bottom: 0.9rem; }
.hint { font-size: 0.74rem; color: var(--parchment-3); margin-top: 0.22rem; }

input[type=text], input[type=password], input[type=search], input[type=number],
input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: 0.62rem 0.7rem;
  background: var(--ink); color: var(--parchment);
  border: 1px solid var(--rule); border-radius: var(--r);
  font-family: var(--sans); font-size: 1rem; /* >=16px stops iOS zoom-on-focus */
}
input[type=number], input.mono { font-family: var(--mono); font-size: 0.9rem; }
textarea { min-height: 4.5rem; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--moss);
  box-shadow: 0 0 0 2px rgba(123,156,88,0.18);
}
input::placeholder, textarea::placeholder { color: var(--parchment-3); opacity: 0.7; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--sage) 50%), linear-gradient(135deg, var(--sage) 50%, transparent 50%);
  background-position: calc(100% - 15px) 1.15rem, calc(100% - 10px) 1.15rem;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: 2rem;
}

.two { display: grid; gap: 0.6rem; grid-template-columns: 1fr 1fr; }
.three { display: grid; gap: 0.6rem; grid-template-columns: 1fr; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.62rem 0.95rem; min-height: 2.75rem;
  background: var(--ink-3); color: var(--parchment);
  border: 1px solid var(--rule); border-radius: var(--r);
  font-family: var(--sans); font-size: 0.9rem; font-weight: 500;
  cursor: pointer; text-align: center;
}
.btn:hover { background: var(--ink-4); border-color: var(--copper-2); color: var(--parchment); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: var(--moss-2); border-color: var(--moss); color: #f2f6ea; font-weight: 600;
}
.btn.primary:hover { background: var(--moss); }
.btn.copper { background: var(--copper-2); border-color: var(--copper); color: #fdf3e8; }
.btn.copper:hover { background: var(--copper); }
.btn.danger { color: #e8b5a6; border-color: rgba(156,79,56,0.5); }
.btn.danger:hover { background: rgba(156,79,56,0.2); border-color: var(--rust); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 0.32rem 0.55rem; min-height: 2rem; font-size: 0.78rem; }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.cta {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; padding: 1.05rem; margin: 0.2rem 0 1.1rem;
  background: linear-gradient(180deg, var(--moss-2), var(--moss-3));
  border: 1px solid var(--moss); border-radius: var(--r);
  color: #f3f7ec; font-family: var(--serif); font-size: 1.16rem; font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 2px 12px rgba(0,0,0,0.35);
}
.cta:hover { background: linear-gradient(180deg, var(--moss), var(--moss-2)); color: #fff; }
.cta .plus { font-size: 1.4rem; line-height: 1; }

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

.note {
  padding: 0.6rem 0.75rem; margin-bottom: 0.85rem;
  border: 1px solid var(--rule); border-left: 2px solid var(--moss);
  border-radius: var(--r); background: rgba(123,156,88,0.07); font-size: 0.85rem;
}
.note.warn { border-left-color: var(--amber); background: rgba(216,160,74,0.08); }
.note.bad { border-left-color: var(--rust); background: rgba(156,79,56,0.12); }
.note strong { color: var(--parchment); }
.note .mono { display: block; margin-top: 0.3rem; color: var(--parchment-2); }


/* --- candidates --------------------------------------------------------- */

.cand { margin-bottom: 0.6rem; }
.cand.top { border-color: var(--copper-2); }
.cand.top .plate-head { background: linear-gradient(180deg, rgba(181,113,60,0.14), transparent); }
.cand .score { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.4rem; }
.cand .score .pc { font-family: var(--serif); font-size: 1.5rem; color: var(--amber); line-height: 1; }
.cand.alt .score .pc { font-size: 1.1rem; color: var(--sage); }
.bar { height: 4px; background: var(--ink-4); border-radius: 2px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--moss-2), var(--amber)); }
.cand .why { font-size: 0.83rem; color: var(--parchment-2); margin-top: 0.45rem; line-height: 1.5; }
.cand .why b { color: var(--sage); font-weight: 600; }

.components { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.45rem; }

/* --- gallery / lightbox ------------------------------------------------- */

.shots { display: grid; gap: 0.4rem; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.shots .sh {
  position: relative; display: block; aspect-ratio: 1/1; border-radius: 2px;
  border: 1px solid var(--rule); background: var(--ink-3) center/cover no-repeat;
}
.hero {
  display: block; width: 100%; max-height: 62vh; object-fit: contain;
  background: var(--ink); border-bottom: 1px solid var(--rule);
}

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

#map { width: 100%; height: 62vh; min-height: 300px; background: var(--ink-2); border: 1px solid var(--rule); border-radius: var(--r); }
#minimap { width: 100%; height: 190px; background: var(--ink-2); border-radius: 2px; }
.leaflet-container { background: #0b0e0b; font-family: var(--sans); }
/* OSM tiles are near-white, which would glare against this palette. Inverting
   and rotating the hue turns land dark while keeping water and roads legible
   -- the standard dark-map treatment -- then the saturation and sepia pull it
   back towards the journal's greens and browns. */
.leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.78) contrast(0.92) saturate(0.45) sepia(0.22);
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--ink-2); color: var(--parchment);
  border: 1px solid var(--rule); border-radius: var(--r); box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.leaflet-popup-content { margin: 0.55rem 0.65rem; font-size: 0.82rem; }
.leaflet-popup-content a { color: var(--sage); }
.leaflet-container a.leaflet-popup-close-button { color: var(--parchment-3); }
.leaflet-bar a, .leaflet-control-attribution {
  background: var(--ink-2) !important; color: var(--parchment-2) !important;
  border-color: var(--rule) !important;
}
.leaflet-control-attribution a { color: var(--sage) !important; }
.pop-shot { width: 100%; height: 96px; object-fit: cover; border-radius: 2px; margin-bottom: 0.35rem; border: 1px solid var(--rule); }
.pin {
  width: 16px; height: 16px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); border: 1.5px solid rgba(12,15,12,0.85);
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.cluster {
  display: flex; align-items: center; justify-content: center;
  background: rgba(92,122,63,0.85); border: 1.5px solid var(--moss);
  color: #f2f6ea; border-radius: 50%;
  font-family: var(--mono); font-size: 0.72rem; font-weight: 600;
}

/* --- filters ------------------------------------------------------------ */

.filters { margin-bottom: 0.9rem; }
.searchrow { display: flex; gap: 0.45rem; margin-bottom: 0.55rem; }
.searchrow input { flex: 1; }
.pills { display: flex; flex-wrap: wrap; gap: 0.32rem; }
.pill {
  padding: 0.28rem 0.55rem; border: 1px solid var(--rule); border-radius: 999px;
  font-family: var(--mono); font-size: 0.64rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--parchment-2); background: transparent;
  cursor: pointer;
}
.pill:hover { border-color: var(--copper-2); color: var(--parchment); }
.pill.on { background: rgba(123,156,88,0.18); border-color: var(--moss); color: var(--parchment); }

.toolbar {
  display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap;
  margin-bottom: 0.8rem; padding-bottom: 0.55rem; border-bottom: 1px solid var(--rule);
}
.toolbar .count { font-family: var(--mono); font-size: 0.68rem; color: var(--parchment-3); letter-spacing: 0.06em; }
.toolbar .spacer { flex: 1; }
.seg { display: flex; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.seg a { padding: 0.3rem 0.55rem; font-family: var(--mono); font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--parchment-3); }
.seg a.on { background: var(--ink-4); color: var(--amber); }

/* --- photo picker ------------------------------------------------------- */

.picker { display: grid; gap: 0.5rem; grid-template-columns: 1fr 1fr; }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem;
  padding: 1.1rem 0.7rem; min-height: 6.4rem;
  border: 1px dashed var(--moss-3); border-radius: var(--r);
  background: rgba(123,156,88,0.05); color: var(--sage); cursor: pointer;
  font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em;
  text-align: center;
}
.drop:hover { border-color: var(--moss); background: rgba(123,156,88,0.1); }
.drop .g { font-size: 1.5rem; }
.previews { display: grid; gap: 0.4rem; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); margin-top: 0.5rem; }
.previews .pv { position: relative; aspect-ratio: 1/1; border: 1px solid var(--rule); border-radius: 2px; overflow: hidden; background: var(--ink-3); }
.previews .pv img { width: 100%; height: 100%; object-fit: cover; }
.previews .pv .x {
  position: absolute; top: 2px; right: 2px; width: 1.25rem; height: 1.25rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,13,10,0.8); border: 1px solid var(--rule); border-radius: 2px;
  color: var(--parchment-2); font-size: 0.8rem; cursor: pointer;
}

/* --- gps ---------------------------------------------------------------- */

.gps {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 0.65rem; border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--ink); font-family: var(--mono); font-size: 0.74rem;
}
.gps .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--parchment-3); flex: 0 0 auto; }
.gps.live .dot { background: var(--moss); box-shadow: 0 0 6px var(--moss); }
.gps.wait .dot { background: var(--amber); animation: pulse 1.3s ease-in-out infinite; }
.gps.err .dot { background: var(--rust); }
.gps .txt { flex: 1; min-width: 0; color: var(--parchment-2); overflow: hidden; text-overflow: ellipsis; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* --- misc --------------------------------------------------------------- */

.empty-state { padding: 2.2rem 1rem; text-align: center; color: var(--parchment-3); }
.empty-state .g { font-size: 2.4rem; color: var(--moss-3); display: block; margin-bottom: 0.5rem; }

.rule { height: 1px; background: var(--rule); border: 0; margin: 1.1rem 0; }
.rule.orn {
  height: auto; background: none; display: flex; align-items: center;
  gap: 0.6rem; color: var(--copper); font-size: 0.7rem;
}
.rule.orn::before, .rule.orn::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

.section-title {
  display: flex; align-items: baseline; gap: 0.5rem; margin: 1.2rem 0 0.6rem;
}
.section-title h2 { margin: 0; }
.section-title .more { margin-left: auto; font-family: var(--mono); font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.1em; }

.sparks { display: flex; align-items: flex-end; gap: 3px; height: 42px; }
.sparks .b {
  flex: 1 1 0; max-width: 2.2rem;  /* keeps a two-month chart from becoming slabs */
  background: var(--moss-3); border-radius: 1px 1px 0 0; min-height: 2px;
}
.sparks .b.now { background: var(--copper); }

.taglist { display: flex; flex-wrap: wrap; gap: 0.28rem; margin-top: 0.4rem; }

.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: var(--pad); padding-bottom: var(--pad);
}
.login-box { width: 100%; max-width: 21rem; }
.login-box .crest {
  text-align: center; margin-bottom: 1.2rem;
  font-family: var(--serif); font-size: 1.9rem; letter-spacing: 0.08em; color: var(--parchment);
}
.login-box .crest b { color: var(--copper); font-weight: 600; }
.login-box .crest .sub {
  display: block; margin-top: 0.3rem; font-family: var(--mono); font-size: 0.6rem;
  text-transform: uppercase; letter-spacing: 0.24em; color: var(--parchment-3);
}

.footer {
  padding: 1.4rem var(--pad) 0.6rem; text-align: center;
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.06em;
  color: var(--parchment-3); line-height: 1.7;
}

.spin {
  display: inline-block; width: 0.85rem; height: 0.85rem;
  border: 2px solid var(--moss-3); border-top-color: var(--amber);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

[hidden] { display: none !important; }
/* Visually hidden but still rendered. File inputs use this rather than
   `hidden`, because some Android browsers will not launch the camera intent
   for an input with display:none. */
.sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.drop { position: relative; }

/* --- wider screens ------------------------------------------------------ */

@media (min-width: 640px) {
  :root { --pad: 1.4rem; }
  .three { grid-template-columns: repeat(3, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .picker { grid-template-columns: repeat(3, 1fr); }
  h1 { font-size: 1.85rem; }
  .masthead .tagline { display: block; }
}

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .desknav { display: flex; }
  .cta { max-width: 22rem; }
  .fields { grid-template-columns: 1fr 1fr; gap: 0 1.6rem; }
  #map { height: 72vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* --- lore: the marginalia of the specimen sheet ------------------------- */

.plate.lore {
  border-color: var(--copper-2);
  background:
    linear-gradient(180deg, rgba(181,113,60,0.05), transparent 40%),
    var(--ink-2);
}
.plate.lore .plate-head {
  background: linear-gradient(180deg, rgba(181,113,60,0.12), transparent);
}
.plate.lore .plate-head h3 { color: var(--amber); }

.lore-block { margin-bottom: 0.85rem; }
.lore-block:last-of-type { margin-bottom: 0.4rem; }
.lore-block .lab { color: var(--copper); letter-spacing: 0.14em; }
.lore-block p {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--parchment);
}
/* The alchemical line gets a rule, like a marginal gloss. */
.lore-block.alch {
  padding-left: 0.7rem;
  border-left: 1px solid var(--copper-2);
}
.lore-block.alch p { font-style: italic; color: var(--sage); }
.lore-folk { color: var(--parchment-2) !important; font-size: 0.78rem !important; }


/* The file input covers its tile and takes the tap itself. A <label> would
   forward a synthetic click instead, which Android browsers may refuse to
   treat as a user gesture for the camera intent. */
.drop { position: relative; }
.drop-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  /* Keep the native control out of sight without display:none or
     visibility:hidden, either of which stops it being tappable. */
  font-size: 0;
  color: transparent;
}
.drop:focus-within {
  border-color: var(--moss);
  box-shadow: 0 0 0 2px rgba(123, 156, 88, 0.18);
}

/* --- ringside commentary ------------------------------------------------ */
/* Loud on purpose, and visibly not the scholarly plate above it. */

.plate.promo { border-color: var(--rust); background: var(--ink-2); }
.plate.promo .plate-head {
  background: linear-gradient(180deg, rgba(156, 79, 56, 0.16), transparent);
}
.plate.promo .plate-head h3 {
  color: #e8b5a6;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.95rem;
}
.promo-billing {
  margin: 0 0 0.6rem;
  font-family: var(--mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--parchment-3);
}
.promo-body {
  font-size: 0.95rem;
  line-height: 1.62;
  color: var(--parchment);
  white-space: pre-wrap;
}
.promo-body::first-letter {
  font-family: var(--serif);
  font-size: 2.1rem;
  line-height: 1;
  float: left;
  padding: 0.1rem 0.35rem 0 0;
  color: var(--rust);
}
