/* ===================================================
   MotorHeritage Certificación S.L.U. — Capa visual 2026
   Se carga después de styles.css. No elimina estilos antiguos:
   los refina. Si este archivo no carga, la web sigue funcionando.
   =================================================== */

:root {
  --mh-accent: #2bb894;
  --mh-accent-2: #7be0c3;
  --mh-gold: #d8b46a;
  --mh-ink: #070908;
  --mh-glow: rgba(43, 184, 148, 0.35);
  --mh-grad: linear-gradient(120deg, #1F6F5E 0%, #2bb894 45%, #d8b46a 100%);
  --mh-grad-soft: linear-gradient(135deg, rgba(43,184,148,.16), rgba(216,180,106,.08));
  --mh-border-glow: linear-gradient(140deg, rgba(123,224,195,.55), rgba(255,255,255,.04) 40%, rgba(216,180,106,.35));
  --mh-ease: cubic-bezier(.2, .8, .2, 1);
  --color-bg: #070908;
}

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }

html { scroll-padding-top: calc(var(--header-h) + 16px); }
body { background: var(--mh-ink); position: relative; }
::selection { background: rgba(43,184,148,.45); color: #fff; }

/* ---------- Fondo vivo: aurora + rejilla técnica + grano ---------- */
.mh-aurora {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(60vw 40vw at 85% -10%, rgba(43,184,148,.13), transparent 60%),
    radial-gradient(50vw 40vw at -10% 30%, rgba(216,180,106,.07), transparent 60%),
    radial-gradient(70vw 50vw at 50% 120%, rgba(31,111,94,.18), transparent 60%),
    var(--mh-ink);
}
.mh-aurora::before {
  content: ""; position: absolute; inset: -50%;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, #000 20%, transparent 65%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 65%);
  transform: perspective(900px) rotateX(55deg) translateY(-8%);
  animation: mh-grid 30s linear infinite;
}
.mh-aurora::after {
  content: ""; position: absolute; inset: 0; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes mh-grid { to { background-position: 0 560px, 560px 0; } }

/* ---------- Barra de progreso de lectura ---------- */
.mh-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%; z-index: 2000;
  transform-origin: 0 50%; transform: scaleX(var(--p, 0));
  background: var(--mh-grad); box-shadow: 0 0 12px var(--mh-glow);
  pointer-events: none;
}

/* ---------- Cabecera de cristal ---------- */
.site-header {
  background: rgba(7, 9, 8, .55) !important;
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: background .3s, border-color .3s, box-shadow .3s;
}
.site-header.scrolled {
  background: rgba(7, 9, 8, .78) !important;
  border-bottom-color: rgba(255,255,255,.07);
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
}
.nav-links a:not(.nav-cta) { position: relative; }
.nav-links a:not(.nav-cta)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; border-radius: 2px;
  background: var(--mh-grad); transform: scaleX(0); transform-origin: left;
  transition: transform .35s var(--mh-ease);
}
.nav-links a:not(.nav-cta):hover::after, .nav-links a.active:not(.nav-cta)::after { transform: scaleX(1); }

