/* ==========================================================================
   Clickwell theme layer — "chrome render + app window" style.
   Source of truth: docs/style.md (see also CLAUDE.md → Style rules).
   Loaded after app.css: remaps the design-system tokens (owner pages inherit
   it) and adds the storefront layout.
   Core rules: achromatic UI (#f1f2f3 / #fff / #111 / #2d2d2d / #ddd / #b4b4b4)
   · colour only inside product renders · system font at 500/700/800 ·
   line-height 1.25 · headings 28px/800/-0.036em · radii: 1.5px default,
   13px window chrome, 20px buttons, 25px app-window card · black pill CTA
   with a trailing › · subtle shadow only on window cards.
   ========================================================================== */

:root, :root:not([data-theme="dark"]) {
  --color-canvas-mist: #f1f2f3;
  --color-carbon-black: #111111;
  --color-pure-white: #ffffff;
  --color-graphite: #2d2d2d;
  --color-pale-stone: #dddddd;
  --color-silver-mist: #b4b4b4;

  --font-system: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono-ui: ui-monospace, "SF Mono", Menlo, "JetBrains Mono", Consolas, monospace;

  --radius-default: 1.5px;
  --radius-window-chrome: 13px;
  --radius-buttons: 20px;
  --radius-cards: 25px;
  --shadow-window: 0 1px 3px rgba(17, 17, 17, .08), 0 4px 12px rgba(17, 17, 17, .06);

  /* Remap app.css tokens — strictly achromatic */
  --font-sans: var(--font-system);
  --font-mono: var(--font-mono-ui);
  --bg: var(--color-canvas-mist);
  --surface: var(--color-pure-white);
  --surface-2: var(--color-canvas-mist);
  --border: var(--color-pale-stone);
  --border-strong: var(--color-pale-stone);
  --text: var(--color-carbon-black);
  --text-muted: #5c5d5e;
  --text-faint: #8a8b8c;
  --accent: var(--color-carbon-black);
  --accent-hover: var(--color-graphite);
  --accent-soft: var(--color-canvas-mist);
  --accent-text: #ffffff;
  --success: var(--color-carbon-black);
  --success-soft: var(--color-canvas-mist);
  --warning: var(--color-graphite);
  --warning-soft: var(--color-canvas-mist);
  --danger: var(--color-carbon-black);
  --danger-soft: var(--color-canvas-mist);
  --radius: var(--radius-default);
  --radius-sm: var(--radius-default);
  --radius-lg: var(--radius-window-chrome);
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: none;
  color-scheme: light;
}

