:root {
  --brand: #a70f2d;
  --brand-dark: #260711;
  --brand-soft: #fff7e6;
  --brand-line: #f4c430;
  --surface: #f8fafc;
  --surface-card: #ffffff;
  --surface-card-soft: rgba(255, 255, 255, 0.85);
  --surface-muted: #f8fafc;
  --surface-subtle: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #020617;
  --text-muted: #475569;
  --text-soft: #64748b;
  --header-bg: rgba(255, 255, 255, 0.92);
  --footer-bg: #020617;
  --brand-text: #a70f2d;
  --warning-surface: #fffbeb;
  --warning-text: #92400e;
  --muted: #64748b;
}

.dark {
  color-scheme: dark;
  --brand-soft: rgba(167, 15, 45, 0.22);
  --surface: #050816;
  --surface-card: rgba(15, 23, 42, 0.92);
  --surface-card-soft: rgba(15, 23, 42, 0.84);
  --surface-muted: rgba(15, 23, 42, 0.74);
  --surface-subtle: rgba(30, 41, 59, 0.88);
  --border: rgba(148, 163, 184, 0.28);
  --border-strong: rgba(148, 163, 184, 0.42);
  --text: #f8fafc;
  --text-muted: #cbd5e1;
  --text-soft: #94a3b8;
  --header-bg: rgba(8, 13, 28, 0.86);
  --footer-bg: #020617;
  --brand-text: #f8b4c2;
  --warning-surface: rgba(120, 53, 15, 0.22);
  --warning-text: #fde68a;
  --muted: #94a3b8;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--surface);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 18%, rgba(167, 15, 45, 0.14), transparent 18rem),
    radial-gradient(circle at 82% 38%, rgba(244, 196, 48, 0.10), transparent 20rem),
    radial-gradient(circle at 48% 82%, rgba(167, 15, 45, 0.10), transparent 18rem);
  opacity: 0.9;
  animation: glow-drift 18s ease-in-out infinite alternate;
}

.app-bg {
  background-color: var(--surface);
  background-image: url("../img/fondo1.png");
  background-position: center top;
  background-repeat: no-repeat;
  background-size: 100% auto;
  background-attachment: fixed;
  animation: app-bg-drift 26s ease-in-out infinite alternate;
}

.dark .app-bg {
  background-image: url("../img/fondomodooscuro2.png");
}

@keyframes app-bg-drift {
  from {
    background-position: center top;
    background-size: 100% auto;
  }

  to {
    background-position: center 1.5rem;
    background-size: 104% auto;
  }
}

.glass-header {
  background: var(--header-bg);
  backdrop-filter: blur(18px);
  transition: background 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.glass-header.is-scrolled {
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.10);
}

.dark .glass-header.is-scrolled {
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
}

.nav-link.is-active {
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(167, 15, 45, 0.10);
}

.theme-toggle {
  background: var(--surface-card);
  border-color: var(--border);
  color: var(--text-muted);
}

.theme-toggle:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

.focus-ring:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(167, 15, 45, 0.16), 0 0 26px rgba(167, 15, 45, 0.14);
}

.route-line::before {
  content: "";
  position: absolute;
  left: 1.07rem;
  top: 2.35rem;
  bottom: -1.45rem;
  width: 2px;
  background: var(--brand-line);
}

.route-line:last-child::before {
  display: none;
}

.trip-timeline {
  --trip-rail-right: 0.95rem;
  --trip-rail-top: 1.35rem;
  --trip-rail-bottom: 1.35rem;
  --trip-progress-offset: 0.28rem;
  position: relative;
}

.trip-timeline::before {
  content: "";
  position: absolute;
  right: var(--trip-rail-right);
  top: var(--trip-rail-top);
  bottom: var(--trip-rail-bottom);
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(167, 15, 45, 0.18), rgba(167, 15, 45, 0.9) 42%, rgba(167, 15, 45, 0.28));
  box-shadow: 0 0 12px rgba(167, 15, 45, 0.2);
  animation: trip-rail-glow 2.8s ease-in-out infinite;
}

