/**
 * davito.dev - Project Detail Pages Theme
 * Estética unificada con la portada de davito.dev: minimalismo técnico,
 * fondo obsidian, tipografía monoespaciada, bordes sutiles y chips cyberpunk.
 */

:root {
  --c-bg: #060607;
  --c-surface: #0c0c10;
  --c-surface-hi: #14141c;
  --c-line: #1c1c24;
  --c-line-hi: #2e2e3c;
  --c-text: #ededed;
  --c-dim: #9090a2;
  --c-faint: #555566;
  --c-accent: #8a7fff;
  --c-accent-glow: rgba(138, 127, 255, 0.25);
  --c-emerald: #23a55a;
  --c-amber: #f0b232;
  --c-rose: #f23f43;

  --mono: "IBM Plex Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius: 8px;
  --radius-sm: 4px;
}

html[data-theme="light"] {
  --c-bg: #f4f4f2;
  --c-surface: #ffffff;
  --c-surface-hi: #f9f9fb;
  --c-line: #dfdfe6;
  --c-line-hi: #bcbcc6;
  --c-text: #111113;
  --c-dim: #60606e;
  --c-faint: #90909c;
  --c-accent: #6556e8;
  --c-accent-glow: rgba(101, 86, 232, 0.15);
}

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

html {
  background-color: var(--c-bg);
  color: var(--c-text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background-color: var(--c-bg);
}

/* Brackets HUD en esquinas */
.gs-fcorner {
  position: fixed;
  width: 14px;
  height: 14px;
  border-color: var(--c-line-hi);
  border-style: solid;
  pointer-events: none;
  z-index: 2;
  opacity: 0.7;
}
.gs-fcorner.tl { top: 16px; left: 16px; border-width: 1px 0 0 1px; }
.gs-fcorner.tr { top: 16px; right: 16px; border-width: 1px 1px 0 0; }
.gs-fcorner.bl { bottom: 16px; left: 16px; border-width: 0 0 1px 1px; }
.gs-fcorner.br { bottom: 16px; right: 16px; border-width: 0 1px 1px 0; }

.crt-scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(rgba(18, 16, 26, 0) 50%, rgba(0, 0, 0, 0.22) 50%);
  background-size: 100% 4px;
  opacity: 0.5;
}

.project-page-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 24px 120px;
  position: relative;
  z-index: 2;
}

/* Barra superior de navegación y retorno */
.project-top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 40px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--c-line);
  font-family: var(--mono);
  font-size: 12px;
}

.back-to-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--c-dim);
  text-decoration: none;
  padding: 6px 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.back-to-home:hover {
  color: var(--c-text);
  border-color: var(--c-accent);
}

.breadcrumb-tag {
  color: var(--c-faint);
  letter-spacing: 0.05em;
}

.breadcrumb-tag span {
  color: var(--c-accent);
}

/* Hero del Proyecto */
.pd-hero-card {
  background: rgba(12, 12, 16, 0.8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 32px;
  display: flex;
  gap: 28px;
  align-items: flex-start;
  margin-bottom: 40px;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.8);
}

html[data-theme="light"] .pd-hero-card {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 36px -20px rgba(0, 0, 0, 0.1);
}

@media (max-width: 680px) {
  .pd-hero-card {
    flex-direction: column;
    padding: 22px;
  }
}

.pd-hero-logo {
  width: 90px;
  height: 90px;
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--c-line-hi);
  background: #000;
}

.pd-hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pd-hero-details {
  flex: 1;
}

.pd-kicker {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--c-accent);
  margin-bottom: 8px;
  display: block;
}

.pd-title {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.pd-sub {
  color: var(--c-dim);
  font-size: 15px;
  line-height: 1.55;
  margin-bottom: 20px;
}

/* Badges de tecnología en Hero */
.pd-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  font-family: var(--mono);
}

.pj-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--c-surface-hi);
  border: 1px solid var(--c-line);
  color: var(--c-dim);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pj-badge.live {
  background: rgba(35, 165, 90, 0.12);
  border-color: rgba(35, 165, 90, 0.35);
  color: #57f287;
}

.pj-badge.vpn {
  background: rgba(138, 127, 255, 0.12);
  border-color: rgba(138, 127, 255, 0.35);
  color: var(--c-accent);
}

.pj-badge.arch {
  background: rgba(100, 100, 110, 0.15);
  border-color: rgba(100, 100, 110, 0.3);
  color: #a0a0b0;
}

/* Botones de acción CTA */
.pd-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.pd-cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--c-text);
  color: var(--c-bg);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
}

.pd-cta-primary:hover {
  opacity: 0.9;
}

