/**
 * Khokan's Moa — Site-wide mobile-first layout
 * Loaded last so it overrides legacy style.css / responsive.css.
 * Focus: phones first (320–767), then tablets (768–991).
 */

/* ═══════════════════════════════════════════════════════════════
   Global mobile-first foundations
   ═══════════════════════════════════════════════════════════════ */
:root {
  --km-section-py: clamp(2.75rem, 7vw, 6rem);
}

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

.theme-khokans .container-fluid {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding-left: var(--km-page-gutter);
  padding-right: var(--km-page-gutter);
}

/* Touch-friendly controls */
.theme-khokans .btn,
.theme-khokans button[type="submit"],
.theme-khokans input[type="submit"],
.theme-khokans input[type="button"],
.theme-khokans .cart__summary--footer__btn,
.theme-khokans .continue__shipping--btn,
.theme-khokans .account__login--btn,
.theme-khokans .wishlist__cart--btn {
  min-height: 44px;
}

.theme-khokans input,
.theme-khokans select,
.theme-khokans textarea {
  font-size: 16px; /* prevents iOS zoom on focus */
}

.theme-khokans .section__heading--maintitle,
.theme-khokans .section__heading3--maintitle,
.theme-khokans .cart__title,
.theme-khokans .account__content--title {
  word-break: break-word;
  max-width: 100%;
}

/* Breadcrumb common */
.theme-khokans .breadcrumb__content--title {
  word-break: break-word;
}

.theme-khokans .breadcrumb__content--menu {
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
}