.trip-timeline::after {
  content: "";
  position: absolute;
  right: calc(var(--trip-rail-right) - 4px);
  top: calc(var(--trip-rail-top) + var(--trip-progress-offset));
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.78), 0 0 14px rgba(167, 15, 45, 0.65);
  animation: trip-route-progress calc(var(--trip-stop-count, 2) * 1.2s) linear infinite;
}

.trip-timeline-stop {
  position: relative;
  opacity: 0;
  transform: translateY(5px);
  animation: trip-stop-reveal 480ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(var(--trip-stop-index, 0) * 65ms);
}

.trip-timeline-rail {
  display: flex;
  justify-content: center;
  padding-top: 0.1rem;
}

.trip-timeline-marker {
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.trip-timeline-marker svg {
  width: 1.45rem;
  height: 1.45rem;
}

.trip-timeline-marker-origin,
.trip-timeline-marker-destination {
  filter: drop-shadow(0 1px 5px rgba(167, 15, 45, 0.3));
}

.trip-timeline-marker-origin::after,
.trip-timeline-marker-destination::after {
  content: "";
  position: absolute;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  border: 1px solid rgba(167, 15, 45, 0.28);
  animation: trip-marker-pulse 2.6s ease-out infinite;
}

.trip-timeline-marker-middle {
  width: 1.2rem;
  height: 1.2rem;
}

.trip-timeline-dot {
  width: 0.68rem;
  height: 0.68rem;
  border-radius: 999px;
  border: 2px solid rgba(167, 15, 45, 0.42);
  background: rgba(255, 255, 255, 0.9);
}

@keyframes trip-stop-reveal {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes trip-rail-glow {
  0%, 100% {
    opacity: 0.85;
    box-shadow: 0 0 12px rgba(167, 15, 45, 0.18);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 16px rgba(167, 15, 45, 0.32);
  }
}

@keyframes trip-marker-pulse {
  0% {
    transform: scale(0.85);
    opacity: 0.68;
  }
  70% {
    transform: scale(1.18);
    opacity: 0;
  }
  100% {
    transform: scale(1.18);
    opacity: 0;
  }
}

@keyframes trip-route-progress {
  0% {
    transform: translateY(0);
    opacity: 0.45;
  }
  12%,
  88% {
    opacity: 1;
  }
  100% {
    transform: translateY(calc(100% - var(--trip-rail-top) - var(--trip-rail-bottom) - 10px - (var(--trip-progress-offset) * 2)));
    opacity: 0.45;
  }
}

@media (max-width: 639px) {
  .trip-timeline {
    --trip-rail-right: 0.78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .trip-timeline::before,
  .trip-timeline::after,
  .trip-timeline-marker-origin::after,
  .trip-timeline-marker-destination::after,
  .trip-timeline-stop {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}

.js [data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 520ms cubic-bezier(0.22, 1, 0.36, 1), transform 520ms cubic-bezier(0.22, 1, 0.36, 1), filter 520ms ease;
  filter: blur(2px);
}

.js [data-reveal-variant="scale"] {
  transform: translateY(14px) scale(0.98);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

.route-ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.42;
}

.route-ambient-bg svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.route-ambient-line {
  fill: none;
  stroke: var(--brand);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-dasharray: 8 16;
  opacity: 0.35;
  animation: route-dash 18s linear infinite;
}

.route-ambient-dot {
  fill: var(--brand);
  opacity: 0.28;
  transform-origin: center;
  animation: marker-pulse 4.8s ease-in-out infinite;
}

[data-search-form],
[data-home-stats] article,
[data-popular-routes] a,
[data-featured-companies] article,
[data-trip-card],
main section article.rounded-2xl,
main section .rounded-2xl.bg-white:not([data-origin-options]):not([data-destination-options]) {
  backdrop-filter: blur(16px);
}

[data-home-stats] article,
[data-popular-routes] a,
[data-featured-companies] article,
[data-trip-card],
main section article.rounded-2xl,
main section .rounded-2xl.bg-white:not([data-search-form]):not([data-origin-options]):not([data-destination-options]) {
  position: relative;
  overflow: hidden;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease, background 220ms ease;
}

[data-search-form] {
  position: relative;
  z-index: 10;
  overflow: visible;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
}

[data-home-stats] article::before,
[data-popular-routes] a::before,
[data-featured-companies] article::before,
[data-trip-card]::before,
main section article.rounded-2xl::before,
main section .rounded-2xl.bg-white:not([data-search-form]):not([data-origin-options]):not([data-destination-options])::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(167, 15, 45, 0.10), transparent 34%, rgba(244, 196, 48, 0.08));
  opacity: 0;
  transition: opacity 220ms ease;
}

[data-search-form]::before {
  content: none;
}

[data-home-stats] article:hover,
[data-popular-routes] a:hover,
[data-featured-companies] article:hover,
[data-trip-card]:hover,
main section article.rounded-2xl:hover {
  transform: translateY(-3px);
  border-color: rgba(167, 15, 45, 0.34);
  box-shadow: 0 22px 58px rgba(15, 23, 42, 0.14);
}

[data-home-stats] article:hover::before,
[data-popular-routes] a:hover::before,
[data-featured-companies] article:hover::before,
[data-trip-card]:hover::before,
main section article.rounded-2xl:hover::before {
  opacity: 1;
}

[data-popular-routes] svg,
[data-featured-companies] span,
[data-theme-toggle] svg,
[data-swap-direction] svg {
  transition: transform 220ms ease;
}

[data-popular-routes] a:hover svg {
  transform: translateX(3px);
}

[data-swap-direction].is-swapping svg {
  transform: rotate(180deg);
}

[data-submit-search] {
  position: relative;
  overflow: hidden;
}

[data-submit-search]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: translateX(-120%);
  transition: transform 520ms ease;
}

[data-submit-search]:hover::after {
  transform: translateX(120%);
}

.local-ad-section {
  opacity: 1;
  animation: soft-enter 360ms ease both;
}

.js .local-ad-section [data-reveal],
.js .local-ad-card {
  opacity: 1;
  transform: none;
  filter: none;
}

.local-ad-card,
.donation-box,
.donation-modal-panel {
  backdrop-filter: blur(16px);
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease, background 220ms ease;
}

.local-ad-card:hover,
.donation-box:hover {
  transform: translateY(-2px);
  border-color: rgba(167, 15, 45, 0.28);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.12);
}

