/* Fundación Ciudadanía — estilos
   Paleta tomada del logo. El momento central es la animación del logo:
   entra por partes, se asienta y al bajar se acomoda en el encabezado. */

:root {
  --paper: #ffffff;
  --mist: #f1f7ec;
  --ink: #17271d;
  --ink-soft: #4b5b51;
  --forest: #0f3a22;
  --green: #1b7a21;
  --leaf: #70ae25;
  --sun: #98bb43;
  --sky: #4db4df;
  --blue: #1f7fa5;

  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-spring: cubic-bezier(0.34, 1.45, 0.64, 1);

  --header-h: 72px;
  --gutter: clamp(16px, 5vw, 56px);
  --max: 1180px;
}

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

html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
section[id] { scroll-margin-top: calc(var(--header-h) - 1px); }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; }

a { color: var(--green); }

h1, h2, h3 { margin: 0; font-weight: 600; }

p { margin: 0; }

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

.wrap {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--forest);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }
main:focus { outline: none; }

/* ---------- Encabezado ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--gutter);
  transition: background-color 300ms ease, box-shadow 300ms ease;
}
.is-docked .site-header,
.menu-open .site-header {
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 1px 0 rgba(23, 39, 29, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  border-radius: 4px;
}
.brand-slot {
  display: block;
  height: 36px;
  aspect-ratio: 527 / 356;
}
.brand-slot img { width: 100%; height: 100%; }

.brand-name {
  display: flex;
  flex-direction: column;
  font-weight: 650;
  font-size: 0.95rem;
  line-height: 1.12;
  color: var(--blue);
}
.brand-name span + span { color: var(--green); }

/* Antes de acoplarse, el emblema del encabezado espera al del hero */
.js .brand-slot img { opacity: 0; }
.js .brand-name {
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 300ms var(--ease-out), transform 450ms var(--ease-out);
}
.is-docked .brand-slot img { opacity: 1; }
.is-docked .brand-name { opacity: 1; transform: none; }

.menu {
  display: flex;
  gap: clamp(1.25rem, 2.5vw, 2.25rem);
}
.menu a {
  position: relative;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding-block: 6px;
}
.menu a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--leaf);
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform 300ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .menu a:hover::after { transform: scaleX(1); transform-origin: 0 50%; }
}

.menu-toggle {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 6px;
}
.menu-toggle span {
  position: absolute;
  left: 11px;
  right: 11px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 250ms var(--ease-out);
}
.menu-toggle span:first-child { transform: translateY(-4px); }
.menu-toggle span:last-child { transform: translateY(4px); }
.menu-open .menu-toggle span:first-child { transform: rotate(45deg); }
.menu-open .menu-toggle span:last-child { transform: rotate(-45deg); }

@media (max-width: 899px) {
  .menu-toggle { display: block; }
  .menu {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 8px var(--gutter) 28px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 12px 24px -16px rgba(23, 39, 29, 0.25);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out), visibility 0s 200ms;
  }
  .menu a {
    font-family: var(--serif);
    font-size: 1.6rem;
    font-weight: 400;
    padding-block: 10px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
  }
  .menu a::after { display: none; }
  .menu-open .menu {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out), visibility 0s;
  }
  .menu-open .menu a { opacity: 1; transform: none; }
  .menu-open .menu a:nth-child(2) { transition-delay: 40ms; }
  .menu-open .menu a:nth-child(3) { transition-delay: 80ms; }
  .menu-open .menu a:nth-child(4) { transition-delay: 120ms; }
  .menu-open .menu a:nth-child(5) { transition-delay: 160ms; }
}

/* ---------- Hero: el logo ---------- */

.hero {
  position: relative;
  /* La altura extra es el recorrido en el que el logo viaja al encabezado */
  height: 150vh;
  height: 150svh;
}
.no-js .hero { height: 100vh; height: 100svh; }

.hero-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--header-h) var(--gutter) 64px;
  overflow: hidden;
  overflow: clip;
}

.logo-stage {
  position: relative;
  width: min(76vw, 420px, 56svh);
  aspect-ratio: 628 / 533;
}

.mark,
.wordmark {
  position: absolute;
  inset: 0;
  margin: 0;
}
.mark { transform-origin: 0 0; }
.is-docked .mark { opacity: 0; }

.mark-box {
  position: absolute;
  left: calc(51 / 628 * 100%);
  top: calc(2 / 533 * 100%);
  width: calc(527 / 628 * 100%);
  aspect-ratio: 527 / 356;
  visibility: hidden;
  pointer-events: none;
}

