/* ==========================================================================
   components.css — logo, navegación, botones, botón de tema, tarjeta, redes
   ========================================================================== */

/* Logo */
.logo {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--step-0);
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.logo:hover {
  color: var(--accent-hover);
}

/* Navegación: en móvil, lista vertical (plegada con JavaScript); en escritorio, en línea */
.site-nav ul {
  display: grid;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}

.site-nav .btn {
  width: 100%;
}

@media (min-width: 52em) {
  .site-nav ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2) var(--space-5);
  }

  .site-nav .btn {
    width: auto;
  }
}

/* Con JavaScript, en móvil el menú está plegado hasta que se pulsa el botón */
@media (max-width: 51.99em) {
  html.js .site-nav:not(.is-open) {
    display: none;
  }
}

.site-nav a:not(.btn) {
  display: inline-block;
  padding-block: var(--space-2);
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  border-block-end: 2px solid transparent;
}

.site-nav a:not(.btn):hover,
.site-nav a:not(.btn)[aria-current="page"] {
  color: var(--accent);
  border-block-end-color: var(--accent);
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: var(--space-3) var(--space-5);
  border: 2px solid transparent;
  border-radius: 999px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn--primary:hover {
  background: var(--accent-hover);
  color: var(--accent-ink);
}

.btn--ghost {
  border-color: var(--border-strong);
  color: var(--text);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
}

/* Botón de tema: solo existe si hay JavaScript */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background: transparent;
  border: 2px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle svg {
  width: 1.4rem;
  height: 1.4rem;
}

html:not(.js) .theme-toggle,
html:not(.js) .menu-toggle {
  display: none;
}

/* Botón de volver (solo móvil, en las páginas que no son el inicio) */
.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 2px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  transition: border-color 0.2s, color 0.2s;
}

.back-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.back-link svg {
  width: 1.4rem;
  height: 1.4rem;
}

@media (min-width: 52em) {
  .back-link {
    display: none;
  }
}

/* Botón del menú (solo móvil, solo con JavaScript) */
.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background: transparent;
  border: 2px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.menu-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.menu-toggle svg {
  width: 1.4rem;
  height: 1.4rem;
}

.menu-toggle .icon-close,
.menu-toggle[aria-expanded="true"] .icon-open {
  display: none;
}

.menu-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

@media (min-width: 52em) {
  .menu-toggle {
    display: none;
  }
}

/* Texto sobre la portada */
.eyebrow {
  margin-block-end: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--accent);
}

.hero__text > * + * {
  margin-block-start: var(--space-5);
}

.hero__text .eyebrow {
  margin-block-start: 0;
}

.hero__text h1 {
  margin-block-start: 0;
}

.accent {
  color: var(--accent);
}

.lead {
  font-size: var(--step-1);
  color: var(--text-muted);
}

.hero__note {
  font-size: var(--step--1);
  color: var(--text-muted);
}

/* Tarjeta decorativa tipo ventana */
.window {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: var(--step--1);
}

.window__bar {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-block-end: 1px solid var(--border);
}

.window__bar i {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--border-strong);
}

.window__bar i:first-child {
  background: var(--warm);
}

.window__body {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-4);
}

.window__key {
  color: var(--accent);
}

.window__comment {
  color: var(--warm);
}

/* Pie: listas de enlaces */
.footer-title {
  margin-block-end: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--text-muted);
}

.footer-list {
  display: grid;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}

.footer-list a {
  display: inline-block;
  padding-block: var(--space-1);
  color: var(--text);
}

.footer-list a:hover {
  color: var(--accent);
}

/* Redes sociales (solo se muestran las que tienen dirección) */
.social-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: 0;
  list-style: none;
}

.social-list a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 2px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  transition: border-color 0.2s, color 0.2s;
}

.social-list a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.social-list svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

/* Icono del botón de tema: sol en oscuro (pasar a claro), luna en claro */
.theme-toggle .icon-moon,
:root[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

/* Tarjeta de contenido */
.card {
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card h3 {
  margin-block-end: var(--space-2);
  font-size: var(--step-0);
}

.card p {
  color: var(--text-muted);
}

/* Pasos del proceso */
.steps {
  display: grid;
  gap: var(--space-4);
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  max-width: 65ch;
  padding-inline-start: 2.5rem;
}

.steps li::before {
  position: absolute;
  inset-inline-start: 0;
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--accent);
}

.section__more {
  font-weight: 700;
}

/* Lista de conceptos de un servicio */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  padding: 0;
  list-style: none;
}

.tag-list li {
  padding: var(--space-1) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: var(--step--1);
}

