/* Iyun demo store. Colours and font come from data.js (set as CSS variables by app.js);
   the values below are only first-paint fallbacks. */
:root {
  --cream: #FFF6E8;
  --wine: #4A0D14;
  --apricot: #F0B58A;
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --w-head: 800;
  --w-text: 400;
  --w-strong: 600;
  --line: rgba(74, 13, 20, .16);
  --radius: 18px;
  --cartbar-h: 76px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }

body {
  margin: 0;
  background: var(--cream);
  color: var(--wine);
  font-family: var(--font);
  font-weight: var(--w-text);
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: calc(var(--cartbar-h) + env(safe-area-inset-bottom));
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { font-weight: var(--w-head); line-height: 1.05; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: clamp(2rem, 7vw, 3.25rem); margin-bottom: .5rem; }
h3 { font-size: 1.125rem; letter-spacing: -0.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--wine); outline-offset: 3px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--wine); color: var(--cream); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.small { font-size: .8125rem; }
.lead { max-width: 36rem; margin-bottom: 1.5rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: 0 22px;
  background: var(--wine); color: var(--cream);
  border: 2px solid var(--wine); border-radius: 999px;
  font-weight: var(--w-strong); font-size: .9375rem; text-decoration: none;
  cursor: pointer; white-space: nowrap;
  transition: transform .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.97); }
.btn--ghost { background: transparent; color: var(--wine); }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: .875rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .35; cursor: not-allowed; transform: none; }
.iconbtn {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--wine);
  background: var(--cream); font-size: 1.5rem; line-height: 1; cursor: pointer;
}

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--cream); border-bottom: 1px solid var(--line); }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.topbar__logo img { height: 30px; width: auto; }

/* Hero */
/* The hero photo is the section background. --hero-top/--hero-mid/--hero-base match the
   photo's own backdrop (peach wall, wine box) so its faded edges blend in. Update them
   if you swap assets/hero.webp for a photo with a different backdrop. */
.hero {
  --hero-top: #FACAAC; --hero-mid: #F8B281; --hero-base: #6C111B;
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--hero-top), var(--hero-mid));
  padding-top: 36px;
}
.hero__inner { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(3rem, 15vw, 6.5rem); letter-spacing: -0.04em; }
.hero__intro { font-size: 1.0625rem; max-width: 30rem; margin: 16px 0 24px; }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 12px; }
/* Phones and tablets: the photo sits under the text, its top (and on tablets its sides) fading
   into the wall colour. The wine box takes the bottom 19.5% of the photo, so the section
   gradient continues it edge to edge. */
