/* Layout and components. Colours and fonts come from theme.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--font-heading); line-height: 1.2; margin: 0 0 0.5em; font-weight: 600; }
p { margin: 0 0 0.75em; }
a { color: var(--color-brand); text-underline-offset: 0.15em; }
a:hover { color: var(--color-brand-hover); }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }

.wrap { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 24px; } }

.muted { color: var(--color-muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.plain-list { list-style: none; margin: 0; padding: 0; }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--color-surface); color: var(--color-text);
  padding: 10px 14px; border-radius: var(--radius-small); box-shadow: var(--shadow);
}
.skip-link:focus { top: 8px; }

/* Header */
.site-header { border-bottom: 1px solid var(--color-border); background: var(--color-surface); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.brand { font-family: var(--font-heading); font-size: 1.35rem; font-weight: 700; color: var(--color-text); text-decoration: none; }
.brand::before {
  content: ""; display: inline-block; width: 0.7em; height: 0.7em; margin-right: 0.4em;
  border-radius: 50%; background: var(--color-accent); box-shadow: inset 0 0 0 2px var(--color-brand);
}
.nav { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav a { display: block; padding: 10px 8px; color: var(--color-text); text-decoration: none; font-size: 0.95rem; }
.nav a:hover { text-decoration: underline; }
@media (max-width: 420px) { .nav li:nth-child(3) { display: none; } }

/* Banners and notices */
.banner { padding: 10px 0; font-size: 0.95rem; }
.banner--info { background: var(--color-info-bg); color: var(--color-info-text); }
.banner--warn { background: var(--color-warn-bg); color: var(--color-warn-text); }
.notice { padding: 12px 14px; border-radius: var(--radius-small); margin: 0 0 14px; }
.notice--info { background: var(--color-info-bg); color: var(--color-info-text); }
.notice--error { background: var(--color-error-bg); color: var(--color-error-text); }

/* Hero */
.hero { padding: 36px 0 12px; }
.hero__title { font-size: clamp(1.9rem, 5vw, 2.8rem); }
.hero__lead { font-size: 1.1rem; color: var(--color-muted); max-width: 40em; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 16px 0 0; padding: 0; }
.facts li {
  padding: 4px 12px; border-radius: 999px; font-size: 0.9rem;
  background: var(--color-surface); border: 1px solid var(--color-border);
}

/* Order form layout: products, then summary (side by side on wide screens) */
.order { display: grid; gap: 24px; padding-top: 24px; padding-bottom: 24px; }
@media (min-width: 960px) {
  .order { grid-template-columns: minmax(0, 1fr) 330px; align-items: start; }
  .summary { position: sticky; top: 16px; }
}
.section-title { font-size: 1.45rem; }

.grid { display: grid; gap: 16px; list-style: none; margin: 0; padding: 0; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Product card */
.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card__media { aspect-ratio: 16 / 9; background: var(--color-media-bg); display: grid; place-items: center; }
@media (min-width: 560px) { .card__media { aspect-ratio: 4 / 3; } }
.card__img { width: 100%; height: 100%; object-fit: cover; }
.card__art { width: auto; height: 82%; max-width: 70%; color: var(--flavor-default); }
.card__body { display: flex; flex-direction: column; gap: 4px; padding: 16px; flex: 1; }
.card__title { font-size: 1.15rem; margin-bottom: 0.2em; }
.card__summary { color: var(--color-muted); margin-bottom: 0.4em; }
.card__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 10px; }
.price { font-size: 1.25rem; font-weight: 700; }
.card__meta .muted { font-size: 0.85rem; }
.card--soldout .card__media { opacity: 0.55; }
.soldout { font-weight: 600; color: var(--color-muted); }

.flavor-tradizionale { color: var(--flavor-tradizionale); }
.flavor-limone { color: var(--flavor-limone); }
.flavor-arancia { color: var(--flavor-arancia); }
.flavor-mandorla { color: var(--flavor-mandorla); }
.flavor-cioccolato { color: var(--flavor-cioccolato); }
.art-dome { fill: currentColor; }
.art-crust { fill: none; stroke: rgb(0 0 0 / 14%); stroke-width: 3; stroke-linecap: round; }
.art-paper { fill: var(--color-paper); stroke: var(--color-paper-lines); stroke-width: 2; }
.art-lines { stroke: var(--color-paper-lines); stroke-width: 2; }
.art-shadow { fill: rgb(0 0 0 / 8%); }

/* Quantity stepper */
.qty { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; }
.qty__label { font-weight: 600; }
.qty__control { display: inline-flex; align-items: stretch; border: 1px solid var(--color-border); border-radius: 999px; overflow: hidden; }
.qty__btn {
  width: 44px; height: 44px; border: 0; background: var(--color-surface); color: var(--color-text);
  font-size: 1.35rem; line-height: 1; cursor: pointer;
}
.qty__btn:hover:not(:disabled) { background: var(--color-media-bg); }
.qty__btn:disabled { color: var(--color-border); cursor: not-allowed; }
.qty__input {
  width: 3.2rem; height: 44px; border: 0; border-left: 1px solid var(--color-border); border-right: 1px solid var(--color-border);
  text-align: center; font: inherit; font-weight: 700; color: var(--color-text); background: var(--color-surface);
}

/* Ingredients */
.details { margin-top: 12px; border-top: 1px solid var(--color-border); padding-top: 8px; }
.details summary { cursor: pointer; padding: 6px 0; font-weight: 600; color: var(--color-brand); }
.details__body { font-size: 0.9rem; padding-top: 6px; }
.nutrition { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 0.9rem; }
.nutrition caption { text-align: left; font-weight: 600; padding-bottom: 4px; }
.nutrition th, .nutrition td { text-align: left; padding: 4px 0; border-bottom: 1px solid var(--color-border); font-weight: 400; }
.nutrition td { text-align: right; }

/* Summary */
.summary:focus { outline: none; }
.summary__box {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.summary__lines { list-style: none; margin: 0 0 8px; padding: 0; }
.summary__lines li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--color-border); }
.summary__empty { color: var(--color-muted); }
.summary__totals { margin: 8px 0 14px; }
.summary__totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.summary__totals dt, .summary__totals dd { margin: 0; }
.summary__totals .summary__total { font-size: 1.15rem; font-weight: 700; border-top: 1px solid var(--color-border); margin-top: 6px; padding-top: 8px; }
.summary__nojs, .summary__hint { font-size: 0.85rem; }
.summary__hint { margin: 12px 0 0; }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border: 0; border-radius: 999px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.button--primary { background: var(--color-brand); color: var(--color-on-brand); }
.button--primary:hover:not(:disabled) { background: var(--color-brand-hover); color: var(--color-on-brand); }
.button:disabled { opacity: 0.55; cursor: not-allowed; }
.button[aria-busy="true"] { cursor: progress; }
.button--block { width: 100%; }

/* Bar at the bottom on phones */
.orderbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--color-surface); border-top: 1px solid var(--color-border);
  box-shadow: 0 -4px 18px rgb(0 0 0 / 8%);
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
}
.orderbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.orderbar__text { margin: 0; font-weight: 600; }
.orderbar .button { min-height: 44px; padding: 10px 18px; white-space: nowrap; }
body.has-orderbar { padding-bottom: 76px; }
@media (min-width: 960px) {
  .orderbar { display: none; }
  body.has-orderbar { padding-bottom: 0; }
}

/* Info sections */
.info { padding-top: 8px; padding-bottom: 24px; }
.steps { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.info__list li { padding: 6px 0; border-bottom: 1px solid var(--color-border); }

/* Text pages */
.page { padding-top: 36px; padding-bottom: 48px; max-width: 760px; }
.lead { font-size: 1.15rem; }
.prose h2 { font-size: 1.2rem; margin-top: 1.4em; }

/* Footer */
.site-footer { margin-top: 32px; padding: 32px 0; border-top: 1px solid var(--color-border); background: var(--color-surface); font-size: 0.92rem; }
.site-footer__grid { display: grid; gap: 20px; }
@media (min-width: 700px) { .site-footer__grid { grid-template-columns: repeat(3, 1fr); } }
.site-footer__title { font-weight: 700; margin-bottom: 0.4em; }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
