@layer components, pages;

@layer components {
  .eyebrow {
    margin-bottom: 0.65rem;
    color: #9a6b12;
    font-size: 0.75rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .button-group { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }

  .button {
    display: inline-flex;
    min-height: 3rem;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.35rem;
    border: 1px solid transparent;
    border-radius: 0.65rem;
    font-weight: 800;
    text-decoration: none;
  }

  .button--primary { background: #062748; color: white; }
  .button--primary:hover { background: #0b3b68; }
  .button--secondary { border-color: #0b477f; background: rgb(255 255 255 / 55%); color: #062748; }
  .button--secondary:hover { background: white; }
  .button--light { background: white; color: #062748; white-space: nowrap; }
  .text-link { display: inline-flex; min-height: 2.75rem; align-items: center; gap: 0.35rem; color: #0b477f; font-weight: 750; text-decoration: none; }
  .text-link:hover { text-decoration: underline; text-underline-offset: 0.2em; }

  .section-title-row { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: clamp(1.4rem, 3vw, 2.2rem); }
  .section-title-row h2 { color: #102d49; font-size: clamp(1.55rem, 3vw, 2.35rem); }

  .support-actions { display: grid; gap: 0.75rem; min-width: min(100%, 15rem); }
  .support-button { justify-content: flex-start; gap: 0.65rem; }
  .support-button span { display: grid; width: 1.8rem; height: 1.8rem; place-items: center; border-radius: 50%; color: white; font-size: 0.8rem; }
  .support-button--line span { background: #06c755; }
  .support-button--facebook span { background: #0866ff; }
}

@layer pages {
  .home-shop { padding-block: clamp(1.5rem, 4vw, 3rem); background: #f4f6f8; }

  .home-category-row { display: flex; gap: 0.55rem; margin-block: 1.25rem; padding-bottom: 0.15rem; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: none; }
  .home-category-row::-webkit-scrollbar { display: none; }
  .home-category-row a { display: inline-flex; min-height: 2.75rem; flex: 0 0 auto; align-items: center; padding: 0.55rem 0.9rem; border: 1px solid #cfd5da; border-radius: 999px; background: white; color: #4f5961; font-size: 0.82rem; font-weight: 800; text-decoration: none; }
  .home-category-row a:hover,
  .home-category-row a.is-active { border-color: #343a40; background: #343a40; color: white; }

  .home-product-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.9rem; }
  .home-product-card { display: flex; min-width: 0; flex-direction: column; overflow: hidden; border: 1px solid #dfe3e6; border-radius: 0.85rem; background: white; box-shadow: 0 0.35rem 1.25rem rgb(30 38 44 / 6%); }
  .home-product-card__media { position: relative; display: block; aspect-ratio: 4 / 4.3; overflow: hidden; background: #eef1f3; }
  .home-product-card__media picture,
  .home-product-card__media img { width: 100%; height: 100%; }
  .home-product-card__media img { object-fit: cover; object-position: center; transition: transform 180ms ease; }
  .home-product-card:hover .home-product-card__media img { transform: scale(1.025); }
  .home-product-card[data-product-slug="d-ver-coffee"] .home-product-card__media img,
  .home-product-card[data-product-slug="fibro-s"] .home-product-card__media img { box-sizing: border-box; padding: 9% 14%; background: white; object-fit: contain; }
  .home-product-card__badge { position: absolute; z-index: 1; top: 0.55rem; left: 0.55rem; max-width: calc(100% - 1.1rem); overflow: hidden; padding: 0.28rem 0.5rem; border-radius: 999px; background: #ba8424; color: white; font-size: 0.65rem; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
  .home-product-card__quantity { position: absolute; right: 0.55rem; bottom: 0.55rem; display: grid; min-width: 2rem; height: 2rem; padding-inline: 0.35rem; place-items: center; border-radius: 999px; background: #343a40; color: white; font-size: 0.72rem; font-weight: 850; }
  .home-product-card__body { display: flex; flex: 1; flex-direction: column; padding: 0.8rem; }
  .home-product-card__body > p { overflow: hidden; color: #7a838a; font-size: 0.68rem; text-overflow: ellipsis; white-space: nowrap; }
  .home-product-card h2 { display: -webkit-box; min-height: 2.65em; margin-top: 0.3rem; overflow: hidden; font-size: 0.86rem; line-height: 1.32; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .home-product-card h2 a { display: block; min-height: 2.65em; color: #303941; text-decoration: none; }
  .home-product-card__body > strong { display: block; margin-top: 0.55rem; color: #20272d; font-size: 1rem; }
  .home-product-card form { margin-top: auto; padding-top: 0.7rem; }
  .home-product-card__add { display: inline-flex; width: 100%; min-height: 2.75rem; align-items: center; justify-content: center; gap: 0.35rem; padding: 0.55rem 0.65rem; border: 0; border-radius: 0.65rem; background: #343a40; color: white; font: inherit; font-size: 0.78rem; font-weight: 850; cursor: pointer; }
  .home-product-card__add:hover { background: #1f2529; }
  .home-product-card__add .ui-icon { width: 1.05rem; height: 1.05rem; }
  .home-shop__note { margin-top: 1rem; color: #747d84; font-size: 0.75rem; text-align: right; }
  .home-shop__empty { padding: 2rem; border: 1px dashed #bec6cc; border-radius: 0.85rem; background: white; text-align: center; }
  .home-shop__empty p { margin-block: 0.5rem 1rem; color: #68717a; }

  .trust-strip { padding-block: 0.8rem; background: white; }
  .trust-grid { display: grid; grid-template-columns: repeat(4, 1fr); padding: 1.15rem; border: 1px solid #dce4ed; border-radius: 1rem; background: white; box-shadow: 0 0.75rem 2rem rgb(6 39 72 / 10%); }
  .trust-grid > div { display: grid; grid-template-columns: 2.5rem 1fr; column-gap: 0.75rem; align-items: center; padding: 0.35rem 1rem; border-right: 1px solid #e7ebef; }
  .trust-grid > div:last-child { border-right: 0; }
  .trust-grid > div > .ui-icon { grid-row: 1 / 3; width: 2.5rem; height: 2.5rem; padding: 0.55rem; border: 1px solid #a9b9ca; border-radius: 50%; color: #0b477f; }
  .trust-grid strong { color: #153550; font-size: 0.9rem; }
  .trust-grid small { color: #6a7783; font-size: 0.72rem; }

  .section { padding-block: clamp(3.75rem, 7vw, 6.5rem); scroll-margin-top: 8.5rem; }
  .section--soft { background: #f2f6fa; }

  .home-promo { overflow: hidden; background: linear-gradient(115deg, #eaf5ff 0%, #f7fbff 47%, #dceafa 100%); }
  .home-promo__grid { display: grid; grid-template-columns: minmax(20rem, 0.8fr) minmax(0, 1.2fr); min-height: 30rem; }
  .home-promo__visual { min-width: 0; max-height: 34rem; overflow: hidden; }
  .home-promo__visual img { width: 100%; height: 100%; object-fit: cover; object-position: center 29%; }
  .home-promo__content { align-self: center; padding: clamp(2rem, 6vw, 5rem); }
  .home-promo__content h2 { max-width: 14ch; color: #26313a; font-size: clamp(2rem, 4vw, 3.8rem); line-height: 1.05; }
  .home-promo__lede { max-width: 42rem; margin-top: 1rem; color: #5b6670; }

  .need-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
  .need-grid a { display: grid; min-height: 10rem; align-content: center; justify-items: center; padding: 1.25rem; border: 1px solid #dbe4ec; border-radius: 1rem; background: white; color: #153550; text-align: center; text-decoration: none; }
  .need-grid a:hover { border-color: #87a9c8; box-shadow: 0 0.5rem 1.5rem rgb(6 39 72 / 7%); }
  .need-grid .ui-icon { width: 3.5rem; height: 3.5rem; margin-bottom: 0.7rem; padding: 0.85rem; border-radius: 50%; background: #e9f3fb; color: #0d4b83; }
  .need-grid strong { font-size: 1rem; }
  .need-grid small { margin-top: 0.25rem; color: #71808d; }

  .featured-story__grid { display: grid; grid-template-columns: minmax(20rem, 0.85fr) minmax(0, 1.15fr); overflow: hidden; border-radius: 1.25rem; background: #eaf4fc; }
  .featured-story__media { max-height: 34rem; overflow: hidden; }
  .featured-story__media img { width: 100%; height: 100%; object-fit: cover; object-position: center 53%; }
  .featured-story__content { align-self: center; padding: clamp(2rem, 6vw, 5rem); }
  .featured-story__content h2 { max-width: 13ch; color: #082947; font-size: clamp(2rem, 4vw, 3.6rem); }
  .featured-story__content > p:not(.eyebrow, .promotion-line) { max-width: 38rem; margin-top: 1.2rem; color: #4d6274; }
  .promotion-line { max-width: 30rem; margin-block: 1.5rem; color: #0b477f; font-size: clamp(1.15rem, 2.5vw, 1.6rem); font-weight: 850; }

  .guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
  .guide-card { display: grid; grid-template-columns: 2.75rem 1fr auto; min-height: 8rem; align-items: center; gap: 1rem; padding: 1.25rem; border: 1px solid #dae2e9; border-radius: 1rem; background: white; color: #173751; text-decoration: none; }
  .guide-card > .ui-icon:first-child { width: 2.75rem; height: 2.75rem; padding: 0.65rem; border-radius: 0.75rem; background: #e9f3fb; color: #0b477f; }
  .guide-card h3 { font-size: 1rem; }
  .guide-card p { margin-top: 0.3rem; color: #6d7a85; font-size: 0.83rem; }
  .guide-card > .ui-icon:last-child { color: #0b477f; }

  .faq-grid { display: grid; grid-template-columns: minmax(16rem, 0.7fr) minmax(0, 1.3fr); gap: clamp(2rem, 7vw, 6rem); }
  .faq-grid .section-heading h2 { max-width: 13ch; color: #102d49; }
  .faq-list details { border-bottom: 1px solid #ccd8e2; }
  .faq-list summary { min-height: 3.5rem; cursor: pointer; padding-block: 1rem; color: #173751; font-weight: 800; }
  .faq-list p { padding: 0 1.5rem 1.25rem 0; color: #62717e; }

  .help-card { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: clamp(2rem, 6vw, 4rem); border-radius: 1.25rem; background: #062748; color: white; }
  .help-card .eyebrow { color: #f0c86f; }
  .help-card h2 { max-width: 22ch; }
  .help-card p:not(.eyebrow) { max-width: 44rem; margin-top: 1rem; color: rgb(255 255 255 / 76%); }
}

@media (max-width: 60rem) {
  .home-product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .home-promo__grid { grid-template-columns: minmax(18rem, 0.8fr) minmax(0, 1.2fr); }
  .trust-grid > div { grid-template-columns: 2.1rem 1fr; padding-inline: 0.6rem; }
  .trust-grid > div > .ui-icon { width: 2.1rem; height: 2.1rem; }
  .need-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-grid { grid-template-columns: 1fr; }
}

@media (max-width: 48rem) {
  .home-shop { padding-block: 1.1rem 1.5rem; }
  .home-category-row { margin-block: 0.8rem 1rem; }
  .home-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; }
  .home-product-card__body { padding: 0.65rem; }
  .home-product-card__body > p { font-size: 0.72rem; }
  .home-product-card h2 { font-size: 0.86rem; }
  .home-product-card__body > strong { font-size: 0.96rem; }
  .home-product-card__add { min-height: 3rem; padding-inline: 0.4rem; font-size: 0.8rem; line-height: 1.25; text-align: center; }
  .home-shop__note { text-align: left; }
  .home-promo__grid { grid-template-columns: 1fr; min-height: 0; }
  .home-promo__visual { max-height: none; aspect-ratio: 16 / 10; }
  .home-promo__content { padding: 2rem 1rem 2.4rem; }
  .home-promo__content h2 { font-size: clamp(1.9rem, 9vw, 2.8rem); }
  .trust-strip { padding-block: 0.65rem; }
  .trust-grid { grid-template-columns: repeat(4, 1fr); width: 100%; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
  .trust-grid > div { grid-template-columns: 1fr; justify-items: center; gap: 0.3rem; padding: 0.35rem; border-right: 0; text-align: center; }
  .trust-grid > div > .ui-icon { grid-row: auto; width: 2.35rem; height: 2.35rem; }
  .trust-grid strong { font-size: 0.68rem; }
  .trust-grid small { display: none; }
  .section { padding-block: 3.25rem; }
  .featured-story__grid,
  .faq-grid { grid-template-columns: 1fr; }
  .featured-story__media { max-height: 25rem; }
  .help-card { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 32rem) {
  .button-group .button { width: 100%; }
  .section-title-row { align-items: flex-start; }
  .section-title-row .text-link { font-size: 0.8rem; white-space: nowrap; }
  .home-category-row a { min-height: 2.65rem; padding-inline: 0.75rem; font-size: 0.76rem; }
  .home-product-card__badge { max-width: calc(100% - 0.9rem); top: 0.45rem; left: 0.45rem; font-size: 0.68rem; }
  .home-product-card__quantity { right: 0.45rem; bottom: 0.45rem; }
  .need-grid { gap: 0.65rem; }
  .need-grid a { min-height: 8.5rem; padding: 0.85rem; }
  .need-grid small { font-size: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  .home-product-card__media img { transition: none; }
}