/* Generic flex rows that often overflow on phones */
.theme-khokans .continue__shopping,
.theme-khokans .cart__summary--footer ul,
.theme-khokans .product__variant .quantity {
  max-width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   Header / drawers / sticky toolbar (extra safety)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 991px) {
  .theme-khokans .km-header__main-inner {
    gap: 0.5rem;
    min-height: 4.6rem;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
  }

  .theme-khokans .km-header,
  .theme-khokans.home-page .km-header {
    top: 0 !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  .theme-khokans .km-header__topbar {
    display: none !important;
    height: 0 !important;
    max-height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    visibility: hidden !important;
  }

  .theme-khokans .km-header__main {
    margin-top: 0 !important;
    border-top: 0;
    padding-top: env(safe-area-inset-top, 0px);
  }

  .theme-khokans .offcanvas__header {
    width: min(100vw - 2.5rem, 32rem);
    max-width: 100%;
  }

  .theme-khokans .predictive__search--box {
    width: 100%;
    max-width: 100%;
    left: 0;
    right: 0;
    padding-left: var(--km-page-gutter);
    padding-right: var(--km-page-gutter);
  }

  .theme-khokans .predictive__search--box form,
  .theme-khokans .predictive__search--form {
    width: 100%;
    max-width: 100%;
  }

  .theme-khokans .minicart {
    width: min(100vw - 1rem, 36rem);
    max-width: 100%;
  }

  /* Keep the sticky tab bar above the viewport edge and fully readable */
  .theme-khokans .offcanvas__stikcy--toolbar {
    display: block !important;
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0 !important;
    z-index: 1000;
    height: auto !important;
    min-height: var(--km-sticky-toolbar-h, 6.4rem);
    padding: 0.45rem 0.4rem calc(0.75rem + env(safe-area-inset-bottom, 0px)) !important;
    overflow: visible !important;
  }

  .theme-khokans .offcanvas__stikcy--toolbar__label {
    overflow: visible !important;
    line-height: 1.2 !important;
  }
}

@media (max-width: 575px) {
  .theme-khokans .breadcrumb__bg {
    min-height: 0;
    padding: 2rem 0 1.5rem;
  }

  .theme-khokans .breadcrumb__content--title {
    font-size: clamp(1.7rem, 6.5vw, 2.3rem);
    margin-bottom: 0.75rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Home — sections that use Bootstrap grids / carousels
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .theme-khokans .section__heading--subtitle {
    font-size: clamp(1.25rem, 3.4vw, 1.5rem);
    letter-spacing: 0.1em;
  }

  .theme-khokans .km-home-products .section__heading,
  .theme-khokans .km-rated-products .section__heading,
  .theme-khokans .km-home-blog .section__heading,
  .theme-khokans .km-home-reviews .section__heading,
  .theme-khokans .km-features .section__heading,
  .theme-khokans .product__section .section__heading3 {
    text-align: center;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  .theme-khokans .product__section--inner,
  .theme-khokans .product3__section--inner__padding {
    padding-left: 0;
    padding-right: 0;
  }

  .theme-khokans .row.row-cols-2 {
    --bs-gutter-x: 0.75rem;
    --bs-gutter-y: 0.75rem;
  }

  .theme-khokans .section__heading--maintitle,
  .theme-khokans .km-section-head .section__heading--maintitle {
    font-size: clamp(2.15rem, 6.2vw, 2.8rem);
  }
}

@media (max-width: 400px) {
  .theme-khokans .km-traditional-way__values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.15rem 0.65rem;
  }

  .theme-khokans .km-traditional-way__value {
    max-width: none;
  }
}

/* Cart — card layout instead of wide table on phones */
@media (max-width: 991px) {
  .theme-khokans .cart__section .container-fluid {
    padding-left: var(--km-page-gutter);
    padding-right: var(--km-page-gutter);
  }

  .theme-khokans .cart__title {
    font-size: clamp(1.7rem, 5vw, 2.2rem);
    margin-bottom: 1.5rem !important;
    text-align: left;
  }

  .theme-khokans .cart__summary {
    margin-top: 1.5rem;
    padding: 1.25rem 1rem;
  }

  .theme-khokans .cart__table {
    overflow: visible;
  }

  .theme-khokans .cart__table .cart__table--inner {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }

  .theme-khokans .cart__table .cart__table--header {
    display: none;
  }

  .theme-khokans .cart__table .cart__table--body {
    display: block;
  }

  .theme-khokans .cart__table .cart__table--body__items {
    display: grid !important;
    gap: 0.65rem 0.75rem;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.85rem;
    background: #fdf8ee;
    border: 1px solid #e6dfd1;
    border-radius: 12px;
    flex-direction: unset !important;
  }

  .theme-khokans .cart__table .cart__table--body__list {
    display: block !important;
    justify-content: flex-start !important;
    padding: 0 !important;
    border-bottom: 0 !important;
  }

  /* Shopping cart (product / price / qty / total) */
  .theme-khokans .km-cart-table .cart__table--body__items {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "product product"
      "price qty"
      "total total";
  }

  .theme-khokans .km-cart-table .cart__table--body__items > .cart__table--body__list:nth-child(1) {
    grid-area: product;
  }

  .theme-khokans .km-cart-table .cart__table--body__items > .cart__table--body__list:nth-child(2) {
    grid-area: price;
  }

  .theme-khokans .km-cart-table .cart__table--body__items > .cart__table--body__list:nth-child(3) {
    grid-area: qty;
    justify-self: end;
  }

  .theme-khokans .km-cart-table .cart__table--body__items > .cart__table--body__list:nth-child(4) {
    grid-area: total;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center;
    padding-top: 0.65rem !important;
    border-top: 1px dashed #e6dfd1 !important;
  }

  .theme-khokans .km-cart-table .cart__table--body__items > .cart__table--body__list:nth-child(4)::before {
    content: "Line total";
    font-size: 1.2rem;
    color: var(--km-brown-light);
    font-weight: 500;
  }

  /* Wishlist (product / price / stock / add) */
  .theme-khokans .km-wishlist-table .cart__table--body__items {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "product product"
      "price stock"
      "cart cart";
  }

  .theme-khokans .km-wishlist-table .cart__table--body__items > .cart__table--body__list:nth-child(1) {
    grid-area: product;
  }

  .theme-khokans .km-wishlist-table .cart__table--body__items > .cart__table--body__list:nth-child(2) {
    grid-area: price;
  }

  .theme-khokans .km-wishlist-table .cart__table--body__items > .cart__table--body__list:nth-child(3) {
    grid-area: stock;
    justify-self: end;
    text-align: right;
  }

  .theme-khokans .km-wishlist-table .cart__table--body__items > .cart__table--body__list:nth-child(4) {
    grid-area: cart;
    padding-top: 0.65rem !important;
    border-top: 1px dashed #e6dfd1 !important;
  }

  .theme-khokans .cart__product {
    min-width: 0;
    gap: 0.5rem;
  }

  .theme-khokans .cart__thumbnail {
    max-width: 5.5rem;
    flex-shrink: 0;
  }

  .theme-khokans .cart__thumbnail img {
    width: 100%;
    height: auto;
    display: block;
  }

  .theme-khokans .cart__content {
    padding-left: 0.5rem;
    min-width: 0;
  }

  .theme-khokans .cart__content--title {
    font-size: 1.35rem;
    line-height: 1.35;
    word-break: break-word;
  }

  .theme-khokans .cart__remove--btn {
    flex-shrink: 0;
  }

  .theme-khokans .continue__shopping {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.75rem;
    margin-top: 0.5rem;
  }

  .theme-khokans .continue__shopping--link {
    text-align: center;
  }

  .theme-khokans .coupon__code--field {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .theme-khokans .coupon__code--field label {
    width: 100%;
  }

  .theme-khokans .coupon__code--field__input {
    width: 100%;
  }

  .theme-khokans .coupon__code--field__btn {
    width: 100%;
    margin-left: 0 !important;
  }

  .theme-khokans .cart__summary--footer ul {
    flex-direction: column;
    gap: 0.65rem;
  }

  .theme-khokans .cart__summary--footer ul li {
    width: 100%;
  }

  .theme-khokans .cart__summary--footer__btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .theme-khokans .cart__summary--total__table {
    width: 100%;
  }

  .theme-khokans .cart__price {
    font-weight: 600;
    color: var(--km-maroon);
  }

  .theme-khokans .wishlist__cart--btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Login / register / forgot password
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 991px) {
  .theme-khokans .login__section--inner .row {
    --bs-gutter-y: 1.5rem;
  }

  .theme-khokans .account__login,
  .theme-khokans .account__login.register {
    width: 100%;
    max-width: 100%;
    padding: 1.5rem 1.15rem;
    margin: 0;
  }

  .theme-khokans .account__login--input {
    width: 100%;
  }

  .theme-khokans .account__login--btn {
    width: 100%;
  }

  .theme-khokans .account__login--remember__forgot {
    flex-wrap: wrap;
    gap: 0.65rem;
  }

  .theme-khokans .account__login--forgot {
    white-space: normal;
    text-align: left;
  }
}

@media (max-width: 575px) {
  .theme-khokans .login__section {
    margin-bottom: 2rem !important;
  }

  .theme-khokans .account__login--header__title {
    font-size: clamp(1.6rem, 5vw, 2rem);
  }

  .theme-khokans .account__login--header__desc {
    font-size: 1.3rem;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Account area (profile, order details, dashboard)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 991px) {
  .theme-khokans .my__account--section__inner {
    flex-direction: column;
    padding: 1.35rem 1rem;
    gap: 0;
  }

  .theme-khokans .account__left--sidebar {
    width: 100%;
    max-width: 100%;
    padding: 0 0 1.25rem;
    margin: 0 0 1.25rem;
    border-right: 0;
    border-bottom: 1px solid #e6dfd1;
  }

  .theme-khokans .account__wrapper {
    width: 100%;
    max-width: 100%;
  }

  .theme-khokans .account__menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .theme-khokans .account__menu--list {
    margin: 0;
  }

  .theme-khokans .account__menu--list a {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.85rem;
    border: 1px solid #e6dfd1;
    border-radius: 8px;
    background: #fdf8ee;
    font-size: 1.25rem;
    line-height: 1.2;
    white-space: nowrap;
  }

  .theme-khokans .account__menu--list.active a {
    background: var(--km-maroon);
    border-color: var(--km-maroon);
    color: #fff;
  }

  .theme-khokans .account__table--area .table-responsive,
  .theme-khokans .account__table--area .table-main {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .theme-khokans .account__table--area .table {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 767px) {
  /* Order details: stack customer / order meta panels */
  .theme-khokans .account__table--area .table:first-of-type tr {
    display: flex;
    flex-direction: column;
  }

  .theme-khokans .account__table--area .table:first-of-type td {
    display: block;
    width: 100%;
    padding: 0.85rem 0;
    border: 0;
  }

  .theme-khokans .account__table--area .table:first-of-type td + td {
    border-top: 1px dashed #e6dfd1;
  }

  .theme-khokans .account__table--area .table:first-of-type h2 {
    font-size: 1.45rem;
    margin-bottom: 0.5rem;
  }

  /* Line items table: keep horizontal scroll but tighter */
  .theme-khokans .account__table--area .table:not(:first-of-type) {
    min-width: 30rem;
  }

  .theme-khokans .profile form .checkout__input--field,
  .theme-khokans .my__account--section .checkout__input--field,
  .theme-khokans .section__shipping--address__content .checkout__input--field {
    width: 100%;
  }

  /* Dashboard order history as cards */
  .theme-khokans .account__table {
    display: block;
    overflow: visible;
    min-width: 0;
  }

  .theme-khokans .account__table .account__table--header {
    display: none;
  }

  .theme-khokans .account__table .account__table--body,
  .theme-khokans .account__table tbody {
    display: block;
  }

  .theme-khokans .account__table .account__table--body__child {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #fdf8ee;
    border: 1px solid #e6dfd1;
    border-radius: 12px;
  }

  .theme-khokans .account__table .account__table--body__child--items {
    display: block;
    padding: 0;
    border: 0;
    font-size: 1.3rem;
    word-break: break-word;
  }

  .theme-khokans .account__table .account__table--body__child--items:nth-child(1) {
    grid-column: 1 / -1;
    font-size: 1.4rem;
  }

  .theme-khokans .account__table .account__table--body__child--items:nth-child(4) {
    text-align: right;
    font-weight: 700;
    color: var(--km-maroon);
  }

  .theme-khokans .account__welcome--text {
    font-size: 1.35rem;
    margin-bottom: 1rem;
    word-break: break-word;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Shop / blog / contact / story extras
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 991px) {
  .theme-khokans .km-shop-sidebar {
    padding: 1.15rem 1rem;
  }

  .theme-khokans .km-blog-layout {
    gap: 1.75rem;
  }

  .theme-khokans .km-contact-section .row > [class*="col-"] {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 575px) {
  .theme-khokans .km-shop-banner,
  .theme-khokans .km-blog-banner,
  .theme-khokans .km-story-hero,
  .theme-khokans .km-contact-hero {
    min-height: 0;
  }

  .theme-khokans .km-shop-pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
  }

  .theme-khokans .km-blog-banner {
    min-height: 0;
    padding: 2.75rem 0;
  }

  .theme-khokans h1.km-blog-banner__title {
    font-size: clamp(28px, 8vw, 36px);
  }

  .theme-khokans .km-post__content {
    padding: 1.15rem 1rem;
  }

  .theme-khokans .km-post__content h2 {
    font-size: 20px;
  }

  .theme-khokans .km-post__content h3 {
    font-size: 18px;
  }

  .theme-khokans .km-home-blog-card:hover,
  .theme-khokans .km-product-card--shop:hover {
    transform: none; /* less layout jump on touch */
  }
}

/* ═══════════════════════════════════════════════════════════════
   Forms — contact, profile, page content
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .theme-khokans .contact__form--input,
  .theme-khokans .contact__form--textarea,
  .theme-khokans .checkout__input--field,
  .theme-khokans .checkout__input--select__field,
  .theme-khokans .account__login--input,
  .theme-khokans .cart__note--textarea {
    width: 100%;
    max-width: 100%;
  }

  .theme-khokans .page__content,
  .theme-khokans .privacy__policy--content,
  .theme-khokans .about__content {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .theme-khokans .page__content img,
  .theme-khokans .privacy__policy--content img {
    height: auto;
  }

  .theme-khokans .thankyou,
  .theme-khokans .payment__success,
  .theme-khokans [align="center"] {
    max-width: 100%;
  }
}

/* Payment / thank-you messaging */
@media (max-width: 575px) {
  .theme-khokans .error__content,
  .theme-khokans .account__login--header,
  .theme-khokans main .col-12[align="center"] {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  .theme-khokans main .col-12[align="center"] h2,
  .theme-khokans main .col-12[align="center"] h3 {
    font-size: clamp(1.5rem, 5.5vw, 2rem);
    word-break: break-word;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Footer / newsletter
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .theme-khokans .km-newsletter__form {
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
  }

  .theme-khokans .km-newsletter__form input {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  .theme-khokans .km-newsletter__form .btn {
    flex: 1 1 100%;
    width: 100%;
  }

  .theme-khokans .km-footer__bottom {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .theme-khokans .km-footer__social {
    flex-wrap: wrap;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Swipers / product carousels
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .theme-khokans .swiper {
    max-width: 100%;
    overflow: hidden;
  }

  .theme-khokans .product__column6--activation .swiper-slide,
  .theme-khokans .related__product--activation .swiper-slide {
    height: auto;
  }

  .theme-khokans .swiper__nav--btn {
    width: 2.6rem;
    height: 2.6rem;
  }
}

/* ═══════════════════════════════════════════════════════════════
   404 / empty states
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 575px) {
  .theme-khokans .error__content h1,
  .theme-khokans .error__content .error__title {
    font-size: clamp(3rem, 18vw, 6rem);
  }

  .theme-khokans .error__content p {
    font-size: 1.35rem;
  }

  .theme-khokans .error__content .btn {
    width: 100%;
    max-width: 22rem;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Tiny phones (≤360)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 360px) {
  :root {
    --km-page-gutter: 0.7rem;
  }

  .theme-khokans .cart__table .cart__table--body__items {
    padding: 0.85rem;
  }

  .theme-khokans .cart__thumbnail {
    max-width: 4.6rem;
  }

  .theme-khokans .quantity__box {
    transform: scale(0.95);
    transform-origin: right center;
  }

  .theme-khokans .km-shop-grid {
    gap: 0.5rem;
  }

  .theme-khokans .account__menu--list a {
    padding: 0.5rem 0.65rem;
    font-size: 1.15rem;
  }
}
