/*
 * Base layout and components of the built-in templates (api/themes/_shared). A theme's style.css
 * sets the tokens below and adds its own look; everything here reads them.
 */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --text: #1c1917;
  --muted: #78716c;
  --line: #e7e5e4;
  --accent: #1c1917;
  --accent-text: #ffffff;
  --sale: #b91c1c;
  --ok: #15803d;
  --radius: 6px;
  --card-radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: var(--font);
  --display-weight: 600;
  --wrap: 1240px;
  --card-ratio: 4 / 5;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); }
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: var(--display-weight); line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.05rem; }
[hidden] { display: none !important; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.eyebrow { display: inline-block; font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); text-decoration: none; margin: 0 0 8px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- buttons and forms ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border: 1px solid var(--accent); border-radius: var(--radius);
  background: transparent; color: var(--text); text-decoration: none; cursor: pointer; font-weight: 600; font-size: 0.9rem; transition: opacity 0.15s, background 0.15s; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.block { display: flex; width: 100%; }
.btn + .btn { margin-left: 8px; }
.btn.block + .btn.block { margin: 8px 0 0; }
.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; background: none; cursor: pointer; color: inherit; position: relative; text-decoration: none; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); margin-bottom: 14px; }
.field input, .field select, .search-page-form input, .qty-input, .sort select {
  padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: 0.95rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.error { color: var(--sale); min-height: 1.4em; margin: 6px 0; }
.note { min-height: 1.2em; font-size: 0.9rem; }
.notice { padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); }

