/* ==========================================================================
   MDM Mayorista — hoja de estilos única
   Índice: 1 Fuentes · 2 Tokens · 3 Base · 4 Utilidades · 5 Botones · 6 Header
           7 Hero · 8 Secciones · 9 Ofertas · 10 Marcas · 11 Nosotros · 12 Zonas
           13 App · 14 Novedades · 15 Footer · 16 Diálogos · 17 404 · 18 Movimiento
   ========================================================================== */

/* 1. Fuentes (self-hosted) ------------------------------------------------ */
@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/instrument-sans-var.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* 2. Tokens --------------------------------------------------------------- */
:root {
  --red: #ec3237;
  --red-start: #dc2b30;       /* inicio del degradé: contraste AA con texto blanco */
  --red-end: #b81d22;
  --green: #0b762a;
  --ink: #161614;
  --ink-soft: #3a3935;
  --muted: #55534e;
  --muted-light: #6b6862;     /* AA sobre --surface */
  --surface: #f4f3f0;
  --surface-2: #e8e6e1;
  --line: #dcdad4;
  --line-strong: #cfccc5;
  --white: #fff;

  --font-sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;

  --radius-xl: 28px;
  --radius-lg: 16px;
  --radius-md: 14px;
  --radius-pill: 999px;

  --max: 1440px;
  --gutter: clamp(24px, 5vw, 64px);
  --gap: 12px;
  --header-h: 84px;

  --grad-red: linear-gradient(90deg, var(--red-start) 0%, var(--red-end) 100%);
}

/* 3. Base ----------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 0 var(--gap) var(--gap);
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--green); }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p, address, figure, dl, dd { margin: 0; }
address { font-style: normal; }
input, textarea, button { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
  border-radius: 4px;
}
.hero :focus-visible,
.about :focus-visible,
.app :focus-visible { outline-color: var(--white); }

.serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}

/* 4. Utilidades ----------------------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px; top: -100px;
  z-index: 100;
  padding: 12px 20px;
  background: var(--ink);
  color: var(--white);
  border-radius: var(--radius-pill);
}
.skip-link:focus { top: 12px; color: var(--white); }

.eyebrow {
  margin-bottom: 16px;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-light);
}

.section {
  max-width: var(--max);
  margin: 0 auto var(--gap);
  border-radius: var(--radius-xl);
  background: var(--surface);
}
.section--pad { padding: clamp(40px, 6vw, 72px) var(--gutter); }
.section--pad-y { padding: clamp(40px, 6vw, 72px) 0; overflow: hidden; }
.section--red { background: var(--grad-red); color: var(--white); }
.section--red .eyebrow { color: var(--white); }

.section__title {
  font-weight: 500;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.05;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.section__title .serif { color: var(--green); }
.section__title .serif--red { color: var(--red); }
.section--red .section__title .serif { color: var(--white); }

.section__head {
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 32px;
  align-items: end;
}
.section__lead {
  max-width: 44ch;
  font-size: 17px;
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}

/* 5. Botones -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  transition: background-color .2s, color .2s, border-color .2s;
}
.btn--dark { background: var(--ink); color: #f7f6f3; }
.btn--dark:hover { background: var(--green); color: #fff; }
.btn--green { background: var(--green); color: #fff; }
.btn--green:hover { background: #095c20; color: #fff; }
.btn--light { background: var(--white); color: var(--ink); }
.btn--light:hover { background: var(--surface-2); color: var(--ink); }
.btn--ghost { border-color: rgba(255, 255, 255, .7); color: var(--white); }
.btn--ghost:hover { background: rgba(255, 255, 255, .14); color: var(--white); }
.btn--sm { padding: 10px 18px; font-size: 14px; }
.btn--block { width: 100%; padding: 15px; margin-top: 12px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: 18px;
  transition: background-color .2s, color .2s;
}
.icon-btn:hover { background: var(--ink); color: #f7f6f3; }

/* 6. Header --------------------------------------------------------------- */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 0;
}
.header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 16px 12px 24px;
  background: rgba(244, 243, 240, .88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-radius: var(--radius-pill);
}
.header__logo img { height: 36px; width: auto; }
.nav { display: flex; align-items: center; gap: 28px; font-size: 14px; color: var(--muted); }
.nav a:hover { color: var(--green); }

