/* Globe — editorial. A travel journal that happens to have a planet in it.
 *
 * Two rules drive the whole sheet:
 *   1. Rules, not boxes. Nothing is a grey rounded rectangle. Hierarchy comes
 *      from type size and hairlines, which is why it stops looking like a
 *      settings screen and starts looking like a page.
 *   2. Colour is never the only carrier. Six tag hues cannot be told apart
 *      under deuteranopia at any lightness — measured with the palette
 *      validator, not assumed — so every tag also has a SHAPE, and every
 *      coloured thing sits next to its own name.
 */

@font-face {
  font-family: "Newsreader";
  src: url("vendor/newsreader.woff2") format("woff2");
  font-weight: 200 800;          /* variable: one file covers the range */
  font-style: normal;
  font-display: swap;            /* the app must never wait on a typeface */
}

:root {
  /* warm dark — a paper-at-night ground rather than the usual blue-black */
  --bg:       #0d0b09;
  --raised:   #16130f;
  --rule:     #2b241c;
  --rule-dim: #1d1813;
  --ink:      #f3ede3;
  --ink-2:    #b9ada0;
  --dim:      #877c6e;
  --accent:   #d9a441;

  /* tag hues: the validated dark-surface categorical steps. They pass the
     lightness band, chroma floor and 3:1 contrast; they do NOT pass CVD
     separation, which is why shape exists. */
  --tag-1: #199e70;   /* Nature   aqua    */
  --tag-2: #3987e5;   /* City     blue    */
  --tag-3: #9085e9;   /* Stay     violet  */
  --tag-4: #c98500;   /* Activity yellow  */
  --tag-5: #d95926;   /* Food     orange  */
  --tag-6: #d55181;   /* Event    magenta */

  --temp: #d95926;    /* season chart — one hue, its own chart, no legend */
  --rain: #3987e5;

  --serif: "Newsreader", Iowan Old Style, Palatino, Georgia, serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --tab-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--sans);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1px 1px at 18% 26%, rgba(255,248,235,.50), transparent),
    radial-gradient(1px 1px at 72% 14%, rgba(255,248,235,.36), transparent),
    radial-gradient(1px 1px at 86% 62%, rgba(255,248,235,.44), transparent),
    radial-gradient(1px 1px at 33% 78%, rgba(255,248,235,.30), transparent),
    radial-gradient(1px 1px at 57% 43%, rgba(255,248,235,.26), transparent),
    radial-gradient(1px 1px at  9% 88%, rgba(255,248,235,.34), transparent),
    radial-gradient(900px 620px at 50% 38%, #17120d, var(--bg));
}

/* ── type ───────────────────────────────────────────────────────────── */

.display { font-family: var(--serif); font-weight: 400; letter-spacing: -.012em; }

/* the small uppercase label is the whole editorial voice — it appears as the
   left column of every field row, above every section, and nowhere else */
.label {
  font: 500 10.5px/1 var(--sans);
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--dim);
}

/* ── layout ─────────────────────────────────────────────────────────── */

#views { height: 100%; }
.view { display: flex; flex-direction: column; height: 100%; }
.view[hidden] { display: none; }

.hd { padding: max(env(safe-area-inset-top), 14px) 22px 14px; }
.hd h1 {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: 34px; line-height: 1.05; letter-spacing: -.02em;
}
.hd .sub { margin: 7px 0 0; color: var(--dim); font-size: 13px; }

.body {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 4px 22px calc(var(--tab-h) + env(safe-area-inset-bottom) + 28px);
}

/* ── the globe view ─────────────────────────────────────────────────── */

#view-globe { position: relative; }
#globeWrap  { position: absolute; inset: 0; }
#globeCanvas {
  position: absolute; inset: 0; touch-action: none;
  -webkit-touch-callout: none;   /* or iOS puts its own Look Up / Copy bar on the press */
  -webkit-user-select: none; user-select: none;
}
#globeCanvas.arming::after {
  content: "Release to drop a pin";
  position: absolute; left: 50%; top: 16%; transform: translateX(-50%);
  background: rgba(217,164,65,.14); border: 1px solid var(--accent);
  color: var(--ink); font: 500 12px/1 var(--sans); letter-spacing: .04em;
  padding: 8px 15px; border-radius: 2px; white-space: nowrap; pointer-events: none;
}

