@layer tokens, base, layout, components, pages, utilities;

@layer tokens {
  :root {
    color-scheme: light;
    --color-bg: oklch(96.8% 0.018 12);
    --color-bg-soft: oklch(98.6% 0.012 18);
    --color-surface: oklch(99.1% 0.007 20);
    --color-surface-2: oklch(97.1% 0.016 14);
    --color-text: oklch(21% 0.02 8);
    --color-text-soft: oklch(47% 0.028 10);
    --color-line: oklch(87% 0.022 10);
    --color-line-strong: oklch(75% 0.045 14);
    --color-brand: oklch(58% 0.175 28);
    --color-brand-strong: oklch(46% 0.155 24);
    --color-link: oklch(35% 0.15 24);
    --color-brand-soft: oklch(93.8% 0.04 24);
    --color-brand-button: oklch(43% 0.15 24);
    --color-brand-button-hover: oklch(38% 0.135 24);
    --color-brand-button-text: oklch(99% 0.003 20);
    --color-ink: oklch(17% 0.022 8);
    --color-shadow: oklch(31% 0.03 10 / 12%);
    --color-focus: oklch(72% 0.14 28);
    --font-ui: "Avenir Next", Avenir, "SF Pro Text", "Segoe UI", "Hiragino Sans", "Yu Gothic", Meiryo, system-ui, sans-serif;
    --radius-panel: 6px;
    --header-h: 4.25rem;
    --page-max: 87.5rem;
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      color-scheme: dark;
      --color-bg: oklch(18% 0.028 357);
      --color-bg-soft: oklch(21.5% 0.03 357);
      --color-surface: oklch(24.5% 0.028 358);
      --color-surface-2: oklch(28.5% 0.034 358);
      --color-text: oklch(95% 0.012 24);
      --color-text-soft: oklch(78% 0.022 18);
      --color-line: oklch(36% 0.03 2);
      --color-line-strong: oklch(48% 0.05 10);
      --color-brand: oklch(71% 0.145 26);
      --color-brand-strong: oklch(79% 0.118 28);
      --color-link: oklch(86% 0.1 26);
      --color-brand-soft: oklch(31% 0.055 0);
      --color-brand-button: oklch(68% 0.13 26);
      --color-brand-button-hover: oklch(74% 0.12 28);
      --color-brand-button-text: oklch(16% 0.022 8);
      --color-ink: oklch(97% 0.012 18);
      --color-shadow: oklch(8% 0.018 350 / 42%);
      --color-focus: oklch(76% 0.12 30);
    }
  }

  :root[data-theme="dark"] {
    color-scheme: dark;
    --color-bg: oklch(18% 0.028 357);
    --color-bg-soft: oklch(21.5% 0.03 357);
    --color-surface: oklch(24.5% 0.028 358);
    --color-surface-2: oklch(28.5% 0.034 358);
    --color-text: oklch(95% 0.012 24);
    --color-text-soft: oklch(78% 0.022 18);
    --color-line: oklch(36% 0.03 2);
    --color-line-strong: oklch(48% 0.05 10);
    --color-brand: oklch(71% 0.145 26);
    --color-brand-strong: oklch(79% 0.118 28);
    --color-link: oklch(86% 0.1 26);
    --color-brand-soft: oklch(31% 0.055 0);
    --color-brand-button: oklch(68% 0.13 26);
    --color-brand-button-hover: oklch(74% 0.12 28);
    --color-brand-button-text: oklch(16% 0.022 8);
    --color-ink: oklch(97% 0.012 18);
    --color-shadow: oklch(8% 0.018 350 / 42%);
    --color-focus: oklch(76% 0.12 30);
  }
}

@layer base {
  * { box-sizing: border-box; }
  html, body { height: 100%; }
  html:has(.locais-body--map) {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }
  html:has(.map-app[data-view="index"]) {
    height: auto;
    max-height: none;
    overflow: auto;
  }
  body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-ui);
    line-height: 1.5;
  }
  img { display: block; max-width: 100%; }
  a { color: var(--color-link); text-decoration-thickness: 1px; }
  a:hover { color: var(--color-brand); }
  :focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
  h1, h2, p { margin: 0; }
  button, input { font: inherit; }
}

