/*
 * Hoja común de las webs de Kanso Space.
 *
 * Es el design system de la app (documents/diseno/sistema_de_diseno.md) llevado a CSS:
 * misma paleta, mismos radios, mismas tipografías y las mismas reglas de
 * movimiento. Los valores salen de lib/core/constants/app_colors.dart y
 * app_dimens.dart; si cambian allí, cambian aquí.
 *
 * Los nombres de color son roles, igual que en AppPalette: en oscuro,
 * --charcoal es un blanco roto y --stone es casi negro.
 */

/* Las mismas TTF que empaqueta la app (assets/fonts). Autoalojadas: la web no
   pide nada a Google Fonts, que es lo que dice la política de privacidad. */
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/Newsreader-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/Newsreader-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("/fonts/Outfit-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("/fonts/Outfit-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Outfit";
  src: url("/fonts/Outfit-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  /* AppPalette.light */
  --moss: #5C6B59;
  --charcoal: #2C2C2C;
  --stone: #EBE9E1;
  --rice: #FDFBF7;
  --warm-grey: #D6CFC7;
  --taupe: #756F68;
  --clay: #A67B5B;

  /* Derivados, como los getters de AppPalette. */
  --shadow: rgba(92, 107, 89, 0.10);
  --card-shadow: rgba(92, 107, 89, 0.15);
  --hairline: rgba(214, 207, 199, 0.55);
  --moss-tint: rgba(92, 107, 89, 0.10);
  --moss-line: rgba(92, 107, 89, 0.30);
  --clay-tint: rgba(166, 123, 91, 0.12);

  /* AppRadius */
  --r-pointer: 4px;
  --r-small: 12px;
  --r-medium: 16px;
  --r-large: 20px;
  --r-pill: 999px;

  /* AppDurations / AppCurves: se decelera, nada rebota. */
  --t-press: 150ms;
  --t-enter: 350ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
}

/* AppPalette.dark: no es el negativo del claro. Ni negro puro, y musgo y
   arcilla aclarados para que sigan cumpliendo contraste sobre carbón. */
@media (prefers-color-scheme: dark) {
  :root {
    --moss: #8FA189;
    --charcoal: #EDEAE3;
    --stone: #1A1917;
    --rice: #24231F;
    --warm-grey: #3E3B35;
    --taupe: #A8A199;
    --clay: #C79A76;

    --shadow: rgba(0, 0, 0, 0.35);
    --card-shadow: rgba(0, 0, 0, 0.35);
    --hairline: rgba(62, 59, 53, 0.9);
    --moss-tint: rgba(143, 161, 137, 0.14);
    --moss-line: rgba(143, 161, 137, 0.35);
    --clay-tint: rgba(199, 154, 118, 0.14);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--stone);
  color: var(--charcoal);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--moss);
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--moss);
  outline-offset: 3px;
  border-radius: var(--r-pointer);
}

/* ---------- Marca ---------- */

/* El icono de la app recortado a su disco, como KansoLogo: en el PNG de
   1024 px el disco ocupa 718, el resto es margen transparente. */
.logo {
  --size: 40px;
  display: inline-block;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  overflow: hidden;
  position: relative;
}
.logo img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(var(--size) * 1024 / 718);
  height: calc(var(--size) * 1024 / 718);
  max-width: none;
  transform: translate(-50%, -50%);
}
/* El icono es el mismo en claro y en oscuro; sobre carbón, un aro tenue lo
   separa del fondo. */
@media (prefers-color-scheme: dark) {
  .logo {
    box-shadow: 0 0 0 1px var(--warm-grey);
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--charcoal);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
}

/* ---------- Conmutador de idioma ---------- */

/* Botones en la landing (cambia el texto en la misma página) y enlaces en los
   textos legales (cada idioma es un documento). */