/* Botón de búsqueda rápida (Ctrl/⌘ K) */
.mh-cmdk-btn {
  display: inline-flex; align-items: center; gap: .45rem; margin-left: .75rem;
  padding: .38rem .6rem .38rem .7rem; border-radius: 999px; cursor: pointer;
  font: 500 .78rem/1 var(--font-body); color: var(--color-text-muted);
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1);
  transition: border-color .25s, color .25s, background .25s;
}
.mh-cmdk-btn:hover { color: #fff; border-color: rgba(123,224,195,.5); background: rgba(43,184,148,.08); }
.mh-cmdk-btn svg { width: 15px; height: 15px; }
.mh-cmdk-btn kbd {
  font: 600 .68rem/1 var(--font-body); padding: .2rem .35rem; border-radius: 5px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: var(--color-text);
}
@media (max-width: 1440px) { .mh-cmdk-btn .mh-cmdk-label, .mh-cmdk-btn kbd { display: none; } .mh-cmdk-btn { padding: .45rem; margin-left: .4rem; } }
.nav-links a { white-space: nowrap; }
@media (max-width: 1250px) { .nav-links a { padding: .5rem .6rem; font-size: .85rem; } }
@media (max-width: 768px) { .mh-cmdk-btn { margin-left: auto; margin-right: .5rem; padding: .45rem; } }

/* ---------- Tipografía y titulares ---------- */
.hero h1 span, .text-secondary, .mh-grad-text {
  background: var(--mh-grad); background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent !important;
  animation: mh-sheen 8s ease-in-out infinite alternate;
}
@keyframes mh-sheen { to { background-position: 100% center; } }
.section-header .section-label, .section-label {
  display: inline-flex; align-items: center; gap: .55rem;
  letter-spacing: .14em;
}
.section-label::before {
  content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%;
  background: var(--mh-accent); box-shadow: 0 0 0 4px rgba(43,184,148,.18);
}
.divider-accent { background: var(--mh-grad) !important; height: 3px !important; border-radius: 3px; }

/* Píldora de estado en el hero */
.mh-live-pill {
  display: inline-flex; align-items: center; gap: .55rem; margin-top: 1.75rem;
  padding: .45rem .9rem; border-radius: 999px; font-size: .82rem; color: var(--color-text);
  background: rgba(7,9,8,.55); border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.mh-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mh-accent); position: relative; }
.mh-live-dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--mh-accent); animation: mh-ping 1.8s var(--mh-ease) infinite;
}
@keyframes mh-ping { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }

/* ---------- Botones ---------- */
.btn { position: relative; overflow: hidden; isolation: isolate; transition: transform .25s var(--mh-ease), box-shadow .3s, background .3s, border-color .3s, color .3s; }
.btn-primary {
  background: linear-gradient(135deg, #1F6F5E, #27977c) !important;
  border-color: transparent !important;
  box-shadow: 0 8px 24px rgba(31,111,94,.35), inset 0 1px 0 rgba(255,255,255,.15);
}
.btn-primary:hover { box-shadow: 0 14px 36px rgba(43,184,148,.4), inset 0 1px 0 rgba(255,255,255,.2); transform: translateY(-2px); }
.btn::after {
  content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%; z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.22), transparent);
  transform: skewX(-20deg); transition: left .7s var(--mh-ease);
}
.btn:hover::after { left: 140%; }
.btn-outline:hover { border-color: var(--mh-accent-2) !important; background: rgba(43,184,148,.08) !important; }
.btn:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--mh-accent-2); outline-offset: 3px;
}

/* ---------- Tarjetas: borde luminoso + foco que sigue al ratón ---------- */
.card-glass {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02)) !important;
  border: 1px solid rgba(255,255,255,.08);
  transition: transform .45s var(--mh-ease), box-shadow .45s var(--mh-ease), border-color .3s;
  transform-style: preserve-3d;
}
.card-glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, -20%), rgba(43,184,148,.13), transparent 45%);
  opacity: 0; transition: opacity .35s;
}
.card-glass::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, -20%), rgba(123,224,195,.7), transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .35s;
}
.card-glass:hover::before, .card-glass:hover::after { opacity: 1; }
.card-glass:hover { box-shadow: 0 24px 60px rgba(0,0,0,.45), 0 0 0 1px rgba(43,184,148,.08); }
.card-glass > * { position: relative; z-index: 1; }

.servicio-image { overflow: hidden; }
.servicio-image img { transition: transform 1.2s var(--mh-ease), filter .6s; filter: saturate(.92); }
.home-service-card:hover .servicio-image img { transform: scale(1.06); filter: saturate(1.08); }
.service-icon-wrap, .ci-icon, .req-icon, .situation-icon {
  background: var(--mh-grad-soft) !important; border: 1px solid rgba(123,224,195,.22) !important;
  box-shadow: 0 0 24px rgba(43,184,148,.12);
}

/* Paso del proceso: número con degradado y línea de conexión */
.step-number {
  background: var(--mh-grad); -webkit-background-clip: text; background-clip: text; color: transparent !important;
}
.process-grid { position: relative; }
@media (min-width: 900px) {
  .process-grid::before {
    content: ""; position: absolute; left: 6%; right: 6%; top: 46px; height: 1px; z-index: 0;
    background: linear-gradient(90deg, transparent, rgba(123,224,195,.45), rgba(216,180,106,.35), transparent);
    transform: scaleX(var(--line, 0)); transform-origin: left; transition: transform 1.4s var(--mh-ease);
  }
  .process-grid.mh-in::before { --line: 1; }
}

