/* Ciao Bistro & Pasticceria */

:root {
  --sand: #f6ead7;
  --cream: #fcf7ee;
  --olive-tint: #eaebd6;
  --blush: #f8e4d8;
  --wine: #6d0f2c;
  --ink: #2b2420;
  --burgundy: #8b072f;
  --terracotta: #a3461f;
  --olive: #565c2c;
  --sun: #f4a650;
  --error: #a1201a;

  --f-display: "Abril Fatface", "Bodoni MT", "Didot", Georgia, serif;
  --f-serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --f-sans: "Jost", "Century Gothic", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease: cubic-bezier(.16, 1, .3, 1);
  --t-fast: .2s;
  --t-med: .5s;
  --t-slow: 1s;

  --gutter: clamp(1.25rem, 5vw, 4rem);
  --header-h: 4.25rem;
}

body {
  --fg: var(--ink); --accent: var(--burgundy); --name: var(--terracotta); --kicker: var(--olive);
  --muted: #5a4f45; --line: rgba(123, 19, 50, .28); --card: #fffdf8;
  --badge-bg: var(--burgundy); --badge-fg: var(--cream);
}
body[data-theme="sand"]  { --bg: var(--sand); }
body[data-theme="cream"] { --bg: var(--cream); }
body[data-theme="olive"] { --bg: var(--olive-tint); }
body[data-theme="blush"] { --bg: var(--blush); }
body[data-theme="wine"]  {
  --bg: var(--wine); --fg: #fbf0e6; --accent: #f8dfc8; --name: #f8dfc8; --kicker: #f8dfc8;
  --muted: #efd6d2; --line: rgba(255, 255, 255, .3); --card: rgba(255, 255, 255, .08);
  --badge-bg: var(--cream); --badge-fg: var(--burgundy);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--f-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--t-slow) var(--ease), color var(--t-med) ease;
  overflow-x: hidden;
}

body.nav-open { overflow: hidden; }

h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
svg { display: block; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: fixed; top: .75rem; left: .75rem; z-index: 100;
  padding: .75rem 1rem; background: var(--burgundy); color: var(--cream);
  border-radius: 999px; transform: translateY(-200%);
}
.skip:focus { transform: none; }

.wrap { width: min(100% - 2 * var(--gutter), 76rem); margin-inline: auto; }

/* ---------- Header ---------- */

.header {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-inline: var(--gutter);
  transition: background-color var(--t-med) ease, box-shadow var(--t-med) ease;
}
.header.is-scrolled {
  background-color: var(--bg);
  background-color: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--line);
}

.brand { display: block; position: relative; z-index: 2; }
.brand img { display: block; height: clamp(2rem, 4vw, 2.5rem); width: auto; transition: filter var(--t-med) ease; }
/* The logo file is burgundy; turn it cream on the dark sections. */
body[data-theme="wine"] .brand img { filter: brightness(0) invert(1) sepia(.25); }

.nav { display: flex; gap: clamp(1.5rem, 3vw, 2.75rem); }
.nav a {
  position: relative; padding: .75rem 0; white-space: nowrap;
  font-size: .82rem; letter-spacing: .18em; text-transform: uppercase; text-decoration: none;
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: .45rem; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform var(--t-med) var(--ease);
}
.nav a:hover::after, .nav a:focus-visible::after, .nav a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }

.header-tools { display: flex; align-items: center; gap: .5rem; position: relative; z-index: 2; }

.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.lang button {
  min-width: 2.6rem; min-height: 2.5rem; padding: 0 .5rem;
  font-size: .78rem; letter-spacing: .12em; border-radius: 999px;
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease;
}
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--bg); }

