:root {
  --ground: #0F5B3C;      /* verde de Andalucía */
  --ground-step: #17694A; /* botones en reposo */
  --ink: #FFFFFF;
  --mark: #FFD23F;        /* el recuadro de los subtítulos */
  --mark-ink: #101010;

  --font: "Archivo", system-ui, sans-serif;
  --caption: clamp(2.6rem, 9vw, 5.25rem);
  --beat: 2.4s;           /* lo que tarda el recuadro en saltar de palabra */
}

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

body {
  margin: 0;
  min-height: 100svh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

.page {
  width: min(100% - 2rem, 44rem);
  min-height: 100svh;
  margin-inline: auto;
  padding-block: 4rem 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* El nombre, como un subtítulo quemado en un short */
.caption {
  position: relative;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 .28em;
  font-size: var(--caption);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.02em;
  text-transform: uppercase;
}
.caption__word {
  position: relative;
  z-index: 1;
  padding: .08em .14em .1em;
  transition: color .18s;
  animation: say .45s cubic-bezier(.3, 1.6, .5, 1) both;
}
.caption__word:nth-of-type(2) { animation-delay: .35s; }
.caption__word + .caption__word { animation-delay: .35s; }
.caption__word.is-on { color: var(--mark-ink); }

.caption__box {
  position: absolute;
  z-index: 0;
  left: 0;
  top: 0;
  border-radius: .12em;
  background: var(--mark);
  transition: transform .32s cubic-bezier(.3, 1.4, .5, 1), width .32s cubic-bezier(.3, 1.4, .5, 1), height .32s;
}
/* Sin JavaScript el recuadro se queda en "Palmero" */
.caption:not(.is-live) .caption__box { display: none; }
.caption:not(.is-live) .caption__word.is-on { background: var(--mark); border-radius: .12em; }

@keyframes say {
  from { opacity: 0; transform: scale(.6); }
}

/* Los canales, como los botones laterales de un short */
.rail {
  margin-top: clamp(3rem, 9vh, 4.5rem);
  display: flex;
  justify-content: center;
  gap: clamp(1.25rem, 5vw, 2.5rem);
}
.rail__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .55rem;
  color: var(--ink);
  text-decoration: none;
  animation: rise .5s cubic-bezier(.2, .8, .2, 1) both;
}
.rail__item:nth-child(1) { animation-delay: .8s; }
.rail__item:nth-child(2) { animation-delay: .87s; }
.rail__item:nth-child(3) { animation-delay: .94s; }
.rail__item:nth-child(4) { animation-delay: 1.01s; }
.rail__btn {
  display: grid;
  place-items: center;
  width: 3.75rem;
  height: 3.75rem;
  border-radius: 50%;
  background: var(--ground-step);
  transition: background-color .18s, color .18s, transform .18s;
}
.rail__btn svg { width: 1.6rem; height: 1.6rem; }
.rail__label { font-size: .95rem; font-weight: 500; }
.rail__item:hover .rail__btn,
.rail__item:focus-visible .rail__btn { background: var(--mark); color: var(--mark-ink); transform: scale(1.08); }
.rail__item:active .rail__btn { transform: scale(.94); }
.rail__item:focus-visible { outline: none; }
.rail__item:focus-visible .rail__btn { outline: 3px solid var(--ink); outline-offset: 3px; }

@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* La barra de reproducción de abajo, al ritmo del recuadro */
.progress {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: var(--ground-step);
}
.progress span {
  display: block;
  height: 100%;
  background: var(--mark);
  transform-origin: left;
  animation: play calc(var(--beat) * 2) linear infinite;
}
@keyframes play { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Proyectos (ocultos hasta que haya alguno) */
.projects { width: 100%; margin-top: 5rem; }
.projects__title { margin: 0 0 1rem; font-size: 1.25rem; font-weight: 900; text-transform: uppercase; }
.projects__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1rem; }
.project {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ground-step);
  color: inherit;
  text-decoration: none;
  transition: transform .18s;
}
.project:hover { transform: translateY(-3px); }
.project:focus-visible { outline: 3px solid var(--mark); outline-offset: 3px; }
.project__img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; display: block; }
.project__body { padding: .9rem 1rem 1.1rem; }
.project__name { margin: 0; font-size: 1.1rem; font-weight: 900; }
.project__desc { margin: .3rem 0 0; font-weight: 500; }

@media (max-width: 26rem) {
  .rail__btn { width: 3.25rem; height: 3.25rem; }
  .rail__label { font-size: .85rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
