/*
 * Rosso Italiano diner QR (resources/views/qr, docs/QR.md).
 *
 * The look of the original QR site (rosso-italiano/frontend-web, Quasar 1):
 * Roboto with Quasar's type scale, white text over a darkened photo, the
 * leaf-cornered photo frame of `.image-product`, a two-column grid, the dark
 * bar with back / title / home, and a black footer with the Ekselence icon.
 * Motion (odd/tasks/rosso-brand.md S6): page transitions, photos that travel
 * between a list row and the product page, loading shimmer, staggered entrance,
 * a sliding sheet and self-advancing banners; none under prefers-reduced-motion.
 * Plain CSS: the deploy runs no asset build.
 */

/* Roboto 300/400/500/700, Latin subset, as the original served it (public/fonts/roboto, Apache 2.0). */
@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("/fonts/roboto/roboto-300.woff") format("woff");
}

@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/roboto/roboto-400.woff") format("woff");
}

@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/roboto/roboto-500.woff") format("woff");
}

@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/roboto/roboto-700.woff") format("woff");
}

:root {
  --qr-bar: #1d140a;
  --qr-bar-height: 50px;
  --qr-footer-height: 50px;
  --qr-sheet: #1d1d1d;
  --qr-line: rgba(255, 255, 255, 0.28);
  --qr-muted: rgba(255, 255, 255, 0.7);
  /* Quasar's shadow-10, under every framed photo. */
  --qr-shadow: 0 6px 6px -3px rgba(0, 0, 0, 0.2), 0 10px 14px 1px rgba(0, 0, 0, 0.14), 0 4px 18px 3px rgba(0, 0, 0, 0.12);
  /* Quasar's elevated header and footer. */
  --qr-elevation: 0 0 10px 2px rgba(0, 0, 0, 0.2), 0 0 10px rgba(0, 0, 0, 0.24);
  --qr-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --qr-spring: cubic-bezier(0.34, 1.32, 0.5, 1);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Roboto", -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* The original layout's burgundy, seen until the photo arrives. */
  background: #4f1517 linear-gradient(90deg, #4f1517 0%, #621a1d 40%, #621a1d 60%, #4f1517 100%);
}

body:has(.qr-sheet[open]) {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

h1,
h2,
p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ------------------------------------------------------------------ */
/* Page transitions, where the browser supports them.                  */
/* ------------------------------------------------------------------ */

@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: qr-page-out 220ms var(--qr-ease) both;
}

::view-transition-new(root) {
  animation: qr-page-in 380ms var(--qr-ease) both;
}

/* The bar and the footer stay put while the page changes under them. */
.qr-bar {
  view-transition-name: qr-bar;
}

.qr-footer {
  view-transition-name: qr-footer;
}

@keyframes qr-page-out {
  to {
    opacity: 0;
    transform: scale(0.98);
  }
}

@keyframes qr-page-in {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
}

/* A product's photo and name travel between its list row and its page. */
.qr-vt-photo {
  view-transition-name: qr-product-photo;
}

.qr-vt-title {
  display: inline-block;
  view-transition-name: qr-product-title;
}

::view-transition-group(qr-product-photo),
::view-transition-group(qr-product-title) {
  animation-duration: 480ms;
  animation-timing-function: var(--qr-ease);
}

/* Scale the name by its height only, so the text never stretches sideways. */
::view-transition-old(qr-product-title),
::view-transition-new(qr-product-title) {
  width: auto;
  height: 100%;
}

/* ------------------------------------------------------------------ */
/* Photos: the ones still loading shimmer behind a small white         */
/* spinner, then fade in from a blur; cached ones show at once.        */
/* ------------------------------------------------------------------ */

.qr-img {
  position: relative;
  display: block;
  overflow: hidden;
}

.qr-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 400ms var(--qr-ease), transform 600ms var(--qr-ease), filter 450ms var(--qr-ease);
}

/* An inline script marks the photos the browser does not have yet, before the first render. */
.qr-img.is-pending {
  background: rgba(255, 255, 255, 0.08);
}

.qr-img.is-pending::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.12) 50%, transparent 80%);
  background-size: 200% 100%;
  animation: qr-shimmer 1.4s linear infinite;
}

.qr-img.is-pending img {
  opacity: 0;
  transform: scale(1.04);
  filter: blur(6px);
}

.qr-img.is-pending.is-loaded {
  background: transparent;
}

