@font-face {
  font-family: "Alexandria";
  src: url("assets/fonts/Alexandria.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --porcelain: #fffdf9;
  --cream: #f6f1e9;
  --roast: #6a3918;
  --deep-roast: #3b1d0d;
  --caramel: #d6a064;
  --stone: #e5e2de;
  --ink: #2d211a;
  --muted: #766c65;
  --white-on-roast: #fffaf3;
  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: light;
  font-family: "Alexandria", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--porcelain);
  overscroll-behavior: none;
}

body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-width: 320px;
  min-height: 100%;
  overflow: hidden;
  background: var(--porcelain);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

html.detail-active,
html.detail-active body {
  background: #814a24;
}

button, input { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, [role="button"]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--caramel), white 20%);
  outline-offset: 3px;
}

::selection { background: var(--caramel); color: var(--deep-roast); }

.icon-sprite { position: fixed; width: 0; height: 0; overflow: hidden; }
.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; }

.app-shell {
  position: relative;
  width: min(100%, 430px);
  min-height: 100svh;
  height: 100svh;
  min-height: 100dvh;
  height: 100dvh;
  margin-inline: auto;
  overflow: hidden;
  background: var(--porcelain);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .38);
}

.view {
  display: none;
  min-height: 100svh;
  height: 100svh;
  min-height: 100dvh;
  height: 100dvh;
  background: var(--porcelain);
}
.view.is-active { display: block; }

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-view { overflow: hidden; padding: max(32px, env(safe-area-inset-top)) 0 calc(92px + env(safe-area-inset-bottom)); }

.topbar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
}

.account-mark, .icon-button, .stage-action, .bag-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.account-mark {
  border-radius: 50%;
  background: var(--roast);
  color: var(--white-on-roast);
  font-size: 17px;
  font-weight: 680;
  box-shadow: 0 7px 18px rgba(75, 35, 10, .2);
}

.location-control {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 570;
  cursor: pointer;
}
.location-control svg { width: 18px; height: 18px; color: var(--caramel); stroke-width: 2.25; }
.quiet { color: var(--ink); }

.search-row { padding: 34px 24px 0; }
.search-field {
  display: grid;
  grid-template-columns: 1fr 46px;
  min-height: 58px;
  border: 1px solid #ded8d0;
  border-radius: 999px;
  background: #f7f5f3;
  overflow: hidden;
}
.search-field input {
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0 8px 0 18px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}
.search-field input::placeholder { color: #6c625c; opacity: 1; }
.search-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 4px;
  border-radius: 50%;
  background: var(--caramel);
  color: var(--deep-roast);
}
.search-button svg { width: 20px; height: 20px; }

.category-block { padding-top: 27px; }
.category-block h1 { margin: 0 24px 14px; font-size: 20px; line-height: 1.2; font-weight: 740; letter-spacing: -.025em; }
.category-rail {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 0 24px 8px;
  scrollbar-width: none;
}
.category-rail::-webkit-scrollbar, .product-carousel::-webkit-scrollbar { display: none; }
.category-chip {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--stone);
  color: #5d554f;
  font-size: 13px;
  font-weight: 580;
  cursor: pointer;
  transition: color .22s var(--ease), background-color .22s var(--ease), transform .22s var(--ease);
}
.category-chip:active { transform: scale(.97); }
.category-chip.is-selected { background: var(--caramel); color: var(--deep-roast); }

.product-carousel {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x mandatory;
  padding: 136px 59px 34px;
}

.product-slide {
  flex: 0 0 min(69.5vw, 271px);
  scroll-snap-align: center;
  cursor: pointer;
  user-select: none;
}
.product-slide[hidden] { display: none; }

