/* Base y colores del proyecto */
:root {
  color-scheme: dark;
  --black: #090909;
  --black-soft: #141414;
  --graphite: #252525;
  --paper: #f1eee6;
  --white: #ffffff;
  --muted: #a5a5a0;
  --green: #b9f451;
  --cyan: #5fd7cc;
  --salmon: #f28d79;
  --line: #393939;
  --max-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

section[id] {
  scroll-margin-top: 80px;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--white);
  background: var(--black);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px var(--black);
}

button {
  color: inherit;
  font: inherit;
}

h1,
h2,
h3,
p,
figure,
dl,
dd {
  margin-top: 0;
}

.container {
  width: min(var(--max-width), calc(100% - 48px));
  margin-inline: auto;
}

/* Cabecera */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(9, 9, 9, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.header-inner {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 27px;
  height: 27px;
  position: relative;
  display: inline-block;
  background: var(--green);
  border-radius: 4px;
}

.brand-icon::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 10px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid var(--black);
}

.brand strong {
  font-size: 1rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 25px;
  color: var(--muted);
  font-size: 0.84rem;
}

.site-nav a {
  padding-block: 5px;
  border-bottom: 1px solid transparent;
}

.site-nav a:hover {
  color: var(--white);
  border-color: var(--white);
}

.site-nav .back-link {
  color: var(--white);
}

/* Presentación */
.hero {
  overflow: hidden;
  padding: 52px 0 46px;
}

.hero-grid {
  min-height: calc(100vh - 210px);
  display: grid;
  grid-template-columns: minmax(0, 0.76fr) minmax(500px, 1.24fr);
  align-items: center;
  gap: 54px;
}

.hero-copy,
.player {
  min-width: 0;
}

.overline,
.section-number {
  margin-bottom: 17px;
  color: var(--green);
  font-size: 0.73rem;
  font-weight: 700;
}

.hero h1 {
  margin-bottom: 22px;
  font-size: 6.4rem;
  line-height: 0.83;
}

.hero-tagline {
  margin-bottom: 20px;
  color: var(--paper);
  font-size: 1.65rem;
  line-height: 1.12;
  font-weight: 700;
}

.hero-intro {
  max-width: 580px;
  margin-bottom: 29px;
  color: var(--muted);
  font-size: 1rem;
}

.hero-actions,
.download-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 22px;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 0 17px;
  border: 1px solid var(--green);
  border-radius: 4px;
  font-size: 0.86rem;
  font-weight: 700;
}

.button-primary {
  color: var(--black);
  background: var(--green);
}

.button-primary:hover {
  background: var(--white);
  border-color: var(--white);
}

.text-link,
.download-repo {
  padding-block: 7px;
  border-bottom: 1px solid currentColor;
  font-size: 0.86rem;
}

/* Interfaz visual del reproductor */
.player {
  position: relative;
  margin: 0;
  border: 1px solid #4a4a4a;
  background: #111111;
  box-shadow: 24px 24px 0 #202020;
}

.window-bar {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  color: #8d8d89;
  border-bottom: 1px solid var(--line);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.66rem;
}

.window-state {
  color: var(--green);
}

.video-stage {
  position: relative;
  min-height: 362px;
  overflow: hidden;
  background:
    linear-gradient(rgba(95, 215, 204, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(95, 215, 204, 0.08) 1px, transparent 1px),
    #0b1212;
  background-size: 34px 34px;
}

.video-stage::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 61%;
  width: 1px;
  background: rgba(95, 215, 204, 0.35);
}

.video-stage::after {
  content: "";
  position: absolute;
  top: 58%;
  right: 0;
  left: 0;
  height: 1px;
  background: rgba(95, 215, 204, 0.35);
}

.video-data {
  position: absolute;
  top: 17px;
  left: 17px;
  display: flex;
  gap: 14px;
  color: var(--cyan);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.62rem;
}

.frame-number {
  position: absolute;
  top: 80px;
  left: 9%;
  display: flex;
  flex-direction: column;
  color: var(--cyan);
  font-family: Consolas, "Courier New", monospace;
}

.frame-number span {
  font-size: 0.68rem;
}

.frame-number strong {
  font-size: 3.8rem;
  line-height: 1;
  font-weight: 400;
}

.audio-meter {
  position: absolute;
  right: 8%;
  bottom: 54px;
  left: 8%;
  height: 94px;
  display: flex;
  align-items: end;
  gap: 8px;
}

.audio-meter i {
  flex: 1;
  height: 42%;
  background: var(--cyan);
  opacity: 0.68;
  animation: meter 900ms ease-in-out infinite alternate;
}

.audio-meter i:nth-child(2n) {
  height: 78%;
  animation-delay: 160ms;
}

