/* =========================================================
   Cypher404 — terminal.css
   Estilos específicos de la terminal interactiva (/terminal/).
   Depende de tokens.css (variables + capas CRT).
   ========================================================= */


/* =========================================================
   Topbar
   ========================================================= */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  z-index: 50;
  background: linear-gradient(180deg, rgba(5,8,10,0.85) 0%, rgba(5,8,10,0) 100%);
  backdrop-filter: blur(2px);
}
.topbar__brand {
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--fg-soft);
}
.topbar__name { color: var(--fg); }
.topbar__sep, .topbar__bracket { color: var(--fg-dim); }
.topbar__path { color: var(--cyan); }

.topbar__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  border: 1px solid rgba(255,180,84,0.4);
  padding: 7px 12px;
  border-radius: 4px;
  background: rgba(255,180,84,0.05);
  transition: background .18s ease, transform .18s ease, border-color .18s ease;
}
.topbar__cta:hover, .topbar__cta:focus-visible {
  background: rgba(255,180,84,0.12);
  border-color: var(--amber);
  text-shadow: 0 0 6px rgba(255,180,84,0.6);
}
.topbar__cta-dot {
  width: 7px; height: 7px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--amber);
  animation: pulseDot 1.6s infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.85); }
}

/* =========================================================
   Terminal
   ========================================================= */
