/* base.css — Reset y estilos generales */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Evita el gesto "deslizar hacia abajo para recargar" en celulares,
     que reiniciaba el proceso sin querer. */
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  overscroll-behavior-y: none;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh);
  color: var(--text-main);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

body.is-locked {
  overflow: hidden;
}

img,
video,
svg {
  display: block;
  max-width: 100%;
}

h1, h2, h3, h4, p, ul, ol, dl, figure {
  margin: 0;
}

h1, h2, h3 {
  line-height: 1.2;
  font-weight: 700;
  color: var(--color-ink);
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }

p + p { margin-top: var(--sp-3); }

a {
  color: var(--color-red);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover { color: var(--color-red-dark); }

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

button:disabled {
  cursor: not-allowed;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

[hidden] {
  display: none !important;
}

/* Layout general */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.app-header__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  height: 100%;
  padding: 0 var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.app-header__logo {
  height: 38px;
  width: auto;
}

.app-header__secure {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-xs);
  color: var(--color-success);
  font-weight: 600;
  white-space: nowrap;
}

.app-header__secure svg {
  width: 14px;
  height: 14px;
}

.app-main {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-4) var(--sp-10);
}

.app-footer {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* Pantallas */
.screen {
  animation: fade-in 260ms ease;
}

.screen__title {
  margin-bottom: var(--sp-2);
}

.screen__title:focus {
  box-shadow: none;
}

.screen__subtitle {
  color: var(--text-muted);
  margin-bottom: var(--sp-5);
}

.screen__actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}

@media (min-width: 560px) {
  .screen__actions {
    flex-direction: row-reverse;
    justify-content: flex-start;
  }
  .screen__actions .btn {
    min-width: 180px;
  }
}

/* Utilidades */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-small { font-size: var(--fs-sm); }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-4 { margin-bottom: var(--sp-4); }
.brand { color: var(--color-red); font-weight: 800; letter-spacing: 0.02em; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
