/* =====================================================================
   STYLE.CSS — the boba cafe look. Change the values in :root to restyle
   the whole site (e.g. --accent for the main color, or the flavors).
   ===================================================================== */
:root {
  /* Cafe colors */
  --paper: #f8f0e4;         /* milk foam background */
  --paper-2: #efe0cb;       /* milk tea */
  --card: #fffaf2;
  --ink: #3d2a1f;           /* brown sugar syrup */
  --muted: #8b6e5a;
  --line: #e6d3bb;
  --accent: #9a5b34;        /* brown sugar — main highlight color */
  --accent-soft: #f1dfcb;

  /* Boba cup parts */
  --tea: #d9b48f;
  --foam: #f3e3cf;
  --lid: #f6ece0;
  --straw: #c98aa8;
  --pearl: #3a2519;

  /* Flavor colors used for tape, card tops, and accents */
  --flavor-0: #b79ad8;      /* taro */
  --flavor-1: #9fc18a;      /* matcha */
  --flavor-2: #f2a9b4;      /* strawberry */
  --flavor-3: #f5c66b;      /* mango */
  --flavor-4: #e9a26a;      /* thai tea */

  --display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Caveat", "Segoe Print", cursive;
  --maxw: 1080px;
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font: 16.5px/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
  background-color: var(--paper);
  /* faint tapioca pearls scattered in the background */
  background-image:
    radial-gradient(circle at 30% 30%, rgba(58,37,25,.07) 0 5px, transparent 6px),
    radial-gradient(circle at 30% 30%, rgba(58,37,25,.05) 0 3.5px, transparent 4.5px);
  background-size: 140px 140px, 90px 90px;
  background-position: 0 0, 45px 60px;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------- Password screen ---------------- */
.gate {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 16px;
  background:
    radial-gradient(700px 420px at 15% 10%, #fbe6ec 0%, transparent 60%),
    radial-gradient(700px 420px at 90% 90%, #ece2f7 0%, transparent 60%),
    var(--paper-2);
  transition: opacity .45s ease;
}
.gate-out { opacity: 0; pointer-events: none; }
.gate-card {
  width: 100%; max-width: 380px; text-align: center;
  background: var(--card); border: 2px solid var(--line); border-radius: 32px;
  padding: 30px 32px 26px;
  box-shadow: 0 24px 60px -24px rgba(90, 55, 30, .35);
}
.gate-cup { width: 110px; height: auto; margin: 0 auto 6px; display: block; }
.gate-cup .pearls { animation: bob 2.4s ease-in-out infinite; transform-origin: center; }
@keyframes bob { 50% { transform: translateY(-3px); } }
.gate-title { font: 600 1.9rem/1.2 var(--display); margin: 0 0 6px; }
.gate-sub { margin: 0 0 22px; color: var(--muted); }
.gate-card input {
  width: 100%; font: inherit; padding: 13px 18px; border-radius: 999px;
  border: 2px solid var(--line); background: #fff; color: var(--ink); outline: none; text-align: center;
}
.gate-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.gate-card button {
  width: 100%; margin-top: 12px; padding: 13px; border: 0; border-radius: 999px;
  font: 600 1.05rem var(--display); color: #fff; background: var(--accent); cursor: pointer;
  box-shadow: 0 4px 0 #6f3f22; transition: transform .1s, box-shadow .1s;
}
.gate-card button:active { transform: translateY(3px); box-shadow: 0 1px 0 #6f3f22; }
.gate-error { min-height: 1.4em; margin: 12px 0 0; color: #b5465a; font-size: .92rem; font-weight: 600; }
.shake { animation: shake .4s; }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }

/* ---------------- Header & tabs (the menu bar) ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 18px;
  padding: 12px max(16px, calc((100% - var(--maxw)) / 2));
  background: rgba(248, 240, 228, .92); backdrop-filter: blur(8px);
  border-bottom: 2px dashed var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font: 600 1.3rem var(--display); text-decoration: none; white-space: nowrap; }
.brand .cup { width: 34px; height: 34px; transition: transform .3s; }
.brand:hover .cup { transform: rotate(-10deg); }
.tabs { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.tabs a {
  text-decoration: none; font: 500 .95rem var(--display); color: var(--muted);
  padding: 7px 14px; border-radius: 999px; transition: background .2s, color .2s;
}
.tabs a:hover { color: var(--ink); background: var(--paper-2); }
.tabs a.active { color: #fff; background: var(--accent); }
.lock-btn, .menu-btn {
  border: 2px solid var(--line); background: var(--card); color: var(--muted);
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
}
.lock-btn:hover { color: var(--accent); border-color: var(--accent); }
.menu-btn { display: none; margin-left: auto; font-size: 1.1rem; }

/* ---------------- Layout ---------------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 16px 40px; }
.fade-in { animation: fade .45s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.eyebrow {
  display: inline-block; margin: 0 0 14px; padding: 4px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font: 600 .8rem var(--display); letter-spacing: .06em; text-transform: uppercase;
}
h1 { font: 600 clamp(2.4rem, 6vw, 3.8rem)/1.05 var(--display); margin: 0 0 16px; letter-spacing: -.01em; }
h2 { font: 600 1.6rem/1.2 var(--display); margin: 0 0 10px; }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 62ch; }
.lead p { margin: 0 0 10px; }

.hero, .page-head { padding: 56px 0 30px; }

/* Quick facts — styled like a cafe menu board */
.facts {
  margin: 30px auto 0; max-width: 560px; padding: 20px 26px;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px -18px rgba(90,55,30,.3);
}
.facts dl { margin: 0; }
.facts-title {
  display: flex; align-items: center; gap: 12px; margin: 0 0 8px;
  font: 600 1.5rem var(--display); color: var(--accent); text-align: center;
}
.facts-title::before, .facts-title::after {   /* little pearl rows on each side */
  content: ""; flex: 1; height: 10px;
  background: radial-gradient(circle, var(--pearl) 0 3.5px, transparent 4px) center / 14px 10px repeat-x;
  opacity: .35;
}
.facts div { display: flex; align-items: baseline; gap: 10px; padding: 5px 0; }
.facts div::after { content: ""; order: 2; flex: 1; border-bottom: 2px dotted var(--line); transform: translateY(-4px); }
.facts dt { order: 1; font: 500 1rem var(--display); color: var(--muted); }
.facts dd { order: 3; margin: 0; font-weight: 700; text-align: right; }

/* ---------------- Photos (polaroids with flavor tape) ---------------- */
.polaroid {
  position: relative; margin: 0; background: #fff; padding: 10px 10px 12px; border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 12px 26px -14px rgba(90,55,30,.45);
  transform: rotate(var(--tilt, 0deg)); transition: transform .25s ease, box-shadow .25s ease;
  cursor: zoom-in; break-inside: avoid;
}
.polaroid::before {        /* a strip of tape in a boba flavor color */
  content: ""; position: absolute; top: -9px; left: 50%; width: 70px; height: 20px;
  transform: translateX(-50%) rotate(-3deg);
  background: var(--tape, var(--flavor-0)); opacity: .8; border-radius: 3px;
}
.polaroid:hover, .polaroid:focus { transform: rotate(0) scale(1.02); box-shadow: 0 18px 36px -14px rgba(90,55,30,.55); outline: none; }
.polaroid img { width: 100%; height: auto; border-radius: 6px; background: var(--paper-2); }
.polaroid figcaption { font: 600 1.35rem/1.2 var(--hand); color: var(--ink); text-align: center; margin-top: 8px; }

/* ---------------- Photo layouts ----------------
   Photos sit in rows, and any leftover photos in the last row are
   centered so there are no lopsided gaps. */
.gallery, .photos {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 34px 28px; padding-top: 14px;
}
.polaroid { flex: 0 0 auto; }
/* Home collage and sections with lots of photos: 3 per row */
.gallery .polaroid, .blurb.wide .photos .polaroid { width: calc((100% - 56px) / 3); }
/* Sections with photos beside the text: 2 per row (1 photo = one big one) */
.photos .polaroid { width: calc((100% - 28px) / 2); }
.photos .polaroid:only-child { width: min(100%, 440px); }

/* Photos inside a blurb */

/* ---------------- Videos ---------------- */
.videos { display: grid; gap: 24px; }
.video-card {
  margin: 0; padding: 12px; background: var(--card); border: 2px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 12px 30px -18px rgba(90,55,30,.4);
}
.video-card video { display: block; width: 100%; max-height: 75vh; border-radius: 14px; background: #1d140f; }
.video-card figcaption { font: 600 1.4rem var(--hand); text-align: center; margin-top: 8px; }

/* ---------------- "On the menu" cards (home) ---------------- */
.chapters-wrap { padding-top: 30px; }
.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 14px; }
.chapter {
  text-decoration: none; display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  border-top: 8px solid var(--flavor, var(--accent));
  transition: transform .2s, box-shadow .2s;
}
.chapter:hover { transform: translateY(-4px); box-shadow: 0 14px 28px -16px rgba(90,55,30,.5); }
.chapter-cover { display: block; aspect-ratio: 1 / 1; background: var(--paper-2); overflow: hidden; }
.chapter-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.chapter:hover .chapter-cover img { transform: scale(1.06); }
.chapter-body { display: flex; flex-direction: column; gap: 0; padding: 10px 14px 14px; }
.chapter-num { font: 500 .8rem var(--display); color: var(--muted); letter-spacing: .05em; }
.chapter-tab { font-size: .75rem; color: var(--muted); }
.chapter-title { font: 600 1.2rem var(--display); }

/* ---------------- Blurbs (tab pages) ---------------- */
.blurb {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: 40px; align-items: center;
  padding: 40px 0 34px; position: relative;
}
.blurb::before {           /* a row of tapioca pearls between sections */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 10px;
  background: radial-gradient(circle, var(--pearl) 0 4px, transparent 4.5px) left center / 26px 10px repeat-x;
  opacity: .25;
}
.blurb.flip .blurb-text { order: 2; }
.blurb-text p { margin: 0 0 12px; max-width: 60ch; }
.blurb:not(:has(.photos)):not(:has(.videos)) { grid-template-columns: 1fr; }
/* Blurbs with lots of photos (or a video): text on top, full width below */
.blurb.wide { grid-template-columns: 1fr; gap: 20px; }
/* Tabs with bigPhotos: true — two large photos per row */
.blurb.big .photos .polaroid { width: calc((100% - 34px) / 2); padding: 12px 12px 14px; }
.blurb.big .photos { column-gap: 34px; }
.blurb.big .polaroid figcaption { font-size: 1.55rem; }

.pager { display: flex; justify-content: space-between; padding-top: 26px; border-top: 2px dashed var(--line); }
.pager a {
  text-decoration: none; font: 600 1rem var(--display); color: var(--accent);
  padding: 8px 16px; border-radius: 999px; background: var(--accent-soft);
}
.pager a:hover { background: var(--accent); color: #fff; }

.site-footer { text-align: center; color: var(--muted); font-size: .9rem; padding: 26px 16px 40px; }
.pearl-row {
  width: 120px; height: 12px; margin: 0 auto 12px;
  background: radial-gradient(circle, var(--pearl) 0 5px, transparent 5.5px) left center / 20px 12px repeat-x;
  opacity: .7;
}

/* ---------------- Lightbox ---------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: rgba(40, 26, 18, .9);
  display: grid; place-items: center; padding: 24px; cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; text-align: center; }
.lightbox img { max-width: 92vw; max-height: 80vh; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox figcaption { color: var(--paper); font: 600 1.7rem var(--hand); margin-top: 12px; }
.lightbox-close { position: absolute; top: 14px; right: 20px; background: none; border: 0; color: #fff; font-size: 2.4rem; cursor: pointer; }

/* ---------------- Phones & small screens ---------------- */
@media (max-width: 860px) {
  .menu-btn { display: grid; }
  .tabs {
    display: none; position: absolute; top: 100%; left: 0; right: 0; margin: 0;
    flex-direction: column; background: var(--paper); border-bottom: 2px dashed var(--line); padding: 8px 16px 14px;
  }
  .tabs.open { display: flex; }
}
@media (max-width: 760px) {
  .blurb { grid-template-columns: 1fr; gap: 22px; }
  .blurb.flip .blurb-text { order: 0; }
  .hero, .page-head { padding: 36px 0 22px; }
  .chapters { grid-template-columns: repeat(2, 1fr); }
}

/* A section can set perRow: N in content.js to choose photos per row */
.blurb .photos.per-row .polaroid { width: calc((100% - (var(--per-row) - 1) * 28px) / var(--per-row)); }

/* Photo rows on smaller screens */
@media (max-width: 760px) {
  .gallery .polaroid, .blurb.wide .photos .polaroid, .blurb.big .photos .polaroid,
  .blurb .photos.per-row .polaroid { width: calc((100% - 28px) / 2); }
  .blurb.big .photos { column-gap: 28px; }
}
@media (max-width: 520px) {
  .gallery .polaroid, .photos .polaroid, .blurb.wide .photos .polaroid, .blurb.big .photos .polaroid,
  .blurb .photos.per-row .polaroid { width: 100%; }
}
