/* ───────────────────────────────────────────────────────────────
   Home Cafe chalkboard
   The screen is the board: slate with eraser smudges, a wooden
   frame, and chalk lettering. Out-of-stock items look half-erased.
   ─────────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Fredericka the Great';
  src: url('fonts/fredericka-the-great.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Patrick Hand';
  src: url('fonts/patrick-hand.woff2') format('woff2');
  font-display: swap;
}

:root {
  /* Board & chalk */
  --board: #2a3530;
  --board-deep: #222c28;
  --chalk: #ece8de;
  --chalk-dust: #b5bcb4;
  --chalk-yellow: #f3d98a;
  --chalk-pink: #f2b4b4;
  --chalk-blue: #a8d2dc;
  --chalk-green: #bddca6;

  /* Frame */
  --wood: #6c4a2f;
  --wood-light: #87603e;
  --wood-dark: #4a3221;
  --frame: clamp(8px, 1.2vw + 4px, 20px);

  /* Type */
  --display: 'Fredericka the Great', 'Chalkboard SE', 'Chalkboard', Georgia, serif;
  --hand: 'Patrick Hand', 'Chalkboard SE', 'Chalkboard', 'Segoe Print', system-ui, sans-serif;

  /* Chalk grain: a speckled mask that lets a little board show through strokes */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -3.2 0 0 0 2.45'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");

  /* Fine chalk dust across the whole board */
  --dust: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='d' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 .34 0 0 0 -.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23d)'/%3E%3C/svg%3E");

  /* Hand-drawn underline for section titles */
  --squiggle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'%3E%3Cpath d='M3 7c19-5 33 3 51-1s31-4 48 0 34 3 51-1 29-3 44 1' fill='none' stroke='%23000' stroke-width='3.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

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

html {
  background-color: var(--board);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--chalk);
  font-family: var(--hand);
  font-size: 1.125rem;
  line-height: 1.35;
  background-color: var(--board);
  background-image:
    var(--dust),
    radial-gradient(60% 38% at 18% 12%, rgba(236, 232, 222, 0.07), transparent 70%),
    radial-gradient(45% 30% at 86% 34%, rgba(236, 232, 222, 0.05), transparent 70%),
    radial-gradient(55% 32% at 30% 72%, rgba(236, 232, 222, 0.045), transparent 70%),
    radial-gradient(40% 26% at 78% 92%, rgba(236, 232, 222, 0.05), transparent 70%),
    radial-gradient(120% 90% at 50% 40%, var(--board) 40%, var(--board-deep) 100%);
  background-attachment: scroll, fixed, fixed, fixed, fixed, fixed;
  background-size: 240px 240px, auto, auto, auto, auto, auto;
}

/* Shadow where the board meets the frame */
body::before {
  content: '';
  position: fixed;
  inset: var(--frame);
  pointer-events: none;
  z-index: 9;
  box-shadow:
    inset 0 2px 3px rgba(0, 0, 0, 0.45),
    inset 0 0 28px rgba(0, 0, 0, 0.35);
}

/* Wooden frame, fixed to the screen edges */
.frame {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  border: var(--frame) solid transparent;
  background:
    repeating-linear-gradient(91deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(89deg, rgba(0, 0, 0, 0.1) 0 1px, transparent 1px 13px),
    linear-gradient(180deg, var(--wood-light), var(--wood) 35%, var(--wood-dark)) border-box;
  -webkit-mask: linear-gradient(#000 0 0) border-box, linear-gradient(#000 0 0) padding-box;
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) border-box exclude, linear-gradient(#000 0 0) padding-box;
}

/* ── Layout ─────────────────────────────────────────────────── */

.board {
  max-width: 62rem;
  margin: 0 auto;
  padding:
    calc(var(--frame) + max(2rem, env(safe-area-inset-top)))
    calc(var(--frame) + max(1.35rem, env(safe-area-inset-right)))
    calc(var(--frame) + max(2.5rem, env(safe-area-inset-bottom)))
    calc(var(--frame) + max(1.35rem, env(safe-area-inset-left)));
  text-shadow: 0 0 0.6px rgba(236, 232, 222, 0.45);
}

.chalk-grain {
  -webkit-mask-image: var(--grain);
  mask-image: var(--grain);
  -webkit-mask-size: 180px 180px;
  mask-size: 180px 180px;
}

/* ── Masthead ───────────────────────────────────────────────── */

.masthead {
  text-align: center;
  margin-bottom: clamp(2.25rem, 6vw, 3.5rem);
}

.cup {
  display: block;
  width: clamp(4.25rem, 17vw, 6.25rem);
  height: auto;
  margin: 0 auto 0.4rem;
  color: var(--chalk);
  overflow: visible;
}

.cafe-name {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3.1rem, 14vw, 6rem);
  line-height: 1;
  letter-spacing: 0.01em;
  text-shadow:
    0 0 1px rgba(236, 232, 222, 0.6),
    0 0 14px rgba(236, 232, 222, 0.14);
}

.tagline {
  margin: 0.6rem 0 0;
  color: var(--chalk-dust);
  font-size: clamp(1.2rem, 4vw, 1.45rem);
}

/* ── Menu ───────────────────────────────────────────────────── */

.menu {
  margin: 0;
}

@media (min-width: 52rem) {
  .menu {
    columns: 2;
    column-gap: 5rem;
    column-rule: 1.5px solid rgba(236, 232, 222, 0.1);
  }
}

.menu-section {
  --ink: var(--chalk-yellow);
  break-inside: avoid;
  padding-bottom: 2.75rem;
}
.menu-section:nth-of-type(4n + 2) { --ink: var(--chalk-pink); }
.menu-section:nth-of-type(4n + 3) { --ink: var(--chalk-blue); }
.menu-section:nth-of-type(4n + 4) { --ink: var(--chalk-green); }

.section-title {
  margin: 0 0 1.15rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 7vw, 2.4rem);
  line-height: 1.05;
  color: var(--ink);
  text-shadow: 0 0 1px currentColor;
}
.section-title::after {
  content: '';
  display: block;
  width: min(8.5rem, 60%);
  height: 0.55rem;
  margin-top: 0.3rem;
  background: currentColor;
  -webkit-mask: var(--squiggle) no-repeat 0 50% / 100% 100%;
  mask: var(--squiggle) no-repeat 0 50% / 100% 100%;
  opacity: 0.85;
}

