/* ==========================================================================
   Coco's, Dereham (outreach demo)
   One lead effect: a steaming cup of coffee in the hero, in real 3D where the
   device allows (cup3d.js), an animated SVG everywhere else.
   Everything else supports it: a printed menu with depth, reviews pinned up
   like notes, a live "open now".
   Espresso, white and one egg-yolk yellow. Mobile-first. Light + dark.
   No framework, no build step. WCAG 2.2 AA.
   ========================================================================== */

/* --- Font: Fraunces 900, self-hosted (SIL OFL 1.1, assets/fonts/OFL.txt) --- */
/* Warm and slightly odd, like the café. Wordmark and headings only. */

@font-face {
  font-family: "Fraunces";
  src: url("assets/fonts/fraunces-latin-900-normal.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* --- Tokens --------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  --paper:      #ffffff;
  --paper-alt:  #fff6d6;   /* pale yolk, for the booking section */
  --band:       #24150e;   /* espresso band for reviews */
  --band-ink:   #ffffff;   /* 17.7:1 on --band */
  --band-muted: #d9c9bd;   /* 11.0:1 on --band */
  --ink:        #24150e;   /* 17.7:1 on --paper, 16.3:1 on --paper-alt */
  --ink-muted:  #5f4c42;   /* 8.1:1 on --paper, 7.5:1 on --paper-alt */
  --line:       #eadfd6;   /* decorative rules only */
  --line-ui:    #5f4c42;   /* field borders, 8.1:1 */
  --yolk:       #f5b301;   /* fills only; espresso text on it is 9.5:1 */
  --yolk-ink:   #24150e;
  --focus:      #1d4ed8;   /* 6.7:1 on --paper */
  --steam:      #8f7a6c;   /* decorative */
  --shadow:     36 21 14;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", "Noto Serif", serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;

  --step--1: clamp(0.88rem, 0.85rem + 0.15vw, 0.95rem);
  --step-0:  clamp(1.02rem, 0.98rem + 0.2vw, 1.12rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2:  clamp(1.6rem, 1.3rem + 1.4vw, 2.4rem);
  --section-y: clamp(3.5rem, 9vw, 7rem);
  --wrap: 70rem;
  --header-h: 4rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Re-picked, not inverted: an espresso room with the same yolk. */
    --paper:      #1c120d;
    --paper-alt:  #2a1d15;
    --band:       #120b08;
    --band-ink:   #f6f1ec;
    --band-muted: #cbbcb1;
    --ink:        #f6f1ec;   /* 16.4:1, 14.6:1 on --paper-alt */
    --ink-muted:  #cbbcb1;   /* 10.0:1, 8.8:1 on --paper-alt */
    --line:       #3a2a20;
    --line-ui:    #cbbcb1;
    --yolk-ink:   #1c120d;   /* 9.9:1 on --yolk */
    --focus:      #93b4ff;   /* 8.9:1 */
    --steam:      #e9ddd3;
    --shadow:     0 0 0;
  }
}

/* --- Base ----------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  padding-bottom: 4.5rem;   /* room for the phone call bar */
}
@media (min-width: 48rem) { body { padding-bottom: 0; } }

h1, h2, h3 { font-family: var(--font-display); font-weight: 900; line-height: 1.1; }
a { color: inherit; text-underline-offset: 0.18em; }
img, svg { display: block; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.small { font-size: var(--step--1); color: var(--ink-muted); }

/* --- Demo banner and header ------------------------------------------------ */

.demo-banner {
  background: var(--band);
  color: var(--band-ink);
  text-align: center;
  font-size: var(--step--1);
  font-weight: 600;
  padding: 0.55rem 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.45rem;
  text-decoration: none;
}
.nav-list { display: none; list-style: none; padding: 0; gap: 1.5rem; }
.nav-list a { text-decoration: none; color: var(--ink-muted); }
.nav-list a:hover { color: var(--ink); text-decoration: underline; }
@media (min-width: 52rem) { .nav-list { display: flex; } }
.header-call {
  font-weight: 700;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* --- Buttons --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: var(--step-0);
  text-decoration: none;
  border: 2px solid var(--ink);
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--yolk); color: var(--yolk-ink); }
.btn-ghost { background: transparent; color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .btn, .header-call { transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease; }
  .btn:hover, .header-call:hover { transform: translateY(-2px); box-shadow: 0 4px 0 var(--ink); }
  .btn:active, .header-call:active { transform: translateY(1px); box-shadow: 0 0 0 var(--ink); }
}
.btn-ghost:hover { background: rgb(var(--shadow) / 0.06); }

