/* ========================================
   ByteMagic — Design Tokens & Base
   ======================================== */

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

:root {
  /* Type Scale */
  --text-xs:   clamp(0.6875rem, 0.65rem + 0.2vw,  0.75rem);
  --text-sm:   clamp(0.8125rem, 0.75rem + 0.25vw, 0.875rem);
  --text-base: clamp(0.875rem,  0.85rem + 0.15vw, 0.9375rem);
  --text-lg:   clamp(1rem,      0.9rem  + 0.5vw,  1.25rem);
  --text-xl:   clamp(1.25rem,   1rem    + 1vw,    1.75rem);
  --text-2xl:  clamp(1.5rem,    1rem    + 2vw,    2.5rem);
  --text-3xl:  clamp(2rem,      0.8rem  + 3vw,    3.5rem);
  --text-hero: clamp(2.25rem,   0.5rem  + 5vw,    5rem);

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Fonts */
  --font-display: 'JetBrains Mono', 'Consolas', monospace;
  --font-body: 'General Sans', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
}

/* Dark theme (default) */
:root, [data-theme="dark"] {
  --color-bg:          #060609;
  --color-surface:     rgba(17, 17, 24, 0.6);
  --color-surface-2:   rgba(22, 22, 31, 0.8);
  --color-border:      rgba(255, 255, 255, 0.06);
  --color-text:        #f4f4f6;
  --color-text-muted:  #8f8fac;
  --color-text-faint:  #5c5c70;
  --color-primary:     #06b6d4;
  --color-primary-hover: #22d3ee;
  --color-primary-glow: rgba(6, 182, 212, 0.20);
  --color-accent:      #f59e0b;
  --color-accent-2:    #10b981;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
}

/* Light theme */
[data-theme="light"] {
  --color-bg:          #f4f4f8;
  --color-surface:     #ffffff;
  --color-surface-2:   #eeeef2;
  --color-border:      #d4d4de;
  --color-text:        #1a1a2e;
  --color-text-muted:  #6a6a7e;
  --color-text-faint:  #a0a0b0;
  --color-primary:     #0891b2;
  --color-primary-hover: #0e7490;
  --color-primary-glow: rgba(8, 145, 178, 0.12);
  --color-accent:      #d97706;
  --color-accent-2:    #059669;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-16);
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.15; }
p, li, figcaption { text-wrap: pretty; max-width: 72ch; }

::selection {
  background: var(--color-primary);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

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

button { cursor: pointer; background: none; border: none; }
a { text-decoration: none; color: inherit; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}


/* ========================================
   MODE SWITCHER
   ======================================== */

.mode-switcher {
  position: fixed;
  top: var(--space-6);
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.mode-switcher.mode-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.mode-switcher-left {
  display: flex;
  align-items: center;
  pointer-events: auto;
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

/* AI button — standalone pill on the right */
.mode-btn-ai {
  background: rgba(10, 10, 15, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  pointer-events: auto;
}

.mode-btn-ai:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.mode-btn-ai.active {
  border-color: transparent;
}

/* Terminal button — frameless prompt */
.mode-btn-terminal {
  gap: 0;
  padding: var(--space-2) 0;
}

.mode-btn-terminal:hover {
  background: none;
  color: var(--color-text);
}

.mode-btn-terminal.active {
  background: none;
  box-shadow: none;
  color: var(--color-text-muted);
}

.tm-btn-prompt {
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-weight: 600;
  transition: color 0.3s;
}

.tm-btn-cmd {
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

/* Blinking cursor after the terminal nav label */
.tm-nav-cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  background: var(--color-primary);
  border-radius: 1px;
  animation: tm-blink 1s step-end infinite;
  opacity: 0.8;
  margin-left: 3px;
  vertical-align: middle;
  flex-shrink: 0;
}

.mode-btn:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.05);
}

.mode-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  box-shadow: 0 4px 12px var(--color-primary-glow), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.mode-btn svg {
  flex-shrink: 0;
}

/* Mode views */
.mode-view {
  display: none;
  min-height: 100dvh;
}

.mode-view.active {
  display: block;
}


/* ========================================
   NORMAL MODE
   ======================================== */

/* Logic gate network background canvas */
#gate-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Header */
.nm-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--color-bg) 85%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  padding-top: calc(var(--space-10) + var(--space-2));
}

