:root {
  font: 100%/1.55 system-ui, -apple-system, sans-serif;
  color-scheme: light dark;
  color: var(--text);
  background: var(--canvas);
  --text: #173428;
  --canvas: #f3f6ef;
  --paper: #fff;
  --edge: #dfe7db;
  --muted: #4b6255;
  --accent: #136747;
  --masthead: #144132;
  --masthead-text: #fff;
  --control-text: #144132;
  --control-border: #768e7e;
  --selected: #e7f3e9;
  --focus: #20774c;
  --footer: #eaf0e7;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #ebf5ed;
    --canvas: #111a16;
    --paper: #192720;
    --edge: #334b3d;
    --muted: #afc2b5;
    --accent: #9ce8b7;
    --masthead: #123629;
    --masthead-text: #f2faf4;
    --control-text: #ebf5ed;
    --control-border: #6b8e7a;
    --selected: #284a39;
    --focus: #b4f4c9;
    --footer: #15241c;
  }
}

* { box-sizing: border-box; }
body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; }
a { color: var(--accent); }
button { font: inherit; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.wrap { width: min(100% - 2rem, 61rem); margin-inline: auto; }
main.wrap { flex: 1; }
.masthead { color: var(--masthead-text); background: var(--masthead); }
.masthead-inner { display: flex; align-items: center; min-height: 3.5rem; }
.brand { font-size: 1.15rem; font-weight: 750; }
.brand [lang] { font-size: .83rem; letter-spacing: .14em; margin-inline-start: .25rem; }
.page-intro { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem 1rem; padding-block: 1.6rem .4rem; }
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); line-height: 1.2; margin: 0; }
h2 { margin: 1.2rem 0 .55rem; font-size: 1.2rem; }
button { min-height: 44px; padding: .4rem .8rem; border: 1px solid var(--control-border); border-radius: .55rem; color: var(--control-text); background: var(--paper); cursor: pointer; }
button:disabled { opacity: .64; }
#refresh { display: inline-grid; place-items: center; min-width: 44px; padding: .4rem; font-size: 1.5rem; line-height: 1; }
@media (prefers-reduced-motion: no-preference) {
  #refresh[aria-busy="true"] > span { animation: refresh-spin .9s linear infinite; }
}
@keyframes refresh-spin { to { transform: rotate(1turn); } }
#status, #location-status, .empty, footer { color: var(--muted); }
#status { margin: .2rem 0; min-height: 1.55em; }
.location-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .7rem; margin-block: .35rem .2rem; }
#location-status { margin: 0; font-size: .88rem; }
#route-credit { margin: .25rem 0 0; font-size: .82rem; }
#sort-distance { display: inline-flex; align-items: center; gap: .4rem; color: var(--accent); }
#sort-distance .metadata-icon { margin: 0; }
.edition-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .55rem; margin-block: .9rem .65rem; }
.edition-toolbar h2 { margin: 0; }
.period-picker { display: inline-flex; flex-wrap: wrap; gap: .24rem; min-inline-size: 0; margin: 0; padding: .2rem; border: 1px solid var(--edge); border-radius: .65rem; background: var(--paper); }
#toggle-flyers { color: var(--accent); }
.period-option { position: relative; cursor: pointer; }
.period-option span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding-inline: .9rem; border-radius: .45rem; color: var(--muted); }
.period-option input:checked + span { background: var(--selected); color: var(--control-text); box-shadow: inset 0 0 0 1px var(--control-border); font-weight: 700; }
.period-option input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -2px; }
.editions { display: grid; gap: .65rem; }
.edition { border: 1px solid var(--edge); border-radius: .8rem; overflow: hidden; background: var(--paper); }
.store-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .55rem; padding: .35rem .9rem 0; }
.store { min-width: 0; margin: 0; font-size: 1.06rem; font-weight: 720; overflow-wrap: anywhere; }
.source-link { display: inline-flex; align-items: center; gap: .2rem; min-height: 44px; min-width: 44px; padding-inline: .2rem; font-size: .86rem; font-weight: 650; white-space: nowrap; text-underline-offset: .18em; }
.external-arrow { line-height: 1; }
.edition summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: .65rem; min-height: 44px; padding: 0 .9rem .8rem; cursor: pointer; }
.edition summary::-webkit-details-marker { display: none; }
.edition summary:focus-visible { outline-offset: -4px; }
.edition-metadata { display: grid; min-width: 0; }
.validity, .branch { display: block; color: var(--muted); font-size: .9rem; }
.branch { margin-block: .06rem .18rem; }
.metadata { display: flex; align-items: flex-start; gap: .4rem; }
.metadata > :last-child { min-width: 0; overflow-wrap: anywhere; }
.metadata-icon { display: inline-block; position: relative; flex: 0 0 1rem; width: 1rem; height: 1rem; margin-top: .15em; color: var(--muted); }
.card-address { padding-inline: .9rem; }
.map-link { width: fit-content; max-width: 100%; min-height: 44px; align-items: center; margin: 0; color: var(--accent); text-decoration: none; }
.map-link .metadata-icon { margin: 0; color: currentColor; }
.map-street { text-decoration: underline; text-underline-offset: .18em; }
.map-area { color: var(--muted); }
.metadata-icon::before, .metadata-icon::after { position: absolute; box-sizing: border-box; }
.pin-icon::before { content: ''; inset: 1px auto auto 2px; width: 11px; height: 11px; border: 1.5px solid currentColor; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.pin-icon::after { content: ''; inset: 5px auto auto 6px; width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.calendar-icon::before { content: ''; inset: 3px auto auto 1px; width: 13px; height: 12px; border: 1.5px solid currentColor; border-radius: 2px; background: linear-gradient(currentColor, currentColor) 0 3px / 100% 1px no-repeat; }
.calendar-icon::after { content: ''; inset: 1px auto auto 4px; width: 1.5px; height: 4px; background: currentColor; box-shadow: 5px 0 currentColor; }
.distance-value { display: block; padding-inline-start: 1.4rem; color: var(--accent); font-size: .87rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.view-label { flex: none; padding: .4rem .57rem; border-radius: .4rem; color: var(--accent); background: var(--selected); font-weight: 650; font-size: .88rem; }
.flyer-action { display: inline-flex; align-items: center; gap: .42rem; min-height: 44px; white-space: nowrap; }
.flyer-chevron { width: .4rem; height: .4rem; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.edition details[open] .flyer-chevron { transform: translateY(1px) rotate(225deg); }
.edition details[open] .view-label-open, .edition details:not([open]) .view-label-close { display: none; }
.pages { display: grid; gap: .45rem; padding: 0 .9rem .9rem; }
.gallery-hint { margin: 0; color: var(--muted); font-size: .86rem; }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.page { min-width: 0; }
.page a { display: block; text-decoration: none; }
.page img { display: block; width: 100%; height: auto; border: 1px solid var(--edge); border-radius: .4rem; }
.page-label { display: block; padding-block-start: .25rem; color: var(--muted); font-size: .86rem; text-align: center; }
.image-error { display: block; background: var(--canvas); color: var(--muted); padding: .6rem; border-radius: .4rem; }
[hidden] { display: none !important; }
.retailer-links { list-style: none; display: grid; gap: .65rem; padding: 0; margin: 0; }
.retailer-links > li { display: flex; align-items: center; justify-content: space-between; gap: .65rem; padding: .8rem .9rem; border: 1px solid var(--edge); border-radius: .8rem; background: var(--paper); }
.retailer-info { min-width: 0; }
.retailer-links .view-label { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.empty { margin: 0; padding: .25rem 0; }
.site-footer { margin-block-start: 1.4rem; border-block-start: 1px solid var(--edge); background: var(--footer); font-size: .88rem; padding-block: .9rem max(1rem, env(safe-area-inset-bottom)); }

@media (max-width: 35rem) {
  .wrap { width: calc(100% - 1.5rem); }
  .gallery { grid-template-columns: 1fr; }
}
