/* ============================================================
   SOLARLINK — presentación TFG
   Scroll vertical continuo, paleta slate + óxido de hjs.es.
   ============================================================ */

:root {
  --bg: #15171a;
  --bg-soft: #1c1f23;
  --bg-card: #242830;
  --line: #33383f;
  --text: #e8e6e1;
  --text-dim: #8b9199;
  --text-faint: #5c6169;

  --rust: #d4703a;        /* acento principal — energía / solar */
  --rust-dim: #4a3122;
  --teal: #4a9b6e;        /* acento secundario — red / positivo */
  --teal-dim: #1e3629;
  --gold: #d4af6a;        /* acento terciario — seguridad */
  --gold-dim: #4a3f26;
  --red: #e05252;         /* semántico — coste / negativo, sin cambios */

  --serif-display: 'Syne', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
}

/* ── STARFIELD ── */
#stars {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  overflow: hidden;
}
.star {
  position: absolute;
  border-radius: 50%;
  background: white;
  animation: twinkle var(--d) infinite ease-in-out var(--delay);
}
@keyframes twinkle {
  0%, 100% { opacity: var(--min-op); transform: scale(1); }
  50% { opacity: var(--max-op); transform: scale(1.4); }
}

/* ── PROGRESS BAR (arriba, se rellena con el scroll) ── */
#scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  z-index: 300; background: var(--line);
}
#scroll-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--rust), var(--gold));
  transition: width 0.1s linear;
}

/* ── SIDE NAV (puntos para saltar de sección) ── */
#side-nav {
  position: fixed; right: 22px; top: 50%; transform: translateY(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
}
.side-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--line);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}
.side-dot:hover { background: var(--text-dim); }
.side-dot.active { background: var(--rust); height: 22px; border-radius: 4px; }
.side-dot .dot-label {
  position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
  white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
  background: var(--bg-soft); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: 4px;
}
.side-dot:hover .dot-label { opacity: 1; }

@media (max-width: 860px) { #side-nav { display: none; } }

/* ── FULLSCREEN TOGGLE ── */
#fs-btn {
  position: fixed; top: 20px; right: 24px; z-index: 200;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 14px;
  font-family: var(--mono);
  font-size: 10px; color: var(--text-dim);
  cursor: pointer; letter-spacing: 1px;
  transition: all .2s;
}
#fs-btn:hover { border-color: var(--rust); color: var(--rust); }

/* ── SECTIONS ── */
.section {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column;
  justify-content: center;
  padding: 14vh 7vw;
  max-width: 1280px;
  margin: 0 auto;
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(.4,0,.2,1), transform 0.7s cubic-bezier(.4,0,.2,1);
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ── SECTION META (etiqueta pequeña arriba de cada sección) ── */
.section-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono);
  font-size: 11px; color: var(--text-dim);
  letter-spacing: 1.5px; text-transform: uppercase;
  margin-bottom: 5vh;
}
.section-num {
  font-size: 11px;
  color: var(--rust);
  border: 1px solid var(--rust-dim);
  padding: 3px 10px; border-radius: 20px;
  background: rgba(212,112,58,.08);
}

