/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --c-bg:            #edf0f7;
  --c-surface:       #ffffff;
  --c-primary:       #1b3d6e;
  --c-primary-dark:  #0e2340;
  --c-accent:        #d9302a;
  --c-success:       #1a7a45;
  --c-text:          #18293d;
  --c-text-muted:    #52677d;
  --c-border:        #d0d8e4;
  --c-banner-bg:     #8b1b14;
  --c-gold:          #f9c846;

  --shadow-xs: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 6px 20px rgba(0,0,0,0.11);
  --shadow-lg: 0 14px 40px rgba(0,0,0,0.16);

  --radius:    12px;
  --radius-sm: 7px;
  --radius-xl: 100px;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
          Ubuntu, Cantarell, sans-serif;
  --ease: 0.2s ease;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   CONTAINER
   ============================================================ */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.1rem;
}

/* ============================================================
   BANNER
   ============================================================ */
.banner {
  background: var(--c-banner-bg);
  color: #fff;
}

.banner__inner {
  display: flex;
  align-items: stretch;
  max-width: 1100px;
  margin: 0 auto;
}

.banner__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.18);
  padding: 0.9rem 1rem;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.banner__text {
  padding: 0.85rem 1.1rem;
  font-size: 0.875rem;
  line-height: 1.55;
}

.banner__text strong {
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
  background: linear-gradient(150deg, #0d2137 0%, #1b3d6e 55%, #1f5490 100%);
  color: #fff;
  padding: 2.5rem 1rem 3.75rem;
  position: relative;
  overflow: hidden;
}

.header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 44px;
  background: var(--c-bg);
  clip-path: ellipse(55% 100% at 50% 100%);
}

.header::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -80px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  pointer-events: none;
}

.header__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.header__titles { max-width: 580px; }

.header__title {
  font-size: clamp(1.75rem, 5.5vw, 2.6rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.header__tagline {
  font-size: clamp(1rem, 3vw, 1.2rem);
  font-weight: 600;
  color: var(--c-gold);
  margin-top: 0.25rem;
  letter-spacing: 0.01em;
}

.header__subtitle {
  font-size: 0.96rem;
  opacity: 0.78;
  margin-top: 0.75rem;
  line-height: 1.6;
}

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.2rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--ease),
    color var(--ease),
    border-color var(--ease),
    box-shadow var(--ease),
    transform var(--ease);
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.96); }

.btn__arrow {
  font-style: normal;
  display: inline-block;
  transition: transform var(--ease);
}

.btn:hover .btn__arrow { transform: translate(2px, -2px); }

.btn--share {
  background: rgba(255,255,255,0.10);
  color: #fff;
  border-color: rgba(255,255,255,0.30);
  align-self: flex-start;
  position: relative;
  z-index: 1;
}

.btn--share:hover {
  background: rgba(255,255,255,0.20);
  border-color: rgba(255,255,255,0.55);
}

.btn--primary {
  background: var(--card-color, var(--c-accent));
  color: #fff;
  border-color: var(--card-color, var(--c-accent));
}

.btn--primary:hover {
  filter: brightness(0.88);
  box-shadow: 0 4px 14px rgba(0,0,0,0.22);
}

.btn--secondary {
  background: transparent;
  color: var(--c-text-muted);
  border-color: var(--c-border);
  font-size: 0.855rem;
  padding: 0.6rem 1rem;
}

.btn--secondary:hover {
  background: var(--c-bg);
  color: var(--c-text);
  border-color: #b0bcc9;
}

.btn--copied {
  background: var(--c-success) !important;
  color: #fff !important;
  border-color: var(--c-success) !important;
}

/* ============================================================
   MAIN
   ============================================================ */
.main {
  flex: 1;
  padding: 2.5rem 0 4rem;
}

/* ============================================================
   BUSCADOR
   ============================================================ */
.search-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-xs);
  margin-bottom: 2.5rem;
}

.search-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 0.55rem;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.95rem;
  font-size: 1rem;
  pointer-events: none;
  user-select: none;
}

