/* ==========================================================================
   CafeHub — responsive.css
   Breakpoints: 1440 · 1200 · 1024 · 900 · 768 · 640 · 480 · 390 · 360
   Loaded after style.css so it can override layout.
   ========================================================================== */

/* 1440px — keep generous gutters on very wide screens ------------------- */
@media (max-width: 1440px) {
  :root {
    --container: 1180px;
  }
}

/* 1200px — tighten large desktop grids ---------------------------------- */
@media (max-width: 1200px) {
  :root {
    --container: 1040px;
    --header-h: 72px;
  }
  .footer-grid {
    grid-template-columns: 1.3fr 1fr 1fr;
    row-gap: var(--sp-7);
  }
  .footer-grid > .footer-newsletter {
    grid-column: 1 / -1;
  }
}

/* 1280px — keep the desktop header from crowding --------------------------- */
@media (max-width: 1280px) {
  .header-actions .only-lg {
    display: none;
  }
}

/* 1140px — trim header actions progressively ------------------------------- */
@media (max-width: 1140px) {
  /* The full desktop bar (brand + 6 nav links + all utility controls) is at
     its tightest here; a smaller gutter keeps real slack instead of relying
     on the page gutter to absorb a few overflowing pixels. */
  .header-inner {
    gap: var(--sp-4);
  }
  .header-actions .lang-switch {
    display: none;
  }
  .header-actions .btn-dark {
    padding-inline: 0.75rem;
  }
  .header-actions .btn-dark [data-account-label] {
    display: none;
  }
  .nav a {
    padding-inline: 0.7rem;
  }
}

/* 1024px — small desktop / large tablet ---------------------------------- */
@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-7);
  }
  .hero-visual {
    max-width: 520px;
    order: -1;
  }
  .hero-visual .hero-img {
    aspect-ratio: 5 / 4;
    border-radius: var(--r-xl);
  }
  .about-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-7);
  }
  .steps-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cart-layout,
  .checkout-layout,
  .profile-layout,
  .reserve-layout,
  .admin-split,
  .admin-split-even,
  .profile-shell,
  .contact-grid {
    /* minmax(0, 1fr) — a bare 1fr still refuses to shrink below the widest
       child's min-content width, which overflows the page on small screens. */
    grid-template-columns: minmax(0, 1fr);
  }
  .summary {
    position: static;
  }
  .side-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: var(--sp-2);
    scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar {
    display: none;
  }
  .side-nav .side-nav-label {
    display: none;
  }
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .admin-side {
    position: fixed;
    inset: 0 auto 0 0;
    width: 262px;
    z-index: 96;
    transform: translateX(-100%);
    transition: transform var(--t-base);
  }
  html[dir="rtl"] .admin-side {
    inset: 0 0 0 auto;
    transform: translateX(100%);
  }
  .admin-side.is-open {
    transform: none;
    box-shadow: var(--sh-lg);
  }
  /* RTL-aware override: the html[dir="rtl"] rule above is more specific
     than .admin-side.is-open, so the open state has to be restated. */
  html[dir="rtl"] .admin-side.is-open {
    transform: none;
  }
  .admin-toggle {
    display: grid;
  }
  .auth-wrap {
    grid-template-columns: 1fr;
  }
  .auth-aside {
    min-height: 260px;
  }
  .auth-aside blockquote {
    margin-top: var(--sp-5);
  }
  .offer-banner {
    grid-template-columns: 1fr;
  }
  .offer-banner .ob-media {
    order: -1;
    min-height: 240px;
  }
}

