/* Puntos.uy homepage-only theme preview.
   All light-mode properties are inherited unmodified from styles.css.
   Dark mode overrides only color/surface tokens and hard-coded color exceptions.
   This file does not affect any business tenant subdomain. */

/* Reference-inspired pill: inset track, electric-blue floating capsule, two Lucide-style SVG icons. */
.theme-toggle {
  --switch-width: 104px;
  --switch-height: 48px;
  --switch-thumb-width: 48px;
  --switch-travel: 48px;
  --switch-pad: 4px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  width: var(--switch-width);
  height: var(--switch-height);
  padding: var(--switch-pad);
  overflow: visible;
  border: 1px solid #dbe5fb;
  border-radius: 999px;
  background: #eaf0ff;
  box-shadow: inset 0 2px 5px rgba(58,83,141,.09),
              inset 0 -1px 2px rgba(255,255,255,.9),
              0 4px 10px rgba(30,58,138,.05);
  color: #7385ab;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 380ms ease, border-color 380ms ease, box-shadow 380ms ease;
}

.theme-toggle__thumb {
  position: absolute;
  z-index: 0;
  top: var(--switch-pad);
  left: var(--switch-pad);
  width: var(--switch-thumb-width);
  height: calc(var(--switch-height) - var(--switch-pad) - var(--switch-pad) - 2px);
  border-radius: 999px;
  background: linear-gradient(150deg, #507aff 0%, #2b59eb 55%, #2655de 100%);
  border: 1px solid rgba(117,184,255,.65);
  box-shadow: 0 0 0 1px rgba(103,167,255,.13),
              0 2px 13px rgba(46,101,245,.45),
              0 0 22px rgba(53,125,255,.35),
              inset 0 3px 8px rgba(202,232,255,.34),
              inset 0 -4px 8px rgba(4,32,138,.26);
  transform: translateX(0);
  transition: transform 400ms cubic-bezier(.2,.82,.2,1),
              box-shadow 400ms ease;
}

.theme-toggle__icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: var(--switch-thumb-width);
  height: 100%;
  flex: 0 0 var(--switch-thumb-width);
  color: #7487aa;
  transition: color 330ms ease, transform 330ms ease;
}

.theme-toggle__icon svg {
  width: 21px;
  height: 21px;
  display: block;
}

:root[data-theme="light"] .theme-toggle__sun,
:root[data-theme="dark"] .theme-toggle__moon {
  color: #fff;
}

:root[data-theme="dark"] .theme-toggle {
  color: #8d9ebd;
  background: #1e2a42;
  border-color: #374760;
  box-shadow: inset 0 3px 9px rgba(0,0,0,.25),
              inset 0 -1px 1px rgba(143,177,244,.05),
              0 5px 12px rgba(0,0,0,.12);
}

:root[data-theme="dark"] .theme-toggle__thumb {
  transform: translateX(var(--switch-travel));
}

:root[data-theme="dark"] .theme-toggle__sun {
  color: #8ca1c7;
}

.theme-toggle:focus-visible {
  outline: 3px solid #60a5fa;
  outline-offset: 4px;
}

.theme-toggle:active .theme-toggle__thumb {
  box-shadow: 0 0 0 1px rgba(103,167,255,.2),
              0 0 29px rgba(53,125,255,.7),
              inset 0 3px 8px rgba(202,232,255,.38);
}

/* Only a persisted explicit choice activates these colors.
   Primary brand blue is still sourced from the existing site settings. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111927;
  --surface: #1d283b;
  --soft: #162236;
  --text: #edf3ff;
  --muted: #b6c6da;
  --line: #384a64;
  --shadow: 0 20px 50px rgba(2,8,25,.25);
}

:root[data-theme="dark"] .site-header {
  background: rgba(17,25,39,.92);
  border-bottom-color: rgba(77,95,128,.5);
}

:root[data-theme="dark"] .brand-mark {
  background: #2856dc;
  color: #fff;
}

:root[data-theme="dark"] .nav-links > a:not(.btn):hover,
:root[data-theme="dark"] .eyebrow {
  color: #a5c9ff;
}

:root[data-theme="dark"] .hero-notes,
:root[data-theme="dark"] .plan-card li {
  color: #cbd7e9;
}

:root[data-theme="dark"] .plan-card li::before {
  color: #a5c9ff;
}

:root[data-theme="dark"] .btn-secondary:not(.fusion-white),
:root[data-theme="dark"] .btn-ghost {
  background: #26354b;
  color: #f1f5ff;
  border-color: #465b77;
}

:root[data-theme="dark"] .btn-secondary:not(.fusion-white):hover,
:root[data-theme="dark"] .btn-ghost:hover {
  background: #2d405c;
}

:root[data-theme="dark"] .hero .hero-actions .fusion-blue {
  color: #fff;
}

:root[data-theme="dark"] .hero .hero-actions .fusion-white,
:root[data-theme="dark"] .hero .hero-actions .fusion-white:hover {
  background: #fff;
  color: #0f172a;
  border-color: #d5ddeb;
}

/* Existing layout, spacing, typography and card hierarchy remain unchanged. */
:root[data-theme="dark"] .plan-card,
:root[data-theme="dark"] .feature-card {
  background: var(--surface);
  border-color: var(--line);
}