.boot {
  position: absolute; inset: 0; display: flex; gap: 16px;
  flex-direction: column; align-items: center; justify-content: center;
  color: var(--dim); transition: opacity .5s;
}
.boot[hidden] { display: none; }
.boot.gone { opacity: 0; pointer-events: none; }
.boot p { margin: 0; font: 400 13px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--rule); border-top-color: var(--accent);
  animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.overlay-top {
  position: absolute; left: 0; right: 0;
  top: max(env(safe-area-inset-top), 12px);
  padding: 0 18px; z-index: 10;
}
.overlay-bottom {
  position: absolute; left: 0; right: 0;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px);
  z-index: 10;
}

/* a rule with a word on it, not a pill with a placeholder in it */
.searchpill {
  width: 100%; display: flex; align-items: baseline; gap: 12px;
  padding: 0 0 11px; background: none; border: 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-2); text-align: left;
  font-family: var(--serif); font-size: 19px; font-weight: 400;
}
.searchpill span { font-family: var(--sans); font-size: 15px; color: var(--accent); }
.searchpill em { font-style: italic; color: var(--dim); }

/* ── filter strip ───────────────────────────────────────────────────── */

.chips { display: flex; align-items: center; gap: 0; padding: 6px 18px 8px; }
.chip-scroll {
  flex: 1; min-width: 0; display: flex; gap: 0;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  touch-action: pan-x; scroll-snap-type: x proximity;
  mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 10px), transparent);
}
.chip-scroll::-webkit-scrollbar { display: none; }
.chip-scroll .chip { scroll-snap-align: start; }
.strip-div { flex: 0 0 auto; width: 1px; height: 15px; background: var(--rule); margin: 0 10px; }

.chip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 7px;
  padding: 7px 11px; background: none; border: 0; border-bottom: 1px solid transparent;
  color: var(--dim); white-space: nowrap;
  font: 500 10.5px/1 var(--sans); text-transform: uppercase; letter-spacing: .13em;
}
.chip .n { font-size: 9.5px; opacity: .6; }
.chip.on { color: var(--ink); border-bottom-color: currentColor; }

/* ── shapes: the channel colour can't carry ─────────────────────────── */

.shape { width: 9px; height: 9px; flex: 0 0 auto; background: var(--c, currentColor); }
.s1 { border-radius: 50%; }
.s2 { border-radius: 2px; }
.s3 { border-radius: 1px; transform: rotate(45deg); }
.s4 { border-radius: 999px; width: 13px; height: 7px; }
.s5 { border-radius: 50% 1px 50% 1px; }
.s6 { border-radius: 50% 50% 50% 1px; }

/* ── pins ───────────────────────────────────────────────────────────────
   No flat colour is legible against every point on Earth — measured worst case
   is about 1.04:1 on a city-light cluster. So the pin never relies on its fill:
   a dark ring and a white ring sit outside it and one of them always has
   contrast (worst case across the whole grey axis is 4.4:1, above the 3:1 bar). */

.pin {
  position: relative; width: 12px; height: 12px;
  background: var(--c);
  box-shadow:
    0 0 0 1.5px #0b0d12,
    0 0 0 3.5px rgba(255,255,255,.92),
    0 2px 7px rgba(0,0,0,.55);
  transition: transform .12s ease, opacity .18s linear;
  will-change: transform;
}
.pin.s1 { border-radius: 50%; }
.pin.s2 { border-radius: 3px; }
.pin.s3 { border-radius: 1px; transform: rotate(45deg); }
.pin.s4 { border-radius: 999px; width: 17px; height: 10px; }
.pin.s5 { border-radius: 50% 2px 50% 2px; }
.pin.s6 { border-radius: 50% 50% 50% 2px; }

/* 44px hit area over a 12px mark: Apple's minimum without an ugly dot */
.pin::before { content: ""; position: absolute; inset: -16px; border-radius: 50%; }
.pin:active { transform: scale(1.4); }
.pin.s3:active { transform: rotate(45deg) scale(1.4); }

