/* ==========================================================================
   MartFront — a traditional storefront theme for GoPress Commerce.
   Light, product-first layout: utility topbar, search header, category nav,
   hero, category + product grids, article grid, multi-column footer.
   ========================================================================== */

:root {
  --brand:        #2f9e44;
  --brand-dark:   #268a3b;
  --brand-soft:   #ebfbee;
  --ink:          #1f2933;
  --ink-soft:     #52606d;
  --ink-faint:    #9aa5b1;
  --line:         #e4e7eb;
  --line-soft:    #f0f2f5;
  --bg:           #f7f8fa;
  --card:         #ffffff;
  --star:         #f59f00;
  --sale:         #e03131;
  --radius:       10px;
  --radius-sm:    7px;
  --shadow:       0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg:    0 8px 24px rgba(16,24,40,.10);
  --container:    1200px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 700; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.main { padding: 28px 20px 56px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1.15rem; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: .9rem; font-weight: 600;
  cursor: pointer; transition: all .15s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-faint); color: var(--ink); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-lg { padding: .8rem 1.6rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border-color: transparent; }

/* ---------- Utility topbar ---------- */
.topbar { background: var(--brand); color: #fff; font-size: .8rem; }
.topbar-inner { display: flex; align-items: center; justify-content: center; gap: 1rem; min-height: 34px; text-align: center; }
.topbar a { color: #fff; opacity: .95; }
.topbar strong { font-weight: 700; }

.subbar { background: #fff; border-bottom: 1px solid var(--line); font-size: .8rem; color: var(--ink-soft); }
.subbar-inner { display: flex; align-items: center; justify-content: space-between; min-height: 38px; }
.subbar-left, .subbar-right { display: flex; align-items: center; gap: 1.2rem; }
.subbar a:hover { color: var(--brand); }
.subbar .sep { color: var(--line); }

/* ---------- Header ---------- */
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: .55rem; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; color: var(--ink); flex-shrink: 0; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 1.15rem; }

.search { flex: 1; max-width: 640px; }
.search form { display: flex; border: 2px solid var(--brand); border-radius: var(--radius-sm); overflow: hidden; }
.search input { flex: 1; border: 0; padding: .6rem .9rem; font-size: .9rem; outline: none; min-width: 0; }
.search .search-cat { border: 0; border-left: 1px solid var(--line); background: var(--line-soft); padding: 0 .7rem; font-size: .85rem; color: var(--ink-soft); max-width: 130px; }
.search button { border: 0; background: var(--brand); color: #fff; padding: 0 1.1rem; cursor: pointer; font-size: 1rem; }
.search button:hover { background: var(--brand-dark); }

.header-actions { display: flex; align-items: center; gap: 1.3rem; margin-left: auto; flex-shrink: 0; }
.header-action { display: flex; align-items: center; gap: .5rem; color: var(--ink-soft); font-size: .8rem; }
.header-action .ha-icon { font-size: 1.35rem; line-height: 1; }
.header-action strong { display: block; color: var(--ink); font-size: .82rem; }

/* mini-cart + my-orders come from Commerce render-hook <li>s */
.nav-cart { display: flex; align-items: center; gap: 1.1rem; }
.nav-cart a { display: flex; align-items: center; gap: .4rem; color: var(--ink-soft); font-weight: 600; font-size: .85rem; }
.commerce-mini-cart a { font-size: 1.15rem; position: relative; }
.commerce-cart-count {
  font-size: .68rem; font-weight: 700; background: var(--sale); color: #fff;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  display: inline-grid; place-items: center;
}

/* ---------- Category nav bar ---------- */
.catnav { background: #fff; border-bottom: 1px solid var(--line); }
.catnav-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 46px; overflow-x: auto; }
.catnav a { display: inline-flex; align-items: center; gap: .35rem; font-size: .88rem; font-weight: 600; color: var(--ink); white-space: nowrap; padding: .2rem 0; border-bottom: 2px solid transparent; }
.catnav a:hover, .catnav a.active { color: var(--brand); border-color: var(--brand); }
.catnav .catnav-all { background: var(--brand); color: #fff; padding: .45rem .9rem; border-radius: var(--radius-sm); }
.catnav .catnav-all:hover { background: var(--brand-dark); color: #fff; border: 0; }

/* ---------- Section heading ---------- */
.section { margin-bottom: 44px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.section-head h2 { font-size: 1.3rem; margin: 0; }
.section-head .tabs { display: flex; gap: 1rem; font-size: .8rem; font-weight: 700; letter-spacing: .04em; color: var(--ink-faint); text-transform: uppercase; }
.section-head .tabs a.active, .section-head .tabs a:hover { color: var(--brand); }

/* ---------- Hero row: category sidebar + banner ---------- */
.home-hero-row { display: grid; grid-template-columns: 232px 1fr; gap: 18px; margin-bottom: 18px; }
.hero-cats { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 0; align-self: start; }
.hero-cats h4 { font-size: .9rem; margin: 0; padding: 10px 18px; color: var(--ink); border-bottom: 1px solid var(--line-soft); }
.hero-cats ul { padding: 6px 0; }
.hero-cats a { display: flex; align-items: center; justify-content: space-between; padding: .5rem 18px; font-size: .88rem; color: var(--ink-soft); }
.hero-cats a:hover { background: var(--brand-soft); color: var(--brand); }
.hero-cats a em { font-style: normal; color: var(--ink-faint); }

.hero-carousel { position: relative; min-height: 390px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line-soft); isolation: isolate; }
.hero-slides { position: relative; min-height: inherit; }
.hero-slide { position: absolute; inset: 0; display: flex; align-items: center; min-height: inherit; overflow: hidden; background: #fff right center/auto 100% no-repeat; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .55s ease, visibility .55s ease; }
.hero-slide::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255,255,255,.99) 0%, rgba(255,255,255,.98) 35%, rgba(255,255,255,.9) 47%, rgba(255,255,255,.45) 61%, rgba(255,255,255,0) 76%); }
.hero-slide.is-active { opacity: 1; visibility: visible; pointer-events: auto; z-index: 1; }
.hero-banner-copy { position: relative; z-index: 2; width: min(58%, 570px); padding: 0 48px; }
.hero-banner-copy .eyebrow { color: var(--brand); font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.hero-banner-copy h1 { font-size: 2.5rem; margin: .3em 0 .35em; letter-spacing: -.02em; color: var(--ink); }
.hero-banner-copy p { color: var(--ink-soft); font-size: 1.05rem; max-width: 40ch; margin-bottom: 1.2rem; }
.hero-arrow { position: absolute; top: 50%; z-index: 3; width: 34px; height: 46px; padding: 0; border: 1px solid rgba(31,41,55,.12); border-radius: 999px; background: rgba(255,255,255,.8); color: var(--ink); font: inherit; font-size: 1.8rem; line-height: 1; cursor: pointer; box-shadow: 0 3px 14px rgba(15,23,42,.12); opacity: .15; transform: translateY(-50%); transition: opacity .18s ease, background .18s ease, transform .18s ease; }
.hero-arrow-prev { left: 12px; }
.hero-arrow-next { right: 12px; }
.hero-carousel:hover .hero-arrow, .hero-carousel:focus-within .hero-arrow { opacity: .9; }
.hero-arrow:hover, .hero-arrow:focus-visible { background: #fff; opacity: 1; transform: translateY(-50%) scale(1.04); outline: 2px solid var(--brand); outline-offset: 2px; }
.hero-dots { position: absolute; z-index: 3; bottom: 16px; left: 50%; display: flex; align-items: center; gap: 7px; transform: translateX(-50%); }
.hero-dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: rgba(31,41,55,.35); cursor: pointer; transition: width .2s ease, background .2s ease; }
.hero-dot.is-active { width: 24px; background: var(--brand); }
.hero-dot:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

/* ---------- Trust bar ---------- */
.trust-bar { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 24px; overflow: hidden; }
.trust-item { display: flex; align-items: center; gap: .8rem; padding: 18px 22px; border-right: 1px solid var(--line-soft); }
.trust-item:last-child { border-right: 0; }
.trust-item .ti-ico { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; line-height: 0; }
.trust-item .ti-ico img { width: 48px; height: 48px; }
.trust-item strong { display: block; font-size: .92rem; }
.trust-item small { color: var(--ink-faint); font-size: .78rem; }

/* ---------- Category cards (image-backed) ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.cat-card { position: relative; height: 150px; border-radius: var(--radius); overflow: hidden; background: var(--line-soft) center/cover no-repeat; border: 1px solid var(--line); display: flex; align-items: flex-end; transition: all .15s ease; }
.cat-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(15,23,32,.74) 0%, rgba(15,23,32,.18) 55%, rgba(15,23,32,0) 100%); }
.cat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.cat-card-body { position: relative; padding: 14px 16px; color: #fff; }
.cat-card-body h3 { font-size: 1.02rem; margin: 0; color: #fff; }
.cat-card-body .cat-count { font-size: .78rem; opacity: .9; }

/* ---------- Product grid + cards ---------- */
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.product-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.product-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: all .15s ease; position: relative;
}
.product-card:hover { border-color: var(--ink-faint); box-shadow: var(--shadow-lg); }
.product-card:hover .product-card-title a { color: var(--brand); }
.product-card-media { display: block; aspect-ratio: 1 / 1; background: var(--line-soft); overflow: hidden; }
.product-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.product-card:hover .product-card-media img { transform: scale(1.04); }
.product-placeholder { width: 100%; height: 100%; background: repeating-linear-gradient(45deg, #f0f2f5, #f0f2f5 12px, #e9edf1 12px, #e9edf1 24px); }
.product-placeholder.large { aspect-ratio: 1/1; border-radius: var(--radius); }
.product-card-body { padding: 14px 15px 16px; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.product-card-cat { font-size: .72rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
.product-card-title { font-size: .92rem; font-weight: 600; margin: 0; line-height: 1.35; }
.product-rating { color: var(--star); font-size: .82rem; letter-spacing: .05em; }
.product-rating .count { color: var(--ink-faint); margin-left: .3rem; }

/* Commerce add-to-cart slot styling (theme owns the visuals) */
.commerce-add-to-cart { margin-top: auto; padding-top: .3rem; }
.commerce-price { font-size: 1.15rem; font-weight: 800; color: var(--ink); }
.commerce-price del { color: var(--ink-faint); font-weight: 500; font-size: .9rem; }
.commerce-price strong { color: var(--brand); }
.commerce-atc-form { margin-top: .55rem !important; }
.commerce-atc-form .btn { padding: .5rem .8rem; }
.commerce-oos { color: var(--sale); font-weight: 600; font-size: .85rem; margin: .4rem 0 0; }

.badge-corner { position: absolute; top: 10px; left: 10px; z-index: 2; font-size: .68rem; font-weight: 700; text-transform: uppercase; padding: .2rem .5rem; border-radius: 4px; color: #fff; letter-spacing: .04em; }
.badge-sale { background: var(--sale); }
.badge-new { background: var(--brand); }

/* ---------- Article cards ---------- */
.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.article-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.article-card:hover { box-shadow: var(--shadow-lg); }
.article-media { display: block; flex: 0 0 auto; aspect-ratio: 16/9; background: var(--line-soft); overflow: hidden; }
.article-media img { width: 100%; height: 100%; object-fit: cover; }
.article-body { flex: 1; padding: 16px 18px 20px; }
.article-body time { font-size: .76rem; color: var(--ink-faint); }
.article-body h3 { font-size: 1.05rem; margin: .3rem 0 .4rem; }
.article-body p { font-size: .88rem; color: var(--ink-soft); margin: 0; }

/* ---------- Breadcrumb ---------- */
.breadcrumb { font-size: .8rem; color: var(--ink-faint); margin-bottom: 18px; display: flex; gap: .45rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb a:hover { color: var(--brand); }

/* ---------- Archive ---------- */
.archive-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.archive-title { font-size: 1.6rem; margin: 0; }
.archive-count { color: var(--ink-faint); font-size: .85rem; }
.archive-pagination { display: flex; justify-content: center; gap: .45rem; margin-top: 28px; }
.archive-pagination a { min-width: 2.25rem; padding: .45rem .65rem; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink-soft); text-align: center; background: var(--card); }
.archive-pagination a:hover, .archive-pagination a.active { color: #fff; border-color: var(--brand); background: var(--brand); }
.empty { color: var(--ink-soft); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; }

/* ---------- Single product ---------- */
.product-single-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; margin-bottom: 44px; }
.product-single-media img { border-radius: var(--radius); border: 1px solid var(--line); }
.product-single-info h1 { font-size: 1.9rem; }
.product-single-info .product-rating { margin-bottom: .6rem; }
.product-single-info .commerce-price { font-size: 1.7rem; margin: .3rem 0; }
.product-single-info .commerce-atc-form { display: flex; gap: .6rem; margin-top: 1rem !important; }
.product-single-info .commerce-atc-form .btn { padding: .7rem 1.6rem; }
.product-excerpt { color: var(--ink-soft); font-size: 1rem; margin: 1rem 0; }
.product-meta-list { border-top: 1px solid var(--line); margin-top: 1.4rem; padding-top: 1rem; font-size: .85rem; color: var(--ink-soft); }
.product-meta-list li { padding: .2rem 0; }
.product-desc { line-height: 1.75; }
.product-desc h3 { margin-top: 1.6rem; font-size: 1.15rem; }
.product-desc ul { list-style: disc; padding-left: 1.3rem; margin: 0 0 1rem; }
.product-desc li { margin: .2rem 0; }

/* ---------- Single post ---------- */
.post-single { max-width: 760px; margin: 0 auto; }
.post-single .post-head h1 { font-size: 2.1rem; }
.post-single .post-meta { color: var(--ink-faint); font-size: .85rem; margin-bottom: 1.4rem; }
.post-single .post-cover { border-radius: var(--radius); margin-bottom: 1.6rem; }
.post-single .post-body { line-height: 1.8; font-size: 1.02rem; }
.post-single .post-body h2, .post-single .post-body h3 { margin-top: 1.8rem; }

/* ---------- Footer ---------- */
.site-footer { background: #1b2733; color: #9aa5b1; margin-top: 40px; }
.footer-top { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; padding: 48px 0 36px; }
.footer-col h4 { color: #fff; font-size: .95rem; margin-bottom: 1rem; }
.footer-col a { display: block; color: #9aa5b1; font-size: .87rem; padding: .28rem 0; }
.footer-col a:hover { color: #fff; }
.footer-brand .brand { color: #fff; margin-bottom: .8rem; }
.footer-brand p { font-size: .87rem; max-width: 34ch; }
.footer-contact li { font-size: .87rem; padding: .28rem 0; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); padding: 18px 0; display: flex; align-items: center; justify-content: space-between; font-size: .82rem; }
.footer-bottom .pay-badges { display: flex; gap: .5rem; opacity: .8; }
.footer-bottom .pay-badges span { background: rgba(255,255,255,.1); border-radius: 4px; padding: .15rem .5rem; font-size: .72rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .home-hero-row { grid-template-columns: 1fr; }
  .hero-cats { display: none; }
  .hero-carousel { min-height: 300px; }
  .hero-banner-copy h1 { font-size: 2.1rem; }
  .trust-bar { grid-template-columns: repeat(2, 1fr); }
  .trust-item:nth-child(2) { border-right: 0; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .product-grid, .product-grid.cols-5 { grid-template-columns: repeat(3, 1fr); }
  .footer-top { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .subbar { display: none; }
  .header-inner { flex-wrap: wrap; min-height: 0; padding: 14px 0; gap: 1rem; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .product-grid, .product-grid.cols-5, .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .trust-bar { grid-template-columns: 1fr 1fr; }
  .article-grid { grid-template-columns: 1fr; }
  .product-single-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-top { grid-template-columns: 1fr; gap: 24px; }
  .hero-slide { background-position: right center; }
  .hero-slide::before { background: linear-gradient(90deg, rgba(255,255,255,.99) 0%, rgba(255,255,255,.96) 48%, rgba(255,255,255,.72) 68%, rgba(255,255,255,.18) 100%); }
  .hero-banner-copy { width: 78%; padding: 0 32px; }
  .hero-banner-copy h1 { font-size: 1.8rem; }
  .hero-banner-copy p { font-size: .95rem; }
  .hero-arrow { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-slide, .hero-arrow, .hero-dot { transition: none; }
}
