/*
 * NavMarket storefront styles.
 * No framework, no external font: system fonts load instantly and need no third party.
 * Colours are tokens on :root, with a dark version under prefers-color-scheme.
 */

:root {
  --brand: #1f3fd1;
  --brand-strong: #162fa3;
  --brand-soft: #e8edff;
  --accent: #ff6b4a;
  --ink: #111827;
  --ink-soft: #4b5563;
  --muted: #6b7280;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --line: #e5e7eb;
  --success: #12a150;
  --star: #f5a524;
  --shadow: 0 1px 2px rgba(17, 24, 39, .06), 0 8px 24px rgba(17, 24, 39, .06);
  --shadow-lg: 0 20px 50px rgba(17, 24, 39, .18);
  --radius: 16px;
  --radius-sm: 10px;
  --container: 1160px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;

  /* product tile tones: background, icon colour */
  --tone-blue-bg: #e3e9ff;   --tone-blue-fg: #1f3fd1;
  --tone-violet-bg: #efe6ff; --tone-violet-fg: #6d28d9;
  --tone-coral-bg: #ffe6df;  --tone-coral-fg: #d9411e;
  --tone-slate-bg: #e6eaf0;  --tone-slate-fg: #334155;
  --tone-mint-bg: #dcf6ea;   --tone-mint-fg: #0f8a52;
  --tone-amber-bg: #fff1d6;  --tone-amber-fg: #b45309;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #6f8bff;
    --brand-strong: #8fa5ff;
    --brand-soft: #1c2550;
    --ink: #eef1f7;
    --ink-soft: #c3c9d6;
    --muted: #949cad;
    --bg: #0d1017;
    --surface: #161a23;
    --line: #262c39;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .55);

    --tone-blue-bg: #1b2552;   --tone-blue-fg: #9fb2ff;
    --tone-violet-bg: #2a1e4d; --tone-violet-fg: #c4a7ff;
    --tone-coral-bg: #3b1f1a;  --tone-coral-fg: #ff9a82;
    --tone-slate-bg: #222a37;  --tone-slate-fg: #c2cbd9;
    --tone-mint-bg: #13332a;   --tone-mint-fg: #6ee0a8;
    --tone-amber-bg: #3a2c12;  --tone-amber-fg: #fcc96b;
  }
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

h1, h2, h3 { line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--brand); }
img, svg { display: block; }
button, input, select { font: inherit; color: inherit; }

.container { width: min(100% - 32px, var(--container)); margin-inline: auto; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }

