/* Self-hosted, subset to the characters the site uses (see _work/fonts build).
   Petrona + Karla are SIL OFL 1.1 — licence texts in /fonts/. */
@font-face {
  font-family: 'Petrona';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/petrona-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Petrona';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/petrona-italic-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Karla';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/karla-latin.woff2') format('woff2');
}

/* Moon Roastery — tokens */
:root {
  --ink-night: #0a0e16;
  --raised-night: #171d2b;
  --moonlight: #eef1f6;
  --dim-moonlight: #a9b2c4;
  --amber: #d98a3e;

  --font-display: 'Petrona', serif;
  --font-body: 'Karla', sans-serif;

  /* For the cart sheet and size steppers only - the rest of the site's
     existing motion uses plain `ease` and is untouched here. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

@property --accent {
  syntax: '<color>';
  inherits: true;
  initial-value: #d98a3e;
}

:root {
  --accent: var(--amber);
}

*, *::before, *::after { box-sizing: border-box; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink-night);
  color: var(--moonlight);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0 0 0.4em; }

a { color: inherit; }

button { font-family: inherit; }

/* Hero */
.hero {
  position: relative;
  height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  text-align: center;
  overflow: hidden;
}

@media (min-width: 640px) {
  .hero { height: 88vh; }
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(10, 14, 22, 0.45) 0%, rgba(10, 14, 22, 0.72) 65%, var(--ink-night) 100%),
    linear-gradient(180deg, rgba(10, 14, 22, 0.35) 0%, rgba(10, 14, 22, 0.55) 60%, var(--ink-night) 100%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  max-width: 28rem;
}

/* Logo lockup: crescent passes behind the wordmark, "Roastery" nested under the O's */
.logo-lockup {
  position: relative;
  width: 9rem;
  aspect-ratio: 1;
  color: var(--moonlight);
  margin-bottom: 0.25rem;
}

.crescent-mark {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.logo-word {
  position: absolute;
  top: 48%;
  left: 60%;
  transform: translate(-50%, -50%);
  z-index: 1;
  white-space: nowrap;
  text-align: center;
}

.logo-moon {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.9rem;
  letter-spacing: 0.03em;
  color: var(--moonlight);
  line-height: 1;
}

.logo-roastery {
  display: block;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 0.6rem;
  color: var(--dim-moonlight);
  letter-spacing: 0.04em;
  margin-top: 0.15em;
}

.logo-lockup--small {
  width: 4.5rem;
  margin: 0 auto 0.5rem;
}

.logo-lockup--small .logo-moon {
  font-size: 1rem;
}

.logo-lockup--small .logo-roastery {
  font-size: 0.4rem;
}

.hero h1 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 600;
  max-width: 20ch;
}

.tagline {
  margin: 0;
  color: var(--dim-moonlight);
  font-size: 1rem;
}

.cafe-link {
  color: var(--amber);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%);
  z-index: 1;
  color: var(--moonlight);
  text-decoration: none;
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  padding: 0.5rem;
}

.scroll-cue span {
  display: inline-block;
  animation: bob 1.8s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(0.3em); }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue span { animation: none; }
}

/* Beans — Layout A: cold brew card, 2-up grid, coming-soon strip, dimmed tiles */
.beans {
  padding: 0.75rem 1.25rem 4rem;
  max-width: 26rem;
  margin: 0 auto;
}

