/* ─────────────────────────────────────────────────────────────────────────────
   product.next.css — a single product's public page in the new look (?ui=next).

   public/product.php does NOT load style.css (see product.css), so this sheet
   brings the design tokens and the typeface in itself. The job of the page is
   one decision: this item, this price, how to get it. The photo and the price
   carry it; everything else is quiet.
   ───────────────────────────────────────────────────────────────────────────── */

@import url('tokens.next.css');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&display=swap');

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--color-bg-page);
    color: var(--color-fg-default);
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--till-100); color: var(--stone-900); }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--color-fg-default);
    outline-offset: 2px;
}

/* ── Top bar ───────────────────────────────────────────────────────────────── */
.bar {
    display: flex;
    align-items: center;
    min-height: 3.5rem;
    padding: 0 var(--space-4);
    background: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border);
}

.bar a { color: var(--color-fg-default); font-size: var(--text-ui); font-weight: 600; text-decoration: none; }

/* ── The item ──────────────────────────────────────────────────────────────── */
.wrap { max-width: 61.25rem; margin: 0 auto; padding: var(--space-6) var(--space-4) var(--space-16); }

.card {
    overflow: hidden;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: none;
}

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }

.shot {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--color-bg-muted);
    border-right: 1px solid var(--color-border);
}

.shot img { width: 100%; height: 100%; object-fit: contain; }

.body { padding: var(--space-8) var(--space-6); }

h1 {
    margin: 0 0 var(--space-2);
    font-size: clamp(1.5rem, 3vw, 1.875rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.from { margin-bottom: var(--space-6); font-size: var(--text-ui); color: var(--color-fg-muted); }

.from a,
.maplink {
    color: var(--color-fg-default);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: var(--color-border-strong);
    text-underline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
    .from a:hover,
    .maplink:hover { text-decoration-color: currentColor; }
}

.price {
    margin: 0 0 var(--space-1);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--color-fg-default);
    font-variant-numeric: tabular-nums;
}

.was { margin-right: var(--space-1); font-size: var(--text-body); font-weight: 400; letter-spacing: 0; color: var(--color-fg-subtle); }

.off {
    margin-left: var(--space-2);
    padding: 0.0625rem 0.375rem;
    border-radius: var(--radius-sm);
    background: var(--color-danger-fg);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0;
    vertical-align: middle;
}

/* Availability — colour plus the word itself, never colour alone. */
.pill {
    display: inline-block;
    margin: var(--space-3) 0;
    padding: 0.125rem var(--space-2);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: var(--text-small);
    font-weight: 500;
}

.pill-in_stock     { background: var(--color-success-bg); border-color: var(--color-success-border); color: var(--color-success-fg); }
.pill-out_of_stock { background: var(--color-danger-bg);  border-color: var(--color-danger-border);  color: var(--color-danger-fg); }
.pill-to_order     { background: var(--color-bg-muted);   border-color: var(--color-border);         color: var(--color-fg-default); }
.pill-unavailable  { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: var(--color-warning-fg); }
.pill-service      { background: var(--color-bg-muted);   border-color: var(--color-border);         color: var(--color-fg-default); }

.note { font-size: var(--text-small); color: var(--color-fg-muted); }

.oos-note {
    margin: var(--space-3) 0 0.125rem;
    padding: var(--space-3);
    border: 1px solid var(--color-warning-border);
    border-radius: var(--radius-md);
    background: var(--color-warning-bg);
    color: var(--color-warning-fg);
    font-size: var(--text-ui);
    line-height: 1.5;
}

.desc {
    margin: var(--space-4) 0 var(--space-1);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--color-fg-default);
}

/* ── Actions ───────────────────────────────────────────────────────────────── */
.acts { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-6); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 10rem;
    min-width: 0;
    min-height: var(--control-lg);
    padding: 0 var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--text-ui);
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}

.btn:active { transform: scale(0.97); }