.pd-cta-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  color: var(--c-dim);
  border: 1px solid var(--c-line-hi);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
  transition: all 0.2s;
}

.pd-cta-ghost:hover {
  border-color: var(--c-accent);
  color: var(--c-text);
}

/* Tabla de Contenidos (Jump Bar) Mejorada */
.pd-toc {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: rgba(12, 13, 18, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--c-line-hi);
  border-radius: var(--radius);
  margin-bottom: 40px;
  font-family: var(--mono);
  font-size: 12px;
  position: sticky;
  top: 16px;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

html[data-theme="light"] .pd-toc {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--c-line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.pd-toc a {
  color: var(--c-dim);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.pd-toc a:hover {
  color: var(--c-text);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--c-line-hi);
}

.pd-toc a.is-active {
  color: #fff;
  background: rgba(138, 127, 255, 0.15);
  border-color: var(--c-accent);
  box-shadow: 0 0 12px rgba(138, 127, 255, 0.25);
  font-weight: 600;
}

/* Botón de Copiado en Bloques de Código */
pre {
  position: relative;
  transition: border-color 0.2s ease;
}
pre:hover {
  border-color: var(--c-line-hi);
}
.code-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(18, 19, 26, 0.85);
  border: 1px solid var(--c-line-hi);
  color: var(--c-dim);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  opacity: 0;
  transition: all 0.2s ease;
  user-select: none;
  z-index: 5;
}
pre:hover .code-copy-btn,
.code-copy-btn:focus,
.code-copy-btn.copied {
  opacity: 1;
}
.code-copy-btn:hover {
  color: var(--c-text);
  background: rgba(30, 32, 44, 0.95);
  border-color: var(--c-accent);
  transform: translateY(-1px);
}
.code-copy-btn.copied {
  border-color: var(--c-emerald);
}

/* Nodos de arquitectura con interactividad */
.arch-node {
  transition: all 0.25s ease;
  cursor: default;
}
.arch-node.is-hovered {
  border-color: var(--c-accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), 0 0 12px var(--c-accent-glow);
}
.arch-arrow {
  transition: transform 0.2s ease, color 0.2s ease;
}
.arch-diagram:hover .arch-arrow {
  color: #57f287;
}

/* Logo levitante */
@keyframes logoLevitate {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.pd-hero-logo img {
  animation: logoLevitate 4.5s ease-in-out infinite;
  transition: transform 0.3s ease;
}
.pd-hero-logo:hover img {
  transform: scale(1.05) rotate(2deg);
}

/* Secciones de contenido */
.pd-section {
  margin-bottom: 48px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--c-line);
}

.pd-section:last-of-type {
  border-bottom: none;
}

.pd-section h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  color: var(--c-text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.pd-section h2::before {
  content: "//";
  color: var(--c-accent);
  font-family: var(--mono);
  font-size: 15px;
}

.pd-section p {
  color: var(--c-dim);
  font-size: 14.5px;
  line-height: 1.7;
  margin-bottom: 16px;
}

.pd-section ul {
  list-style: none;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pd-section li {
  color: var(--c-dim);
  font-size: 14px;
  line-height: 1.6;
  position: relative;
  padding-left: 20px;
}

.pd-section li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--c-accent);
  font-family: var(--mono);
}

/* Mod-Cards / Bloques de arquitectura */
.mods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.mod-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.mod-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 8px;
  font-family: var(--mono);
}

.mod-card p {
  font-size: 13px;
  color: var(--c-dim);
  line-height: 1.5;
  margin: 0;
}

/* Bloques de código y ficheros */
.file-chip {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-sm);
  color: var(--c-accent);
}

code {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--c-line);
  color: #57f287;
}

/* Nodo de arquitectura */
.arch-diagram {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  margin: 20px 0;
}

.arch-node {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--c-line-hi);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text);
  display: flex;
  flex-direction: column;
}

.arch-node small {
  color: var(--c-faint);
  font-size: 10px;
  font-weight: 400;
  margin-top: 2px;
}

.arch-arrow {
  color: var(--c-accent);
  font-family: var(--mono);
  font-size: 14px;
}

/* Footer de pie de proyecto */
.project-footer {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--c-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--c-dim);
}


/* --------------------------------------------------------------------------
 * Cyber-Lofi Generative Ambient Widget & Equalizer (Project Pages)
 * -------------------------------------------------------------------------- */
.cyber-lofi-capsule {
  position: fixed;
  bottom: 26px;
  right: 26px;
  z-index: 99;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(14, 15, 20, 0.9);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--c-line-hi);
  border-radius: 999px;
  padding: 5px 8px 5px 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-family: var(--mono);
  font-size: 11px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}