.nm-header-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: var(--space-2) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nm-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transition: filter var(--transition-interactive);
}

.nm-logo:hover {
  filter: drop-shadow(0 0 8px var(--color-primary-glow));
}

.nm-logo-icon {
  color: var(--color-primary);
}

.nm-logo-text {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nm-contact-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  transition: background var(--transition-interactive),
              border-color var(--transition-interactive),
              color var(--transition-interactive),
              box-shadow var(--transition-interactive);
}

.nm-contact-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 20px var(--color-primary-glow);
}

.nm-contact-btn svg {
  transition: transform var(--transition-interactive);
}

.nm-contact-btn:hover svg {
  transform: translateX(3px);
}

/* Hero Section */
.nm-hero {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 85vh;
  padding: var(--space-16) var(--space-6);
  overflow: hidden;
}

@keyframes pulse-orb {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  50% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
}

.nm-hero::before {
  content: '';
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 500px;
  background: radial-gradient(ellipse, var(--color-primary-glow) 0%, rgba(0, 242, 254, 0.1) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: pulse-orb 8s ease-in-out infinite;
  filter: blur(40px);
}

.nm-hero-content {
  text-align: center;
  max-width: 760px;
  position: relative;
  z-index: 2;
}

@keyframes hero-enter {
  from {
    opacity: 0;
    transform: translateY(40px);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes text-shine {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.nm-hero-name {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin-bottom: var(--space-4);
  background: linear-gradient(to right, #fff 20%, var(--color-accent) 40%, var(--color-primary) 60%, #fff 80%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: hero-enter 1s cubic-bezier(0.16, 1, 0.3, 1) both, text-shine 6s linear infinite;
}

.nm-hero-tagline {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
  margin-bottom: var(--space-6);
  animation: hero-enter 0.8s var(--ease-out) 0.15s both;
}

.nm-hero .nm-hero-desc {
  font-size: var(--text-base);
  color: var(--color-text-faint);
  margin-bottom: var(--space-8);
  animation: hero-enter 0.8s var(--ease-out) 0.3s both;
}

.nm-hero .nm-btn-primary {
  animation: hero-enter 0.8s var(--ease-out) 0.45s both;
}

.nm-title-accent {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary) 50%, var(--color-accent-2) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: text-shine 4s linear infinite;
}

.nm-hero-desc {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-10);
  margin-left: auto;
  margin-right: auto;
  max-width: 48ch;
  animation: hero-enter 0.8s var(--ease-out) 0.3s both;
}

.nm-hero-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  animation: hero-enter 0.8s var(--ease-out) 0.45s both;
}

.nm-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: #fff;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: 0 4px 20px var(--color-primary-glow), inset 0 1px 1px rgba(255, 255, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.nm-btn-primary::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: skewX(-20deg);
  transition: left 0.7s ease;
}

.nm-btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 32px var(--color-primary-glow), 0 0 40px var(--color-primary-glow), inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.nm-btn-primary:hover::before {
  left: 150%;
}

.nm-btn-primary:active {
  transform: translateY(0);
}

.nm-btn-primary svg {
  transition: transform var(--transition-interactive);
}

.nm-btn-primary:hover svg {
  transform: translate(2px, -2px);
}

.nm-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background var(--transition-interactive),
              border-color var(--transition-interactive),
              color var(--transition-interactive);
}

.nm-btn-secondary:hover {
  background: var(--color-surface);
  border-color: var(--color-text-faint);
  color: var(--color-text);
}

.nm-btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

.nm-section-tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: center;
  margin-bottom: var(--space-3);
}


/* Services Section */
.nm-services {
  position: relative;
  z-index: 1;
  padding: var(--space-20) 0;
}

.nm-services-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.nm-services-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  text-align: center;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-12);
  color: var(--color-text);
}

.nm-services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-6);
}