/* 1000px — collapse main navigation to the hamburger menu ---------------- */
@media (max-width: 1000px) {
  .nav {
    display: none;
  }
  /* The desktop nav also carried the header's centring (.nav has
     `margin-inline: auto`), so once it is gone the utility cluster has to be
     pushed to the trailing edge by itself — otherwise the brand and the
     buttons bunch up on one side and leave a gap on the other. */
  .header-actions {
    margin-inline-start: auto;
  }
  .hamburger {
    display: grid;
  }
  .header-actions .hide-md {
    display: none;
  }
  .gallery-strip {
    grid-template-columns: repeat(3, 1fr);
  }
  .gallery-item:nth-child(1),
  .gallery-item:nth-child(6) {
    grid-column: span 2;
    grid-row: span 1;
  }
  .menu-toolbar {
    position: static;
  }
  .product-list .product-card {
    flex-direction: column;
  }
  .product-list .product-card .media {
    width: 100%;
    aspect-ratio: 5 / 4;
    min-height: 0;
  }
  .timeline-step::before {
    display: none;
  }
}

/* 768px — tablet --------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --sp-9: 4rem;
    --sp-8: 3rem;
    --header-h: 66px;
    --fs-2xl: 1.9rem;
  }
  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .section-head {
    align-items: flex-start;
  }
  .section-head .section-title {
    max-width: 100%;
  }
  .hero-stats {
    gap: var(--sp-5);
    margin-top: var(--sp-6);
  }
  .hero-badge {
    display: none;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .order-card {
    grid-template-columns: 1fr;
    gap: var(--sp-3);
  }
  .order-card > *:last-child {
    justify-content: flex-start;
  }
  .offer-banner .ob-body {
    padding: var(--sp-6) var(--sp-5);
  }
  .data-table {
    min-width: 560px;
  }
  /* Seven labelled bars cannot fit a phone width: scroll the chart inside its
     own panel instead of letting it stretch the page. */
  .bar-chart {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: var(--sp-2);
  }
  .bottom-nav {
    display: grid;
  }
  body {
    padding-bottom: 78px;
  }
  body.has-bottom-nav .footer {
    padding-bottom: var(--sp-7);
  }
  .floating-cart,
  .to-top {
    bottom: 90px;
  }
  .qr-bar {
    bottom: 78px;
  }
  /* the QR page has its own sticky order bar instead of the floating cart */
  body[data-page="qr-menu"] .floating-cart {
    display: none;
  }
  body[data-page="qr-menu"] {
    padding-bottom: 78px;
  }
  .to-top {
    display: none;
  }
  .quick-order {
    bottom: 90px;
    inset-inline-start: 16px;
  }
  .toast-wrap {
    bottom: 92px;
  }
  .admin-main {
    padding: var(--sp-5) var(--sp-4);
  }
  .admin-toggle {
    bottom: 88px;
  }
  .cart-item {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: var(--sp-3);
  }
  .cart-item .ci-price {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-align: start;
  }
  .drawer {
    width: 100%;
  }
  .modal {
    padding: 0;
    align-items: flex-end;
  }
  .modal-box,
  .modal-lg .modal-box {
    width: 100%;
    max-height: 92vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
  .search-overlay {
    padding-top: var(--sp-5);
  }
  .so-close {
    top: var(--sp-4);
    inset-inline-end: var(--sp-4);
  }
}

/* 640px — large phone ---------------------------------------------------- */
@media (max-width: 640px) {
  .container,
  .container-narrow {
    width: min(100% - 1.75rem, var(--container));
  }
  .grid-4,
  .grid-3,
  .grid-2,
  .grid-auto {
    grid-template-columns: 1fr;
  }
  .hero-cta .btn {
    flex: 1 1 100%;
  }
  .hero-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-4);
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .steps-flow {
    grid-template-columns: 1fr;
  }
  .step-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--sp-4);
    align-items: center;
    padding: var(--sp-5);
  }
  .step-num {
    margin: 0;
    font-size: 2rem;
  }
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .table-map {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--sp-3);
  }
  .order-timeline {
    grid-template-columns: 1fr;
    gap: var(--sp-5);
    text-align: start;
  }
  .timeline-step {
    flex-direction: row;
    text-align: start;
    gap: var(--sp-4);
  }
  .timeline-step::before {
    display: block;
    top: 56px;
    inset-inline-start: 27px;
    width: 2px;
    height: calc(100% + var(--sp-5) - 12px);
  }
  .timeline-dot {
    flex: none;
  }
  .timeline-step .ts-text {
    display: flex;
    flex-direction: column;
  }
  .stepper {
    gap: var(--sp-1);
  }
  .step-pill {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--fs-xs);
  }
  .step-pill span.sp-label {
    display: none;
  }
  .step-sep {
    width: 12px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-5);
  }
  .footer {
    padding-block: var(--sp-7) var(--sp-5);
  }
  .newsletter-form {
    flex-direction: column;
  }
  .social-row {
    grid-template-columns: 1fr;
  }
  .auth-wrap {
    display: block;
  }
  .auth-aside {
    display: none;
  }
  .modal-foot {
    flex-direction: column-reverse;
  }
  .modal-foot .btn {
    width: 100%;
  }
  .cart-item {
    grid-template-columns: 64px minmax(0, 1fr);
    padding: var(--sp-3);
  }
  .gallery-grid .gallery-item.wide {
    grid-column: span 1;
  }
  .gallery-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .bar-chart {
    height: 150px;
    gap: var(--sp-2);
  }
  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