.card__title {
  font-size: var(--step-1);
}

.card > * + * {
  margin-block-start: var(--space-3);
}

/* Texto solo para lectores de pantalla */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Figura con pie */
.figure {
  margin-block-start: var(--space-7);
}

.figure img {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.figure figcaption {
  margin-block-start: var(--space-2);
  font-size: var(--step--1);
  color: var(--text-muted);
}

/* Lista simple con separación */
.plain-list {
  display: grid;
  gap: var(--space-3);
  max-width: 65ch;
  padding-inline-start: var(--space-5);
}

/* Formulario */
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: var(--space-5);
}

.form {
  display: grid;
  gap: var(--space-5);
  max-width: 40rem;
}

.field {
  display: grid;
  gap: var(--space-2);
}

.field label {
  font-weight: 700;
}

.field__hint {
  font-weight: 400;
  color: var(--text-muted);
}

.field input:not([type="checkbox"]),
.field select,
.field textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
}

.field textarea {
  resize: vertical;
}

.field [aria-invalid="true"] {
  border-color: var(--warm);
  border-width: 3px;
}

.field__error {
  color: var(--warm);
  font-size: var(--step--1);
  font-weight: 700;
}

.field--check {
  grid-template-columns: auto 1fr;
  align-items: start;
  column-gap: var(--space-3);
}

.field--check input {
  width: 1.4rem;
  height: 1.4rem;
  margin-block-start: 0.2rem;
  accent-color: var(--accent);
}

.field--check label {
  font-weight: 400;
}

.field--check .field__error {
  grid-column: 1 / -1;
}

/* Campo trampa anti-spam: fuera de pantalla, sin display:none (algunos bots lo detectan) */
.field--trap {
  position: absolute;
  inset-inline-start: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-status {
  max-width: 40rem;
  margin-block-end: var(--space-5);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  font-weight: 700;
}

.form-status--error {
  border-color: var(--warm);
}

/* Página de contacto */
.contact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: var(--space-7);
  margin-block-start: var(--space-7);
  align-items: start;
}

.contact__title {
  margin-block-end: var(--space-3);
  font-size: var(--step-1);
}

@media (min-width: 52em) {
  .contact {
    grid-template-columns: 2fr 1fr;
  }
}

.field ::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

/* Botón con aspecto de enlace (enlace «Configurar cookies» del pie) */
.link-button {
  padding: var(--space-1) 0;
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.link-button:hover {
  color: var(--accent);
}

/* Banner de cookies */
.cookie-banner {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 90;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-block-start: 2px solid var(--accent);
  box-shadow: 0 -0.5rem 2rem rgb(0 0 0 / 0.25);
}

.cookie-banner[hidden] {
  display: none;
}

.cookie-banner__inner {
  display: grid;
  gap: var(--space-4);
  padding-block: var(--space-5);
}

.cookie-banner__title {
  font-size: var(--step-1);
}

.cookie-banner__panel {
  display: grid;
  gap: var(--space-3);
  justify-items: start;
  padding: var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

.cookie-banner__panel[hidden] {
  display: none;
}

.cookie-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.cookie-option input {
  width: 1.4rem;
  height: 1.4rem;
  margin-block-start: 0.15rem;
  accent-color: var(--accent);
}

/* Botón flotante de WhatsApp */
.whatsapp-float {
  position: fixed;
  inset-block-end: var(--space-4);
  inset-inline-end: var(--space-4);
  z-index: 80;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  background: #25d366; /* verde de WhatsApp; el icono oscuro da contraste suficiente */
  color: #0f1b2d;
  border-radius: 50%;
  box-shadow: 0 0.25rem 1rem rgb(0 0 0 / 0.3);
  transition: transform 0.2s;
}

.whatsapp-float:hover {
  color: #0f1b2d;
  transform: scale(1.08);
}

.whatsapp-float svg {
  width: 1.9rem;
  height: 1.9rem;
  fill: currentColor;
}

@media print {
  .whatsapp-float {
    display: none;
  }
}

/* Página interna de diagnóstico del correo */
.diag {
  width: 100%;
  max-width: 40rem;
  border-collapse: collapse;
  font-size: var(--step--1);
}

.diag th,
.diag td {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  text-align: start;
}

.diag th {
  width: 45%;
  background: var(--surface);
}

.diag__title {
  margin-block: var(--space-6) var(--space-3);
  font-size: var(--step-1);
}

.diag__form {
  margin-block: var(--space-5);
}

.diag__log {
  max-height: 24rem;
  overflow: auto;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  white-space: pre-wrap;
  word-break: break-word;
}
