/* =====================================================================
   SafeShare — Base: reset, tipografía y utilidades
   ===================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--sp-m));
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-s);
  line-height: var(--lh-s);
  font-weight: var(--fw-regular);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

h1, h2, h3, h4 {
  color: var(--color-text);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-3xl); line-height: var(--lh-3xl); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-2xl); line-height: var(--lh-2xl); letter-spacing: -0.015em; }
h3 { font-size: var(--fs-m); line-height: var(--lh-m); }

p { color: var(--color-text-secondary); }
strong { color: var(--color-text); font-weight: var(--fw-bold); }

a {
  color: var(--color-accent-text);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--color-accent-text-hover); }

button { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
code { font-family: var(--font-mono); }

:focus-visible {
  outline: 2px solid var(--color-accent-text);
  outline-offset: 2px;
}

/* ---------- Tipos de texto ---------- */
.lead { font-size: var(--fs-m); line-height: var(--lh-m); }
.text-small { font-size: var(--fs-xs); line-height: var(--lh-xs); }
.text-brand { color: var(--color-text-brand); }

/* ---------- Iconos (sprite SVG inline) ---------- */
.icon {
  width: var(--icon-s);
  height: var(--icon-s);
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--xs { width: var(--icon-xs); height: var(--icon-xs); }
.icon--m { width: var(--icon-m); height: var(--icon-m); }
.icon--l { width: var(--icon-l); height: var(--icon-l); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- Utilidades ---------- */
[hidden] { display: none !important; }
.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;
}
.br-desktop { display: none; }
@media (min-width: 768px) { .br-desktop { display: inline; } }

/* ---------- Modo de la app (create | open) ----------
   El body declara data-mode y el CSS decide qué se ve. Así la lógica JS
   no tiene que conocer cada bloque de la página. */
body[data-mode="open"]   [data-only="create"] { display: none !important; }
body[data-mode="create"] [data-only="open"]   { display: none !important; }

/* ---------- Aparición al hacer scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity var(--dur-slow) var(--ease-out-quint),
    transform var(--dur-slow) var(--ease-out-quint);
}
.reveal.is-visible { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .reveal { opacity: 1; transform: none; }
}