body { font-family: var(--font-system); font-weight: 500; font-size: 16px; line-height: 1.25; letter-spacing: -0.016em;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, .card__title, .stat__value, .topbar h1 {
  font-family: var(--font-system); font-weight: 800; line-height: 1.25; letter-spacing: -0.036em; color: var(--text); }
h1, h2 { font-size: 28px; }
h3 { font-size: 18px; letter-spacing: -0.016em; }
b, strong { font-weight: 800; }
a { color: var(--text); }
p a, .muted a { text-decoration: underline; text-underline-offset: 2px; font-weight: 700; }
.mono { font-family: var(--font-mono-ui); font-weight: 800; font-size: 12px; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }

/* Buttons — black lozenge is the CTA; secondary is the quiet white lozenge */
.btn { border-radius: var(--radius-buttons); border: 1px solid var(--color-pale-stone); padding: 10px 20px;
  font-size: 12px; font-weight: 800; letter-spacing: 0; line-height: 1.25; gap: 5px;
  background: var(--color-pure-white); color: var(--color-carbon-black); box-shadow: none; }
.btn:hover { background: var(--color-canvas-mist); color: var(--color-carbon-black); }
.btn--primary { background: var(--color-carbon-black); border-color: var(--color-carbon-black); color: #fff; }
.btn--primary:hover { background: var(--color-carbon-black); color: #fff; }
.btn--primary.chev::after, .btn.chev::after { content: "›"; font-weight: 800; font-size: 14px; line-height: 1; margin-left: 2px; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text); }
.btn--ghost:hover { background: transparent; text-decoration: underline; }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--lg { padding: 12px 24px; font-size: 12px; }
.btn--block { width: 100%; }
.btn:disabled { color: var(--color-silver-mist); background: var(--color-canvas-mist); border-color: var(--color-pale-stone); cursor: default; }
.btn:focus-visible, .input:focus-visible, .select:focus-visible, summary:focus-visible { outline: 2px solid var(--color-carbon-black); outline-offset: 2px; }

/* Cards, inputs, badges */
.card { border-radius: var(--radius-window-chrome); border: 0; box-shadow: none; background: var(--surface); }
.card__head { border-bottom: 2px solid var(--color-pale-stone); padding: 10px 20px; }
.card__body { padding: 20px; }
.card__title { font-size: 18px; letter-spacing: -0.016em; }
.input, .select, .textarea { border-radius: var(--radius-default); border: 1px solid var(--color-pale-stone); font-size: 16px; font-weight: 500;
  padding: 10px 12px; box-shadow: none; background: #fff; color: var(--text); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--color-carbon-black); box-shadow: none; }
.select { appearance: auto; width: auto; font-size: 12px; font-weight: 800; padding: 9px 12px; }
.badge { border-radius: var(--radius-default); font-weight: 800; font-size: 12px; background: var(--color-canvas-mist); color: var(--text);
  border: 1px solid var(--color-pale-stone); padding: 3px 8px; }
.badge::before { display: none; }
.badge--accent, .badge--success, .badge--warning, .badge--danger { background: var(--color-canvas-mist); color: var(--text); }
.toast { border: 0; border-radius: var(--radius-buttons); box-shadow: var(--shadow-window); font-size: 12px; font-weight: 800;
  padding: 10px 20px; background: var(--color-carbon-black); color: #fff; min-width: 0; }
.spinner { border-color: var(--color-pale-stone); border-top-color: var(--color-carbon-black); }
.empty { color: var(--text-muted); }

/* Window chrome (shared by hero card, product cards, drawer, owner cards) */
.win { background: #fff; border-radius: var(--radius-window-chrome); overflow: hidden; }
.win--app { border-radius: var(--radius-cards); box-shadow: var(--shadow-window); padding: 10px; }
.win__bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 2px solid var(--color-pale-stone); }
.win--app .win__bar { padding: 2px 6px 10px; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--color-silver-mist); display: block; }
.dots i + i { background: var(--color-graphite); }
.win__title { font-family: var(--font-mono-ui); font-weight: 800; font-size: 12px; color: var(--text-muted); margin-left: auto; letter-spacing: 0; }

/* Owner shell (base.html) */
.sidebar__brand .logo, .shop-brand .logo { background: var(--color-carbon-black); box-shadow: none; border-radius: var(--radius-default);
  font-weight: 800; color: #fff; font-family: var(--font-mono-ui); }
.sidebar__brand { font-weight: 800; letter-spacing: -0.036em; }
.nav-item { border-radius: var(--radius-default); font-size: 16px; font-weight: 700; }
.nav-item.active { background: var(--color-carbon-black); color: #fff; }
.nav-item.active:hover { background: var(--color-carbon-black); color: #fff; }
.topbar { background: rgba(241, 242, 243, .9); border-bottom: 2px solid var(--color-pale-stone); }
.topbar h1 { font-size: 28px; margin: 0; }
.stat__label { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0; }
.stat__value { font-size: 28px; }
.table th { font-size: 12px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0; }
.table td { font-weight: 500; }

/* ── Utility bar (prototype notice) ────────────────────────────────────── */
.proto-banner { background: var(--color-canvas-mist); color: var(--text-muted); font-size: 12px; font-weight: 500; letter-spacing: 0;
  padding: 8px 16px; text-align: center; border-bottom: 1px solid var(--color-pale-stone); }
.proto-banner strong { color: var(--text); }
.proto-banner a { color: var(--text); text-decoration: underline; font-weight: 800; }
.proto-banner code { font-family: var(--font-mono-ui); font-weight: 800; background: #fff; padding: 1px 5px; border-radius: var(--radius-default); }

/* ── Storefront ────────────────────────────────────────────────────────── */
.shop-wrap { padding: 0 30px; }     /* centered but unconstrained — no max-width */

.shop-header { position: sticky; top: 0; z-index: 30; background: rgba(241, 242, 243, .88);
  backdrop-filter: saturate(160%) blur(16px); border-bottom: 1px solid var(--color-pale-stone); }
.shop-header .shop-wrap { height: 52px; }
.shop-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; letter-spacing: -0.036em; color: var(--text); text-decoration: none; }
.shop-brand .logo { width: 22px; height: 22px; display: grid; place-items: center; font-size: 12px; }
.shop-nav { display: flex; gap: 20px; }
.shop-nav a { color: var(--text-muted); font-size: 12px; font-weight: 800; text-decoration: none; }
.shop-nav a:hover { color: var(--text); }
.cart-btn { padding: 7px 14px; }
.cart-count:not(:empty) { background: var(--color-carbon-black); color: #fff; border-radius: var(--radius-buttons); min-width: 18px; height: 18px;
  padding: 0 5px; font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; }

.kicker { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0; color: var(--text-muted); margin: 0 0 8px; }

/* Hero: the render is the hero; the app-window card sits 30px below it */
.hero { min-height: min(calc(100vh - 86px), 860px); display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px 0 60px; text-align: center; }
.hero__render { width: min(560px, 92vw); height: auto; display: block; }
.hero__card { width: min(300px, 90vw); margin-top: 30px; }
.hero__card .wordmark { font-size: 28px; font-weight: 800; letter-spacing: -0.036em; margin: 16px 0 4px; }
.hero__card .tag { font-size: 12px; color: var(--text-muted); margin: 0 0 16px; }
.hero__card .btn { margin-bottom: 8px; }
.hero__facts { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; margin-top: 30px; font-size: 12px; color: var(--text-muted); }
.hero__facts b { color: var(--text); }

/* Sections — compact, one canvas, no bands */
.section { padding: 60px 0 30px; }
.section__head { margin: 0 0 20px; }
.section__head h2 { margin: 0 0 5px; }
.section__head p { margin: 0; color: var(--text-muted); font-size: 16px; }

/* Filters */
.filters { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 20px; }
.filters__right { gap: 8px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 9px 16px; border-radius: var(--radius-buttons); font-size: 12px; font-weight: 800;
  border: 1px solid var(--color-pale-stone); background: #fff; color: var(--text); cursor: pointer; }
.chip span:hover { border-color: var(--color-carbon-black); }
.chip input:checked + span { background: var(--color-carbon-black); border-color: var(--color-carbon-black); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--color-carbon-black); outline-offset: 2px; }

/* Product windows */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.product { display: flex; flex-direction: column; }
.product__art { padding: 30px 70px 10px; background: #fff; }
.product__body { padding: 10px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.product__flag { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); margin: 0 0 5px; min-height: 15px; }
.product h3 { margin: 0; font-size: 28px; letter-spacing: -0.036em; }
.product__tag { margin: 5px 0 10px; font-size: 16px; color: var(--text-muted); }
.product__meta { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; }
.rating { font-size: 12px; font-weight: 800; color: var(--text); }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; margin: 0 0 20px; font-size: 12px; }
.specs div { display: flex; justify-content: space-between; border-top: 1px solid var(--color-pale-stone); padding: 8px 0; }
.specs dt { color: var(--text-muted); font-weight: 700; }
.specs dd { margin: 0; white-space: nowrap; font-weight: 800; }
.product__foot { margin-top: auto; }
.price { font-size: 18px; font-weight: 800; letter-spacing: -0.016em; }
.mouse-svg { width: 100%; height: auto; display: block; }

/* Guide */
.guide { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.guide p { margin: 0; color: var(--text-muted); }
.guide h3 { margin: 0 0 8px; }

/* FAQ — sharp hairline rows */
.faq-list { display: grid; gap: 8px; max-width: 760px; }
.faq-list details { background: #fff; border-radius: var(--radius-default); padding: 14px 20px; }
.faq-list summary { list-style: none; cursor: pointer; font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::before { content: "›"; font-weight: 800; width: 10px; transition: transform .15s; }
.faq-list details[open] summary::before { transform: rotate(90deg); }
.faq-list details p { margin: 10px 0 0 20px; color: var(--text-muted); }

.shop-footer { border-top: 1px solid var(--color-pale-stone); padding: 20px 0 30px; margin-top: 60px; font-size: 12px; color: var(--text-muted); }
.shop-footer a { color: var(--text); font-weight: 800; text-decoration: none; }
.shop-footer a:hover { text-decoration: underline; }

/* Drawer — an app window sliding in */
.drawer-overlay { position: fixed; inset: 0; background: rgba(17, 17, 17, .25); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.drawer { position: fixed; top: 10px; right: 10px; bottom: 10px; width: min(440px, calc(100% - 20px)); z-index: 50; background: #fff;
  border-radius: var(--radius-cards); box-shadow: var(--shadow-window); transform: translateX(calc(100% + 20px));
  transition: transform .25s ease; display: flex; flex-direction: column; overflow: hidden; }
.drawer-open .drawer { transform: none; }
.drawer-open .drawer-overlay { opacity: 1; pointer-events: auto; }
.drawer__head { padding: 12px 20px; border-bottom: 2px solid var(--color-pale-stone); gap: 10px; }
.drawer__head h2 { margin: 0; font-size: 18px; letter-spacing: -0.016em; }
.drawer__body { padding: 0 20px 30px; overflow-y: auto; flex: 1; }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line { display: flex; gap: 10px; padding: 20px 0; border-bottom: 1px solid var(--color-pale-stone); }
.cart-line__art { width: 64px; flex: none; background: var(--color-canvas-mist); border-radius: var(--radius-default); padding: 8px 12px; }
.cart-line__info { flex: 1; font-size: 16px; }
.cart-line__info .faint { font-size: 12px; }
.qty { gap: 8px; margin-top: 8px; align-items: center; }
.qty .btn--sm { width: 30px; height: 30px; padding: 0; font-size: 16px; }
.qty__n { min-width: 18px; text-align: center; font-weight: 800; }
.totals { padding: 20px 0; display: grid; gap: 8px; font-size: 16px; }
.total { font-weight: 800; font-size: 18px; border-top: 2px solid var(--color-pale-stone); padding-top: 10px; }
.free-hint { font-size: 12px; }
.checkout { display: none; margin-top: 20px; border-top: 2px solid var(--color-pale-stone); padding-top: 20px; }
.checkout.is-open { display: block; }
.checkout h3 { margin: 0 0 10px; }
.field { margin-bottom: 10px; }
.field label { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); margin-bottom: 5px; }
.has-error .input { border-color: var(--color-carbon-black); border-width: 2px; }
.field__error { color: var(--text); font-size: 12px; font-weight: 800; margin-top: 5px; }
.field__error::before { content: "! "; }
.alert--error { background: var(--color-canvas-mist); color: var(--text); border: 2px solid var(--color-carbon-black); border-radius: var(--radius-default);
  padding: 10px 12px; font-size: 12px; font-weight: 800; margin: 20px 0 0; }
.demo-note { font-size: 12px; }
.confirmed { padding-top: 20px; }
.confirmed h3 { font-size: 28px; letter-spacing: -0.036em; margin: 0 0 8px; }
.confirmed__items { list-style: none; padding: 10px 0 0; margin: 20px 0; display: grid; gap: 8px; border-top: 2px solid var(--color-pale-stone); font-size: 16px; }
.checkout .htmx-indicator { display: none; }
.checkout.htmx-request .htmx-indicator { display: inline-block; }

@media (max-width: 640px) {
  .shop-wrap { padding: 0 16px; }
  .shop-nav { display: none; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters__right .select { flex: 1; }
  .shop-footer .shop-wrap { flex-direction: column; gap: 10px; align-items: flex-start; }
}
