/* ───────── Buttons ───────── */
.btn {
  --btn-bg: var(--action);
  --btn-fg: var(--text-on-dark);
  --btn-bd: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-md);
  font-weight: 620;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), color var(--t-fast);
}
.btn:hover { --btn-bg: var(--action-hover); }
.btn:active { transform: scale(0.98); }
.btn svg { flex: none; }
.btn[aria-disabled="true"], .btn:disabled { opacity: 0.5; pointer-events: none; }

.btn--marigold { --btn-bg: var(--highlight); --btn-fg: var(--text); }
.btn--marigold:hover { --btn-bg: var(--highlight-strong); }
.btn--outline { --btn-bg: transparent; --btn-fg: var(--text); --btn-bd: var(--border-strong); }
.btn--outline:hover { --btn-bg: var(--surface-tint); --btn-bd: var(--text); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--text); padding-inline: 14px; }
.btn--ghost:hover { --btn-bg: var(--surface-tint); }
.btn--light { --btn-bg: var(--surface-card); --btn-fg: var(--text); }
.btn--light:hover { --btn-bg: var(--highlight-soft); }
.btn--on-dark { --btn-bg: transparent; --btn-fg: var(--text-on-dark); --btn-bd: rgba(255,255,255,.45); }
.btn--on-dark:hover { --btn-bg: rgba(255,255,255,.1); --btn-bd: var(--surface-card); }
.btn--danger { --btn-bg: transparent; --btn-fg: var(--danger); --btn-bd: #e7b8b3; }
.btn--danger:hover { --btn-bg: var(--danger-soft); }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: var(--fs-sm); }
.btn--block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: var(--r-pill);
  border: 0;
  background: transparent;
  color: inherit;
  transition: background-color var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-tint); }

.link {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; color: var(--text);
  text-decoration: underline; text-decoration-color: var(--border-strong);
  text-underline-offset: 0.25em;
  transition: text-decoration-color var(--t-fast);
  background: none; border: 0; padding: 0; cursor: pointer;
}
.link:hover { text-decoration-color: currentColor; }

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary);
  text-decoration: none;
}
.back-link:hover { color: var(--text); }
.back-link:hover svg { transform: translateX(-2px); }
.back-link svg { transition: transform var(--t-fast) var(--ease); }

/* ───────── Chips & segmented ───────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface-card);
  font-size: var(--fs-sm); font-weight: 560;
  color: var(--text);
  text-decoration: none;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast), color var(--t-fast);
}
.chip:hover { border-color: var(--text); }
.chip[aria-pressed="true"], .chip[aria-current="true"] {
  background: var(--action); border-color: var(--action); color: var(--text-on-dark);
}
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--border)); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.chip--on-editorial { background: rgba(255,255,255,.55); border-color: transparent; }
.chip--on-editorial:hover { background: var(--surface-card); border-color: var(--action); }

.segmented {
  display: inline-flex; padding: 4px; gap: 2px;
  background: var(--surface-tint); border-radius: var(--r-pill);
}
.segmented button {
  min-height: 36px; padding: 0 14px;
  border: 0; border-radius: var(--r-pill);
  background: transparent; font-size: var(--fs-sm); font-weight: 560; color: var(--text-secondary);
  display: inline-flex; align-items: center; gap: 6px;
  transition: background-color var(--t-fast), color var(--t-fast);
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface-card); color: var(--text); box-shadow: 0 1px 2px rgba(23,36,29,.12); }

/* ───────── Form controls ───────── */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 18px; }
.label { font-size: var(--fs-sm); font-weight: 620; }
.label .opt { font-weight: 400; color: var(--text-tertiary); }
.help { font-size: var(--fs-xs); color: var(--text-tertiary); }
.error-text { font-size: var(--fs-xs); color: var(--danger); font-weight: 560; display: flex; gap: 6px; align-items: center; }

.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface-card);
  font-size: 1rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-tertiary); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-tertiary); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 3px rgba(30,74,54,.18); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.textarea.serif { font-family: var(--font-sans); font-size: 1.0625rem; }
.select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%2317241d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); pointer-events: none; }
.input-icon > .input { padding-left: 44px; }

.check {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; font-size: var(--fs-sm); cursor: pointer;
}
.check input { width: 20px; height: 20px; accent-color: var(--action); margin: 0; flex: none; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-sm); font-weight: 560; min-height: 40px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  width: 42px; height: 24px; border-radius: 99px; background: var(--border-strong);
  position: relative; flex: none; transition: background-color var(--t-fast);
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface-card); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform var(--t-med) var(--ease);
}
.switch input:checked + .track { background: var(--action); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ───────── Search bar ───────── */
.searchbar {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  padding: 6px 6px 6px 18px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.searchbar:focus-within { border-color: var(--action); box-shadow: 0 0 0 4px rgba(30,74,54,.14); }
.searchbar > svg { color: var(--text-tertiary); flex: none; }
.searchbar input {
  flex: 1; min-width: 0; min-height: 44px; border: 0; background: transparent; outline: none;
  font-size: var(--fs-md); padding: 0 6px;
}
.searchbar input::placeholder { color: var(--text-tertiary); }
.searchbar input::-webkit-search-cancel-button { display: none; }
.searchbar .clear { width: 36px; height: 36px; }

/* ───────── Category label ───────── */
.cat {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--fs-sm); color: var(--text-secondary);
}
.cat::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: var(--c, var(--border)); box-shadow: inset 0 0 0 1px rgba(23,36,29,.18);
  flex: none;
}