.nm-service-card {
  padding: var(--space-8) var(--space-6);
  background: linear-gradient(160deg, rgba(30, 30, 40, 0.6), rgba(15, 15, 20, 0.8));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.nm-service-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  padding: 2px;
  background: linear-gradient(135deg, var(--color-primary), transparent 50%, var(--color-accent));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.nm-service-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 40px var(--color-primary-glow);
}

.nm-service-card:hover::after {
  opacity: 1;
}

.nm-service-card:nth-child(2) .nm-service-icon {
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-accent-2);
}

.nm-service-card:nth-child(3) .nm-service-icon {
  background: rgba(245, 158, 11, 0.12);
  color: var(--color-accent);
}

.nm-service-card:nth-child(4) .nm-service-icon {
  background: rgba(6, 182, 212, 0.1);
  color: var(--color-primary);
}

.nm-service-card:nth-child(2):hover {
  border-color: var(--color-accent-2);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.12);
}

.nm-service-card:nth-child(3):hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.12);
}

.nm-service-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--color-primary-glow);
  color: var(--color-primary);
  margin-bottom: var(--space-5);
}

.nm-service-icon svg {
  width: 24px;
  height: 24px;
}

.nm-service-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-3);
  letter-spacing: -0.01em;
}

.nm-service-card p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}


/* Divider */
.nm-divider {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  max-width: var(--content-default);
  margin: 0 auto;
}

.nm-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-primary-glow), transparent);
}

.nm-divider-icon {
  color: var(--color-primary);
  opacity: 0.5;
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

/* Bottom Section */
.nm-bottom {
  position: relative;
  z-index: 1;
  padding: var(--space-20) 0 var(--space-16);
}

.nm-bottom-inner {
  max-width: var(--content-default);
  margin: 0 auto;
  padding: 0 var(--space-6);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-12);
}

.nm-stack-quote {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  text-align: center;
  color: var(--color-text);
  letter-spacing: -0.02em;
  max-width: 36ch;
}

.nm-bottom-cta {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-10) var(--space-8);
  background: linear-gradient(160deg, rgba(30, 30, 40, 0.4), rgba(15, 15, 20, 0.6));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid transparent;
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 48px rgba(0,0,0,0.3);
  max-width: 480px;
  width: 100%;
  background-clip: padding-box;
  overflow: hidden;
}

.nm-bottom-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  padding: 1px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent-2), var(--color-accent));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.8;
}

.nm-cta-desc {
  color: var(--color-text-muted);
  font-size: var(--text-lg);
}

/* Footer */
.nm-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--color-border);
  padding: var(--space-6) 0;
}

.nm-footer-inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.nm-footer-inner a {
  color: var(--color-text-faint);
  transition: color var(--transition-interactive);
}

.nm-footer-inner a:hover {
  color: var(--color-text);
}


/* ========================================
   TERMINAL MODE
   ======================================== */

#mode-terminal {
  display: none;
  min-height: 100dvh;
  padding: calc(var(--space-16) + var(--space-8)) var(--space-4) var(--space-4);
  background: #07070d;
  position: relative;
  overflow: hidden;
}

#mode-terminal.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