.section-options {
  margin: -0.2rem 0 1.5rem;
  padding: 0.15rem 0 0.2rem 0.9rem;
  border-left: 2px solid color-mix(in srgb, var(--ink) 55%, transparent);
}

.section-options-intro {
  margin: 0;
  color: var(--chalk-dust);
  font-size: 1.05rem;
}

.section-options .options {
  margin-top: 0.2rem;
}

.drinks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.4rem;
}

.drink-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.drink-name {
  margin: 0;
  font-family: var(--hand);
  font-weight: 400;
  font-size: 1.65rem;
  line-height: 1.1;
}

.temps {
  flex: none;
  color: var(--chalk-dust);
  font-size: 1.1rem;
}

.drink-desc {
  margin: 0.2rem 0 0;
  max-width: 34em;
  color: var(--chalk-dust);
  font-size: 1.15rem;
  line-height: 1.3;
}

.options {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.1rem 0.85rem;
  margin: 0.45rem 0 0;
  font-size: 1.12rem;
}

.options dt {
  color: var(--ink);
}

.options dd {
  margin: 0;
}

.choices {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.4em;
}

.choice:not(:last-child)::after {
  content: ',';
}

/* ── Out today: half-erased chalk, words unchanged ──────────── */

.drink[data-out],
.choice[data-out] {
  opacity: 0.3;
  filter: blur(0.35px);
}

/* ── Footer, notices, states ────────────────────────────────── */

.legend {
  margin-top: 0.5rem;
  text-align: center;
  color: var(--chalk-dust);
  font-size: 1.1rem;
}

.loading {
  text-align: center;
  color: var(--chalk-dust);
}

.notice {
  column-span: all;
  margin: 0 0 2.5rem;
  padding: 1rem 1.25rem;
  border: 2px dashed var(--chalk-pink);
  border-radius: 6px;
  color: var(--chalk);
}
.notice p { margin: 0; }
.notice ul { margin: 0.5rem 0 0; padding-left: 1.2rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── The one moment of motion: the cup is drawn in chalk ────── */

@media (prefers-reduced-motion: no-preference) {
  .cup .stroke {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: draw 0.7s ease-out forwards;
  }
  .cup .stroke:nth-child(4) { animation-delay: 0.1s; }
  .cup .stroke:nth-child(5) { animation-delay: 0.45s; }
  .cup .stroke:nth-child(6) { animation-delay: 0.75s; }
  .cup .stroke:nth-child(7) { animation-delay: 0.95s; animation-duration: 0.9s; }
  .cup .stroke:nth-child(1) { animation-delay: 1.35s; }
  .cup .stroke:nth-child(2) { animation-delay: 1.5s; }
  .cup .stroke:nth-child(3) { animation-delay: 1.65s; }
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

/* ── Print: dark chalk on paper, no board ───────────────────── */

@media print {
  html, body { background: #fff; color: #222; }
  body::before, .frame, .cup { display: none; }
  .board { text-shadow: none; padding: 0; }
  .chalk-grain { -webkit-mask-image: none; mask-image: none; }
  .tagline, .drink-desc, .temps, .legend { color: #555; }
  .menu-section { --ink: #222; }
  .drink[data-out], .choice[data-out] { filter: none; opacity: 0.4; }
}
