/* =====================================================
   MAIN.CSS — site-wide styles
   ===================================================== */

/* ---------- 1. VARIABLES: change colors/fonts here ---------- */
:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-text: #1f2937;
  --color-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-bg: #ffffff;
  --color-bg-soft: #f9fafb;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 8px;
  --container: 1200px;
}

/* ---------- 2. RESET / BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-body); line-height: 1.6; color: var(--color-text); background: var(--color-bg); }
a { color: var(--color-primary); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { line-height: 1.25; }

/* ---------- 3. LAYOUT HELPERS ---------- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 760px; }
.center { text-align: center; }
.site-main { padding: 40px 0; min-height: 60vh; }
.canvas-page .site-main { padding: 0; }

/* ---------- 4. BUTTONS ---------- */
.btn, .button {
  display: inline-block; padding: 10px 20px; border: 0; border-radius: var(--radius);
  background: var(--color-primary); color: #fff; text-decoration: none; cursor: pointer;
}
.btn:hover, .button:hover { background: var(--color-primary-dark); }

/* ---------- 5. HEADER ---------- */
.site-header { border-bottom: 1px solid var(--color-border); background: var(--color-bg); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; gap: 24px; padding: 14px 16px; }
.site-logo a { font-weight: 700; font-size: 1.25rem; color: var(--color-text); text-decoration: none; }
.site-logo img { max-height: 50px; width: auto; }

/* ---------- 6. MAIN MENU (desktop) ---------- */
.main-nav { margin-left: auto; }
.menu { list-style: none; display: flex; gap: 24px; margin: 0; padding: 0; }
.menu a { color: var(--color-text); text-decoration: none; }
.menu a:hover, .menu .current-menu-item > a { color: var(--color-primary); }
.menu li { position: relative; }

/* Dropdown (sub-menu) */
.menu .sub-menu {
  display: none; position: absolute; top: 100%; left: 0; min-width: 200px;
  list-style: none; margin: 0; padding: 8px 0; background: #fff;
  border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.08);
}
.menu li:hover > .sub-menu { display: block; }
.menu .sub-menu a { display: block; padding: 8px 16px; }

/* ---------- 7. HEADER ACTIONS: account + cart ---------- */
.header-actions { display: flex; align-items: center; gap: 16px; }
.header-account { color: var(--color-text); text-decoration: none; font-size: .95rem; }
.header-cart { position: relative; color: var(--color-text); display: flex; }
.cart-count {
  position: absolute; top: -8px; right: -10px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--color-primary); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}
.menu-toggle { display: none; background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--color-text); }

/* ---------- 8. BLOG CARDS ---------- */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.post-card { border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.post-card-body { padding: 16px; }
.post-card h2 { font-size: 1.15rem; margin: 0 0 8px; }
.post-card h2 a { color: var(--color-text); text-decoration: none; }
.post-meta { color: var(--color-muted); font-size: .9rem; }

/* ---------- 9. FOOTER ---------- */
.site-footer { border-top: 1px solid var(--color-border); background: var(--color-bg-soft); padding: 40px 0 24px; }
.footer-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; margin-bottom: 24px; }
.footer-menu { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; padding: 0; }
.footer-menu a { color: var(--color-text); text-decoration: none; }
.copyright { text-align: center; color: var(--color-muted); font-size: .9rem; }

/* ---------- 10. MOBILE (768px and below) ---------- */
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .header-account { display: none; }
  .main-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; padding: 16px; border-bottom: 1px solid var(--color-border);
  }
  .main-nav.open { display: block; }
  .menu { flex-direction: column; gap: 12px; }
  .menu .sub-menu { position: static; display: block; box-shadow: none; padding-left: 16px; }
}