/* Subtle grid background */
.tm-bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(6, 182, 212, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 182, 212, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.tm-window {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 880px;
  background: rgba(13, 13, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(6, 182, 212, 0.25);
  box-shadow:
    0 24px 64px rgba(0,0,0,0.8),
    0 0 80px rgba(6, 182, 212, 0.1),
    inset 0 1px 1px rgba(255,255,255,0.1);
  overflow: hidden;
  animation: tm-enter 0.6s var(--ease-out) both;
}

@keyframes tm-enter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tm-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(180deg, #18182a 0%, #131320 100%);
  border-bottom: 1px solid rgba(6, 182, 212, 0.12);
}

.tm-dots {
  display: flex;
  gap: var(--space-2);
}

.tm-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transition: filter 0.2s ease;
}

.tm-dot:hover {
  filter: brightness(1.3);
}

.tm-dot-red { background: #ff5f57; box-shadow: 0 0 6px rgba(255, 95, 87, 0.3); }
.tm-dot-yellow { background: #febc2e; box-shadow: 0 0 6px rgba(254, 188, 46, 0.3); }
.tm-dot-green { background: #28c840; box-shadow: 0 0 6px rgba(40, 200, 64, 0.3); }

.tm-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: #555;
  display: flex;
  align-items: center;
}

.tm-titlebar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.tm-tab {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #555;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.15);
}

.tm-tab.active {
  color: var(--color-primary);
  background: rgba(6, 182, 212, 0.12);
}

.tm-tab-add {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #444;
  padding: 0 4px;
  cursor: default;
}

.tm-body {
  position: relative;
  padding: var(--space-5) var(--space-5);
  min-height: 500px;
  max-height: 70vh;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  color: #c8c8d8;
  background: #0d0d14;
}

/* CRT-style scanline overlay */
.tm-scanline {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 2;
}

/* Custom scrollbar */
.tm-body::-webkit-scrollbar {
  width: 6px;
}

.tm-body::-webkit-scrollbar-track {
  background: transparent;
}

.tm-body::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.2);
  border-radius: 3px;
}

.tm-body::-webkit-scrollbar-thumb:hover {
  background: rgba(6, 182, 212, 0.35);
}

.tm-output {
  white-space: pre-wrap;
  word-break: break-all;
}

.tm-line {
  margin-bottom: 2px;
  transition: opacity 0.15s ease;
}

.tm-line-prompt {
  color: #28c840;
  text-shadow: 0 0 8px rgba(40, 200, 64, 0.2);
}

.tm-line-cmd {
  color: #e0e0e0;
}

.tm-line-output {
  color: #8888a0;
}

.tm-line-accent {
  color: #10b981;
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
}

.tm-line-success {
  color: #28c840;
  text-shadow: 0 0 8px rgba(40, 200, 64, 0.15);
}

.tm-line-info {
  color: #0ea5e9;
  text-shadow: 0 0 8px rgba(14, 165, 233, 0.15);
}

.tm-line-warn {
  color: #febc2e;
  text-shadow: 0 0 8px rgba(254, 188, 46, 0.15);
}

.tm-input-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  position: relative;
}

.tm-prompt {
  color: #28c840;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 14px;
  text-shadow: 0 0 8px rgba(40, 200, 64, 0.25);
}

.tm-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #e0e0e8;
  font-family: var(--font-mono);
  font-size: 14px;
  outline: none;
  caret-color: #28c840;
}

.tm-cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: #28c840;
  border-radius: 1px;
  animation: tm-blink 1s step-end infinite;
  opacity: 0.7;
  flex-shrink: 0;
}

@keyframes tm-blink {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0; }
}

/* Status bar */
.tm-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) var(--space-4);
  background: linear-gradient(180deg, #131320 0%, #0f0f1a 100%);
  border-top: 1px solid rgba(6, 182, 212, 0.1);
  font-family: var(--font-mono);
  font-size: 10px;
  color: #444;
}

.tm-status-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tm-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #28c840;
  box-shadow: 0 0 6px rgba(40, 200, 64, 0.4);
  animation: tm-status-pulse 2s ease-in-out infinite;
}

@keyframes tm-status-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.tm-status-center {
  color: #555;
}

.tm-status-right {
  color: #444;
}

/* ========================================
   AI MODE
   ======================================== */

#mode-ai {
  display: none;
  min-height: 100dvh;
  background: #fafafa;
  color: #1a1a1a;
  padding: calc(var(--space-16) + var(--space-8)) var(--space-4) var(--space-4);
}

#mode-ai.active {
  display: block;
}

.ai-container {
  max-width: 780px;
  margin: 0 auto;
}

.ai-header {
  margin-bottom: var(--space-10);
  padding-bottom: var(--space-6);
  border-bottom: 2px solid #1a1a1a;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
}

.ai-header-text {
  flex: 1;
  min-width: 0;
}

.ai-header h1 {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-2);
  color: #1a1a1a;
}

.ai-header p {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: #666;
}

.ai-human-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: #1a1a1a;
  color: #f0f0f0;
  border: 1px solid #1a1a1a;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
  margin-top: var(--space-1);
}