/* --- Hero ------------------------------------------------------------------ */
/* Phones: words on top, the cup in its own stage below the buttons, so the
   steam never sits on the call link. Wide screens: words left, cup right. */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(2rem, 6vw, 4rem) clamp(16rem, 76vw, 26rem);
}
@media (min-width: 48rem) and (min-aspect-ratio: 6/5) {
  .hero {
    min-height: clamp(32rem, 78vh, 46rem);
    display: flex;
    align-items: center;
    padding-block: 3rem 5rem;
  }
}

.hero-inner { position: relative; }
@media (min-width: 48rem) and (min-aspect-ratio: 6/5) {
  .hero-inner > * { max-width: 34rem; }
}

.wordmark {
  display: block;
  font-size: clamp(4.4rem, 2rem + 13vw, 9.5rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 0.9;
}
.hero-sub {
  display: block;
  margin-top: 0.6rem;
  font-family: var(--font-sans);
  font-size: var(--step-1);
  font-weight: 600;
}
.hero-lede { margin-top: 1rem; max-width: 30ch; font-size: var(--step-1); color: var(--ink-muted); line-height: 1.45; }

.open-now {
  margin-top: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
}
.open-now::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--ink-muted);
  flex: none;
}
.open-now.is-open::before { background: #2e9e4f; box-shadow: 0 0 0 4px rgb(46 158 79 / 0.2); }
.open-now.is-closed::before { background: #b42318; }
.open-now-big { font-size: var(--step-1); margin-block: 0.25rem 1rem; }

.hero-actions { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero-call { margin-top: 1rem; color: var(--ink-muted); }
.hero-call a { color: var(--ink); font-weight: 700; }

/* The poster cup: same stage as the 3D. */
.cup-poster {
  position: absolute;
  z-index: -1;
  left: 50%;
  bottom: 0.5rem;
  width: min(68%, 19rem);   /* shorter than the stage, so the steam never reaches the call link */
  height: auto;
  transform: translateX(-50%);
}
@media (min-width: 48rem) and (min-aspect-ratio: 6/5) {
  .cup-poster {
    left: auto;
    right: max(1rem, (100% - var(--wrap)) / 2);
    bottom: 50%;
    width: min(44%, 30rem);
    transform: translateY(50%);
  }
}
.cup-poster { aspect-ratio: 1; }
.cup-art { width: 100%; height: 100%; }
.cup-poster .cup { fill: var(--yolk); stroke: var(--ink); stroke-width: 4; }
.cup-poster .handle { stroke: var(--ink); stroke-width: 14; stroke-linecap: round; }
.cup-poster .saucer { fill: var(--paper); stroke: var(--ink); stroke-width: 4; }
.cup-poster .coffee { fill: #8a5a3b; stroke: var(--ink); stroke-width: 4; }
.wisp {
  position: absolute;
  top: 0;
  width: 15%;
  height: 37.5%;
  overflow: visible;
  opacity: 0.55;
}
.wisp-1 { left: 35%; }
.wisp-2 { left: 44%; }
.wisp-3 { left: 53%; }
.wisp path { fill: none; stroke: var(--steam); stroke-width: 7; stroke-linecap: round; }
@media (prefers-reduced-motion: no-preference) {
  .hero.motion-on .wisp { animation: rise 3.2s ease-in-out infinite; }
  .hero.motion-on .wisp-2 { animation-delay: -1.1s; }
  .hero.motion-on .wisp-3 { animation-delay: -2.2s; }
  .hero.is-paused .wisp,
  .hero.is-offscreen .wisp { animation-play-state: paused; }
  .hero.is-3d .wisp { animation: none; }   /* the 3D has taken over */
}
@keyframes rise {
  from { transform: translateY(18%) scaleY(0.85); opacity: 0; }
  30%  { opacity: 0.6; }
  to   { transform: translateY(-22%) scaleY(1.05); opacity: 0; }
}

/* The 3D cup fades in over the poster once it's drawn. */
.hero-3d {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 700ms ease;
  pointer-events: none;
}
.hero.is-3d .hero-3d { opacity: 1; }
/* Phones: the canvas covers only the stage under the buttons, so each frame
   draws about a third of the pixels. */
@media not all and (min-width: 48rem) and (min-aspect-ratio: 6/5) {
  .hero-3d { inset: auto 0 0 0; height: clamp(16rem, 76vw, 26rem); }
}
.hero.is-3d .cup-poster { opacity: 0; visibility: hidden; transition: opacity 500ms ease, visibility 0s 500ms; }

.motion-toggle {
  margin-top: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.5rem 0.9rem;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  font: 600 var(--step--1) var(--font-sans);
  cursor: pointer;
}
/* Until the script shows it, the button keeps its space (no layout shift);
   with reduced motion it's removed outright, below. */
.motion-toggle[hidden] { visibility: hidden; }
/* Wide screens: bottom-right corner of the hero, clear of the cup. */
@media (min-width: 48rem) and (min-aspect-ratio: 6/5) {
  .hero-inner { position: static; }
  .motion-toggle { position: absolute; right: max(1rem, (100% - var(--wrap)) / 2); bottom: 1rem; margin: 0; }
}
.motion-toggle svg { fill: currentColor; }
.motion-toggle .icon-play { display: none; }
.hero.is-paused .motion-toggle .icon-play { display: inline; }
.hero.is-paused .motion-toggle .icon-pause { display: none; }

/* --- Sections ------------------------------------------------------------- */

.section { padding-block: var(--section-y); }
.section-alt { background: var(--paper-alt); }
.section h2 { font-size: var(--step-2); margin-bottom: 1rem; }
.two-col { display: grid; gap: 2.5rem; }
@media (min-width: 52rem) { .two-col { grid-template-columns: 1fr 1fr; gap: 4rem; } }

/* --- Menu: a printed sheet with real depth (Tier 1) ------------------------ */

.example-note {
  display: inline-block;
  margin-bottom: 1.5rem;
  padding: 0.35rem 0.75rem;
  border: 2px dashed var(--ink-muted);
  border-radius: 6px;
  font-size: var(--step--1);
}

/* Wide screens: heading on the left, the sheet filling the rest. */
@media (min-width: 64rem) {
  .menu-layout { display: grid; grid-template-columns: 16rem 1fr; gap: 3rem; align-items: start; }
  .menu-head { position: sticky; top: calc(var(--header-h) + 2rem); }
}

.menu-sheet {
  max-width: 52rem;
  padding: clamp(1.25rem, 5vw, 3rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 6px solid var(--yolk);
  border-radius: 4px;
  display: grid;
  gap: 1.75rem;
}
@media (min-width: 48rem) { .menu-sheet { grid-template-columns: 1fr 1fr; column-gap: 3rem; } }
.menu-group h3 {
  font-size: var(--step-1);
  padding-bottom: 0.4rem;
  margin-bottom: 0.6rem;
  border-bottom: 2px solid var(--ink);
}
.menu-group ul { list-style: none; padding: 0; display: grid; gap: 0.6rem; }
.menu-group li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.price { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-muted); font-style: italic; }
.menu-aside { margin-top: 0.6rem; font-size: var(--step--1); color: var(--ink-muted); }
.menu-foot { grid-column: 1 / -1; font-weight: 600; }

.card-3d {
  box-shadow:
    0 1px 2px rgb(var(--shadow) / 0.08),
    0 22px 44px -22px rgb(var(--shadow) / 0.35);
}
@media (prefers-reduced-motion: no-preference) {
  .card-3d {
    transform: perspective(80rem) rotateX(var(--rx, 2deg)) rotateY(var(--ry, -2deg)) translateY(var(--lift, 0px));
    transition: transform 220ms ease-out, box-shadow 220ms ease-out;
  }
  .card-3d:hover, .card-3d:active { --lift: -6px; }
}

/* --- Reviews: notes pinned up on an espresso band -------------------------- */

.section-band { background: var(--band); color: var(--band-ink); }
.notes { display: grid; gap: 1.5rem; margin-top: 1.5rem; }
@media (min-width: 48rem) { .notes { grid-template-columns: 1fr 1fr; gap: 2rem; } }
.note {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  padding: 1.75rem 1.5rem 1.25rem;
  border-radius: 3px;
  box-shadow: 0 18px 30px -18px rgb(0 0 0 / 0.6);
}
.note::before {   /* the pin */
  content: "";
  position: absolute;
  top: 0.6rem;
  left: 50%;
  width: 0.9rem;
  height: 0.9rem;
  margin-left: -0.45rem;
  border-radius: 50%;
  background: var(--yolk);
  border: 2px solid var(--ink);
}
.note:nth-child(odd) { rotate: -1.2deg; }
.note:nth-child(even) { rotate: 1deg; }
.note blockquote p { font-family: var(--font-serif); font-size: var(--step-1); line-height: 1.4; }
.note figcaption { margin-top: 0.9rem; font-weight: 700; font-size: var(--step--1); color: var(--ink-muted); }

/* --- Hours and find us ----------------------------------------------------- */

.hours { width: 100%; max-width: 26rem; border-collapse: collapse; }
.hours th, .hours td { text-align: left; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.hours th { font-weight: 600; }
.hours td { text-align: right; }
.hours tr.is-today th, .hours tr.is-today td { font-weight: 800; }
.hours tr.is-today th::after { content: " (today)"; font-weight: 400; color: var(--ink-muted); }
.address { font-style: normal; font-size: var(--step-1); line-height: 1.5; margin-bottom: 1rem; }
.link-arrow { font-weight: 700; }
.hygiene {
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  border-left: 6px solid var(--yolk);
  background: var(--paper-alt);
}

/* --- Booking form ---------------------------------------------------------- */

.book-form { display: grid; gap: 1rem; }
.field { display: grid; gap: 0.3rem; border: 0; padding: 0; }
.field-row { display: grid; gap: 1rem; }
@media (min-width: 30rem) { .field-row { grid-template-columns: 1fr 1fr; } }
label, legend { font-weight: 700; }
.optional { font-weight: 400; color: var(--ink-muted); }
input, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--line-ui);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  min-height: 48px;
  width: 100%;
}
.choices { display: flex; gap: 1.5rem; }
.choices label { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 400; min-height: 44px; }
.choices input { width: 1.25rem; min-height: 0; accent-color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  input, textarea { transition: border-color 150ms ease, box-shadow 150ms ease; }
}
input:focus-visible, textarea:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus); }
.field.is-valid input { border-color: #2e7d46; }
.field.is-invalid input { border-color: #b42318; }
.field-msg { min-height: 1.3em; font-size: var(--step--1); font-weight: 600; }
.field.is-invalid .field-msg { color: #b42318; }
@media (prefers-color-scheme: dark) {
  .field.is-invalid .field-msg { color: #ff9b8f; }
  .field.is-invalid input { border-color: #ff9b8f; }
  .field.is-valid input { border-color: #7ed49a; }
}
.form-done {
  padding: 1rem 1.25rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
}
.form-done p + p { margin-top: 0.4rem; }

/* --- Footer and call bar ---------------------------------------------------- */

.site-footer { padding-block: 2.5rem; border-top: 1px solid var(--line); }
.site-footer p + p { margin-top: 0.5rem; }

.call-bar {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border-radius: 999px;
  background: var(--yolk);
  color: var(--yolk-ink);
  border: 2px solid var(--ink);
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 20px -8px rgb(0 0 0 / 0.45);
}
@media (min-width: 48rem) { .call-bar { display: none; } }
/* While the hero's own call link is on screen, the bar steps aside so it
   doesn't cover the cup. Tap-to-call is in view either way. */
@media (prefers-reduced-motion: no-preference) { .call-bar { transition: translate 250ms ease, opacity 250ms ease; } }
.call-bar.is-tucked { translate: 0 150%; opacity: 0; pointer-events: none; }

/* --- Scroll scenes (visible without JavaScript) ----------------------------- */

@media (prefers-reduced-motion: no-preference) {
  /* Menu lines step in, one course after another */
  .scenes-on [data-scene="steps"].is-in .menu-group { transition: opacity 450ms ease, translate 450ms ease; }
  .scenes-on [data-scene="steps"].is-in .menu-group:nth-child(2) { transition-delay: 110ms; }
  .scenes-on [data-scene="steps"].is-in .menu-group:nth-child(3) { transition-delay: 220ms; }
  .scenes-on [data-scene="steps"].is-in .menu-group:nth-child(4) { transition-delay: 330ms; }
  .scenes-on [data-scene="steps"]:not(.is-in) .menu-group { opacity: 0; translate: 0 1rem; }

  /* Notes get pinned up: they drop in from slightly above */
  .scenes-on [data-scene="pin"].is-in .note { transition: opacity 400ms ease, translate 500ms cubic-bezier(.3, 1.4, .5, 1); }
  .scenes-on [data-scene="pin"].is-in .note:nth-child(2) { transition-delay: 120ms; }
  .scenes-on [data-scene="pin"].is-in .note:nth-child(3) { transition-delay: 240ms; }
  .scenes-on [data-scene="pin"].is-in .note:nth-child(4) { transition-delay: 360ms; }
  .scenes-on [data-scene="pin"]:not(.is-in) .note { opacity: 0; translate: 0 -1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .motion-toggle { display: none; }
}

@media print {
  .demo-banner, .call-bar, .motion-toggle, .hero-3d, .cup-poster, .book-form { display: none; }
}
