/* cheesecake. ngon — public grid
   Coral brand palette from the logo. Lora headings, Be Vietnam Pro body. */

@import url('/fonts.css');

:root {
  --paper:     #FDF8F6;
  --paper-2:   #F5E4E1;
  --card-back: #FCF1EF;
  --ink:       #2A1E1E;
  --ink-2:     #7C6A69;
  --line:      #F0DCD8;
  --brand:     #F26F7C;  /* sampled from the logo artwork — fills and marks */
  --brand-tint:#FDECEE;
  --accent:    #C93E53;  /* 4.6:1 on paper; the logo coral itself is only 2.7:1 */

  --radius: 14px;
  --shadow: 0 1px 2px rgba(80,35,35,.05), 0 10px 26px -14px rgba(80,35,35,.28);

  --font-head: 'Lora', ui-serif, Georgia, 'Times New Roman', serif;
  --font-body: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --flip:  560ms cubic-bezier(.2,.72,.16,1);
  --slide: 420ms cubic-bezier(.2,.72,.16,1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:     #17100F;
    --paper-2:   #2C1E1D;
    --card-back: #241918;
    --ink:       #F7EDEA;
    --ink-2:     #A89694;
    --line:      #3A2725;
    --brand:     #F26F7C;
    --brand-tint:#33201F;
    --accent:    #F58A93;
    --shadow: 0 1px 2px rgba(0,0,0,.45), 0 10px 26px -14px rgba(0,0,0,.75);
  }
}

*, *::before, *::after { box-sizing: border-box; }

/* Author `display` rules outrank the UA's [hidden]{display:none} — .guide is a
   flex row and would otherwise never hide. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Keep flicks inside the page — no rubber-band chaining to the browser chrome. */
  overscroll-behavior-y: contain;
}

/* ---------- masthead ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: env(safe-area-inset-top) 0 0;
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .35s ease;
}
.masthead.stuck { border-bottom-color: var(--line); }

.masthead-in {
  max-width: 1180px;
  margin: 0 auto;
  padding: 15px 16px 13px;
  text-align: center;
}

.wordmark {
  display: inline-block;
  line-height: 0;
  text-decoration: none;
}
.wordmark img {
  width: auto;
  height: 34px;
  display: block;
}

.tagline {
  margin: 7px 0 0;
  font-size: 12px;
  letter-spacing: .01em;
  color: var(--ink-2);
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

@media (min-width: 640px) {
  .masthead-in { padding: 22px 20px 18px; }
  .wordmark img { height: 46px; }
  .tagline { font-size: 13.5px; margin-top: 9px; }
}

/* ---------- grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 12px 24px;
}

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 22px 20px 32px; }
}
@media (min-width: 1000px) {
  .grid { grid-template-columns: repeat(4, 1fr); gap: 18px; }
}

.skel {
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--paper-2) 30%, color-mix(in srgb, var(--paper-2) 55%, var(--paper)) 50%, var(--paper-2) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
}
@keyframes shimmer { to { background-position: -220% 0; } }

/* ---------- card ---------- */

.card {
  position: relative;
  aspect-ratio: 4 / 5;
  /* cqw units below let the card's type scale with column count */
  container-type: inline-size;

  /* scroll reveal */
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .65s ease, transform .65s cubic-bezier(.2,.7,.2,1);
}
.card.in { opacity: 1; transform: none; }

/* perspective lives here so the press-scale doesn't break the 3D context */
.card-press {
  position: absolute;
  inset: 0;
  perspective: 1400px;
  transition: transform 200ms ease;
}
.card:active .card-press { transform: scale(.978); }

.card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform var(--flip);
}
.card.flipped .card-inner { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.face-back { transform: rotateY(180deg); }

.face:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.face-back:focus-visible { outline-offset: -3px; }

/* front ------------------------------------------------ */

.face-front {
  box-shadow: var(--shadow);
  /* --lqip is set per-card from the DB; shows instantly under the real photo */
  background: var(--paper-2) var(--lqip, none) center / cover no-repeat;
}

.face-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity .5s ease;
}
.face-front img.loaded { opacity: 1; }