.terminal {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 70px 20px 140px;
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.terminal__chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(124,255,178,0.18);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(180deg, rgba(124,255,178,0.05), rgba(124,255,178,0.01));
}
.terminal__dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  display: inline-block;
}
.terminal__dot--red    { background: #ff5a6b; box-shadow: 0 0 6px rgba(255,90,107,0.6); }
.terminal__dot--yellow { background: #ffd166; box-shadow: 0 0 6px rgba(255,209,102,0.5); }
.terminal__dot--green  { background: #7CFFB2; box-shadow: 0 0 6px rgba(124,255,178,0.6); }
.terminal__chrome-title {
  margin-left: 10px;
  font-size: 12px;
  color: var(--fg-dim);
  letter-spacing: 0.05em;
}

.terminal__output {
  flex: 1;
  padding: 18px 18px 12px;
  border: 1px solid rgba(124,255,178,0.18);
  border-bottom: none;
  background: linear-gradient(180deg,
    rgba(10,15,13,0.85) 0%,
    rgba(8,12,10,0.85) 100%);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  max-height: 62vh;
  min-height: 360px;
  scrollbar-width: thin;
  scrollbar-color: rgba(124,255,178,0.25) transparent;
}
.terminal__output::-webkit-scrollbar { width: 8px; }
.terminal__output::-webkit-scrollbar-thumb { background: rgba(124,255,178,0.25); border-radius: 4px; }

/* Líneas individuales */
.line {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}
.line--typed { animation: lineIn 220ms ease both; }
@keyframes lineIn {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Variantes de color */
.c-fg      { color: var(--fg); }
.c-dim     { color: var(--fg-dim); }
.c-soft    { color: var(--fg-soft); }
.c-cyan    { color: var(--cyan); }
.c-amber   { color: var(--amber); }
.c-red     { color: var(--red); }
.c-magenta { color: var(--magenta); }
.c-white   { color: var(--white); }

.tag {
  color: var(--cyan);
  font-weight: 500;
}
.tag-warn  { color: var(--amber); }
.tag-err   { color: var(--red); }
.tag-ok    { color: var(--fg); }
.tag-spam  { color: var(--magenta); }
.tag-akbal { color: var(--amber); letter-spacing: 0.08em; }

/* Prompt impreso (eco del comando) */
.echo {
  color: var(--fg-dim);
}
.echo b {
  color: var(--fg);
  font-weight: 500;
}

/* Boxes ASCII */
.ascii {
  color: var(--fg-soft);
}

.banner-ascii {
  font-size: 14px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  word-break: break-word;
  overflow-x: auto;
  white-space: pre;
  display: block;
  text-shadow: 0 0 10px rgba(34,211,238,0.4);
}

/* Responsivo: reducir tamaño en tablets y móviles */
@media (max-width: 900px) {
  .banner-ascii {
    font-size: 13px;
  }
}

@media (max-width: 600px) {
  .banner-ascii {
    font-size: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
  }
  
  /* Hacer scrolleable si es muy grande */
  .terminal__output {
    overflow-x: auto;
  }
}

@media (max-width: 400px) {
  .banner-ascii {
    font-size: 11px;
  }
}

/* Input line */
.terminal__inputline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: 1px solid rgba(124,255,178,0.18);
  border-radius: 0 0 var(--radius) var(--radius);
  background: linear-gradient(180deg, rgba(10,15,13,0.85), rgba(6,10,8,0.85));
}
.terminal__prompt {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  flex: 0 0 auto;
  user-select: none;
}
.prompt__user  { color: var(--fg); }
.prompt__at    { color: var(--fg-dim); }
.prompt__host  { color: var(--cyan); }
.prompt__sep   { color: var(--fg-dim); }
.prompt__path  { color: var(--fg-soft); }
.prompt__sigil { color: var(--amber); margin: 0 8px 0 4px; }

.terminal__inputwrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}
.terminal__input {
  flex: 1;
  width: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 15px;
  caret-color: transparent; /* usamos caret custom */
  padding: 0;
  text-shadow: 0 0 2px rgba(124,255,178,0.45);
}
.terminal__caret {
  position: absolute;
  pointer-events: none;
  color: var(--fg);
  font-size: 15px;
  line-height: 1;
  transform: translateY(-1px);
  text-shadow: 0 0 6px rgba(124,255,178,0.7);
}
.terminal__caret.is-blink { animation: caretBlink 1.05s steps(1) infinite; }
@keyframes caretBlink {
  0%, 50%   { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

/* =========================================================
   Quickbar (botones rápidos)
   ========================================================= */
.quickbar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 8px;
  z-index: 40;
  background: rgba(8,12,10,0.85);
  border: 1px solid rgba(124,255,178,0.2);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 30px rgba(0,0,0,0.55);
  max-width: calc(100vw - 24px);
  overflow-x: auto;
  scrollbar-width: none;
}
.quickbar::-webkit-scrollbar { display: none; }
.quickbar__btn {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--fg-soft);
  border: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.quickbar__btn:hover, .quickbar__btn:focus-visible {
  color: var(--fg);
  border-color: rgba(124,255,178,0.35);
  background: rgba(124,255,178,0.06);
  outline: none;
}
.quickbar__btn--primary {
  color: var(--amber);
  border-color: rgba(255,180,84,0.4);
  background: rgba(255,180,84,0.08);
}
.quickbar__btn--primary:hover {
  background: rgba(255,180,84,0.16);
  color: var(--white);
}

/* =========================================================
   Modal SPAM
   ========================================================= */
.spam {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: grid;
  place-items: center;
  padding: 20px;
}
.spam[hidden] { display: none; }
.spam__backdrop {
  position: absolute; inset: 0;
  background: rgba(2,4,5,0.65);
  backdrop-filter: blur(2px);
}
.spam__window {
  position: relative;
  width: min(480px, 100%);
  background: var(--panel);
  border: 1px solid rgba(255,180,84,0.45);
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(255,180,84,0.15),
    0 20px 80px rgba(0,0,0,0.7),
    0 0 30px rgba(255,180,84,0.15);
  animation: spamIn 220ms cubic-bezier(.2,.9,.2,1) both;
  overflow: hidden;
}
@keyframes spamIn {
  0%   { opacity: 0; transform: translateY(8px) scale(0.96); }
  60%  { opacity: 1; transform: translateY(-2px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0)    scale(1); }
}
.spam__titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(90deg, rgba(255,180,84,0.18), rgba(255,180,84,0.05));
  border-bottom: 1px solid rgba(255,180,84,0.35);
  color: var(--amber);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.spam__icon { color: var(--amber); }
.spam__title { flex: 1; }
.spam__x {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  color: var(--amber);
  border: 1px solid rgba(255,180,84,0.4);
  border-radius: 3px;
  font-size: 14px;
  line-height: 1;
}
.spam__x:hover { background: rgba(255,180,84,0.15); }

.spam__meta {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--fg-dim);
  border-bottom: 1px dashed rgba(124,255,178,0.18);
  display: grid;
  gap: 3px;
}
.spam__label { color: var(--fg-soft); }
.spam__warn  { color: var(--red); margin-top: 4px; }

.spam__body {
  padding: 18px 14px;
}
.spam__lead { margin: 0 0 6px; color: var(--fg-soft); font-size: 13px; }
.spam__product {
  margin: 0 0 4px;
  font-size: 17px;
  color: var(--fg);
  letter-spacing: 0.02em;
  text-shadow: var(--glow);
}
.spam__sub { margin: 0; color: var(--fg-dim); font-size: 13px; }

.spam__actions {
  display: flex;
  gap: 10px;
  padding: 12px 14px 16px;
  border-top: 1px dashed rgba(124,255,178,0.18);
}
.spam__btn {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid rgba(124,255,178,0.3);
  color: var(--fg);
  letter-spacing: 0.06em;
  font-size: 13px;
  background: rgba(124,255,178,0.04);
  border-radius: 4px;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.spam__btn:hover { background: rgba(124,255,178,0.12); }
.spam__btn--primary {
  color: var(--amber);
  border-color: rgba(255,180,84,0.55);
  background: rgba(255,180,84,0.1);
}
.spam__btn--primary:hover { background: rgba(255,180,84,0.22); color: var(--white); }

/* =========================================================
   Glitch
   ========================================================= */
.is-glitch .terminal__output {
  animation: glitchShake 0.9s steps(8) 1;
}
.is-glitch {
  filter: hue-rotate(20deg) saturate(1.2);
}
@keyframes glitchShake {
  0%   { transform: translate(0,0); }
  20%  { transform: translate(-2px, 1px); filter: hue-rotate(-15deg); }
  40%  { transform: translate(2px, -1px); filter: hue-rotate(40deg); }
  60%  { transform: translate(-1px, 2px); }
  80%  { transform: translate(1px, -2px); filter: hue-rotate(-30deg); }
  100% { transform: translate(0,0); }
}
.glitch-text {
  position: relative;
  display: inline-block;
  animation: textGlitch 0.7s steps(2) 1;
}
@keyframes textGlitch {
  0%   { text-shadow: 0 0 1px rgba(124,255,178,0.5); }
  20%  { text-shadow: 2px 0 0 #ff5a6b, -2px 0 0 #22d3ee; }
  40%  { text-shadow: -2px 0 0 #ff5a6b, 2px 0 0 #22d3ee; }
  60%  { text-shadow: 1px 0 0 #ff5a6b, -1px 0 0 #22d3ee; }
  100% { text-shadow: 0 0 1px rgba(124,255,178,0.5); }
}

/* Linea sutil tipo notificación reaparece */
.line--notice {
  color: var(--fg-dim);
  animation: noticeIn 600ms ease both;
}
@keyframes noticeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 720px) {
  body { font-size: 14px; }
  .topbar { padding: 10px 14px; }
  .topbar__brand { font-size: 11px; }
  .topbar__cta { font-size: 11px; padding: 6px 10px; }
  .terminal { padding: 60px 12px 110px; }
  .terminal__output {
    min-height: 320px;
    max-height: 58vh;
    padding: 14px;
    font-size: 13px;
  }
  .terminal__inputline { padding: 10px 12px; }
  .terminal__input { font-size: 14px; }
  .terminal__prompt { font-size: 13px; }
  .terminal__chrome-title { display: none; }
  .quickbar { bottom: 10px; padding: 6px; gap: 6px; }
  .quickbar__btn { padding: 7px 11px; font-size: 11px; }
}

@media (max-width: 380px) {
  .prompt__user, .prompt__at, .prompt__host, .prompt__sep, .prompt__path {
    display: none;
  }
  .prompt__sigil { margin-left: 0; }
}

/* Respeto a reduce-motion */
@media (prefers-reduced-motion: reduce) {
  .crt-overlay { animation: none; }
  .terminal__caret.is-blink { animation: none; opacity: 1; }
  .line--typed { animation: none; }
  .spam__window { animation: none; }
  .is-glitch .terminal__output,
  .glitch-text { animation: none; }
  .hacker-window { animation: none; }
}

/* Foco visible global */
:focus-visible {
  outline: 1px dashed rgba(124,255,178,0.6);
  outline-offset: 3px;
}

/* =========================================================
   Ventanas Browser (draggables tipo hacker)
   ========================================================= */
.hacker-window {
  position: fixed;
  width: 640px;
  height: 600px;
  background: var(--panel);
  border: 1px solid rgba(124,255,178,0.35);
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(124,255,178,0.12),
    0 20px 60px rgba(0,0,0,0.8),
    0 0 40px rgba(34,211,238,0.1);
  display: flex;
  flex-direction: column;
  animation: windowOpen 280ms cubic-bezier(.2,.9,.2,1) both;
  cursor: default;
  user-select: none;
}
@keyframes windowOpen {
  0%   { opacity: 0; transform: scale(0.92) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes windowClose {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.92) translateY(20px); }
}

.hacker-window__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(34,211,238,0.15), rgba(34,211,238,0.05));
  border-bottom: 1px solid rgba(34,211,238,0.25);
  cursor: grab;
  user-select: none;
  flex: 0 0 auto;
  border-radius: 5px 5px 0 0;
}
.hacker-window__titlebar:active {
  cursor: grabbing;
}

.hacker-window__title {
  flex: 1;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--cyan);
  text-transform: capitalize;
  text-shadow: 0 0 6px rgba(34,211,238,0.5);
}

.hacker-window__close {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: rgba(255,90,107,0.08);
  border: 1px solid rgba(255,90,107,0.3);
  border-radius: 4px;
  color: var(--red);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.hacker-window__close:hover, .hacker-window__close:focus-visible {
  background: rgba(255,90,107,0.2);
  border-color: var(--red);
}

.hacker-window__btn-new {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: rgba(34,211,238,0.08);
  border: 1px solid rgba(34,211,238,0.3);
  border-radius: 4px;
  color: var(--cyan);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
  margin-right: 6px;
}
.hacker-window__btn-new:hover, .hacker-window__btn-new:focus-visible {
  background: rgba(34,211,238,0.2);
  border-color: var(--cyan);
}

.hacker-window__content {
  flex: 1;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(10,15,13,0.9), rgba(8,12,10,0.9));
  border-radius: 0 0 5px 5px;
  position: relative;
}

.hacker-window__iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--bg);
  display: block;
}

.hacker-window__youtube-wrapper {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
}
.hacker-window__youtube-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Responsive: reducir tamaño en pantallas pequeñas */
@media (max-width: 800px) {
  .hacker-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    max-width: 100vw;
    max-height: 100vh;
    left: 10px !important;
    top: 10px !important;
  }
}

/* =========================================================
   Nav extra en topbar (enlace a home)
   ========================================================= */
.topbar__nav {
  margin-left: 16px;
  margin-right: auto;
}
.topbar__home {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--fg-soft);
  border: 1px solid transparent;
  padding: 5px 9px;
  border-radius: 4px;
}
.topbar__home:hover, .topbar__home:focus-visible {
  color: var(--fg);
  border-color: rgba(124,255,178,0.3);
  background: rgba(124,255,178,0.05);
}
@media (max-width: 720px) {
  .topbar__nav { margin-left: 10px; }
  .topbar__home { font-size: 11px; padding: 4px 7px; }
}

/* Enlaces impresos dentro de la terminal (ost, signal, etc.) */
.line a { color: var(--cyan); }
.line a:hover { text-shadow: var(--glow-cyan); }