@layer layout {
  .skip-link {
    position: absolute;
    left: 0.75rem;
    top: -3rem;
    z-index: 20;
    background: var(--color-surface);
    padding: 0.4rem 0.7rem;
  }
  .skip-link:focus { top: 0.75rem; }
  .locais-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-line);
    overflow-x: auto;
  }
  .locais-header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    min-height: var(--header-h);
    padding: 0.5rem 1rem;
    white-space: nowrap;
    width: 100%;
    min-width: max-content;
    max-width: var(--page-max);
    margin-inline: auto;
  }
  .locais-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: inherit;
    text-decoration: none;
    flex: 0 0 auto;
    justify-self: start;
  }
  .locais-brand img { width: 40px; height: 40px; }
  .locais-brand span { display: flex; flex-direction: column; line-height: 1.15; }
  .locais-brand small { color: var(--color-text-soft); font-size: 0.75rem; }
  .locais-nav {
    display: flex;
    gap: 1rem;
    flex: 0 0 auto;
    justify-self: center;
  }
  .locais-nav a { color: inherit; text-decoration: none; }
  .locais-nav a[aria-current="page"] { font-weight: 700; color: var(--color-brand-strong); }
  .locais-actions {
    display: flex;
    align-items: center;
    justify-self: end;
    gap: 0.5rem;
    flex: 0 0 auto;
  }
  .locais-body--page .locais-main { padding: 0; }
  .locais-body--map {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .locais-body--map .locais-header {
    position: relative;
    flex: 0 0 auto;
  }
  .locais-body--map .locais-main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .locais-body--map:has(.map-app[data-view="index"]) {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .locais-body--map:has(.map-app[data-view="index"]) .locais-main {
    flex: 0 0 auto;
    min-height: auto;
  }
}

@layer components {
  .language-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--color-line);
    background: var(--color-bg-soft);
    color: inherit;
  }
  .language-popover {
    inset: unset;
    margin: 0;
    padding: 0.45rem;
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    box-shadow: 0 10px 32px var(--color-shadow);
    max-height: min(70vh, 28rem);
    overflow: auto;
    z-index: 80;
  }
  .language-popover:not(:popover-open) {
    display: none;
  }
  .language-popover-title {
    margin: 0 0.35rem 0.35rem;
    font-size: 0.75rem;
    color: var(--color-text-soft);
  }
  .language-menu-list {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .language-menu-list a {
    display: flex;
    gap: 0.4rem;
    padding: 0.4rem 0.55rem;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
  }
  .language-menu-list a[aria-current="true"] {
    background: var(--color-brand-soft);
    font-weight: 700;
  }
  .theme-toggle {
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid var(--color-line);
    background: var(--color-bg-soft);
    color: var(--color-ink);
    cursor: pointer;
    padding: 0.35rem;
  }
  .theme-toggle svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; }
  .theme-icon { display: block; }
  .theme-icon-moon { display: none; }
  :root[data-theme="dark"] .theme-icon-sun { display: none; }
  :root[data-theme="dark"] .theme-icon-moon { display: block; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-icon-sun { display: none; }
    :root:not([data-theme="light"]) .theme-icon-moon { display: block; }
  }

  .map-app {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
  .map-dossier {
    display: grid;
    grid-template-columns: minmax(8.5rem, 12rem) minmax(0, 1fr);
    gap: 0.55rem 0.85rem;
    align-items: center;
    flex: 0 0 auto;
    padding: 0.5rem 1rem 0.45rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-line);
  }
  .map-dossier-art {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 1;
    object-fit: cover;
    background: var(--color-surface-2);
  }
  .map-dossier-copy {
    min-width: 0;
  }
  .map-dossier-copy h1 {
    font-size: 1.35rem;
    line-height: 1.12;
    color: var(--color-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .map-dossier-copy .map-lead {
    margin-top: 0.2rem;
    color: var(--color-text-soft);
    font-size: 0.92rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .map-dossier-meta {
    margin-top: 0.2rem;
    color: var(--color-text-soft);
    font-size: 0.82rem;
  }
  .map-dossier-ad {
    grid-column: 1 / -1;
    width: 100%;
    margin: 0;
    padding: 0.4rem 0 0.15rem;
    min-height: 50px;
  }
  .map-dossier-ad .adsbygoogle {
    display: block;
  }
  .map-dossier--plain {
    grid-template-columns: minmax(0, 1fr);
  }
  @media (min-width: 60rem) {
    .map-dossier {
      grid-template-columns: 12rem minmax(0, 1fr) 29.25rem;
      align-items: center;
      padding: 0.55rem 1.1rem 0.5rem;
    }
    .map-dossier-art {
      height: 100%;
      min-height: 5.4rem;
    }
    .map-dossier-copy h1 {
      font-size: 1.55rem;
    }
    .map-dossier-ad {
      grid-column: auto;
      justify-self: end;
      align-self: center;
      width: 29.25rem;
      min-width: 29.25rem;
      min-height: 3.75rem;
      padding: 0;
    }
    .map-dossier--plain {
      grid-template-columns: minmax(0, 1fr) 29.25rem;
    }
  }
  @media (min-width: 77.5rem) {
    .map-dossier {
      grid-template-columns: 12rem minmax(0, 1fr) 45.5rem;
    }
    .map-dossier-ad {
      width: 45.5rem;
      min-width: 45.5rem;
      min-height: 5.625rem;
    }
    .map-dossier--plain {
      grid-template-columns: minmax(0, 1fr) 45.5rem;
    }
  }
  .map-toolbar, .map-tabs {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 1rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-line);
    overflow-x: auto;
    white-space: nowrap;
  }
  .map-board { position: relative; z-index: 0; }
  .map-crumb {
    position: absolute;
    top: 0.7rem;
    left: 4.5rem;
    z-index: 500;
    padding: 0.28rem 0.55rem;
    border: 1px solid var(--color-line);
    background: color-mix(in oklch, var(--color-surface) 92%, transparent);
    box-shadow: 0 6px 18px var(--color-shadow);
  }
  .map-crumb a { color: inherit; text-decoration: none; }
  .map-crumb a:hover { color: var(--color-brand-strong); }
  .map-type-nav, .map-tools { display: flex; gap: 0.5rem; align-items: center; }
  .map-tools button { cursor: pointer; }
  .map-type-nav a, .map-tools button, .hub-card-types a {
    border: 1px solid var(--color-line);
    background: var(--color-bg-soft);
    color: inherit;
    text-decoration: none;
    padding: 0.3rem 0.65rem;
  }
  .map-type-nav a[aria-current="page"] {
    background: var(--color-brand-button);
    color: var(--color-brand-button-text);
    border-color: var(--color-brand-button);
  }
  .map-shell {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
  }
  .map-panel {
    flex: 0 0 18.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    min-height: 0;
    padding: 0.8rem 1rem 1rem;
    border-right: 1px solid var(--color-line);
    background: var(--color-surface);
    overflow: auto;
  }
  .map-panel-top {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
  }
  .map-search {
    flex: 1 1 auto;
    min-width: 0;
  }
  .map-search input {
    width: 100%;
    border: 1px solid var(--color-line);
    background: var(--color-bg);
    color: inherit;
    padding: 0.4rem 0.6rem;
  }
  .map-panel-close,
  .map-panel-scrim {
    display: none;
  }
  .map-progress {
    margin: 0;
    font-size: 0.82rem;
    color: var(--color-text-soft);
  }
  .map-layer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .map-layer-actions button,
  .map-filters-toggle {
    border: 1px solid var(--color-line);
    background: var(--color-bg-soft);
    color: inherit;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    min-height: 2.3rem;
  }
  .map-filters {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding-bottom: 0.5rem;
  }
  .map-cat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2rem;
    font-size: 0.9rem;
    cursor: pointer;
  }
  .map-cat input {
    width: 1rem;
    height: 1rem;
  }
  .map-cat .map-swatch {
    width: 1.4rem;
    height: 1.4rem;
    flex: 0 0 auto;
    border-radius: 50%;
    overflow: hidden;
    line-height: 0;
  }
  .map-cat .map-swatch svg {
    display: block;
    width: 100%;
    height: 100%;
  }
  .map-count {
    margin-left: auto;
    color: var(--color-text-soft);
    font-size: 0.78rem;
  }
  .map-filters-toggle {
    display: none;
    position: absolute;
    top: 0.7rem;
    left: 3.75rem;
    z-index: 1100;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--color-line);
    background: var(--color-surface);
    color: var(--color-ink);
    font-weight: 700;
    padding: 0.38rem 0.75rem;
    min-height: 2.4rem;
    box-shadow: 0 8px 22px var(--color-shadow);
  }
  .map-filters-toggle svg {
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .map-tools input {
    border: 1px solid var(--color-line);
    background: var(--color-bg);
    color: inherit;
    padding: 0.35rem 0.55rem;
    min-width: 12rem;
  }
  .map-tabs {
    gap: 0;
    justify-content: center;
    padding: 0 1rem;
  }
  .map-tabs button {
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: inherit;
    min-height: 2.4rem;
    padding: 0 0.9rem;
    cursor: pointer;
    margin-bottom: -1px;
  }
  .map-tabs button[aria-selected="true"] {
    font-weight: 700;
    border-bottom-color: var(--color-brand);
    color: var(--color-brand-strong);
  }
  .map-stage {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    position: relative;
  }
  .map-board:not([hidden]),
  .map-index:not([hidden]) {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }
  .map-canvas {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    background: #f4efe4;
  }
  .map-index {
    overflow: auto;
    background: var(--color-bg-soft);
    padding: 1rem max(1rem, calc((100% - var(--page-max)) / 2));
  }
  .map-app[data-view="index"] {
    flex: 0 0 auto;
    width: 100%;
  }
  .map-app[data-view="index"] .map-shell {
    flex: 0 0 auto;
    width: 100%;
    min-height: 0;
    overflow: visible;
    height: auto;
  }
  .map-app[data-view="index"] .map-stage {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    overflow: visible;
    height: auto;
  }
  .map-app[data-view="index"] .map-index {
    overflow: visible;
    height: auto;
    min-height: 0;
  }
  .map-app[data-view="index"] .map-panel {
    position: sticky;
    top: 0;
    align-self: flex-start;
    max-height: 100dvh;
  }
  .locais-body--map:not(:has(.map-app[data-view="index"])) .locais-main > .site-footer {
    display: none;
  }
  .locais-body--map:has(.map-app[data-view="index"]) .locais-main > .site-footer {
    display: block;
    width: 100%;
    margin-top: 0;
  }
  .map-index > header {
    display: grid;
    gap: 0.45rem;
  }
  .map-index > header h2 {
    font-size: 1.45rem;
    color: var(--color-ink);
  }
  .map-index > header p {
    color: var(--color-text-soft);
  }
  .map-index [data-index-count] {
    font-size: 0.85rem;
  }
  .map-index-list { list-style: none; margin: 0.9rem 0 0; padding: 0; display: grid; gap: 0.75rem; }
  @media (min-width: 64rem) {
    .map-index-list {
      grid-template-columns: 1fr 1fr;
      gap: 0.85rem 0.9rem;
    }
  }
  .map-index-row {
    display: grid;
    gap: 0.45rem;
    padding: 0.7rem 0.8rem 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-line);
  }
  .map-index-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
  }
  .map-index-go {
    border: 0;
    background: none;
    color: var(--color-brand-strong);
    cursor: pointer;
    padding: 0;
    font-weight: 700;
    text-align: left;
    min-width: 0;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.14em;
  }
  .map-index-go:hover,
  .map-index-go:focus-visible {
    color: var(--color-brand);
  }
  .map-index-thumb {
    position: relative;
    width: 5.6rem;
    height: 2.85rem;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid var(--color-line);
    background-color: var(--color-surface-2);
    background-image:
      repeating-linear-gradient(
        -32deg,
        color-mix(in oklch, var(--color-surface) 70%, transparent) 0 7px,
        color-mix(in oklch, var(--color-brand-soft) 78%, transparent) 7px 14px
      ),
      url("https://cdn.skdesu.com/locals/photos/onsens/ginzan.webp");
    background-size: auto, cover;
    background-position: 0 0, center;
  }
  .map-index-thumb--locker {
    background-image:
      repeating-linear-gradient(
        -32deg,
        color-mix(in oklch, var(--color-surface) 70%, transparent) 0 7px,
        color-mix(in oklch, var(--color-brand-soft) 78%, transparent) 7px 14px
      ),
      url("https://cdn.skdesu.com/locals/photos/coin-lockers/locker-11.webp");
  }
  .map-index-thumb::after {
    content: "ゆ";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-text-soft);
    opacity: 0.42;
    pointer-events: none;
  }
  .map-index-thumb--locker::after {
    content: "";
    display: block;
    inset: auto;
    top: 50%;
    left: 50%;
    width: 1.15rem;
    height: 1.45rem;
    margin: -0.72rem 0 0 -0.58rem;
    border: 2px solid var(--color-text-soft);
    border-radius: 0.15rem;
    box-shadow: inset 0.45rem 0.35rem 0 -0.32rem var(--color-text-soft);
    opacity: 0.4;
  }
  .map-index-thumb--castle {
    background-image:
      repeating-linear-gradient(
        -32deg,
        color-mix(in oklch, var(--color-surface) 70%, transparent) 0 7px,
        color-mix(in oklch, var(--color-brand-soft) 78%, transparent) 7px 14px
      ),
      url("https://cdn.skdesu.com/locals/photos/castles/himeji.webp");
  }
  .map-index-thumb--castle::after {
    content: "城";
  }
  .map-index-thumb--park {
    background-image:
      repeating-linear-gradient(
        -32deg,
        color-mix(in oklch, var(--color-surface) 70%, transparent) 0 7px,
        color-mix(in oklch, var(--color-brand-soft) 78%, transparent) 7px 14px
      ),
      url("https://cdn.skdesu.com/locals/photos/amusement-parks/tokyo-disneysea.webp");
  }
  .map-index-thumb--park::after {
    content: "園";
  }
  .map-index-thumb img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.18s ease;
  }
  .map-index-thumb img.is-ready {
    opacity: 1;
  }
  .place-facts {
    display: grid;
    gap: 0;
    margin: 0.15rem 0 0;
  }
  .place-facts div {
    display: grid;
    grid-template-columns: 7.2rem minmax(0, 1fr);
    gap: 0.65rem;
    padding: 0.28rem 0;
    border-bottom: 1px solid var(--color-line);
    min-width: 0;
  }
  .place-facts dt {
    color: var(--color-text-soft);
    font-size: 0.78rem;
  }
  .place-facts dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .place-facts a { color: var(--color-link); }
  .map-index-row .place-facts div {
    grid-template-columns: 6.4rem minmax(0, 1fr);
    padding: 0.2rem 0;
  }
  .map-index-row .place-facts div:last-child {
    border-bottom: 0;
  }
  .map-status {
    position: absolute;
    left: 1rem;
    bottom: 1rem;
    margin: 0;
    padding: 0.4rem 0.65rem;
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    z-index: 500;
  }
  .locais-pin-wrap, .locais-you-wrap {
    background: none;
    border: 0;
    overflow: visible;
  }
  .locais-pin {
    display: block;
    width: 44px;
    height: 58px;
    filter: drop-shadow(0 3px 5px var(--color-shadow));
  }
  .locais-pin-svg { width: 44px; height: 58px; display: block; }
  .locais-pin-body { fill: var(--color-brand); }
  .locais-pin-door { fill: #fff6f0; stroke: #5a1f24; stroke-width: 1.2; }
  .locais-pin-split { stroke: #b42318; stroke-width: 1.2; }
  .locais-pin-slot { fill: #5a1f24; }
  .locais-pin-key { fill: #b42318; }
  .locais-pin-yu {
    fill: #1f1714;
    font-weight: 700;
    text-anchor: middle;
    font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  }
  .locais-pin--region {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    border: 3px solid var(--color-surface);
    background: var(--color-brand);
    box-shadow: 0 2px 8px var(--color-shadow);
  }
  .locais-you {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
  }
  .locais-you span {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: #2a6fdb;
    border: 3px solid #fff;
    box-shadow: 0 0 0 6px rgb(42 111 219 / 28%);
  }
  .map-locate-wrap { border: 0; background: none; }
  .map-locate {
    width: 2.15rem;
    height: 2.15rem;
    border: 2px solid var(--color-line-strong);
    background: var(--color-surface);
    color: var(--color-ink);
    cursor: pointer;
    padding: 0.28rem;
  }
  .map-locate svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; }
  .map-popup-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-height: calc(100cqh - 2.8rem);
  }
  .map-popup-media {
    position: relative;
    overflow: hidden;
    flex: 0 0 auto;
    line-height: 0;
    border-radius: 12px 12px 0 0;
    clip-path: inset(0 round 12px 12px 0 0);
  }
  .map-popup-photo {
    box-sizing: border-box;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 1;
    max-height: min(7.25rem, 22cqh);
    object-fit: cover;
    display: block;
    border: 0;
    border-radius: 12px 12px 0 0;
    background: var(--color-surface-2);
  }
  .map-popup-main {
    display: grid;
    gap: 0.35rem;
    padding: 0.55rem 0.85rem 0.4rem;
    min-width: 0;
    min-height: 0;
    overflow: auto;
  }
  .map-popup-body > .map-popup-main:last-child {
    padding-bottom: 0.75rem;
  }
  .map-popup-credit {
    position: absolute;
    left: 0.4rem;
    bottom: 0.4rem;
    z-index: 1;
    margin: 0;
    padding: 0.12rem 0.38rem;
    font-size: 0.62rem;
    line-height: 1.25;
    color: #fff;
    background: rgb(0 0 0 / 72%);
    pointer-events: none;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 0.8rem);
  }
  .map-popup-look { color: var(--color-text-soft); font-size: 0.82rem; }
  .map-popup-meta {
    margin: 0;
    font-size: 0.82rem;
  }
  .map-popup-phone a { color: inherit; }
  .map-popup-actions {
    display: flex;
    flex-wrap: wrap;
    flex: 0 0 auto;
    gap: 0.45rem;
    margin: 0;
    padding: 0 0.85rem 0.75rem;
  }
  .map-popup-route {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--color-line);
    background: var(--color-brand-button);
    color: var(--color-brand-button-text);
    text-decoration: none;
    padding: 0.35rem 0.7rem;
    min-height: 2.2rem;
  }
  .map-popup-route svg {
    width: 1.05rem;
    height: 1.05rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
  }
  .map-popup-maps {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--color-line-strong);
    background: var(--color-bg-soft);
    color: var(--color-ink);
    text-decoration: none;
    padding: 0.35rem 0.7rem;
    min-height: 2.2rem;
  }
  .map-about-path { margin-top: 0.75rem; }
}