/* the whole photo is the flip target */
.hit {
  position: absolute;
  inset: 0;
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
}
.hit:focus-visible { outline: 2px solid var(--brand); outline-offset: -3px; border-radius: var(--radius); }

.zoom-btn {
  position: absolute;
  right: 3.4cqw;
  bottom: 3.4cqw;
  z-index: 2;
  width: clamp(26px, 11cqw, 34px);
  height: clamp(26px, 11cqw, 34px);
  display: grid;
  place-items: center;
  appearance: none;
  border: 0;
  border-radius: 50%;
  background: rgba(20,10,10,.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: clamp(12px, 5cqw, 15px);
  line-height: 1;
  cursor: pointer;
  opacity: .92;
  transition: background .2s ease, transform .2s ease;
}
.zoom-btn:hover { background: rgba(20,10,10,.66); transform: scale(1.08); }
.zoom-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* desktop-only: a slow push-in on hover */
@media (hover: hover) and (pointer: fine) {
  .face-front img { transition: opacity .5s ease, transform .75s cubic-bezier(.2,.7,.2,1); }
  .card:not(.flipped):hover .face-front img.loaded { transform: scale(1.07); }
}

.scrim {
  position: absolute;
  inset: auto 0 0 0;
  height: 38%;
  background: linear-gradient(to top, rgba(0,0,0,.36), rgba(0,0,0,0));
  pointer-events: none;
}

.badge {
  position: absolute;
  left: 4cqw;
  bottom: 3.4cqw;
  font-family: var(--font-head);
  font-size: clamp(11px, 4.6cqw, 15px);
  letter-spacing: .04em;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0,0,0,.55);
  pointer-events: none;
}

/* back ------------------------------------------------- */