.product-card {
  position: relative;
  min-height: 338px;
  border-radius: 18px;
  background: linear-gradient(145deg, #814a24 0%, #6a3918 48%, #4b250e 100%);
  color: var(--white-on-roast);
  box-shadow: 0 24px 34px rgba(75, 36, 14, .32), inset 0 1px 0 rgba(255,255,255,.08);
}

.card-cup {
  position: absolute;
  z-index: 2;
  top: -110px;
  left: 50%;
  width: 260px;
  max-width: 96%;
  aspect-ratio: 1;
  object-fit: contain;
  transform: translateX(-50%);
  filter:
    drop-shadow(0 20px 13px rgba(32, 13, 3, .36))
    drop-shadow(0 6px 4px rgba(32, 13, 3, .2));
  pointer-events: none;
}
.hero-product { view-transition-name: featured-coffee; }

.card-content { padding: 140px 22px 22px; }
.card-content h2 { margin: 0 0 16px; font-size: 31px; line-height: 1.06; letter-spacing: -.035em; font-weight: 740; }
.rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--caramel), white 12%);
  color: var(--deep-roast);
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.rating svg { width: 13px; height: 13px; fill: currentColor; stroke-width: 0; }
.card-content p { margin: 17px 0 21px; font-size: 15px; color: #f3e6da; }
.card-content p strong { color: white; font-weight: 650; }
.card-price { display: flex; align-items: baseline; gap: 5px; font-size: 14px; font-variant-numeric: tabular-nums; }
.card-price strong { font-size: 18px; }

.add-button {
  position: absolute;
  right: 18px;
  bottom: 28px;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: white;
  color: var(--caramel);
  cursor: pointer;
  box-shadow: 0 9px 20px rgba(47, 19, 4, .18);
  transition: transform .22s var(--ease);
}
.add-button:active { transform: scale(.93); }

.empty-state { margin: 90px 24px; text-align: center; color: var(--muted); }

.bottom-nav {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  min-height: calc(78px + env(safe-area-inset-bottom));
  padding: 10px 34px calc(10px + env(safe-area-inset-bottom));
  background: var(--porcelain);
}
.nav-button {
  position: relative;
  justify-self: center;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #aaa39e;
  cursor: pointer;
}
.nav-button svg { width: 25px; height: 25px; }
.nav-button.is-active { color: var(--caramel); }
.nav-button[data-nav="home"] svg { fill: currentColor; stroke-width: 0; }
.active-dot { position: absolute; bottom: 2px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: 0; }
.nav-button.is-active .active-dot { opacity: 1; }

.detail-view { overflow: hidden; padding-bottom: 0; }
.detail-stage {
  position: relative;
  z-index: 2;
  min-height: 282px;
  display: flex;
  justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) 22px 0;
  border-radius: 0 0 42px 42px;
  background:
    radial-gradient(circle at 52% 12%, rgba(255,255,255,.13), transparent 35%),
    linear-gradient(145deg, #814a24 0%, #6a3918 56%, #47220c 100%);
  color: white;
  box-shadow: 0 22px 24px -8px rgba(48, 20, 6, .52), inset 0 -1px 0 rgba(255,255,255,.09);
}
.detail-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 390 282'%3E%3Cg fill='none' stroke='white' stroke-width='2' opacity='.32'%3E%3Cpath d='M94 38c27-15 54 3 49 27-5 23-33 39-57 28-26-12-20-40 8-55Zm-5 4c18 7 35 23 42 43'/%3E%3Cpath d='M276 20c17-9 35 2 33 18-2 14-21 25-36 18-17-7-14-26 3-36Zm-2 3c11 5 22 15 27 27'/%3E%3Cpath d='M310 142c32-17 63 5 57 33-6 27-39 45-67 31-29-15-22-48 10-64Zm-5 5c21 8 42 27 50 50'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  opacity: .22;
  pointer-events: none;
}
.detail-stage::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 18px;
  right: 18px;
  bottom: -17px;
  height: 34px;
  border-radius: 50%;
  background: rgba(48, 20, 6, .2);
  filter: blur(12px);
  pointer-events: none;
}
.detail-stage > * { z-index: 1; }
.stage-action {
  border: 1.5px solid rgba(255,255,255,.84);
  border-radius: 50%;
  color: white;
}
.stage-action[aria-pressed="true"] { background: white; color: var(--roast); }
.detail-cup {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: -128px;
  width: min(92vw, 360px);
  aspect-ratio: 1;
  object-fit: contain;
  transform: translateX(-50%);
  filter: drop-shadow(0 22px 18px rgba(37, 14, 2, .25));
  pointer-events: none;
}