@layer pages {
  .hub-page {
    display: grid;
    gap: 1.35rem;
    width: min(var(--page-max), 100%);
    margin-inline: auto;
  }
  .hub-hero {
    display: grid;
    gap: 0.65rem;
    padding: 1.25rem 1rem 0;
  }
  .hub-kicker {
    color: var(--color-brand-strong);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.8rem;
  }
  .hub-hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1.15; color: var(--color-ink); }
  .hub-shelf-title {
    font-size: 1.35rem;
    color: var(--color-ink);
    padding: 0 1rem;
  }
  .hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
    gap: 1.25rem;
    padding: 0 1rem;
  }
  .hub-map-card {
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    transition: border-color 0.16s ease, transform 0.16s ease;
  }
  .hub-map-card:hover,
  .hub-map-card:focus-visible {
    border-color: var(--color-brand);
    transform: translateY(-2px);
  }
  .hub-map-card:hover h2,
  .hub-map-card:focus-visible h2 {
    color: var(--color-brand-strong);
  }
  .hub-map-card-media {
    display: block;
    overflow: hidden;
    min-height: 0;
    background:
      repeating-linear-gradient(
        -32deg,
        var(--color-surface-2) 0 10px,
        var(--color-brand-soft) 10px 20px
      );
  }
  .hub-map-card-media img {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 1;
    object-fit: cover;
  }
  .hub-map-card-body {
    display: grid;
    gap: 0.35rem;
    padding: 1rem 1.15rem 1.25rem;
  }
  .hub-map-card-body .kicker {
    color: var(--color-text-soft);
    font-size: 0.78rem;
  }
  .hub-map-card-body h2 {
    font-size: 1.25rem;
    line-height: 1.2;
    color: var(--color-ink);
  }
  .hub-map-card-body p { color: var(--color-text); }
  .locais-body--page .site-footer {
    margin-top: 2.5rem;
  }
  .site-footer {
    border-top: 1px solid var(--color-line);
    background:
      linear-gradient(180deg, color-mix(in oklch, var(--color-surface) 90%, transparent), var(--color-surface-2)),
      radial-gradient(circle at 12% 20%, color-mix(in oklch, var(--color-brand-soft) 48%, transparent), transparent 20rem);
  }
  .footer-inner {
    width: min(var(--page-max), calc(100% - 2rem));
    margin-inline: auto;
    display: grid;
    grid-template-columns: minmax(18rem, 0.9fr) minmax(0, 1.1fr);
    gap: clamp(2rem, 6vw, 3rem);
    padding: 2.5rem 0 calc(1.25rem + env(safe-area-inset-bottom, 0px));
  }
  .footer-brand {
    display: grid;
    align-content: start;
    gap: 1.25rem;
    min-width: 0;
  }
  .footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    width: max-content;
    text-decoration: none;
    color: inherit;
  }
  .footer-logo img {
    width: 3.625rem;
    height: 3.625rem;
  }
  .footer-logo span {
    color: var(--color-ink);
    font-size: 1.25rem;
    font-weight: 950;
  }
  .site-footer p {
    color: var(--color-text-soft);
    font-size: 1rem;
    line-height: 1.65;
  }
  .footer-utility {
    display: grid;
    gap: 0.75rem;
    min-width: 0;
  }
  .footer-search {
    display: grid;
    gap: 0.4rem;
    min-width: 0;
  }
  .footer-search label {
    color: var(--color-text-soft);
    font-size: 0.9rem;
    font-weight: 800;
  }
  .footer-search div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
    min-width: 0;
  }
  .footer-search input {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--color-line);
    background: var(--color-surface);
    color: var(--color-text);
    padding: 0.85rem 1rem;
  }
  .footer-search button {
    border: 0;
    background: var(--color-brand-button);
    color: var(--color-brand-button-text);
    font-weight: 900;
    padding: 0.85rem 1.1rem;
    cursor: pointer;
  }
  .footer-search button:hover {
    background: var(--color-brand-button-hover);
  }
  .footer-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.75rem;
  }
  .footer-nav div {
    display: grid;
    align-content: start;
    gap: 0.75rem;
    min-width: 0;
  }
  .footer-nav strong {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid color-mix(in oklch, var(--color-brand) 14%, var(--color-line));
    color: var(--color-ink);
    font-size: 0.9rem;
    font-weight: 950;
  }
  .footer-nav a {
    color: var(--color-text-soft);
    font-weight: 750;
    text-decoration: none;
    min-width: 0;
  }
  .footer-social {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
  }
  .footer-social a {
    display: inline-grid;
    place-items: center;
    width: 2.55rem;
    height: 2.55rem;
    border: 1px solid var(--color-line);
    background: var(--color-surface);
    color: var(--color-brand-strong);
    text-decoration: none;
  }
  .footer-social svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: currentColor;
  }
  .footer-social a:hover {
    border-color: var(--color-brand);
    background: var(--color-brand-soft);
  }
  .footer-bottom {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    align-items: center;
    justify-content: space-between;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-line);
  }
  .footer-bottom p {
    font-size: 0.9rem;
  }
  .footer-legal {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
  }
  .footer-legal a {
    color: var(--color-text-soft);
    font-size: 0.9rem;
    font-weight: 750;
    text-decoration: none;
  }
  .site-footer a:hover {
    color: var(--color-brand-strong);
  }
  @media (max-width: 64rem) {
    .footer-inner {
      grid-template-columns: minmax(0, 1fr);
      gap: 1.75rem;
      padding-block: 2rem 1rem;
    }
  }
  @media (max-width: 40rem) {
    .footer-search div {
      grid-template-columns: minmax(0, 1fr);
    }
    .footer-search input,
    .footer-search button {
      width: 100%;
    }
    .footer-nav {
      grid-template-columns: minmax(0, 1fr);
      gap: 1.25rem 1rem;
    }
    .footer-bottom {
      align-items: flex-start;
      flex-direction: column;
    }
  }
}

