/* ===== Fonts (files are in the fonts folder, so no request goes to Google) ===== */
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/playfair-display-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 800; font-display: swap; src: url("fonts/playfair-display-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/inter-latin-600-normal.woff2") format("woff2"); }

/* ===== Colours and fonts (change them here) ===== */
:root {
  --brown-dark: #2b1a12;
  --brown: #4a2c1d;
  --cream: #fbf1df;
  --orange: #f08a24;
  --font-head: "Playfair Display", Georgia, "Times New Roman", serif; /* elegant serif */
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; /* clean */
}

* { box-sizing: border-box; margin: 0; }

html, body {
  height: 100%;
  background: var(--brown-dark);
  color: var(--cream);
  font-family: var(--font-body);
}

/* ===== The phone column ===== */
/* On a phone it fills the screen. On a desktop it is 390 x 844 and centred. */
.phone {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--brown-dark);
}

@media (min-width: 600px) {
  body { display: grid; place-items: center; background: #160d08; }
  .phone {
    width: 390px;
    height: min(844px, 100dvh);
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  }
}

/* ===== Top bar: shop name + category buttons ===== */
.topbar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 10;
  padding: calc(14px + env(safe-area-inset-top)) 16px 28px;
  /* dark fade so the buttons are readable on any photo */
  background: linear-gradient(to bottom, rgba(30, 17, 11, .8), rgba(30, 17, 11, 0));
  pointer-events: none; /* let swipes pass through the empty parts */
}
.topbar > * { pointer-events: auto; }

.shop-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .02em;
  margin-bottom: 10px;
}

.cats { display: flex; gap: 8px; }

.cat-btn {
  font: 600 .85rem var(--font-body);
  color: var(--cream);
  background: rgba(43, 26, 18, .55);
  border: 1.5px solid rgba(251, 241, 223, .55);
  border-radius: 999px;
  padding: 7px 16px;
  min-height: 36px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.cat-btn[aria-current="true"] {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--brown-dark);
}

/* ===== The feed: one card per screen, snapping ===== */
.feed {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
  outline: none;
}
.feed::-webkit-scrollbar { display: none; }

.card {
  position: relative;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always; /* one swipe = one product */
  overflow: hidden;
  background: var(--brown);
}

.card .media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Photos: show the whole photo, with a blurred copy filling the space around it */
.card .media-bg {
  position: absolute;
  inset: -30px;           /* a little bigger so the blur has no soft edges */
  width: calc(100% + 60px);
  height: calc(100% + 60px);
  object-fit: cover;
  filter: blur(28px) brightness(.7) saturate(1.1);
}
.card .media.photo {
  inset: auto;
  top: 9%;                /* leaves room for the category buttons */
  left: 0;
  width: 100%;
  height: auto;           /* the photo keeps its own shape */
  object-fit: contain;
  /* fade the top and bottom edges of the photo into the blurred background */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 7%, #000 93%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 7%, #000 93%, transparent 100%);
}

/* Dark gradient behind the text */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
    rgba(30, 17, 11, .92) 0%,
    rgba(30, 17, 11, .75) 30%,
    rgba(30, 17, 11, 0) 62%);
  pointer-events: none;
}

.info {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  padding: 24px 22px calc(36px + env(safe-area-inset-bottom));
}

.name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(2.4rem, 11vw, 3.1rem);
  line-height: 1.02;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .5);
}

.price {
  display: inline-block;
  margin-top: 12px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.9rem;
  color: var(--orange);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}

.details {
  margin-top: 10px;
  font-size: 1rem;
  line-height: 1.45;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
  /* cut to 2 lines */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.details.open { -webkit-line-clamp: unset; line-clamp: unset; display: block; }

/* Dietary tags: small pills under the description */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding: 0;
  list-style: none;
}
.tags li {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--cream);
  padding: 4px 11px;
  border: 1px solid rgba(240, 138, 36, .8);
  border-radius: 999px;
  background: rgba(240, 138, 36, .18);
}

/* Hashtags: shown under the nutrition when open */
.hashtags {
  display: none;
  margin-top: 12px;
  font-size: .9rem;
  line-height: 1.6;
  color: var(--orange);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
}
.info.open .hashtags { display: block; }

/* Nutritional values: shown only when the caption is open */
.nutrition {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.info.open .nutrition { display: grid; }
.nutrition div {
  text-align: center;
  padding: 9px 4px;
  border: 1px solid rgba(251, 241, 223, .28);
  border-radius: 14px;
  background: rgba(251, 241, 223, .1);
  backdrop-filter: blur(6px);
}
.nutrition dd {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--cream);
}
.nutrition dt {
  margin-top: 2px;
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .75;
}

.more-btn {
  margin-top: 10px;
  font: 600 .85rem var(--font-body);
  color: var(--brown-dark);
  background: var(--cream);
  border: 0;
  border-radius: 999px;
  padding: 7px 18px;
  min-height: 36px;
  cursor: pointer;
}
.more-btn[hidden] { display: none; }

/* Small play / pause button on video cards */
.play-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid rgba(251, 241, 223, .6);
  background: rgba(43, 26, 18, .55);
  color: var(--cream);
  font-size: 1rem;
  cursor: pointer;
}