/* WhatsApp's own dark green: a third-party brand action. #25d366 fails behind white text. */
.btn-buy   { background: #075e54; color: #ffffff; }
.btn-cart  { background: var(--color-action); color: var(--color-action-fg); }
.btn-share,
.btn-ghost { background: var(--color-bg-surface); border-color: var(--color-border-strong); color: var(--color-fg-default); }
.btn-ask   { background: var(--color-bg-muted); border-color: var(--color-border-strong); color: var(--color-fg-default); }

@media (hover: hover) and (pointer: fine) {
    .btn-buy:hover  { background: #054d44; }
    .btn-cart:hover { background: var(--color-action-hover); filter: none; }
    .btn-share:hover,
    .btn-ghost:hover,
    .btn-ask:hover  { background: var(--color-bg-muted); border-color: var(--color-border-input); }
}

.thumbs { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: 0 var(--space-6) var(--space-6); }

.thumbs img {
    width: 3.875rem;
    height: 3.875rem;
    object-fit: contain;
    background: var(--color-bg-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.miss {
    padding: var(--space-16) var(--space-6);
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: none;
    text-align: center;
}

/* BRIDGE — the not-found button carries style="display:inline-block", which overrides .btn's
   flex centring and pins its label to the top of the 44px box. */
.miss .btn { display: inline-flex !important; }

/* ── Related items ─────────────────────────────────────────────────────────── */
.rel-wrap { margin: 0; padding: var(--space-6); border-top: 1px solid var(--color-border); }

.rel-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
.rel-head h2 { margin: 0; font-size: var(--text-body); font-weight: 600; color: var(--color-fg-default); }
.rel-head span { font-size: var(--text-small); color: var(--color-fg-muted); }

.rel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr)); gap: var(--space-3); }

.rel-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: inherit;
    text-decoration: none;
    transition: border-color var(--duration-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .rel-card:hover { border-color: var(--color-border-input); box-shadow: none; transform: none; }
}

.rel-ph { position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden; background: var(--color-bg-surface); }
.rel-ph img { width: 100%; height: 100%; object-fit: contain; }
.rel-noimg { display: block; width: 100%; height: 100%; background: var(--color-bg-muted); }
.rel-out { position: absolute; inset: auto 0 0 0; padding: 0.125rem 0; background: rgb(28 25 23 / 0.75); color: #ffffff; font-size: 0.75rem; text-align: center; }
.rel-nm { display: block; padding: var(--space-2) var(--space-3) 0; font-size: var(--text-ui); line-height: 1.35; color: var(--color-fg-default); }
.rel-pr { display: block; padding: 0.125rem var(--space-3) var(--space-3); font-size: var(--text-ui); font-weight: 600; color: var(--color-fg-default); font-variant-numeric: tabular-nums; }
.rel-pr s { font-size: 0.8125rem; font-weight: 400; color: var(--color-fg-subtle); }

/* ── Sponsored rails ───────────────────────────────────────────────────────────
   Unchanged behaviour from product.css: a grid only when .has-rails is present,
   folding into strips under ~1300px. */
.pr-shell.has-rails {
    display: grid;
    grid-template-columns: 1fr minmax(0, 61.25rem) 1fr;
    align-items: start;
    gap: var(--space-4);
    max-width: 88.75rem;
    margin: 0 auto;
}

.pr-shell.has-rails .wrap { max-width: 61.25rem; padding-left: 0; padding-right: 0; }

.rl-rail {
    position: sticky;
    top: var(--space-4);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
    max-width: 13.25rem;
    padding: var(--space-3);
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    justify-self: center;
}

.rl-head {
    grid-column: 1 / -1;
    padding: 0;
    background: none;
    color: var(--color-fg-muted);
    font-size: var(--text-small);
    font-weight: 500;
    letter-spacing: 0;
    text-align: center;
    text-transform: none;
}

.rl-tile {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: inherit;
    text-decoration: none;
    transition: border-color var(--duration-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .rl-tile:hover { border-color: var(--color-border-input); box-shadow: none; transform: none; }
}

.rl-ph { display: block; aspect-ratio: 1 / 1; overflow: hidden; background: var(--color-bg-surface); }
.rl-ph img { width: 100%; height: 100%; object-fit: contain; }
.rl-noimg { display: block; width: 100%; height: 100%; background: var(--color-bg-muted); }
.rl-pr { display: block; padding: 0.25rem 0.375rem 0.375rem; font-size: var(--text-small); font-weight: 600; text-align: center; color: var(--color-fg-default); font-variant-numeric: tabular-nums; }

@media (max-width: 1300px) {
    .pr-shell.has-rails { display: block; max-width: none; }
    .pr-shell.has-rails .wrap { max-width: 61.25rem; padding-left: var(--space-4); padding-right: var(--space-4); }
    .rl-rail { position: static; max-width: 61.25rem; margin: 0 auto var(--space-4); grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); }
    .rl-rail:first-of-type { margin-top: 0; }
}

@media (max-width: 760px) {
    .grid { grid-template-columns: 1fr; }
    .shot { border-right: none; border-bottom: 1px solid var(--color-border); }
    .body { padding: var(--space-6) var(--space-4); }
    .rel-wrap { padding: var(--space-4); }
    .thumbs { padding: 0 var(--space-4) var(--space-4); }
}

@media (max-width: 560px) {
    .rl-rail { grid-template-columns: repeat(3, 1fr); }
}

/* The cart (button, drawer, toasts) is styled by assets/css/cart.css, linked by this page. */
