/* =============================================================
   FIELDCTRL — Operational control, simplified.
   Industrial terminal aesthetic for IT professionals.
   ============================================================= */

:root {
  /* Base palette — industrial dark */
  --bg-base: #0a0e14;
  --bg-elevated: #0f1419;
  --bg-card: #131821;

  /* Text hierarchy */
  --text-primary: #d9e0e8;
  --text-secondary: #8b95a3;
  --text-muted: #4d5666;
  --text-dim: #2a2f3a;

  /* Accent — terminal cyan */
  --accent: #00d4d4;
  --accent-dim: #0a8a8a;
  --accent-glow: rgba(0, 212, 212, 0.15);

  /* Semantic */
  --status-active: #50fa7b;
  --status-warn: #ffb86c;
  --status-error: #ff5555;
  --error-bg: #1a0e0e;
  --error-border: #3a1a1a;

  /* Borders */
  --border-subtle: #1a1f29;
  --border-default: #252b38;
  --border-emphasis: #3a4252;

  /* Typography */
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  --font-display: 'Space Grotesk', system-ui, sans-serif;

  /* Layout */
  --max-width: 720px;
  --gutter: 2rem;
}

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

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

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 400;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Subtle grain texture overlay */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

/* =============================================================
   Topbar — system-style header
   ============================================================= */

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem var(--gutter);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-active);
  box-shadow: 0 0 8px var(--status-active);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.domain {
  color: var(--text-secondary);
  font-weight: 500;
}

.version {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* =============================================================
   Hero section
   ============================================================= */

.hero {
  position: relative;
  z-index: 5;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5rem var(--gutter) 4rem;
}

.hero-meta {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 2.5rem;
  font-size: 0.8125rem;
  opacity: 0;
  animation: fadeUp 0.6s ease 0.1s forwards;
}

.line-num {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.comment {
  color: var(--text-muted);
  font-style: italic;
}

.logo {
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
  opacity: 0;
  animation: fadeUp 0.7s ease 0.2s forwards;
}

.logo::after {
  content: '_';
  color: var(--accent);
  margin-left: 0.1em;
  animation: blink 1.2s steps(2) infinite;
}

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

.tagline {
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  letter-spacing: -0.01em;
  opacity: 0;
  animation: fadeUp 0.7s ease 0.3s forwards;
}

.lede {
  font-size: 1rem;
  color: var(--text-primary);
  max-width: 32em;
  margin-bottom: 2.5rem;
  line-height: 1.75;
  opacity: 0;
  animation: fadeUp 0.7s ease 0.4s forwards;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =============================================================
   Signup form
   ============================================================= */

.signup {
  display: flex;
  gap: 0.5rem;
  max-width: 32rem;
  margin-bottom: 0.875rem;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp 0.7s ease 0.5s forwards;
}

#email {
  flex: 1;
  min-width: 14rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  padding: 0.875rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  transition: all 0.2s ease;
}

#email::placeholder {
  color: var(--text-muted);
}

#email:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

#submit-btn {
  background: var(--accent);
  color: var(--bg-base);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.875rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

#submit-btn:hover:not(:disabled) {
  background: #00f0f0;
  transform: translateY(-1px);
}

#submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

#submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#submit-btn.success {
  background: var(--status-active);
  border-color: var(--status-active);
}

#submit-btn.error {
  background: var(--status-error);
  border-color: var(--status-error);
}

.btn-arrow {
  transition: transform 0.2s ease;
}

#submit-btn:hover .btn-arrow {
  transform: translateX(3px);
}

.signup-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 3rem;
  opacity: 0;
  animation: fadeUp 0.7s ease 0.6s forwards;
}

.signup-meta a {
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px dotted var(--text-muted);
  transition: color 0.2s;
}

.signup-meta a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* =============================================================
   Status line
   ============================================================= */

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
  opacity: 0;
  animation: fadeUp 0.7s ease 0.7s forwards;
}

.status-key {
  color: var(--text-muted);
}

.status-value {
  color: var(--text-secondary);
  font-weight: 500;
}

.status-value.pulse {
  color: var(--status-active);
}

.status-sep {
  color: var(--text-dim);
  margin: 0 0.5rem;
}

/* =============================================================
   Story section
   ============================================================= */

.story,
.about {
  position: relative;
  z-index: 5;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem var(--gutter);
  border-top: 1px solid var(--border-subtle);
}

.section-label {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.8125rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 2rem;
  line-height: 1.2;
}

.story-content p,
.about-content p {
  margin-bottom: 1.25rem;
  color: var(--text-primary);
  font-size: 0.9375rem;
  line-height: 1.75;
  max-width: 38em;
}

.story-content em,
.about-content em {
  color: var(--accent);
  font-style: normal;
}

.error-block {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-left: 3px solid var(--status-error);
  border-radius: 2px;
  padding: 0.875rem 1rem;
  margin: 1.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.err-prefix {
  color: var(--text-muted);
}

.err-msg {
  color: var(--status-error);
  font-weight: 500;
}

.story-conclusion {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.story-conclusion strong {
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* =============================================================
   About section
   ============================================================= */

.about-content strong {
  color: var(--text-primary);
  font-weight: 500;
}

.about-meta {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.about-meta a {
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px dotted var(--text-muted);
  transition: color 0.2s;
}

.about-meta a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.sep {
  color: var(--text-dim);
  margin: 0 0.5rem;
}

/* =============================================================
   Footer
   ============================================================= */

footer {
  position: relative;
  z-index: 5;
  border-top: 1px solid var(--border-subtle);
  padding: 2.5rem var(--gutter);
  margin-top: 2rem;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-brand {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.footer-tagline {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer-links {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px dotted var(--text-muted);
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* =============================================================
   Selection
   ============================================================= */

::selection {
  background: var(--accent-glow);
  color: var(--accent);
}

/* =============================================================
   Mobile
   ============================================================= */

@media (max-width: 640px) {
  :root {
    --gutter: 1.25rem;
  }

  .hero {
    padding: 3rem var(--gutter) 3rem;
  }

  .story,
  .about {
    padding: 3rem var(--gutter);
  }

  .signup {
    flex-direction: column;
  }

  #email,
  #submit-btn {
    width: 100%;
  }

  .footer-content {
    text-align: left;
  }
}

/* =============================================================
   Reduced motion
   ============================================================= */

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