.search-input {
  width: 100%;
  padding: 0.85rem 2.8rem 0.85rem 2.65rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 1rem;
  color: var(--c-text);
  background: var(--c-bg);
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

.search-input:focus {
  outline: none;
  border-color: var(--c-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(27,61,110,0.13);
}

.search-input::placeholder { color: #9aaabb; }
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-clear {
  position: absolute;
  right: 0.65rem;
  background: none;
  border: none;
  font-size: 0.9rem;
  color: var(--c-text-muted);
  cursor: pointer;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease), color var(--ease);
}

.search-clear:hover { background: var(--c-border); color: var(--c-text); }

.search-status {
  font-size: 0.82rem;
  color: var(--c-text-muted);
  margin-top: 0.5rem;
  min-height: 1.2em;
}

/* ============================================================
   ENCABEZADO DE SECCIÓN
   ============================================================ */
.section-title {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  font-weight: 700;
  color: var(--c-primary);
  margin-bottom: 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-title::before {
  content: '';
  display: block;
  width: 4px;
  height: 1.3em;
  background: var(--c-accent);
  border-radius: 4px;
  flex-shrink: 0;
}

/* ============================================================
   SECCIÓN DE RECURSOS
   ============================================================ */
.resources-section { margin-bottom: 2.75rem; }

/* ============================================================
   TRES COLUMNAS POR CATEGORÍA (modo por defecto)
   ============================================================ */
.categories-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}

.category-column {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  background: var(--c-surface);
}

.category-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.9rem 1.1rem;
  background: var(--cat-color, var(--c-primary));
  color: #fff;
  width: 100%;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: filter var(--ease);
}

.category-header:hover {
  filter: brightness(0.91);
}

.category-header__icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.category-header__label {
  font-size: 0.9rem;
  font-weight: 700;
  flex: 1;
  letter-spacing: 0.01em;
}

.category-header__count {
  background: rgba(255,255,255,0.22);
  border-radius: var(--radius-xl);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  line-height: 1.5;
  flex-shrink: 0;
}

.category-header__chevron {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-left: 0.25rem;
  opacity: 0.85;
  transition: transform 0.3s ease;
}

.category-header[aria-expanded="true"] .category-header__chevron {
  transform: rotate(180deg);
}

/* ── Acordeón: animación con grid-template-rows ── */
.category-cards {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.32s ease;
}

.category-cards--open {
  grid-template-rows: 1fr;
}

.category-cards__inner {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   TARJETA DENTRO DE COLUMNA
   ============================================================ */
.category-column .resource-card {
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--c-border);
  box-shadow: none;
  padding: 1.15rem 1.1rem;
  transition: background var(--ease);
}

.category-column .resource-card:first-child {
  border-top: none;
}

.category-column .resource-card:hover {
  transform: none;
  background: #f4f7fc;
  box-shadow: none;
}

/* ============================================================
   TARJETA (modo búsqueda / flat)
   ============================================================ */
.resource-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-top: 4px solid var(--card-color, var(--c-accent));
  border-radius: var(--radius);
  padding: 1.35rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: box-shadow var(--ease), transform var(--ease);
}

.resource-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.resource-card__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-primary);
  line-height: 1.3;
}

.resource-card__description {
  font-size: 0.9rem;
  color: var(--c-text-muted);
  line-height: 1.58;
  flex: 1;
}

.resource-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

/* ============================================================
   GRID PLANO (modo búsqueda)
   ============================================================ */
.resources-grid--flat {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* ============================================================
   SIN RESULTADOS
   ============================================================ */
.no-results {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--c-text-muted);
}

.no-results__icon {
  font-size: 2.75rem;
  display: block;
  margin-bottom: 0.8rem;
}

.no-results p { font-size: 1rem; line-height: 1.5; }

.no-results__hint {
  font-size: 0.875rem;
  margin-top: 0.4rem;
  opacity: 0.7;
}

/* ============================================================
   SECCIÓN DE CONSEJOS
   ============================================================ */
.tips-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem 1.85rem;
  box-shadow: var(--shadow-xs);
  margin-bottom: 1rem;
}

.tips-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.tip-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.94rem;
  line-height: 1.55;
}

.tip-icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  margin-top: -0.1rem;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--c-primary-dark);
  color: rgba(255,255,255,0.65);
  padding: 2rem 1rem;
  text-align: center;
  border-top: 3px solid var(--c-accent);
}

.footer__primary {
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255,255,255,0.88);
  margin-bottom: 0.4rem;
}

.footer__secondary {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.45);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: #1b2e42;
  color: #fff;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-xl);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  z-index: 9999;
  transition: transform 0.26s cubic-bezier(0.34,1.56,0.64,1), opacity 0.22s ease;
}

.toast.toast--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============================================================
   RESPONSIVE – TABLET (≥ 600px)
   ============================================================ */
@media (min-width: 600px) {
  .resources-grid--flat {
    grid-template-columns: 1fr 1fr;
  }

  .header__content {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }

  .btn--share { align-self: flex-end; flex-shrink: 0; }

  .tips-list { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   RESPONSIVE – DESKTOP (≥ 860px)
   ============================================================ */
@media (min-width: 860px) {
  .container { padding: 0 1.5rem; }

  .main { padding: 3rem 0 5rem; }

  .header { padding: 3rem 1.5rem 4.25rem; }

  .categories-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .tips-section { padding: 2rem 2rem 2.1rem; }

  .tips-list { grid-template-columns: 1fr 1fr; gap: 1rem; }
}

/* ============================================================
   FOCO VISIBLE
   ============================================================ */
:focus-visible {
  outline: 3px solid var(--c-primary);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ============================================================
   MOVIMIENTO REDUCIDO
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
