@layer reset, tokens, base, layout, components, utilities;

/* ============================================================
   La Dolce Vita Creperia — production stylesheet
   Royal blue + amber gold · WCAG 2.2 AA
   ============================================================ */

/* ---------- RESET ---------- */
@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  * {
    margin: 0;
  }

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

  body {
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  img,
  picture,
  svg,
  video {
    display: block;
    max-width: 100%;
    height: auto;
  }

  input,
  button,
  textarea,
  select {
    font: inherit;
    color: inherit;
  }

  button {
    background: none;
    border: 0;
    cursor: pointer;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  ul,
  ol {
    list-style: none;
    padding: 0;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    text-wrap: pretty;
    line-height: 1.1;
  }

  p {
    text-wrap: pretty;
  }

  :where(dialog) {
    padding: 0;
  }
}

/* ---------- TOKENS ---------- */
@layer tokens {
  :root {
    /* brand palette */
    --blue: #003F6E;
    --blue-deep: #002B4D;
    --blue-raised: #0A5285;
    --gold: #C07010;
    --gold-bright: #DE9A2D;
    --gold-light: #EAB552;
    --cream: #ECE7D3;
    --cream-soft: #F6F1E4;
    --ink: #16130E;
    --ink-soft: #4A4436;

    /* type families */
    --font-script: 'Pacifico', cursive;
    --font-head: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', system-ui, sans-serif;

    /* fluid type scale */
    --step--1: clamp(0.83rem, 0.79rem + 0.20vw, 0.94rem);
    --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.13rem);
    --step-1: clamp(1.2rem, 1.12rem + 0.40vw, 1.42rem);
    --step-2: clamp(1.44rem, 1.31rem + 0.65vw, 1.80rem);
    --step-3: clamp(1.73rem, 1.53rem + 1.00vw, 2.28rem);
    --step-4: clamp(2.07rem, 1.77rem + 1.50vw, 2.89rem);
    --step-5: clamp(2.49rem, 2.03rem + 2.28vw, 3.66rem);

    /* fluid space scale */
    --space-3xs: clamp(0.25rem, 0.24rem + 0.05vw, 0.31rem);
    --space-2xs: clamp(0.50rem, 0.48rem + 0.10vw, 0.56rem);
    --space-xs: clamp(0.75rem, 0.71rem + 0.15vw, 0.88rem);
    --space-s: clamp(1rem, 0.95rem + 0.25vw, 1.13rem);
    --space-m: clamp(1.5rem, 1.43rem + 0.38vw, 1.69rem);
    --space-l: clamp(2rem, 1.90rem + 0.50vw, 2.25rem);
    --space-xl: clamp(3rem, 2.85rem + 0.75vw, 3.38rem);
    --space-2xl: clamp(4rem, 3.80rem + 1.00vw, 4.50rem);

    /* geometry */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 22px;
    --maxw: 1180px;
    --header-h: 5rem;

    /* effects */
    --shadow-sm: 0 2px 8px rgba(0, 43, 77, 0.10);
    --shadow-md: 0 12px 30px rgba(0, 43, 77, 0.16);
    --shadow-lg: 0 24px 60px rgba(0, 43, 77, 0.28);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
  }
}