.local-ad-icon svg {
  transition: transform 220ms ease;
}

.local-ad-card:hover .local-ad-icon svg {
  transform: translateY(-1px);
}

.donation-modal-panel {
  animation: modal-enter 220ms ease both;
}

@keyframes soft-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes route-dash {
  to {
    stroke-dashoffset: -220;
  }
}

@keyframes marker-pulse {
  0%, 100% {
    opacity: 0.22;
    transform: scale(1);
  }

  50% {
    opacity: 0.54;
    transform: scale(1.45);
  }
}

@keyframes glow-drift {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(0, 1.4rem, 0);
  }
}

.cookie-consent-modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}

.cookie-consent-modal-wrap.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.cookie-consent-overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.48);
  backdrop-filter: blur(8px);
}

.cookie-consent-modal {
  position: relative;
  width: min(620px, 100%);
  border-radius: 1.6rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.84));
  backdrop-filter: blur(18px);
  box-shadow: 0 26px 66px rgba(2, 6, 23, 0.30);
  padding: 1.4rem;
  transform: translateY(20px) scale(0.98);
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.cookie-consent-modal-wrap.is-visible .cookie-consent-modal {
  transform: translateY(0) scale(1);
}

.cookie-consent-content {
  display: grid;
  gap: 0.55rem;
}

.cookie-consent-title {
  font-size: 1.1rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text);
}

.cookie-consent-copy {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.cookie-consent-link {
  margin-top: 0.1rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand);
}

.cookie-consent-link:hover {
  color: var(--brand-dark);
}

.cookie-consent-actions {
  margin-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.cookie-btn {
  border-radius: 0.8rem;
  border: 1px solid transparent;
  padding: 0.48rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  transition: transform 160ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.cookie-btn:hover {
  transform: translateY(-1px);
}

.cookie-btn-primary {
  background: var(--brand);
  color: #fff;
}

.cookie-btn-primary:hover {
  background: #8d0d27;
}

.cookie-btn-muted {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text-muted);
}

.cookie-btn-muted:hover {
  background: rgba(248, 250, 252, 0.96);
}

.cookie-btn-ghost {
  border-color: rgba(167, 15, 45, 0.22);
  background: rgba(167, 15, 45, 0.08);
  color: var(--brand);
}

.cookie-btn-ghost:hover {
  background: rgba(167, 15, 45, 0.14);
}

.cookie-consent-config {
  margin-top: 0.95rem;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  padding-top: 0.85rem;
}

.cookie-consent-config-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.cookie-consent-config-copy {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-soft);
}