.part {
  position: absolute;
  left: calc(var(--x) / 628 * 100%);
  top: calc(var(--y) / 533 * 100%);
  width: calc(var(--w) / 628 * 100%);
  height: auto;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
}

.sunlines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  transform-origin: calc(288 / 628 * 100%) calc(178 / 533 * 100%);
}
.sunlines line {
  stroke: var(--sun);
  stroke-width: 1;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.55;
}
.sunlines circle { fill: var(--sun); opacity: 0.6; }

.hero-meta { text-align: center; }
.tagline {
  margin-top: clamp(1.25rem, 4svh, 2.5rem);
  max-width: 30ch;
  font-family: var(--serif);
  font-size: clamp(1.125rem, 0.95rem + 0.9vw, 1.45rem);
  line-height: 1.45;
  color: var(--ink-soft);
}

.hero-cue {
  position: absolute;
  left: 50%;
  bottom: 24px;
}
.scroll-cue {
  display: block;
  position: relative;
  width: 1px;
  height: 48px;
  background: rgba(23, 39, 29, 0.14);
  overflow: hidden;
}
.scroll-cue::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 16px;
  background: var(--green);
  animation: cue 2s var(--ease-in-out) infinite;
}
@keyframes cue {
  from { transform: translateY(-16px); }
  to { transform: translateY(48px); }
}

/* Puntos de giro de cada pieza, en coordenadas de la propia pieza */
.base { transform-origin: 50.3% 85%; }
.page-left, .cover-left { transform-origin: 100% 100%; }
.page-right { transform-origin: 0% 100%; }
.leaf { transform-origin: 3% 98%; }
.ray-1 { transform-origin: 90% 90%; }
.ray-2 { transform-origin: 80% 94%; }
.ray-3 { transform-origin: 50% 96%; }
.ray-4 { transform-origin: 20% 94%; }

