/* ==========================================================================
   Nodeblue — Secure Shell Identity
   Dark-first, mobile-first, framework-free
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Nodeblue Design System)
   -------------------------------------------------------------------------- */
:root {
  /* Foundation colours */
  --nb-bg-root: #0E1424;
  --nb-bg-layer-1: #131B30;
  --nb-bg-layer-2: #18213A;
  --nb-border-subtle: #243056;

  /* Content colours */
  --nb-text-primary: #E6EBF5;
  --nb-text-secondary: #A9B2CC;
  --nb-text-muted: #7E88A8;
  --nb-text-disabled: #55607E;

  /* Accent colours */
  --nb-accent-primary: #2563EB;
  --nb-accent-hover: #3B82F6;
  --nb-accent-soft: #1E3A8A;
  --nb-accent-glow: rgba(37, 99, 235, 0.35);

  /* Violet hints */
  --nb-violet-hint: #7C3AED;
  --nb-violet-soft: rgba(124, 58, 237, 0.15);

  /* Terminal-specific */
  --term-prompt-user: #93C5FD;
  --term-prompt-host: #A78BFA;
  --term-prompt-path: #67E8F9;
  --term-command: #E6EBF5;
  --term-output: #A9B2CC;
  --term-success: #34D399;
  --term-link: #60A5FA;
  --term-link-hover: #93C5FD;

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Typography */
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Segoe UI Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Transitions */
  --transition-fast: 150ms ease-out;
  --transition-normal: 200ms ease-out;
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--nb-text-primary);
  background-color: var(--nb-bg-root);
  min-height: 100vh;
  min-height: 100dvh;
}

/* Subtle background pattern */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(37, 99, 235, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(124, 58, 237, 0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-md);
  position: relative;
  z-index: 1;
}

.terminal-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Terminal Window
   -------------------------------------------------------------------------- */
.terminal {
  background: rgba(19, 27, 48, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(36, 48, 86, 0.6);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  position: relative;
  z-index: 1;
}

/* Terminal header bar */
.terminal-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(24, 33, 58, 0.5);
  border-bottom: 1px solid rgba(36, 48, 86, 0.4);
}

.terminal-buttons {
  display: flex;
  gap: 6px;
}

.terminal-button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--nb-text-disabled);
}

.terminal-button--close { background: #EF5350; }
.terminal-button--minimize { background: #FFB74D; }
.terminal-button--maximize { background: #66BB6A; }

.terminal-title {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  color: var(--nb-text-muted);
  letter-spacing: 0.02em;
}

/* Terminal body */
.terminal-body {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* --------------------------------------------------------------------------
   Command Blocks
   -------------------------------------------------------------------------- */
.command-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* Prompt line */
.prompt-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  font-weight: 500;
}

.prompt-user {
  color: var(--term-prompt-user);
}

.prompt-at {
  color: var(--nb-text-muted);
}

.prompt-host {
  color: var(--term-prompt-host);
}

.prompt-separator {
  color: var(--nb-text-muted);
}

.prompt-path {
  color: var(--term-prompt-path);
}

.prompt-symbol {
  color: var(--nb-text-secondary);
  margin-right: var(--space-sm);
}

.command-text {
  color: var(--term-command);
}

/* Output area */
.output {
  padding-left: var(--space-md);
  color: var(--term-output);
}

.output-line {
  display: block;
}

.output-line--success {
  color: var(--term-success);
}

.output-line--highlight {
  color: var(--nb-text-primary);
}

.output--secondary {
  opacity: 0.75;
  font-size: 0.9em;
}

/* --------------------------------------------------------------------------
   Page Load Animation
   -------------------------------------------------------------------------- */
.terminal-body {
  /* Hide content initially for animation */
}

.animate-in {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 300ms ease-out, transform 300ms ease-out;
}

.animate-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Typing cursor for connection sequence */
.typing-cursor {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  background: var(--term-command);
  margin-left: 2px;
  animation: cursorBlink 800ms step-end infinite;
  vertical-align: text-bottom;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.typing-cursor.hidden {
  display: none;
}

/* Reduced motion: show everything immediately */
@media (prefers-reduced-motion: reduce) {
  .animate-in {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .typing-cursor {
    display: none;
  }
}

/* Bullet list output */
.output-list {
  list-style: none;
  padding-left: var(--space-sm);
}

.output-list li {
  position: relative;
  padding-left: var(--space-md);
}

.output-list li::before {
  content: ">";
  position: absolute;
  left: 0;
  color: var(--nb-accent-primary);
}

/* --------------------------------------------------------------------------
   Interactive Commands (Links)
   -------------------------------------------------------------------------- */
.command-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--term-link);
  text-decoration: underline;
  text-decoration-color: var(--nb-text-disabled);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  padding: var(--space-xs) var(--space-sm);
  margin: calc(-1 * var(--space-xs)) calc(-1 * var(--space-sm));
  border-radius: var(--radius-sm);
  transition:
    color var(--transition-fast),
    text-decoration-color var(--transition-fast),
    background-color var(--transition-fast);
  cursor: pointer;
}

.command-link:hover,
.command-link:focus-visible {
  color: var(--term-link-hover);
  text-decoration-color: var(--term-link-hover);
  background: rgba(96, 165, 250, 0.1);
}

.command-link:focus-visible {
  outline: 2px solid var(--nb-accent-primary);
  outline-offset: 2px;
}

.command-link--secondary {
  color: var(--nb-text-muted);
  font-size: 0.875em;
}

.command-link--secondary:hover,
.command-link--secondary:focus-visible {
  color: var(--term-link);
}

/* Command row (for connect buttons) */
.command-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

.connect-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: 1px solid var(--nb-border-subtle);
  border-radius: var(--radius-sm);
  color: var(--term-link);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  cursor: pointer;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.connect-button:hover,
.connect-button:focus-visible {
  color: var(--term-link-hover);
  background: rgba(96, 165, 250, 0.08);
  border-color: var(--nb-accent-primary);
}

.connect-button:focus-visible {
  outline: 2px solid var(--nb-accent-primary);
  outline-offset: 2px;
}

.connect-button:active {
  transform: scale(0.98);
}

.connect-button[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.7;
}

/* --------------------------------------------------------------------------
   Secure Channel Animation
   -------------------------------------------------------------------------- */
.secure-channel {
  display: none;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-md);
  margin-top: var(--space-sm);
  background: var(--nb-bg-layer-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--nb-border-subtle);
}

.secure-channel.active {
  display: flex;
}

.channel-status {
  font-size: 0.8125rem;
  color: var(--nb-text-muted);
}

.channel-status--success {
  color: var(--term-success);
}

/* Handshake animation line */
.handshake-line {
  position: relative;
  height: 3px;
  background: var(--nb-bg-root);
  border-radius: 2px;
  overflow: hidden;
}

.handshake-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--nb-accent-primary), var(--nb-violet-hint));
  border-radius: 2px;
  transition: width 600ms ease-out;
}