/* ===== Last card: shop details ===== */
.end-card {
  display: grid;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 18%, rgba(240, 138, 36, .28), transparent 55%),
    radial-gradient(circle at 50% 100%, rgba(240, 138, 36, .14), transparent 60%),
    linear-gradient(to bottom, #3a2217, var(--brown-dark));
}
/* Coffee bean pattern: strongest at the edges, faded behind the text */
.end-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("coffee-beans.svg") center top / 140px 140px;
  -webkit-mask-image: radial-gradient(ellipse 80% 62% at 50% 46%, transparent 35%, #000 95%);
  mask-image: radial-gradient(ellipse 80% 62% at 50% 46%, transparent 35%, #000 95%);
  opacity: .7;
  pointer-events: none;
}
/* Faint steaming cup at the bottom (replaces the photo gradient) */
.end-card::after {
  content: "";
  position: absolute;
  inset: auto 0 20px 0;
  height: 150px;
  background: url("steaming-cup.svg") center bottom / auto 100% no-repeat;
  opacity: .14;
  pointer-events: none;
}
.end-inner { position: relative; z-index: 1; padding: 96px 30px 120px; width: 100%; }

.end-kicker {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--orange);
}
.end-quote {
  margin: 20px 0 34px;
  font-family: var(--font-head);
  font-style: italic;
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1.25;
}
.end-quote::before { content: "“"; display: block; font-size: 3.4rem; line-height: .6; color: var(--orange); }

.end-hours {
  padding: 22px 16px;
  border: 1px solid rgba(251, 241, 223, .25);
  border-radius: 24px;
  background: rgba(43, 26, 18, .72);
  backdrop-filter: blur(4px);
}
.end-label { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.end-days { margin-top: 8px; font-family: var(--font-head); font-weight: 700; font-size: 1.35rem; }
.end-time { margin-top: 4px; font-family: var(--font-head); font-weight: 800; font-size: 2.4rem; color: var(--orange); }

.end-notes { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 22px 0 0; padding: 0; list-style: none; }
.end-notes li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid rgba(240, 138, 36, .8);
  border-radius: 999px;
  background: rgba(240, 138, 36, .18);
  font-size: .85rem;
  font-weight: 600;
}
.paw { width: 18px; height: 18px; flex: none; fill: var(--orange); }

.end-shop { margin-top: 36px; font-family: var(--font-head); font-weight: 700; font-size: 1rem; opacity: .85; }

/* ===== Keyboard focus ===== */
button:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.nojs { padding: 24px; text-align: center; }

/* ===== Reduce motion: no smooth scrolling ===== */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* ===== Likes and comments ===== */
/* Buttons sit just above the text, on the right (like a social feed) */
.actions {
  position: absolute;
  right: 14px;
  bottom: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 8px;
}
.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 48px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--cream);
  font: 600 .78rem var(--font-body);
  cursor: pointer;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .7);
}
.action svg {
  box-sizing: content-box;
  width: 26px;
  height: 26px;
  padding: 10px;
  border-radius: 50%;
  background: rgba(43, 26, 18, .55);
  backdrop-filter: blur(6px);
  fill: none;
  stroke: var(--cream);
  stroke-width: 1.8;
  stroke-linejoin: round;
}
.like-btn.liked svg { fill: #ff4d4d; stroke: #ff4d4d; }
.like-btn.pop svg { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* Big heart when you double-tap a card */
.big-heart {
  position: absolute;
  top: 38%;
  left: 50%;
  z-index: 4;
  width: 120px;
  margin-left: -60px;
  pointer-events: none;
  animation: float-heart .8s ease-out forwards;
}
.big-heart svg { fill: #ff4d4d; filter: drop-shadow(0 4px 16px rgba(0, 0, 0, .5)); }
@keyframes float-heart {
  0% { transform: scale(.4); opacity: 0; }
  25% { transform: scale(1.1); opacity: 1; }
  100% { transform: translateY(-40px) scale(1); opacity: 0; }
}
.card { touch-action: manipulation; }
/* The play button moves up so it never meets the like buttons */
.play-btn { top: 96px; }

/* ===== Comment sheet ===== */
body.sheet-open .feed { overflow: hidden; }
.sheet-backdrop { position: absolute; inset: 0; z-index: 20; background: rgba(0, 0, 0, .5); }
.sheet-backdrop[hidden], .sheet[hidden] { display: none; }
.sheet {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 21;
  display: flex;
  flex-direction: column;
  height: 68%;
  background: #2f1c13;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .5);
  transform: translateY(100%);
  transition: transform .25s ease;
}
.sheet.show { transform: translateY(0); }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid rgba(251, 241, 223, .15);
}
.sheet-head h2 { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; }
.sheet-close {
  width: 40px; height: 40px;
  border: 0; border-radius: 50%;
  background: rgba(251, 241, 223, .12);
  color: var(--cream);
  font-size: 1.6rem; line-height: 1;
  cursor: pointer;
}
.sheet-list { flex: 1; margin: 0; padding: 8px 20px; overflow-y: auto; list-style: none; }
.comment { display: flex; gap: 12px; padding: 12px 0; }
.avatar {
  flex: none;
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-weight: 600;
}
.c-head { font-size: .85rem; }
.c-head strong { font-weight: 600; }
.c-head span { margin-left: 6px; opacity: .6; font-size: .78rem; }
.c-text { margin-top: 2px; font-size: .95rem; line-height: 1.4; }
.empty { padding: 24px 0; text-align: center; opacity: .7; }
.sheet-form {
  display: flex; gap: 8px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(251, 241, 223, .15);
}
.sheet-form input {
  flex: 1; min-width: 0;
  padding: 11px 16px;
  border: 1px solid rgba(251, 241, 223, .3);
  border-radius: 999px;
  background: rgba(251, 241, 223, .08);
  color: var(--cream);
  font: 1rem var(--font-body);
}
.sheet-form input::placeholder { color: rgba(251, 241, 223, .55); }
.sheet-form button {
  padding: 0 20px;
  border: 0; border-radius: 999px;
  background: var(--orange);
  color: var(--brown-dark);
  font: 600 .9rem var(--font-body);
  cursor: pointer;
}
input:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