.dark .cookie-consent-overlay {
  background: rgba(2, 6, 23, 0.62);
}

.dark .cookie-consent-modal {
  border-color: rgba(148, 163, 184, 0.24);
  background: linear-gradient(130deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.8));
}

.dark .cookie-btn-muted {
  border-color: rgba(148, 163, 184, 0.5);
  background: rgba(30, 41, 59, 0.72);
}

.dark .cookie-btn-muted:hover {
  background: rgba(30, 41, 59, 0.88);
}

.dark .glass-header,
.dark .border-slate-200\/80 {
  border-color: var(--border);
}

.dark .bg-white {
  background-color: var(--surface-card);
}

.dark .bg-white\/80,
.dark .bg-white\/85 {
  background-color: var(--surface-card-soft);
}

.dark .bg-slate-50 {
  background-color: var(--surface-muted);
}

.dark .hover\:bg-slate-50:hover,
.dark .focus\:bg-white:focus {
  background-color: var(--surface-subtle);
}

.dark .bg-slate-100,
.dark .bg-slate-200 {
  background-color: var(--surface-subtle);
}

.dark .bg-slate-950 {
  background-color: var(--footer-bg);
}

.dark .bg-brand-50,
.dark .bg-brand-50\/70,
.dark .hover\:bg-brand-50:hover,
.dark .hover\:bg-brand-100:hover {
  background-color: var(--brand-soft);
}

.dark .bg-amber-50 {
  background-color: var(--warning-surface);
}

.dark .border-slate-100,
.dark .border-slate-200,
.dark .border-slate-300,
.dark .border-brand-100,
.dark .border-amber-200,
.dark .ring-slate-200,
.dark .ring-brand-100,
.dark .ring-amber-200 {
  border-color: var(--border);
  --tw-ring-color: var(--border);
}

.dark .text-slate-950,
.dark .text-slate-900,
.dark .text-slate-800 {
  color: var(--text);
}

.dark .text-slate-700,
.dark .text-slate-600 {
  color: var(--text-muted);
}

.dark .text-slate-500,
.dark .text-slate-400,
.dark .text-slate-300 {
  color: var(--text-soft);
}

.dark .text-brand-700,
.dark .hover\:text-brand-700:hover,
.dark .hover\:text-brand-900:hover {
  color: var(--brand-text);
}

.dark .text-amber-950,
.dark .text-amber-900,
.dark .text-amber-800,
.dark .text-amber-700 {
  color: var(--warning-text);
}

.dark input,
.dark select,
.dark textarea {
  color: var(--text);
}

.dark input::placeholder,
.dark textarea::placeholder {
  color: var(--text-soft);
}

.dark .shadow-soft,
.dark .shadow-sm {
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}

.dark .shadow-lift {
  box-shadow: 0 14px 34px rgba(167, 15, 45, 0.36);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .js [data-reveal] {
    transition: none;
  }

  .app-bg {
    animation: none;
  }

  body::before,
  .route-ambient-bg,
  .route-ambient-line,
  .route-ambient-dot,
  .local-ad-section,
  .donation-modal-panel {
    animation: none;
  }
}

@media (max-width: 768px) {
  .app-bg {
    background-attachment: scroll;
    background-position: left top;
  }
}

@media (max-width: 480px) {
  .cookie-consent-modal-wrap {
    padding: 0.8rem;
  }

  .cookie-consent-modal {
    border-radius: 1.2rem;
    padding: 1rem;
  }

  .cookie-consent-title {
    font-size: 1rem;
  }

  .cookie-consent-copy {
    font-size: 0.86rem;
  }

  .cookie-consent-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .cookie-consent-actions .cookie-btn-ghost {
    grid-column: span 2;
  }

  .local-ad-card > .flex {
    flex-direction: column;
  }

  .local-ad-card .local-ad-icon {
    height: 2.75rem;
    width: 2.75rem;
  }
}
