@font-face {
  font-family: "Noto Sans Ogham";
  src: url("fonts/NotoSansOgham.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: dark light;
  --bg: #11150f;
  --bg2: #181e15;
  --card: #1c2318;
  --line: #2f3a28;
  --ink: #e9e3cf;
  --dim: #a3a88f;
  --gold: #c9a54e;
  --gold-ink: #17140a;
  --moss: #7f9a5c;
  --rust: #c0714a;
  --sky: #8fb0c4;
  --warn: #d0694f;
  --moon-lit: #efe6c8;
  --moon-dark: #262d22;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 10px;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f2ecda;
    --bg2: #ebe3cc;
    --card: #faf6ea;
    --line: #d6cba9;
    --ink: #24261c;
    --dim: #5f604c;
    --gold: #8a6414;
    --gold-ink: #fffaf0;
    --moss: #4f6b32;
    --rust: #9c4f2a;
    --sky: #3f6a85;
    --warn: #a8402a;
    --moon-lit: #fff8dd;
    --moon-dark: #c9c1a6;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--gold); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6em; }
kbd {
  font: 600 .72em/1 var(--sans);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: .15em .4em;
  color: var(--dim);
}
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

/* header */
.top {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem clamp(.8rem, 3vw, 2rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; color: var(--ink); text-decoration: none; font: 600 1.3rem var(--serif); }
.brand-mark { width: 28px; height: 28px; }
.tabs { display: flex; gap: .2rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tabs a {
  display: flex; align-items: center; gap: .4rem;
  padding: .45rem .75rem; border-radius: 999px;
  color: var(--dim); text-decoration: none; white-space: nowrap; font-size: .95rem;
}
.tabs a:hover { color: var(--ink); background: var(--bg2); }
.tabs a.on { color: var(--gold-ink); background: var(--gold); }
.tabs a.on kbd { color: var(--gold-ink); border-color: color-mix(in srgb, var(--gold-ink) 35%, transparent); }
.help-btn {
  width: 2rem; height: 2rem; border-radius: 50%; padding: 0;
  border: 1px solid var(--line); background: none; color: var(--dim); font: 600 1rem var(--sans); cursor: pointer;
  display: grid; place-items: center; flex: none;
}
.small { font-size: .82rem; }
@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: .4rem .8rem; padding-bottom: .4rem; }
  .tabs { order: 3; flex-basis: 100%; justify-content: space-between; gap: 0; }
  .tabs a { padding: .4rem .55rem; font-size: .88rem; }
  .tabs kbd { display: none; }
  .help-btn { margin-left: auto; }
}

main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: clamp(1rem, 3vw, 2rem); }
.foot { color: var(--dim); font-size: .82rem; text-align: center; padding: 1.5rem 1rem 2rem; border-top: 1px solid var(--line); }
.foot p { max-width: 60rem; margin: 0 auto; }

/* shared */
.hero { margin: .5rem 0 1.6rem; max-width: 46rem; }
.eyebrow { color: var(--dim); font-size: .85rem; letter-spacing: .02em; margin-bottom: .5rem; }
.lede { font: 1.25rem/1.45 var(--serif); color: var(--ink); }
.dim { color: var(--dim); }
.big { font: 600 1.35rem/1.25 var(--serif); margin: 0 0 .2rem; }
.lbl { display: block; color: var(--dim); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .1rem; }
.nudge { font-weight: 600; }
.section-h { margin-top: 2rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.1rem 1.2rem 1.2rem;
}
.card h2 { color: var(--gold); font-size: .85rem; font-family: var(--sans); text-transform: uppercase; letter-spacing: .1em; margin-bottom: .8rem; }
.season-card { grid-column: 1 / -1; }
.nature { margin: 0 0 1rem; padding-left: 1.1rem; }
.nature li { margin-bottom: .35rem; }
.nature li::marker { color: var(--moss); }
.ask { font-family: var(--serif); font-size: 1.08rem; }
.ask .lbl { font-family: var(--sans); }

button, .btn {
  font: 500 .92rem var(--sans); color: var(--ink);
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px;
  padding: .5rem .85rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem;
}
button:hover, .btn:hover { border-color: var(--gold); }
button.primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
button.primary kbd { color: var(--gold-ink); border-color: color-mix(in srgb, var(--gold-ink) 35%, transparent); }
button.warn { color: var(--warn); }
button.on { border-color: var(--gold); color: var(--gold); }
.btns { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .8rem; }
label.btn { margin: 0; color: var(--ink); font-size: .92rem; }
.map-hint { color: var(--dim); font-size: .8rem; margin: -.4rem 0 0; }
input, textarea, select {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: .5rem .65rem; width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); outline: none; }
label { display: block; font-size: .88rem; color: var(--dim); margin-bottom: .7rem; }
label input, label textarea { margin-top: .25rem; color: var(--ink); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.note-lbl { margin: 1rem 0 .3rem; }
.note { resize: vertical; transition: border-color .3s; }
.note.saved { border-color: var(--moss); }

/* today */
.sun-row { display: flex; gap: 2rem; margin-bottom: .6rem; }
.sun-row .big { font-size: 1.9rem; }
.moon-row { display: flex; gap: 1rem; align-items: center; }
.moon-row > div p:last-child { margin: 0; }
.moon-svg .moon-dark { fill: var(--moon-dark); }
.moon-svg .moon-lit { fill: var(--moon-lit); }
.moon-svg .moon-rim { fill: none; stroke: var(--line); stroke-width: 1.5; }
.few { display: flex; gap: 1rem; align-items: center; }
.glyph { font: 3.2rem/1 "Noto Sans Ogham", var(--serif); color: var(--gold); min-width: 3.4rem; text-align: center; }

/* wheel */
.wheel-wrap { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 820px) { .wheel-wrap { grid-template-columns: 1fr; } }
.wheel-svg { width: 100%; max-width: 400px; height: auto; display: block; margin: 0 auto; overflow: visible; }
.w-ring { fill: none; stroke: var(--line); stroke-width: 10; }
.w-done { fill: none; stroke: color-mix(in srgb, var(--moss) 55%, transparent); stroke-width: 10; stroke-linecap: round; }
.w-season { fill: var(--dim); font: italic 12px var(--serif); text-anchor: middle; dominant-baseline: middle; opacity: .8; }
.w-tick { stroke: var(--dim); stroke-width: 1; }
.w-solar { fill: var(--sky); }
.w-fire { fill: var(--rust); }
.w-label { fill: var(--ink); font: 13px var(--serif); }
.w-fest { cursor: pointer; }
.w-fest:hover .w-label, .w-fest.sel .w-label { fill: var(--gold); font-weight: 600; }
.w-fest.sel circle { stroke: var(--gold); stroke-width: 2.5; }
.w-fest.now .w-label { text-decoration: underline; text-decoration-color: var(--moss); }
.w-hand { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 3 3; }
.w-today { fill: var(--gold); stroke: var(--bg); stroke-width: 3; }
.w-hub { fill: var(--gold); }
.w-date { fill: var(--dim); font: 12px var(--sans); }
.fest-list { list-style: none; padding: 0; margin: 1.2rem 0 0; display: grid; gap: .3rem; }
.fest-list button { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 0 1rem; text-align: left; background: none; border-color: transparent; padding: .45rem .7rem; }
.fest-list button.on { background: var(--card); border-color: var(--line); }
.fl-name { font: 600 1rem var(--serif); }
.fl-date { color: var(--dim); font-size: .85rem; font-variant-numeric: tabular-nums; }
.fl-rel { grid-column: 1 / -1; color: var(--dim); font-size: .8rem; }
.fest-name { font-size: 2rem; color: var(--ink); }
.fest-detail h2.fest-name { text-transform: none; letter-spacing: -.01em; font-family: var(--serif); font-size: 2rem; color: var(--ink); margin-bottom: .2rem; }

/* moon */
.moon-hero { display: flex; gap: 2rem; align-items: center; flex-wrap: wrap; margin: .5rem 0 1rem; }
.moon-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: .4rem 1.5rem; }
.moon-list li { display: grid; grid-template-columns: 28px 1fr auto; grid-template-rows: auto auto; gap: 0 .8rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.moon-list li .moon-svg { grid-row: span 2; }
.ml-date { font-variant-numeric: tabular-nums; font-size: .9rem; }
.ml-name { grid-column: 2; font-family: var(--serif); }
.moon-list li.full .ml-name { color: var(--gold); font-weight: 600; }
.moon-list li.new .ml-name { color: var(--dim); }
.ml-rel { grid-column: 3; grid-row: 1 / span 2; color: var(--dim); font-size: .82rem; }

/* ogham */
.aicme { margin-bottom: 1.6rem; }
.aicme h3 { color: var(--dim); font-family: var(--sans); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }
.few-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: .7rem; }
.few-cell { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; display: grid; grid-template-columns: auto 1fr; gap: 0 .8rem; }
.few-cell .glyph { grid-row: span 3; font-size: 2.4rem; min-width: 2.4rem; align-self: center; }
.few-cell.today { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.fc-name { font: 600 1.05rem var(--serif); }
.fc-tree { color: var(--moss); font-size: .9rem; }
.fc-holds { color: var(--dim); font-size: .85rem; grid-column: 1 / -1; margin-top: .4rem; }
.fc-badge { position: absolute; top: .5rem; right: .6rem; background: var(--gold); color: var(--gold-ink); font-size: .7rem; font-weight: 600; border-radius: 999px; padding: .05rem .5rem; }
.few-notes { list-style: none; padding: 0; display: grid; gap: .6rem; }
.few-notes li { display: grid; grid-template-columns: 12rem 1fr; gap: 1rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line); white-space: pre-wrap; }
.fn-date { color: var(--dim); font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .few-notes li { grid-template-columns: 1fr; gap: .2rem; } }