.eyebrow {
  font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brand); margin-bottom: 10px;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 650; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(31, 63, 209, .25); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-light { background: #fff; color: #10194a; }
.btn-light:hover { background: #e8edff; }
.btn-outline-light { color: #fff; border-color: rgba(255, 255, 255, .45); }
.btn-outline-light:hover { border-color: #fff; background: rgba(255, 255, 255, .08); }
.btn-small { min-height: 38px; padding: 0 16px; font-size: .9rem; }
.btn-block { width: 100%; }

@media (prefers-color-scheme: dark) {
  .btn-primary { color: #0d1017; box-shadow: none; }
}

.icon-button, .link-button {
  border: 0; background: none; cursor: pointer; padding: 0;
}
.icon-button {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
}
.icon-button:hover { background: var(--line); }
.icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.link-button { color: var(--muted); font-size: .85rem; text-decoration: underline; text-underline-offset: 3px; }
.link-button:hover { color: var(--accent); }

/* ---------- announcement + header ---------- */

.announce { background: #10194a; color: #dfe5ff; font-size: .85rem; text-align: center; padding: 8px 16px; }
.announce strong { color: #fff; }

.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 68px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 1.25rem; letter-spacing: -0.02em; }
.brand b { color: var(--brand); }
.brand-mark { width: 34px; height: 34px; color: var(--brand); }

.main-nav { display: flex; gap: 6px; margin-left: auto; }
.main-nav a { color: var(--ink-soft); text-decoration: none; font-weight: 550; padding: 8px 12px; border-radius: 999px; }
.main-nav a:hover { color: var(--ink); background: var(--surface); }

.cart-button {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  height: 44px; padding: 0 8px 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 650;
}
.cart-button:hover { border-color: var(--brand); }
.cart-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cart-count {
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px;
  display: grid; place-items: center; background: var(--brand); color: #fff; font-size: .85rem;
}
@media (prefers-color-scheme: dark) { .cart-count { color: #0d1017; } }

/* ---------- hero ---------- */

.hero { padding: 64px 0 72px; overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }

.hero h1 { font-size: clamp(2.3rem, 5vw, 3.9rem); font-weight: 800; }
.accent { color: var(--brand); }
.lead { margin-top: 18px; font-size: 1.15rem; color: var(--ink-soft); max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.hero-facts { list-style: none; padding: 0; margin: 40px 0 0; display: flex; flex-wrap: wrap; gap: 14px 36px; }
.hero-facts li { display: flex; flex-direction: column; }
.hero-facts strong { font-size: 1.5rem; letter-spacing: -0.02em; }
.hero-facts span { color: var(--muted); font-size: .9rem; }

.hero-visual {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  transform: rotate(-3deg);
}
.tile {
  aspect-ratio: 1; border-radius: 28px; display: grid; place-items: center; box-shadow: var(--shadow);
}
.tile svg { width: 46%; height: 46%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tile-a { background: var(--tone-blue-bg); color: var(--tone-blue-fg); }
.tile-b { background: var(--tone-slate-bg); color: var(--tone-slate-fg); transform: translateY(16px); }
.tile-c { background: var(--tone-mint-bg); color: var(--tone-mint-fg); transform: translateY(-16px); }
.tile-d { background: var(--tone-coral-bg); color: var(--tone-coral-fg); }

.hero-badge {
  position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%) rotate(3deg);
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  padding: 10px 16px; border-radius: 999px; font-weight: 650; font-size: .9rem;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 25%, transparent); }

/* ---------- shop ---------- */

.shop { padding: 72px 0; background: var(--surface); border-block: 1px solid var(--line); }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-head h2, .why h2, .hood h2 { font-size: clamp(1.8rem, 3.2vw, 2.5rem); font-weight: 800; }
.result-count { color: var(--muted); font-weight: 550; }

.toolbar { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 40px; padding: 0 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-soft); font-weight: 600;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--surface); }

.toolbar-right { display: flex; gap: 10px; flex-wrap: wrap; }
.search {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg); min-width: 240px;
}
.search:focus-within { border-color: var(--brand); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { border: 0; outline: 0; background: none; width: 100%; }
.sort select {
  height: 42px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg);
}

.product-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px;
}

.card {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: transparent; }

.card-media { position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.card-media svg { width: 38%; height: 50%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s; }
.card:hover .card-media svg { transform: scale(1.06) rotate(-2deg); }

.badge {
  position: absolute; top: 12px; left: 12px;
  background: var(--surface); color: var(--ink); font-size: .75rem; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; box-shadow: var(--shadow);
}

.card-body { padding: 16px 18px 6px; flex: 1; }
.card-category { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.card-title { font-size: 1.06rem; margin-top: 4px; }
.card-text { color: var(--ink-soft); font-size: .92rem; margin-top: 6px; }
.rating { margin-top: 10px; font-size: .85rem; font-weight: 600; }
.stars { color: var(--star); letter-spacing: 1px; }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px 18px; }
.price { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.01em; }

.empty { text-align: center; padding: 40px 0 8px; display: grid; gap: 14px; justify-items: center; }
.empty[hidden] { display: none; }
.noscript { padding: 20px; border-radius: var(--radius-sm); background: var(--brand-soft); }

/* tones (product tiles, cart thumbnails) */
.tone-blue   { background: var(--tone-blue-bg);   color: var(--tone-blue-fg); }
.tone-violet { background: var(--tone-violet-bg); color: var(--tone-violet-fg); }
.tone-coral  { background: var(--tone-coral-bg);  color: var(--tone-coral-fg); }
.tone-slate  { background: var(--tone-slate-bg);  color: var(--tone-slate-fg); }
.tone-mint   { background: var(--tone-mint-bg);   color: var(--tone-mint-fg); }
.tone-amber  { background: var(--tone-amber-bg);  color: var(--tone-amber-fg); }

/* ---------- why ---------- */

.why { padding: 80px 0; }
.why-grid { list-style: none; padding: 0; margin: 34px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.why-grid li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.why-icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); margin-bottom: 16px;
}
.why-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.why h3 { font-size: 1.1rem; }
.why-grid p { color: var(--ink-soft); margin-top: 6px; font-size: .95rem; }

/* ---------- under the hood ---------- */

.hood {
  padding: 84px 0; color: #e6ebff;
  background:
    radial-gradient(900px 400px at 85% 0%, rgba(111, 139, 255, .35), transparent 60%),
    radial-gradient(700px 400px at 0% 100%, rgba(255, 107, 74, .18), transparent 60%),
    #0e1640;
}
.hood .eyebrow { color: #9fb2ff; }
.hood h2 { color: #fff; }
.hood-inner { display: grid; grid-template-columns: .9fr 1.1fr; gap: 48px; align-items: start; }
.hood-copy p { margin-top: 16px; color: #c4cdf2; font-size: 1.05rem; }
.hood-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.hood-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel {
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--radius); padding: 22px;
}
.panel h3 { color: #fff; font-size: 1rem; margin-bottom: 16px; }

.flow { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.flow li { position: relative; padding: 0 0 16px 38px; counter-increment: step; }
.flow li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: #6f8bff; color: #0e1640; font-weight: 800; font-size: .8rem;
}
.flow li:not(:last-child)::after {
  content: ""; position: absolute; left: 12px; top: 28px; bottom: 2px; width: 2px; background: rgba(159, 178, 255, .35);
}
.flow span, .roadmap span { display: block; color: #fff; font-weight: 650; }
.flow small, .roadmap small { color: #9aa6d6; font-size: .82rem; }

.roadmap { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.roadmap li { position: relative; padding-left: 28px; }
.roadmap li::before {
  content: ""; position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(159, 178, 255, .6);
}
.roadmap li.done::before { background: #3ddc84; border-color: #3ddc84; }

/* ---------- footer ---------- */

.site-footer { padding: 44px 0; border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 18px 40px; align-items: center; }
.footer-inner .muted { margin-top: 8px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-links a { color: var(--ink-soft); text-decoration: none; font-weight: 550; }
.footer-links a:hover { color: var(--brand); }
.footer-note { grid-column: 1 / -1; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- cart drawer ---------- */

.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(10, 14, 30, .5); }
.overlay[hidden] { display: none; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(420px, 100%); display: flex; flex-direction: column;
  background: var(--surface); box-shadow: var(--shadow-lg);
  transform: translateX(105%); visibility: hidden;
  transition: transform .28s ease, visibility 0s linear .28s;
}
.drawer.is-open { transform: none; visibility: visible; transition: transform .28s ease; }
.drawer:focus { outline: none; }

.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 1.25rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-foot { padding: 18px 20px 22px; border-top: 1px solid var(--line); }
.drawer-foot[hidden], .delivery-meter[hidden], .cart-empty[hidden] { display: none; }

.delivery-meter { background: var(--bg); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; font-size: .9rem; }
.meter { height: 6px; border-radius: 999px; background: var(--line); margin-top: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--success); border-radius: inherit; transition: width .3s; }

.cart-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.cart-line { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: start; }
.cart-thumb { width: 64px; height: 64px; border-radius: 12px; display: grid; place-items: center; }
.cart-thumb svg { width: 60%; height: 60%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cart-name { font-weight: 650; line-height: 1.3; }
.cart-side { text-align: right; display: grid; gap: 6px; justify-items: end; }
.cart-price { font-weight: 750; }

.qty { display: inline-flex; align-items: center; margin-top: 8px; border: 1px solid var(--line); border-radius: 999px; }
.qty button { width: 32px; height: 32px; border: 0; background: none; cursor: pointer; font-size: 1.1rem; border-radius: 50%; }
.qty button:hover { background: var(--line); }
.qty span { min-width: 24px; text-align: center; font-weight: 650; }

.cart-empty { text-align: center; padding: 48px 0; display: grid; gap: 16px; justify-items: center; color: var(--muted); }

.totals { margin: 0 0 16px; display: grid; gap: 8px; }
.totals div { display: flex; justify-content: space-between; }
.totals dt { color: var(--ink-soft); }
.totals dd { margin: 0; font-weight: 650; }
.totals .grand { padding-top: 10px; border-top: 1px dashed var(--line); font-size: 1.15rem; }
.totals .grand dt { color: var(--ink); font-weight: 750; }
.totals .grand dd { font-weight: 800; }

/* ---------- dialog + toast ---------- */

.notice {
  width: min(440px, calc(100% - 32px)); border: 0; border-radius: 20px; padding: 28px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
.notice::backdrop { background: rgba(10, 14, 30, .55); }
.notice h2 { font-size: 1.35rem; margin-bottom: 12px; }
.notice p { color: var(--ink-soft); margin-top: 8px; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 24px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  transform: translate(-50%, 140%); opacity: 0;
  background: var(--ink); color: var(--surface); padding: 12px 20px; border-radius: 999px;
  font-weight: 600; font-size: .92rem; box-shadow: var(--shadow-lg);
  transition: transform .25s, opacity .25s; pointer-events: none; max-width: calc(100% - 32px);
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
body.no-scroll .toast { bottom: 200px; }

/* ---------- responsive ---------- */

@media (max-width: 960px) {
  .hero-inner, .hood-inner { grid-template-columns: 1fr; }
  .hero-visual { max-width: 460px; margin: 20px auto 0; width: 100%; }
  .why-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .main-nav { display: none; }
  .cart-button { margin-left: auto; }
  .hero { padding: 40px 0 56px; }
  .hero-visual { max-width: 300px; gap: 14px; transform: rotate(-2deg); }
  .tile { border-radius: 22px; }
  .hood-panels { grid-template-columns: 1fr; }
  .toolbar-right, .search { width: 100%; }
  .search { min-width: 0; flex: 1 1 100%; }
  .sort, .sort select { width: 100%; }
  .section-head { flex-direction: column; align-items: start; }
  .footer-inner { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .cart-label { display: none; }
  .cart-button { padding-left: 10px; }
  .why-grid { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card-body { padding: 12px 12px 4px; }
  .card-text { display: none; }
  .card-foot { flex-direction: column; align-items: stretch; padding: 10px 12px 12px; }
  .card-foot .btn { width: 100%; }
  .hero-facts { gap: 12px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- 404 page ---------- */

.error-page {
  min-height: 100vh; display: grid; place-content: center; justify-items: center;
  gap: 14px; padding: 32px 16px; text-align: center;
}
.error-page .brand { margin-bottom: 18px; }
.error-code {
  font-size: clamp(5rem, 18vw, 9rem); font-weight: 900; line-height: 1; letter-spacing: -0.05em;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.error-page h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.error-page .lead { margin: 0 0 12px; }