/* done keeps its shape and hollows out, so both channels survive */
.pin.done {
  background: transparent;
  box-shadow:
    inset 0 0 0 2px var(--c),
    0 0 0 1.5px #0b0d12,
    0 0 0 3.5px rgba(255,255,255,.55),
    0 2px 6px rgba(0,0,0,.5);
}
.pin.sel { transform: scale(1.3); box-shadow: 0 0 0 1.5px #0b0d12, 0 0 0 3.5px #fff, 0 0 0 10px rgba(217,164,65,.28), 0 2px 10px rgba(0,0,0,.6); }
.pin.s3.sel { transform: rotate(45deg) scale(1.3); }

/* ── rows: hairlines, no cards ──────────────────────────────────────── */

.row {
  width: 100%; display: flex; align-items: baseline; gap: 13px;
  padding: 15px 0; background: none; border: 0;
  border-bottom: 1px solid var(--rule-dim);
  color: inherit; text-align: left; text-decoration: none;
}
.row:active { background: rgba(255,255,255,.03); }
.row .grow { flex: 1; min-width: 0; }
.row .nm {
  display: block; font-family: var(--serif); font-size: 19px;
  font-weight: 400; line-height: 1.2; letter-spacing: -.01em;
}
.row .mt {
  display: block; color: var(--dim); font-size: 12.5px; margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row .chev { color: var(--rule); font-size: 17px; }
.row .shape { align-self: center; }

.sec { margin: 30px 0 2px; padding-bottom: 9px; border-bottom: 1px solid var(--rule); }
.dim { color: var(--dim); font-size: 13px; line-height: 1.6; }
.empty { text-align: center; padding: 56px 8px; }
.empty p { margin: 0 0 10px; }
.empty .big { font-family: var(--serif); font-size: 22px; color: var(--ink-2); }

/* ── field rows inside the place sheet ──────────────────────────────── */

.field {
  width: 100%; display: flex; align-items: baseline; gap: 16px;
  padding: 13px 0; background: none; border: 0;
  border-bottom: 1px solid var(--rule-dim); color: inherit; text-align: left;
}
.field .label { flex: 0 0 74px; padding-top: 2px; }
.field .val { flex: 1; min-width: 0; font-size: 15.5px; color: var(--ink); }
.field .val.none { color: var(--dim); font-style: italic; font-family: var(--serif); }
.field .hint { display: block; color: var(--dim); font-size: 12px; margin-top: 4px; }

/* ── the season chart ───────────────────────────────────────────────────
   Two charts, not one. Temperature and rainfall have different units and
   different natural baselines, so putting them on one axis would be the
   classic dual-axis lie. Rain grows from zero, so it gets bars; temperature
   goes below zero and is about shape rather than magnitude, so it gets a line. */

.season { margin: 4px 0 2px; }
.season .cap {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 5px;
}
.season .cap .rng { font: 400 11px/1 var(--sans); color: var(--dim); }
.season svg { display: block; width: 100%; height: 40px; overflow: visible; }
.season .bars {
  display: flex; align-items: flex-end; gap: 2px; height: 32px;
  border-bottom: 1px solid var(--rule);   /* the zero line the bars grow from */
}
.season .bars i {
  flex: 1; background: var(--rain); border-radius: 3px 3px 0 0;
  min-height: 1.5px; opacity: .32; display: block;
}
.season .bars i.on { opacity: 1; }
.season .months {
  display: flex; gap: 2px; margin-top: 7px;
  font: 500 9px/1 var(--sans); color: var(--dim); letter-spacing: .06em;
}
.season .months span { flex: 1; text-align: center; }
.season .months span.on { color: var(--ink-2); }
.season .read { margin: 9px 0 0; color: var(--dim); font-size: 12px; line-height: 1.55; }

/* ── buttons ────────────────────────────────────────────────────────── */

button { cursor: pointer; font-family: var(--sans); }
.btn {
  width: 100%; padding: 15px; margin-top: 10px;
  background: none; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 2px;
  font: 500 11px/1 var(--sans); text-transform: uppercase; letter-spacing: .14em;
}
.btn:active { background: rgba(255,255,255,.04); }
.btn.primary { background: var(--accent); color: #1a1206; border-color: var(--accent); font-weight: 600; }
.btn.danger  { color: #e0705f; border-color: rgba(224,112,95,.35); }
.row2 { display: flex; gap: 10px; }
.row2 > * { flex: 1; }

.fab {
  position: absolute; right: 20px;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 78px);
  height: 42px; padding: 0 18px; z-index: 20;
  background: var(--accent); color: #1a1206; border: 0; border-radius: 2px;
  font: 600 11px/1 var(--sans); text-transform: uppercase; letter-spacing: .13em;
  box-shadow: 0 6px 22px rgba(0,0,0,.55);
}
.fab:active { transform: scale(.96); }

/* ── forms ──────────────────────────────────────────────────────────── */

label { display: block; margin: 20px 0 8px;
        font: 500 10.5px/1 var(--sans); text-transform: uppercase;
        letter-spacing: .14em; color: var(--dim); }
input, textarea, select {
  width: 100%; padding: 11px 0; background: none; color: var(--ink);
  border: 0; border-bottom: 1px solid var(--rule); border-radius: 0;
  font: 400 17px/1.4 var(--serif);   /* 16px+ or iOS zooms the page on focus */
}
input::placeholder, textarea::placeholder { color: var(--dim); font-style: italic; }
input:focus, textarea:focus, select:focus { outline: 0; border-bottom-color: var(--accent); }
textarea { resize: vertical; min-height: 74px; }
select { font-family: var(--sans); font-size: 16px; }

.searchbar { display: flex; gap: 10px; margin-bottom: 6px; }
.searchbar input { flex: 1; }

/* ── bottom bar ─────────────────────────────────────────────────────── */

#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; background: rgba(13,11,9,.93);
  backdrop-filter: blur(16px) saturate(1.15);
  border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabs button {
  flex: 1; height: var(--tab-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; background: none; border: 0; color: var(--dim);
  font: 500 9.5px/1 var(--sans); text-transform: uppercase; letter-spacing: .13em;
}
#tabs button span { font-size: 15px; line-height: 1; }
#tabs button.on { color: var(--ink); }

/* ── sheet ──────────────────────────────────────────────────────────── */

.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; }
.sheet[hidden] { display: none; }
.sheet-bg { position: absolute; inset: 0; background: rgba(4,3,2,.7); }
.sheet-card {
  position: relative; width: 100%; max-height: 93%; overflow-y: auto;
  background: var(--bg); border-top: 1px solid var(--rule);
  border-radius: 3px 3px 0 0;
  padding: 8px 22px calc(env(safe-area-inset-bottom) + 26px);
  animation: up .24s cubic-bezier(.2,.8,.3,1);
}
@keyframes up { from { transform: translateY(16px); opacity: .5 } }
@media (prefers-reduced-motion: reduce) { .sheet-card { animation: none } }
.grip { width: 30px; height: 2px; background: var(--rule); margin: 8px auto 18px; }
.sheet-card h2 {
  margin: 0 0 6px; font-family: var(--serif); font-weight: 400;
  font-size: 30px; line-height: 1.08; letter-spacing: -.02em;
}
.sheet-card .where {
  margin: 0 0 16px; color: var(--dim);
  font: 400 11px/1.4 var(--sans); text-transform: uppercase; letter-spacing: .13em;
}

.tagline { display: flex; align-items: center; gap: 8px; margin: 0 0 18px;
           font: 500 10.5px/1 var(--sans); text-transform: uppercase; letter-spacing: .13em; }
.tagline .done-mark { color: var(--accent); }

/* ── photos ─────────────────────────────────────────────────────────── */

.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 12px; }
.shots img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--raised); display: block; }
.shots .add {
  aspect-ratio: 1; border: 1px solid var(--rule); background: none;
  color: var(--dim); font-size: 20px;
}

/* ── settings: the view picker ──────────────────────────────────────── */

.views { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 12px; }
.viewopt {
  padding: 13px 12px; background: none; color: var(--ink-2);
  border: 1px solid var(--rule); border-radius: 2px; text-align: left;
}
.viewopt b { display: block; font: 500 11px/1 var(--sans);
             text-transform: uppercase; letter-spacing: .13em; color: var(--ink); }
.viewopt span { display: block; margin-top: 5px; font-size: 11.5px; color: var(--dim); line-height: 1.45; }
.viewopt.on { border-color: var(--accent); background: rgba(217,164,65,.08); }
