/* ==========================================================================
   RESPONSIVE.CSS — Sagra San Giuseppe
   Mobile-first breakpoints, responsive grid overrides, accessibility
   preferences, and print styles.
   ========================================================================== */

/* ==========================================================================
   DEFAULT (Mobile — < 576px)
   ==========================================================================
   Mobile-first base: grids collapse to 1 column, hero content gets
   extra padding, headings scale down, stacked layouts.
   ========================================================================== */

/* Grids — all single column on mobile */
.grid--2,
.grid--3,
.grid--4 {
  grid-template-columns: 1fr;
}

/* Hero — tighter padding on small screens */
.hero__content {
  padding: var(--space-2xl) var(--container-padding);
}

.hero--full {
  min-height: 90vh;
  min-height: 90dvh;
}

/* Headliner — stacked on mobile */
.headliner {
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  text-align: center;
}

.headliner__image-wrap {
  max-width: 300px;
  margin: 0 auto;
}

/* Gallery full grid — 1 column on mobile */
.gallery-grid {
  grid-template-columns: 1fr;
}

.gallery-grid__item--wide {
  grid-column: span 1;
}

.gallery-grid__item--tall {
  grid-row: span 1;
  aspect-ratio: 4 / 3;
}

/* Footer — stacked on mobile */
.site-footer__grid {
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

.site-footer__about {
  max-width: 100%;
}

.site-footer__bottom {
  flex-direction: column;
  text-align: center;
}

/* Festa dei Fiori badge — nascosto su mobile */
.schedule-tab__badge {
  display: none;
}

/* Schedule event — stacked on mobile */
.schedule-event {
  grid-template-columns: 1fr;
}

.schedule-event__time {
  font-size: var(--text-base);
  margin-bottom: 2px;
}

/* Card horizontal — stacked on mobile */
.card--horizontal {
  grid-template-columns: 1fr;
}

.card--horizontal .card__image {
  aspect-ratio: 16 / 10;
}

/* Countdown — smaller circles on mobile */
.countdown__unit {
  width: 72px;
  height: 72px;
}

.countdown__digit {
  font-size: var(--text-xl);
}

/* Stats counter — tighter gap */
.stats-counter {
  gap: var(--space-lg);
}

.stats-counter__circle {
  width: 80px;
  height: 80px;
}

/* Header — show hamburger, hide desktop nav */
.site-header__hamburger {
  display: flex;
}

.site-header__nav {
  display: none;
}

.site-header__mobile-nav {
  display: flex;
}

/* Hero dates — stack on mobile if long */
.hero__dates {
  flex-direction: column;
  gap: var(--space-xs);
}

.hero__dates-divider {
  display: none;
}

/* Lightbox arrows — smaller on mobile */
.gallery-lightbox__nav {
  width: 40px;
  height: 40px;
}

.gallery-lightbox__nav--prev {
  left: var(--space-sm);
}

.gallery-lightbox__nav--next {
  right: var(--space-sm);
}


/* ==========================================================================
   SMALL (>= 576px)
   ========================================================================== */

@media (min-width: 576px) {

  /* Minor adjustments for slightly larger phones */
  .hero__dates {
    flex-direction: row;
    gap: var(--space-md);
  }

  .hero__dates-divider {
    display: inline-block;
  }

  /* Stats — side by side in pairs */
  .stats-counter {
    gap: var(--space-xl);
  }

  .stats-counter__circle {
    width: 90px;
    height: 90px;
  }

  /* Countdown circles — closer to desktop size */
  .countdown__unit {
    width: 80px;
    height: 80px;
  }

  /* Gallery full grid — 2 columns */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-grid__item--wide {
    grid-column: span 2;
  }
}


/* ==========================================================================
   MEDIUM / TABLET (>= 768px)
   ========================================================================== */

@media (min-width: 768px) {

  /* Grids become 2 columns */
  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Headliner — side by side */
  .headliner {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }

  .headliner__image-wrap {
    max-width: 100%;
    margin: 0;
  }

  /* Hero — restore full height */
  .hero--full {
    min-height: 100vh;
    min-height: 100dvh;
  }

  /* Footer — 2 columns */
  .site-footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
  }

  .site-footer__bottom {
    flex-direction: row;
    text-align: left;
  }

  /* Festa dei Fiori badge — visibile su tablet+ */
  .schedule-tab__badge {
    display: inline-block;
  }

  /* Schedule event — restore grid on desktop */
  .schedule-event {
    grid-template-columns: 55px 1fr;
  }

  .schedule-event__time {
    font-size: var(--text-lg);
    margin-bottom: 0;
  }

  /* Card horizontal — restore */
  .card--horizontal {
    grid-template-columns: 200px 1fr;
  }

  .card--horizontal .card__image {
    aspect-ratio: auto;
    height: 100%;
  }

  /* Countdown — restore full size */
  .countdown__unit {
    width: 90px;
    height: 90px;
  }

  .countdown__digit {
    font-size: var(--text-2xl);
  }

  /* Stats counter — full size */
  .stats-counter__circle {
    width: 100px;
    height: 100px;
  }
}