.beans h2 {
  font-size: 1.3rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.beans-intro {
  max-width: 30rem;
  margin: 0 auto 1.5rem;
  color: var(--dim-moonlight);
  font-size: 0.88rem;
  text-align: center;
}

.beans-updated {
  margin: -1rem auto 1.25rem;
  color: var(--dim-moonlight);
  font-size: 0.75rem;
  text-align: center;
}
.beans-updated[hidden] { display: none; }

/* State pills — told apart by fill, not just hue:
   ready = solid light · roast/brew = amber outline · off = muted outline · soon = dashed */
.pill {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 1.5rem;
  padding: 0.1em 0.7em;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.pill--ready { background: var(--moonlight); border-color: var(--moonlight); color: var(--ink-night); }
.pill--amber { border-color: var(--amber); color: var(--amber); }
.pill--off { border-color: rgba(169, 178, 196, 0.45); color: var(--dim-moonlight); }
.pill--soon { border: 1.5px dashed rgba(238, 241, 246, 0.7); color: var(--moonlight); }

/* Cold brew: one wide card */
.cold-card {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  grid-template-areas:
    'art body'
    'copy copy'
    'note note'
    'also also';
  column-gap: 1rem;
  row-gap: 0.55rem;
  margin-bottom: 12px;
  padding: 0.85rem;
  border-radius: 14px;
  background: var(--raised-night);
  border: 1px solid rgba(238, 241, 246, 0.08);
}
.cold-card.is-dim .cold-art { opacity: 0.55; filter: saturate(0.75); }

.cold-art {
  grid-area: art;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
}

.cold-body {
  grid-area: body;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  min-width: 0;
}

.cold-title { margin: 0.2rem 0 0; font-size: 1.2rem; font-weight: 600; }
.cold-sub { margin: 0; color: var(--dim-moonlight); font-size: 0.85rem; }

.cold-buy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  margin-top: auto;
}
.cold-price { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.cold-buy .bean-buy { margin: 0; padding: 0; }

.cold-copy { grid-area: copy; max-width: 60ch; margin: 0.15rem 0 0; font-size: 0.9rem; }
.cold-note { grid-area: note; margin: 0; color: var(--dim-moonlight); font-size: 0.8rem; }
.cold-also { grid-area: also; margin: 0; color: var(--dim-moonlight); font-size: 0.8rem; font-style: italic; }

/* Grid: ready / roast beans, 2-up on phone */
.bean-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.bean-grid:empty { display: none; }

.bean-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid rgba(238, 241, 246, 0.08);
  border-radius: 14px;
  overflow: hidden;
  background: var(--raised-night);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), border-color 160ms ease;
}
.bean-card:active { transform: scale(0.97); }
.bean-card:focus-visible,
.tile:focus-visible { outline: 2px solid var(--moonlight); outline-offset: 2px; }

@media (hover: hover) and (pointer: fine) {
  .bean-card:hover { border-color: color-mix(in srgb, var(--card-accent) 55%, transparent); }
}

.bean-art {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--ink-night);
  box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--card-accent) 10%, transparent);
}
/* The label art is 4:5 with text burnt into its edges (country, the vertical
   foreign word) — `contain` keeps all of it inside the square; the accent-tinted
   ground fills the side bars. */
.bean-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.staple-ribbon {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 0.4em 0.6em;
  background: rgba(10, 14, 22, 0.82);
  backdrop-filter: blur(2px);
  color: var(--moonlight);
  text-align: center;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.bean-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.7rem 0.8rem;
}
.bean-title { margin-top: 0.3rem; font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; line-height: 1.2; }
.bean-sub { color: var(--dim-moonlight); font-size: 0.75rem; }
.bean-price { margin-top: auto; padding-top: 0.3rem; font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; }

.bean-price--ask { font-family: var(--font-body); font-size: 0.8rem; font-weight: 700; color: var(--amber); }

/* Shared type for the detail sheet and strip */
.bean-type {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  color: var(--amber);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.bean-type::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
}
.bean-variant { font-style: italic; font-weight: 400; color: var(--dim-moonlight); font-size: 0.85em; }
.bean-taste { margin: 0; color: var(--moonlight); font-size: 0.9rem; }
.bean-meta { margin: 0; color: var(--dim-moonlight); font-size: 0.78rem; letter-spacing: 0.01em; }
.bean-origin { margin: 0; color: var(--dim-moonlight); font-size: 0.72rem; font-style: italic; }

/* Coming soon: one wide dashed strip under the grid */
.soon-slot { display: flex; flex-direction: column; gap: 12px; }
.soon-slot:not(:empty) { margin-top: 12px; }

.soon-strip {
  display: flex;
  gap: 0.85rem;
  padding: 0.75rem;
  border: 1.5px dashed rgba(238, 241, 246, 0.28);
  border-radius: 14px;
}
.soon-art {
  flex: none;
  width: 76px;
  height: 76px;
  border-radius: 10px;
  object-fit: cover;
  opacity: 0.85;
}
.soon-body { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; min-width: 0; }
.soon-title { margin: 0.15rem 0 0; font-size: 1rem; font-weight: 600; }
.soon-notes { margin: 0; color: var(--moonlight); font-size: 0.82rem; }
.soon-meta { margin: 0; color: var(--dim-moonlight); font-size: 0.74rem; }

.origin-note {
  margin: 1.5rem auto 0;
  max-width: 34rem;
  color: var(--dim-moonlight);
  font-size: 0.85rem;
  font-style: italic;
  text-align: center;
}