/* 7. Hero ----------------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 48px;
  align-items: center;
  padding: clamp(48px, 8vw, 104px) var(--gutter) clamp(40px, 5vw, 64px);
}
.hero .eyebrow { margin-bottom: 24px; color: var(--white); }
.hero__title {
  max-width: 15ch;
  font-weight: 500;
  font-size: clamp(42px, 6.4vw, 88px);
  line-height: 1;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.hero__lead {
  max-width: 46ch;
  margin-top: 28px;
  font-size: 18px;
  line-height: 1.55;
  text-wrap: pretty;
}
.hero__cta { margin-top: 40px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero__media { display: flex; justify-content: flex-end; }
.hero__media img { width: 100%; max-width: 440px; }

/* 9. Ofertas -------------------------------------------------------------- */
.offers__head {
  padding: 0 var(--gutter);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.offers__nav { display: flex; gap: 8px; }
.offers__rail {
  display: flex;
  gap: 16px;
  margin-top: 40px;
  padding: 0 var(--gutter) 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--gutter);
  scrollbar-width: none;
}
.offers__rail::-webkit-scrollbar { display: none; }
.offers__item {
  flex: 0 0 auto;
  width: max(260px, calc((100% - 32px) / 3));
  align-self: flex-start;
  scroll-snap-align: start;
}
.offers__link {
  display: block;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  cursor: zoom-in;
}
.offers__link img { width: 100%; height: auto; }

/* 10. Marcas -------------------------------------------------------------- */
.brands__rows { margin-top: 48px; display: flex; flex-direction: column; gap: var(--gap); }
.brands__row {
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
  padding: 0 var(--gutter);
  scrollbar-width: none;
}
.brands__row::-webkit-scrollbar { display: none; }
.brands__item {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 168px; height: 104px;
  padding: 22px;
  border-radius: 18px;
  background: var(--white);
}
.brands__item img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  filter: grayscale(1) contrast(1.1);
  opacity: .75;
  transition: filter .25s, opacity .25s;
}
.brands__item:hover img { filter: none; opacity: 1; }

/* Marquee: solo cuando el JS clonó la fila (sin JS queda como carrusel con scroll) */
.brands__track { flex: none; display: flex; gap: var(--gap); }
.brands__row.is-marquee {
  overflow: hidden;
  padding: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.brands__belt {
  display: flex;
  width: max-content;
  animation: marquee 70s linear infinite;
}
.brands__belt .brands__track { padding-right: var(--gap); }
.brands__row--rev .brands__belt { animation-direction: reverse; }
.brands__row.is-marquee:hover .brands__belt,
.brands__row.is-marquee:focus-within .brands__belt { animation-play-state: paused; }

.brands__text {
  padding: 40px var(--gutter) 0;
  max-width: 100ch;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted-light);
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* 11. Nosotros ------------------------------------------------------------ */
.about {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 64px;
  align-items: center;
  padding: clamp(48px, 8vw, 104px) var(--gutter);
}
.about .eyebrow { margin-bottom: 20px; }
.about__text { margin-top: 28px; max-width: 46ch; font-size: 17px; line-height: 1.6; text-wrap: pretty; }
.about__stats {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 20px;
  max-width: 560px;
}
.about__stats div { padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .45); }
.about__stats dt { order: 2; font-size: 13px; }
.about__stats dd { white-space: nowrap; font-size: clamp(28px, 3vw, 40px); font-weight: 500; letter-spacing: -.02em; line-height: 1.1; }
.about__stats div { display: flex; flex-direction: column; }
.about__media { overflow: hidden; border-radius: var(--radius-lg); }
.about__media img { width: 100%; height: auto; }

/* 12. Zonas --------------------------------------------------------------- */
.zones { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px; align-items: center; }
.zones__list { display: flex; flex-wrap: wrap; gap: 8px; }
.zones__list li {
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--white);
  font-size: 15px;
  color: var(--ink-soft);
}

