/* Storefront chrome — announcement bar, header + search, categories menu, drawer nav, footer, tab bar,
   auth form, login page, 404 page. Tokens only (docs/CSS_INDEX.md); light + dark come from the tokens. */

/* ───────── announcement ───────── */
.ann { background: var(--surface-2); border-bottom: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-sm); }
.ann-in { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; padding-block: 6px; padding-inline: 48px; text-align: center; }
.ann-text { margin: 0; }
.ann-text a { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.ann-x { position: absolute; inset-inline-end: 0; top: 0; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: var(--r-full); background: none; color: var(--text-3); cursor: pointer; }
.ann-x:hover { color: var(--text); }

/* ───────── header ───────── */
.site-header { position: sticky; top: 0; z-index: var(--z-header); background: var(--surface); border-bottom: 1px solid var(--border); }
.hdr { display: flex; align-items: center; gap: var(--s-2); height: var(--header-h); }
.hdr-brand { display: inline-flex; align-items: center; gap: var(--s-2); min-width: 0; color: var(--text); font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.01em; }
.hdr-brand img { flex: none; width: auto; height: 28px; max-width: 120px; object-fit: contain; }
.hdr-brand span { overflow: hidden; max-width: 200px; text-overflow: ellipsis; white-space: nowrap; }
.hdr-nav { display: none; align-items: center; gap: var(--s-1); margin-inline-start: var(--s-4); }
.hdr-link { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 var(--s-3); border: 0; border-radius: var(--r-md); background: none; color: var(--text-2); font: inherit; font-weight: 500; white-space: nowrap; cursor: pointer; }
.hdr-link:hover { background: var(--surface-2); color: var(--text); }
.hdr-link[aria-current="page"] { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--brand-600); border-radius: var(--r-md) var(--r-md) 0 0; }

.hdr-actions { display: flex; align-items: center; gap: 2px; margin-inline-start: auto; }
.hdr-btn { position: relative; display: inline-flex; flex: none; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--r-full); background: none; color: var(--text); font: inherit; cursor: pointer; }
.hdr-btn:hover { background: var(--surface-2); }
.hdr-lang { width: auto; padding-inline: var(--s-3); border-radius: var(--r-md); font-size: var(--fs-sm); font-weight: 600; }
.hdr-signin { display: none; align-items: center; gap: var(--s-2); height: 40px; margin-inline: var(--s-1); padding: 0 var(--s-3); border: 1px solid var(--border-strong); border-radius: var(--r-full); background: none; color: var(--text); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.hdr-signin:hover { background: var(--surface-2); }
.hdr-avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r-full); background: var(--brand-100); color: var(--brand-800); font-size: var(--fs-sm); font-weight: 700; }
.hdr-badge { position: absolute; top: 3px; inset-inline-end: 1px; display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full); background: var(--brand-600); color: var(--on-brand); font-size: 11px; font-weight: 700; line-height: 1; }
.hdr-desk { display: none; }

/* search: an overlay row under the bar on compact layouts (no layout shift), inline on desktop */
.hdr-search { position: absolute; inset-inline: 0; top: 100%; display: none; padding: var(--s-2) var(--s-4) var(--s-3); border-bottom: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-md); }
.hdr-search.is-open { display: block; }
.hdr-search-box { position: relative; }
.hdr-search-ico { position: absolute; top: 50%; inset-inline-start: 14px; display: inline-flex; color: var(--text-3); pointer-events: none; transform: translateY(-50%); }
.hdr-search input { width: 100%; height: 44px; padding-inline: 42px var(--s-4); border: 1px solid var(--border-strong); border-radius: var(--r-full); background: var(--surface-2); color: var(--text); font: inherit; }
.hdr-search input:focus { border-color: var(--brand-600); background: var(--surface); }
.hdr-suggest { position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 2; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-lg); }
.hdr-suggest[hidden] { display: none; }
.hdr-sug { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); color: var(--text); }
.hdr-sug:hover, .hdr-sug:focus-visible { background: var(--surface-2); }
.hdr-sug img, .hdr-sug-ph { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--text-3); object-fit: cover; }
.hdr-sug-name { flex: 1; min-width: 0; font-size: var(--fs-sm); }
.hdr-sug-price { flex: none; font-size: var(--fs-sm); font-weight: 600; }
.hdr-sug-all { display: block; padding: var(--s-3); border-top: 1px solid var(--border); color: var(--brand-700); font-size: var(--fs-sm); font-weight: 600; }
.hdr-sug-all:hover { background: var(--surface-2); }

/* categories menu (desktop) */
.hdr-cats { position: relative; }
.hdr-cat-panel { position: absolute; inset-inline-start: 0; top: calc(100% + 6px); z-index: 3; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--s-2) var(--s-4); width: min(640px, 90vw); padding: var(--s-4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-lg); }
.hdr-cat-panel[hidden] { display: none; }
.hdr-cat-col { display: flex; flex-direction: column; }
.hdr-cat-link { display: block; padding: 6px var(--s-2); border-radius: var(--r-sm); color: var(--text-2); font-size: var(--fs-sm); }
.hdr-cat-link:hover { background: var(--surface-2); color: var(--text); }
.hdr-cat-root { color: var(--text); font-weight: 600; }
.hdr-cat-all { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 6px; color: var(--brand-700); font-weight: 600; }