/* Not roasting: one row of small dimmed tiles */
.beans-secondary { margin-top: 2rem; }
.beans-secondary[hidden] { display: none; }
.beans-secondary h3 {
  margin: 0 0 0.9rem;
  font-size: 1rem;
  text-align: center;
  color: var(--dim-moonlight);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tile-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms var(--ease-out);
}
.tile:active { transform: scale(0.95); }
.tile-art {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(238, 241, 246, 0.08);
  background: var(--ink-night);
}
.tile-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
  filter: saturate(0.75);
}
.tile-name {
  color: var(--dim-moonlight);
  font-size: 0.7rem;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}
@media (hover: hover) and (pointer: fine) {
  .tile:hover .tile-art img { opacity: 0.8; }
}

/* One chip per size / a single in-place stepper (cold brew). Once the item is
   in the cart, the chip swaps in place for [−] qty [+] — same footprint. */
.bean-buy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.size-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.5em 1em;
  border-radius: 999px;
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.4s ease, border-color 0.4s ease, background 140ms ease, transform 140ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .size-chip:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
}
.size-chip:active { transform: scale(0.97); }
.size-chip:focus-visible { outline: 2px solid var(--moonlight); outline-offset: 2px; }
/* .size-chip's own display: flex beats the UA [hidden] rule — restate it. */
.size-chip[hidden] { display: none; }
.size-chip-price { font-family: var(--font-display); }

.size-stepper {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  min-height: 44px;
  padding: 0.15rem;
  padding-left: 0.7em;
  border-radius: 999px;
  background: var(--accent);
  border: 2px solid var(--accent);
  color: #05070a;
  font-weight: 700;
  transition: background 0.4s ease, border-color 0.4s ease;
}
.size-stepper[hidden] { display: none; }
.size-stepper .step-label { font-family: var(--font-display); font-size: 0.85rem; white-space: nowrap; margin-right: 0.1rem; }
.size-stepper .step-qty { min-width: 1.3rem; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.size-stepper .step-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  border-radius: 50%;
  color: #05070a;
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .size-stepper .step-btn:hover { background: rgba(5, 7, 10, 0.14); }
}
.size-stepper .step-btn:active { transform: scale(0.9); }

.ask-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  min-height: 44px;
  color: var(--dim-moonlight);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  font-size: 0.85rem;
}
.ask-whatsapp:hover { color: var(--amber); }
.ask-whatsapp:focus-visible { outline: 2px solid var(--moonlight); outline-offset: 2px; }

.cafe-link:focus-visible,
.scroll-cue:focus-visible { outline: 2px solid var(--moonlight); outline-offset: 2px; }

/* How to buy / find us / for cafes / about — shared narrow-section layout */
.how-to-buy,
.find-us,
.for-cafes,
.about {
  max-width: 30rem;
  margin: 0 auto;
  padding: 3rem 1.25rem;
  text-align: center;
}

.how-to-buy h2,
.find-us h2,
.for-cafes h2,
.about h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.how-to-buy p,
.find-us p,
.for-cafes p,
.about p {
  color: var(--dim-moonlight);
  margin: 0 0 0.75rem;
}

.lead-time-note {
  font-size: 0.85rem;
  font-style: italic;
}

.product-photo {
  margin: 1.5rem 0;
}

.product-photo img {
  width: 100%;
  height: auto;
  border-radius: 14px;
  display: block;
}

.product-photo figcaption {
  margin-top: 0.6rem;
  color: var(--dim-moonlight);
  font-size: 0.8rem;
  font-style: italic;
  text-align: center;
}

/* ---- cross-link (sister-site card) ---- */
.cross-link-card {
  margin-top: 1.5rem;
  text-align: left;
}

.cross-link-shots {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
}

.shot-frame {
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(238, 241, 246, 0.08);
}

.shot-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.shot-frame--desktop {
  flex: 1 1 0;
  aspect-ratio: 4 / 3;
}

.shot-frame--mobile {
  flex: 0 0 30%;
  aspect-ratio: 9 / 16;
}

.cross-link-info {
  margin-top: 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.cross-link-crescent {
  width: 30px;
  height: 30px;
  color: var(--moonlight);
}

.cross-link-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--moonlight);
}

.cross-link-status {
  margin: 0;
  color: var(--dim-moonlight);
  font-size: 0.9rem;
}

