/* Relaptops storefront.
   Layout: a shelf of laptops. Each card carries a spec strip like a shop shelf label,
   and the price sits on a yellow sticker, the one loud element on the page. */
:root {
  --bg: #eef1f4;          /* cool workshop grey */
  --surface: #ffffff;
  --ink: #16212e;
  --muted: #5b6878;
  --line: #d5dbe2;
  --brand: #0d5c75;       /* lid blue */
  --brand-ink: #ffffff;
  --sticker: #ffd23f;     /* price sticker */
  --sticker-ink: #1d1a05;
  --ok: #1d7a46;
  --warn: #a35a00;
  --bad: #b3261e;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10161d; --surface: #19222c; --ink: #e8edf2; --muted: #9aa7b6; --line: #2b3744;
    --brand: #58b7d3; --brand-ink: #06202a; --sticker: #ffd23f; --sticker-ink: #1d1a05;
    --ok: #5fcf8f; --warn: #f0b05a; --bad: #ff8a80;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--body); }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }

/* header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  padding: 12px var(--gutter);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font: 700 1.5rem/1 var(--display); color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand-re { color: var(--brand); }
.shop-switch { display: flex; margin-left: auto; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--bg); }
.shop-switch button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font-weight: 500; white-space: nowrap; }
.shop-switch small { color: var(--muted); font-size: .75rem; margin-left: 2px; }
.shop-switch button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.shop-switch button[aria-pressed="true"] small { color: inherit; opacity: .8; }
.cart-btn { border: 1px solid var(--ink); background: var(--surface); padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.cart-count { display: inline-block; min-width: 1.5em; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--sticker); color: var(--sticker-ink); font-variant-numeric: tabular-nums; text-align: center; }

main { padding: 0 var(--gutter) 64px; max-width: 1280px; margin: 0 auto; }
.intro { padding-block: clamp(28px, 6vw, 56px) 20px; }
.intro h1 { font-size: clamp(2rem, 6vw, 3.4rem); letter-spacing: -0.03em; }
.intro p { margin: 10px 0 0; color: var(--muted); max-width: 56ch; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 12px; padding-block: 12px 20px; }
.field { display: grid; gap: 4px; min-width: 150px; flex: 1 1 150px; }
.field.grow { flex: 3 1 240px; }
.field span { font-size: .8rem; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.status { color: var(--muted); margin: 0 0 16px; min-height: 1.5em; }
.status.error { color: var(--bad); }

/* shelf */
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.card-open { all: unset; cursor: pointer; display: block; }
.card-open:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }
.photo { position: relative; aspect-ratio: 4 / 3; background: var(--bg); display: grid; place-items: center; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo svg { width: 46%; color: var(--line); }
.sticker {
  position: absolute; left: 10px; bottom: -14px; padding: 6px 12px; border-radius: 4px;
  background: var(--sticker); color: var(--sticker-ink);
  font: 700 1.15rem/1.1 var(--display); font-variant-numeric: tabular-nums; transform: rotate(-2deg);
  box-shadow: 0 1px 0 rgba(0,0,0,.25);
}
.cond { position: absolute; right: 10px; top: 10px; padding: 3px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .78rem; font-weight: 500; }
.card-text { padding: 26px 14px 10px; display: grid; gap: 6px; }
.card-text .maker { color: var(--muted); font-size: .85rem; }
.card-text h3 { font-size: 1.15rem; }
.specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 6px 0 0; border-top: 1px dashed var(--line); }
.specs div { padding: 6px 0; border-bottom: 1px dashed var(--line); min-width: 0; }
.specs dt { font-size: .72rem; color: var(--muted); }
.specs dd { margin: 0; font-size: .9rem; font-weight: 500; overflow-wrap: anywhere; }
.card-foot { margin-top: auto; padding: 8px 14px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stock { font-size: .85rem; font-weight: 500; }
.stock.in { color: var(--ok); } .stock.low { color: var(--warn); } .stock.out { color: var(--bad); }

.btn { border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 600; background: var(--brand); color: var(--brand-ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: none; color: var(--ink); border: 1px solid var(--line); }
.btn.wide { width: 100%; padding: 13px 16px; }

.empty { grid-column: 1 / -1; padding: 40px 20px; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font: 700 1.2rem var(--display); margin-bottom: 4px; }

/* dialogs */
dialog { border: 0; padding: 0; color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgba(10, 16, 24, .55); }
.close { position: absolute; right: 10px; top: 8px; width: 40px; height: 40px; border: 0; background: none; font-size: 1.8rem; line-height: 1; }
.sheet { width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border-radius: 12px; }
.sheet .pd { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.sheet .pd-photo { background: var(--bg); display: grid; place-items: center; min-height: 220px; }
.sheet .pd-photo img { width: 100%; height: 100%; object-fit: cover; }
.sheet .pd-photo svg { width: 40%; color: var(--line); }
.sheet .pd-text { padding: 28px 22px 22px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.sheet .pd-text h2 { font-size: 1.6rem; padding-right: 30px; }
.sheet .pd-price { font: 700 1.5rem var(--display); font-variant-numeric: tabular-nums; }
.sheet .pd-desc { color: var(--muted); margin: 0; white-space: pre-line; }

.drawer { margin: 0 0 0 auto; width: min(440px, 100vw); height: 100dvh; max-height: 100dvh; padding: 22px 20px 28px; overflow-y: auto; }
.drawer h2 { font-size: 1.5rem; margin-bottom: 14px; }
.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.line-name { font-weight: 600; overflow-wrap: anywhere; }
.line-price { font-variant-numeric: tabular-nums; text-align: right; }
.qty { display: inline-flex; align-items: center; gap: 4px; }
.qty button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.qty output { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.remove { border: 0; background: none; color: var(--muted); text-decoration: underline; padding: 0; justify-self: end; }
.total { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0; font: 700 1.3rem var(--display); font-variant-numeric: tabular-nums; }
.checkout { display: grid; gap: 12px; }
.checkout .field { min-width: 0; }
.note { color: var(--muted); font-size: .88rem; margin: 0; }
.form-error { color: var(--bad); font-weight: 500; margin: 0; }
.done { display: grid; gap: 12px; }
.done .order-no { font: 700 2.2rem var(--display); font-variant-numeric: tabular-nums; }

.foot { padding: 24px var(--gutter) 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.foot p { margin: 0; }

@media (max-width: 560px) {
  .shop-switch { order: 3; margin-left: 0; width: 100%; }
  .shop-switch button { flex: 1; }
  .cart-btn { margin-left: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .shop-switch button { transition: background-color .15s, color .15s; }
}