.lang {
  display: inline-flex;
  flex: none;
  padding: 3px;
  border-radius: var(--r-pill);
  box-shadow: inset 0 0 0 1px var(--warm-grey);
}
.lang a,
.lang button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 32px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--taupe);
  font: 500 0.8125rem/1 var(--sans);
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
}
.lang [aria-pressed="true"],
.lang [aria-current="true"] {
  background: var(--rice);
  color: var(--charcoal);
  box-shadow: 0 2px 8px var(--shadow);
}

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 28px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--moss);
  color: var(--rice);
  font: 500 1rem/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--t-press) var(--ease),
    opacity var(--t-press) var(--ease);
}
.btn:hover {
  opacity: 0.92;
}
/* AnimatedPressScale: la pulsación encoge, no salta. */
.btn:active {
  transform: scale(0.97);
}
.btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.btn--quiet {
  background: transparent;
  color: var(--charcoal);
  box-shadow: inset 0 0 0 1px var(--warm-grey);
}
.btn[aria-disabled="true"] {
  background: transparent;
  color: var(--taupe);
  box-shadow: inset 0 0 0 1px var(--warm-grey);
  cursor: default;
  pointer-events: none;
}

/* ---------- Superficie ---------- */

.surface {
  background: var(--rice);
  border: 1px solid var(--hairline);
  border-radius: var(--r-large);
  box-shadow: 0 12px 24px var(--shadow);
}

/* ---------- Pie ---------- */

.site-footer {
  padding: 48px 24px 56px;
  text-align: center;
  color: var(--taupe);
  font-size: 0.875rem;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
  margin-bottom: 16px;
}
.site-footer a {
  color: var(--charcoal);
  text-decoration: none;
}
.site-footer a:hover {
  text-decoration: underline;
}

/* ---------- Páginas de documento (privacidad, términos, borrar cuenta) ---------- */

.doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 24px 0;
}

.doc {
  max-width: 760px;
  margin: 32px auto 0;
  padding: 0 24px;
}
.doc article {
  padding: 48px 44px;
}
.doc h1 {
  font-size: clamp(1.9rem, 5vw, 2.5rem);
  margin-bottom: 12px;
}
.doc .updated {
  color: var(--taupe);
  font-size: 0.9375rem;
  margin-bottom: 32px;
}
.doc h2 {
  font-size: 1.45rem;
  margin: 44px 0 12px;
  padding-top: 28px;
  border-top: 1px solid var(--hairline);
}
.doc h3 {
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0;
  margin: 28px 0 8px;
}
.doc p {
  margin: 0 0 16px;
}
.doc ul,
.doc ol {
  margin: 0 0 16px;
  padding-left: 22px;
}
.doc li {
  margin-bottom: 10px;
}
.doc li::marker {
  color: var(--taupe);
}
.doc strong {
  font-weight: 600;
}
.doc .callout {
  margin: 24px 0;
  padding: 16px 20px;
  border-radius: var(--r-medium);
  background: var(--clay-tint);
  color: var(--charcoal);
}
.doc .callout strong {
  color: var(--clay);
}

@media (max-width: 600px) {
  .doc {
    padding: 0 12px;
  }
  .doc article {
    padding: 32px 22px;
  }
}

/* ---------- Páginas de una sola tarjeta (invitación, 404) ---------- */

.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}
.gate .surface {
  width: 100%;
  max-width: 360px;
  padding: 40px 28px 32px;
}
.gate .logo {
  --size: 64px;
  margin-bottom: 20px;
}
.gate h1 {
  font-size: 1.6rem;
  margin-bottom: 10px;
}
.gate p {
  color: var(--taupe);
  font-size: 0.9375rem;
  margin-bottom: 28px;
}
.gate .btn {
  width: 100%;
}
.gate .hint {
  margin: 20px 0 0;
  font-size: 0.875rem;
}

/* ---------- Movimiento ---------- */

/* StaggeredEntrance: fundido y 12 px de recorrido, escalonado con --i. */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--t-enter) var(--ease),
    transform var(--t-enter) var(--ease);
  transition-delay: calc(var(--i, 0) * 120ms);
}
.is-visible .reveal,
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* El equivalente a MediaQuery.disableAnimationsOf. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .btn {
    transition: none;
  }
}

/* Sin JavaScript no hay quien dispare la entrada: todo visible. */
.no-js .reveal {
  opacity: 1;
  transform: none;
}