.cross-link-visit {
  margin-top: 0.35rem;
}

.collection-info {
  margin-top: 1.5rem;
  padding: 1.25rem 1.25rem 1.5rem;
  border-radius: 14px;
  background: var(--raised-night);
  border: 1px solid rgba(238, 241, 246, 0.08);
}

.collection-only {
  color: var(--moonlight);
}

.collection-only strong {
  color: var(--amber);
}

.collection-address {
  font-size: 0.9rem;
}

.collection-hours {
  margin-top: 0.75rem;
  font-size: 0.8rem;
}

.for-cafes .needs-input,
.about .needs-input {
  margin: 1rem auto;
  text-align: left;
}

.trade-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-top: 0.5rem;
  padding: 0.6em 1.2em;
  min-height: 44px;
  border-radius: 999px;
  border: 2px solid var(--amber);
  color: var(--amber);
  text-decoration: none;
  font-weight: 700;
}

.trade-cta:hover {
  background: color-mix(in srgb, var(--amber) 14%, transparent);
}

.trade-cta:focus-visible {
  outline: 2px solid var(--moonlight);
  outline-offset: 2px;
}

.trade-cta--secondary {
  margin-top: 1.5rem;
  border-color: rgba(238, 241, 246, 0.2);
  color: var(--dim-moonlight);
}

.trade-cta--secondary:hover {
  background: rgba(238, 241, 246, 0.08);
}

/* For cafes: two wholesale routes, the second with a structured enquiry form */
.wholesale-route {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(238, 241, 246, 0.08);
  text-align: left;
}

.wholesale-route h3 {
  font-size: 1rem;
  color: var(--amber);
}

.wholesale-enquiry {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.wholesale-enquiry fieldset {
  margin: 0;
  padding: 0;
  border: none;
}

.wholesale-enquiry legend {
  padding: 0 0 0.5rem;
  color: var(--dim-moonlight);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wholesale-enquiry fieldset label {
  display: flex;
  align-items: center;
  gap: 0.6em;
  min-height: 44px;
  font-size: 0.9rem;
}

.wholesale-enquiry input[type="checkbox"],
.wholesale-enquiry input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--amber);
  flex: none;
}

.wholesale-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--dim-moonlight);
}

.wholesale-field[hidden] {
  display: none;
}

.wholesale-field input[type="text"] {
  min-height: 44px;
  padding: 0.5em 0.75em;
  border-radius: 8px;
  border: 1px solid rgba(238, 241, 246, 0.2);
  background: var(--raised-night);
  color: var(--moonlight);
  font-family: inherit;
  font-size: 0.9rem;
}

.wholesale-field input:focus-visible,
.wholesale-enquiry input[type="checkbox"]:focus-visible,
.wholesale-enquiry input[type="radio"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Cart bar: a compact always-visible strip once the cart has items. Tapping
   it opens/closes the full cart-panel sheet (below) — it never scrolls or
   grows itself. */
.cart-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  background: #05070a;
  border-top: 2px solid var(--accent);
  transition: border-color 0.4s ease;
}

body.has-cart {
  padding-bottom: var(--cart-bar-height, 0px);
}

.cart-bar-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 0.9rem 1.25rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  min-height: 44px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--accent);
  transition: color 0.4s ease;
}

/* Dimmed scrim behind the sheet. Sits below the bar and panel so both
   stay tappable above the dim. */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: rgba(3, 4, 8, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 240ms var(--ease-out), visibility 0s linear 240ms;
}

.sheet-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 240ms var(--ease-out);
}

/* Sheet: sits just off-screen when closed (reads as something living
   below the viewport, not fading into existence) and slides up on open.
   CSS transition (not keyframes) on transform so a rapid close mid-open
   retargets from wherever it currently is. Opening is a slower, deliberate
   reveal; closing is a snappier response. */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 7;
  max-height: 85svh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #05070a;
  border-top: 2px solid var(--accent);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform 220ms var(--ease-out), visibility 0s linear 220ms, border-color 0.4s ease;
}

.sheet.is-open {
  transform: translateY(0);
  visibility: visible;
  transition: transform 320ms var(--ease-drawer), visibility 0s linear 0s, border-color 0.4s ease;
}

.sheet.is-dragging {
  transition: border-color 0.4s ease;
}

.sheet-inner {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0.5rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.sheet-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding-bottom: 0.35rem;
}