.ai-human-btn:hover {
  background: #333;
  border-color: #333;
}

.ai-human-btn svg {
  flex-shrink: 0;
}

.ai-section {
  margin-bottom: var(--space-10);
}

.ai-section h2 {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-4);
  color: #1a1a1a;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid #ddd;
}

.ai-block {
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  overflow-x: auto;
}

.ai-block pre {
  margin: 0;
}

.ai-block code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: #333;
}

.ai-status {
  margin-top: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  display: none;
}

.ai-status:not(:empty) {
  display: block;
}

.ai-status-loading {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}

.ai-status-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #28a745;
}

.ai-status-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #dc3545;
}

.ai-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 13px;
}

.ai-table th,
.ai-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.ai-table th {
  font-weight: 700;
  background: #f0f0f0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #555;
}

.ai-table td {
  color: #333;
}

.ai-footer {
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid #ddd;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: #888;
  display: flex;
  justify-content: space-between;
}

.ai-footer a {
  color: #888;
  text-decoration: underline;
}

.ai-footer a:hover {
  color: #555;
}


/* ========================================
   SCROLL REVEALS (Normal mode)
   ======================================== */

.nm-services,
.nm-bottom {
  opacity: 1;
}

@supports (animation-timeline: scroll()) {
  .nm-services,
  .nm-bottom {
    opacity: 0;
    animation: reveal-fade linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 40%;
  }
}

@keyframes reveal-fade {
  to { opacity: 1; }
}


/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .nm-hero {
    min-height: 80vh;
    padding-top: var(--space-12);
  }

  .nm-hero-name {
    font-size: var(--text-3xl);
  }

  .nm-footer-inner {
    flex-direction: column;
    gap: var(--space-2);
    text-align: center;
  }

  .mode-btn span:not(.tm-btn-prompt) {
    display: none;
  }

  .mode-btn {
    padding: var(--space-2) var(--space-3);
  }

  .tm-body {
    font-size: 12px;
    min-height: 400px;
  }

  .tm-prompt {
    font-size: 12px;
  }

  .tm-input {
    font-size: 12px;
  }

  .nm-services-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ai-footer {
    flex-direction: column;
    gap: var(--space-2);
  }
}

@media (max-width: 480px) {

  .nm-services-grid {
    grid-template-columns: 1fr;
  }
  .nm-hero-name {
    font-size: var(--text-2xl);
  }

  .nm-contact-btn span {
    display: none;
  }

  .modal-window {
    margin: var(--space-4);
    max-height: calc(100dvh - var(--space-8));
  }
}


/* ========================================
   CONTACT MODAL
   ======================================== */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(12px);
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal-overlay.open {
  display: flex;
}

.modal-window {
  width: 100%;
  max-width: 480px;
  background: rgba(17, 17, 24, 0.85);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 60px var(--color-primary-glow), inset 0 1px 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  animation: modal-enter 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
}

.modal-close {
  color: var(--color-text-muted);
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  transition: color var(--transition-interactive),
              background var(--transition-interactive);
}

.modal-close:hover {
  color: var(--color-text);
  background: var(--color-primary-glow);
}

.modal-form {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-field label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-field input,
.form-field textarea {
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.5;
  transition: border-color var(--transition-interactive),
              box-shadow var(--transition-interactive);
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--color-text-faint);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.form-submit {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background var(--transition-interactive),
              transform var(--transition-interactive),
              box-shadow var(--transition-interactive);
}

.form-submit:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--color-primary-glow);
}

.form-submit svg {
  transition: transform var(--transition-interactive);
}

.form-submit:hover svg {
  transform: translate(2px, -2px);
}

.form-submit:active {
  transform: translateY(0);
}

.form-submit:disabled {
  opacity: 0.6;
  pointer-events: none;
}

.form-feedback {
  font-size: var(--text-sm);
  text-align: center;
  min-height: 1.5em;
}

.form-feedback.success {
  color: #28c840;
}

.form-feedback.error {
  color: #ff5f57;
}

/* AI mode contact button styled as link — see also ai-contact-link in AI MODE section */