.hero {
  --hero-img-w: min(100vw, 520px);
  background: linear-gradient(0deg, var(--hero-base) 0 calc(var(--hero-img-w) * 1.25 * .195), var(--hero-mid) 0, var(--hero-top) 100%);
}
.hero__bg { order: 1; align-self: center; width: var(--hero-img-w); margin-top: calc(var(--hero-img-w) * -.14); pointer-events: none; }
.hero__bg img {
  display: block; width: 100%; height: auto; aspect-ratio: 4 / 5;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 20%), linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(180deg, transparent 0, #000 20%), linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%);
  mask-composite: intersect;
}
@media (max-width: 519px) {
  .hero__bg img { -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 20%); mask-image: linear-gradient(180deg, transparent 0, #000 20%); }
}
/* Desktop: the photo fills the hero's full height on the right, its left edge fading into the
   backdrop; the gradient's hard stop continues the wine box across the full width. */
@media (min-width: 1024px) {
  .hero {
    display: grid; align-items: center; padding: 0 0 12vh;
    min-height: clamp(560px, calc(100svh - 64px), 860px);
    background: linear-gradient(180deg, var(--hero-top) 0%, var(--hero-mid) 70%, var(--hero-mid) 80.5%, var(--hero-base) 80.5%);
  }
  .hero__bg { position: absolute; top: 0; right: 0; bottom: 0; width: auto; margin: 0; }
  .hero__bg img {
    width: auto; height: 100%;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 35%); mask-image: linear-gradient(90deg, transparent 0, #000 35%);
  }
  .hero__text { max-width: 34rem; }
}

/* Sections */
.section { padding: 56px 0; }
.section--accent { border-top: 10px solid var(--apricot); }
.grid { display: grid; gap: 16px; margin-top: 24px; }
.grid--products { grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid--sets { grid-template-columns: repeat(2, 1fr); gap: 12px; }
.card--set .card__foot { flex-wrap: wrap; }
@media (max-width: 420px) { .card--set .card__foot { flex-direction: column; align-items: stretch; } }
@media (min-width: 820px) { .grid--products { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
@media (min-width: 1000px) { .grid--sets { grid-template-columns: repeat(4, 1fr); } }

/* Cards */
.card { background: var(--cream); border: 2px solid var(--wine); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card__media { aspect-ratio: 1 / 1; position: relative; }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__body { padding: 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card__desc { font-size: .6875rem; font-weight: var(--w-strong); letter-spacing: .08em; }
.card__meta { font-size: .8125rem; }
.card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; }
.price { font-weight: var(--w-head); font-size: 1.0625rem; }
/* Whole product card opens the detail panel; the Add button sits above that hit area. */
.card--product { position: relative; }
.card__open { all: unset; cursor: pointer; font: inherit; }
.card__open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card--product:has(.card__open:focus-visible) { outline: 3px solid var(--wine); outline-offset: 3px; }
.card--product .card__body { padding-bottom: 0; }
.card--product .card__foot { position: relative; z-index: 1; }
.card--product .card__foot { padding: 10px 14px 14px; }
.card--product .btn { min-height: 40px; padding: 0 16px; }
.card__items { font-size: .8125rem; margin-top: 2px; }
@media (max-width: 380px) {
  .card--product .card__foot { flex-direction: column; align-items: stretch; }
}

/* Build your box */
.box { display: grid; gap: 16px; }
.box__aside { display: contents; }
.box__media { order: -1; aspect-ratio: 1 / 1; border: 2px solid var(--wine); border-radius: var(--radius); overflow: hidden; background: var(--apricot); }
.box__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (min-width: 820px) {
  .box { grid-template-columns: 1.3fr 1fr; align-items: start; }
  .box__aside { display: grid; gap: 16px; position: sticky; top: 80px; }
  .box__media { order: 0; aspect-ratio: 4 / 3; }
  .box__media img { object-position: center 55%; }
}
.box__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.boxitem { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 12px; background: var(--cream); border: 2px solid var(--wine); border-radius: 14px; padding: 8px 10px 8px 8px; }
.boxitem img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }
.boxitem__name { font-weight: var(--w-strong); line-height: 1.2; }
.boxitem__price { font-size: .8125rem; }
.panel { background: var(--cream); border: 2px solid var(--wine); border-radius: var(--radius); padding: 18px; display: grid; gap: 12px; }
.box__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.box__row strong { font-weight: var(--w-head); font-size: 1.5rem; }
.box__status { font-weight: var(--w-strong); background: var(--apricot); color: var(--wine); padding: 10px 12px; border-radius: 10px; }
.field { display: grid; gap: 6px; font-weight: var(--w-strong); font-size: .875rem; }
.field textarea { font: inherit; font-weight: var(--w-text); color: var(--wine); background: var(--cream); border: 2px solid var(--wine); border-radius: 10px; padding: 10px 12px; resize: vertical; min-height: 64px; }
.field__count { font-weight: var(--w-text); font-size: .75rem; justify-self: end; }

/* Stepper */
.stepper { display: inline-flex; align-items: center; border: 2px solid var(--wine); border-radius: 999px; overflow: hidden; }
.stepper button { width: 40px; height: 40px; border: 0; background: var(--cream); font-size: 1.25rem; font-weight: var(--w-strong); cursor: pointer; }
.stepper button:disabled { opacity: .3; cursor: not-allowed; }
.stepper output { min-width: 28px; text-align: center; font-weight: var(--w-head); }

/* How to order */
.steps { list-style: none; counter-reset: s; margin: 24px 0 0; padding: 0; display: grid; gap: 14px; }
@media (min-width: 820px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { counter-increment: s; border: 2px solid var(--wine); border-radius: var(--radius); padding: 18px; font-weight: var(--w-strong); }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--wine); color: var(--cream); font-weight: var(--w-head); margin-bottom: 12px; }

/* Footer */
.footer { padding: 36px 0 28px; border-top: 1px solid var(--line); }
.footer__logo { height: 26px; width: auto; margin-bottom: 10px; }
.footer p { font-size: .875rem; max-width: 34rem; }

/* Cart bar */
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--cream); border-top: 2px solid var(--wine); padding-bottom: env(safe-area-inset-bottom); }
.cartbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: var(--cartbar-h); }
.cartbar__summary { all: unset; cursor: pointer; display: grid; line-height: 1.2; padding: 6px 4px; border-radius: 8px; }
.cartbar__summary span { font-size: .8125rem; text-decoration: underline; text-underline-offset: 3px; }
.cartbar__summary strong { font-weight: var(--w-head); font-size: 1.25rem; }
.cartbar__summary:focus-visible { outline: 3px solid var(--wine); }
.cartbar.bump .cartbar__summary strong { animation: bump .35s ease; }
@keyframes bump { 50% { transform: scale(1.12); } }

/* Sheets (cart + product detail) */
.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px;
  max-height: 88vh; background: var(--cream); color: var(--wine);
  border-radius: 22px 22px 0 0; display: none; flex-direction: column;
}
.sheet[open] { display: flex; animation: up .22s ease; }
@media (min-width: 820px) { .sheet { margin: auto; border-radius: 22px; border: 2px solid var(--wine); } }
.sheet::backdrop { background: rgba(74, 13, 20, .45); }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.sheet__head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 8px; }
.sheet__head h2 { font-size: 1.75rem; margin: 0; }
.sheet__foot { padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: grid; gap: 10px; }
.cartlist { list-style: none; margin: 0; padding: 4px 18px 12px; overflow-y: auto; display: grid; gap: 12px; }
.cartline { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.cartline img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; }
.cartline__top { display: flex; justify-content: space-between; gap: 8px; font-weight: var(--w-strong); }
.cartline__sub { font-size: .8125rem; }
.cartline__actions { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.cartline__actions .stepper button { width: 34px; height: 34px; }
.linkbtn { background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; font-size: .8125rem; font-weight: var(--w-strong); cursor: pointer; padding: 8px 0; }
.tag { display: inline-block; font-size: .6875rem; font-weight: var(--w-strong); letter-spacing: .06em; border: 1.5px solid var(--wine); border-radius: 999px; padding: 0 7px; margin-left: 6px; vertical-align: middle; }
.empty { padding: 24px 0; text-align: center; }

#detailBody { overflow-y: auto; padding: 0 18px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 10px; }
#detailBody img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 16px; }
.detail__name { font-size: 2rem; }
.detail__benefit { font-weight: var(--w-head); font-size: 1.25rem; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--cartbar-h) + 14px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--wine); color: var(--cream); padding: 10px 18px; border-radius: 999px; font-weight: var(--w-strong); font-size: .875rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 40; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
