/* =========================================================
   ABC Kitchen — stable, timeless, low-noise theme
   Phase 2A: left sidebar + anchors
   Phase 2B: active category (V2) weight + subtle color shift
   ========================================================= */

:root {
  /* Light (default) */
  --bg: #f7f7f5;
  --surface: #ffffff;
  --border: #dadad6;
  --text: #121212;
  --muted: #4b4f58;
  --link: #1b4dd8;
  --panel: #ffffff;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  --radius: 16px;

  /* Layout */
  --sidebar-w: 288px;
  --content-pad: 24px;
  --sidebar-pad: 18px;

  /* Brand name */
  --brand-name-color: #111111;

  /* Typography scale */
  --fs-brand: 22px;
  --fs-h1: 24px;
  --fs-h2: 20px;
  --fs-item: 16px;
  --fs-body: 14px;
  --fs-meta: 13px;
  --fs-pill: 12px;
  --fs-price: 15px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #151821;
    --border: rgba(255, 255, 255, 0.14);
    --text: #eef0f5;
    --muted: rgba(238, 240, 245, 0.74);
    --link: #8db1ff;
    --panel: #151821;
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    --brand-name-color: #f0f0f0;
  }
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.small { font-size: var(--fs-meta); }

/* ---------- App layout ---------- */

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: var(--sidebar-pad);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: auto;
}

.sidebar-brand {
  display: block;
  padding: 10px;
  border-radius: 12px;
  color: var(--brand-name-color);
  font-weight: 900;
  font-size: var(--fs-brand);
  line-height: 1.15;
}

.sidebar-brand:hover {
  text-decoration: none;
  background: color-mix(in srgb, var(--surface) 85%, var(--text));
}

/* Sidebar nav */
.sidebar-nav {
  margin-top: 12px;
  display: grid;
  gap: 2px;
}

.nav-link {
  display: block;
  padding: 10px;
  border-radius: 12px;
  color: var(--muted);
  font-size: var(--fs-body);
  font-weight: 500;
  text-decoration: none;
}

.nav-link:hover {
  background: color-mix(in srgb, var(--surface) 88%, var(--text));
  text-decoration: none;
}

.nav-link:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--link) 60%, transparent);
  outline-offset: 2px;
}

/* Phase 2B (V2): weight + subtle color shift */
.nav-link.is-active {
  color: var(--text);
  font-weight: 700;
}

/* Right content */
.main { min-width: 0; }

.content {
  padding: var(--content-pad);
  padding-right: 16px;
  max-width: 1200px;
}


/* Mobile */
@media (max-width: 820px) {
  :root { --sidebar-w: 100%; }

  .app { grid-template-columns: 1fr; }

  .sidebar {
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow: auto;
    padding-bottom: 6px;
  }

  .content { padding: 16px; }
}

/* ---------- Catalog ---------- */

.catalog {
  padding: 0 0 24px;
}

.category {
  margin: 28px 0 0;
  padding-bottom: 48px;
}
.category:last-child { padding-bottom: 0; }

.category-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 14px;
}

.category-title {
  font-size: var(--fs-h2);
  margin: 0;
  font-weight: 800;
}

.category-meta {
  color: var(--muted);
  font-size: var(--fs-meta);
}

/* ---------- Grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
}

@media (max-width: 1200px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
}

/* ---------- Cards ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-top {
  aspect-ratio: 4 / 3;
  background: color-mix(in srgb, var(--surface) 92%, var(--text));
  display: grid;
  place-items: center;
}

.card-top img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.card-title {
  margin: 0;
  font-weight: 800;
  font-size: var(--fs-item);
  line-height: 1.25;
  color: var(--text);
}

.card-desc {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-body);
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.price {
  font-weight: 900;
  font-size: var(--fs-price);
}

/* ---------- UI elements ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-pill);
  color: var(--muted);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, var(--text));
  padding: 6px 10px;
  border-radius: 999px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

.btn:hover {
  background: color-mix(in srgb, var(--surface) 85%, var(--text));
}

.btn-primary {
  border-color: color-mix(in srgb, var(--link) 55%, var(--border));
  background: color-mix(in srgb, var(--surface) 82%, var(--link));
}

/* ---------- Product page ---------- */

.product-hero { padding: 8px 0 10px; }

.product-title {
  margin: 0;
  font-size: var(--fs-h1);
  font-weight: 900;
}

.back-link {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover { text-decoration: underline; }

.product-page {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  padding-bottom: 10px;
}

.product-media {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.product-img {
  width: 100%;
  height: auto;
  display: block;
}

/* Product page — stable 3-region card layout */
.product-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.product-desc {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-body);
  line-height: 1.55;
}

.product-bottom {
  margin-top: auto; /* pushes bottom region to the bottom */
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding-top: 14px;
}

.product-bottom-left {
  display: grid;
  gap: 8px;
}

.product-bottom-right {
  display: flex;
  justify-content: flex-end;
}


.product-desc {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-body);
  line-height: 1.55;
}

.product-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.product-cta .price {
  font-weight: 900;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.space { margin-top: 12px; }

@media (max-width: 980px) {
  .product-page { grid-template-columns: 1fr; }
}

/* ---------- Footer (About + Contact) ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 16px 0 12px;
  background: var(--bg);
}

.footer-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.footer-block {
  font-size: var(--fs-body);
  color: var(--muted);
}

.footer-block strong {
  font-weight: 700;   /* was visually heavy before */
  font-size: var(--fs-meta);
  letter-spacing: 0.02em;
}

.footer-block p {
  margin: 0 0 8px;
  line-height: 1.5;
}

.footer-bottom {
  margin-top: 10px;
  font-size: var(--fs-meta);
  color: var(--muted);
}

/* ---------- Accessibility ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