.sheet-handle {
  grid-column: 1 / -1;
  justify-self: center;
  width: 2.5rem;
  height: 4px;
  margin-bottom: 0.6rem;
  border-radius: 999px;
  background: rgba(238, 241, 246, 0.22);
  touch-action: none;
}

.sheet-title {
  grid-column: 1;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--moonlight);
}

.sheet-close {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -0.5rem -0.4rem -0.5rem 0;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--dim-moonlight);
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .sheet-close:hover {
    color: var(--moonlight);
    background: rgba(238, 241, 246, 0.08);
  }
}

.sheet-close:active {
  transform: scale(0.94);
}

.cart-panel-actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.75rem;
  margin-top: 0.4rem;
}

.clear-all {
  padding: 0.4em 0.6em;
  border: none;
  background: transparent;
  color: var(--dim-moonlight);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  font-size: 0.8rem;
  cursor: pointer;
  min-height: 44px;
  align-self: center;
}

.clear-all.is-confirming {
  color: #e0446b;
  font-weight: 700;
  text-decoration: none;
}

.cart-lines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--dim-moonlight);
}

.cart-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: none;
}

.qty-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--dim-moonlight);
  background: transparent;
  color: var(--moonlight);
  font-size: 0.95rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}

.qty-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.qty-count {
  min-width: 1.2em;
  text-align: center;
  color: var(--moonlight);
  font-variant-numeric: tabular-nums;
}

.cart-line-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cart-line-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.3;
}

.cart-line-kind {
  color: var(--dim-moonlight);
  font-size: 0.72rem;
}

.cart-line-price {
  flex: none;
  color: var(--moonlight);
}

.remove-btn {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--dim-moonlight);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.remove-btn:hover {
  color: #e0446b;
}

.cart-name-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--dim-moonlight);
}

.cart-name-field input {
  min-height: 40px;
  padding: 0.5em 0.75em;
  border-radius: 8px;
  border: 1px solid rgba(238, 241, 246, 0.2);
  background: var(--raised-night);
  color: var(--moonlight);
  font-family: inherit;
  font-size: 0.9rem;
}

.cart-name-field input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--moonlight);
}

.cart-total span:last-child {
  color: var(--accent);
  transition: color 0.4s ease;
}

.send-order {
  display: block;
  text-align: center;
  min-height: 44px;
  line-height: 44px;
  border-radius: 999px;
  background: var(--accent);
  color: #05070a;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.4s ease;
}

.send-order:focus-visible {
  outline: 2px solid var(--moonlight);
  outline-offset: 2px;
}

.cart-send {
  margin: 0;
  font-size: 0.7rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid rgba(238, 241, 246, 0.08);
  padding: 2.5rem 1.25rem 3rem;
}

.footer-inner {
  max-width: 30rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
}

.footer-tagline {
  margin: 0;
  color: var(--dim-moonlight);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem 1.5rem;
  font-size: 0.85rem;
}

.footer-links a {
  color: var(--moonlight);
  text-decoration: none;
  border-bottom: 1px solid rgba(238, 241, 246, 0.3);
}

.footer-links a:hover,
.footer-links a:focus-visible {
  border-color: var(--amber);
  color: var(--amber);
}

.footer-inner .credit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  margin-top: 0.4rem;
  padding: 0.65rem 0.5rem;
  min-height: 44px;
  color: var(--dim-moonlight);
  opacity: 0.6;
  font-family: var(--font-body);
  font-size: 0.75rem;
  text-decoration: none;
  transition: opacity 200ms ease;
}
.footer-inner .credit:hover,
.footer-inner .credit:focus-visible { opacity: 1; }
.footer-inner .credit-mark { width: 11px; height: auto; flex-shrink: 0; }


/* ---- Bean detail sheet (shares .sheet with the cart) ---- */
/* Sits above the cart bar and its backdrop, unlike the cart sheet. */
.sheet--bean { z-index: 9; }
.sheet-backdrop--bean { z-index: 8; }

.sheet--bean .sheet-inner { padding-bottom: 0; }
/* No title row here — the ✕ floats top-right so the art can sit right under the handle. */
.sheet--bean .sheet-header { position: relative; padding-bottom: 0; }
.sheet--bean .sheet-handle { margin-bottom: 0.4rem; }
.sheet--bean .sheet-close { position: absolute; top: -0.45rem; right: -0.4rem; margin: 0; }
.sheet--bean .sheet-bean-text { padding-right: 2.4rem; }