.face-back {
  background: var(--card-back);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.rail {
  display: flex;
  width: 300%;
  height: 100%;
  transition: transform var(--slide);
}
.card.showsizes .rail { transform: translateX(-33.3333%); }
.card.showdesc  .rail { transform: translateX(-66.6667%); }

.pane {
  width: 33.3333%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: clamp(11px, 6.2cqw, 20px);
  gap: 0;
}
.pane-fill { flex: 1 1 auto; min-height: 4px; }

.no {
  margin: 0;
  font-family: var(--font-head);
  font-size: clamp(10px, 4.4cqw, 14px);
  letter-spacing: .06em;
  color: var(--ink-2);
}

.flavour {
  margin: 2px 0 0;
  font-family: var(--font-head);
  font-size: clamp(13px, 7cqw, 20px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.005em;
  /* long flavour names must not push the price off the card */
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.note {
  margin: clamp(3px, 1.6cqw, 6px) 0 0;
  font-size: clamp(11px, 4.1cqw, 13px);
  line-height: 1.35;
  color: var(--ink-2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.size-line {
  margin: 0;
  font-size: clamp(11px, 4.1cqw, 13px);
  color: var(--ink-2);
}

.price {
  margin: 1px 0 clamp(5px, 2.4cqw, 9px);
  font-size: clamp(15px, 8.2cqw, 24px);
  font-weight: 600;
  letter-spacing: -.015em;
  font-variant-numeric: tabular-nums;
}

.link-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: clamp(11px, 4cqw, 13px);
  line-height: 1.3;
  text-align: left;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.pane-links {
  display: flex;
  flex-wrap: wrap;
  gap: 2px clamp(8px, 4cqw, 14px);
}

/* description pane: scrolls inside the card rather than shrinking the type */
.desc-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: clamp(4px, 2cqw, 8px) 0 clamp(5px, 2.4cqw, 9px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 6px, #000 calc(100% - 10px), transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 6px, #000 calc(100% - 10px), transparent 100%);
}
.desc-text {
  margin: 0;
  font-size: clamp(12px, 4.05cqw, 13.5px);
  line-height: 1.55;
  color: var(--ink-2);
}

/* sizes pane ------------------------------------------- */

.sizes {
  list-style: none;
  margin: clamp(6px, 3cqw, 12px) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Two lines per row: label + price on top, serves beneath. Keeps the
   đồng sign off the padding edge and never overflows at 2-column widths. */
.sizes li {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: clamp(6px, 3cqw, 12px);
  padding: clamp(5px, 2.4cqw, 9px) 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  font-size: clamp(11.5px, 4.4cqw, 14px);
}
.sizes li:last-child { border-bottom: 0; }
.sizes li.is-default { color: var(--accent); }

.sizes .lbl {
  grid-area: 1 / 1;
  font-weight: 600;
}
.sizes .amt {
  grid-area: 1 / 2;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding-right: .06em; /* the ₫ glyph paints slightly past its advance width */
}
.sizes .serves {
  grid-area: 2 / 1 / 2 / -1;
  margin-top: 1px;
  font-size: .82em;
  line-height: 1.3;
  color: var(--ink-2);
}
.sizes li.is-default .serves { color: inherit; opacity: .72; }
.sizes .serves:empty { display: none; }

/* ---------- states + footer ---------- */

.state {
  max-width: 1180px;
  margin: 40px auto;
  padding: 0 20px;
  text-align: center;
  color: var(--ink-2);
  font-size: 14px;
}

/* ---------- the promise ---------- */

.about {
  max-width: 620px;
  margin: 10px auto 0;
  padding: 34px 24px 6px;
  text-align: center;
  border-top: 1px solid var(--line);
}

.about h2 {
  margin: 0;
  font-family: var(--font-head);
  font-size: clamp(21px, 5.6vw, 29px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.01em;
}

.about p {
  margin: 12px auto 0;
  max-width: 46ch;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-2);
}
.about strong { color: var(--ink); font-weight: 600; }

.about .no-fake {
  margin-top: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--accent);
}

.creds {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.creds li {
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .about { padding-top: 48px; }
  .about p { font-size: 15.5px; }
  .creds li { font-size: 13.5px; padding: 8px 16px; }
}

.footer {
  padding: 26px 20px calc(34px + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--ink-2);
}
.footer-hint { margin: 0; font-size: 12.5px; }
.footer img {
  width: 40px;
  height: 40px;
  margin: 16px auto 0;
  display: block;
  opacity: .85;
}

/* ---------- first-visit guide ---------- */

.guide {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 40;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 15px;
  border-radius: 999px;
  background: rgba(28,14,14,.62);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  color: rgba(255,255,255,.94);
  font-size: 12.5px;
  white-space: nowrap;
  /* never intercept a tap — it is a hint, not a control */
  pointer-events: none;
  opacity: 0;
  animation: guide-in .5s .7s ease forwards;
}
.guide b { font-weight: 600; }
.guide-sep { width: 1px; height: 13px; background: rgba(255,255,255,.28); }
.guide.out { animation: guide-out .45s ease forwards; }

@keyframes guide-in  { from { opacity: 0; transform: translate(-50%, 10px); }
                       to   { opacity: 1; transform: translate(-50%, 0); } }
@keyframes guide-out { to   { opacity: 0; transform: translate(-50%, 8px); } }

@media (max-width: 380px) { .guide { font-size: 11.5px; padding: 8px 13px; gap: 8px; } }

/* ---------- photo viewer ---------- */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(16,8,8,.94);
  /* Not `forwards` — a filled animation outranks inline styles, and the
     drag-to-dismiss fade sets opacity inline. */
  opacity: 1;
  animation: viewer-in .26s ease;
  /* the stage handles gestures itself; never let the page scroll behind it */
  touch-action: none;
  overscroll-behavior: contain;
}
.viewer.closing { animation: viewer-out .2s ease forwards; }
@keyframes viewer-in  { from { opacity: 0; } }
@keyframes viewer-out { to { opacity: 0; } }

.viewer-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: zoom-in;
  touch-action: none;
}
.viewer-stage.zoomed { cursor: grab; }
.viewer-stage.panning { cursor: grabbing; }

#viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}
/* only animate when snapping back, never mid-gesture */
#viewer-img.settle { transition: transform .28s cubic-bezier(.2,.7,.2,1); }

.viewer-close {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: 12px;
  z-index: 2;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  appearance: none; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff; font-size: 16px; cursor: pointer;
}
.viewer-close:hover { background: rgba(255,255,255,.24); }
.viewer-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.viewer-bar {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 20px;
  color: rgba(255,255,255,.9);
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}
.viewer-tip { font-size: 11.5px; color: rgba(255,255,255,.5); }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .card { opacity: 1; transform: none; }
}