@layer utilities {
  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  @media (max-width: 840px) {
    .map-tools input { min-width: 8rem; }
    .map-crumb { display: none; }
    .map-filters-toggle { left: 3.75rem; }
    .map-panel {
      position: absolute;
      z-index: 1050;
      inset: 0 auto 0 0;
      width: min(22rem, 92vw);
      transform: translateX(-105%);
      box-shadow: 8px 0 24px var(--color-shadow);
    }
    .map-app.is-panel .map-panel { transform: none; }
    .map-panel-close {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 2.3rem;
      height: 2.3rem;
      border: 1px solid var(--color-line);
      background: var(--color-bg-soft);
      color: inherit;
      cursor: pointer;
      flex: 0 0 auto;
    }
    .map-panel-scrim {
      position: absolute;
      inset: 0;
      z-index: 1040;
      margin: 0;
      padding: 0;
      border: 0;
      background: oklch(0% 0 0 / 55%);
      cursor: pointer;
    }
    .map-app.is-panel .map-panel-scrim { display: block; }
    .map-filters-toggle { display: inline-flex; align-items: center; }
    .map-app.is-panel .map-filters-toggle { display: none; }
    .map-app[data-view="index"] .map-panel {
      position: absolute;
      top: 0;
      align-self: auto;
      max-height: none;
    }
  }
  @media (pointer: coarse) {
    .map-cat { min-height: 2.4rem; }
    .map-cat input { width: 1.1rem; height: 1.1rem; }
  }
  @media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; }
    .hub-map-card,
    .hub-map-card:hover,
    .hub-map-card:focus-visible { transform: none; }
  }
}

