/* IRONBOND storefront — v4, single coherent sheet.
   Genre-informed: white ground, charcoal ink, quiet chrome, wood art as the
   colour. Spruce green accent (competitors all use blue). Anton lives in the
   wordmark only. */

@font-face {
  font-family: "Anton";
  src: url("/assets/fonts/anton.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ground: #FFFFFF;
  --surface: #F8F7F4;
  --surface-alt: #EFEDE8;
  --ink: #201D18;
  --ink-muted: #6F695F;
  --rule: #E8E5DF;
  --accent: #201D18;
  --accent-hover: #3B362E;
  --accent-text: #201D18;
  --accent-ink: #FFFFFF;
  --ok: #2E7D4F;

  --f-display: "Anton", "Arial Narrow", sans-serif;    /* wordmark only */
  --f-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
            "Liberation Mono", monospace;

  --r: 10px;
  --soft: 0 1px 2px rgba(32, 29, 24, 0.05);
  --lift: 0 10px 30px rgba(32, 29, 24, 0.10), 0 2px 6px rgba(32, 29, 24, 0.05);

  --gut: clamp(1.15rem, 4vw, 3rem);
  --maxw: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #141311;
    --surface: #1C1A17;
    --surface-alt: #26231F;
    --ink: #EDEAE4;
    --ink-muted: #9A938A;
    --rule: #2C2924;
    --accent: #EDEAE4;
    --accent-hover: #FFFFFF;
    --accent-text: #EDEAE4;
    --accent-ink: #141311;
    --ok: #6FBF8B;
    --soft: 0 1px 2px rgba(0, 0, 0, 0.4);
    --lift: 0 10px 30px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gut); }

/* ---------- type: bold sans, sentence case ---------- */
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.015em;
             text-wrap: balance; font-weight: 700; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.85rem); }
h3 { font-size: 1.02rem; line-height: 1.35; letter-spacing: -0.01em; }
.hero-h { font-size: clamp(2.3rem, 5.5vw, 3.9rem); line-height: 1.05; }
.lede { font-size: clamp(1.05rem, 1.7vw, 1.18rem); color: var(--ink-muted);
        max-width: 36ch; margin-top: 1.1rem; line-height: 1.65; }

a { color: inherit; }

.eyebrow {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-muted); margin: 0;
}
.mono-sm { font-family: var(--f-mono); font-size: 0.74rem; color: var(--ink-muted); }

:where(a, button, input, select, summary):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px;
}

/* ---------- masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--ground) 92%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.masthead .wrap { display: flex; align-items: center;
                  gap: clamp(1rem, 3vw, 2.5rem); min-height: 64px; }
.brand { display: block; line-height: 0; text-decoration: none; }
.ib-logo { width: clamp(110px, 12vw, 136px); height: auto; display: block;
           color: var(--ink); }
.nav { display: flex; gap: clamp(0.9rem, 2vw, 1.7rem); margin-left: auto;
       align-items: center; font-size: 0.92rem; font-weight: 500; }
.nav a { text-decoration: none; color: var(--ink); padding-block: 0.4rem; }
.nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.cartlink, .cartlink:hover {
  font-family: var(--f-body); font-size: 0.85rem; font-weight: 600;
  border: 1px solid var(--rule); border-radius: 8px;
  padding: 0.45rem 0.85rem; text-decoration: none; white-space: nowrap;
  color: var(--ink); background: transparent;
}
.cartlink:hover { border-color: var(--ink-muted); }
.cartlink.has, .cartlink.has:hover {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}

/* ---------- layout rhythm ---------- */
main { padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3rem, 7vw, 5rem); }
section { margin-block: clamp(3rem, 7vw, 5rem); }
.sec-head { margin-bottom: clamp(1.3rem, 3vw, 2rem); }
.sec-head p { color: var(--ink-muted); max-width: 54ch; margin: 0.55rem 0 0; }
.sec-head h2 { margin-top: 0.45rem; }
.divider { height: 1px; background: var(--rule); }
.grainbar { display: none; }   /* whitespace does this job now */