.status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 560; }
.status--open { color: var(--success); }
.status--closed { color: var(--text-tertiary); }
.status--open::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.new-flag {
  display: inline-block; padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--highlight); color: var(--text);
  font-size: var(--fs-xs); font-weight: 650; line-height: 1.2;
}

/* ───────── Business card ───────── */
.biz-card { position: relative; display: grid; gap: 12px; align-content: start; color: inherit; text-decoration: none; }
.biz-card__media {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--r-md); background: var(--c, var(--surface-tint));
}
.biz-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms var(--ease); }
.biz-card:hover .biz-card__media img { transform: scale(1.03); }
.biz-card__media .new-flag { position: absolute; left: 12px; top: 12px; }
.biz-card__body { display: grid; gap: 4px; }
.biz-card__name { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.012em; line-height: 1.2; }
.biz-card__name a { text-decoration: none; }
.biz-card__name a::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-md); }
.biz-card:hover .biz-card__name a { text-decoration: underline; text-decoration-thickness: 1.5px; }
.biz-card__line { font-family: var(--font-sans); font-size: 1.0625rem; color: var(--text-secondary); line-height: 1.45; }
.biz-card__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: var(--fs-sm); color: var(--text-secondary); }
.biz-card a:focus-visible { outline: none; }
.biz-card:has(a:focus-visible) .biz-card__media { outline: 3px solid var(--focus); outline-offset: 3px; }

.biz-card--row { grid-template-columns: 112px 1fr; gap: 16px; align-items: center; }
.biz-card--row .biz-card__media { aspect-ratio: 1; border-radius: var(--r-sm); }
.biz-card--row .biz-card__name { font-size: var(--fs-md); }
.biz-card--row .biz-card__line { font-size: 1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ───────── Section heads ───────── */
.section { padding-block: clamp(48px, 7vw, 96px); }
.section--tight { padding-block: clamp(32px, 5vw, 64px); }
.section-head {
  display: flex; align-items: end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap;
  margin-bottom: clamp(20px, 3vw, 32px);
}
.section-head p { color: var(--text-secondary); margin-top: 8px; max-width: 46ch; }

/* ───────── Grids ───────── */
.grid-cards { display: grid; gap: 36px 24px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.grid-cards--3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }

.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr);
  gap: 24px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px;
  scrollbar-width: thin;
}
.rail > * { scroll-snap-align: start; }
@media (max-width: 720px) {
  .rail { grid-auto-columns: 78%; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); }
}

/* ───────── Date block ───────── */
.date-block {
  display: grid; place-items: center; align-content: center;
  width: 72px; min-height: 76px; padding: 8px 4px;
  border-radius: var(--r-sm); background: var(--surface-card); border: 1px solid var(--border);
  text-align: center; flex: none;
}
.date-block .m { font-size: var(--fs-xs); font-weight: 700; color: var(--text-event); }
.date-block .d { font-family: var(--font-display); font-size: 1.75rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.date-block .w { font-size: var(--fs-xs); color: var(--text-secondary); }

/* ───────── Avatar ───────── */
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-tint); }
.avatar--sm { width: 32px; height: 32px; }
.avatar--lg { width: 64px; height: 64px; }
.avatar-initials {
  display: grid; place-items: center; font-weight: 700; font-size: var(--fs-sm);
  background: var(--c, var(--surface-tint)); color: var(--text);
}

/* ───────── Empty state ───────── */
.empty {
  display: grid; justify-items: start; gap: 12px;
  padding: clamp(28px, 5vw, 48px);
  border: 1px dashed var(--border-strong); border-radius: var(--r-md);
}
.empty h3 { font-size: var(--fs-lg); }
.empty p { color: var(--text-secondary); max-width: 48ch; }