.handshake-progress.complete {
  width: 100%;
}

/* Packet animation */
.handshake-packets {
  position: absolute;
  top: -2px;
  left: 0;
  right: 0;
  height: 7px;
  overflow: hidden;
}

.packet {
  position: absolute;
  width: 8px;
  height: 3px;
  background: var(--nb-accent-hover);
  border-radius: 1px;
  opacity: 0;
  animation: packetMove 500ms ease-in-out forwards;
}

.packet:nth-child(1) { animation-delay: 50ms; }
.packet:nth-child(2) { animation-delay: 250ms; }
.packet:nth-child(3) { animation-delay: 450ms; }

@keyframes packetMove {
  0% {
    left: 0;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    left: calc(100% - 8px);
    opacity: 0;
  }
}

/* Lock icon */
.channel-lock {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.75rem;
  color: var(--term-success);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.channel-lock.visible {
  opacity: 1;
}

.channel-lock svg {
  width: 12px;
  height: 12px;
}

/* --------------------------------------------------------------------------
   Footer Hint
   -------------------------------------------------------------------------- */
.terminal-hint {
  text-align: center;
  padding: var(--space-md);
  font-size: 0.75rem;
  color: var(--nb-text-disabled);
  border-top: 1px solid var(--nb-border-subtle);
}

/* --------------------------------------------------------------------------
   Accessibility
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .handshake-progress {
    transition: none;
  }
}

/* Focus visible polyfill fallback */
.connect-button:focus:not(:focus-visible),
.command-link:focus:not(:focus-visible) {
  outline: none;
}

/* Skip link (screen readers) */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--nb-accent-primary);
  color: white;
  border-radius: var(--radius-sm);
  z-index: 1000;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-md);
}

/* Generic visually hidden helper (for SEO/semantic headings) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (min-width: 480px) {
  body {
    font-size: 1rem;
  }

  .site-wrapper {
    padding: var(--space-lg);
  }

  .terminal-body {
    padding: var(--space-xl);
    gap: var(--space-xl);
  }
}

@media (min-width: 768px) {
  .site-wrapper {
    padding: var(--space-2xl);
  }
}

/* --------------------------------------------------------------------------
   Background Logo Watermark
   -------------------------------------------------------------------------- */
.logo-background {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 0;
}

.logo-watermark {
  width: 40vmin;
  height: 40vmin;
  min-width: 200px;
  min-height: 200px;
  max-width: 500px;
  max-height: 500px;
  object-fit: contain;
  opacity: 0.42;
}

@media (min-width: 768px) {
  .logo-watermark {
    width: 45vmin;
    height: 45vmin;
  }
}

/* --------------------------------------------------------------------------
   Contact Dot Matrix Canvas
   -------------------------------------------------------------------------- */
.contact-canvas {
  display: block;
  max-width: 100%;
  /* Crisp pixel rendering — no antialiasing on dots */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  margin-top: var(--space-sm);
  opacity: 0;
  transition: opacity 300ms ease-out;
}

.contact-canvas.visible {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .contact-canvas {
    opacity: 1;
    transition: none;
  }
}