.detail-content { position: relative; z-index: 1; padding: 106px 32px 0; }
.product-meta { display: grid; gap: 12px; }
.detail-rating { justify-self: start; }
.title-line { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.title-line h1 { margin: 0; min-width: 0; font-size: clamp(32px, 8.7vw, 38px); line-height: 1.06; letter-spacing: -.035em; font-weight: 740; }
.detail-price { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; background: #f0eeeb; font-size: 10px; font-weight: 680; font-variant-numeric: tabular-nums; }

.size-control { margin: 32px 0 0; padding: 0; border: 0; }
.size-control legend, .about-block h2 { margin-bottom: 9px; font-size: 14px; font-weight: 720; }
.segment-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.size-option {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--stone);
  color: #5d554f;
  font-size: 12px;
  cursor: pointer;
}
.size-option.is-selected { background: var(--caramel); color: var(--deep-roast); font-weight: 680; }

.about-block { margin-top: 32px; }
.about-block h2 { margin-top: 0; }
.about-block p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.text-action { display: inline; padding: 0; border: 0; background: transparent; color: var(--ink); font-size: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.order-controls { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 14px; padding-top: 18px; border-top: 1px solid #e9e4dd; }
.order-controls p { margin: 0; color: var(--muted); font-size: 13px; }
.order-controls strong { color: var(--ink); }
.quantity-control { display: grid; grid-template-columns: 38px 34px 38px; align-items: center; min-height: 42px; border: 1px solid #cfc9c2; border-radius: 999px; }
.quantity-control button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.quantity-control svg { width: 14px; height: 14px; }
.quantity-control output { text-align: center; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }

.purchase-row { display: grid; grid-template-columns: 54px 1fr; gap: 14px; margin-top: 8px; }
.bag-button { position: relative; width: 54px; height: 54px; border: 1px solid #cbc3bc; border-radius: 50%; }
.bag-button svg { width: 21px; height: 21px; }
.cart-count { position: absolute; top: -4px; right: -2px; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--roast); color: white; font-size: 10px; font-weight: 700; }
.buy-button { min-height: 54px; border: 0; border-radius: 999px; background: var(--caramel); color: var(--deep-roast); font-size: 16px; font-weight: 720; cursor: pointer; box-shadow: 0 13px 24px rgba(0, 0, 0, .14); }
.buy-button:active { transform: translateY(1px); }

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100% - 44px);
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

::view-transition-old(featured-coffee), ::view-transition-new(featured-coffee) { animation-duration: .48s; animation-timing-function: var(--ease); }

@media (min-width: 768px) {
  body { padding-block: 28px; }
  .app-shell { min-height: min(880px, calc(100dvh - 56px)); height: min(880px, calc(100dvh - 56px)); border-radius: 36px; }
  .view { min-height: 100%; height: 100%; }
  .home-view, .detail-view { overflow-y: auto; }
}

@media (max-height: 720px) {
  .product-carousel { padding-top: 52px; }
  .product-card { min-height: 305px; }
  .card-cup { width: 190px; }
  .card-content { padding-top: 132px; }
  .detail-stage { min-height: 244px; }
  .detail-cup { width: min(82vw, 300px); bottom: -90px; }
  .detail-content { padding-top: 72px; }
  .size-control { margin-top: 18px; }
  .about-block { margin-top: 18px; }
  .order-controls { margin-top: 18px; padding-top: 14px; }
  .purchase-row { margin-top: 12px; }
}

@media (min-height: 721px) and (max-height: 820px) {
  .home-view { padding-top: max(24px, env(safe-area-inset-top)); }
  .search-row { padding-top: 22px; }
  .search-field { min-height: 52px; }
  .search-button { width: 42px; height: 42px; }
  .category-block { padding-top: 18px; }
  .category-block h1 { margin-bottom: 10px; }
  .category-chip { min-height: 38px; }
  .product-carousel { padding-top: 110px; }

  .detail-stage { min-height: 264px; }
  .detail-cup { width: min(86vw, 334px); bottom: -112px; }
  .detail-content { padding: 96px 28px 0; }
  .size-control { margin-top: 26px; }
  .about-block { margin-top: 26px; }
  .order-controls { margin-top: 14px; padding-top: 16px; }
  .purchase-row { margin-top: 10px; }
}

@media (max-height: 700px) {
  .home-view { padding-top: max(12px, env(safe-area-inset-top)); }
  .topbar { padding-inline: 20px; }
  .search-row { padding: 8px 20px 0; }
  .search-field { min-height: 44px; }
  .search-button { width: 36px; height: 36px; }
  .category-block { padding-top: 10px; }
  .category-block h1 { margin: 0 20px 8px; font-size: 16px; }
  .category-rail { padding-inline: 20px; }
  .category-chip { min-height: 34px; padding-inline: 14px; font-size: 11px; }
  .product-carousel { padding: 52px 45px 24px; }
  .product-slide { flex-basis: min(72vw, 270px); }
  .product-card { min-height: 270px; }
  .card-cup { top: -60px; width: 180px; }
  .card-content { padding: 112px 18px 16px; }
  .card-content h2 { margin-bottom: 10px; font-size: 25px; }
  .rating { min-height: 29px; font-size: 12px; }
  .card-content p { margin: 10px 0 10px; font-size: 13px; }
  .card-price strong { font-size: 16px; }
  .add-button { right: 14px; bottom: 16px; width: 48px; height: 48px; }

  .detail-stage { min-height: 210px; }
  .detail-cup { top: 30px; bottom: auto; width: min(78vw, 42dvh, 300px); }
  .detail-content { padding: 64px 24px 0; }
  .product-meta { gap: 8px; }
  .rating { min-height: 29px; }
  .title-line h1 { font-size: 28px; }
  .size-control { margin-top: 10px; }
  .size-control legend, .about-block h2 { margin-bottom: 6px; font-size: 13px; }
  .segment-row { gap: 8px; }
  .size-option { min-height: 44px; }
  .about-block { margin-top: 10px; }
  .about-block p { line-height: 1.35; }
  .order-controls { margin-top: 10px; padding-top: 10px; }
  .purchase-row { grid-template-columns: 52px 1fr; gap: 10px; margin-top: 6px; }
  .bag-button { width: 52px; height: 52px; }
  .buy-button { min-height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
