:root {
  --bg: #e6e6e6;
  --panel: #ffffff;
  --well: #efefef;
  --line: #dcdcdc;
  --text: #111111;
  --muted: #5a5a5a;
  --faint: #8a8a8a;
  --dark: #1f1f1f;
  --dark-text: #d9d9d9;
  --focus: #111111;
  --rail: 220px;
  --pad: 40px;
  --gutter: 20px;
  --topbar: 56px;
  --z-rail: 30; --z-top: 40;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--panel); color: var(--text); font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
@media (min-width: 900px) { body { font-size: 14px; } }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
select, input { font: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.page { width: 100%; min-height: 100dvh; display: flex; flex-direction: column; }

/* top bar: sticky on mobile, hidden on desktop (the rail takes over) */
.topbar { position: sticky; top: 0; z-index: var(--z-top); display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--panel); padding: 0 var(--gutter); min-height: var(--topbar); border-bottom: 1px solid var(--line); }
.topbar .logo { font-size: 17px; }
.topbar-right { display: flex; align-items: center; gap: 4px; }
.topbar-cart { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.menu-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; margin-right: -10px; }
@media (min-width: 900px) { .topbar { display: none; } }

.logo { font-weight: 600; font-size: 18px; letter-spacing: -.01em; }

/* frame: rail + main */
.frame { flex: 1; display: grid; grid-template-columns: 1fr; }
@media (min-width: 900px) { .frame { grid-template-columns: var(--rail) minmax(0, 1fr); } }

.rail { display: none; padding: 8px var(--gutter) 20px; border-bottom: 1px solid var(--line); }
.rail.open { display: block; }
@media (min-width: 900px) {
  .rail { display: block; border-bottom: 0; border-right: 1px solid var(--line); padding: var(--pad) 28px; position: sticky; top: 0; align-self: start; height: 100dvh; overflow: auto; }
}
.rail-logo { display: none; margin-bottom: 40px; }
@media (min-width: 900px) { .rail-logo { display: block; } }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 0 10px 18px; position: relative; min-height: 44px; display: flex; align-items: center; }
.nav a::before { content: ""; position: absolute; left: 0; top: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--text); transform: translateY(-50%); opacity: 0; transition: opacity .2s; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); }
.nav a.active::before { opacity: 1; }
.nav-cart { margin-top: 20px; }
.rail-note { margin-top: 48px; font-size: 11px; color: var(--faint); line-height: 1.5; display: none; }
@media (min-width: 900px) { .rail-note { display: block; } }

.main { padding: 20px var(--gutter) 56px; min-width: 0; }
@media (min-width: 900px) { .main { padding: var(--pad) var(--pad) 80px; } }
@media (min-width: 1400px) { .main { padding-left: 56px; padding-right: 56px; } }

/* headers */
.head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 24px; margin-bottom: 20px; }
@media (min-width: 900px) { .head { margin-bottom: 28px; } }
.head h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.head .count { color: var(--muted); font-size: 12px; }
.head .spacer { flex: 1; }
.sort { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); min-height: 44px; }
.sort select { border: 0; background: transparent; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text); padding: 8px 0; cursor: pointer; min-height: 44px; max-width: 46vw; }
@media (max-width: 899px) { .head .sort { flex-basis: 100%; } .head .spacer { display: none; } }
.tabs { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin: 0 calc(-1 * var(--gutter)) 20px; padding: 0 var(--gutter) 4px; }
@media (min-width: 900px) { .tabs { margin: 0 0 28px; padding: 0 0 4px; gap: 24px; } }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { white-space: nowrap; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 0; min-height: 44px; display: inline-flex; align-items: center; border-bottom: 1px solid transparent; transition: color .2s; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); font-weight: 600; }

