/* KASTOR Links · estilos. Fuentes con licencia SIL OFL, alojadas localmente. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/montserrat-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/montserrat-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/montserrat-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Sofia Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/sofia-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Sofia Sans"; font-style: normal; font-weight: 800; font-display: swap; src: url("fonts/sofia-sans-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Sofia Sans"; font-style: normal; font-weight: 900; font-display: swap; src: url("fonts/sofia-sans-latin-900-normal.woff2") format("woff2"); }

/* Layout: perfil tipo Linktree en una columna de 560px sobre fondo crema con el patrón de castores
   del manual. Avatar = icono navy con castor naranja; botones píldora; tarjetas de las tres divisiones
   con sus combinaciones de color; sticker del lema; franja escalonada de la paleta al pie. */
:root {
  --cream: #FAF6F2;
  --navy: #14234B;
  --blue: #3A6DAF;
  --sky: #94BAC4;
  --orange: #E57D37;
  --gold: #EAAD62;
  --lilac: #E3A5EC;

  --bg: #FAF6F2;
  --fg: #14234B;
  --muted: #4F5B7A;
  --surface: #FFFFFF;
  --line: rgba(20, 35, 75, 0.14);
  --pattern: rgba(20, 35, 75, 0.045);
  --glow: rgba(229, 125, 55, 0.30);
  --pill: #14234B;
  --pill-fg: #FAF6F2;
  --chip: #FFFFFF;

  --font-display: "Sofia Sans", "Arial Narrow", system-ui, sans-serif;
  --font-label: "Montserrat", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1A3A;
    --fg: #FAF6F2;
    --muted: #AEB9D2;
    --surface: #16264F;
    --line: rgba(250, 246, 242, 0.14);
    --pattern: rgba(148, 186, 196, 0.06);
    --glow: rgba(229, 125, 55, 0.22);
    --pill: #FAF6F2;
    --pill-fg: #14234B;
    --chip: #16264F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1A3A;
  --fg: #FAF6F2;
  --muted: #AEB9D2;
  --surface: #16264F;
  --line: rgba(250, 246, 242, 0.14);
  --pattern: rgba(148, 186, 196, 0.06);
  --glow: rgba(229, 125, 55, 0.22);
  --pill: #FAF6F2;
  --pill-fg: #14234B;
  --chip: #16264F;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
img { max-width: 100%; }
.noscript { position: relative; z-index: 60; margin: 0; padding: 14px 16px; background: #E57D37; color: #14234B; font-weight: 600; text-align: center; }
html, body { min-height: 100%; }
body {
  position: relative;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  overflow-x: hidden;
}
a, button { color: inherit; font: inherit; }
a { text-decoration: none; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }

/* ---------- Fondo: patrón de castores + brillos de esquina (pág. 1 y 9 del manual) ---------- */
.bg { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.bg .pattern {
  position: absolute; inset: 0;
  background: var(--pattern);
  -webkit-mask-image: url("img/patron-castores.svg"); mask-image: url("img/patron-castores.svg");
  -webkit-mask-size: 132px 128px; mask-size: 132px 128px;
}
.bg .glow-a, .bg .glow-b { position: absolute; width: 520px; height: 520px; border-radius: 50%; filter: blur(40px); background: radial-gradient(closest-side, var(--glow), transparent); }
.bg .glow-a { top: -260px; right: -220px; }
.bg .glow-b { bottom: -280px; left: -240px; }

.wrap {
  position: relative; z-index: 1;
  max-width: 560px; margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 14px 0;
  display: flex; flex-direction: column; align-items: center;
}

/* ---------- Barra superior ---------- */
.bar { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.appicon {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: var(--navy); color: #FAF6F2;
}
.appicon svg { width: 28px; height: auto; }
.round {
  width: 42px; height: 42px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer;
  display: grid; place-items: center; background: var(--chip); color: var(--fg);
  transition: transform .15s ease, border-color .15s ease;
}
.round:hover { transform: scale(1.06); border-color: var(--orange); }
.round svg { width: 18px; height: 18px; }

/* ---------- Perfil ---------- */
.avatar {
  margin-top: 22px; width: 112px; height: 112px; border-radius: 50%;
  display: grid; place-items: center; background: var(--navy);
  box-shadow: 0 0 0 5px var(--bg), 0 0 0 7px var(--orange), 0 18px 40px -16px rgba(20, 35, 75, 0.55);
}
.avatar svg { width: 72px; height: auto; color: var(--orange); }
.eyebrow { margin: 20px 0 0; font-family: var(--font-label); font-weight: 600; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--fg); }
.eyebrow b { color: var(--orange); font-weight: 600; }
.eyebrow span { opacity: .45; padding: 0 .5em; }
.handle { margin: 6px 0 0; font-family: var(--font-display); font-weight: 900; font-size: 32px; line-height: 1; letter-spacing: 0.005em; }
.bio { margin: 10px 0 0; max-width: 34ch; text-align: center; color: var(--muted); text-wrap: balance; }

.sticker {
  margin-top: 18px; display: inline-block; padding: 8px 18px; border-radius: 999px;
  background: var(--orange); color: #14234B;
  font-family: var(--font-display); font-weight: 900; font-size: 16px; letter-spacing: 0.02em;
  box-shadow: 0 0 0 4px #FFFFFF, 0 10px 22px -10px rgba(20, 35, 75, 0.45);
  transform: rotate(-2.5deg);
}

.icons { margin-top: 20px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.icons a {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--chip); border: 1px solid var(--line); color: var(--fg);
  transition: color .15s ease, transform .15s ease, border-color .15s ease;
}
.icons a:hover { color: var(--orange); border-color: var(--orange); transform: translateY(-2px); }
.icons svg { width: 21px; height: 21px; }

/* ---------- Botones píldora ---------- */
.links { width: 100%; margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.link {
  position: relative; width: 100%; min-height: 60px;
  display: flex; align-items: center; justify-content: center;
  padding: 12px 60px; border-radius: 999px;
  background: var(--pill); color: var(--pill-fg);
  font-weight: 600; font-size: 15.5px; text-align: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.link:hover { transform: translateY(-2px) scale(1.01); box-shadow: 0 0 0 2px var(--orange); }
.link .lead {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--orange); color: #14234B;
}
.link .lead svg { width: 20px; height: 20px; }
.link .go { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); opacity: .6; transition: transform .15s ease, opacity .15s ease; }
.link:hover .go { opacity: 1; transform: translate(3px, -50%); }
.link .go svg { width: 18px; height: 18px; }
.link.primary { background: var(--orange); color: #14234B; }
.link.primary .lead { background: #14234B; color: #E57D37; }
.link.primary:hover { box-shadow: 0 0 0 2px var(--fg); }

/* ---------- Divisiones (pág. 4–5 del manual) ---------- */
.label {
  width: 100%; margin: 34px 0 12px; display: flex; align-items: center; gap: 12px;
  font-family: var(--font-label); font-weight: 700; font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--fg);
}
.label::before, .label::after { content: ""; height: 2px; flex: 1; background: var(--orange); border-radius: 2px; opacity: .85; }

.divs { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.div {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: 14px 18px 14px 14px; border-radius: 22px;
  background: var(--surface); border: 1.5px solid var(--edge);
  transition: transform .15s ease, box-shadow .15s ease;
}
.div:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -18px rgba(20, 35, 75, 0.5); }
.tile { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--tile-bg); border: 1px solid var(--tile-edge, transparent); }
.tile svg { width: 44px; height: auto; color: var(--tile-fg); }
.div .txt { min-width: 0; }
.div .k { display: block; font-family: var(--font-display); font-weight: 900; font-size: 24px; line-height: .95; color: var(--fg); }
.div .sub { display: block; font-family: var(--font-display); font-weight: 900; font-size: 19px; line-height: 1.05; letter-spacing: 0.03em; color: var(--subc, var(--fg)); }
.div .sub i { font-style: normal; }
.div .chip { display: inline-block; margin-top: 7px; padding: 3px 10px; border-radius: 999px; font-family: var(--font-label); font-weight: 700; font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; }
.div .d { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }
.div .go { color: var(--muted); }
.div .go svg { width: 20px; height: 20px; display: block; }
.div:hover .go { color: var(--orange); }

/* ---------- Pie con placa y franja escalonada (pág. 2 y 10) ---------- */
.plate {
  margin-top: 40px; display: inline-flex; align-items: center; gap: 14px;
  padding: 8px 14px 8px 16px; border-radius: 12px;
  background: var(--orange); color: #14234B; border: 2px solid #14234B;
  box-shadow: 0 0 0 4px #FFFFFF;
  transform: rotate(1.5deg);
}
.plate .w { font-family: var(--font-display); font-weight: 900; font-size: 34px; line-height: 1; letter-spacing: 0.01em; }
.plate .rule { width: 2px; align-self: stretch; background: #14234B; opacity: .8; }
.plate .s { font-family: var(--font-display); font-weight: 800; font-size: 11px; line-height: 1.25; letter-spacing: 0.06em; }
.plate svg { width: 22px; height: 22px; align-self: flex-start; }
.plate-top { position: relative; margin-top: 76px; transform: rotate(-2deg); }
.kas-top { position: absolute; left: 4px; bottom: calc(100% - 4px); width: 104px; height: 70px; cursor: pointer; }
.kas-top img { position: absolute; left: 0; bottom: 0; width: 104px; height: auto; }
.kas-top .kt-s, .kas-top .kt-c { opacity: 0; }
.kas-top .kt-c { width: 76px; left: 6px; }
.kas-top.party .kt-p, .kas-top.party .kt-s { opacity: 0 !important; animation: none !important; }
.kas-top.party .kt-c { opacity: 1; animation: hop .5s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: no-preference) {
  .kas-top .kt-p { animation: think 4.5s steps(1) infinite; }
  .kas-top .kt-s { animation: aha 4.5s steps(1) infinite, ahaJump 4.5s ease-out infinite; }
  @keyframes think { 0% { opacity: 1; } 78% { opacity: 0; } 100% { opacity: 1; } }
  @keyframes aha { 0% { opacity: 0; } 78% { opacity: 1; } 100% { opacity: 0; } }
  @keyframes ahaJump { 0%, 78% { transform: none; } 82% { transform: translateY(-9px); } 88%, 100% { transform: none; } }
}
.plate .pi { width: 46px; height: auto; align-self: center; }
.plate-top .s { font-size: 13px; }
.copy { margin: 34px 0 18px; font-family: var(--font-label); font-size: 10.5px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }

.steps { position: relative; z-index: 1; width: 100%; height: 56px; overflow: hidden; }
/* ---------- Pantalla de carga: Kas saludando ---------- */
.loader {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; align-content: center; gap: 18px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: #14234B; color: #FAF6F2; text-align: center; cursor: pointer;
  animation: loaderOut .3s ease 1.2s forwards;
}
.loader.gone { display: none; }
.loader .wave { width: 150px; aspect-ratio: 161 / 136; max-width: 100%; background: url("img/kas-hola.png") 0 0 / 200% 100% no-repeat; animation: wave .5s linear infinite; }
@keyframes wave { 0%, 49.9% { background-position: 0 0; } 50%, 100% { background-position: 100% 0; } }
.loader .hi { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: 34px; line-height: 1; }
.loader .hi b { color: #E57D37; font-weight: 900; }
.loader .lbar { display: flex; gap: 4px; padding: 4px; border: 2px solid #FAF6F2; }
.loader .lbar i { width: 14px; height: 14px; background: #E57D37; opacity: 0; animation: fill .05s linear forwards; }
.loader .lbar i:nth-child(1) { animation-delay: .03s } .loader .lbar i:nth-child(2) { animation-delay: .12s }
.loader .lbar i:nth-child(3) { animation-delay: .22s } .loader .lbar i:nth-child(4) { animation-delay: .32s }
.loader .lbar i:nth-child(5) { animation-delay: .42s } .loader .lbar i:nth-child(6) { animation-delay: .52s }
.loader .lbar i:nth-child(7) { animation-delay: .62s } .loader .lbar i:nth-child(8) { animation-delay: .72s }
.loader .lbar i:nth-child(9) { animation-delay: .82s } .loader .lbar i:nth-child(10) { animation-delay: .92s }
@keyframes fill { to { opacity: 1; } }
.loader .sub { margin: 0; font-family: var(--font-label); font-weight: 600; font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: #94BAC4; }
@keyframes loaderOut { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  .loader { animation-delay: .7s; }
  .loader .wave { animation: none; }
  .loader .lbar i { animation: none; opacity: 1; }
}

/* ---------- Kas, la mascota, caminando sobre la franja ---------- */
.ground { position: relative; z-index: 1; width: 100%; margin-top: 64px; }
.kas {
  position: absolute; bottom: 52px; left: 6%; z-index: 2;
  width: 88px; height: 66px; padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 12px;
}
.kas-sprite {
  display: block; width: 100%; height: 100%;
  background: url("img/kas-caminando.png") 0 0 / 400% 100% no-repeat;
}
.kas.party .kas-sprite { background: url("img/kas-celebrando.png") center bottom / contain no-repeat; animation: hop .5s ease-in-out infinite alternate; }
@keyframes hop { from { transform: translateY(0); } to { transform: translateY(-8px); } }
@media (prefers-reduced-motion: no-preference) {
  .kas { animation: stroll 16s linear infinite; }
  .kas .kas-sprite { animation: legs .6s steps(4) infinite; }
  .kas.party { animation-play-state: paused; }
  @keyframes stroll { from { left: -96px; } to { left: 100%; } }
  @keyframes legs { from { background-position: 0 0; } to { background-position: 133.333% 0; } }
}

.steps span { position: absolute; bottom: 0; height: 56px; border-radius: 0 44px 0 0; }
.steps span:nth-child(1) { left: 0; width: 100%; background: #94BAC4; }
.steps span:nth-child(2) { left: 0; width: 86%; background: #3A6DAF; }
.steps span:nth-child(3) { left: 0; width: 80%; background: #14234B; }
.steps span:nth-child(4) { left: 0; width: 66%; background: #EAAD62; }
.steps span:nth-child(5) { left: 0; width: 61%; background: #E57D37; }
.steps-pad { height: env(safe-area-inset-bottom, 0px); background: #94BAC4; }

.toast {
  position: fixed; z-index: 5; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 999px;
  background: #14234B; color: #FAF6F2; font-size: 13px; font-weight: 500;
  border: 1px solid rgba(250, 246, 242, 0.25);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise .55s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i, 0) * 45ms); }
  @keyframes rise { from { transform: translateY(10px); } to { transform: none; } }
}
@media (prefers-reduced-motion: reduce) { .round, .icons a, .link, .div, .toast { transition: none; } }

.sprite-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.kas-seen .loader { display: none; }
