/* Allfresh storefront — layout modelled on officemix.ge (clean white, navy + green, 4px radius) */

:root {
  --navy: #002741;
  --navy-2: #0a3a5c;
  --green: #8dc63f;
  --green-dark: #6fa52a;
  --price: hsl(25, 100%, 50%);
  --sale: #e53935;
  --text: #222;
  --muted: #777;
  --line: #e6e6e6;
  --bg: #fff;
  --bg-soft: #f6f7f8;
  --radius: 4px;
  --shadow: 0 4px 18px rgba(0, 39, 65, .08);
  --font: "Noto Sans Georgian", "DejaVu Sans", Arial, sans-serif;

  /* Colour roles. Dark mode (bottom of this file) only changes these values. */
  color-scheme: light;
  --surface: #fff;               /* header, cards, inputs */
  --photo-bg: #fff;              /* plate behind product photos (they have white backgrounds) */
  --heading: var(--navy);        /* headings, brand names, hovered links */
  --btn: var(--navy);            /* button background */
  --btn-hover: var(--navy-2);
  --outline: var(--navy);        /* search box border, focus and outlined buttons */
  --field-line: #ccc;            /* input borders */
  --line-2: #ddd;
  --line-hover: #d4d4d4;
  --text-2: #555;
  --text-3: #444;
  --text-4: #666;
  --faint: #999;
  --faint-2: #aaa;
  --faint-3: #bbb;
  --hero-text: #456;
  --hero-bg: linear-gradient(135deg, #e9f6dc 0%, #d7f0ee 100%);
  --ok-bg: #f4fbec;              /* selected payment option */
  --sale-text: var(--sale);      /* red text (errors, remove hover) */
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.grid > *, .hero > *, .catalog > *, .cart > *, .pdp > *, .intro > *, .perks > * { min-width: 0; }

/* ---------- Top bar ---------- */
.topbar { background: var(--bg-soft); border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.topbar__inner { display: flex; justify-content: space-between; align-items: center; height: 34px; }
.topbar__left, .topbar__right { display: flex; gap: 20px; align-items: center; }
.topbar a:hover { color: var(--heading); }
.lang-btn { border: 1px solid var(--field-line); background: var(--surface); border-radius: var(--radius); padding: 2px 8px; font-size: 12px; font-weight: 600; }
.lang-btn:hover { border-color: var(--outline); color: var(--heading); }

/* ---------- Header ---------- */
.header { background: var(--surface); position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--line); }
.header__inner { display: flex; align-items: center; gap: 24px; height: 76px; }
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo__mark { width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg, var(--green), #3bb3a8); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 22px; }
.logo__text { font-size: 24px; letter-spacing: 1px; color: var(--heading); font-weight: 500; }
.logo__text b { color: var(--green-dark); font-weight: 700; }
/* Logo image (img/logo.png, 1360x652). Height drives the size; width follows the aspect ratio. */
.logo__img { display: block; height: 58px; width: auto; }
.logo--light .logo__img { height: 64px; background: #fff; border-radius: var(--radius); padding: 4px 8px; }
.logo--light .logo__text { color: #fff; }
.logo--light .logo__text b { color: var(--green); }

.search { flex: 1; display: flex; max-width: 620px; border: 2px solid var(--outline); border-radius: var(--radius); overflow: hidden; }
.search input { flex: 1; border: 0; padding: 10px 14px; outline: none; min-width: 0; }
.search button { border: 0; background: var(--btn); color: #fff; padding: 0 18px; font-size: 16px; }
.search button:hover { background: var(--btn-hover); }

.cart-btn { display: flex; align-items: center; gap: 10px; margin-left: auto; padding: 6px 12px; border-radius: var(--radius); }
.cart-btn:hover { background: var(--bg-soft); }
.cart-btn__icon { position: relative; font-size: 26px; }
.cart-btn__count { position: absolute; top: -6px; right: -10px; background: var(--price); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.cart-btn__text { display: flex; flex-direction: column; line-height: 1.2; }
.cart-btn__text small { color: var(--muted); font-size: 12px; }
.cart-btn__text b { color: var(--heading); }
.burger { display: none; border: 0; background: none; font-size: 24px; color: var(--heading); }

/* ---------- Nav ---------- */
.nav { background: var(--navy); color: #fff; }
.nav__inner { display: flex; align-items: center; height: 46px; gap: 4px; }
.nav a { padding: 0 14px; height: 46px; display: flex; align-items: center; font-size: 13.5px; white-space: nowrap; transition: background .15s; }
.nav a:hover, .nav a.active { background: rgba(255, 255, 255, .1); }
.nav__all { background: var(--green-dark); font-weight: 600; }
.nav a.nav__all:hover { background: var(--green); }
.nav__cats { display: flex; }
/* Main category + dropdown of its subcategories (desktop: opens on hover/focus). */
.nav__item { position: relative; }
.nav__item.has-sub > a::after { content: "▾"; margin-left: 6px; font-size: 10px; opacity: .7; }
.nav__sub { display: none; position: absolute; top: 100%; left: 0; z-index: 50; min-width: 220px; background: var(--navy-2); box-shadow: var(--shadow); border-radius: 0 0 var(--radius) var(--radius); }
.nav__sub a { height: 40px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.nav__sub a:last-child { border-bottom: 0; }
.nav__item:hover > .nav__sub, .nav__item:focus-within > .nav__sub { display: block; }
.nav__pages { display: flex; margin-left: auto; }
.nav__sale { color: #ffc56b; font-weight: 600; }

/* ---------- Generic ---------- */
main#app { min-height: 60vh; padding-top: 24px; padding-bottom: 48px; }
.section { margin-top: 40px; }
.section__head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--line); margin-bottom: 18px; }
.section__head h2 { margin: 0; padding-bottom: 10px; font-size: 20px; color: var(--heading); border-bottom: 2px solid var(--green); margin-bottom: -2px; }
.section__head a { color: var(--heading); font-size: 13px; font-weight: 600; }
.section__head a:hover { color: var(--green-dark); }
.page-title { font-size: 24px; color: var(--heading); margin: 0 0 18px; }
.breadcrumbs { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.breadcrumbs a:hover { color: var(--heading); text-decoration: underline; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: var(--radius); padding: 10px 18px; font-weight: 600; font-size: 14px; background: var(--btn); color: #fff; transition: background .15s; }
.btn:hover { background: var(--btn-hover); }
.btn--green { background: var(--green-dark); }
.btn--green:hover { background: var(--green); }
.btn--ghost { background: var(--surface); color: var(--heading); border: 1px solid var(--outline); }
.btn--ghost:hover { background: var(--bg-soft); }
.btn--block { width: 100%; }
.price { color: var(--price); font-weight: 700; font-size: 18px; }
.price small { font-size: 12px; font-weight: 600; }
.old-price { color: var(--muted); text-decoration: line-through; font-size: 13px; margin-left: 6px; }
.empty { text-align: center; padding: 60px 0; color: var(--muted); }
.empty .btn { margin-top: 16px; }

/* ---------- Hero (officemix-style: big tile + category tiles) ---------- */
.hero { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 210px 210px; gap: 14px; }
.tile { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--bg-soft); display: flex; flex-direction: column; justify-content: flex-end; padding: 18px; transition: box-shadow .2s, transform .2s; border: 1px solid var(--line); }
.tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.tile img { position: absolute; right: 10px; top: 10px; width: 50%; height: 58%; object-fit: contain; mix-blend-mode: multiply; }
.tile h3 { position: relative; margin: 0; font-size: 16px; color: var(--heading); }
.tile > span:not(.btn):not(.badge) { position: relative; font-size: 12px; color: var(--muted); }
.tile--wide { grid-column: span 2; }
/* Category with its own uploaded photo: full-bleed cover image, title over a dark fade. */
.tile--photo img { inset: 0; width: 100%; height: 100%; object-fit: cover; mix-blend-mode: normal; }
.tile--photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 39, 65, .78) 0%, rgba(0, 39, 65, 0) 60%); }
.tile--photo h3, .tile--photo > span:not(.btn):not(.badge) { z-index: 1; color: #fff; }
.tile--main { grid-row: span 2; background: var(--hero-bg); padding: 36px; justify-content: center; }
.tile--main img { width: 46%; height: 80%; top: 10%; right: 4%; }
.tile--main h1 { position: relative; font-size: 32px; line-height: 1.25; color: var(--heading); margin: 0 0 12px; max-width: 55%; }
.tile--main p { position: relative; color: var(--hero-text); max-width: 50%; margin: 0 0 20px; }
.tile--main .badge { position: relative; align-self: flex-start; background: var(--sale); color: #fff; font-weight: 700; border-radius: var(--radius); padding: 3px 10px; margin-bottom: 14px; font-size: 13px; }
.tile--main .btn { position: relative; align-self: flex-start; }

/* ---------- Text / info blocks ---------- */
.intro { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 40px; }
.intro__block { background: var(--bg-soft); border-radius: var(--radius); padding: 28px; border-left: 4px solid var(--green); }
.intro__block h2 { margin: 0 0 10px; font-size: 19px; color: var(--heading); }
.intro__block p { margin: 0 0 12px; color: var(--text-2); }
.intro__block a { color: var(--heading); font-weight: 600; }
.intro__block a:hover { color: var(--green-dark); }

.perks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 28px; }
.perk { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.perk__icon { font-size: 28px; }
.perk b { display: block; color: var(--heading); font-size: 13.5px; }
.perk span { font-size: 12px; color: var(--muted); }

.brands { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.brand { border: 1px solid var(--line); border-radius: var(--radius); height: 72px; display: grid; place-items: center; font-weight: 700; color: var(--heading); font-size: 15px; text-align: center; padding: 8px; transition: border-color .15s, color .15s; }
.brand:hover { border-color: var(--green); color: var(--green-dark); }

/* ---------- Product cards ---------- */
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; background: var(--surface); position: relative; transition: box-shadow .2s, border-color .2s; }
.card:hover { box-shadow: var(--shadow); border-color: var(--line-hover); }
.card__img { aspect-ratio: 1; position: relative; margin-bottom: 10px; }
.card__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.card__code { font-size: 11px; color: var(--faint); }
.card__brand { font-size: 12px; font-weight: 700; color: var(--heading); text-transform: uppercase; letter-spacing: .3px; }
.card__name { font-size: 13px; line-height: 1.4; margin: 4px 0 10px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 54px; }
.card__name:hover { color: var(--green-dark); }
.card__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card__add { border: 0; background: var(--btn); color: #fff; width: 38px; height: 38px; border-radius: var(--radius); font-size: 17px; flex-shrink: 0; transition: background .15s; }
.card__add:hover { background: var(--green-dark); }
.card__badge { position: absolute; top: 10px; left: 10px; background: var(--sale); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: var(--radius); z-index: 1; }

/* ---------- Catalog ---------- */
.catalog { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.filters { border: 1px solid var(--line); border-radius: var(--radius); position: sticky; top: 92px; }
.filters__group { padding: 16px; border-bottom: 1px solid var(--line); }
.filters__group:last-child { border-bottom: 0; }
.filters h4 { margin: 0 0 10px; font-size: 14px; color: var(--heading); }
.filters a.f-link { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; color: var(--text-3); }
.filters a.f-link:hover, .filters a.f-link.active { color: var(--green-dark); font-weight: 600; }
.filters a.f-link--sub { padding-left: 14px; font-size: 12.5px; color: var(--text-4); }
.filters a.f-link span { color: var(--faint-2); font-weight: 400; }
.price-range { display: flex; gap: 8px; align-items: center; }
.price-range input { width: 100%; border: 1px solid var(--field-line); border-radius: var(--radius); padding: 6px 8px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.toolbar__count { color: var(--muted); font-size: 13px; }
.toolbar select { border: 1px solid var(--field-line); border-radius: var(--radius); padding: 7px 10px; background: var(--surface); }
.filters-toggle { display: none; }

/* ---------- Product page ---------- */
.pdp { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.pdp__gallery { display: flex; flex-direction: column; gap: 12px; }
.pdp__thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.pdp__thumb { width: 72px; height: 72px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--photo-bg); padding: 4px; cursor: pointer; overflow: hidden; }
.pdp__thumb.is-active { border-color: var(--green); box-shadow: 0 0 0 2px rgba(90,167,0,.25); }
.pdp__thumb img { width: 100%; height: 100%; object-fit: contain; }
.pdp__tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag { font-size: 12.5px; color: var(--heading); background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; transition: border-color .15s, color .15s; }
.tag:hover { border-color: var(--green); color: var(--green-dark); }
.pdp__img { border: 1px solid var(--line); border-radius: var(--radius); aspect-ratio: 1; position: relative; max-width: 560px; width: 100%; }
.pdp__img img { position: absolute; inset: 30px; width: calc(100% - 60px); height: calc(100% - 60px); object-fit: contain; }
.pdp__brand { color: var(--heading); font-weight: 700; text-transform: uppercase; font-size: 13px; }
.pdp h1 { font-size: 24px; margin: 6px 0 8px; line-height: 1.35; }
.pdp__code { color: var(--muted); font-size: 12px; margin-bottom: 16px; }
.pdp__stock { color: var(--green-dark); font-weight: 600; font-size: 13px; margin: 8px 0 18px; }
.pdp .price { font-size: 30px; }
.pdp__buy { display: flex; gap: 12px; margin: 20px 0; }
.qty { display: flex; border: 1px solid var(--field-line); border-radius: var(--radius); overflow: hidden; }
.qty button { border: 0; background: var(--bg-soft); width: 36px; font-size: 18px; }
.qty button:hover { background: var(--line); }
.qty input { width: 46px; border: 0; text-align: center; font-weight: 600; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.pdp__info { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 8px; }
.pdp__info li { margin-bottom: 6px; color: var(--text-2); }
.pdp__info ul { padding-left: 18px; }
.pdp__desc { overflow-wrap: anywhere; }
.pdp__desc.is-loading { min-height: 5em; } /* the text is fetched when the page opens: keep its place so nothing jumps */
.specs { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.specs td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.specs td:first-child { color: var(--muted); width: 40%; }

/* ---------- Cart / checkout ---------- */
.cart { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
.cart-table { border: 1px solid var(--line); border-radius: var(--radius); }
.cart-row { display: grid; grid-template-columns: 80px 1fr auto auto 32px; gap: 16px; align-items: center; padding: 14px; border-bottom: 1px solid var(--line); }
.cart-row:last-child { border-bottom: 0; }
.cart-row img { width: 80px; height: 80px; object-fit: contain; }
.cart-row a { display: block; }
.cart-row__name { font-size: 13.5px; }
.cart-row__name a:hover { color: var(--green-dark); }
.cart-row__name small { display: block; color: var(--muted); }
.cart-row__sum { font-weight: 700; color: var(--heading); min-width: 80px; text-align: right; }
.cart-row__rm { border: 0; background: none; color: var(--faint-3); font-size: 20px; }
.cart-row__rm:hover { color: var(--sale-text); }
.summary { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: var(--bg-soft); position: sticky; top: 92px; }
.summary h3 { margin: 0 0 14px; color: var(--heading); }
.summary__row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.summary__total { border-top: 1px solid var(--line-2); padding-top: 12px; margin-top: 12px; font-size: 18px; font-weight: 700; color: var(--heading); }
.summary__note { font-size: 12px; color: var(--green-dark); margin: 8px 0 14px; }
.summary__discount { color: var(--green-dark); font-weight: 600; }

/* ---------- Promo code ---------- */
.promo { margin: 4px 0 14px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.promo__row { display: flex; gap: 8px; }
.promo__row input { flex: 1; min-width: 0; border: 1px solid var(--field-line); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; text-transform: uppercase; }
.promo__row input:focus { outline: none; border-color: var(--outline); }
.promo__row .btn { white-space: nowrap; }
.promo__msg { font-size: 12.5px; margin-top: 8px; min-height: 16px; color: var(--green-dark); }
.promo__msg--err { color: var(--sale-text); }
.promo--active { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.promo__tag { font-size: 13px; color: var(--green-dark); }
.promo__tag b { color: var(--heading); }
.promo__remove { border: 0; background: none; color: var(--muted); font-size: 12.5px; cursor: pointer; text-decoration: underline; }
.promo__remove:hover { color: var(--sale-text); }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; }
.form .full { grid-column: 1 / -1; }

/* ---------- Account auth (login / register) ---------- */
.auth { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; max-width: 760px; }
.auth__form { display: flex; flex-direction: column; gap: 14px; }
.auth__form h3 { margin: 0; color: var(--heading); font-size: 18px; }
.auth__form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; }
.auth__form input { border: 1px solid var(--field-line); border-radius: var(--radius); padding: 10px 12px; outline: none; }
.auth__form input:focus { border-color: var(--outline); }
.auth__form .muted { margin: 0; font-size: 12.5px; min-height: 1em; }
.form input, .form select, .form textarea { border: 1px solid var(--field-line); border-radius: var(--radius); padding: 10px 12px; outline: none; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--outline); }
.pay-opts { display: grid; gap: 8px; }
.pay-opt { flex-direction: row !important; align-items: center; gap: 10px !important; border: 1px solid var(--field-line); border-radius: var(--radius); padding: 12px; cursor: pointer; }
.pay-opt:has(input:checked) { border-color: var(--green-dark); background: var(--ok-bg); }
.box { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.box h3 { margin-top: 0; color: var(--heading); }
.success { text-align: center; padding: 60px 20px; }
.success__icon { font-size: 60px; }
.success h1 { color: var(--green-dark); }

/* ---------- Static pages ---------- */
.prose { max-width: 820px; }
.prose h2 { color: var(--heading); margin-top: 28px; }
.prose p, .prose li { color: var(--text-3); }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.map { border: 0; width: 100%; height: 100%; min-height: 320px; border-radius: var(--radius); }

/* ---------- Footer ---------- */
.footer { background: var(--navy); color: #c9d4dd; margin-top: 40px; }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 32px; padding-top: 44px; padding-bottom: 36px; }
.footer h4 { color: #fff; margin: 0 0 14px; font-size: 15px; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: 8px; font-size: 13px; }
.footer a:hover { color: var(--green); }
.footer__about { font-size: 13px; margin: 16px 0; }
.socials { display: flex; gap: 8px; }
.socials a { width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .1); display: grid; place-items: center; font-weight: 700; color: #fff; }
.socials a:hover { background: var(--green-dark); color: #fff; }
.footer__bottom { border-top: 1px solid rgba(255, 255, 255, .1); padding: 16px 0; font-size: 12px; color: #8ea2b3; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 120px); background: var(--btn); color: #fff; padding: 12px 22px; border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .25s; z-index: 100; font-size: 13.5px; }
.toast.show { transform: translate(-50%, 0); }
.toast a { color: var(--green); font-weight: 600; margin-left: 10px; }

/* ---------- Out of stock ---------- */
.card--soldout .card__img img { opacity: .45; filter: grayscale(.7); }
.card__soldout { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 4px 6px; background: rgba(0, 39, 65, .85); color: #fff; font-size: 12px; font-weight: 700; text-align: center; }
.card__add:disabled, .card__add:disabled:hover { background: var(--faint-3); cursor: not-allowed; opacity: .6; }
.btn--soldout:disabled, .btn--soldout:disabled:hover { background: var(--faint-3); cursor: not-allowed; opacity: .75; }
.pdp__stock--out { color: var(--sale-text); }
.cart-row__name small.cart-row__warn { color: var(--sale-text); font-weight: 600; }
.summary__warn { margin: 12px 0 0; padding: 8px 10px; font-size: 12.5px; line-height: 1.4; color: var(--sale-text); background: var(--surface); border-left: 3px solid var(--sale-text); border-radius: var(--radius); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .brands { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .tile--main { grid-column: 1 / -1; grid-row: auto; min-height: 280px; }
  .tile { min-height: 160px; }
  .grid, .grid--4 { grid-template-columns: repeat(3, 1fr); }
  .perks { grid-template-columns: 1fr 1fr; }
  .intro, .pdp, .cart, .contact-grid, .auth { grid-template-columns: 1fr; }
  .catalog { grid-template-columns: 1fr; }
  .filters { position: static; display: none; }
  .filters.open { display: block; }
  .filters-toggle { display: inline-flex; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .summary { position: static; }

  .burger { display: block; }
  .nav { display: none; }
  .nav.open { display: block; }
  .nav__inner { flex-direction: column; align-items: stretch; height: auto; padding: 0; }
  .nav__cats, .nav__pages { flex-direction: column; margin: 0; }
  .nav a { height: 42px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
  .nav__sub { display: block; position: static; box-shadow: none; background: rgba(255, 255, 255, .04); }
  .nav__sub a { padding-left: 32px; }
  .nav__item.has-sub > a::after { content: none; }
}
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .header__inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .logo__text { font-size: 20px; }
  .logo__img { height: 46px; }
  .cart-btn__text { display: none; }
  .grid, .grid--4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile--main h1 { font-size: 24px; max-width: 60%; }
  .tile--main p { display: none; }
  .tile--main { padding: 22px; }
  .tile--main img { width: 38%; }
  .tile { min-height: 180px; padding: 12px; }
  .tile img { left: 0; right: 0; margin: 0 auto; height: 50%; }
  .tile--photo img { height: 100%; margin: 0; }
  .tile h3 { font-size: 13.5px; }
  .section__head h2 { font-size: 17px; }
  .perks, .form { grid-template-columns: 1fr; }
  .brands { grid-template-columns: 1fr 1fr; }
  .cart-row { grid-template-columns: 64px 1fr auto; }
  .cart-row img { width: 64px; height: 64px; }
  .cart-row .qty { grid-column: 2; }
  .cart-row__sum { grid-column: 3; grid-row: 2; }
  .cart-row__rm { grid-column: 3; grid-row: 1; }
  .footer__grid { grid-template-columns: 1fr; }
}

/* ---------- Theme switch (top bar) ---------- */
.theme-btn { border: 1px solid var(--field-line); background: var(--surface); border-radius: var(--radius); padding: 2px 8px; font-size: 13px; line-height: 1.5; }
.theme-btn:hover { border-color: var(--outline); }

/* ---------- Dark mode ----------
   Chosen with the switch in the top bar; the shop is light unless the visitor switched to
   dark (see the small script in index.html and js/app.js). Only the colour
   roles from :root change here; product photos keep a white plate because they have white
   backgrounds, and the logo gets the same white plate it already has in the footer. */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1620;
  --bg-soft: #16212d;
  --surface: #1a2634;
  --photo-bg: #fff;
  --text: #e6edf3;
  --text-2: #b9c6d2;
  --text-3: #c9d4de;
  --text-4: #a3b2c0;
  --muted: #92a3b3;
  --faint: #8d9eaf;
  --faint-2: #8d9eaf;
  --faint-3: #7f90a1;
  --line: #2a3a4b;
  --line-2: #34475b;
  --line-hover: #46607a;
  --field-line: #5d758b;
  --heading: #e3eef8;
  --btn: #1f5c8a;
  --btn-hover: #2a73a8;
  --outline: #5b9fd0;
  --hero-bg: linear-gradient(135deg, #17331f 0%, #123239 100%);
  --hero-text: #b9ccda;
  --ok-bg: #1b3022;
  --sale-text: #ff8682;
  --shadow: 0 6px 22px rgba(0, 0, 0, .5);
}
/* Form fields: the browser would otherwise pick its own greys. */
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { background: var(--surface); color: var(--text); }
html[data-theme="dark"] ::placeholder { color: var(--faint); opacity: 1; }
html[data-theme="dark"] input:-webkit-autofill { -webkit-box-shadow: 0 0 0 100px var(--surface) inset; -webkit-text-fill-color: var(--text); caret-color: var(--text); }
/* Product photos keep a white plate. */
html[data-theme="dark"] .card__img,
html[data-theme="dark"] .pdp__img { background: var(--photo-bg); border-radius: var(--radius); overflow: hidden; }
html[data-theme="dark"] .cart-row img { background: var(--photo-bg); border-radius: var(--radius); }
html[data-theme="dark"] .tile img { mix-blend-mode: normal; background: var(--photo-bg); border-radius: var(--radius); }
html[data-theme="dark"] .tile--main img { border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .35); }
@media (min-width: 641px) {
  /* A little smaller than in light mode, so the white plate keeps clear of the heading. */
  html[data-theme="dark"] .tile--main img { width: 38%; height: 76%; top: 12%; right: 5%; }
}
html[data-theme="dark"] .tile--photo img { background: none; border-radius: 0; }
/* The logo is dark text on white, so it sits on a white plate (same as in the footer). */
html[data-theme="dark"] .header .logo__img { height: 54px; background: #fff; border-radius: var(--radius); padding: 3px 8px; }
/* The embedded map is bright: tone it down. */
html[data-theme="dark"] .map { filter: invert(.92) hue-rotate(180deg) contrast(.9); }
@media (max-width: 640px) {
  html[data-theme="dark"] .header .logo__img { height: 44px; padding: 2px 6px; }
  /* On a phone the big banner photo sits on the right, so its white plate cannot cover the heading. */
  html[data-theme="dark"] .tile--main img { left: auto; right: 4%; margin: 0; }
}