.cyber-lofi-capsule:hover {
  border-color: var(--c-accent);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), 0 0 16px var(--c-accent-glow);
}
.cyber-lofi-capsule.is-playing {
  border-color: rgba(138, 127, 255, 0.45);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), 0 0 20px var(--c-accent-glow);
}
.lofi-capsule-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--c-dim);
  cursor: pointer;
  padding: 4px 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  transition: color 0.2s ease;
}
.lofi-capsule-btn:hover,
.lofi-capsule-btn.is-playing {
  color: var(--c-text);
}
.lofi-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--c-dim);
  transition: color 0.2s ease;
}
.lofi-capsule-btn:hover .lofi-label,
.lofi-capsule-btn.is-playing .lofi-label {
  color: var(--c-text);
}
.lofi-chord-badge {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--c-accent);
  transition: all 0.2s ease;
}
.lofi-capsule-btn.is-playing .lofi-chord-badge {
  border-color: var(--c-accent);
  box-shadow: 0 0 8px var(--c-accent-glow);
  background: rgba(138, 127, 255, 0.12);
}
.lofi-mixer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--c-faint);
  cursor: pointer;
  transition: all 0.2s ease;
}
.lofi-mixer-btn:hover {
  color: var(--c-text);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--c-line);
}

/* Equalizer Bars Animadas */
.lofi-equalizer {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  width: 12px;
}
.eq-bar {
  width: 2.5px;
  background: var(--c-dim);
  border-radius: 1px;
  transition: height 0.2s ease, background 0.2s ease;
}
.eq-bar.bar-1 { height: 4px; }
.eq-bar.bar-2 { height: 8px; }
.eq-bar.bar-3 { height: 5px; }

@keyframes eqDance1 {
  0%, 100% { height: 3px; }
  50% { height: 12px; }
}
@keyframes eqDance2 {
  0%, 100% { height: 11px; }
  50% { height: 4px; }
}
@keyframes eqDance3 {
  0%, 100% { height: 6px; }
  50% { height: 10px; }
}

.lofi-equalizer.is-active .eq-bar {
  background: var(--c-accent);
}
.lofi-equalizer.is-active .bar-1 { animation: eqDance1 0.8s ease-in-out infinite; }
.lofi-equalizer.is-active .bar-2 { animation: eqDance2 0.7s ease-in-out infinite 0.15s; }
.lofi-equalizer.is-active .bar-3 { animation: eqDance3 0.9s ease-in-out infinite 0.3s; }

/* Popover del Mixer */
.lofi-popover {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 280px;
  max-width: calc(100vw - 32px);
  background: rgba(12, 13, 18, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--c-line-hi);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 20px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
}
.lofi-popover.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.lofi-pop-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--c-line);
  padding-bottom: 10px;
}
.lofi-pop-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: 0.08em;
  font-family: var(--mono);
}
.lofi-pop-sub {
  font-size: 10px;
  color: var(--c-accent);
  margin-top: 2px;
  font-family: var(--mono);
}
.lofi-status-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.06em;
  font-family: var(--mono);
}
.lofi-status-badge.live {
  background: rgba(35, 165, 90, 0.2);
  color: #57f287;
  border: 1px solid rgba(35, 165, 90, 0.4);
}
.lofi-status-badge.paused {
  background: rgba(255, 255, 255, 0.06);
  color: var(--c-dim);
  border: 1px solid var(--c-line);
}
.lofi-slider-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lofi-slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lofi-slider-name {
  font-size: 10px;
  color: var(--c-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
}
.lofi-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--c-line);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.lofi-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c-accent);
  cursor: pointer;
  box-shadow: 0 0 6px var(--c-accent);
  transition: transform 0.15s ease;
  border: none;
}
.lofi-range::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}
.lofi-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c-accent);
  cursor: pointer;
  box-shadow: 0 0 6px var(--c-accent);
  transition: transform 0.15s ease;
  border: none;
}
.lofi-range::-moz-range-thumb:hover {
  transform: scale(1.25);
}
.lofi-range::-moz-range-track {
  height: 4px;
  background: var(--c-line);
  border-radius: 2px;
  border: none;
}
.lofi-pop-footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--c-line);
  text-align: center;
}
.lofi-zero-tag {
  font-size: 9px;
  color: var(--c-faint);
  letter-spacing: 0.05em;
  font-family: var(--mono);
}

@media (max-width: 680px) {
  .cyber-lofi-capsule {
    bottom: 20px;
    right: 16px;
  }
  .lofi-popover {
    right: -6px;
  }
}
