/* =========================================================
   dd-theme — UI components
   Ported verbatim from the approved mockup styles.css.
   Contract spacing values (non-4-multiples) are preserved as-is
   per UI-SPEC §Spacing exceptions (e.g. course card body padding
   18px 20px 22px, button padding 12px 20px). Do NOT round.

   Adaptation note: the responsive @media blocks below include
   attribute selectors like [style*="grid-template-columns: ..."]
   that targeted inline styles emitted by the React mockup. They
   are ported verbatim and remain valid CSS; PHP templates that
   render those grids (Phase 2) carry the same inline style strings,
   so these rules keep working. The .tab-panel rule (bottom) pairs
   with tabs.js (data-tab-target -> id) and is dd-theme-specific.
   ========================================================= */

/* Botones / utilidades base */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px;
  font: 600 14.5px/1 var(--sans);
  letter-spacing: -0.01em;
  cursor: pointer; border: 1px solid transparent;
  transition: transform .12s ease, background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
  white-space: nowrap; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--ink-1); color: var(--cream);
}
.btn-primary:hover { background: var(--ink-2); }
.btn-ghost {
  background: transparent; color: var(--ink); border-color: var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--cream); }
.btn-cream {
  background: var(--cream); color: var(--ink);
}
.btn-cream:hover { background: white; }
.btn-lg { padding: 16px 28px; font-size: 16px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* Pills / badges */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font: 600 11.5px/1 var(--sans);
  letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--paper); color: var(--ink-1);
  border: 1px solid var(--hair);
}
.pill-dark { background: var(--ink-1); color: var(--cream); border-color: transparent; }
.pill-mustard { background: var(--mustard); color: var(--ink-3); border-color: transparent; }
.pill-terra { background: var(--terracotta); color: var(--cream); border-color: transparent; }
.pill-outline { background: transparent; }

/* Cards */
.card {
  background: var(--off-white);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
}

/* Hairline divider */
.hair { height: 1px; background: var(--hair); border: 0; }

/* Star rating */
.stars { display: inline-flex; gap: 2px; color: var(--mustard); }
.stars svg { width: 14px; height: 14px; }

/* Decorative tape / sticker — collage feel */
.tape {
  position: absolute;
  background: rgba(212, 162, 58, 0.5);
  width: 60px; height: 18px;
  transform: rotate(-6deg);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
  border-radius: 1px;
}
.tape-blue { background: rgba(40,50,140,0.18); }
.tape-coral { background: rgba(232,122,93,0.45); }

/* Stamp circle */
.stamp {
  position: absolute;
  display: flex; align-items: center; justify-content: center;
  width: 86px; height: 86px; border-radius: 50%;
  border: 1.5px dashed currentColor;
  font: 700 11px/1.1 var(--sans);
  letter-spacing: 0.08em; text-transform: uppercase;
  text-align: center;
  transform: rotate(-12deg);
  color: var(--terracotta);
}

/* Halftone dot field */
.halftone {
  background-image: radial-gradient(currentColor 1px, transparent 1.5px);
  background-size: 8px 8px;
  opacity: 0.4;
}

/* Course card (default — "Editorial") */
.coursecard {
  position: relative;
  background: var(--off-white);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  cursor: pointer;
}
.coursecard:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -16px rgba(20,20,43,0.18);
  border-color: var(--ink-1);
}
.coursecard .cc-visual {
  aspect-ratio: 4 / 3;
  position: relative;
  overflow: hidden;
}
.coursecard .cc-body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.coursecard .cc-title { font: 700 17px/1.25 var(--sans); letter-spacing: -0.015em; color: var(--ink); }
.coursecard .cc-meta { font: 500 12.5px/1 var(--sans); color: var(--muted); display: flex; gap: 10px; align-items: center; }
.coursecard .cc-meta::before, .coursecard .cc-meta-d { content: ''; width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); }
.coursecard .cc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 10px; }
.coursecard .cc-price { font: 800 18px/1 var(--sans); color: var(--ink-1); letter-spacing: -0.02em; }
.coursecard .cc-price s { font-weight: 500; color: var(--muted-2); margin-right: 6px; }

/* Visual variants */
.cc-visual { background: var(--paper); }

/* Inputs */
.input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--hair-2); background: white;
  border-radius: 10px;
  font: 500 14.5px/1.2 var(--sans); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus { outline: 0; border-color: var(--ink-1); box-shadow: 0 0 0 3px rgba(40,50,140,0.12); }
.input::placeholder { color: var(--muted-2); }

label.field { display: flex; flex-direction: column; gap: 6px; }
label.field span { font: 600 12.5px/1 var(--sans); color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hair); }
.tabs button {
  background: none; border: 0; padding: 14px 18px;
  font: 600 14.5px/1 var(--sans); color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink-1); border-color: var(--ink-1); }