/* 480px — small phone ---------------------------------------------------- */
@media (max-width: 480px) {
  :root {
    --fs-4xl: 2.15rem;
    --sp-9: 3.25rem;
  }
  .hero {
    padding-block: var(--sp-7);
  }
  .hero-stats {
    gap: var(--sp-3);
  }
  .hero-visual .hero-img {
    aspect-ratio: 1;
  }
  .brand-mark {
    width: 36px;
    height: 36px;
  }
  .brand-name {
    font-size: 1.15rem;
  }
  .brand-tag {
    display: none;
  }
  .header-actions .btn-icon {
    width: 38px;
    height: 38px;
  }
  .hamburger {
    width: 38px;
    height: 38px;
  }
  .marquee-track span {
    font-size: var(--fs-base);
  }
  .floating-cart {
    inset-inline: 16px;
    bottom: 84px;
    justify-content: center;
  }
  .quick-order {
    display: none;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
  .coupon {
    flex-direction: column;
    align-items: flex-start;
  }
  .empty-state {
    padding: var(--sp-6) var(--sp-4);
  }
  .empty-state .es-icon {
    width: 68px;
    height: 68px;
  }
  .empty-state .es-icon svg {
    width: 30px;
    height: 30px;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .time-slots {
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  }
  .toolbar-group {
    width: 100%;
  }
  .toolbar-group select {
    flex: 1;
    min-width: 0;
  }
  .btn-lg {
    padding: 0.9rem 1.4rem;
    min-height: 50px;
  }
}

/* 390px — iPhone 12/13/14 ------------------------------------------------- */
@media (max-width: 390px) {
  .container,
  .container-narrow {
    width: min(100% - 1.25rem, var(--container));
  }
  .section {
    padding-block: var(--sp-8);
  }
  .header-inner {
    gap: var(--sp-3);
  }
  .floating-cart .fc-text strong {
    font-size: var(--fs-xs);
  }
  .bottom-nav a {
    /* keep the labels at the base size — shrinking them further hurts legibility */
    font-size: 0.66rem;
  }
  .table-map {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  }
  .stat-grid {
    grid-template-columns: 1fr;
  }
  .chip {
    padding: 0.45rem 0.85rem;
    font-size: var(--fs-xs);
  }
  .qty button {
    width: 32px;
    height: 34px;
  }
  .qty output {
    width: 34px;
  }
}

/* 360px — smallest supported width --------------------------------------- */
@media (max-width: 360px) {
  .brand-text {
    display: none;
  }
  .hero-title .line {
    font-size: 1.95rem;
  }
  .btn {
    padding: 0.7rem 1.1rem;
    font-size: var(--fs-xs);
  }
  .avatar-lg {
    width: 58px;
    height: 58px;
  }
  .time-slots {
    grid-template-columns: repeat(2, 1fr);
  }
  .toast-wrap {
    width: min(100% - 1rem, 390px);
  }
}