/* ---------- BASE ---------- */
@layer base {
  body {
    font-family: var(--font-body);
    font-size: var(--step-0);
    line-height: 1.65;
    color: var(--ink);
    background: var(--cream-soft);
    overflow-x: hidden;
  }

  h1,
  h2,
  h3,
  h4 {
    font-family: var(--font-head);
  }

  a {
    transition: color 0.2s var(--ease);
  }

  /* anchored sections clear the fixed header */
  :target,
  [id] {
    scroll-margin-top: calc(var(--header-h) + 1rem);
  }

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

/* ---------- LAYOUT ---------- */
@layer layout {
  .wrap {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    padding-inline: clamp(1.1rem, 4vw, 2.5rem);
  }

  .section {
    padding-block: clamp(3.5rem, 8vw, 7rem);
  }
}

/* ---------- COMPONENTS ---------- */
@layer components {

  /* ===== SKIP LINK ===== */
  .skip-link {
    position: absolute;
    left: 0.75rem;
    top: 0.75rem;
    z-index: 200;
    transform: translateY(-160%);
    background: var(--blue);
    color: var(--cream);
    font-weight: 600;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    transition: transform 0.2s var(--ease);
  }

  .skip-link:focus {
    transform: translateY(0);
  }

  /* ===== HEADER ===== */
  .site-header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    background: transparent;
    transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease),
      padding 0.3s var(--ease);
  }

  .site-header.is-stuck {
    background: var(--blue);
    box-shadow: 0 4px 20px rgba(0, 43, 77, 0.28);
  }

  .site-header__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-s);
    padding-block: 1rem;
  }

  .site-header.is-stuck .site-header__bar {
    padding-block: 0.65rem;
  }

  /* brand lockup */
  .brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    z-index: 110;
  }

  .brand__seal {
    display: inline-block;
    flex-shrink: 0;
    width: clamp(48px, 5vw, 52px);
    height: clamp(48px, 5vw, 52px);
    border-radius: 50%;
    background: url('../seal.png') center / cover no-repeat var(--blue);
    border: 2px solid var(--cream);
  }

  .brand__word {
    font-family: var(--font-script);
    color: #C57B1A;
    font-size: 1.5rem;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,.35);
  }

  /* ===== NAV (desktop bar) ===== */
  .nav__list {
    display: flex;
    align-items: center;
    gap: var(--space-m);
  }

  .nav__link {
    position: relative;
    color: var(--cream);
    font-weight: 500;
  }

  .nav__link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 2px;
    background: var(--gold-light);
    transition: width 0.28s var(--ease);
  }

  .nav__link:hover::after,
  .nav__link:focus-visible::after {
    width: 100%;
  }

  .lang {
    color: var(--cream);
    font-weight: 600;
    font-size: var(--step--1);
    padding: 0.3rem 0.8rem;
    border: 1px solid rgba(236, 231, 211, 0.45);
    border-radius: 999px;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
  }

  .lang:hover {
    background: rgba(236, 231, 211, 0.12);
    border-color: var(--cream);
  }

  /* Functional language switcher (native <select>) */
  select.lang {
    background: transparent;
    color: var(--cream);
    border: 1px solid rgba(236, 231, 211, 0.4);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.6rem;
    font: inherit;
    font-size: var(--step--1);
    cursor: pointer;
  }

  select.lang:focus-visible {
    outline: 3px solid var(--gold-bright);
    outline-offset: 2px;
  }

  select.lang option {
    background: var(--blue-deep);
    color: var(--cream);
  }

  .burger {
    display: none;
    color: var(--cream);
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.35rem;
    z-index: 110;
  }

  .nav-backdrop {
    display: none;
  }

  /* ===== HERO ===== */
  .hero {
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    background: var(--blue-deep);
  }

  .hero__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 30%;
  }

  .hero__scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(
      105deg,
      rgba(0, 43, 77, 0.9),
      rgba(0, 63, 110, 0.72) 42%,
      rgba(0, 63, 110, 0.28)
    );
  }

  .hero__inner {
    position: relative;
    z-index: 2;
    padding-top: 8rem;
    padding-bottom: clamp(3rem, 9vh, 7rem);
  }

  .overline {
    color: var(--gold-light);
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.8rem;
    font-weight: 600;
  }

  .wordmark {
    font-family: var(--font-script);
    font-size: clamp(3.4rem, 10vw, 7rem);
    line-height: 0.95;
    margin-block: 0.5rem 0.2rem;
    background: linear-gradient(95deg, #E7318B 0%, #E23A31 22%, #EE6A1F 44%, #F4A31C 64%, #86C23A 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    -webkit-text-stroke: 0.5px #fff;
    paint-order: stroke fill;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
  }

  .subword {
    display: block;
    font-family: var(--font-body);
    color: var(--cream);
    text-transform: uppercase;
    letter-spacing: 0.42em;
    font-weight: 600;
    font-size: var(--step-0);
  }

  .hero__tag {
    color: var(--cream);
    font-size: 1.2rem;
    max-width: 34ch;
    margin-top: var(--space-m);
  }

  .hero__cta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-s);
    margin-top: var(--space-l);
  }

  .scrolldown {
    position: absolute;
    left: 50%;
    bottom: 1.4rem;
    transform: translateX(-50%);
    z-index: 2;
    color: var(--cream);
    font-size: 1.6rem;
    animation: bob 1.8s ease-in-out infinite;
  }

  @keyframes bob {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, 8px); }
  }

  /* ===== BUTTONS ===== */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.85rem 1.6rem;
    border-radius: 999px;
    border: 2px solid transparent;
    transition: transform 0.2s var(--ease), background 0.2s var(--ease),
      color 0.2s var(--ease), border-color 0.2s var(--ease);
  }

  .btn--gold {
    background: var(--gold-bright);
    color: var(--blue-deep);
  }

  .btn--gold:hover {
    background: var(--gold-light);
    transform: translateY(-2px);
  }

  .btn--ghost {
    color: var(--cream);
    border-color: var(--cream);
  }

  .btn--ghost:hover {
    background: rgba(236, 231, 211, 0.14);
    transform: translateY(-2px);
  }

  /* ===== SECTION HEADINGS ===== */
  .eyebrow {
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.82rem;
    font-weight: 600;
  }

  .h-sec {
    font-family: var(--font-head);
    font-weight: 600;
    color: var(--blue-deep);
    font-size: clamp(1.9rem, 4.5vw, 3rem);
    line-height: 1.1;
    margin-top: 0.4rem;
  }

  .lead {
    color: var(--ink-soft);
    font-size: 1.1rem;
    max-width: 56ch;
    margin-top: var(--space-s);
  }

  /* ===== PAGE BANNER (interior pages) ===== */
  .page-banner {
    background: var(--blue);
    color: var(--cream);
    /* clear the fixed header + slim vertical rhythm */
    padding-block: calc(var(--header-h) + var(--space-m)) var(--space-l);
  }

  .page-banner .h-sec {
    color: var(--cream);
  }

  .page-banner .lead {
    color: rgba(236, 231, 211, 0.86);
  }

  /* ===== MENU CARDS ===== */
  .menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-top: var(--space-xl);
  }

  .card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease);
  }

  .card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
  }

  .card__img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
  }

  .card__body {
    padding: 1.25rem 1.4rem 1.5rem;
  }

  .card__title {
    font-family: var(--font-head);
    font-weight: 600;
    color: var(--blue);
    font-size: 1.25rem;
  }

  .card__price {
    float: right;
    color: var(--gold);
    font-weight: 600;
    font-family: var(--font-body);
  }

  .card__desc {
    color: var(--ink-soft);
    font-size: 0.95rem;
    margin-top: 0.4rem;
  }

  /* ===== TEXT MENU (printed-board style) ===== */
  .menu-list {
    max-width: 640px;
    margin-inline: auto;
    margin-top: var(--space-xl);
    list-style: none;
    padding: 0;
  }

  .menu-item {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding-block: 1rem;
    border-bottom: 1px solid var(--line-light, rgba(0, 43, 77, 0.12));
  }

  .menu-item:last-child {
    border-bottom: 0;
  }

  .menu-item__text {
    flex: 1 1 auto;
    min-width: 0;
  }

  .menu-item__name {
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 1.15rem;
    line-height: 1.2;
    color: var(--blue-deep);
  }

  .menu-item__desc {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--ink-soft);
  }

  /* dotted leader between name block and price */
  .menu-item__leader {
    flex: 1 1 auto;
    align-self: baseline;
    min-width: 1.5rem;
    height: 0;
    transform: translateY(-0.15em);
    border-bottom: 2px dotted rgba(0, 43, 77, 0.28);
  }

  .menu-item__price {
    flex: 0 0 auto;
    font-family: var(--font-body);
    font-weight: 600;
    color: var(--gold);
    white-space: nowrap;
  }

  /* ambiance decoration beside the text menu (home) */
  .menu-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(2rem, 5vw, 3.5rem);
    align-items: start;
    margin-top: var(--space-xl);
  }

  .menu-layout .menu-list {
    margin-top: 0;
  }

  .menu-ambiance {
    margin: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: var(--blue-deep);
  }

  .menu-ambiance img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
  }

  .menu-ambiance figcaption {
    padding: 0.85rem 1.1rem;
    color: var(--cream);
    font-size: 0.9rem;
    line-height: 1.35;
    text-align: center;
  }

  .menu-cta {
    margin-top: var(--space-xl);
    text-align: center;
  }

  /* ===== GALLERY ===== */
  .gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
    gap: 0.9rem;
    margin-top: var(--space-xl);
  }

  .gallery li {
    margin: 0;
  }

  .gallery__item {
    display: block;
    width: 100%;
    cursor: zoom-in;
    border-radius: var(--radius-sm);
    overflow: hidden;
  }

  .gallery__item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform 0.4s var(--ease);
  }

  .gallery__item:hover img {
    transform: scale(1.05);
  }

  .gallery__cap {
    display: block;
    text-align: left;
    color: var(--ink-soft);
    font-size: 0.9rem;
    line-height: 1.35;
    padding: 0.55rem 0.15rem 0.1rem;
  }

  /* ===== LIGHTBOX ===== */
  .lightbox {
    border: 0;
    background: transparent;
    max-width: min(92vw, 1100px);
    max-height: 90vh;
    margin: auto;
    color: var(--cream);
  }

  .lightbox::backdrop {
    background: rgba(0, 20, 40, 0.86);
  }

  .lightbox img {
    width: 100%;
    max-height: 82vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
  }

  .lightbox__close,
  .lightbox__prev,
  .lightbox__next {
    position: absolute;
    top: 50%;
    width: 3rem;
    height: 3rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(0, 43, 77, 0.65);
    color: var(--cream);
    font-size: 1.4rem;
    transform: translateY(-50%);
    transition: background 0.2s var(--ease);
  }

  .lightbox__close:hover,
  .lightbox__prev:hover,
  .lightbox__next:hover {
    background: var(--blue-raised);
  }

  .lightbox__prev { left: -1.5rem; }
  .lightbox__next { right: -1.5rem; }

  .lightbox__close {
    top: -1.5rem;
    right: -1.5rem;
    transform: none;
  }

  /* ===== ABOUT ===== */
  .about {
    background: var(--blue);
    color: var(--cream);
  }

  .about__split {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: center;
  }

  .about .eyebrow {
    color: var(--gold-light);
  }

  .about .h-sec {
    color: var(--cream);
  }

  .about p {
    color: rgba(236, 231, 211, 0.86);
  }

  .about__photo {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
  }

  .about__photo img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
  }

  /* ===== CTA ===== */
  .cta {
    background: var(--blue-deep);
    color: var(--cream);
    text-align: center;
  }

  .cta__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-s);
  }

  .seal {
    display: inline-block;
    flex-shrink: 0;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: url('../seal.png') center / cover no-repeat var(--blue);
    border: 3px solid var(--gold-bright);
  }

  .cta .h-sec,
  .cta p {
    color: var(--cream);
  }

  /* ===== FOOTER ===== */
  .site-footer {
    background: #04263f;
    color: var(--cream);
    padding-block: 3rem;
  }

  .footer__cols {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-l);
  }

  .site-footer h4 {
    font-size: var(--step--1);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gold-light);
    margin-bottom: 0.6rem;
  }

  .site-footer a {
    color: rgba(236, 231, 211, 0.85);
  }

  .site-footer a:hover {
    color: var(--gold-light);
  }

  .phone {
    color: var(--gold-light);
    font-weight: 600;
  }

  .foot-note {
    margin-top: var(--space-l);
    padding-top: var(--space-m);
    border-top: 1px solid rgba(236, 231, 211, 0.18);
    text-align: center;
    font-size: var(--step--1);
    color: rgba(236, 231, 211, 0.7);
  }

  /* ===== FLOATING MUSIC TOGGLE ===== */
  .music-toggle {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 30;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 0;
    display: grid;
    place-items: center;
    background: var(--gold-bright);
    color: var(--blue-deep);
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: background 0.2s var(--ease), transform 0.2s var(--ease);
  }

  .music-toggle:hover {
    background: var(--gold-light);
  }

  .music-toggle:focus-visible {
    outline: 3px solid var(--gold-bright);
    outline-offset: 3px;
  }

  .music-toggle.is-playing {
    box-shadow: 0 0 0 3px rgba(222, 154, 45, 0.4), var(--shadow-md);
    animation: music-pulse 1.8s ease-in-out infinite;
  }

  @keyframes music-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
  }
}

