/* ---------- colors: light, then dark (by system setting or ?theme=dark) ---------- */
:root {
  --bg: #f5f4f1; --card: #ffffff; --text: #1d1b18; --muted: #66625b; --line: #e2dfd8;
  --accent: #b86e0e; --accent-soft: #f6ead8; --on-accent: #ffffff;
  --error: #d2463a;
  /* the light itself, the same in both themes */
  --night: #141a2e; --blue: #3463b5; --golden: #f0a43a; --day: #9cc8e6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12110f; --card: #1c1a17; --text: #efece6; --muted: #a29d94; --line: #2f2c27;
    --accent: #f2ae4b; --accent-soft: #2e2416; --on-accent: #15110b;
    --error: #ff7a6b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12110f; --card: #1c1a17; --text: #efece6; --muted: #a29d94; --line: #2f2c27;
  --accent: #f2ae4b; --accent-soft: #2e2416; --on-accent: #15110b;
  --error: #ff7a6b;
  color-scheme: dark;
}

/* ---------- page ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 760px; margin: 0 auto; padding: 40px 16px 32px; }

header { margin-bottom: 20px; }
h1 { margin: 0; font-size: 2rem; letter-spacing: -0.02em; line-height: 1.1; }
h1 span { color: var(--accent); }
.tagline { margin: 8px 0 0; color: var(--muted); }
h3 { margin: 0; font-size: 1.05rem; letter-spacing: -0.01em; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%), 0 8px 24px rgb(0 0 0 / 5%);
}
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
footer { margin-top: 18px; text-align: center; }

/* ---------- buttons and pill choices ---------- */
.btn {
  font: inherit; font-weight: 600;
  border-radius: 10px; padding: 10px 14px;
  border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .5; cursor: wait; }
@media (max-width: 440px) { .locbar .btn span { display: none; } }

.seg { display: flex; gap: 4px; flex-wrap: wrap; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: inline-block; padding: 4px 10px; font-size: 0.8rem;
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer; user-select: none;
}
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- place and options ---------- */
.locbar { display: flex; gap: 10px; }
.search { position: relative; flex: 1; min-width: 0; }
input[type="search"], input[type="date"] {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; width: 100%;
}
input[type="search"] { height: 100%; }
input[type="date"] { padding: 6px 10px; }
input:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.suggest {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: 4px; list-style: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 15%);
}
.suggest li { padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--accent-soft); }
.suggest li small { color: var(--muted); }
.suggest li.note { cursor: default; color: var(--muted); background: none; }

.opts { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-top: 14px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 0.8rem; color: var(--muted); }
.field .seg span { padding: 6px 12px; }

.place { margin: 12px 0 0; }
.place:empty { display: none; }
.place strong { color: var(--text); }
.status { margin: 10px 0 0; }
.status:empty { display: none; }
.status.error { color: var(--error); }

/* ---------- the day's light ---------- */
.next { margin: 0 0 14px; font-size: 1.15rem; font-weight: 600; }
.next small { display: block; font-size: 0.85rem; font-weight: 400; color: var(--muted); }
.timeline { position: relative; height: 28px; border-radius: 8px; overflow: hidden; }
.now-mark { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); box-shadow: 0 0 0 1px var(--card); }
.ticks { position: relative; height: 1.4em; font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ticks span { position: absolute; top: 3px; transform: translateX(-50%); white-space: nowrap; }
.ticks span:first-child { transform: none; }
@media (max-width: 560px) { .ticks .minor { display: none; } }
.legend { margin: 8px 0 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-left: 6px; }
.legend i:first-child { margin-left: 0; }
.legend i.night { background: var(--night); } .legend i.blue { background: var(--blue); }
.legend i.golden { background: var(--golden); } .legend i.day { background: var(--day); }

.halves { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
@media (max-width: 560px) { .halves { grid-template-columns: 1fr; } }
.half { background: var(--bg); border-radius: 10px; padding: 14px; }
.half h4 { margin: 0 0 8px; font-size: 0.8rem; font-weight: 500; color: var(--muted); font-family: "Geist Mono", ui-monospace, monospace; text-transform: uppercase; letter-spacing: 0.04em; }
.half dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.half dt { color: var(--muted); font-size: 0.875rem; }
.half dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.half dd .arrow { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.half .sky { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 0.875rem; }
.half .sky strong { display: block; }
.tz { margin: 12px 0 0; }

/* ---------- map ---------- */
.map { height: 360px; border-radius: 10px; border: 1px solid var(--line); z-index: 0; }
@media (max-width: 520px) { .map { height: 280px; } }
.map-note { margin: 10px 0 0; }
.key { display: inline-block; width: 18px; height: 0; border-top: 3px solid; vertical-align: 3px; margin: 0 4px 0 10px; }
.key:first-child { margin-left: 0; }
.key.rise { border-color: #f6c768; border-top-style: dashed; }
.key.set { border-color: #e2592a; }
.leaflet-container { font: inherit; }
.leaflet-tooltip.tip { font-weight: 600; padding: 2px 6px; }
/* Dark map tiles: invert the light ones and turn the hues back. */
:root[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.8) invert(1) contrast(.9) hue-rotate(180deg); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: brightness(.8) invert(1) contrast(.9) hue-rotate(180deg); }
}

/* ---------- photo spots ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.spots { margin: 0; padding: 0; list-style: none; }
.spot {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer;
}
.spot:first-child { border-top: 0; }
.spot .n { font-family: "Geist Mono", ui-monospace, monospace; font-size: 0.8rem; color: var(--muted); }
.spot .info { display: flex; flex-direction: column; min-width: 0; }
.spot .info strong { overflow-wrap: anywhere; }
.spot .links { display: flex; flex-direction: column; gap: 2px; text-align: right; white-space: nowrap; }
@media (max-width: 520px) {
  .spot { grid-template-columns: 22px 1fr; }
  .spot .links { grid-column: 2; flex-direction: row; gap: 14px; text-align: left; }
}

/* ---------- embedded in the site page (../goldenhour.html) ---------- */
.embedded body { background: transparent; }
.embedded .wrap { max-width: none; padding: 0; }
.embedded header { display: none; }
.embedded footer { margin-bottom: 4px; }
