/* ==========================================================================
   Adaptación Responsive y Soporte WordPress Admin Bar
   ========================================================================== */

/* 1. Offset de WordPress Admin Bar */
.admin-bar .site-header {
  top: 32px;
}

@media screen and (max-width: 782px) {
  .admin-bar .site-header {
    top: 46px;
  }
}

/* 2. Breakpoints de Cabecera y Navegación */
@media (max-width: 1180px) {
  .nav-shell {
    width: calc(100% - 36px);
    gap: 17px;
  }

  .brand {
    flex-basis: 156px;
  }

  .main-nav {
    gap: 13px;
  }

  .main-nav a {
    font-size: 0.65rem;
  }

  .header-cta {
    padding: 0 14px;
  }
}

@media (max-width: 900px) {
  .site-header {
    background: rgba(8, 17, 13, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .nav-shell {
    height: 72px;
  }

  body.has-solid-header .site-main {
    padding-top: calc(72px + var(--td-space-xl));
  }

  .brand {
    flex-basis: 150px;
  }

  .menu-button {
    display: flex;
    order: 3;
    margin-left: auto;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 72px;
    left: 18px;
    right: 18px;
    padding: 23px;
    background: #0d1d16;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--td-radius-md);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  .header-cta {
    order: 2;
    margin-left: 0;
  }

  .main-nav[data-open="true"] {
    display: flex;
  }

  .main-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    width: 100%;
  }

  .main-nav a {
    font-size: 0.85rem;
    padding: 0.5rem 0;
    display: block;
    width: 100%;
  }
}

@media (max-width: 600px) {
  .nav-shell {
    width: calc(100% - 28px);
  }

  .header-cta {
    display: none;
  }
}

/* 3. Breakpoints de Footer */
@media (max-width: 1000px) {
  .footer-main {
    grid-template-columns: 1.5fr repeat(2, 1fr);
  }

  .footer-brand {
    grid-row: span 2;
  }

  .footer-bottom {
    grid-template-columns: 1fr auto;
  }

  .footer-bottom nav {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-content: center;
  }
}

@media (max-width: 650px) {
  .site-footer {
    padding: 58px 5% 0;
  }

  .footer-main {
    grid-template-columns: 1fr;
    gap: 0;
    width: 100%;
    padding-bottom: 0;
  }

  .footer-brand {
    grid-column: 1 / -1;
    grid-row: auto;
    margin-bottom: 30px;
  }

  .footer-contact {
    grid-column: auto;
  }

  .footer-bottom {
    display: flex;
    width: 100%;
    min-height: 0;
    padding: 27px 0;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
  }

  .footer-bottom nav {
    order: -1;
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 12px 18px;
  }
}

/* La tabla legal se convierte en fichas legibles en pantallas estrechas. */
@media (max-width: 700px) {
  .cookie-policy-table {
    overflow: visible;
  }

  .cookie-policy-table table,
  .cookie-policy-table tbody,
  .cookie-policy-table tr,
  .cookie-policy-table td {
    display: block;
    width: 100%;
  }

  .cookie-policy-table table {
    border: 0;
  }

  .cookie-policy-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .cookie-policy-table tr {
    margin-bottom: 18px;
    border: 1px solid rgba(14, 48, 34, 0.28);
    border-radius: 8px;
    overflow: hidden;
  }

  .cookie-policy-table td {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 10px;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid rgba(14, 48, 34, 0.18);
    overflow-wrap: anywhere;
  }

  .cookie-policy-table td:last-child {
    border-bottom: 0;
  }

  .cookie-policy-table td::before {
    color: #0d2b20;
    font-size: 0.8em;
    font-weight: 700;
    overflow-wrap: normal;
    word-break: normal;
  }

  .cookie-policy-table td:nth-child(1)::before {
    content: "Cookie";
  }

  .cookie-policy-table td:nth-child(2)::before {
    content: "Responsable";
  }

  .cookie-policy-table td:nth-child(3)::before {
    content: "Finalidad";
  }

  .cookie-policy-table td:nth-child(4)::before {
    content: "Duración";
  }
}

/* 4. Movilidad Reducida */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