.qr-img.is-pending.is-loaded::before,
.qr-img.is-pending.is-loaded::after {
  content: none;
}

.qr-img.is-pending.is-loaded img {
  opacity: 1;
  transform: none;
  filter: none;
}

.qr-img.is-error img {
  visibility: hidden;
}

@keyframes qr-shimmer {
  from {
    background-position: 150% 0;
  }

  to {
    background-position: -50% 0;
  }
}

/* Quasar's default spinner: 1em, white. */
.qr-img.is-pending::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1em;
  height: 1em;
  margin: -0.5em 0 0 -0.5em;
  border: 2px solid #fff;
  border-right-color: transparent;
  border-radius: 50%;
  animation: qr-spin 0.8s linear infinite;
}

@keyframes qr-spin {
  to {
    transform: rotate(360deg);
  }
}

/* `.image-product` of the original: leaf corners, a 2px white frame and shadow-10. */
.qr-leaf {
  border: 2px solid #fff;
  border-radius: 5px 25px;
  box-shadow: var(--qr-shadow);
}

/* ------------------------------------------------------------------ */
/* Page: the photo behind, darkened as on the original.               */
/* ------------------------------------------------------------------ */

.qr-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
}

.qr-bg__img {
  position: absolute;
  inset: 0;
}

.qr-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 1),
    rgba(0, 0, 0, 0.8) 10%,
    rgba(0, 0, 0, 0.8) 26%,
    rgba(0, 0, 0, 0.8) 70%,
    rgba(0, 0, 0, 1) 100%
  );
}

/* The background photo never shows a shimmer or a spinner. */
.qr-bg .qr-bg__img::before,
.qr-bg .qr-bg__img::after {
  content: none;
}

.qr-main {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: calc(var(--qr-bar-height) + env(safe-area-inset-top)) 0 calc(var(--qr-footer-height) + env(safe-area-inset-bottom) + 24px);
}

/* ------------------------------------------------------------------ */
/* Bar and footer.                                                     */
/* ------------------------------------------------------------------ */

.qr-bar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  min-height: calc(var(--qr-bar-height) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  background: var(--qr-bar);
  box-shadow: var(--qr-elevation);
  transition: box-shadow 300ms var(--qr-ease);
}

/* A deeper shadow once the page scrolls. */
body.is-scrolled .qr-bar {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.75);
}

.qr-bar__title {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 12px;
  overflow: hidden;
  font-size: 21px;
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.5;
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.qr-bar__button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  transition: background 200ms, transform 200ms var(--qr-spring);
}

a.qr-bar__button:active {
  background: var(--qr-line);
  transform: scale(0.9);
}

.qr-bar__button svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.qr-footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--qr-footer-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #000;
  box-shadow: var(--qr-elevation);
}

.qr-footer a {
  display: block;
}

.qr-footer__icon {
  width: 36px;
  height: 36px;
}

/* ------------------------------------------------------------------ */
/* Type: Quasar's scale, white, light headings typed as they read.     */
/* ------------------------------------------------------------------ */

/* "NUESTRA CARTA": text-h4, weight-light, letter-spacing -1px. */
.qr-title {
  padding: 24px 16px;
  font-size: 2.125rem;
  font-weight: 300;
  line-height: 2.5rem;
  letter-spacing: -1px;
  text-align: center;
}

/* Category and reviews titles: text-h5. They drop in as the page opens. */
.qr-heading {
  padding: 32px 16px 8px;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 2rem;
  text-align: center;
  animation: qr-heading-in 700ms var(--qr-ease) both;
}

@keyframes qr-heading-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
    letter-spacing: 0.2em;
  }
}