.audio-meter i:nth-child(3n) {
  height: 56%;
  animation-delay: 320ms;
}

.audio-meter i:nth-child(5n) {
  height: 92%;
  animation-delay: 480ms;
}

@keyframes meter {
  to {
    transform: scaleY(0.55);
    opacity: 0.36;
  }
}

.preview {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 138px;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
  color: var(--black);
  background: var(--salmon);
  font-family: Consolas, "Courier New", monospace;
}

.preview span {
  font-size: 0.58rem;
}

.preview strong {
  align-self: flex-end;
  font-size: 1.25rem;
}

.player-controls {
  padding: 15px 17px 18px;
}

.time-row {
  display: flex;
  justify-content: space-between;
  color: #8d8d89;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.62rem;
}

.timeline {
  position: relative;
  height: 3px;
  margin: 10px 0 17px;
  background: #3c3c3c;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 46%;
  background: var(--green);
}

.progress-knob {
  position: absolute;
  top: 50%;
  left: 46%;
  width: 9px;
  height: 9px;
  background: var(--green);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.control-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-row button {
  width: 34px;
  height: 32px;
  padding: 0;
  border: 1px solid #434343;
  border-radius: 3px;
  background: #1d1d1d;
  cursor: pointer;
  font-size: 0.72rem;
}

.control-row .play-button {
  color: var(--black);
  background: var(--green);
  border-color: var(--green);
}

.codec,
.volume {
  color: #8d8d89;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.61rem;
}

.codec {
  margin-left: auto;
}

.player figcaption {
  position: absolute;
  right: 0;
  bottom: -28px;
  color: #7d7d79;
  font-size: 0.66rem;
}

/* Franja de datos */
.facts {
  color: var(--black);
  background: var(--paper);
}

.facts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.facts p {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 0;
  padding: 22px;
  border-left: 1px solid #c6c2b9;
}

.facts p:last-child {
  border-right: 1px solid #c6c2b9;
}

.facts span {
  color: #6d6a64;
  font-size: 0.7rem;
}

.facts strong {
  font-size: 1.05rem;
}

/* Historia del proyecto */
.section {
  padding: 108px 0;
}

.story {
  color: var(--black);
  background: var(--paper);
}

.story-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.75fr);
  gap: 100px;
}

.story .section-number,
.details .section-number {
  color: #63615c;
}

.section-title h2,
.architecture-heading h2,
.details-heading h2,
.download h2 {
  margin-bottom: 0;
  font-size: 3.8rem;
  line-height: 0.98;
}

.story-copy {
  padding-top: 32px;
}

.story-copy p {
  color: #67645e;
}

.story-copy .story-lead {
  color: var(--black);
  font-size: 1.25rem;
  font-weight: 700;
}

/* Arquitectura */
.architecture {
  padding: 108px 0 116px;
  background: var(--black-soft);
  border-block: 1px solid var(--line);
}

.architecture-heading {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(260px, 0.45fr);
  column-gap: 80px;
  margin-bottom: 64px;
}

.architecture-heading .section-number {
  grid-column: 1 / -1;
}

.architecture-heading p:last-child {
  align-self: end;
  margin-bottom: 0;
  color: var(--muted);
}

.pipeline {
  display: grid;
  grid-template-columns: 1fr 36px 1fr 36px 1.2fr 36px 1fr;
  align-items: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.pipeline-node {
  min-height: 154px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
}

.pipeline-node span,
.pipeline-node small {
  color: var(--muted);
  font-size: 0.66rem;
}

.pipeline-node strong {
  margin: 8px 0 4px;
  font-size: 1.04rem;
}

.source-node strong {
  color: var(--green);
}

.audio-node strong {
  color: var(--cyan);
}

.video-node strong {
  color: var(--salmon);
}

.clock-node strong {
  color: var(--green);
}

.pipeline-arrow {
  color: #6a6a66;
  text-align: center;
}

.pipeline-branches {
  display: grid;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.pipeline-branches .pipeline-node {
  min-height: 112px;
}

.pipeline-branches .pipeline-node + .pipeline-node {
  border-top: 1px solid var(--line);
}

/* Decisiones técnicas */
.details {
  color: var(--black);
  background: var(--paper);
}

.details-heading {
  margin-bottom: 58px;
}

.detail-list {
  border-top: 1px solid var(--black);
}

.detail-list article {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 28px;
  padding: 27px 0;
  border-bottom: 1px solid #c6c2b9;
}

.detail-list h3,
.detail-list p {
  margin-bottom: 0;
}

.detail-list h3 {
  font-size: 1.12rem;
}

.detail-list p {
  color: #67645e;
}

/* Descarga */
.download {
  padding: 104px 0;
  color: var(--black);
  background: var(--green);
}

.download .section-number {
  color: #4c641d;
}

.download-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 0.7fr);
  gap: 100px;
}