.sheet-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
}

.sheet-bean { display: flex; align-items: flex-start; gap: 0.9rem; }
.sheet-art {
  flex: none;
  width: 96px;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 10px;
}
.sheet-bean-text { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; padding-top: 0.15rem; }
.sheet-bean .sheet-title { grid-column: auto; font-size: 1.45rem; font-weight: 600; line-height: 1.15; }
.sheet-sub { margin: 0; color: var(--dim-moonlight); font-size: 0.9rem; }

.sheet-state {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.25rem;
  padding: 0.75rem;
  border-radius: 12px;
  background: var(--raised-night);
}
.sheet-state-note { margin: 0; color: var(--moonlight); font-size: 0.85rem; }

.size-rows {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.size-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem 0.35rem 0.85rem;
  border: 1px solid rgba(238, 241, 246, 0.12);
  border-radius: 14px;
}
.size-row-info { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.size-row-main { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; }
.size-row-mode { color: var(--dim-moonlight); font-size: 0.8rem; }
.size-row-mode--ready { color: var(--moonlight); font-weight: 700; }
.size-row-incart { color: var(--accent); font-size: 0.74rem; }

.row-stepper { display: flex; align-items: center; flex: none; }
.row-stepper .step-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(238, 241, 246, 0.3);
  border-radius: 50%;
  background: transparent;
  color: var(--moonlight);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), opacity 140ms ease, border-color 140ms ease;
}
.row-stepper .step-btn:active:not(:disabled) { transform: scale(0.92); }
.row-stepper .step-btn:disabled { opacity: 0.3; cursor: default; }
.row-stepper .step-btn:focus-visible { outline: 2px solid var(--moonlight); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .row-stepper .step-btn:hover:not(:disabled) { border-color: var(--accent); }
}
.row-qty { min-width: 2rem; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Add button stays in reach while the size rows scroll. */
.sheet-footer {
  position: sticky;
  bottom: 0;
  margin: 0.4rem 0 calc(-1.25rem - env(safe-area-inset-bottom, 0px));
  padding: 0.75rem 0 calc(1.25rem + env(safe-area-inset-bottom, 0px));
  background: #05070a;
}
.add-to-order {
  display: block;
  width: 100%;
  min-height: 48px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #05070a;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.add-to-order:active:not(:disabled) { transform: scale(0.97); }
.add-to-order:disabled {
  background: transparent;
  border-color: rgba(238, 241, 246, 0.2);
  color: var(--dim-moonlight);
  cursor: default;
}
/* The same button as a link — "Ask for price ↗" on a buyable bean with no price yet. */
.add-to-order--link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  text-decoration: none;
}
.add-to-order:focus-visible { outline: 2px solid var(--moonlight); outline-offset: 2px; }

.sheet--bean .needs-input { margin-top: 0.5rem; }

/* Wider screens: 3–4 columns, same cards. */
@media (min-width: 640px) {
  .beans { max-width: 52rem; }
  .cold-card {
    grid-template-columns: 180px minmax(0, 1fr);
    grid-template-areas:
      'art body'
      'art copy'
      'art note'
      'art also';
    grid-template-rows: auto auto auto 1fr;
    align-items: start;
  }
  .cold-art { align-self: start; }
  .bean-grid { grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: 16px; }
  .soon-art { width: 96px; height: 96px; }
  .tile-row { grid-template-columns: repeat(auto-fill, 5.5rem); justify-content: start; gap: 12px; }
  .beans-secondary h3 { text-align: left; }
}

/* Placed last so it wins the specificity tie against the regular
   .sheet.is-open rule above (same selector, same specificity -
   source order decides, and an earlier reduced-motion block loses). */
@media (prefers-reduced-motion: reduce) {
  /* Press feedback is movement too — drop the scale, keep the colour/border
     changes. Selectors repeat the originals so they win the specificity tie. */
  .bean-card:active,
  .tile:active,
  .size-chip:active,
  .size-stepper .step-btn:active,
  .row-stepper .step-btn:active:not(:disabled),
  .add-to-order:active:not(:disabled),
  .sheet-close:active { transform: none; }

  /* Movement goes instant; the backdrop's opacity fade is a color-style
     transition (not movement) and stays - gentler, not zero. */
  .sheet,
  .sheet.is-open {
    transition: visibility 0s linear, border-color 0.4s ease;
  }
}