/* Tab panels — pair with tabs.js (data-tab-target -> getElementById).
   Hidden by default; .active is toggled by tabs.js to reveal the matched one. */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Accordion */
.acc-row { border-bottom: 1px solid var(--hair); }
.acc-row > button {
  width: 100%; text-align: left; background: none; border: 0;
  padding: 18px 0; display: flex; justify-content: space-between; align-items: center;
  font: 600 16px/1.3 var(--sans); color: var(--ink); cursor: pointer;
}
.acc-row .acc-body { padding: 0 0 18px; color: var(--ink-soft); display: none; }
.acc-row.open .acc-body { display: block; }
.acc-chev { transition: transform .2s; color: var(--ink-1); }
.acc-row.open .acc-chev { transform: rotate(45deg); }

/* Marquee */
@keyframes marqueescroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.marquee { overflow: hidden; mask-image: linear-gradient(90deg, transparent, black 6%, black 94%, transparent); }
.marquee-track { display: inline-flex; gap: 48px; animation: marqueescroll 50s linear infinite; white-space: nowrap; }

/* Tag list */
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 6px;
  background: var(--paper); color: var(--ink-1);
  font: 600 12px/1 var(--sans); letter-spacing: 0.02em;
  border: 1px solid var(--hair);
  cursor: pointer;
}
.tag.active { background: var(--ink-1); color: var(--cream); border-color: transparent; }
.tag:hover { border-color: var(--ink-1); }

/* Logo color helper */
.brand-logo { color: var(--ink-1); }

/* Animated underline link */
.ulink { position: relative; padding-bottom: 2px; font-weight: 600; }
.ulink::after { content: ''; position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; background: currentColor; transform-origin: right center; transform: scaleX(0); transition: transform .25s ease; }
.ulink:hover::after { transform: scaleX(1); transform-origin: left center; }

/* Status banner top */
.statbar {
  background: var(--ink-3); color: var(--cream);
  font: 500 12.5px/1 var(--sans); letter-spacing: 0.02em;
  text-align: center; padding: 9px 12px;
}
.statbar strong { color: var(--mustard); font-weight: 700; }

/* For collage placeholder */
.placeholder-collage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}

/* ==================================================
   RESPONSIVE — tablet + móvil
   ================================================== */

/* Header hamburger (móvil) */
.dd-hamb { display: none; background: none; border: 0; padding: 8px; cursor: pointer; color: var(--ink); }
.dd-mobile-drawer { display: none; }

/* Bottom dev nav scrollable */
.dd-pagenav { max-width: calc(100vw - 28px); overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none; }
.dd-pagenav::-webkit-scrollbar { display: none; }

