/* Header */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--surface-a); backdrop-filter: saturate(1.4) blur(10px); transition: box-shadow .3s, transform .35s var(--ease); }
body.scrolled .topbar { box-shadow: 0 1px 0 var(--line), 0 6px 18px rgb(16 19 23 / .04); }
.topbar-in { width: min(var(--wrap), 100% - var(--pad) * 2); margin-inline: auto; height: var(--top-h); display: flex; align-items: center; gap: clamp(12px, 3vw, 40px); }
.logo { display: flex; align-items: center; gap: 8px; flex: none; text-decoration: none; }
.logo img { height: 34px; width: auto; transition: transform .5s var(--spring); }
.logo:hover img:first-child { transform: rotate(-12deg) scale(1.08); }
.topnav { display: flex; gap: 4px; }
.topnav a { position: relative; padding: 10px 12px; border-radius: 10px; text-decoration: none; font-weight: 580; font-size: var(--t-sm); color: var(--ink-2); transition: color .2s, background-color .2s; }
.topnav a:hover { background: var(--soft); color: var(--ink); }
.topnav a[aria-current]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px; border-radius: 2px; background: var(--blue); animation: grow .4s var(--ease); }
@keyframes grow { from { transform: scaleX(0); } }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.fav-link .count { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; animation: pop-in .4s var(--spring); }
@keyframes pop-in { from { transform: scale(0); } }
.btn-post { min-height: 42px; }
.account-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px 0 6px; border-radius: 999px; border: 1px solid var(--line-2); text-decoration: none; font-weight: 600; font-size: var(--t-sm); transition: border-color .2s; }
.account-btn:has(.label:only-child) { padding: 0 16px; }
.account-btn:hover { border-color: var(--ink); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--blue-soft); color: var(--blue-2); font-weight: 750; }

/* Bottom tab bar (phones) */
.tabbar { display: none; }
@media (max-width: 760px) {
  :root { --top-h: 56px; }
  .topnav, .btn-post, .account-btn .label { display: none; }
  .account-btn { padding: 0; border: 0; }
  .account-btn:has(.label:only-child) { display: none; }
  .logo-word { height: 28px !important; }
  .tabbar { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface-a); box-shadow: 0 -1px 0 var(--line); backdrop-filter: blur(10px); transition: transform .35s var(--ease); }
  body.nav-hidden .tabbar { transform: translateY(100%); }
  body.nav-hidden .topbar { transform: translateY(-100%); }
  body[data-page="listing"] .tabbar { display: none; }
  .nav-tab { position: relative; overflow: hidden; display: grid; justify-items: center; align-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; }
  .nav-tab .ic { width: 23px; height: 23px; transition: transform .35s var(--spring); }
  .nav-tab[aria-current] { color: var(--blue); }
  .nav-tab[aria-current] .ic { transform: translateY(-2px) scale(1.08); }
  .nav-post .plus { display: grid; place-items: center; width: 40px; height: 32px; border-radius: 12px; background: var(--blue); color: #fff; }
  .nav-post .plus .ic { width: 20px; height: 20px; }
  .footer { padding-bottom: calc(var(--tab-h) + 24px); }
}

/* Footer */
.footer { margin-top: 64px; background: var(--soft); }
.footer-in, .footer-bottom { width: min(var(--wrap), 100% - var(--pad) * 2); margin-inline: auto; }
.footer-in { padding: 44px 0 36px; display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); gap: 28px 40px; align-items: start; }
.footer-brand { display: grid; gap: 14px; align-content: start; }
.footer-brand p { margin: 0; color: var(--muted); font-size: var(--t-sm); line-height: 1.55; max-width: 38ch; }
.footer-col { display: grid; gap: 10px; align-content: start; }
.footer-col h2 { margin: 0 0 4px; font-size: var(--t-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); line-height: 34px; }
.footer-col a { width: fit-content; color: var(--ink-2); font-size: var(--t-sm); font-weight: 560; text-decoration: none; transition: color .2s; }
.footer-col a:hover, .footer-bottom a:hover { color: var(--blue); }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 0 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--t-xs); }
.footer-bottom a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 600; text-decoration: none; transition: color .2s; }
.footer-bottom .ic { width: 18px; height: 18px; }
body[data-page="admin"] .footer, body[data-page="catalog"].map-mode .footer { display: none; }
@media (max-width: 900px) { .footer-in { grid-template-columns: repeat(3, minmax(0, 1fr)); } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 560px) { .footer-in { grid-template-columns: 1fr 1fr; gap: 24px; } .footer-col h2 { line-height: 1.4; } }

/* Sheet: right panel on desktop, bottom sheet on phones */
.sheet { border: 0; padding: 0; margin: 0 0 0 auto; width: min(480px, 100%); max-width: 100%; height: 100dvh; max-height: 100dvh; background: transparent; overflow: visible; }
.sheet.wide { width: min(720px, 100%); }
.sheet::backdrop { background: rgb(16 19 23 / .42); animation: fade .3s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.sheet-panel { height: 100%; display: flex; flex-direction: column; background: var(--surface); box-shadow: var(--shadow-lift); }
.sheet-grab { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px 24px; }
.sheet-body { flex: 1; overflow: auto; padding: 4px 24px 28px; overscroll-behavior: contain; }
@media (max-width: 760px) {
  .sheet, .sheet.wide { margin: auto 0 0; width: 100%; height: auto; max-height: 92dvh; }
  .sheet-panel { max-height: 92dvh; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .sheet-grab { display: block; height: 22px; cursor: grab; touch-action: none; }
  .sheet-grab::before { content: ""; display: block; width: 44px; height: 5px; margin: 9px auto 0; border-radius: 3px; background: var(--line-2); }
  .sheet-head { padding: 2px 16px 10px 20px; }
  .sheet-body { padding: 4px 20px 24px; }
}
.demo-roles { display: grid; gap: 8px; margin-top: 24px; padding-top: 20px; box-shadow: 0 -1px 0 var(--line); }
.demo-roles .btn { justify-content: flex-start; }

/* Toast */
.toast { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%); display: none; align-items: center; gap: 10px; max-width: min(92vw, 480px); padding: 12px 18px; border-radius: 14px; background: var(--ink); color: #fff; font-size: var(--t-sm); font-weight: 560; box-shadow: var(--shadow-lift); }
.toast.show { display: flex; }
.toast.error { background: #8f1f19; }
.toast .ic { width: 18px; height: 18px; }
@media (max-width: 760px) { .toast { bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); } }

/* Helper button */
.helper { position: fixed; z-index: 35; right: 20px; bottom: 24px; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 18px 6px 6px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 620; font-size: var(--t-sm); box-shadow: var(--shadow-lift); transition: transform .3s var(--spring), background-color .2s; }
.helper:hover { background: var(--blue); transform: translateY(-2px); }
.helper-dot { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgb(255 255 255 / .14); }
.helper-text { display: inline-block; min-width: 9ch; transition: opacity .3s, transform .4s var(--ease); }
.helper-text.swap { opacity: 0; transform: translateY(8px); }
@media (max-width: 760px) {
  .helper {
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom));
    width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    justify-content: center;
  }
  .helper-dot { width: 100%; height: 100%; background: transparent; }
  .helper-text { display: none; }
}
/* The helper never covers contacts or the complaint button. */
body[data-page="admin"] .helper, body[data-page="post"] .helper, body[data-page="listing"] .helper { display: none; }
.burst { position: fixed; z-index: 95; pointer-events: none; }
.burst i { position: absolute; width: 9px; height: 9px; border-radius: 50% 50% 0 50%; background: currentColor; transform: translate(-50%, -50%) rotate(45deg); }