/* grid + cards */
.grid { display: grid; grid-template-columns: 1fr; gap: 24px 16px; }
@media (min-width: 480px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 20px; } }
@media (min-width: 1700px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.grid.tiles { gap: 20px 16px; }
@media (min-width: 480px) { .grid.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid.tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1400px) { .grid.tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { display: block; cursor: pointer; min-width: 0; }
.card .well { background: var(--well); aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card .well img { width: 100%; height: 100%; object-fit: contain; padding: 8%; transition: opacity .2s; }
.card:hover .well img { opacity: .85; }
.card .well.empty { color: var(--faint); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; text-align: center; padding: 12px; }
.card .meta { padding-top: 10px; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card .name { font-size: 13px; line-height: 1.4; }
.card .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card .stock { font-size: 11px; color: var(--faint); margin-top: 2px; }
.card .meta-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: 0 0 auto; }
.card .add-card { white-space: nowrap; }
.card .included { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text); border: 1px solid var(--line); padding: 6px 10px; white-space: nowrap; }
.tile .well { aspect-ratio: 4 / 3; }
.tile .name { font-size: 14px; font-weight: 500; }

.price { font-size: 13px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: baseline; }
.price .sep { color: var(--faint); }
.price.big { font-size: 19px; }
.price .from { font-size: 11px; color: var(--muted); margin-right: 4px; }

/* product page */
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.crumb a:hover { color: var(--text); }
.product { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
@media (min-width: 900px) { .product { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 48px; align-items: start; } }
@media (min-width: 1400px) { .product { grid-template-columns: minmax(0, 1.3fr) minmax(360px, 1fr); gap: 64px; } }
.gallery .stage { background: var(--well); aspect-ratio: 1 / 1; position: relative; overflow: hidden; }
.gallery .stage img { width: 100%; height: 100%; object-fit: contain; padding: 4%; }
.gallery .stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.gallery .thumbs { display: flex; gap: 8px; margin: 8px calc(-1 * var(--gutter)) 0; padding: 0 var(--gutter); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
@media (min-width: 900px) { .gallery .thumbs { margin: 8px 0 0; padding: 0; flex-wrap: wrap; } }
.gallery .thumbs::-webkit-scrollbar { display: none; }
.gallery .thumbs button { width: 64px; height: 64px; flex: 0 0 auto; background: var(--well); border: 1px solid transparent; display: flex; align-items: center; justify-content: center; }
.gallery .thumbs button img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.gallery .thumbs button.active { border-color: var(--text); }
.gallery .thumbs .video-thumb { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.gallery .thumbs .video-thumb svg { margin-right: 4px; }
.gallery .caption { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 10px 0 0; }
.gallery .ai-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; max-width: 60ch; line-height: 1.5; }

.info h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; letter-spacing: -.01em; line-height: 1.25; }
@media (min-width: 1400px) { .info h1 { font-size: 26px; } }
.info .maker { color: var(--muted); font-size: 13px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.info .maker a.ig { display: inline-flex; align-items: center; gap: 5px; color: var(--text); padding: 6px 0; min-height: 44px; }
.info .maker a.ig svg { width: 14px; height: 14px; }
.info .price-row { margin: 18px 0 6px; }
.info .stock { font-size: 12px; color: var(--muted); }
.dl { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px 14px; margin: 22px 0 0; font-size: 13px; }
@media (min-width: 900px) { .dl { grid-template-columns: 110px minmax(0, 1fr); gap: 8px 16px; } }
.dl dt { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding-top: 2px; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.note { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; margin: 20px 0; font-size: 13px; }
.variant { margin-top: 22px; }
.variant label { display: block; }
.variant select { width: 100%; border: 1px solid var(--line); background: var(--panel); padding: 10px 12px; margin-top: 6px; min-height: 44px; border-radius: 0; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px; border: 1px solid var(--text); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; transition: background .2s, color .2s; border-radius: 0; }
.btn:hover { background: var(--text); color: var(--panel); }
.btn.primary { background: var(--text); color: var(--panel); }
.btn.primary:hover { background: #333; border-color: #333; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 11px; }
@media (max-width: 899px) { .actions .btn.primary { flex: 1 1 100%; } .card .add-card { min-height: 40px; } }
.added { font-size: 12px; color: var(--muted); }
.source { font-size: 12px; color: var(--faint); margin-top: 28px; }
.source a { text-decoration: underline; text-underline-offset: 3px; }

.section { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
@media (min-width: 900px) { .section { margin-top: 56px; padding-top: 28px; } }
.section h2 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; margin: 0 0 20px; }

/* cart */
.cart-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cart-table th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 0 0 10px; border-bottom: 1px solid var(--line); }
.cart-table td { padding: 14px 12px 14px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.cart-table td:last-child, .cart-table th:last-child { text-align: right; padding-right: 0; }
.cart-table .thumb { width: 56px; height: 56px; background: var(--well); display: flex; align-items: center; justify-content: center; }
.cart-table .thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
@media (max-width: 599px) {
  .cart-table thead { display: none; }
  .cart-table tr { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .cart-table td { display: block; padding: 0; border: 0; }
  .cart-table td:first-child { grid-row: 1 / span 3; }
  .cart-table td:last-child { text-align: left; }
}
.qty { display: inline-flex; border: 1px solid var(--line); }
.qty button { width: 44px; height: 40px; }
.qty span { width: 40px; display: inline-flex; align-items: center; justify-content: center; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.remove { font-size: 11px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; margin-top: 6px; display: inline-block; min-height: 32px; }
.totals { display: flex; justify-content: flex-end; margin-top: 20px; }
.totals .box { min-width: min(100%, 260px); }
.totals .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.totals .row.total { border-top: 1px solid var(--text); margin-top: 6px; padding-top: 12px; font-weight: 600; }
.checkout-note { font-size: 12px; color: var(--muted); max-width: 520px; margin-top: 18px; }
.empty-state { color: var(--muted); padding: 40px 0; }

/* footer */
.footer { background: var(--dark); color: var(--dark-text); display: grid; grid-template-columns: 1fr; gap: 24px; padding: 36px var(--gutter) calc(48px + var(--safe-b)); font-size: 12px; }
@media (min-width: 900px) { .footer { grid-template-columns: 1.2fr 1fr 1fr; padding: 48px var(--pad) 72px; } }
.footer p { margin: 0 0 8px; }
.footer .muted { color: #8f8f8f; }
.footer-nav { display: flex; flex-direction: column; gap: 6px; }
.footer-nav a { letter-spacing: .08em; text-transform: uppercase; font-size: 11px; color: var(--dark-text); min-height: 32px; display: inline-flex; align-items: center; }
.footer-nav a:hover { color: #fff; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
