/* ==========================================================================
   Responsive — Agape Labs
   Mobile-first breakpoints
   ========================================================================== */

/* --- Tablet (max-width: 1024px) --- */
@media (max-width: 1024px) {
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

  .contact-layout {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .service-detail__features {
    grid-template-columns: 1fr;
  }
}

/* --- Mobile landscape / small tablet (max-width: 768px) --- */
@media (max-width: 768px) {
  :root {
    --header-height: 4rem;
  }

  .section {
    padding-block: var(--space-16);
  }

  .section__header {
    margin-bottom: var(--space-10);
  }

  .grid--2,
  .grid--3 {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  /* Header mobile — single row */
  .header {
    padding: var(--space-2) 0;
  }

  .header--scrolled {
    padding: var(--space-2) 0;
  }

  .header__inner {
    flex-direction: row;
    justify-content: space-between;
  }

  .header__brand {
    margin-bottom: 0;
    flex-shrink: 0;
    max-height: none;
    opacity: 1;
  }

  .header--scrolled .header__brand {
    max-height: none;
    opacity: 1;
    margin: 0;
  }

  .header__logo img {
    height: 44px;
  }

  .header__bar {
    flex: 0;
    justify-content: flex-end;
    padding: 0;
  }

  .header__bar .header__actions {
    position: static;
    transform: none;
  }

  .header__nav {
    display: none;
  }

  .header__menu-btn {
    display: flex;
  }

  .mobile-nav {
    display: block;
  }

  /* Hero */
  .hero {
    padding-top: calc(var(--header-height) + var(--space-16));
    padding-bottom: var(--space-16);
  }

  .hero--home {
    padding-top: calc(var(--header-height) + var(--space-20));
    padding-bottom: var(--space-20);
  }

  .hero__actions {
    flex-direction: column;
    width: 100%;
  }

  .hero__actions .btn {
    width: 100%;
  }

  /* Process */
  .process {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  /* Contact form */
  .form__row {
    grid-template-columns: 1fr;
  }

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

  .footer__bottom {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }

  /* CTA Banner */
  .cta-banner {
    padding: var(--space-10) var(--space-6);
    border-radius: var(--radius-xl);
  }

  /* Cards */
  .card {
    padding: var(--space-6);
  }

  .service-detail {
    padding: var(--space-6);
  }
}

/* Section dividers: smaller on mobile */
@media (max-width: 768px) {
  .section--alt::after,
  .section--alt + .section::before {
    height: 32px;
    top: -32px;
  }
}

/* --- Small mobile (max-width: 480px) --- */
@media (max-width: 480px) {
  .container {
    padding-inline: var(--space-4);
  }

  h1 {
    font-size: var(--text-3xl);
  }

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

  .btn--lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-sm);
  }

  .hero--home {
    padding-top: calc(var(--header-height) + var(--space-16));
    padding-bottom: var(--space-16);
  }

  .stats {
    gap: var(--space-4);
  }

}

/* Cookie banner responsive */
@media (max-width: 768px) {
  .cookie-banner {
    left: var(--space-4);
    right: var(--space-4);
    bottom: var(--space-4);
    max-width: none;
    max-height: 85vh;
    overflow-y: auto;
  }

  .cookie-banner__actions {
    flex-direction: column;
  }

  .cookie-banner__actions .btn {
    width: 100%;
  }

  .cookie-prefs__item {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .cookie-prefs__info {
    min-width: 0;
  }
}

/* --- Chatbot responsive --- */
@media (max-width: 768px) {
  .chatbot-window {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }

  .chatbot-bubble {
    right: 1rem;
    bottom: 1rem;
  }

  .chatbot-teaser {
    right: 1rem;
    bottom: 4.5rem;
  }

  .back-to-top--shifted {
    bottom: 5rem;
  }
}

/* --- New component responsive rules --- */
@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: 1fr;
  }

  .article__sidebar {
    position: static;
  }

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

@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }

  .toast-container {
    top: var(--space-4);
    right: var(--space-4);
    left: var(--space-4);
  }

  .toast {
    min-width: 0;
    max-width: 100%;
  }

  .faq__question {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
  }

  .faq__answer-inner {
    padding: 0 var(--space-4) var(--space-4);
  }
}

/* --- New feature responsive: tablet --- */
@media (max-width: 1024px) {
  .lh-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 320px;
  }

  .comparison-table {
    font-size: var(--text-xs);
  }
}

/* --- New feature responsive: mobile --- */
@media (max-width: 768px) {
  .lh-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
    max-width: 280px;
  }

  .mf-indicator__line {
    width: 1.5rem;
  }

  .cal-header,
  .cal-row {
    grid-template-columns: 45px repeat(5, 1fr);
  }

  .cal-slot {
    padding: var(--space-1);
    font-size: 10px;
  }

  .portal-card__phases {
    flex-direction: column;
    gap: var(--space-2);
  }

}