:root[data-theme="dark"] .plan-card {
  box-shadow: 0 9px 28px rgba(2,8,23,.18);
}

:root[data-theme="dark"] .plan-card.featured {
  border-color: #5086df;
  box-shadow: 0 18px 42px rgba(37,99,235,.19);
}

:root[data-theme="dark"] .popular {
  background: #233b62;
  color: #bfdbfe;
}

:root[data-theme="dark"] .access-form {
  background: var(--surface);
  border-color: var(--line);
}

:root[data-theme="dark"] .domain-input {
  background: #162136;
  border-color: #57708b;
}

:root[data-theme="dark"] .domain-input input {
  background: transparent;
  color: #f3f7ff;
  caret-color: #93c5fd;
}

:root[data-theme="dark"] .domain-input input::placeholder {
  color: #a9bad1;
}

:root[data-theme="dark"] .domain-input span {
  color: #b6c6da;
}

:root[data-theme="dark"] .error {
  color: #ffb6b6;
}

:root[data-theme="dark"] .contact-card {
  background: #1b2b43;
  color: #f8fbff;
  box-shadow: 0 12px 35px rgba(5,12,26,.18);
}

:root[data-theme="dark"] .contact-card .eyebrow {
  color: #a5c9ff;
}

:root[data-theme="dark"] .contact-card p {
  color: #c3d0e3;
}

:root[data-theme="dark"] .preview {
  background: #132036;
}

:root[data-theme="dark"] .preview-logo {
  background: #e3edff;
  color: #122038;
}

:root[data-theme="dark"] footer {
  background: #172235;
  border-top-color: var(--line);
}

/* Animate only after the document has initialized, preventing an entrance flash. */
:root.theme-ready body,
:root.theme-ready .site-header,
:root.theme-ready .section-soft,
:root.theme-ready .feature-card,
:root.theme-ready .plan-card,
:root.theme-ready .access-form,
:root.theme-ready .domain-input,
:root.theme-ready .domain-input input,
:root.theme-ready .contact-card,
:root.theme-ready footer,
:root.theme-ready .btn-ghost,
:root.theme-ready .plan-contact,
:root.theme-ready .brand-mark {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 360ms;
  transition-timing-function: ease;
}

@media (max-width: 620px) {
  /* Keep the existing navigation items on one row; the new control is intentionally compact. */
  .nav { gap: 10px; }
  .brand { gap: 7px; font-size: .97rem; }
  .nav-links { gap: 8px; }
  .theme-toggle {
    --switch-width: 82px;
    --switch-height: 40px;
    --switch-thumb-width: 37px;
    --switch-travel: 37px;
    width: var(--switch-width);
    height: var(--switch-height);
  }
  .theme-toggle__icon svg { width: 18px; height: 18px; }
}

@media (max-width: 355px) {
  .nav { gap: 6px; }
  .brand { gap: 5px; font-size: .88rem; }
  .brand-mark { width: 32px; height: 32px; }
  .nav-links { gap: 6px; }
  .nav-links .btn { padding-inline: 8px; font-size: .76rem; }
  .theme-toggle {
    --switch-width: 74px;
    --switch-height: 38px;
    --switch-thumb-width: 33px;
    --switch-travel: 33px;
  }
  .theme-toggle__icon svg { width: 17px; height: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle,
  .theme-toggle__thumb,
  .theme-toggle__icon,
  :root.theme-ready body,
  :root.theme-ready .site-header,
  :root.theme-ready .section-soft,
  :root.theme-ready .feature-card,
  :root.theme-ready .plan-card,
  :root.theme-ready .access-form,
  :root.theme-ready .domain-input,
  :root.theme-ready .domain-input input,
  :root.theme-ready .contact-card,
  :root.theme-ready footer,
  :root.theme-ready .btn-ghost,
  :root.theme-ready .plan-contact,
  :root.theme-ready .brand-mark {
    transition: none !important;
    animation: none !important;
  }
}
