/* Shared base for every demo: reset, layout helpers and the motion system driven by motion.js. */

:root {
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --reveal-distance: 28px;
  --reveal-zoom: 1.08;
  --header-z: 50;
  --chips-z: 40;
}

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

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

body {
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

ul {
  list-style: none;
}

.pad {
  padding-left: clamp(16px, 4vw, 56px);
  padding-right: clamp(16px, 4vw, 56px);
}

.wrap {
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
}

.map iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Header: sticky, hides on scroll down and comes back on scroll up. */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--header-z);
  isolation: isolate;
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--hdr-bg, transparent);
}

.site-header.overlay {
  position: fixed;
  left: 0;
  right: 0;
}

.site-header.overlay::before {
  opacity: 0;
}

.site-header.overlay.is-scrolled::before {
  opacity: 1;
}

.site-header.is-hidden {
  transform: translateY(-100%);
}

.nav ul a[aria-current] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.hdr-end {
  display: flex;
  align-items: center;
  gap: 8px;
}

.m-carta {
  display: none;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
}

@media (max-width: 820px) {
  .m-carta {
    display: inline-flex;
  }
}

/* Menu page: title, sticky category chips and sections. */
.page-head {
  padding-top: clamp(40px, 6vw, 80px);
  padding-bottom: clamp(20px, 3vw, 32px);
}

.page-head h1 {
  font-family: var(--font-display);
  font-weight: var(--display-weight, 400);
  font-size: clamp(52px, 9vw, 120px);
  line-height: 0.95;
  text-transform: var(--display-case, none);
}

.page-head p {
  margin-top: 14px;
  max-width: 46ch;
  font-size: 19px;
  color: var(--muted-text, inherit);
}

.chips {
  position: sticky;
  top: 0;
  z-index: var(--chips-z);
  background: var(--bar-bg);
  border-bottom: 1px solid var(--chip-line);
}

.chips ul {
  display: flex;
  gap: 8px;
  max-width: var(--chips-max, 1240px);
  margin: 0 auto;
  padding: 12px clamp(16px, 4vw, 56px);
  overflow-x: auto;
  scrollbar-width: none;
}

.chips ul::-webkit-scrollbar {
  display: none;
}

.chips a {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 18px;
  border: var(--chip-bw, 1.5px) solid var(--chip-line);
  border-radius: var(--chip-radius, 999px);
  background: var(--chip-bg);
  color: var(--chip-fg);
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
}

.chips a[aria-current] {
  background: var(--chip-on-bg);
  border-color: var(--chip-on-bg);
  color: var(--chip-on-fg);
}

.carta-sec {
  scroll-margin-top: 72px;
  padding-top: clamp(40px, 6vw, 72px);
}

h2.sec-t {
  font-family: var(--font-display);
  font-weight: var(--display-weight, 400);
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1;
  text-transform: var(--display-case, none);
  margin-bottom: 20px;
}

.to-carta {
  display: flex;
  justify-content: center;
  margin-top: 36px;
}

/* Motion: everything moves only with JS on and no reduced-motion preference. */
@media (prefers-reduced-motion: no-preference) {
  html:not(.capture) {
    scroll-behavior: smooth;
  }

  .site-header {
    transition: transform 0.35s var(--ease);
  }

  .site-header.overlay::before {
    transition: opacity 0.3s var(--ease);
  }

  .js [data-reveal] {
    opacity: 0;
    translate: 0 var(--reveal-distance);
    transition:
      opacity 0.7s var(--ease),
      translate 0.9s var(--ease);
    transition-delay: calc(var(--i, 0) * 80ms);
  }

  .js [data-reveal].is-in {
    opacity: 1;
    translate: none;
  }

  .js .zoom img {
    scale: var(--reveal-zoom);
    transition: scale 1.4s var(--ease);
  }

  .js .zoom.is-in img,
  .js .is-in .zoom img {
    scale: 1;
  }

  [role="tabpanel"].is-entering {
    animation: panel-in 0.45s var(--ease);
  }

  @view-transition {
    navigation: auto;
  }

  .site-header {
    view-transition-name: site-header;
  }

  ::view-transition-group(*) {
    animation-duration: 0.4s;
    animation-timing-function: var(--ease);
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    translate: 0 14px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .js .zoom.is-in:hover img,
  .js .is-in .zoom:hover img {
    scale: 1.04;
  }
}

/* Video capture mode (?capture): motion.js drives every state per frame, so time-based effects are off. */
html.capture *,
html.capture *::before,
html.capture *::after {
  transition: none !important;
  animation: none !important;
}