.word {
  -webkit-mask-image: linear-gradient(90deg, #000 33%, transparent 67%);
  mask-image: linear-gradient(90deg, #000 33%, transparent 67%);
  -webkit-mask-size: 300% 100%;
  mask-size: 300% 100%;
  -webkit-mask-position: 0 0;
  mask-position: 0 0;
}

/* Estado inicial: todo espera a que las imágenes estén listas */
.js .part,
.js .tagline,
.js .scroll-cue,
.js .site-header { opacity: 0; }
.js .sunlines line {
  stroke-dasharray: var(--len);
  stroke-dashoffset: var(--len);
}
.js .sunlines circle { opacity: 0; }

/* Secuencia de entrada */
.is-ready .site-header { animation: fade-in 700ms ease 1700ms both; }
/* Si alguien baja antes de que termine la entrada, el encabezado ya tiene que estar */
.is-docked .site-header { animation: none; opacity: 1; }

.is-ready .sunlines line {
  animation: line-draw 1500ms var(--ease-out) calc(150ms + var(--k) * 24ms) both;
}
.is-ready .sunlines circle {
  animation: dot-in 600ms var(--ease-out) calc(1100ms + var(--k) * 24ms) both;
}
.is-ready .sunlines { animation: drift 28s ease-in-out 3s infinite alternate; }

.is-ready .base { animation: base-in 900ms var(--ease-out) 120ms both; }
.is-ready .page-left { animation: unfold-left 1000ms var(--ease-spring) 350ms both; }
.is-ready .cover-left { animation: unfold-left 1000ms var(--ease-spring) 440ms both; }
.is-ready .page-right { animation: unfold-right 1000ms var(--ease-spring) 400ms both; }
.is-ready .sun { animation: sunrise 1200ms var(--ease-out) 700ms both; }
.is-ready .leaf {
  animation:
    leaf-grow 1100ms var(--ease-spring) 850ms both,
    leaf-sway 4.8s ease-in-out 2.4s infinite alternate;
}
.is-ready .ray {
  animation:
    ray-in 650ms var(--ease-spring) calc(1250ms + var(--r) * 80ms) both,
    ray-breathe 2.6s ease-in-out calc(2.4s + var(--r) * 350ms) infinite alternate;
}
.ray-1 { --r: 0; }
.ray-2 { --r: 1; }
.ray-3 { --r: 2; }
.ray-4 { --r: 3; }

.is-ready .word-1 { animation: word-in 1000ms var(--ease-out) 1500ms both; }
.is-ready .word-2 { animation: word-in 1100ms var(--ease-out) 1650ms both; }
.is-ready .tagline { animation: rise 900ms var(--ease-out) 2100ms both; }
.is-ready .scroll-cue { animation: fade-in 600ms ease 2700ms both; }

/* Si la página se abre ya desplazada, no hay función de entrada */
.no-intro .site-header,
.no-intro .part,
.no-intro .tagline,
.no-intro .scroll-cue { animation-delay: 0s !important; animation-duration: 1ms !important; }
.no-intro .sunlines line,
.no-intro .sunlines circle { animation: none; opacity: 0.55; stroke-dashoffset: 0; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes line-draw {
  from { stroke-dashoffset: var(--len); opacity: 0; }
  25% { opacity: 0.55; }
  to { stroke-dashoffset: 0; opacity: 0.55; }
}
@keyframes dot-in {
  from { opacity: 0; transform: scale(0.4); }
  to { opacity: 0.6; transform: none; }
}
@keyframes drift {
  from { transform: rotate(-2.5deg); }
  to { transform: rotate(2.5deg); }
}
@keyframes base-in {
  from { opacity: 0; transform: scaleX(0.2); }
  to { opacity: 1; transform: none; }
}
@keyframes unfold-left {
  from { opacity: 0; transform: perspective(600px) rotateY(-82deg); }
  35% { opacity: 1; }
  to { opacity: 1; transform: perspective(600px) rotateY(0deg); }
}
@keyframes unfold-right {
  from { opacity: 0; transform: perspective(600px) rotateY(82deg); }
  35% { opacity: 1; }
  to { opacity: 1; transform: perspective(600px) rotateY(0deg); }
}
@keyframes sunrise {
  from { opacity: 0; clip-path: circle(0% at 50% 100%); }
  to { opacity: 1; clip-path: circle(110% at 50% 100%); }
}
@keyframes leaf-grow {
  from { opacity: 0; transform: rotate(-32deg) scale(0.3); }
  35% { opacity: 1; }
  to { opacity: 1; transform: none; }
}
@keyframes leaf-sway {
  from { transform: none; }
  to { transform: rotate(-2.2deg); }
}
@keyframes ray-in {
  from { opacity: 0; transform: scale(0.15); }
  to { opacity: 1; transform: none; }
}
@keyframes ray-breathe {
  from { transform: none; }
  to { transform: scale(1.14); }
}
@keyframes word-in {
  from { opacity: 1; -webkit-mask-position: 100% 0; mask-position: 100% 0; transform: translateY(14%); }
  to { opacity: 1; -webkit-mask-position: 0 0; mask-position: 0 0; transform: none; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

/* ---------- Manifiesto ---------- */

.manifesto {
  position: relative;
  /* Sube mientras el logo viaja al encabezado, para que no quede un hueco */
  margin-top: -55vh;
  margin-top: -55svh;
  padding-block: clamp(6rem, 14vw, 11rem) clamp(4rem, 9vw, 7rem);
}
.no-js .manifesto { margin-top: 0; }

.statement {
  max-width: 17ch;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.25rem, 1.1rem + 4.8vw, 4.75rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.js .statement .w { opacity: 0.16; transition: opacity 160ms linear; }

.manifesto-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem;
  max-width: 780px;
  margin: clamp(3rem, 7vw, 5rem) 0 0 auto;
  color: var(--ink-soft);
}

/* ---------- Secciones ---------- */

.section { padding-block: clamp(5rem, 11vw, 9rem); }

.section h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 1.4rem + 2.2vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(1.5rem, 6vw, 6rem);
  align-items: start;
}
.split-body { max-width: 62ch; }
.split-body > * + * { margin-top: 1.25rem; }

.lead {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.65rem);
  line-height: 1.45;
  color: var(--ink);
}
.split-body p:not(.lead) { color: var(--ink-soft); }

.purpose {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2.5rem, 6vw, 5rem);
  margin-top: clamp(4rem, 9vw, 7rem);
}
.purpose-item {
  padding-top: 1.5rem;
  border-top: 2px solid var(--mist);
}
.purpose-item h3 {
  font-size: 1rem;
  color: var(--blue);
  margin-bottom: 1rem;
}
.purpose-item p {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.05rem + 0.4vw, 1.35rem);
  line-height: 1.55;
}

/* Áreas */
.areas {
  list-style: none;
  margin: clamp(3rem, 6vw, 4.5rem) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(3rem, 5vw, 4.5rem) clamp(2rem, 4vw, 3.5rem);
}
.areas h3 {
  margin: 1.25rem 0 0.6rem;
  font-size: 1.15rem;
  line-height: 1.3;
}
.areas p { color: var(--ink-soft); font-size: 1rem; }

.icon {
  width: 46px;
  height: 46px;
  fill: none;
  stroke: var(--c);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.js .icon > * {
  stroke-dasharray: var(--len);
  stroke-dashoffset: var(--len);
  transition: stroke-dashoffset 1300ms var(--ease-out);
  transition-delay: calc(var(--i) * 110ms + var(--n, 0) * 90ms);
}
.icon > :nth-child(2) { --n: 1; }
.icon > :nth-child(3) { --n: 2; }
.icon > :nth-child(4) { --n: 3; }
.icon > :nth-child(5) { --n: 4; }
.icon > :nth-child(6) { --n: 5; }
.icon > :nth-child(7) { --n: 6; }
.js .areas.is-drawn .icon > * { stroke-dashoffset: 0; }

/* Cómo trabajamos */
.method { background: var(--mist); padding-bottom: 0; }
.method-note {
  margin-top: clamp(3.5rem, 8vw, 6rem);
  max-width: 62ch;
  color: var(--ink-soft);
}

.marquee {
  margin-top: 1.5rem;
  padding-block: clamp(1.5rem, 3vw, 2.5rem) clamp(3.5rem, 7vw, 5.5rem);
  overflow: hidden;
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 48s linear infinite;
}
.marquee span {
  display: flex;
  align-items: center;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 1.5rem + 5vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--green);
  white-space: nowrap;
}
.marquee span::after {
  content: "";
  width: 0.22em;
  height: 0.22em;
  margin-inline: 0.55em;
  border-radius: 50%;
  background: var(--sun);
}
@keyframes marquee {
  to { transform: translateX(-50%); }
}
@media (hover: hover) and (pointer: fine) {
  .marquee:hover .marquee-track { animation-play-state: paused; }
}

/* Principios */
.principles {
  margin: clamp(3rem, 6vw, 4.5rem) 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2.25rem, 4vw, 3.25rem) clamp(2rem, 6vw, 6rem);
}
.principles dt {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 1.15rem + 0.5vw, 1.55rem);
  line-height: 1.25;
}
.principles dd {
  margin: 0.6rem 0 0;
  color: var(--ink-soft);
  max-width: 48ch;
}

