/* Community Atlas. Profile colours and fonts arrive as custom properties from the build (see :root in the page).
   Editorial layout: square corners, thin rules between items, thick rules between sections. */
:root {
  color-scheme: light;
  --bg: var(--p-bg-light, #fff);
  --ink: var(--p-text-light, #1a1a1a);
  --accent: var(--p-accent, #f7931a);
  --accent-ink: var(--p-accent-text-light, #a85a00);
  --muted: color-mix(in srgb, var(--ink) 60%, var(--bg));
  --rule: color-mix(in srgb, var(--ink) 20%, var(--bg));
  --rule-strong: var(--ink);
  --panel: color-mix(in srgb, var(--ink) 4%, var(--bg));
  --merchants: #e8860c;
  --communities: #0f766e;
  --events: #4338ca;
  --head: var(--p-font-heading, system-ui, sans-serif);
  --body: var(--p-font-body, system-ui, sans-serif);
  --gutter: clamp(1rem, 3vw, 2.75rem);
  --header: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: var(--p-bg-dark, #1a1a1a);
    --ink: var(--p-text-dark, #fff);
    --accent-ink: var(--p-accent-text-dark, #f7931a);
    --merchants: #f7931a;
    --communities: #2dd4bf;
    --events: #a5b4fc;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--p-bg-dark, #1a1a1a);
  --ink: var(--p-text-dark, #fff);
  --accent-ink: var(--p-accent-text-dark, #f7931a);
  --merchants: #f7931a;
  --communities: #2dd4bf;
  --events: #a5b4fc;
}

* { box-sizing: border-box; border-radius: 0; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 300 17px/1.6 var(--body); -webkit-text-size-adjust: 100%; }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--head); font-weight: 500; line-height: 1.15; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--bg); padding: 0.5rem 1rem; }
.muted { color: var(--muted); }

/* Small uppercase labels, as on offchain.media: category in accent colour, then grey facts. */
.kicker, .tabs a, .segmented button, .chips button, .btn, .more, .tools a, .group-title, h2.sub {
  font-family: var(--head);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.kicker { margin: 0 0 0.35rem; font-size: 0.72rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; }
.kicker .cat { color: var(--accent-ink); }

/* header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 1.5rem;
  min-height: var(--header); padding: 0 var(--gutter);
  background: var(--bg); border-bottom: 2px solid var(--rule-strong);
}
.brand { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.brand .logo { color: var(--ink); line-height: 0; }
.brand .logo svg { height: 26px; width: auto; display: block; }
.brand .sep { width: 1px; height: 26px; background: var(--rule); }
.brand .name { font: 600 1.2rem/1 var(--head); text-transform: uppercase; letter-spacing: 0.06em; text-decoration: none; white-space: nowrap; }
.tabs { display: flex; gap: 1.6rem; margin-left: auto; }
.tabs a { font-size: 0.9rem; letter-spacing: 0.08em; text-decoration: none; padding: 0.35rem 0; border-bottom: 2px solid transparent; }
.tabs a[aria-current="page"] { border-bottom-color: var(--accent); }
.tools { display: flex; align-items: center; gap: 1.1rem; font-size: 0.8rem; }
.tools a { text-decoration: none; color: var(--muted); }
.tools a:hover { color: var(--ink); }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; background: none; color: inherit; cursor: pointer; padding: 0; }

/* pages */
main:focus { outline: none; }
.page { max-width: 78rem; margin: 0 auto; padding: 2.5rem var(--gutter) 4rem; }
.page > header { margin-bottom: 2rem; }
.page > header h1 { font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 700; text-transform: uppercase; letter-spacing: 0.01em; margin: 0 0 0.4rem; }
.page > header p { margin: 0; max-width: 48rem; color: var(--muted); font-style: italic; font-size: 1.1rem; }
.page > header p a { font-style: normal; }
.section-head { display: flex; align-items: center; gap: 1.2rem; margin: 3rem 0 1rem; }
.section-head::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
h2.sub, .group-title { font-size: 0.78rem; margin: 0; }

/* map */
#view-map { position: relative; height: calc(100dvh - var(--header)); }
#map { position: absolute; inset: 0; }
/* Search bar, top left of the map. */
.map-search { position: absolute; z-index: 3; top: 10px; left: 10px; width: min(360px, calc(100% - 64px)); }
.search { position: relative; display: flex; align-items: center; gap: 0.55rem; padding: 0 0.75rem; background: var(--bg); border: 1px solid var(--rule-strong); box-shadow: 0 2px 10px rgb(0 0 0 / 0.18); }
.search:focus-within { border-color: var(--accent); }
.search-icon { display: flex; flex: none; color: var(--muted); }
.search-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: square; }
.search input { flex: 1; min-width: 0; font: 400 0.95rem var(--body); color: inherit; background: none; border: 0; padding: 0.6rem 0; }
.search input:focus { outline: none; }
.search-results { list-style: none; margin: 0; padding: 0; position: absolute; left: -1px; right: -1px; top: calc(100% + 1px); z-index: 3; background: var(--bg); border: 1px solid var(--rule-strong); max-height: 50vh; overflow: auto; }
.search-results button { display: block; width: 100%; text-align: left; font: 400 0.92rem var(--body); color: inherit; background: none; border: 0; border-bottom: 1px solid var(--rule); padding: 0.55rem 0.9rem; cursor: pointer; }
.search-results button:hover, .search-results button:focus-visible { background: var(--panel); }
.search-results .hint { padding: 0.5rem 0.9rem; font-size: 0.78rem; line-height: 1.4; color: var(--muted); }

/* Legend, bottom left: a click on a line shows or hides that layer. */
.map-legend {
  position: absolute; z-index: 2; left: 10px; bottom: 10px; padding: 0.2rem 0.55rem;
  background: color-mix(in srgb, var(--bg) 90%, transparent); border: 1px solid var(--rule); font-size: 0.78rem; line-height: 1.2;
}
.map-legend .layer { position: relative; display: flex; align-items: center; gap: 0.45rem; min-height: 24px; cursor: pointer; user-select: none; }
.map-legend .layer input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.swatch { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; background: currentColor; }
.layer-merchants .swatch { color: var(--merchants); }
.layer-communities .swatch { color: var(--communities); }
.layer-events .swatch { color: var(--events); }
.layer-count { margin-left: auto; padding-left: 0.6rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.map-legend .layer input:not(:checked) ~ .swatch { background: none; }
.map-legend .layer input:not(:checked) ~ .layer-name, .map-legend .layer input:not(:checked) ~ .layer-count { opacity: 0.45; text-decoration: line-through; }
.map-legend .layer input:focus-visible ~ .swatch { outline: 2px solid var(--accent); outline-offset: 2px; }
/* On narrow maps the open attribution spans the whole width: keep the legend above it until it folds. */
@media (max-width: 700px) { #view-map:has(.maplibregl-compact-show) .map-legend { bottom: 60px; } }
.atlas-reset { display: flex !important; align-items: center; justify-content: center; }
.atlas-reset svg { width: 18px; height: 18px; fill: none; stroke: #333; stroke-width: 2; }
.btn, .more {
  display: inline-block; margin-top: 0.6rem; padding: 0.55rem 0.9rem; font-size: 0.75rem;
  background: var(--bg); color: var(--ink); border: 1px solid var(--rule-strong); cursor: pointer;
}
.btn:hover, .more:hover { background: var(--accent); border-color: var(--accent); color: #1a1a1a; }
.maplibregl-ctrl-group { border-radius: 0 !important; }
.maplibregl-popup-content { background: var(--bg); color: var(--ink); border-radius: 0; padding: 1rem 1.1rem; border: 1px solid var(--rule); box-shadow: 0 6px 20px rgb(0 0 0 / 0.18); }
.maplibregl-popup-tip { border-top-color: var(--bg) !important; border-bottom-color: var(--bg) !important; }
.maplibregl-popup-close-button { color: var(--ink); font-size: 1.2rem; padding: 0 6px; }
.maplibregl-popup-content h3 { margin: 0 1rem 0.35rem 0; font-size: 1.15rem; }
.popup .details { display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.7rem; margin: 0.5rem 0; font-size: 0.9rem; }
.popup dt { color: var(--muted); }
.popup dd { margin: 0; overflow-wrap: anywhere; }
.popup ol.events { border: 0; }
.popup .event { grid-template-columns: 1fr; padding: 0; border: 0; }
.popup .event .thumb { margin-bottom: 0.6rem; max-width: 11rem; }

/* filters */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1.6rem; margin: 0 0 1.75rem; }
.controls input[type="search"], .controls select {
  font: 400 0.95rem var(--body); color: inherit; background: var(--bg);
  border: 0; border-bottom: 1px solid var(--rule-strong); padding: 0.5rem 0.1rem; min-height: 42px;
}
.controls input[type="search"] { flex: 1 1 16rem; }
.controls select { flex: 0 1 13rem; cursor: pointer; }
.segmented, .chips { display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; }
.segmented button, .chips button {
  font-size: 0.78rem; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 0.4rem 0; cursor: pointer;
}
.segmented button[aria-pressed="true"], .chips button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.more { display: block; margin: 2rem auto 0; }
.empty { color: var(--muted); font-style: italic; }

/* events: image (or date) on the left, kicker, title, source */
ol.events { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--rule-strong); }
.event { display: grid; grid-template-columns: 12rem 1fr; gap: 1.5rem; padding: 1.4rem 0; border-bottom: 1px solid var(--rule); }
.thumb { aspect-ratio: 16 / 9; background: var(--panel); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.logo { background: none; }
.thumb.logo img { object-fit: contain; }
.thumb.date { display: flex; flex-direction: column; align-items: center; justify-content: center; background: none; text-decoration: none; font-family: var(--head); line-height: 1; }
.thumb.date .d { font-size: 2.2rem; font-weight: 600; }
.thumb.date .m { margin-top: 0.65rem; font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-ink); }
.event h3 { margin: 0 0 0.4rem; font-size: 1.4rem; }
.event h3 a { text-decoration: none; }
.event h3 a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.event .source { margin: 0; font-size: 0.85rem; color: var(--muted); }
.planned .thumb.date .d { font-size: 1.6rem; }

/* communities and companies: logo, kicker, name, links, separated by rules */
.section-head + .grid { border-top: 0; }
.country-group .section-head { margin: 2.2rem 0 0.4rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 0 2.75rem; border-top: 2px solid var(--rule-strong); }
.community, .company { display: grid; grid-template-columns: 56px 1fr; gap: 1rem; padding: 1.3rem 0; border-bottom: 1px solid var(--rule); align-content: start; }
.logo-img, .mono { width: 56px; height: 56px; }
.logo-img { object-fit: contain; }
.mono { display: grid; place-items: center; background: var(--panel); font: 600 1.4rem var(--head); color: var(--muted); text-transform: uppercase; }
.community h3, .company h3 { margin: 0 0 0.3rem; font-size: 1.2rem; }
.community h3 a, .company h3 a { text-decoration: none; }
.community p, .company p { margin: 0.25rem 0 0; }
.community .links, .company .links { font-size: 0.85rem; }
.community .next { font-size: 0.9rem; }
.company .desc { font-size: 0.98rem; }
.notice { border-left: 3px solid var(--accent); padding: 0.4rem 0 0.4rem 0.9rem; font-size: 0.95rem; margin: 0 0 2rem; }

/* about */
.prose { max-width: 46rem; }
.prose h2 { font-size: 1.5rem; margin: 2.5rem 0 0.6rem; padding-top: 1.5rem; border-top: 2px solid var(--rule-strong); }
.prose ul { padding-left: 1.2rem; }
.prose li { margin: 0.35rem 0; }
.stat { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.9rem; }
#embed-builder { display: grid; gap: 0.8rem; }
#embed-builder .row { display: flex; flex-wrap: wrap; gap: 1.5rem; }
#embed-builder label { font-weight: 400; }
#embed-builder select { font: inherit; padding: 0.3rem; border: 0; border-bottom: 1px solid var(--rule-strong); background: var(--bg); color: inherit; }
#embed-builder textarea { width: 100%; font: 0.8rem/1.45 ui-monospace, monospace; padding: 0.7rem; border: 1px solid var(--rule); background: var(--panel); color: inherit; }
#embed-builder .btn { justify-self: start; margin: 0; }

footer.foot { border-top: 2px solid var(--rule-strong); padding: 1.3rem var(--gutter) 2.2rem; font-size: 0.85rem; color: var(--muted); }
body[data-view="map"] footer.foot { display: none; }

/* embed */
.embed { --header: 46px; }
.embed .top { position: static; border-bottom-width: 1px; }
.embed .brand .name { font-size: 0.95rem; }
.embed .page { padding: 1.2rem; }
.embed .event { grid-template-columns: 8rem 1fr; gap: 1rem; }
.embed .event h3 { font-size: 1.15rem; }

/* small screens */
@media (max-width: 860px) {
  :root { --header: 56px; }
  .top { flex-wrap: wrap; gap: 0.2rem 1rem; padding-top: 0.5rem; }
  .brand .logo, .brand .sep { display: none; }
  .tabs { order: 3; width: calc(100% + 2 * var(--gutter)); margin: 0 calc(-1 * var(--gutter)); padding: 0.2rem var(--gutter) 0.4rem; overflow-x: auto; scrollbar-width: none; gap: 1.3rem; }
  .tabs a { white-space: nowrap; }
  .tools { margin-left: auto; }
  #view-map { height: calc(100dvh - 104px); }
  .event { grid-template-columns: 7.5rem 1fr; gap: 1rem; }
  .event h3 { font-size: 1.15rem; }
  .thumb.date .d { font-size: 1.6rem; }
}

/* event page */
.event-page { max-width: 54rem; }
.crumbs { margin-bottom: 1.6rem; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a::before { content: "← "; }
.event-page h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 600; margin: 0.4rem 0 1.6rem; }
.event-picture { margin: 0 0 1.8rem; aspect-ratio: 16 / 9; max-width: 40rem; background: var(--panel); }
.event-picture img { width: 100%; height: 100%; object-fit: cover; }
.event-picture.logo { background: none; }
.event-picture.logo img { object-fit: contain; }
.facts { display: grid; grid-template-columns: 9rem 1fr; margin: 0 0 1.8rem; border-top: 2px solid var(--rule-strong); }
.facts dt, .facts dd { margin: 0; padding: 0.75rem 0; border-bottom: 1px solid var(--rule); }
.facts dt { font: 500 0.72rem/1.9 var(--head); text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.actions .btn { margin: 0; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1a1a; }
@media (max-width: 600px) { .facts { grid-template-columns: 1fr; } .facts dt { padding-bottom: 0; border: 0; } }