/* ==========================================================================
   LARGE / DESKTOP (>= 1024px)
   ========================================================================== */

@media (min-width: 1024px) {

  /* Grids — 3 and 4 columns at desktop */
  .grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid--4 {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Header — show desktop nav, hide hamburger */
  .site-header__nav {
    display: flex;
  }

  .site-header__hamburger {
    display: none;
  }

  .site-header__mobile-nav {
    display: none !important;
  }

  /* Footer — full 4-column grid */
  .site-footer__grid {
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
  }

  /* Gallery full grid — 3 columns */
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .gallery-grid__item--wide {
    grid-column: span 2;
  }

  .gallery-grid__item--tall {
    grid-row: span 2;
    aspect-ratio: 3 / 4;
  }

  /* Hero scroll indicator — show on desktop */
  .hero__scroll {
    display: flex;
  }
}


/* ==========================================================================
   EXTRA LARGE (>= 1280px)
   ========================================================================== */

@media (min-width: 1280px) {

  /* Container max widths — enforce ceiling */
  .container {
    max-width: var(--container-default);
  }

  .container--wide {
    max-width: var(--container-wide);
  }

  .container--narrow {
    max-width: var(--container-narrow);
  }

  /* Slightly larger grid gaps */
  .grid {
    gap: var(--space-xl);
  }

  /* Headliner — bigger gap */
  .headliner {
    gap: var(--space-3xl);
  }
}


/* ==========================================================================
   ACCESSIBILITY — Reduced Motion
   ==========================================================================
   Respects user preference for reduced motion by disabling
   transitions, animations, and scroll behavior.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

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

  /* Reveal elements are immediately visible */
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .bloom {
    opacity: 1;
    transform: none;
    transition: none;
  }

  /* Disable hover transforms */
  .card:hover,
  .food-card:hover,
  .lineup-card:hover,
  .schedule-event:hover {
    transform: none;
  }

  /* Disable hero scroll bounce */
  .hero__scroll-icon {
    animation: none;
  }

  /* Disable page loader petal animation */
  .page-loader__petal {
    animation: none;
    opacity: 0.6;
  }

  /* Disable floating/swaying decorations */
  .anim-float,
  .anim-sway,
  .anim-pulse {
    animation: none;
  }
}


/* ==========================================================================
   ACCESSIBILITY — High Contrast
   ========================================================================== */

@media (prefers-contrast: high) {

  .btn--primary {
    border: 2px solid var(--color-soil);
  }

  .btn--outline {
    border-width: 3px;
  }

  .card {
    border: 1px solid var(--color-bark);
  }

  .schedule-event {
    border-bottom: 2px solid var(--color-bark);
  }

  .form-input,
  .form-textarea {
    border-width: 2px;
    border-color: var(--color-bark);
  }
}


/* ==========================================================================
   PRINT STYLES
   ==========================================================================
   Clean print output: remove backgrounds, shadows, decorative elements.
   Ensure good readability on paper.
   ========================================================================== */

@media print {

  /* Remove fixed/sticky elements */
  .site-header,
  .page-loader,
  .hero__scroll,
  .gallery-lightbox {
    display: none !important;
  }

  /* Reset backgrounds to white */
  body {
    background: white;
    color: black;
    font-size: 12pt;
  }

  .section,
  .section--petal,
  .section--soil,
  .section--cream {
    background: white !important;
    color: black !important;
    padding: 1rem 0;
  }

  .section--soil h1,
  .section--soil h2,
  .section--soil h3,
  .section--soil h4,
  .section--soil .section__title {
    color: black !important;
  }

  .section--soil p,
  .section--soil .section__subtitle {
    color: #333 !important;
  }

  /* Remove shadows */
  .card,
  .food-card,
  .lineup-card,
  .info-card {
    box-shadow: none;
    border: 1px solid #ccc;
  }

  /* Remove decorative elements */
  .section-divider,
  .site-footer__vine {
    display: none !important;
  }

  /* Show URLs for links */
  .content a[href]::after,
  .prose a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  /* Hero — simplified print version */
  .hero {
    min-height: auto !important;
    background: white !important;
    padding: 2rem 0;
  }

  .hero__overlay,
  .hero__background,
  .hero__petals,
  #hero-petals {
    display: none !important;
  }

  .hero__title {
    color: black !important;
    text-shadow: none !important;
    font-size: 24pt;
  }

  .hero__subtitle,
  .hero__dates,
  .hero__location {
    color: #333 !important;
  }

  /* Footer — simplified */
  .site-footer {
    background: white !important;
    color: black !important;
    border-top: 2px solid #ccc;
    padding: 1rem 0;
  }

  .site-footer__column-title {
    color: black !important;
  }

  .site-footer__link,
  .site-footer__description,
  .site-footer__copyright {
    color: #333 !important;
  }

  /* Avoid page breaks inside cards */
  .card,
  .food-card,
  .schedule-event,
  .info-card {
    break-inside: avoid;
  }

  /* Page breaks before major sections */
  .section {
    break-before: auto;
  }
}