/* ── SLIDE 1: PORTADA ── */
#s1 {
  justify-content: center;
  align-items: center;
  text-align: center;
}
#s1 .bg-sun {
  position: absolute;
  bottom: -20vh; left: 50%; transform: translateX(-50%);
  width: 70vw; height: 70vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,112,58,.16) 0%, rgba(212,112,58,.03) 45%, transparent 70%);
  pointer-events: none;
}
#s1 .logo-mark {
  font-family: var(--serif-display);
  font-size: clamp(70px, 14vw, 160px);
  font-weight: 800;
  letter-spacing: -4px;
  line-height: 1;
  color: transparent;
  background: linear-gradient(135deg, #fff 0%, var(--rust) 50%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  margin-bottom: 24px;
}
#s1 .tagline {
  font-size: clamp(13px, 1.8vw, 20px);
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  max-width: 600px;
}
#s1 .authors {
  margin-top: 40px;
  display: flex; gap: 24px; flex-wrap: wrap; justify-content: center;
}
#s1 .author-chip {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 8px 20px;
  font-size: 13px;
  color: var(--text);
}
#s1 .scroll-hint {
  position: absolute; bottom: 6vh; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text-dim); font-size: 10px; letter-spacing: 2px;
  text-transform: uppercase;
}
.arrow-down {
  width: 20px; height: 20px;
  border-right: 1px solid var(--text-dim);
  border-bottom: 1px solid var(--text-dim);
  transform: rotate(45deg);
  animation: bounce 1.6s infinite;
}
@keyframes bounce { 0%,100%{transform:rotate(45deg) translateY(0)} 50%{transform:rotate(45deg) translateY(4px)} }

/* ── SLIDE 2: CONTEXTO — big stats ── */
.big-stat-row {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 20px;
}
.big-stat {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 24px;
  position: relative; overflow: hidden;
}
.big-stat::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
}
.big-stat.rust::before { background: linear-gradient(90deg, transparent, var(--rust), transparent); }
.big-stat.teal::before { background: linear-gradient(90deg, transparent, var(--teal), transparent); }
.big-stat.gold::before { background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.big-stat .num {
  font-family: var(--serif-display);
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 800; line-height: 1;
  margin-bottom: 8px;
}
.big-stat.rust .num { color: var(--rust); }
.big-stat.teal .num { color: var(--teal); }
.big-stat.gold .num { color: var(--gold); }
.big-stat .stat-label { font-size: 13px; color: var(--text-dim); line-height: 1.5; }

/* ── SECTION HEADER ── */
.section-title {
  font-family: var(--serif-display);
  font-size: clamp(28px, 4.5vw, 54px);
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: 6px;
}
.section-subtitle {
  font-size: clamp(12px, 1.4vw, 16px);
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6vh;
}
.accent-rust { color: var(--rust); }
.accent-teal { color: var(--teal); }
.accent-gold { color: var(--gold); }

/* ── TWO / THREE COL ── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}
.card-icon {
  font-size: 28px; margin-bottom: 12px; display: block;
}
.card-title {
  font-family: var(--serif-display);
  font-size: 15px; font-weight: 700;
  margin-bottom: 8px;
}
.card-body {
  font-size: 13px; color: var(--text-dim);
  line-height: 1.75;
}

/* ── PILLS ── */
.pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 500;
  margin: 3px 3px 3px 0;
}
.pill-rust { background: rgba(212,112,58,.1); border: 1px solid rgba(212,112,58,.3); color: var(--rust); }
.pill-teal { background: rgba(74,155,110,.1); border: 1px solid rgba(74,155,110,.3); color: var(--teal); }
.pill-gold { background: rgba(212,175,106,.1); border: 1px solid rgba(212,175,106,.3); color: var(--gold); }
.pill-red { background: rgba(224,82,82,.1); border: 1px solid rgba(224,82,82,.3); color: var(--red); }

/* ── STEPS ── */
.steps { display: flex; flex-direction: column; gap: 14px; }
.step { display: flex; gap: 16px; align-items: flex-start; }
.step-num {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--rust);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 11px; font-weight: 700; color: var(--rust);
}
.step-text { font-size: 14px; color: var(--text); line-height: 1.6; padding-top: 4px; }
.step-text b { color: var(--rust); font-weight: 600; }

/* ── PROGRESS BARS (dentro de tarjetas) ── */
.progress-row { display: flex; flex-direction: column; gap: 12px; }
.prog-label { display: flex; justify-content: space-between; font-size: 11.5px; margin-bottom: 5px; }
.prog-label span:first-child { color: var(--text-dim); }
.prog-track { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 2px; width: 0; transition: width 1.1s ease; }
.fill-rust { background: linear-gradient(90deg, var(--rust-dim), var(--rust)); }
.fill-teal { background: linear-gradient(90deg, var(--teal-dim), var(--teal)); }
.fill-gold { background: linear-gradient(90deg, var(--gold-dim), var(--gold)); }