@media (min-width: 1100px) {
  .hdr { gap: var(--s-3); }
  .hdr-menu, .hdr-search-toggle { display: none; }
  .hdr-nav { display: flex; }
  .hdr-search { position: static; display: block; flex: 1 1 200px; max-width: 460px; margin-inline: auto var(--s-3); padding: 0; border: 0; background: none; box-shadow: none; }
  .hdr-search input { height: 40px; }
  .hdr-actions { margin-inline-start: 0; }
  .hdr-desk { display: inline-flex; }
}

/* ───────── drawer navigation ───────── */
.dnav { display: flex; flex-direction: column; gap: 2px; }
.dnav a, .dnav > button { display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 48px; padding: 0 var(--s-3); border: 0; border-radius: var(--r-md); background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.dnav a:hover, .dnav > button:hover { background: var(--surface-2); }
.dnav a[aria-current="page"] { background: var(--surface-2); font-weight: 600; }
.dnav a.dnav-sub { min-height: 40px; padding-inline-start: var(--s-10); color: var(--text-2); font-size: var(--fs-sm); }
.dnav-title { margin-top: var(--s-4); padding: var(--s-2) var(--s-3); color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.dnav-row { display: flex; gap: var(--s-2); padding: var(--s-2) var(--s-3); }
.dnav-row .btn { flex: 1; }

/* ───────── footer ───────── */
.site-footer { margin-top: var(--s-16); border-top: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.ftr { padding-block: var(--s-10) var(--s-6); }
.ftr-grid { display: grid; grid-template-columns: 1fr; gap: var(--s-8); }
.ftr-brand { color: var(--text); font-size: var(--fs-lg); font-weight: 700; }
.ftr-tag { margin: var(--s-2) 0 0; max-width: 34ch; }
.ftr h2 { margin: 0 0 var(--s-3); color: var(--text); font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.ftr .ftr-h-gap { margin-top: var(--s-6); }
.ftr ul { display: grid; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.ftr ul.ftr-contact { margin-top: var(--s-4); }
.ftr-contact li { display: flex; align-items: flex-start; gap: var(--s-2); }
.ftr-contact .icon { flex: none; margin-top: 3px; color: var(--text-3); }
.ftr a { color: var(--text-2); }
.ftr a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.ftr-social { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.ftr-social a { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--border-strong); border-radius: var(--r-full); color: var(--text); }
.ftr-social a:hover { background: var(--surface); text-decoration: none; }
.ftr-pay { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.ftr-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2) var(--s-4); margin-top: var(--s-8); padding-top: var(--s-4); border-top: 1px solid var(--border); color: var(--text-3); font-size: var(--fs-sm); }
@media (min-width: 640px) { .ftr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .ftr-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; } }

/* ───────── tab bar (mobile) ───────── */
body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.tabbar { position: fixed; inset-inline: 0; bottom: 0; z-index: var(--z-header); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--border); background: var(--surface); }
.tabbar[hidden] { display: none; }
.tab-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 44px; color: var(--text-3); font-size: 11px; font-weight: 500; }
.tab-item:hover { color: var(--text); }
.tab-item[aria-current="page"] { color: var(--brand-700); font-weight: 600; }
.tab-ico { position: relative; display: inline-flex; }
.tab-badge { position: absolute; top: -6px; inset-inline-start: 12px; display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-full); background: var(--brand-600); color: var(--on-brand); font-size: 10px; font-weight: 700; line-height: 1; }
.tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 768px) { body.has-tabbar { padding-bottom: 0; } .tabbar { display: none; } }

/* ───────── auth form (popup + login page) ───────── */
.auth { display: grid; gap: var(--s-4); }
.auth-head { text-align: center; }
.auth-title { margin: 0 0 var(--s-1); font-size: var(--fs-2xl); line-height: var(--lh-tight); }
.auth-sub { margin: 0; color: var(--text-2); }
.auth-msg:empty { display: none; }
.auth-form { display: grid; gap: var(--s-4); }
.auth-row { display: flex; justify-content: flex-end; margin-top: calc(var(--s-2) * -1); }
.auth-or { display: flex; align-items: center; gap: var(--s-3); color: var(--text-3); font-size: var(--fs-sm); }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-alt { display: grid; gap: var(--s-2); }
.auth-switch { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s-2); color: var(--text-2); font-size: var(--fs-sm); }
.auth-note { margin: 0; color: var(--text-2); }
.auth-captcha:empty { display: none; }
.auth-eye { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; background: none; color: var(--text-3); cursor: pointer; }
.auth-eye:hover { color: var(--text); }

/* ───────── login page ───────── */
.login { display: flex; justify-content: center; }
.login-card { width: 100%; max-width: 440px; padding: var(--s-6); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
@media (min-width: 640px) { .login-card { padding: var(--s-8); } }

/* ───────── 404 page ───────── */
.nf { display: flex; flex-direction: column; align-items: center; text-align: center; padding-block: var(--s-12); }
.nf-code { margin: 0; color: var(--border-strong); font-size: clamp(64px, 16vw, 120px); font-weight: 700; line-height: 1; }
.nf-text { max-width: 44ch; margin: 0; }
.nf-search { display: flex; gap: var(--s-2); width: 100%; max-width: 420px; margin-block: var(--s-6) var(--s-4); }
.nf-search .input { flex: 1; min-width: 0; }
.nf-actions { justify-content: center; }

/* ───────── small resets ───────── */
#main:focus, #main:focus-visible { outline: none; box-shadow: none; border-radius: 0; }   /* focus moves here after navigation; a ring around the whole page is noise */
.auth .btn-link, .auth-switch .btn-link, .auth-row .btn-link { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; border-radius: var(--r-sm); background: none; color: var(--brand-700); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.auth .btn-link:hover { color: var(--brand-800); }
