/* ============================================
   GATE — The Watcher
   Surveillance / Dystopia Terminal
   Cold. Clinical. You are observed.
   ============================================ */

/* --- Base Layout --- */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--black);
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--green-terminal);
}

/* --- Status Bar --- */
.status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 16px;
  background: var(--near-black);
  border-bottom: 1px solid var(--green-dark);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--green-terminal);
  opacity: 0;
  animation: fade-in 1s ease-out 0.3s forwards;
}

.status-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-terminal);
  margin-right: 8px;
  animation: pulse-indicator 2s ease-in-out infinite;
  box-shadow: 0 0 4px var(--green-terminal);
}

@keyframes pulse-indicator {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--green-terminal); }
  50% { opacity: 0.4; box-shadow: 0 0 1px var(--green-terminal); }
}

.status-divider {
  color: var(--green-muted);
  margin: 0 8px;
}

.text-green {
  color: var(--green-terminal);
  text-shadow: 0 0 6px rgba(51, 170, 51, 0.4);
}

.status-bar__right {
  color: var(--text-dim);
  font-size: 0.6rem;
}

#tracking-readout {
  color: var(--green-muted);
  font-variant-numeric: tabular-nums;
}

/* --- Terminal Layout --- */
.terminal-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  padding-top: 32px;
  flex: 1;
  background: var(--green-dark);
}

/* --- Panels --- */
.panel-header {
  padding: 10px 16px;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--green-terminal);
  border-bottom: 1px solid var(--green-dark);
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-shadow: 0 0 8px rgba(51, 170, 51, 0.3);
}

.bracket {
  color: var(--green-muted);
}

.subject-panel,
.log-panel {
  background: var(--black);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* --- Subject Panel --- */
.subject-content {
  padding: 24px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.subject-title {
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  color: var(--green-terminal);
  text-shadow: 0 0 12px rgba(51, 170, 51, 0.5), 0 0 30px rgba(51, 170, 51, 0.2);
  margin-bottom: 16px;
  min-height: 2em;
  line-height: 1.4;
}

.subject-title .cursor {
  display: inline-block;
  width: 0.7em;
  height: 1.1em;
  background: var(--green-terminal);
  vertical-align: text-bottom;
  animation: cursor-blink 1s step-end infinite;
  box-shadow: 0 0 6px rgba(51, 170, 51, 0.6);
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.scan-status {
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  margin-bottom: 24px;
}

.scan-status.complete {
  color: var(--green-terminal);
}

.blink {
  animation: cursor-blink 1.4s step-end infinite;
}

/* --- Metadata Grid --- */
.metadata-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 32px;
}

.meta-row {
  display: flex;
  padding: 6px 0;
  border-bottom: 1px solid rgba(51, 170, 51, 0.06);
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.meta-row.revealed {
  opacity: 1;
  transform: translateX(0);
}

.meta-label {
  width: 120px;
  flex-shrink: 0;
  color: var(--green-muted);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  padding-top: 1px;
}

.meta-value {
  color: var(--green-terminal);
  font-size: 0.7rem;
  word-break: break-all;
}

.meta-value--wide {
  font-size: 0.6rem;
  color: var(--text-dim);
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-value.scanning {
  color: var(--green-muted);
  animation: scan-flicker 0.15s steps(2) infinite;
}

@keyframes scan-flicker {
  0% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* --- Recording Indicator --- */
.recording-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 20px;
}

.recording-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red-glow);
  box-shadow: 0 0 6px var(--red-glow), 0 0 12px rgba(170, 34, 34, 0.4);
  animation: recording-pulse 1.5s ease-in-out infinite;
}

@keyframes recording-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--red-glow), 0 0 12px rgba(170, 34, 34, 0.4); }
  50% { opacity: 0.3; box-shadow: 0 0 2px var(--red-glow); }
}

.recording-text {
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  color: var(--red-glow);
  text-shadow: 0 0 8px rgba(170, 34, 34, 0.5);
}

/* --- Log Panel --- */
.log-feed {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  max-height: calc(100vh - 80px);
}

