/* MARXS COSMETICS — Responsive layout v3
   Rebuilt for phones first, then tablets and desktop. */
:root { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { width: 100%; max-width: 100%; min-width: 0; overflow-x: clip; }
body { margin: 0; }
main, header, footer, section, nav, aside, form, article { min-width: 0; }
img, svg, video, iframe { max-width: 100%; }
input, select, textarea, button { max-width: 100%; }
button, a, input, select, textarea { touch-action: manipulation; }
section[id], [id] { scroll-margin-top: 82px; }

/* Tablets and compact laptops */
@media (max-width: 1020px) {
  .header { gap: 14px; padding-inline: 22px; }
  .logo img { width: 140px; max-height: 55px; }
  .menubtn { display: inline-grid !important; place-items: center; }
  .nav {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 330px);
    height: 100vh;
    height: 100dvh;
    box-sizing: border-box;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: max(76px, calc(env(safe-area-inset-top) + 60px)) 26px max(26px, env(safe-area-inset-bottom));
    background: var(--cream);
    box-shadow: 12px 0 38px rgba(50, 29, 40, .16);
    transform: translateX(-105%);
    transition: transform .25s ease, visibility .25s ease;
    z-index: 56;
    visibility: hidden;
    pointer-events: none;
  }
  .nav.open { transform: translateX(0); visibility: visible; pointer-events: auto; }
  .nav a { display: block; min-height: 48px; padding: 13px 4px; border-bottom: 1px solid var(--line); font-size: .98rem; }
  .nav a:after { display: none; }
  .nav-backdrop { display: block; position: fixed; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: rgba(31,18,25,.43); opacity: 0; visibility: hidden; pointer-events: none; z-index: 50; transition: opacity .2s ease, visibility .2s ease; }
  .nav-backdrop.show { opacity: 1; visibility: visible; pointer-events: auto; }
  body.menu-open { overflow: hidden; }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 30px; padding: 48px 5%; }
  .hero h1 { font-size: clamp(2.8rem, 6vw, 4.8rem); }
  .hero-photo { height: clamp(300px, 48vw, 490px); }
  .cats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters label:first-child { grid-column: 1 / -1; }
  .fgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phones and portrait tablets */