/* Contacto */
.contact {
  background: var(--forest);
  color: #fff;
  padding-block: clamp(6rem, 14vw, 10rem);
}
.contact h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #b9d98c;
}
.contact-lead {
  margin-top: 1.25rem;
  max-width: 22ch;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 1.2rem + 3vw, 3.4rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.contact-email {
  display: inline;
  margin-top: 2.5rem;
  font-size: clamp(1.15rem, 0.9rem + 1.6vw, 2rem);
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  overflow-wrap: anywhere;
  background: linear-gradient(rgba(152, 187, 67, 0.35), rgba(152, 187, 67, 0.35)) 0 100% / 100% 2px no-repeat;
  transition: background-size 350ms var(--ease-out);
}
.contact .wrap > .contact-email { display: inline-block; }
@media (hover: hover) and (pointer: fine) {
  .contact-email:hover { background-size: 100% 100%; }
}
.contact-email:active { opacity: 0.85; }

/* Pie */
.site-footer {
  background: var(--forest);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  line-height: 1.5;
}
.footer-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: 28px 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.footer-inner img { height: 30px; width: auto; }
.footer-year { margin-left: auto; }

/* ---------- Pantallas chicas ---------- */

@media (max-width: 999px) {
  .areas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 759px) {
  .split,
  .purpose,
  .principles,
  .manifesto-body { grid-template-columns: minmax(0, 1fr); }
  .manifesto-body { gap: 1.25rem; }
  .areas { grid-template-columns: minmax(0, 1fr); }
  .brand-name { font-size: 0.875rem; }
}

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

@media (prefers-reduced-motion: reduce) {
  .hero { height: 100vh; height: 100svh; }
  .manifesto { margin-top: 0; }
  .is-ready .part,
  .is-ready .tagline,
  .is-ready .scroll-cue,
  .is-ready .site-header { animation: fade-in 500ms ease both; }
  .is-ready .sunlines { animation: none; }
  .is-ready .sunlines line,
  .is-ready .sunlines circle { animation: fade-in 500ms ease both; stroke-dashoffset: 0; }
  .scroll-cue::after { animation: none; }
  .js .icon > * { transition: none; stroke-dashoffset: 0; }
  .js .statement .w { opacity: 1; }
  .marquee-track { animation: none; flex-wrap: wrap; width: auto; padding-inline: var(--gutter); row-gap: 0.75rem; }
  .marquee-track span:nth-child(n+7) { display: none; }
  .marquee span { font-size: clamp(1.75rem, 1.2rem + 3vw, 3rem); }
  .menu, .menu a, .brand-name { transition: none; }
}