.log-entry {
  padding: 5px 16px;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(51, 170, 51, 0.03);
  opacity: 0;
  animation: log-appear 0.4s ease-out forwards;
  line-height: 1.6;
}

@keyframes log-appear {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.log-entry .log-timestamp {
  color: var(--green-muted);
  margin-right: 6px;
}

.log-entry.log-entry--alert {
  color: var(--green-terminal);
  text-shadow: 0 0 4px rgba(51, 170, 51, 0.3);
}

.log-entry.log-entry--warning {
  color: var(--red-muted);
}

.log-entry.log-entry--archive {
  color: var(--text-dim);
  transition: color 0.5s, text-shadow 0.5s;
  cursor: default;
}

.log-entry.log-entry--archive:hover {
  color: var(--green-terminal);
  text-shadow: 0 0 6px rgba(51, 170, 51, 0.3);
  cursor: pointer;
}

.log-entry.log-entry--archive .log-sigil-hint {
  color: inherit;
  text-decoration: none;
  display: block;
}

.log-entry.log-entry--terminal {
  color: var(--text-dim);
  transition: color 0.5s, text-shadow 0.5s;
  cursor: default;
}

.log-entry.log-entry--terminal:hover {
  color: var(--green-terminal);
  text-shadow: 0 0 6px rgba(51, 170, 51, 0.3);
  cursor: pointer;
}

.log-entry.log-entry--terminal .log-terminal-hint {
  color: inherit;
  text-decoration: none;
  display: block;
}

.log-count {
  font-size: 0.55rem;
  color: var(--green-muted);
  letter-spacing: 0.1em;
}

/* --- Mouse Follower --- */
.mouse-follower {
  position: fixed;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(51, 170, 51, 0.15);
  border-radius: 50%;
  pointer-events: none;
  z-index: 50;
  transition: transform 0.15s ease-out, opacity 0.3s;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px rgba(51, 170, 51, 0.05);
  opacity: 0;
}

.mouse-follower.active {
  opacity: 1;
}

.mouse-follower::after {
  content: '+';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.5rem;
  color: rgba(51, 170, 51, 0.2);
}

/* --- Depth Marker --- */
.depth-marker {
  position: fixed;
  bottom: 10px;
  left: 14px;
  font-size: 0.5rem;
  letter-spacing: 0.15em;
  color: var(--near-black);
  transition: color 2s;
  z-index: 10;
}

.depth-marker:hover {
  color: var(--text-faint);
}

/* --- Vignette --- */
.vignette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-shadow: inset 0 0 200px 80px rgba(0, 0, 0, 0.95);
  pointer-events: none;
  z-index: 10;
}

/* --- CRT Curvature Hint --- */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0, 0, 0, 0.4) 100%
  );
  pointer-events: none;
  z-index: 11;
}

/* --- Occasional full-screen glitch line --- */
.screen-glitch {
  position: fixed;
  left: 0;
  width: 100%;
  height: 2px;
  background: rgba(51, 170, 51, 0.15);
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  animation: glitch-line 0.1s linear forwards;
}

@keyframes glitch-line {
  0% { opacity: 0.8; }
  100% { opacity: 0; transform: translateX(4px); }
}

/* --- Scrollbar (green tint) --- */
.log-feed::-webkit-scrollbar {
  width: 3px;
}

.log-feed::-webkit-scrollbar-track {
  background: var(--black);
}

.log-feed::-webkit-scrollbar-thumb {
  background: var(--green-dark);
}

/* --- Mobile --- */
@media (max-width: 768px) {
  .terminal-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .status-bar {
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px;
    font-size: 0.55rem;
  }

  .status-bar__right {
    font-size: 0.5rem;
  }

  .terminal-layout {
    padding-top: 52px;
  }

  .subject-title {
    font-size: 1rem;
  }

  .meta-label {
    width: 90px;
    font-size: 0.55rem;
  }

  .meta-value {
    font-size: 0.6rem;
  }

  .log-feed {
    max-height: 40vh;
  }
}