/* Entrance: content slides up and fades in as it scrolls into view, staggered by --i. Hidden only with JS. */
.js .reveal {
  opacity: 0;
  transform: translateY(22px) scale(0.98);
  transition: opacity 650ms var(--qr-ease), transform 750ms var(--qr-ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Product and promotion names: text-h6. */
.qr-name {
  margin: 24px 16px;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 2rem;
  letter-spacing: 0.0125em;
  text-align: center;
}

/* Subcategory sections, Acompañamientos, Reseñas: a light text-h5 between thin lines. */
.qr-subheading {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 16px 0;
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 2rem;
  text-align: center;
}

.qr-subheading::before,
.qr-subheading::after {
  content: "";
  flex: 1 1 0;
  height: 1px;
  background: var(--qr-line);
}

/* text-subtitle1, centred. */
.qr-description {
  margin: 16px 0;
  padding: 0 16px;
  font-size: 1rem;
  line-height: 1.75rem;
  letter-spacing: 0.00937em;
  text-align: center;
}

.qr-description--pre {
  white-space: pre-line;
}

.qr-caption {
  font-size: 0.75rem;
  line-height: 1.25rem;
  letter-spacing: 0.03333em;
  color: var(--qr-muted);
}

.qr-note {
  display: block;
  font-size: 0.75rem;
  font-style: italic;
  line-height: 1.25rem;
  letter-spacing: 0.03333em;
}

.qr-center {
  margin: 16px;
  text-align: center;
}

.qr-empty {
  margin: 32px 16px;
  font-weight: 300;
  text-align: center;
}

.qr-separator {
  height: 1px;
  margin: 0;
  border: 0;
  background: var(--qr-line);
}

/* Prices: text-h6 in lists, text-h4 bold on the product page. */
.qr-price {
  display: block;
  padding-top: 8px;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.0125em;
}

.qr-price del {
  margin-left: 8px;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--qr-muted);
}

.qr-price--large {
  font-size: 2.125rem;
  font-weight: 700;
  line-height: 2.5rem;
  letter-spacing: 0.00735em;
}

.qr-price--large del {
  font-size: 1rem;
}

/* Text buttons: white, light, inside a thin leaf frame. */
.qr-button {
  display: inline-block;
  padding: 6px 16px;
  border: 1px solid #fff;
  border-radius: 5px 15px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5rem;
  letter-spacing: 0.0178em;
}

/* ------------------------------------------------------------------ */
/* Home: logo, promotions, "NUESTRA CARTA", two-column grid.          */
/* ------------------------------------------------------------------ */

.qr-logo {
  padding: 16px 16px 0;
  text-align: center;
}

.qr-logo__img {
  display: inline-block;
  width: 50%;
  border-radius: 4px;
  box-shadow: var(--qr-shadow);
}

.qr-logo__img img {
  height: auto;
}

.qr-banners-box {
  margin-top: 24px;
}

.qr-banners {
  display: flex;
  gap: 16px;
  padding: 4px 16px 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 16px;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

/* A mouse drag pans the banners; touch pans natively. */
.qr-banners.is-panning {
  cursor: grabbing;
  scroll-behavior: auto;
  user-select: none;
}

.qr-banners::-webkit-scrollbar {
  display: none;
}

.qr-banner {
  position: relative;
  flex: 0 0 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  border: 2px solid #fff;
  border-radius: 5px 25px;
  box-shadow: var(--qr-shadow);
  transition: transform 260ms var(--qr-ease);
}

.qr-banner:active {
  transform: scale(0.98);
}

/* Page dots under several banners; the current one stretches. */
.qr-banners__pager {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: -12px 0 16px;
}

.qr-banners__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--qr-line);
  transition: width 300ms var(--qr-ease), background 300ms;
}

.qr-banners__dot.is-active {
  width: 18px;
  background: #fff;
}

/* Several banners: the next one peeks in, so the diner knows to swipe. */
.qr-banners--several .qr-banner {
  flex-basis: 88%;
}

.qr-banner__img {
  position: absolute;
  inset: 0;
}

.qr-banner__text {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 16px;
  background: rgba(0, 0, 0, 0.7);
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 2rem;
  text-align: center;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  padding: 0 16px;
}

.qr-tile {
  position: relative;
  display: block;
  justify-self: center;
  width: 96%;
  aspect-ratio: 1;
  overflow: hidden;
  transition: transform 300ms var(--qr-spring), box-shadow 300ms;
}

.qr-tile:active {
  transform: scale(0.95);
}

.qr-tile__img {
  position: absolute;
  inset: 0;
}

.qr-tile__img img {
  transition: opacity 600ms var(--qr-ease), transform 1.2s var(--qr-ease), filter 700ms var(--qr-ease);
}

@media (hover: hover) {
  .qr-tile:hover .qr-tile__img.is-loaded img {
    transform: scale(1.06);
  }
}

/* The name on a 70% black strip, as `.q-img__content > div` of the original. */
.qr-tile__name {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 16px;
  background: rgba(0, 0, 0, 0.7);
  font-size: 0.75rem;
  line-height: 1.25rem;
  letter-spacing: 0.03333em;
  text-align: center;
}

/* Bottom sheet with the subcategories: Quasar's dark BottomSheet, rising from the bottom. */
.qr-sheet {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
}