/* ---------- hero ---------- */
.hero { padding-top: clamp(0.5rem, 2vw, 1.5rem); }
.hero-grid { display: grid; gap: clamp(1.8rem, 4vw, 3.5rem); }
@media (min-width: 940px) {
  .hero-grid { grid-template-columns: 1.02fr 0.98fr; align-items: center; }
}
.hero-facts { display: flex; flex-wrap: wrap; gap: 0 clamp(1.2rem, 3vw, 2.2rem);
              margin-top: 1.8rem; padding-top: 1.1rem;
              border-top: 1px solid var(--rule);
              font-size: 0.83rem; color: var(--ink-muted); }
.hero-facts b { color: var(--ink); font-weight: 650; }
.hero-visual { display: flex; flex-direction: column; gap: 0.8rem; }
.roll-box { line-height: 0; background: var(--surface); border-radius: var(--r);
            overflow: hidden; }
.roll-box canvas { width: 100%; height: 100%; display: block; }
.roll-hero { height: clamp(240px, 30vw, 340px); }
.grain-tall { height: clamp(170px, 22vw, 240px); line-height: 0;
              border-radius: var(--r); overflow: hidden; }
.grain-tall canvas { width: 100%; height: 100%; display: block; }

.species { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.species button {
  font-size: 0.8rem; font-weight: 550; padding: 0.4rem 0.75rem;
  background: transparent; color: var(--ink-muted);
  border: 1px solid var(--rule); border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--f-body);
}
.species button:hover { color: var(--ink); border-color: var(--ink-muted); }
.species button[aria-pressed="true"] { color: var(--ink); border-color: var(--ink);
                                       background: var(--surface); }
.species .dot { width: 10px; height: 10px; border-radius: 50%;
                box-shadow: inset 0 0 0 1px rgba(0,0,0,.22); }
.species-link { text-decoration: none; color: var(--accent-text);
                font-weight: 600; font-family: var(--f-body); font-size: 0.88rem; }

