:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  background: #f7f3eb;
  color: #29201d;
  --wine: #721f37;
  --muted: #594e48;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 20px 16px;
  padding-top: max(20px, env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px));
  padding-bottom: max(20px, env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left), var(--tg-content-safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right), var(--tg-content-safe-area-inset-right, 0px));
}

main { max-width: 49rem; margin-inline: auto; }

.cover {
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 14px;
  background: #eae1d4;
}

.cover img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 34vh;
  min-height: 1.5rem;
  object-fit: contain;
}

.details { padding: 20px 2px 4px; }
.publisher { color: var(--wine); font-weight: 700; margin: 0 0 8px; }
h1 { font: 700 clamp(1.9rem, 6vw, 3rem)/1.07 Georgia, serif; margin: 0; }
.edition { color: var(--muted); line-height: 1.5; margin: 10px 0 20px; }

.quantity, .total {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.quantity { font-weight: 650; }
.stepper { display: flex; align-items: center; gap: 8px; }
#quantity { min-width: 3ch; text-align: center; font-variant-numeric: tabular-nums; }

button, .buy {
  min-height: 52px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

button {
  min-width: 52px;
  border: 1px solid var(--wine);
  background: #fff;
  color: var(--wine);
  font-size: 1.5rem;
}

button[aria-disabled="true"] { cursor: default; border-color: #9a8d84; color: var(--muted); background: #eee8df; }
:focus-visible { outline: 3px solid #235a87; outline-offset: 3px; }

.total {
  border-top: 1px solid #c9bdb1;
  padding-top: 14px;
  margin: 16px 0;
}
.total strong { font-size: 1.25rem; }
.buy {
  display: grid;
  place-items: center;
  padding: 10px 14px;
  background: var(--wine);
  color: #fff;
  text-decoration: none;
  text-align: center;
  font-weight: 750;
}
.buy:hover { background: #56172a; }
.checkout-note { color: var(--muted); font-size: .875rem; line-height: 1.45; margin: 8px 0 0; }

@media (min-width: 42rem) {
  main { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr); gap: 36px; align-items: center; margin-block: 48px; }
  .cover { padding: 24px; }
  .cover img { max-height: 29rem; }
  .details { padding: 0; }
}