.qr-sheet::backdrop {
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0);
  transition: background 300ms var(--qr-ease), backdrop-filter 300ms;
}

.qr-sheet.is-open::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.qr-sheet__panel {
  position: absolute;
  inset: auto 0 0;
  max-width: 600px;
  max-height: 80vh;
  margin: 0 auto;
  padding: 0 0 calc(8px + env(safe-area-inset-bottom));
  overflow-y: auto;
  border-radius: 4px 4px 0 0;
  background: var(--qr-sheet);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.4);
  transform: translateY(100%);
  /* Closing: it accelerates back down. */
  transition: transform 260ms cubic-bezier(0.4, 0, 1, 1);
}

/* Opening: it rises and decelerates without overshooting. */
.qr-sheet.is-open .qr-sheet__panel {
  transform: translateY(0);
  transition: transform 420ms var(--qr-ease);
}

.qr-sheet__panel.is-dragging {
  transition: none;
}

/* Drag the handle or the message down to close the sheet. */
.qr-sheet__handle {
  display: block;
  width: 40px;
  height: 5px;
  margin: 8px auto 0;
  border-radius: 999px;
  background: var(--qr-line);
  cursor: grab;
  touch-action: none;
}

.qr-sheet__list li {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 360ms var(--qr-ease), transform 420ms var(--qr-ease);
  transition-delay: calc(80ms + var(--i, 0) * 45ms);
}

.qr-sheet.is-open .qr-sheet__list li {
  opacity: 1;
  transform: none;
}

.qr-sheet__message {
  padding: 16px;
  touch-action: none;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--qr-muted);
}

.qr-sheet__item {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 8px 16px;
  font-size: 0.875rem;
  transition: background 200ms, transform 220ms var(--qr-spring);
}

.qr-sheet__item:active {
  background: rgba(255, 255, 255, 0.06);
  transform: scale(0.98);
}

.qr-sheet__icon {
  flex: none;
  width: 24px;
  height: 24px;
  margin-right: 32px;
}

.qr-sheet__icon .qr-img {
  width: 24px;
  height: 24px;
}

/* ------------------------------------------------------------------ */
/* Category page and side dishes: the original list.                  */
/* ------------------------------------------------------------------ */

.qr-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  transition: transform 260ms var(--qr-spring), background 200ms;
}

.qr-row:active {
  transform: scale(0.98);
}

.qr-row__thumb {
  flex: none;
  width: 100px;
  height: 100px;
  margin-right: 16px;
}

.qr-row__body {
  flex: 1 1 0;
  min-width: 0;
}

.qr-row__name {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.2;
}

.qr-row__description {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  line-height: 1.2;
  letter-spacing: 0.03333em;
}

/* ------------------------------------------------------------------ */
/* Product and promotion pages.                                       */
/* ------------------------------------------------------------------ */

.qr-photo {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.qr-photo__img {
  width: 70%;
  aspect-ratio: 1;
}

.qr-photo--wide .qr-photo__img {
  width: calc(100% - 32px);
  aspect-ratio: 16 / 9;
}

/* ------------------------------------------------------------------ */
/* Reviews.                                                            */
/* ------------------------------------------------------------------ */

.qr-rating {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin: 16px;
  font-size: 1.25rem;
}

.qr-rating strong {
  font-weight: 500;
}

/* Five stars filled up to --rating (0–5): white on a faint white. */
.qr-stars::before {
  content: "\2605\2605\2605\2605\2605";
  letter-spacing: 2px;
  background: linear-gradient(90deg, #fff calc(var(--rating, 0) / 5 * 100%), rgba(255, 255, 255, 0.3) 0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.qr-review {
  padding: 16px;
  border-bottom: 1px solid var(--qr-line);
}

.qr-review:first-child {
  border-top: 1px solid var(--qr-line);
}

.qr-review__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.qr-review__head .qr-stars {
  font-size: 0.875rem;
}

.qr-review__comment {
  margin: 4px 0;
  white-space: pre-line;
}

.qr-pages {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin: 24px 16px;
}

.qr-pages > :first-child {
  justify-self: start;
}

.qr-pages > :last-child {
  justify-self: end;
}

/* Visitors who ask for less motion get none. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
  }

  .js .reveal,
  .qr-sheet__list li {
    opacity: 1;
    transform: none;
  }

  @view-transition {
    navigation: none;
  }
}