/* ---------- UTILITIES ---------- */
@layer utilities {
  .js-reveal-ready [data-reveal] {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  }

  .js-reveal-ready [data-reveal].in {
    opacity: 1;
    transform: none;
  }

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

/* ============================================================
   RESPONSIVE — mobile-first up
   ============================================================ */

/* Mobile nav overlay (< 900px) */
@media (max-width: 899.98px) {
  @layer components {
    .burger {
      display: inline-flex;
    }

    .nav {
      position: fixed;
      inset: 0;
      z-index: 105;
      display: flex;
      flex-direction: column;
      justify-content: center;
      background: var(--blue);
      transform: translateX(100%);
      transition: transform 0.35s var(--ease);
    }

    .nav__list {
      flex-direction: column;
      align-items: center;
      gap: var(--space-l);
    }

    .nav__link {
      font-size: var(--step-3);
    }

    .lang {
      margin-top: var(--space-s);
    }

    .nav-backdrop {
      display: block;
      position: fixed;
      inset: 0;
      z-index: 104;
      background: rgba(0, 20, 40, 0.5);
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.35s var(--ease), visibility 0.35s var(--ease);
    }

    body[data-nav-open="true"] .nav {
      transform: none;
    }

    body[data-nav-open="true"] .nav-backdrop {
      opacity: 1;
      visibility: visible;
    }

    body[data-nav-open="true"] {
      overflow: hidden;
    }
  }
}

/* Desktop nav bar (>= 900px) */
@media (min-width: 900px) {
  @layer components {
    .burger {
      display: none;
    }

    .nav {
      position: static;
      transform: none;
      background: transparent;
    }
  }
}

/* About + footer multi-column (>= 820px) */
@media (min-width: 820px) {
  @layer components {
    .about__split {
      grid-template-columns: 1.1fr 1fr;
    }

    .menu-layout {
      grid-template-columns: 0.85fr 1.15fr;
    }

    .footer__cols {
      grid-template-columns: 1.4fr 1fr 1fr;
    }
  }
}

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .scrolldown {
    animation: none;
  }
}