@media (max-width: 1080px) {
  .container { padding-left: 20px; padding-right: 20px; }

  /* 4-col → 2-col */
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns: repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  /* 5-col → 3-col */
  [style*="grid-template-columns: repeat(5, 1fr)"],
  [style*="grid-template-columns: repeat(5,1fr)"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  /* Sticky asides → estáticos */
  aside[style*="position:sticky"],
  aside [style*="position:sticky"],
  [style*="position:sticky"][style*="top:160"],
  [style*="position:sticky"][style*="top: 160"],
  [style*="position:sticky"][style*="top:180"] {
    position: static !important;
  }

  /* Gaps grandes → más razonables */
  [style*="gap:64px"], [style*="gap: 64px"] { gap: 32px !important; }
  [style*="gap:56px"], [style*="gap: 56px"] { gap: 28px !important; }

  /* Reducción heroes asimétricos a tablet */
  [style*="grid-template-columns: 260px 1fr"] {
    grid-template-columns: 220px 1fr !important;
  }
}

@media (max-width: 820px) {
  .container { padding-left: 18px; padding-right: 18px; }

  /* Sección padding compacto */
  .section { padding: clamp(40px, 7vw, 64px) 0 !important; }
  .section-tight { padding: clamp(28px, 5vw, 48px) 0 !important; }

  /* Stack TODOS los grids 2-col asimétricos */
  [style*="grid-template-columns: 1.4fr 1fr"],
  [style*="grid-template-columns: 1.3fr 1fr"],
  [style*="grid-template-columns: 1.2fr 1fr"],
  [style*="grid-template-columns: 1.15fr 1fr"],
  [style*="grid-template-columns: 1.1fr 1fr"],
  [style*="grid-template-columns: 1.1fr 0.9fr"],
  [style*="grid-template-columns: 1.05fr 0.95fr"],
  [style*="grid-template-columns: 1fr 1.2fr"],
  [style*="grid-template-columns: 1fr 1.4fr"],
  [style*="grid-template-columns: 1.5fr 1fr"],
  [style*="grid-template-columns: 1.6fr 1fr"],
  [style*="grid-template-columns: 0.9fr 1.4fr"],
  [style*="grid-template-columns: 260px 1fr"],
  [style*="grid-template-columns: 220px 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  /* 3-col → 1 col */
  [style*="grid-template-columns: repeat(3, 1fr)"],
  [style*="grid-template-columns: repeat(3,1fr)"] {
    grid-template-columns: 1fr !important;
  }
  /* 4-col → 2-col (mantener) */
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns: repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  /* 5-col → 2-col */
  [style*="grid-template-columns: repeat(5, 1fr)"],
  [style*="grid-template-columns: repeat(5,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* HEADER: hide desktop nav + search + cat-strip */
  .dd-header-nav { display: none !important; }
  .dd-header-search { display: none !important; }
  .dd-cat-strip { display: none !important; }
  .dd-hamb { display: flex; align-items: center; justify-content: center; }

  /* h1 + grande */
  h1 { font-size: clamp(34px, 9vw, 56px) !important; line-height: 1 !important; }
  h2 { font-size: clamp(26px, 6vw, 38px) !important; }

  /* Hero pads */
  [style*="padding:72px 28px"], [style*="padding: 72px 28px"],
  [style*="padding:80px 28px"], [style*="padding: 80px 28px"],
  [style*="padding:96px 28px"], [style*="padding: 96px 28px"] {
    padding: 36px 18px !important;
  }
  [style*="padding:64px 28px"], [style*="padding: 64px 28px"] {
    padding: 32px 18px !important;
  }
  [style*="padding:56px 28px"], [style*="padding: 56px 28px"] {
    padding: 28px 18px !important;
  }
  [style*="padding:48px 28px"], [style*="padding: 48px 28px"] {
    padding: 24px 18px !important;
  }

  /* Stamps más pequeños */
  .stamp { width: 66px !important; height: 66px !important; font-size: 9px !important; }

  /* Tape no se ve raro */
  .tape { transform: rotate(-6deg) scale(0.85); }

  /* Item rows shrink */
  [style*="grid-template-columns: 140px 1fr auto"] {
    grid-template-columns: 100px 1fr !important;
    grid-template-rows: auto auto !important;
  }
  [style*="grid-template-columns: 140px 1fr auto"] > :nth-child(3) {
    grid-column: 1 / -1 !important;
    display: flex !important;
    align-items: baseline !important;
    gap: 12px !important;
  }
  [style*="grid-template-columns: 60px 1fr auto"] {
    grid-template-columns: 50px 1fr auto !important;
    gap: 10px !important;
  }

  /* Tabs scroll */
  .tabs { overflow-x: auto; flex-wrap: nowrap !important; -ms-overflow-style: none; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { white-space: nowrap; padding: 12px 12px !important; font-size: 13px !important; }

  /* Statbar smaller */
  .statbar { font-size: 11.5px !important; padding: 8px 10px !important; }

  /* Course card visual smaller stamp */
  .coursecard .stamp { display: none; }

  /* Footer */
  footer .marquee-track { font-size: 22px !important; }

  /* Status pill scroll-protect */
  [style*="overflow-x:auto"], [style*="overflow-x: auto"] { padding-bottom: 4px; }

  /* Big stamp on category hero — hide */
  [style*="position:absolute"][style*="top:36px"][style*="right:60px"],
  [style*="position: absolute"][style*="top:36px"][style*="right:60px"] {
    display: none;
  }

  /* Page nav bottom — make horizontal scroll */
  .dd-pagenav { max-width: calc(100vw - 28px); }
}

@media (max-width: 540px) {
  /* Stats grid */
  [style*="grid-template-columns: repeat(2, 1fr)"][style*="gap:24"],
  [style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: 1fr 1fr !important;
  }
  /* Trust bar 5 items → 2col */
  /* (already covered) */

  /* Header eyebrow stats hide */
  .dd-mobile-hide-xs { display: none !important; }

  /* Coursecard sticker offset */
  .coursecard[style*="background:transparent"] > div:nth-child(2) {
    transform: translateY(-14px) rotate(0deg) !important;
  }

  /* Stats numbers smaller */
  h1 { font-size: 38px !important; }

  /* Page nav bottom */
  .dd-pagenav { left: 8px !important; right: 8px !important; bottom: 8px !important; }
}

/* Ocultar el contador "pagination" labels en móvil */
@media (max-width: 600px) {
  .dd-pagination button:nth-child(n+4):nth-child(-n+5) { display: none; }
}