.download-copy > p {
  font-size: 1.08rem;
}

.download dl {
  margin-bottom: 34px;
  border-top: 1px solid rgba(9, 9, 9, 0.35);
}

.download dl div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(9, 9, 9, 0.35);
}

.download dt,
.download dd {
  font-size: 0.78rem;
}

.download dd {
  margin-bottom: 0;
  font-weight: 700;
}

.button-dark {
  color: var(--white);
  background: var(--black);
  border-color: var(--black);
}

.download-repo {
  font-weight: 700;
}

/* Pie de página */
.site-footer {
  border-top: 1px solid var(--line);
}

.footer-inner {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
  font-size: 0.76rem;
}

.footer-inner p {
  margin-bottom: 0;
}

.footer-inner a {
  color: var(--white);
}

/* Aparición progresiva */
[data-animate] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 520ms ease, transform 520ms ease;
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Adaptación para tablet */
@media (max-width: 1120px) {
  .hero-grid {
    grid-template-columns: minmax(350px, 0.9fr) minmax(0, 1.1fr);
    gap: 35px;
  }

  .hero h1 {
    font-size: 4.6rem;
  }

  .hero-tagline {
    font-size: 1.35rem;
  }

  .section-title h2,
  .architecture-heading h2,
  .details-heading h2,
  .download h2 {
    font-size: 3.1rem;
  }

  .story-grid,
  .download-grid {
    gap: 55px;
  }

  .pipeline {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .pipeline-arrow {
    padding: 8px;
    transform: rotate(90deg);
  }

  .pipeline-branches {
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--line);
  }

  .pipeline-branches .pipeline-node + .pipeline-node {
    border-top: 0;
    border-left: 1px solid var(--line);
  }
}

/* Apila el reproductor antes de que el título pierda espacio */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 50px;
  }

  .hero-copy {
    max-width: 650px;
  }
}

/* Adaptación para móvil */
@media (max-width: 720px) {
  section[id] {
    scroll-margin-top: 108px;
  }

  .container {
    width: min(100% - 28px, var(--max-width));
  }

  .header-inner {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 13px 0;
  }

  .site-nav {
    width: 100%;
    gap: 17px;
    overflow-x: auto;
  }

  .site-nav a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
  }

  .hero {
    padding-top: 40px;
    padding-bottom: 24px;
  }

  .hero-grid {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .hero h1 {
    font-size: 4rem;
  }

  .video-stage {
    min-height: 230px;
  }

  .frame-number strong {
    font-size: 2.7rem;
  }

  .player {
    box-shadow: 12px 12px 0 #202020;
  }

  .facts-grid {
    grid-template-columns: 1fr 1fr;
  }

  .facts p:nth-child(2) {
    border-right: 1px solid #c6c2b9;
  }

  .facts p:nth-child(n + 3) {
    border-top: 1px solid #c6c2b9;
  }

  .section,
  .architecture,
  .download {
    padding: 76px 0;
  }

  .story-grid,
  .architecture-heading,
  .download-grid {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .section-title h2,
  .architecture-heading h2,
  .details-heading h2,
  .download h2 {
    font-size: 2.5rem;
  }

  .story-copy {
    padding-top: 0;
  }

  .architecture-heading .section-number {
    grid-column: auto;
  }

  .detail-list article {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .detail-list p {
    grid-column: auto;
  }
}

@media (max-width: 430px) {
  .hero h1 {
    font-size: 3.25rem;
  }

  .video-data {
    gap: 7px;
    font-size: 0.54rem;
  }

  .video-stage {
    min-height: 210px;
  }

  .audio-meter {
    height: 68px;
  }

  .preview {
    width: 108px;
  }

  .codec {
    display: none;
  }

  .facts-grid,
  .pipeline-branches {
    grid-template-columns: 1fr;
  }

  .facts p,
  .facts p:last-child {
    border-right: 1px solid #c6c2b9;
  }

  .facts p + p {
    border-top: 1px solid #c6c2b9;
  }

  .pipeline-branches .pipeline-node + .pipeline-node {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

/* Mantiene todos los destinos visibles en pantallas especialmente estrechas */
@media (max-width: 360px) {
  .site-nav {
    justify-content: space-between;
    gap: 5px;
    overflow-x: visible;
    font-size: 0.78rem;
  }
}

/* Reduce animaciones cuando el sistema lo solicita */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  [data-animate] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .audio-meter i {
    animation: none;
  }
}