.nav-toggle { display: none; width: 2.75rem; height: 2.75rem; place-items: center; }
.bars { position: relative; width: 1.5rem; height: .6rem; display: block; }
.bars i { position: absolute; left: 0; width: 100%; height: 1.5px; background: currentColor; transition: transform var(--t-med) var(--ease); }
.bars i:first-child { top: 0; }
.bars i:last-child { bottom: 0; }
.nav-toggle[aria-expanded="true"] .bars i:first-child { transform: translateY(.26rem) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars i:last-child { transform: translateY(-.26rem) rotate(-45deg); }

@media (max-width: 68.74rem) {
  .nav-toggle { display: grid; }
  .nav {
    position: fixed; inset: 0; z-index: 1;
    flex-direction: column; justify-content: center; align-items: flex-start; gap: .5rem;
    padding: var(--header-h) var(--gutter) 2rem;
    background: var(--bg);
    opacity: 0; visibility: hidden;
    transition: opacity var(--t-med) ease, visibility 0s linear var(--t-med);
  }
  /* backdrop-filter would trap the fixed overlay inside the header */
  body.nav-open .header { -webkit-backdrop-filter: none; backdrop-filter: none; background-color: var(--bg); box-shadow: none; }
  body.nav-open .nav { opacity: 1; visibility: visible; transition-delay: 0s; }
  .nav a {
    font-family: var(--f-serif); font-size: clamp(2.5rem, 13vw, 4rem); line-height: 1.15;
    letter-spacing: 0; text-transform: none; color: var(--accent);
    transform: translateY(1.5rem); opacity: 0;
    transition: transform var(--t-med) var(--ease), opacity var(--t-med) ease;
  }
  .nav a::after { display: none; }
  body.nav-open .nav a { transform: none; opacity: 1; }
  body.nav-open .nav a:nth-child(2) { transition-delay: .06s; }
  body.nav-open .nav a:nth-child(3) { transition-delay: .12s; }
  body.nav-open .nav a:nth-child(4) { transition-delay: .18s; }
  body.nav-open .nav a:nth-child(5) { transition-delay: .24s; }
}

/* ---------- Shared type ---------- */

.eyebrow, .kicker {
  font-size: .8rem; letter-spacing: .24em; text-transform: uppercase; color: var(--muted);
}
.kicker { display: flex; align-items: center; gap: .9rem; color: var(--kicker); }
.kicker::before { content: ""; width: 2.5rem; height: 1px; background: currentColor; }

.title {
  font-family: var(--f-serif); font-weight: 500;
  font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: 1.02; letter-spacing: -.01em;
  color: var(--accent); text-wrap: balance;
}
.title-xl { font-size: clamp(2.75rem, 7.5vw, 6rem); }

.section { padding-block: clamp(4.5rem, 11vw, 9rem); }
.section-head { display: grid; gap: 1rem; margin-bottom: clamp(2.25rem, 5vw, 4rem); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3.25rem; padding: 0 1.75rem;
  font-size: .82rem; letter-spacing: .18em; text-transform: uppercase; text-decoration: none;
  border-radius: 999px; border: 1px solid var(--accent);
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) var(--ease);
}
.btn-solid { background: var(--accent); color: var(--bg); }
.btn-line { color: var(--accent); }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(.97); }
.btn-line:hover { background: var(--accent); color: var(--bg); }

/* ---------- Hero ---------- */

.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100vh; min-height: 100svh;
  display: grid; align-items: end;
  padding: calc(var(--header-h) + 3rem) var(--gutter) clamp(2.5rem, 7vh, 5rem);
}
.hero-bg {
  position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%;
  object-fit: cover; object-position: 60% 50%;
  animation: settle 2.4s var(--ease) both;
}
/* Cream wash keeps the dark text readable over the photo. */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(252, 247, 238, .9), rgba(252, 247, 238, 0) 9rem),
    linear-gradient(to top, rgba(252, 247, 238, .97) 0%, rgba(252, 247, 238, .9) 55%, rgba(252, 247, 238, .25) 100%);
}
.hero-copy { display: grid; gap: 1.1rem; justify-items: start; max-width: 40rem; }

.tagline {
  font-family: var(--f-serif); font-style: italic; font-weight: 500;
  font-size: clamp(2.2rem, 5.4vw, 4.25rem); line-height: 1.05; color: var(--accent); text-wrap: balance;
}
.lede { max-width: 34rem; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .5rem; }