/* ---------- Revelado al hacer scroll (más suave y nunca deja contenido oculto) ---------- */
.reveal { transition: opacity .8s var(--mh-ease), transform .8s var(--mh-ease), filter .8s var(--mh-ease) !important; }
.reveal:not(.visible) { filter: blur(6px); }
.mh-no-reveal .reveal, .mh-print .reveal { opacity: 1 !important; transform: none !important; filter: none !important; }
@media print { .reveal { opacity: 1 !important; transform: none !important; filter: none !important; } .mh-aurora, .mh-progress, .mh-totop { display: none !important; } }

/* ---------- Formularios ---------- */
input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="password"], input[type="date"], select, textarea {
  transition: border-color .25s, box-shadow .25s, background .25s;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(123,224,195,.7) !important;
  box-shadow: 0 0 0 4px rgba(43,184,148,.15) !important;
}
.form-check input[type="checkbox"] { accent-color: var(--mh-accent); }

/* ---------- Volver arriba con anillo de progreso ---------- */
.mh-totop {
  position: fixed; right: 20px; bottom: 20px; width: 48px; height: 48px; z-index: 900;
  border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  background: rgba(10,14,12,.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  opacity: 0; transform: translateY(16px) scale(.9); pointer-events: none;
  transition: opacity .35s, transform .35s var(--mh-ease);
}
.mh-totop.show { opacity: 1; transform: none; pointer-events: auto; }
.mh-totop svg.ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.mh-totop svg.ring circle { fill: none; stroke-width: 2.5; }
.mh-totop .arrow { position: relative; width: 18px; height: 18px; }
.cookie-banner.show ~ .mh-totop { bottom: 120px; }

/* ---------- Paleta de comandos ---------- */
.mh-cmdk {
  position: fixed; inset: 0; z-index: 5000; display: none; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.mh-cmdk.open { display: flex; animation: mh-fade .2s ease; }
@keyframes mh-fade { from { opacity: 0; } }
.mh-cmdk-panel {
  width: min(640px, 100%); border-radius: 18px; overflow: hidden;
  background: rgba(14,18,16,.96); border: 1px solid rgba(123,224,195,.22);
  box-shadow: 0 40px 120px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.03), 0 0 60px rgba(43,184,148,.12);
  animation: mh-pop .25s var(--mh-ease);
}
@keyframes mh-pop { from { transform: translateY(-10px) scale(.98); opacity: 0; } }
.mh-cmdk-search { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.15rem; border-bottom: 1px solid rgba(255,255,255,.07); }
.mh-cmdk-search svg { width: 20px; height: 20px; color: var(--mh-accent-2); flex: none; }
.mh-cmdk-search input {
  flex: 1; min-width: 0; background: transparent !important; border: 0 !important; box-shadow: none !important;
  color: #fff; font: 500 1.02rem var(--font-body); outline: none; padding: 0;
}
.mh-cmdk-list { max-height: 52vh; overflow: auto; padding: .5rem; margin: 0; }
.mh-cmdk-group { padding: .6rem .75rem .3rem; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--color-text-subtle); }
.mh-cmdk-item {
  display: flex; align-items: center; gap: .8rem; padding: .7rem .8rem; border-radius: 10px;
  color: var(--color-text); cursor: pointer; text-decoration: none;
}
.mh-cmdk-item .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.05); flex: none; font-size: .78rem; font-weight: 700; color: var(--mh-accent-2); }
.mh-cmdk-item .tx { display: flex; flex-direction: column; min-width: 0; }
.mh-cmdk-item .tx small { color: var(--color-text-muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mh-cmdk-item[aria-selected="true"], .mh-cmdk-item:hover { background: rgba(43,184,148,.12); color: #fff; }
.mh-cmdk-empty { padding: 1.5rem; text-align: center; color: var(--color-text-muted); }
.mh-cmdk-foot { display: flex; gap: 1rem; padding: .65rem 1rem; border-top: 1px solid rgba(255,255,255,.07); font-size: .72rem; color: var(--color-text-subtle); }
.mh-cmdk-foot kbd { font: 600 .68rem var(--font-body); padding: .1rem .3rem; border-radius: 4px; background: rgba(255,255,255,.08); }

/* ---------- Sección «¿Qué trámite necesitas?» (inicio) ---------- */
.mh-anexos-home { position: relative; }
.mh-anexo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-top: 2.5rem; }
@media (max-width: 1100px) { .mh-anexo-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .mh-anexo-grid { grid-template-columns: 1fr; } }
.mh-anexo-card { display: flex; flex-direction: column; gap: .8rem; padding: 1.6rem; border-radius: var(--radius-lg); color: var(--color-text); text-decoration: none; }
.mh-anexo-card:hover { color: var(--color-text); }
.mh-anexo-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.mh-anexo-top .service-icon-wrap { margin: 0 !important; }
.mh-anexo-code { white-space: nowrap;
  font: 700 .78rem/1 var(--font-body); letter-spacing: .08em; padding: .4rem .6rem; border-radius: 8px;
  color: #04110d; background: var(--mh-grad);
}
.mh-anexo-mode { font-size: .76rem; color: var(--color-text-muted); display: inline-flex; gap: .4rem; align-items: center; padding: .3rem .6rem; border-radius: 999px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); align-self: flex-start; }
.mh-anexo-mode svg { width: 14px; height: 14px; color: var(--mh-accent-2); flex: none; }
.mh-anexo-card h3 { font-size: 1.15rem; margin: 0; }
.mh-anexo-card p { font-size: .9rem; color: var(--color-text-muted); margin: 0; flex: 1; }
.mh-anexo-go { font-size: .85rem; font-weight: 600; color: var(--mh-accent-2); display: inline-flex; gap: .35rem; align-items: center; }
.mh-anexo-go span { transition: transform .3s var(--mh-ease); }
.mh-anexo-card:hover .mh-anexo-go span { transform: translateX(4px); }
.mh-anexos-cta { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin-top: 2.25rem; }
.mh-skeleton { border-radius: var(--radius-lg); min-height: 230px; background: linear-gradient(90deg, rgba(255,255,255,.03), rgba(255,255,255,.07), rgba(255,255,255,.03)); background-size: 200% 100%; animation: mh-shimmer 1.4s infinite; }
@keyframes mh-shimmer { to { background-position: -200% 0; } }

/* Pie: enlace extra a Condiciones */
.footer-bottom-links { flex-wrap: wrap; gap: .5rem 1.25rem; }
@media (max-width: 768px) { .footer-bottom-links { justify-content: center; } .footer-bottom p { text-align: center; } }

/* ---------- Página legal ---------- */
.legal-content h2 { scroll-margin-top: calc(var(--header-h) + 20px); }
.legal-content h2::before { content: ""; display: inline-block; width: 4px; height: .9em; margin-right: .6rem; border-radius: 3px; background: var(--mh-grad); vertical-align: -0.08em; }
.legal-content table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: .9rem; }
.legal-content th, .legal-content td { text-align: left; padding: .65rem .75rem; border-bottom: 1px solid rgba(255,255,255,.08); vertical-align: top; }
.legal-content th { color: #fff; font-weight: 600; background: rgba(255,255,255,.03); }
.mh-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mh-toc { margin: 1.5rem 0 2rem; padding: 1.1rem 1.25rem; border-radius: 14px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.07); }
.mh-toc strong { display: block; margin-bottom: .5rem; color: #fff; font-size: .9rem; }
.mh-toc ol { margin: 0; padding-left: 1.2rem; columns: 2; column-gap: 2rem; font-size: .88rem; }
@media (max-width: 600px) { .mh-toc ol { columns: 1; } }
.mh-toc li { list-style: decimal; margin: .2rem 0; break-inside: avoid; }

/* ---------- Accesibilidad: menos movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal:not(.visible) { filter: none; }
}

/* El atributo hidden siempre oculta, aunque la clase defina display */
[hidden] { display: none !important; }
.legal-content .btn { max-width: 100%; white-space: normal; text-align: center; }