/* sites */
.sites { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 1rem; height: calc(100vh - 9rem); min-height: 520px; }
.sites-side { display: flex; flex-direction: column; min-height: 0; }
.sites-controls { display: grid; gap: .5rem; }
.seg { display: flex; flex-wrap: wrap; gap: .3rem; }
.seg button { padding: .35rem .65rem; font-size: .82rem; border-radius: 999px; }
.sites-count { color: var(--dim); font-size: .82rem; margin: .6rem 0 .3rem; }
.site-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; border-top: 1px solid var(--line); }
.site-list button { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: .1rem .8rem; text-align: left; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; padding: .55rem .5rem; }
.site-list button:hover { background: var(--bg2); }
.site-list button.on { background: var(--card); box-shadow: inset 3px 0 0 var(--gold); }
.site-list .empty { color: var(--dim); padding: 1rem .5rem; }
.sl-name { font-family: var(--serif); }
.sl-meta { grid-column: 1; color: var(--dim); font-size: .8rem; display: flex; align-items: center; gap: .4rem; }
.sl-dist { grid-column: 2; grid-row: 1 / span 2; color: var(--dim); font-size: .82rem; font-variant-numeric: tabular-nums; align-self: center; }
.mk { font-size: .85em; margin-left: .15rem; }
.mk.star { color: var(--gold); }
.mk.want { color: var(--rust); }
.mk.seen { color: var(--moss); font-weight: 700; }
.kind-dot { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; flex: none; }
.kind-dot.g-stone { background: var(--sky); }
.kind-dot.g-barrow { background: var(--rust); }
.kind-dot.g-earth { background: var(--moss); }
.kind-dot.g-other { background: var(--dim); }
.sites-main { position: relative; min-height: 0; display: flex; flex-direction: column; gap: .8rem; }
.map { flex: 1; min-height: 320px; border-radius: var(--r); border: 1px solid var(--line); background: var(--bg2); z-index: 0; }
.site-detail { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; max-height: 48%; overflow-y: auto; }
.sd-head { display: flex; justify-content: space-between; gap: 1rem; }
.sd-head h2 { font-size: 1.4rem; margin: 0 0 .2rem; }
.x { border: 0; background: none; font-size: 1.5rem; line-height: 1; padding: .1rem .4rem; color: var(--dim); }
.visit { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.visit .two { max-width: 22rem; grid-template-columns: 1fr; }
@media (max-width: 820px) {
  .sites { grid-template-columns: 1fr; height: auto; }
  .sites-main { order: -1; }
  .map { height: 55vh; flex: none; }
  .site-list { max-height: 60vh; }
  .site-detail { max-height: none; }
}

/* the map's own bits */
.leaflet-container { font: 13px var(--sans); background: var(--bg2); }
.site-dot { stroke: var(--bg); stroke-width: 1.5; fill-opacity: .9; }
.site-dot.g-stone { fill: var(--sky); }
.site-dot.g-barrow { fill: var(--rust); }
.site-dot.g-earth { fill: var(--moss); }
.site-dot.g-other { fill: var(--dim); }
.site-dot.want { stroke: var(--rust); stroke-width: 3; }
.site-dot.visited { stroke: var(--moss); stroke-width: 3; }
.site-dot.sel { stroke: var(--gold); stroke-width: 4; }
.home-dot { fill: var(--gold); stroke: var(--gold-ink); stroke-width: 3; fill-opacity: 1; }
.tt-kind { color: #666; }
@media (prefers-color-scheme: dark) {
  .leaflet-tile-pane { filter: brightness(.72) contrast(1.1) saturate(.6) sepia(.15); }
}

/* place */
.place-form .btns { margin-top: 0; }
.danger { margin-top: 1.2rem; color: var(--dim); }
.danger summary { cursor: pointer; }
.danger p { margin: .5rem 0; }

/* help */
.help {
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r);
  max-width: 34rem; width: calc(100% - 2rem); padding: 1.4rem 1.6rem;
}
.help::backdrop { background: rgb(0 0 0 / .55); }
.help h2 { color: var(--gold); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: 0 0 1.2rem; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: var(--dim); }
.help form { text-align: right; }

#toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem);
  background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; font-size: .92rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 2000;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