/* 13. App ----------------------------------------------------------------- */
.app-wrap { max-width: var(--max); margin: 0 auto var(--gap); }
.app {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 40px;
  align-items: end;
  overflow: hidden;
  padding: clamp(40px, 6vw, 80px) var(--gutter) 0;
  border-radius: var(--radius-xl);
  background: var(--green);
  color: var(--white);
}
.app .eyebrow { color: var(--white); }
.app__title {
  font-weight: 500;
  font-size: clamp(30px, 3.6vw, 46px);
  line-height: 1.05;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.app__badges { margin-top: 32px; display: flex; gap: 12px; flex-wrap: wrap; }
.app__badges img { height: 56px; width: auto; }
.app__copy { padding-bottom: clamp(40px, 6vw, 80px); }
.app__media { display: flex; justify-content: center; }
.app__media img { width: 100%; max-width: 420px; }

/* 14. Novedades ----------------------------------------------------------- */
.news {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 32px;
  align-items: center;
}
.news__title {
  font-weight: 500;
  font-size: clamp(28px, 3.4vw, 42px);
  line-height: 1.05;
  letter-spacing: -.03em;
}
.news__title .serif { color: var(--green); }
.news__lead { margin-top: 12px; font-size: 16px; color: var(--muted); }
.pill-form {
  display: flex;
  padding: 6px;
  border-radius: var(--radius-pill);
  background: var(--white);
}
.pill-form input {
  flex: 1;
  min-width: 0;
  padding: 12px 18px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
}
.pill-form:focus-within { outline: 3px solid var(--green); outline-offset: 2px; }
.pill-form .btn { padding: 12px 24px; }
.form-status { margin-top: 12px; min-height: 1.5em; padding-left: 24px; font-weight: 500; color: var(--green); }

/* 15. Footer -------------------------------------------------------------- */
.footer { margin-bottom: 0; }
.footer__inner { padding: clamp(40px, 6vw, 72px) var(--gutter) 28px; }
.footer__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 40px; }
.footer__title {
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-light);
}
.footer__body { font-size: 15px; line-height: 1.6; color: var(--ink-soft); }
.footer__contact { display: flex; flex-direction: column; }
.footer__body a { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: text-decoration-color .2s; }
.footer__body a:hover { text-decoration-color: currentColor; }
.social { margin-top: 16px; display: flex; gap: 8px; }
.social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: var(--radius-pill);
  background: var(--white);
  transition: background-color .2s;
}
.social a:hover { background: var(--surface-2); }
.social img { width: 20px; height: 20px; }
.footer__legal {
  margin-top: 72px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted-light);
}

/* 16. Diálogos (contacto + lightbox) -------------------------------------- */
dialog { border: 0; padding: 0; color: var(--ink); }
dialog::backdrop { background: rgba(22, 22, 20, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

.drawer {
  width: min(480px, calc(100% - 24px));
  height: calc(100% - 24px);
  max-height: none;
  margin: 12px 12px 12px auto;
  border-radius: 24px;
  background: var(--white);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
}
.drawer__form {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(28px, 4vw, 48px);
}
.drawer__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.drawer__title { margin-bottom: 8px; font-weight: 500; font-size: 26px; line-height: 1.15; letter-spacing: -.02em; }
.drawer__close { border: 0; background: transparent; font-size: 28px; line-height: 1; padding: 4px 8px; }
.field { display: flex; flex-direction: column; }
.field label { font-size: 13px; color: var(--muted-light); }
.field input,
.field textarea {
  padding: 10px 0 12px;
  border: 0;
  border-bottom: 1px solid #b9b6ae;
  background: transparent;
  outline: 0;
  font-size: 16px;
  resize: none;
  border-radius: 0;
}
.field input:focus,
.field textarea:focus { border-bottom: 2px solid var(--green); }
.drawer__note { font-size: 13px; color: var(--muted-light); }

.lightbox {
  width: 100%; height: 100%;
  max-width: none; max-height: none;
  background: transparent;
}
.lightbox::backdrop { background: rgba(22, 22, 20, .94); }
.lightbox__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 100%;
  padding: 24px;
}
.lightbox__stage img { max-width: 100%; max-height: 100%; width: auto; border-radius: 12px; }
.lightbox__btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px; height: 48px;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .14);
  color: var(--white);
  font-size: 22px;
}
.lightbox__btn:hover { background: rgba(255, 255, 255, .28); }
.lightbox__btn--prev { left: 16px; }
.lightbox__btn--next { right: 16px; }
.lightbox__close { top: 24px; right: 16px; transform: none; }

/* 17. Página 404 ---------------------------------------------------------- */
.notfound { padding: clamp(64px, 12vw, 160px) var(--gutter); text-align: center; }
.notfound__code { font-family: var(--font-serif); font-style: italic; font-size: clamp(96px, 18vw, 220px); line-height: 1; }
.notfound .hero__cta { justify-content: center; }

/* 18. Responsive + movimiento --------------------------------------------- */
@media (max-width: 760px) {
  :root { --header-h: 76px; }
  .nav { display: none; }
  .header__bar { padding-left: 18px; }
  .offers__item { width: 78%; }
  .hero__media { justify-content: center; }
  .lightbox__btn--prev { left: 8px; }
  .lightbox__btn--next { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .brands__belt { animation: none; }
  .brands__row.is-marquee { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  * { transition-duration: .01ms !important; }
}