/* ── DEMO SLIDE (iframe) ── */
.iframe-wrap {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 0 60px rgba(212,112,58,.06);
  position: relative;
  height: 62vh;
  min-height: 380px;
}
.iframe-wrap iframe {
  width: 100%; height: 100%; border: none; display: block;
}
.iframe-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
  padding: 9px 16px;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono);
  font-size: 11px; color: var(--text-dim);
}
.dot-row { display: flex; gap: 6px; }
.dot-r { width:10px; height:10px; border-radius:50%; background:#e05252; }
.dot-y { width:10px; height:10px; border-radius:50%; background:#d4af6a; }
.dot-g { width:10px; height:10px; border-radius:50%; background:#4a9b6e; }
.url-bar {
  flex: 1; background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 12px;
  font-size: 11px; color: var(--text);
  max-width: 500px;
}

/* ── QR SECTION ── */
.qr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.qr-box {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  display: flex; flex-direction: column; gap: 16px;
}
.qr-code-wrap {
  width: 100%; max-width: 160px;
  background: white;
  border-radius: 8px;
  padding: 12px;
  align-self: center;
}
.qr-code-wrap svg { display: block; width: 100%; height: auto; }
.qr-caption {
  text-align: center; font-family: var(--mono); font-size: 10.5px;
  color: var(--text-faint); margin-top: -6px;
}
.role-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
}
.role-icon { font-size: 20px; flex-shrink: 0; }
.role-name { font-family: var(--serif-display); font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.role-desc { font-size: 10.5px; color: var(--text-dim); }

/* ── VIABILITY TABLE ── */
.viab-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.viab-table th {
  text-align: left; padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-dim);
}
.viab-table td { padding: 10px 14px; border-bottom: 1px solid rgba(51,56,63,.5); color: var(--text-dim); }
.viab-table tr:last-child td { border-bottom: none; }
.viab-table tr:hover td { background: rgba(255,255,255,.015); }

/* ── CÓDIGO (WireGuard config) ── */
.code-block {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.85;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px; flex: 1; overflow: auto;
}

/* ── GRACIAS ── */
#s12 { justify-content: center; align-items: center; text-align: center; }
#s12 .big-thanks {
  font-family: var(--serif-display);
  font-size: clamp(60px, 12vw, 140px);
  font-weight: 800;
  color: transparent;
  background: linear-gradient(135deg, var(--text-dim) 0%, var(--text) 50%, var(--rust) 100%);
  -webkit-background-clip: text; background-clip: text;
  line-height: 1;
}
#s12 .contact { margin-top: 18px; font-size: 14px; color: var(--text-dim); }
#s12 .contact a { color: var(--rust); text-decoration: none; }
#s12 .sun-ring {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 60%, rgba(212,112,58,.10) 0%, transparent 55%);
}

.cta-row { margin-top: 36px; }
.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--rust);
  color: #15171a;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  padding: 15px 32px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}
.btn-cta:hover {
  background: var(--gold);
  transform: translateY(-2px);
}

/* ── ENLACE DE VUELTA (arriba a la izquierda, junto al de pantalla completa) ── */
#back-link {
  position: fixed; top: 20px; left: 24px; z-index: 200;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 14px;
  font-family: var(--mono);
  font-size: 10px; color: var(--text-dim);
  text-decoration: none;
  letter-spacing: 1px;
  transition: all .2s;
}
#back-link:hover { border-color: var(--rust); color: var(--rust); }

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .two-col, .three-col, .qr-grid { grid-template-columns: 1fr; }
  .big-stat-row { grid-template-columns: 1fr; }
  .section { padding: 12vh 6vw; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