/* Fora de @layer: o CSS do Leaflet não usa camadas, então só assim o fundo e a costura vencem. */
.map-canvas,
.leaflet-container {
  background: #f4efe4;
  font-family: var(--font-ui);
}
.map-canvas {
  container-type: size;
}
.map-board .leaflet-container {
  width: 100%;
  height: 100%;
}
.leaflet-container .leaflet-tile-pane img.leaflet-tile {
  mix-blend-mode: normal;
  width: 257px !important;
  height: 257px !important;
}
.leaflet-control-attribution {
  display: none !important;
}
.leaflet-container a {
  color: var(--color-link);
}
.leaflet-container a:hover {
  color: var(--color-brand);
}
.leaflet-container a.leaflet-popup-close-button,
.leaflet-container a.leaflet-popup-close-button:hover {
  color: var(--color-ink);
}
.leaflet-container a.map-popup-route,
.leaflet-container a.map-popup-route:hover {
  color: var(--color-brand-button-text);
}
.leaflet-container a.map-popup-maps,
.leaflet-container a.map-popup-maps:hover {
  color: var(--color-ink);
}
.leaflet-container .place-facts a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}
.map-popup .leaflet-popup-content-wrapper {
  box-sizing: border-box;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  border-radius: 12px;
  width: min(24rem, calc(100vw - 2rem));
  max-height: calc(100cqh - 2.8rem);
}
.map-popup .leaflet-popup-content {
  box-sizing: border-box;
  width: 100% !important;
  margin: 0 !important;
  overflow: hidden;
}
.map-popup-body,
.map-popup-main,
.map-popup .place-facts {
  min-width: 0;
}
.map-popup a.leaflet-popup-close-button {
  top: 0.4rem;
  right: 0.4rem;
  width: 1.75rem;
  height: 1.75rem;
  font-size: 1.15rem;
  line-height: 1.75rem;
  border-radius: 999px;
  background: color-mix(in oklch, var(--color-surface) 88%, transparent);
}
@media (max-width: 840px) {
  .map-popup .leaflet-popup-content-wrapper {
    width: calc(100vw - 1.15rem);
  }
  .map-popup a.leaflet-popup-close-button {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.45rem;
    line-height: 2.5rem;
  }
}