/* ---- icons used by the views (CSS masks) ---- */
.icon { display: inline-block; width: 26px; height: 26px; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.icon-local_shipping { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M2 6h11v10H2zM13 9h4l4 4v3h-8z'/%3E%3Ccircle cx='6' cy='18' r='2'/%3E%3Ccircle cx='17' cy='18' r='2'/%3E%3C/svg%3E"); }
.icon-undo { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M9 14 4 9l5-5'/%3E%3Cpath d='M4 9h10a6 6 0 0 1 0 12h-3'/%3E%3C/svg%3E"); }
.icon-lock { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Crect x='4' y='10' width='16' height='11' rx='2'/%3E%3Cpath d='M8 10V7a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E"); }
.icon-check { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m7 12 3 3 7-7'/%3E%3C/svg%3E"); width: 48px; height: 48px; color: var(--ok); }

/* ---- header ---- */
.announcement { margin: 0; padding: 8px 20px; text-align: center; font-size: 0.85rem; background: var(--accent); color: var(--accent-text); }
.site-header { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 12px; height: 68px; }
.logo { font-family: var(--display); font-weight: 700; font-size: 1.35rem; text-decoration: none; white-space: nowrap; }
.nav { flex: 1; min-width: 0; }
.nav ul { display: flex; gap: 22px; list-style: none; margin: 0 0 0 20px; padding: 0; overflow: hidden; }
.nav a { text-decoration: none; font-size: 0.92rem; white-space: nowrap; }
.nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.search { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding-left: 14px; background: var(--surface-2); }
.search input { border: 0; background: none; width: 160px; outline: none; font-size: 0.9rem; }
.search .icon-btn { width: 34px; height: 34px; }
.badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-text); font-size: 0.7rem; line-height: 18px; text-align: center; font-weight: 700; }
.menu-toggle { display: none; }
.mobile-nav { display: none; }
.mobile-nav ul { list-style: none; margin: 0; padding: 8px 20px 16px; }
.mobile-nav a { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; }

/* ---- main ---- */
main { min-height: 60vh; padding-top: 28px; padding-bottom: 72px; outline: none; }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 80px 0; color: var(--muted); }
.spinner { width: 20px; height: 20px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.message, .message-page { text-align: center; color: var(--muted); padding: 40px 0; }
.message-page { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 64px 0; }
.message-page h1 { color: var(--text); margin: 0; }
.not-found .eyebrow { font-size: 3rem; letter-spacing: 0; color: var(--line); font-weight: 800; margin: 0; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 18px; font-size: 0.82rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; }
.breadcrumbs a { text-decoration: none; }

/* ---- product grid ---- */
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 28px 20px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.card a { display: block; text-decoration: none; }
.card-media { position: relative; overflow: hidden; border-radius: var(--card-radius); background: var(--surface-2); aspect-ratio: var(--card-ratio); }
.card-media img, .card-media .ph { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.card a:hover .card-media img { transform: scale(1.04); }
.card-title { font-family: var(--font); font-weight: 500; font-size: 0.97rem; margin: 12px 0 2px; }
.price { margin: 0; color: var(--text); }
.price s { color: var(--muted); font-weight: 400; }
.badge.sale { top: 10px; left: 10px; right: auto; height: auto; padding: 3px 9px; border-radius: 4px; background: var(--sale); color: #fff; line-height: 1.4; }
.ph { width: 100%; aspect-ratio: var(--card-ratio); background: linear-gradient(135deg, var(--surface-2), var(--line)); }

/* ---- home ---- */
.home { display: flex; flex-direction: column; gap: 64px; }
.hero { position: relative; display: grid; align-items: center; min-height: 420px; border-radius: var(--card-radius); overflow: hidden; background: var(--surface-2); }
.hero-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero:not(.with-image) .hero-image { display: none; }
.hero.with-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.05)); }
.hero-copy { position: relative; z-index: 1; padding: 48px clamp(24px, 6vw, 72px); max-width: 640px; }
.hero.with-image .hero-copy { color: #fff; }
.hero.with-image .eyebrow { color: rgba(255, 255, 255, 0.85); }
.hero h1 { font-size: clamp(2.2rem, 5.5vw, 4rem); }
.hero.with-image .btn.primary { background: #fff; color: #111; border-color: #fff; }
.lede { font-size: 1.1rem; margin: 0 0 24px; }
.usp { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; padding: 24px; border-radius: var(--card-radius); background: var(--surface-2); }
.usp > div { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center; }
.usp .icon { grid-row: span 2; }
.usp span.muted { font-size: 0.85rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 20px; }
.section-head h2 { margin: 0; }
.section-head a { font-size: 0.9rem; }
.category-tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.category-tiles a { position: relative; display: block; border-radius: var(--card-radius); overflow: hidden; aspect-ratio: 1; text-decoration: none; }
.category-tiles img, .category-tiles .ph { width: 100%; height: 100%; object-fit: cover; aspect-ratio: auto; }
.category-tiles span { position: absolute; left: 12px; bottom: 12px; padding: 6px 12px; border-radius: 999px; background: var(--surface); font-weight: 600; font-size: 0.9rem; }
.story { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.story img { border-radius: var(--card-radius); aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.story:not(:has(img)) { grid-template-columns: 1fr; max-width: 720px; }
.post-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 28px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.post-card a { display: block; text-decoration: none; }
.post-card img, .post-card .ph { aspect-ratio: 3 / 2; width: 100%; object-fit: cover; border-radius: var(--card-radius); margin-bottom: 12px; }
.post-card h3 { font-size: 1.15rem; margin: 2px 0 6px; }
.post-card p { margin: 0 0 6px; }

/* ---- listings ---- */
.listing-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.listing-head h1 { margin: 0; }
.intro { max-width: 680px; margin: 8px 0 0; }
.sort { font-size: 0.85rem; color: var(--muted); }
.count { margin: 0 0 16px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 20px; }
.chips a { display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: 0.88rem; }
.chips a:hover { border-color: var(--text); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); }
.search-page-form { display: flex; gap: 10px; max-width: 560px; margin: 0 0 24px; width: 100%; }
.search-page-form input { flex: 1; }
.category-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.category-list > li { padding: 22px; border: 1px solid var(--line); border-radius: var(--card-radius); background: var(--surface); }
.category-name { font-family: var(--display); font-size: 1.25rem; font-weight: var(--display-weight); text-decoration: none; }
.subcats { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0; margin: 12px 0 0; font-size: 0.88rem; }

/* ---- product ---- */
.product-layout { display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: start; }
.gallery-main { border-radius: var(--card-radius); overflow: hidden; background: var(--surface-2); }
.gallery-main img { width: 100%; aspect-ratio: var(--card-ratio); object-fit: cover; }
.thumbs { display: flex; gap: 10px; margin-top: 10px; overflow-x: auto; }
.thumbs button { border: 1px solid var(--line); border-radius: var(--radius); padding: 0; background: none; cursor: pointer; flex: 0 0 72px; overflow: hidden; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; }
.info { position: sticky; top: 96px; }
.info h1 { margin-bottom: 8px; }
.price.big { font-size: 1.4rem; margin: 0 0 24px; }
.option { border: 0; padding: 0; margin: 0 0 18px; }
.option legend { font-size: 0.88rem; color: var(--muted); margin-bottom: 8px; }
.option legend strong { color: var(--text); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { min-width: 48px; padding: 9px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.swatch[aria-pressed="true"] { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.buy-row { display: flex; gap: 10px; margin-top: 8px; }
.qty-input { width: 84px; text-align: center; }
.buy-row .btn { flex: 1; }
.stock { font-size: 0.88rem; margin: 12px 0 0; }
.stock.in { color: var(--ok); }
.stock.out { color: var(--sale); }
.description { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.description h2 { font-size: 1rem; }
.related { margin-top: 72px; }

/* ---- text pages ---- */
.prose { max-width: 760px; }
.page { margin: 0 auto; }
.prose h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.prose blockquote { border-left: 3px solid var(--line); margin: 20px 0; padding-left: 16px; color: var(--muted); }
.prose pre { background: var(--surface-2); padding: 12px; overflow-x: auto; border-radius: var(--radius); }
.prose img { border-radius: var(--radius); }
.cover { width: 100%; border-radius: var(--card-radius); margin-bottom: 24px; }
.post-nav { display: flex; justify-content: space-between; gap: 20px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }

/* ---- cart drawer ---- */
.drawer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); opacity: 0; transition: opacity 0.2s; }
.drawer-panel { position: absolute; top: 0; right: 0; height: 100%; width: min(420px, 100%); background: var(--surface); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.25s ease; box-shadow: -12px 0 40px rgba(0, 0, 0, 0.12); }
.drawer-open .drawer { pointer-events: auto; }
.drawer-open .drawer-backdrop { opacity: 1; }
.drawer-open .drawer-panel { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 1.15rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; }
.drawer-body .empty { margin: 24px 0 16px; }
.drawer-lines { list-style: none; margin: 0; padding: 0; flex: 1; }
.drawer-lines li { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.drawer-lines img, .drawer-lines .ph { width: 64px; height: 80px; object-fit: cover; border-radius: var(--radius); aspect-ratio: auto; }
.line-info a { text-decoration: none; font-weight: 500; }
.line-info p { margin: 0; font-size: 0.85rem; }
.drawer-foot { padding-top: 16px; }
.subtotal { display: flex; justify-content: space-between; margin: 0 0 4px; }
.qty { display: inline-flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: var(--radius); margin-top: 8px; }
.qty button { width: 32px; height: 32px; border: 0; background: none; cursor: pointer; font-size: 1.1rem; }
.qty.small button { width: 28px; height: 28px; }

/* ---- cart, checkout, account ---- */
.cart, .checkout, .account { max-width: 980px; margin: 0 auto; }
.lines { list-style: none; padding: 0; margin: 0; }
.lines li { display: grid; grid-template-columns: 72px 1fr auto auto; gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.lines img, .lines .ph { width: 72px; height: 88px; object-fit: cover; border-radius: var(--radius); aspect-ratio: auto; }
.lines p { margin: 0; }
.cart-foot { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-top: 20px; }
.total { font-size: 1.1rem; margin: 0; }
.checkout-layout { display: grid; grid-template-columns: 1fr 340px; gap: 32px; align-items: start; }
.checkout-form { border: 1px solid var(--line); border-radius: var(--card-radius); padding: 24px; margin-bottom: 20px; background: var(--surface); }
.checkout-form h2 { font-size: 1.15rem; }
.ship-option { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; }
.ship-option span:nth-child(2) { flex: 1; }
.pay-note { display: flex; gap: 10px; align-items: center; padding: 14px; border-radius: var(--radius); background: var(--surface-2); font-size: 0.88rem; margin: 12px 0 16px; }
.pay-note .icon { width: 20px; height: 20px; flex: none; }
.summary { position: sticky; top: 96px; padding: 20px; border-radius: var(--card-radius); background: var(--surface-2); }
.summary h2 { font-size: 1.05rem; }
.summary ul { list-style: none; padding: 0; margin: 0 0 12px; font-size: 0.9rem; }
.summary li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.auth { max-width: 440px; margin: 24px auto; }
.auth h1 { text-align: center; }
.auth-form { border: 1px solid var(--line); border-radius: var(--card-radius); padding: 28px; background: var(--surface); margin-bottom: 16px; }
.auth-form.wide { max-width: 640px; }
.account-nav { display: flex; flex-wrap: wrap; gap: 6px 22px; padding-bottom: 14px; margin: 8px 0 28px; border-bottom: 1px solid var(--line); }
.account-nav a { text-decoration: none; color: var(--muted); }
.account-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.account-nav .link { margin-left: auto; }
.orders { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.orders th, .orders td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); }
.orders th { color: var(--muted); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; background: var(--surface-2); text-transform: capitalize; }
.status-completed { color: var(--ok); }
.status-canceled { color: var(--sale); }
.addresses { list-style: none; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: 0 0 28px; }
.address-card { border: 1px solid var(--line); border-radius: var(--card-radius); padding: 16px; margin-top: 16px; }
.address-card p { margin: 0; }

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface-2); padding: 48px 0 40px; }
.footer-grid { display: grid; gap: 32px; grid-template-columns: 2fr 1fr 1fr 1fr; }
.footer-brand strong { font-family: var(--display); font-size: 1.2rem; }
.site-footer h2 { font-family: var(--font); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; line-height: 2.1; font-size: 0.92rem; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ---- small screens ---- */
@media (max-width: 960px) {
  .nav, .search { display: none; }
  .menu-toggle { display: inline-flex; }
  .bar { gap: 4px; }
  .logo { flex: 1; text-align: center; }
  .menu-open .mobile-nav { display: block; border-top: 1px solid var(--line); }
  .product-layout, .story, .checkout-layout { grid-template-columns: 1fr; }
  .info, .summary { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 20px 12px; }
  .row { grid-template-columns: 1fr; }
  .lines li { grid-template-columns: 56px 1fr; }
  .hero { min-height: 340px; }
  .footer-grid { grid-template-columns: 1fr; }
  .home { gap: 44px; }
}