.status { display: inline-flex; align-items: center; gap: .6rem; font-size: .9rem; color: var(--muted); margin-top: .25rem; }
.status-inline { font-size: 1rem; margin-top: .5rem; }
.dot { width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; opacity: .45; flex: none; }
.is-open .dot { background: #2f7d4f; opacity: 1; animation: pulse 2.4s ease-out infinite; }
body[data-theme="wine"] .is-open .dot { background: #9be0b4; }

.hero-in { animation: fade-up 1s var(--ease) both; animation-delay: var(--d, 0s); }

@media (min-width: 44rem) {
  .hero { align-items: center; }
  .hero::before {
    background:
      linear-gradient(to bottom, rgba(252, 247, 238, .88), rgba(252, 247, 238, 0) 8rem),
      linear-gradient(to right, rgba(252, 247, 238, .97) 0%, rgba(252, 247, 238, .92) 34%, rgba(252, 247, 238, .35) 62%, rgba(252, 247, 238, 0) 82%);
  }
}

/* ---------- Marquee ---------- */

.marquee { background: #b04e25; color: var(--cream); overflow: hidden; padding-block: 1.1rem; }
.marquee-track { display: flex; align-items: center; width: max-content; animation: marquee 44s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee span { font-family: var(--f-serif); font-style: italic; font-size: clamp(1.4rem, 3vw, 2.1rem); white-space: nowrap; }
.marquee i { width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; opacity: .6; margin-inline: clamp(1.25rem, 3vw, 2.5rem); flex: none; }

/* ---------- About ---------- */

.statement {
  font-family: var(--f-serif); font-weight: 500;
  font-size: clamp(1.9rem, 4.6vw, 3.6rem); line-height: 1.12; letter-spacing: -.01em;
  color: var(--accent); max-width: 58rem; margin-top: 1.5rem; text-wrap: balance;
}
.pillars { display: grid; gap: 2.5rem; margin-top: clamp(3rem, 7vw, 6rem); }
.pillars li { display: grid; gap: .75rem; align-content: start; padding-top: 1.75rem; border-top: 1px solid var(--line); }
.pillars h3 { font-family: var(--f-serif); font-weight: 600; font-size: 1.7rem; line-height: 1.15; color: var(--accent); }
.pillars p { color: var(--muted); max-width: 26rem; }
.icon { width: 3.5rem; height: 3.5rem; color: var(--terracotta); margin-bottom: .5rem; }

@media (min-width: 48rem) { .pillars { grid-template-columns: repeat(3, 1fr); gap: 3rem; } .pillars-2 { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Picks ---------- */

.picks { padding-top: 0; }
.pick-grid { display: grid; gap: 1rem; }
.pick {
  position: relative; display: grid; gap: .6rem; align-content: start;
  padding: 1.75rem; min-height: 13rem;
  background: var(--sand); border-radius: 1.25rem; overflow: hidden;
}
.pick:nth-child(3n+2) { background: var(--olive-tint); }
.pick:nth-child(3n) { background: var(--blush); }
.pick::after {
  content: ""; position: absolute; right: -3rem; bottom: -3rem; width: 9rem; height: 9rem; border-radius: 50%;
  border: 1px solid var(--line); transition: transform .8s var(--ease);
}
.pick:hover::after { transform: scale(1.5); }
.pick-tag { font-size: .72rem; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.pick-name { font-family: var(--f-serif); font-weight: 600; font-size: 2rem; line-height: 1.05; color: var(--accent); }
.pick-desc { color: var(--muted); font-size: .98rem; max-width: 24rem; }
.pick-price { margin-top: auto; padding-top: 1rem; font-family: var(--f-serif); font-size: 1.5rem; color: var(--accent); font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.pick-price small, .item-price small { font-family: var(--f-sans); font-size: .7em; margin-left: .2em; color: var(--muted); }

@media (min-width: 40rem) { .pick-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem) { .pick-grid { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; } }

/* ---------- Menu ---------- */

.tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.tab {
  min-height: 3rem; padding: 0 1.25rem; border-radius: 999px; border: 1px solid var(--line);
  font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease, border-color var(--t-fast) ease;
}
.tab:hover { border-color: var(--accent); }
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }

.panel { outline-offset: 12px; min-height: 20rem; }
.group + .group { margin-top: clamp(2.75rem, 6vw, 4.5rem); }
.group-title {
  font-family: var(--f-serif); font-weight: 600; font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: .16em; text-transform: uppercase; color: var(--accent);
  padding-bottom: .9rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--accent);
}
.items { column-gap: clamp(2.5rem, 6vw, 5rem); }
.item { break-inside: avoid; padding-bottom: 1.35rem; }
.group.compact .item { padding-bottom: .7rem; }
.item-head { display: flex; align-items: baseline; gap: .6rem; }
.item-name { min-width: 0; font-weight: 500; font-size: 1.02rem; letter-spacing: .06em; text-transform: uppercase; color: var(--name); }
.item-variant { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.leader { flex: 1; min-width: 1rem; border-bottom: 1px dotted var(--line); transform: translateY(-.28em); }
.item-price { font-family: var(--f-serif); font-weight: 600; font-size: 1.3rem; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; flex: none; }
.item-desc { color: var(--muted); font-size: .95rem; margin-top: .15rem; max-width: 30rem; padding-right: 3rem; }

.panel.is-swapping .item, .panel.is-swapping .group-title { animation: fade-up .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 28ms); }

.note { margin-top: clamp(2.5rem, 5vw, 4rem); font-size: .9rem; color: var(--muted); }

@media (min-width: 52rem) { .items { columns: 2; } }
@media (max-width: 30rem) { .item-variant { white-space: normal; } }

/* ---------- Booking ---------- */

.book-grid { display: grid; gap: 2.5rem; }
.book-intro { display: grid; gap: 1.1rem; align-content: start; }
.book-lede { color: var(--muted); max-width: 30rem; }
.book-mail { color: var(--muted); }
.book-mail a, .form-done a { color: var(--accent); overflow-wrap: anywhere; }

.form-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 1.5rem;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  box-shadow: 0 1.5rem 3rem -2rem rgba(123, 19, 50, .35);
}
.form { display: grid; gap: 1.25rem; }
.form[hidden], .form-done[hidden] { display: none; }
.field { display: grid; gap: .4rem; align-content: start; min-width: 0; }
.field label { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.req { color: var(--accent); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 3.25rem; padding: .75rem 1rem;
  font: inherit; font-size: 1.0625rem; color: var(--ink);
  background: #fff; border: 1px solid rgba(43, 36, 32, .4); border-radius: .75rem;
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.field textarea { resize: vertical; min-height: 6rem; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--burgundy); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: none; border-color: var(--burgundy); box-shadow: 0 0 0 3px rgba(123, 19, 50, .25);
}
.field [aria-invalid="true"] { border-color: var(--error); border-width: 2px; }
.help { font-size: .88rem; color: var(--muted); }
.error { font-size: .92rem; font-weight: 500; color: var(--error); }
.error[hidden] { display: none; }
.error::before { content: "! "; }
.form-summary {
  grid-column: 1 / -1;
  padding: 1rem 1.25rem; border: 2px solid var(--error); border-radius: .75rem; color: var(--error); background: #fff5f3;
}
.form-summary[hidden] { display: none; }
.form-summary ul { list-style: disc; padding-left: 1.25rem; margin-top: .4rem; }
.form-summary a { color: inherit; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .25rem; }

.form-done { display: grid; gap: 1rem; justify-items: start; animation: fade-up .8s var(--ease) both; outline: none; }
.form-done h3 { font-family: var(--f-serif); font-weight: 600; font-size: 2.2rem; line-height: 1.1; color: var(--accent); }
.done-icon { width: 3.5rem; color: #2f7d4f; }
.done-icon path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: check .6s .35s var(--ease) forwards; }
.done-summary { font-family: var(--f-serif); font-size: 1.5rem; }

@media (min-width: 36rem) {
  .form { grid-template-columns: 1fr 1fr; }
  .field-wide { grid-column: 1 / -1; }
}
@media (min-width: 60rem) {
  .book-grid { grid-template-columns: .8fr 1.2fr; gap: 5rem; align-items: start; }
  .book-intro { position: sticky; top: calc(var(--header-h) + 2rem); }
}

/* ---------- Visit ---------- */

.visit-grid { display: grid; gap: 3rem; }
.visit .title { margin-top: 1.25rem; }
.facts { display: grid; gap: 2rem; align-content: end; }
.facts dt { font-size: .78rem; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; }
.facts dd { font-family: var(--f-serif); font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.25; }
.facts .status { font-family: var(--f-sans); }
.mail-link { overflow-wrap: anywhere; text-underline-offset: .2em; }

@media (min-width: 56rem) { .visit-grid { grid-template-columns: 1.2fr .8fr; gap: 5rem; align-items: end; } }

/* ---------- Footer ---------- */

.footer { background: var(--wine); color: #fbf0e6; padding-bottom: 2rem; overflow: hidden; }
.footer-mark { display: block; width: 100%; height: auto; max-width: 70rem; margin-top: 1rem; filter: brightness(0) invert(1); opacity: .09; user-select: none; }
.footer-row { margin-top: 2rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; font-size: .88rem; color: #ecd2d2; padding-top: 1.75rem; border-top: 1px solid rgba(255, 255, 255, .25); }

/* ---------- Scroll reveals (only when JS is running) ---------- */

.js [data-reveal] {
  opacity: 0; transform: translateY(1.75rem);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
  transition-delay: calc(var(--i, 0) * 80ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js [data-reveal] .draw path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.8s .25s var(--ease); }
.js [data-reveal].is-in .draw path, .js [data-reveal].is-in.draw path { stroke-dashoffset: 0; }

/* ---------- Keyframes ---------- */

@keyframes fade-up { from { opacity: 0; transform: translateY(1.25rem); } to { opacity: 1; transform: none; } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes settle { from { transform: scale(1.08); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes check { to { stroke-dashoffset: 0; } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 125, 79, .45); }
  100% { box-shadow: 0 0 0 .6rem rgba(47, 125, 79, 0); }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .js [data-reveal] .draw path { stroke-dashoffset: 0; }
  .done-icon path { stroke-dashoffset: 0; }
  .marquee-track { flex-wrap: wrap; width: auto; justify-content: center; row-gap: .5rem; }
}

@media print {
  .header, .marquee, .hero-bg, .tabs { display: none; }
  .js [data-reveal] { opacity: 1; transform: none; }
}

/* ---------- Pasticceria gallery ---------- */

.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.gallery a { display: block; overflow: hidden; border-radius: 1rem; aspect-ratio: 4 / 5; background: var(--card); }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-med) var(--ease); }
.gallery a:hover img, .gallery a:focus-visible img { transform: scale(1.04); }
@media (min-width: 52rem) { .gallery { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; } }