/* ───────── Toast ───────── */
.toast-region {
  position: fixed; z-index: 90; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom));
  display: grid; gap: 8px; width: min(440px, calc(100% - 32px));
  pointer-events: none;
}
@media (max-width: 860px) { .toast-region { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); } }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--text); color: var(--text-on-dark);
  font-size: var(--fs-sm); font-weight: 520;
  box-shadow: var(--shadow-pop);
  animation: toast-in var(--t-med) var(--ease);
}
.toast svg { color: var(--highlight); flex: none; }
.toast .link { color: var(--text-on-dark); margin-left: auto; white-space: nowrap; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--t-med), transform var(--t-med); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ───────── Dialog ───────── */
dialog.modal {
  width: min(560px, calc(100% - 24px));
  max-height: min(88vh, 860px);
  padding: 0; border: 0; border-radius: var(--r-lg);
  background: var(--surface-card); color: var(--text);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
dialog.modal[open] { display: flex; flex-direction: column; animation: modal-in var(--t-med) var(--ease); }
dialog.modal::backdrop { background: rgba(23, 36, 29, 0.45); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.modal__head { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 24px 24px 8px; }
.modal__head h2 { font-size: var(--fs-xl); }
.modal__head p { color: var(--text-secondary); margin-top: 6px; font-size: var(--fs-sm); }
.modal__body { padding: 12px 24px 24px; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface-card); }
@media (max-width: 560px) {
  dialog.modal { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92vh; }
  .modal__foot .btn { flex: 1; }
}
dialog.modal--wide { width: min(1080px, calc(100% - 24px)); }
dialog.modal--md { width: min(760px, calc(100% - 24px)); }
.modal__body { overflow-x: hidden; }

/* ───────── Lightbox ───────── */
dialog.lightbox {
  width: 100%; height: 100%; max-width: 100%; max-height: 100%; margin: 0;
  padding: 0; border: 0; background: rgba(12, 18, 15, 0.94); color: var(--text-on-dark);
}
dialog.lightbox[open] { display: grid; grid-template-rows: auto 1fr auto; }
.lightbox__bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
.lightbox__stage { display: grid; place-items: center; padding: 0 16px; min-height: 0; }
.lightbox__stage img { max-height: 100%; max-width: 100%; object-fit: contain; border-radius: var(--r-sm); }
.lightbox__nav { display: flex; justify-content: center; gap: 12px; padding: 16px; }
.lightbox .icon-btn { color: var(--text-on-dark); }
.lightbox .icon-btn:hover { background: rgba(255,255,255,.12); }
.lightbox__credit { font-size: var(--fs-xs); color: rgba(255,255,255,.7); }

/* ───────── Tabs (underline) ───────── */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button {
  position: relative; flex: none;
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 14px;
  border: 0; background: none; text-decoration: none;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary);
}
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs [aria-current="page"], .tabs [aria-selected="true"] { color: var(--action); }
.tabs [aria-current="page"]::after, .tabs [aria-selected="true"]::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--action);
}

/* ───────── Map ───────── */
.map {
  position: relative; overflow: hidden;
  border-radius: var(--r-md); background: #eef0f6;
  border: 1px solid var(--border);
}
.map svg.map__base { width: 100%; height: 100%; }
.map__pins { position: absolute; inset: 0; }
.map-pin {
  position: absolute; transform: translate(-50%, -100%);
  display: grid; place-items: center;
  width: 34px; height: 34px; padding: 0; border: 0; background: none;
}
.map-pin span {
  width: 22px; height: 22px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--c, var(--highlight)); border: 2px solid var(--text);
  transition: transform var(--t-fast) var(--ease);
}
.map-pin:hover span, .map-pin[aria-expanded="true"] span { transform: rotate(-45deg) scale(1.2); }
.map-pin[aria-expanded="true"] span { background: var(--text); border-color: var(--text-on-dark); }
.map-pin:focus-visible { outline: none; }
.map-pin:focus-visible span { outline: 3px solid var(--focus); outline-offset: 2px; }
.map-you {
  position: absolute; transform: translate(-50%, -50%);
  width: 18px; height: 18px; border-radius: 50%; background: var(--info);
  border: 3px solid var(--surface-card); box-shadow: 0 0 0 6px rgba(20,145,217,.22);
  pointer-events: none;
}
.map-pop {
  position: absolute; z-index: 3; width: 250px;
  transform: translate(-50%, calc(-100% - 44px));
  background: var(--surface-card); border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  padding: 10px; display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center;
  animation: modal-in var(--t-fast) var(--ease);
}
.map-pop img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--r-sm); }
.map-pop strong { display: block; font-size: var(--fs-sm); line-height: 1.25; }
.map-pop a { text-decoration: none; }
.map-pop a:hover strong { text-decoration: underline; }
.map-pop .t-small { margin-top: 2px; }
.map-pop.flip-x-left { transform: translate(-12%, calc(-100% - 44px)); }
.map-pop.flip-x-right { transform: translate(-88%, calc(-100% - 44px)); }
.map-pop.flip-y { transform: translate(-50%, 10px); }
.map-pop.flip-y.flip-x-left { transform: translate(-12%, 10px); }
.map-pop.flip-y.flip-x-right { transform: translate(-88%, 10px); }
.map__label { font-family: var(--font-display); font-size: 24px; font-weight: 700; fill: var(--slate-veil); }
.map__street { font-family: var(--font-sans); font-size: 16px; fill: var(--text-tertiary); }

/* ───────── Skeleton / loading ───────── */
.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.is-loading::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border-radius: 50%; border: 2px solid currentColor; border-color: var(--text-on-dark) var(--surface-card) transparent transparent;
  animation: spin 700ms linear infinite;
}
.btn--outline.is-loading::after, .btn--marigold.is-loading::after { border-color: var(--text) var(--text) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── Misc ───────── */
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.kbd { font-size: var(--fs-xs); border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 6px; color: var(--text-secondary); }
.progress { height: 8px; border-radius: 8px; background: var(--surface-feature); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--action); border-radius: 8px; transition: width 500ms var(--ease); }