@media (max-width: 700px) {
  html { scroll-padding-top: 68px; }
  .topbar { padding: 7px 12px; font-size: .58rem; line-height: 1.45; letter-spacing: .045em; }
  .topbar span { padding-inline: 4px; }

  .header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 62px;
    padding: 7px 14px;
    z-index: 40;
  }
  .logo { display: inline-flex; align-items: center; flex: 0 1 auto; min-width: 0; }
  .logo img { width: clamp(112px, 34vw, 142px); max-height: 47px; object-fit: contain; }
  .icons { display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; gap: 8px; margin-left: auto; }
  .icons button, .menubtn {
    display: inline-grid !important;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--berry);
    font-size: 1.25rem;
    line-height: 1;
  }
  .catalog-shortcut { display: none !important; }
  .menubtn { display: inline-grid !important; cursor: pointer; }

  .nav { width: min(88vw, 340px); }
  .searchbar.open { max-height: 150px; }
  .searchbar form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 12px 14px; }
  .searchbar input { min-width: 0; min-height: 44px; font-size: 16px; }
  .searchbar .btn { padding: 10px 13px; font-size: .68rem; letter-spacing: .04em; }

  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 25px;
    padding: 38px 18px 32px;
  }
  .hero-copy { width: 100%; max-width: 620px; }
  .eyebrow { font-size: .61rem; letter-spacing: .16em; }
  .hero h1 { font-size: clamp(2.65rem, 12vw, 3.65rem); line-height: 1.02; letter-spacing: -.04em; margin: 13px 0 16px; overflow-wrap: normal; }
  .hero-copy > p { max-width: 100%; margin: 0; font-size: .94rem; line-height: 1.7; }
  .cta { display: flex; flex-direction: column; align-items: stretch; gap: 15px; margin-top: 23px; }
  .cta .btn { width: 100%; min-height: 48px; }
  .cta .text-link { align-self: center; }
  .hero-note { margin-top: 25px; font-size: .62rem; letter-spacing: .08em; }
  .hero-photo { width: 100%; height: clamp(230px, 72vw, 370px); min-height: 0; }
  .photo-stamp { top: 13px; left: 13px; padding: 9px 12px; font-size: 1rem; }
  .photo-caption { right: 12px; bottom: 12px; font-size: .54rem; letter-spacing: .12em; }

  .service-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 8px; padding: 20px 12px; }
  .service-strip > div { grid-template-columns: 25px minmax(0, 1fr); column-gap: 7px; padding: 0 5px; border: 0; }
  .service-strip span { font-size: 1.1rem; }
  .service-strip b { font-size: .68rem; line-height: 1.35; }
  .service-strip small { font-size: .58rem; line-height: 1.35; }

  .sec { padding: 45px 16px; }
  .section-heading { display: flex; align-items: flex-start; flex-direction: column; gap: 9px; margin-bottom: 22px; }
  .section-heading h2, .sec h2 { font-size: clamp(1.8rem, 8vw, 2.55rem); line-height: 1.08; }
  .section-heading p { font-size: .82rem; line-height: 1.6; }
  .cats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 8px; }
  .cat { min-width: 0; }
  .cat img { width: 100%; border-width: 3px; }
  .cat span { padding: 7px 2px 0; font-size: .61rem; line-height: 1.25; overflow-wrap: anywhere; }

  .grid { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 10px; }
  .card { min-width: 0; overflow: hidden; }
  .card .imgw { width: 100%; aspect-ratio: 1 / 1; }
  .card img { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; }
  .card .b { min-width: 0; padding: 10px 9px 11px; gap: 6px; }
  .card small { font-size: .53rem; letter-spacing: .07em; line-height: 1.3; }
  .card h3 { font-size: .91rem; line-height: 1.2; overflow-wrap: anywhere; }
  .card .d { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: .67rem; line-height: 1.4; }
  .price { margin: 3px 0; font-size: .8rem; }
  .price b { font-size: .94rem; }
  .reference-price { font-size: .55rem !important; }
  .acts { display: flex; flex-direction: column; gap: 6px; margin-top: 5px; }
  .acts .btn { width: 100%; min-height: 42px; padding: 9px 5px; font-size: .59rem; line-height: 1.25; letter-spacing: .015em; }

  .editorial-banner { display: grid; grid-template-columns: minmax(0, 1fr); }
  .editorial-image { width: 100%; height: clamp(220px, 62vw, 330px); min-height: 0; }
  .editorial-copy { padding: 34px 21px 39px; }
  .editorial-copy h2 { font-size: clamp(2.2rem, 10vw, 3rem); }
  .editorial-copy p { font-size: .88rem; line-height: 1.7; }
  .editorial-copy .btn { width: 100%; min-height: 46px; }
  .catalog-note { padding: 48px 18px; }
  .catalog-note h2 { font-size: clamp(2rem, 9vw, 2.7rem); }
  .catalog-note p { font-size: .85rem; line-height: 1.7; }
  .catalog-note .btn { width: 100%; min-height: 46px; }

  .ptitle { font-size: clamp(2.15rem, 10vw, 3rem); line-height: 1.06; margin-bottom: 22px; }
  .catalog-intro { max-width: 100%; margin: 0 0 22px; font-size: .88rem; line-height: 1.7; }
  .layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 19px; }
  .filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 13px; position: static; padding: 15px; }
  .filters label, .filters label:first-child { grid-column: auto; font-size: .78rem; }
  .filters input, .filters select { width: 100%; min-height: 46px; font-size: 16px; }
  .filters .btn { min-height: 44px; }
  #resCount { font-size: .8rem; margin: 0 0 12px; }

  .two, .pd { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .two img { width: 100%; max-height: 340px; object-fit: cover; }
  .cform { width: 100%; max-width: none; gap: 13px; }
  .cform input, .cform textarea, .cform select { width: 100%; min-height: 46px; font-size: 16px; }

  .footer { padding: 38px 17px 16px; }
  .fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 17px; }
  .footer .fgrid > div { min-width: 0; }
  .footer .fgrid > div:first-child { grid-column: 1 / -1; }
  .flogo { width: 145px; max-height: 58px; }
  .footer h4 { font-size: 1.05rem; margin-bottom: 9px; }
  .footer p, .footer a { font-size: .72rem; line-height: 1.55; overflow-wrap: anywhere; }
  .footer .soc { line-height: 2; }
  .footer .soc a { display: inline-block; margin-right: 3px; }
  .copy { margin-top: 27px; padding-top: 14px; font-size: .63rem; line-height: 1.5; }

  .modal { display: flex; align-items: flex-end; justify-content: center; padding: 0; }
  .mbox { width: 100%; max-width: none; max-height: 88vh; max-height: 88dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 53px 17px 22px; border-radius: 18px 18px 0 0; }
  .pd { gap: 14px; }
  .pd img { width: 100%; max-height: 34vh; object-fit: contain; }
  .mclose { position: absolute; top: 8px; right: 12px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--pink); color: var(--berry); font-size: 1.5rem; }
}

/* Very narrow phones */
@media (max-width: 360px) {
  .header { padding-inline: 10px; gap: 7px; }
  .logo img { width: 104px; }
  .icons { gap: 6px; }
  .icons button, .menubtn { flex-basis: 39px; width: 39px; min-width: 39px; height: 39px; min-height: 39px; }
  .hero { padding-inline: 15px; }
  .sec { padding-inline: 13px; }
  .cats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px 6px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .card { display: grid; grid-template-columns: 36% minmax(0, 1fr); align-items: stretch; }
  .card .imgw { height: 100%; min-height: 180px; aspect-ratio: auto; }
  .card img { height: 100%; min-height: 180px; aspect-ratio: auto; object-fit: cover; }
  .card .b { padding: 11px 10px; }
  .card h3 { font-size: .96rem; }
  .card .d { -webkit-line-clamp: 3; }
  .acts .btn { min-height: 40px; }
  .fgrid { gap: 18px 12px; }
}

@media (hover: none) {
  .card:hover, .cat:hover, .btn:hover, .icons button:hover { transform: none; box-shadow: none; }
  .card:hover img, .cat:hover img { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .intro { display: none; }
}