/* --- Accessibility panel responsive --- */
@media (max-width: 768px) {
  .a11y-panel {
    width: calc(100vw - 2rem);
    left: 1rem;
    right: 1rem;
    bottom: 5rem;
  }

  .a11y-trigger {
    left: 1rem;
    bottom: 1rem;
  }
}

/* --- Premium: Cursor disabled on touch --- */
@media (hover: none) {
  .has-custom-cursor,
  .has-custom-cursor * {
    cursor: auto !important;
  }
}

@media (max-width: 768px) {
  /* Schedule calendar: hide grid, show mobile list */
  .schedule-calendar__grid {
    display: none;
  }

  .schedule-calendar__mobile-list {
    display: block;
  }

  /* Schedule service cards stack */
  .schedule-service-card {
    width: 100%;
  }

  /* Schedule summary grid to 1 col */
  .schedule-summary__grid {
    grid-template-columns: 1fr;
  }

}

/* --- Small mobile overrides (max-width: 480px) --- */
@media (max-width: 480px) {
  /* Schedule calendar slots: ensure touch targets */
  .cal-slot {
    min-height: 40px;
  }

  /* Chatbot inline calendar: tighter fit */
  .chatbot__inline-calendar {
    max-width: 260px;
    padding: var(--space-2);
  }

  /* CTA banner tighter on very small screens */
  .cta-banner {
    padding: var(--space-8) var(--space-4);
  }

  .cta-banner h2 {
    font-size: var(--text-xl);
  }
}

/* --- Capabilities Page Responsive --- */
@media (max-width: 1024px) {
  .perf-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 500px;
  }

  .scroll-counter__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .scroll-horiz__card {
    width: 240px;
    height: 160px;
  }

  .micro-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .perf-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    max-width: 360px;
  }

  .perf-gauge__svg {
    width: 64px;
    height: 64px;
  }

  .perf-gauge__value {
    font-size: var(--text-sm);
  }

  .perf-gauge__desc {
    display: none;
  }

  .before-after {
    height: 350px;
  }

  .micro-gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }

  .micro-item__demo {
    height: 130px;
  }

  .scroll-counter__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }

  .scroll-horiz__card {
    width: 220px;
    height: 140px;
  }

  .scroll-parallax__wrap {
    height: 200px;
  }

  .scroll-scale__box {
    width: 150px;
    height: 150px;
  }

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

  .scroll-stagger__card--left,
  .scroll-stagger__card--right {
    align-self: stretch;
  }

  .scroll-rotate__wrap {
    width: 150px;
    height: 150px;
  }

  .scroll-clip__inner {
    font-size: var(--text-2xl);
    padding: var(--space-12) var(--space-6);
  }

  .scroll-demo--colorshift {
    margin: 0 var(--space-4);
    padding: var(--space-12) var(--space-6);
  }

  .scroll-sticky__card {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-sm);
  }

  .theme-config {
    width: 100vw;
  }
}

@media (max-width: 480px) {
  .before-after {
    height: 280px;
  }

  .ba-mock__cards-placeholder,
  .ba-mock__cards-styled {
    display: none;
  }

  .micro-gallery {
    grid-template-columns: 1fr;
  }

  .perf-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 250px;
  }
}

/* ---------- CSS @property / WebGPU / AI Palette Responsive ---------- */

/* Mobile */
@media (max-width: 768px) {
  .cssprop-grid {
    grid-template-columns: 1fr;
  }

  .cssprop-card__demo {
    height: 120px;
  }

  .webgpu-demo__canvas-wrap {
    height: 280px;
  }

  .webgpu-demo__controls {
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    flex-direction: column;
    align-items: flex-start;
  }

  .webgpu-demo__range {
    width: 100px;
  }

}

@media (max-width: 480px) {
  .webgpu-demo__canvas-wrap {
    height: 220px;
  }

  .webgpu-demo__stats {
    flex-wrap: wrap;
    gap: 4px;
  }

}

/* ---------- Animation Lab Responsive ---------- */

/* Tablet */
@media (max-width: 1024px) {
  .anim-lab__layout {
    grid-template-columns: 1fr;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .anim-lab {
    padding: var(--space-4);
  }

  .anim-lab__stage {
    min-height: 220px;
  }

  .anim-lab__card {
    width: 200px;
    padding: var(--space-4);
  }

  .anim-lab__export-tabs {
    flex-wrap: wrap;
  }

  .fluid-demo__canvas-wrap {
    height: 320px;
  }

  .fluid-demo__controls {
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
  }

  .fluid-demo__range {
    width: 80px;
  }

  .fluid-demo__clear {
    margin-left: 0;
    width: 100%;
  }
}

/* --- Large screens (min-width: 1440px) --- */
@media (min-width: 1440px) {
  .container {
    max-width: 1320px;
  }
}