/* ---------- buttons & forms ---------- */
.btn {
  font-family: var(--f-body); font-size: 0.95rem; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid var(--accent); border-radius: 8px;
  padding: 0.62rem 1.25rem; cursor: pointer; text-decoration: none;
  display: inline-block; transition: background 0.12s ease;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { background: var(--surface); border-color: var(--ink-muted); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

input, select, textarea {
  font-family: var(--f-body); font-size: 0.95rem; padding: 0.55rem 0.7rem;
  background: var(--ground); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 8px;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type=number] { width: 5.5rem; font-family: var(--f-mono); }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.06em;
               text-transform: uppercase; color: var(--ink-muted); }

/* ---------- product grid ---------- */
.grid { display: grid; gap: clamp(1rem, 2.2vw, 1.5rem);
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card { background: var(--ground); border: 1px solid var(--rule);
        border-radius: var(--r); overflow: hidden; padding: 0;
        display: flex; flex-direction: column; text-decoration: none;
        transition: box-shadow 0.15s ease, border-color 0.15s ease; }
.card:hover { box-shadow: var(--lift); border-color: var(--surface-alt); }
.card-visual, .card .swatch, .card .shot {
  height: 170px; line-height: 0; overflow: hidden; background: var(--surface); }
.card-visual canvas, .card-visual img,
.card .swatch canvas, .card .shot img {
  width: 100%; height: 100%; display: block; object-fit: cover; }
.card h3 { padding: 0.95rem 1.05rem 0; }
.card > p { margin: 0.35rem 0 0; padding: 0 1.05rem; color: var(--ink-muted);
            font-size: 0.86rem; }
.card .foot { margin-top: auto; padding: 0.85rem 1.05rem 1rem;
              display: flex; justify-content: space-between; align-items: baseline;
              gap: 0.6rem; font-size: 0.8rem; }
.card .price { font-weight: 650; font-size: 0.95rem; color: var(--ink); }
.in-stock { color: var(--ok); font-weight: 550; }
.no-stock { color: var(--ink-muted); }

/* ---------- product page ---------- */
.product { display: grid; gap: clamp(1.5rem, 4vw, 3rem); }
@media (min-width: 900px) { .product { grid-template-columns: 1fr 1fr; align-items: start; } }
.hero-swatch { height: clamp(220px, 30vw, 340px); line-height: 0;
               border-radius: var(--r); overflow: hidden; }
.hero-swatch canvas { width: 100%; height: 100%; display: block; }
.shot { background: var(--surface); line-height: 0; overflow: hidden;
        border-radius: var(--r); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-shot { aspect-ratio: 1 / 1; max-height: 420px; }
.hero-shot img { object-fit: contain; }

table.variants { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.variants th { text-align: left; font-weight: 600; font-size: 0.72rem;
                    letter-spacing: 0.08em; text-transform: uppercase;
                    color: var(--ink-muted); padding: 0.55rem 0.6rem 0.55rem 0;
                    border-bottom: 1px solid var(--rule); }
table.variants td { padding: 0.7rem 0.6rem 0.7rem 0;
                    border-bottom: 1px solid var(--rule);
                    vertical-align: middle; font-variant-numeric: tabular-nums; }
table.variants tr:last-child td { border-bottom: none; }
table.variants .btn { padding: 0.45rem 1rem; font-size: 0.88rem; }
.tablewrap { overflow-x: auto; }

/* ---------- cart & totals ---------- */
.totals { margin-top: 1.2rem; border-top: 1px solid var(--rule); padding-top: 1rem;
          display: grid; gap: 0.5rem; max-width: 420px; margin-left: auto; }
.totals .row { display: flex; justify-content: space-between; gap: 1rem;
               font-size: 0.9rem; color: var(--ink-muted); }
.totals .row b { color: var(--ink); font-weight: 600;
                 font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 1px solid var(--rule); padding-top: 0.75rem;
                 font-size: 1.15rem; font-weight: 700;
                 display: flex; justify-content: space-between; align-items: baseline; }
.totals .grand span:last-child { font-variant-numeric: tabular-nums; }

.notice { border: 1px solid var(--rule); background: var(--surface);
          border-radius: var(--r); padding: 0.9rem 1.1rem; font-size: 0.92rem; }
.notice.warn { border-left: 3px solid #C4622D; }
.notice.good { border-left: 3px solid var(--ok); }

/* ---------- calculator ---------- */
.calcpanel { background: var(--surface); border: 1px solid var(--rule);
             border-radius: var(--r); }

/* ---------- steps (how-to) ---------- */
.band { border-block: 1px solid var(--rule);
        background: var(--surface);
        margin-inline: calc(50% - 50vw); padding-inline: calc(50vw - 50%);
        padding-block: clamp(2.4rem, 5vw, 3.6rem); }
.steps { display: grid; gap: clamp(1.4rem, 3vw, 2.2rem);
         grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.step .num { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.12em;
             color: var(--accent-text); border-top: 2px solid var(--accent);
             padding-top: 0.6rem; margin: 0 0 0.4rem; display: inline-block; }
.step h3 { margin-top: 0.2rem; }
.step p { margin: 0.45rem 0 0; font-size: 0.89rem; color: var(--ink-muted); }

/* ---------- trade ---------- */
.trade { background: var(--surface); border: 1px solid var(--rule);
         border-radius: var(--r);
         padding: clamp(1.4rem, 3.5vw, 2.4rem); display: grid; gap: 1.6rem; }
@media (min-width: 880px) { .trade { grid-template-columns: 1.1fr 0.9fr; align-items: center; } }
.trade ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.65rem;
            font-size: 0.9rem; }
.trade li { display: flex; gap: 0.7rem; align-items: baseline; }
.trade li::before { content: "✓"; color: var(--accent-text); font-weight: 700; }

/* ---------- assurance ---------- */
.assure { display: grid; gap: clamp(0.7rem, 1.6vw, 1rem);
          margin-top: clamp(2.5rem, 6vw, 4rem);
          grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.assure div { background: var(--surface); border-radius: var(--r);
              padding: 1.05rem 1.15rem; }
.assure b { font-weight: 650; font-size: 0.95rem; display: block; }
.assure span { font-size: 0.83rem; color: var(--ink-muted); }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--rule); background: var(--surface);
         padding-block: 2.4rem 3rem; font-size: 0.9rem;
         margin-top: clamp(3rem, 7vw, 5rem); }
.foot-grid, footer .cols { display: grid; gap: 1.6rem;
               grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
footer h4 { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em;
            text-transform: uppercase; color: var(--ink-muted);
            margin: 0 0 0.7rem; }
footer ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.45rem; }
footer a { text-decoration: none; color: var(--ink); }
footer a:hover { text-decoration: underline; text-underline-offset: 3px; }
.pay { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.pay span { font-family: var(--f-mono); font-size: 0.63rem; letter-spacing: 0.05em;
            border: 1px solid var(--rule); border-radius: 6px;
            padding: 0.28rem 0.45rem; color: var(--ink-muted);
            background: var(--ground); white-space: nowrap; }
.colophon { margin-top: 2.2rem; padding-top: 1.2rem;
            border-top: 1px solid var(--rule);
            font-size: 0.78rem; color: var(--ink-muted); }

/* ---------- admin ---------- */
.admin-nav { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: 0.9rem;
             font-weight: 550; }
.admin-nav a { text-decoration: none; padding-block: 0.55rem;
               border-bottom: 2px solid transparent; color: var(--ink); }
.admin-nav a:hover { text-decoration: underline; text-underline-offset: 5px; }
.admin-nav a[aria-current="page"] { border-bottom-color: var(--accent);
                                    color: var(--accent-text); }
.toolbar { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: flex-end;
           margin-block: 1.2rem; }
.stat-grid { display: grid; gap: clamp(0.7rem, 1.5vw, 1rem);
             grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat { background: var(--surface); border-radius: var(--r);
        padding: 0.9rem 1rem; }
.stat h2 { font-size: 1.6rem; margin-top: 0.2rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: 0.06em;
        text-transform: uppercase; padding: 0.22rem 0.55rem;
        border: 1px solid var(--rule); border-radius: 999px; white-space: nowrap; }
.pill.paid, .pill.fulfilled { color: var(--ok); border-color: var(--ok); }
.pill.pending { color: #C4622D; border-color: #C4622D; }

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

/* ---------- product configurator ---------- */
.cfg-label { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.08em;
             text-transform: uppercase; color: var(--ink-muted);
             margin: 0 0 0.5rem; }
.swatches { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.swatch-chip { display: inline-flex; align-items: center; gap: 0.45rem;
               font-size: 0.85rem; font-weight: 550; text-decoration: none;
               padding: 0.42rem 0.8rem; border: 1px solid var(--rule);
               border-radius: 8px; color: var(--ink-muted); }
.swatch-chip i { width: 14px; height: 14px; border-radius: 4px;
                 box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.swatch-chip:hover { color: var(--ink); border-color: var(--ink-muted); }
.swatch-chip[aria-current="true"] { color: var(--ink); border-color: var(--ink);
                                    background: var(--surface); }

.sizes { display: grid; gap: 0.5rem;
         grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.size-tile { position: relative; border: 1px solid var(--rule);
             border-radius: 8px; padding: 0.65rem 0.75rem; cursor: pointer;
             display: flex; flex-direction: column; gap: 0.15rem;
             background: var(--ground); }
.size-tile input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.size-tile:hover { border-color: var(--ink-muted); }
.size-tile:has(input:checked) { border-color: var(--ink);
                                box-shadow: inset 0 0 0 1px var(--ink);
                                background: var(--surface); }
.size-tile:has(input:focus-visible) { outline: 2px solid var(--accent);
                                      outline-offset: 2px; }
.size-tile.oos { opacity: 0.5; cursor: not-allowed; }
.st-size { font-weight: 650; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.st-price { font-size: 0.88rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.st-stock { font-size: 0.72rem; color: var(--ok); }
.size-tile.oos .st-stock { color: var(--ink-muted); }

.cfg-buy { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap;
           margin-top: 1.4rem; padding-top: 1.2rem;
           border-top: 1px solid var(--rule); }
.cfg-price { font-size: 1.55rem; font-weight: 700; margin: 0; line-height: 1.1;
             font-variant-numeric: tabular-nums; }
#cfg-add { padding: 0.75rem 1.7rem; font-size: 1rem; }

.toast { position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%);
         background: var(--ink); color: var(--ground);
         padding: 0.75rem 1.2rem; border-radius: 10px; font-size: 0.92rem;
         box-shadow: var(--lift); z-index: 50; }
.toast a { color: inherit; font-weight: 650; }

/* ---------- basket drawer ---------- */
#bd-overlay { position: fixed; inset: 0; background: rgba(20,18,15,0.4);
              z-index: 60; }
#bd { position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
      width: min(420px, 92vw); background: var(--ground);
      border-left: 1px solid var(--rule); display: flex; flex-direction: column;
      transform: translateX(105%); transition: transform 0.22s ease;
      box-shadow: var(--lift); }
#bd.open { transform: translateX(0); }
.bd-head { display: flex; justify-content: space-between; align-items: center;
           padding: 1rem 1.2rem; border-bottom: 1px solid var(--rule); }
#bd-close { background: none; border: 0; font-size: 1.5rem; line-height: 1;
            cursor: pointer; color: var(--ink-muted); padding: 0.2rem 0.4rem; }
#bd-close:hover { color: var(--ink); }
#bd-body { flex: 1; overflow-y: auto; padding: 0.6rem 1.2rem; }
.bd-empty { color: var(--ink-muted); padding-block: 1.5rem; text-align: center; }
.bd-item { display: grid; grid-template-columns: 1fr auto;
           gap: 0.3rem 0.8rem; padding-block: 0.9rem;
           border-bottom: 1px solid var(--rule); align-items: center; }
.bd-info { display: flex; flex-direction: column; gap: 0.15rem; grid-column: 1; }
.bd-title { font-weight: 600; font-size: 0.92rem; }
.bd-sku { font-family: var(--f-mono); font-size: 0.7rem; color: var(--ink-muted); }
.bd-line { grid-column: 2; grid-row: 1; font-weight: 650;
           font-variant-numeric: tabular-nums; }
.bd-controls { grid-column: 1 / -1; display: flex; align-items: center;
               gap: 0.5rem; }
.bd-qty { width: 28px; height: 28px; border: 1px solid var(--rule);
          border-radius: 6px; background: var(--ground); cursor: pointer;
          font-size: 1rem; line-height: 1; color: var(--ink); }
.bd-qty:hover:not([disabled]) { border-color: var(--ink-muted); }
.bd-qty[disabled] { opacity: 0.4; cursor: not-allowed; }
.bd-n { min-width: 1.6rem; text-align: center; font-variant-numeric: tabular-nums;
        font-weight: 600; }
.bd-rm { margin-left: auto; background: none; border: 0; cursor: pointer;
         font-size: 0.78rem; color: var(--ink-muted); text-decoration: underline;
         text-underline-offset: 2px; }
.bd-rm:hover { color: var(--ink); }
#bd-foot { border-top: 1px solid var(--rule); padding: 1rem 1.2rem 1.3rem;
           display: grid; gap: 0.5rem; }
.bd-row { display: flex; justify-content: space-between; font-size: 0.9rem;
          color: var(--ink-muted); }
.bd-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.bd-total { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.bd-checkout { width: 100%; text-align: center; margin-top: 0.4rem; }
.bd-full { text-align: center; font-size: 0.82rem; color: var(--ink-muted); }
@media (prefers-reduced-motion: reduce) { #bd { transition: none; } }

/* ---------- basket drawer thumbnails ---------- */
#bd .bd-item { grid-template-columns: 48px 1fr auto; }
.bd-thumb { grid-row: 1 / span 1; width: 48px; height: 48px; border-radius: 6px;
            overflow: hidden; background: var(--surface); line-height: 0;
            display: block; }
.bd-thumb img, .bd-thumb canvas { width: 100%; height: 100%; display: block;
                                  object-fit: cover; }
#bd .bd-info { grid-column: 2; }
#bd .bd-line { grid-column: 3; grid-row: 1; align-self: start; }
#bd .bd-controls { grid-column: 2 / -1; }

/* ---------- drawer: small screens ---------- */
@media (max-width: 520px) {
  #bd { width: 100vw; border-left: 0; }
  .bd-head, #bd-body, #bd-foot { padding-inline: max(1rem, env(safe-area-inset-left)); }
  #bd .bd-item { grid-template-columns: 44px 1fr auto; gap: 0.25rem 0.7rem; }
  .bd-thumb { width: 44px; height: 44px; }
  .bd-title { font-size: 0.88rem; }
  .bd-qty { width: 32px; height: 32px; }   /* comfortable touch targets */
  #bd-foot { padding-bottom: max(1.3rem, env(safe-area-inset-bottom)); }
}


/* ---------- shared basket partial ---------- */
.bd-qi { width: 3.2rem; text-align: center; padding: 0.3rem;
         -moz-appearance: textfield; appearance: textfield; }
.bd-qi::-webkit-outer-spin-button,
.bd-qi::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bd-controls .bd-rm { margin-left: auto; }
.bk-totals { border-top: 1px solid var(--rule); margin-top: 0.4rem;
             padding-top: 0.9rem; display: grid; gap: 0.5rem; }
.bk-checkout { margin-top: 0.9rem; }

/* the same partial, sized for each context */
#bd .bk-checkout .btn { width: 100%; text-align: center; }
#basket-page { max-width: 920px; margin-top: 1.3rem; }
#basket-page .bd-item { padding-block: 1.1rem; gap: 0.3rem 1.2rem; }
#basket-page .bd-thumb { width: 80px; height: 80px; border-radius: 8px; }
#basket-page .bd-item { grid-template-columns: 80px 1fr auto; }
#basket-page .bd-title { font-size: 1rem; }
#basket-page .bd-line { font-size: 1rem; }
/* explicit cell placement — these rules exist under #bd for the drawer;
   without a page-scoped copy the grid auto-places and collapses the title
   into the thumbnail column */
#basket-page .bd-thumb { grid-column: 1; grid-row: 1 / span 2; }
#basket-page .bd-info { grid-column: 2; grid-row: 1; }
#basket-page .bd-line { grid-column: 3; grid-row: 1; justify-self: end; align-self: start; }
#basket-page .bd-controls { grid-column: 2 / -1; grid-row: 2; margin-top: 0.35rem; }
#basket-page .bd-item { align-items: start; }

/* on a wide page the totals sit as a right-hand column, classic cart style */
#basket-page .bk-totals { max-width: 380px; margin-left: auto; width: 100%; }
#basket-page .bk-checkout { display: flex; justify-content: flex-end; }
@media (max-width: 520px) {
  #basket-page .bd-thumb { width: 48px; height: 48px; }
  #basket-page .bd-item { grid-template-columns: 48px 1fr auto; }
}
