:root {
  --bg: #0a0a0a;
  --bg-elev: #111111;
  --bg-card: #161616;
  --line: #232323;
  --line-strong: #2e2e2e;
  --text: #f5f5f5;
  --text-dim: #a3a3a3;
  --text-muted: #6f6f6f;
  --accent: #ffffff;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

main { flex: 1; position: relative; z-index: 1; }

/* ============ Animated Background ============ */
.bg-fx {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Grid layer - slowly drifts */
.bg-grid {
  position: absolute;
  inset: -60px;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridDrift 20s linear infinite;
  mask-image: radial-gradient(ellipse 100% 75% at 50% 50%, #000 40%, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse 100% 75% at 50% 50%, #000 40%, transparent 90%);
}

@keyframes gridDrift {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(60px, 60px); }
}

/* Sweeping scan beam */
.bg-scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 220px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 255, 255, 0.025) 40%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.025) 60%,
    transparent 100%
  );
  animation: scanSweep 7s ease-in-out infinite;
  will-change: transform;
}

@keyframes scanSweep {
  0%   { transform: translateY(-220px); }
  100% { transform: translateY(100vh); }
}

/* Pulse glow at center */
.bg-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 800px;
  height: 800px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06), transparent 60%);
  animation: pulseGlow 6s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 0.8; }
}

.site-header, .site-footer { position: relative; z-index: 2; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.75rem;
}

.container.narrow { max-width: 520px; }

/* ============ Header ============ */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  background: rgba(10, 10, 10, 0.85);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo {
  display: block;
  height: 44px;
  width: auto;
  filter: invert(1) brightness(1.05);
}

.nav {
  display: flex;
  gap: 2rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}

.nav a:hover { color: var(--text); }

.nav-cta {
  color: var(--bg) !important;
  background: var(--text);
  padding: 0.65rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.2s, background 0.2s;
}

.nav-cta:hover {
  background: #e5e5e5;
  transform: translateY(-1px);
}

/* ============ Portal Section ============ */
.portal-section {
  padding: 6rem 0 5rem;
  position: relative;
  overflow: hidden;
}

.portal-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 70%),
    radial-gradient(ellipse 40% 30% at 50% 100%, rgba(255, 255, 255, 0.03), transparent 60%);
  pointer-events: none;
}

.portal-section .container { position: relative; }

.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}

.portal-title {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 1rem;
  color: var(--text);
}

.portal-title .accent {
  color: var(--text);
  font-style: italic;
  font-weight: 300;
}

.portal-sub {
  color: var(--text-dim);
  font-size: 1rem;
  margin-bottom: 2.5rem;
  max-width: 420px;
}

/* ============ Form ============ */
.login-form {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 20px 50px rgba(0, 0, 0, 0.4);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.login-form label {
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
}

.login-form input {
  padding: 0.85rem 1rem;
  border: 1px solid var(--line-strong);
  background: var(--bg-elev);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.login-form input::placeholder { color: var(--text-muted); }

.login-form input:focus {
  border-color: #4a4a4a;
  background: #1a1a1a;
}

/* ============ Buttons ============ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--text);
  color: var(--bg);
  padding: 0.95rem 1.6rem;
  text-decoration: none;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  margin-top: 0.5rem;
}

.btn-primary:hover {
  background: #e5e5e5;
  transform: translateY(-1px);
}

.btn-primary.full { width: 100%; }

/* ============ Footer ============ */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 2rem 0;
}

.footer-inner {
  text-align: center;
  color: var(--text-muted);
}

.footer-inner p {
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

/* ============ Responsive ============ */
@media (max-width: 640px) {
  .header-inner {
    padding: 1rem 1.25rem;
    justify-content: space-between;
  }

  .brand-logo { height: 32px; }

  .nav { gap: 1rem; }

  .nav a { font-size: 0.82rem; }

  .nav-cta { padding: 0.5rem 0.95rem; }

  .portal-section { padding: 3.5rem 0 3rem; }

  .login-form { padding: 1.5rem; }
}
