/* ============================================================
   TeMiCorp Gateway — Design System
   Dark-mode, minimalist, high-tech "E Corp" corporate look.
   Palette:
     bg #0b0f19 · card #131b2e · accent #00f0ff · ok #10b981
   ============================================================ */

:root {
  --bg: #0b0f19;
  --card: #131b2e;
  --card-2: #0f1524;
  --line: rgba(0, 240, 255, 0.14);
  --line-soft: rgba(255, 255, 255, 0.07);
  --text: #e6edf3;
  --muted: #8b98ad;
  --accent: #00f0ff;
  --accent-dim: rgba(0, 240, 255, 0.12);
  --ok: #10b981;
  --ok-dim: rgba(16, 185, 129, 0.12);
  --warn: #f59e0b;
  --err: #f43f5e;
  --radius: 14px;
  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, "SF Mono", Consolas, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

.mono { font-family: var(--font-mono); }
.accent-text { color: var(--accent); }
.muted { color: var(--muted); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ---------- Background grid ---------- */
.bg-grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, black 30%, transparent 75%);
}

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 15, 25, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}

.header-inner {
  display: flex; align-items: center; gap: 28px;
  height: 64px;
}

.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-weight: 700; font-size: 1.05rem;
  color: var(--text); text-decoration: none; letter-spacing: 0.05em;
  white-space: nowrap;
}
.logo-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.5);
  position: relative; flex: none;
}
.logo-mark::after {
  content: ""; position: absolute; inset: 6px; border-radius: 2px;
  background: var(--bg);
}
.logo-accent { color: var(--accent); }

.status-pill {
  font-size: 0.62rem; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ok); background: var(--ok-dim);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 3px 9px; border-radius: 999px;
  margin-left: 6px;
}
.status-pill::before {
  content: ""; display: inline-block; width: 6px; height: 6px;
  background: var(--ok); border-radius: 50%;
  margin-right: 6px;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16,185,129,.5); }
  50% { opacity: .6; box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}

.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a {
  color: var(--muted); text-decoration: none; font-size: 0.88rem;
  font-family: var(--font-mono);
  transition: color .2s;
}
.nav a:hover { color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 14px; }

.lang-toggle {
  display: flex; align-items: center; gap: 5px;
  background: var(--card); border: 1px solid var(--line-soft);
  color: var(--muted); border-radius: 999px; padding: 5px 12px;
  font-family: var(--font-mono); font-size: 0.8rem; cursor: pointer;
  transition: border-color .2s;
}
.lang-toggle:hover { border-color: var(--line); }
.lang-opt { cursor: pointer; transition: color .2s; }
.lang-sep { opacity: .4; }
.lang-opt.active { color: var(--accent); text-shadow: 0 0 8px rgba(0,240,255,.5); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-mono); font-size: 0.9rem; font-weight: 600;
  padding: 12px 24px; border-radius: 10px; border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 8px 16px; font-size: 0.78rem; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--accent); color: #04121a;
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.35);
}
.btn-primary:hover { box-shadow: 0 0 36px rgba(0, 240, 255, 0.55); }
.btn-primary:disabled { opacity: .55; cursor: wait; box-shadow: none; }

.btn-ghost {
  background: transparent; color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ---------- Hero ---------- */
.hero { padding: 96px 0 72px; position: relative; }

.hero-inner {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center;
}

.hero-eyebrow { color: var(--accent); font-size: 0.85rem; margin-bottom: 18px; letter-spacing: 0.06em; }

.hero-title {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.12; font-weight: 800; letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.hero-sub { color: var(--muted); font-size: 1.06rem; max-width: 34em; margin-bottom: 32px; }

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 26px; }

.hero-meta {
  display: flex; gap: 22px; flex-wrap: wrap;
  color: var(--muted); font-size: 0.78rem;
}

/* ---------- Hero terminal ---------- */
.hero-terminal {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 240, 255, 0.05);
}
.term-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 14px;
  background: var(--card-2);
  border-bottom: 1px solid var(--line-soft);
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-red { background: #f43f5e; } .dot-yellow { background: #f59e0b; } .dot-green { background: #10b981; }
.term-title { margin-left: auto; font-size: 0.68rem; color: var(--muted); }
.term-body {
  padding: 18px; font-size: 0.76rem; line-height: 1.75;
  color: #9fb3c8; min-height: 220px; white-space: pre-wrap;
}
.term-body .t-accent { color: var(--accent); }
.term-body .t-ok { color: var(--ok); }
.term-body .t-dim { color: var(--muted); }
.term-body .caret {
  display: inline-block; width: 8px; height: 14px;
  background: var(--accent); vertical-align: -2px;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Sections ---------- */
.section { padding: 72px 0; border-top: 1px solid var(--line-soft); }

.section-title { font-size: 1.7rem; font-weight: 700; margin-bottom: 12px; letter-spacing: -0.01em; }
.section-lead { color: var(--muted); max-width: 44em; margin-bottom: 40px; }

/* ---------- Cards ---------- */
.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px; margin-bottom: 34px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color .25s, transform .25s, box-shadow .25s;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
  opacity: 0; transition: opacity .25s;
}
.card:hover {
  border-color: var(--line);
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}
.card:hover::before { opacity: 1; }

.card-tag {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-dim);
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  margin-bottom: 14px;
}
.card h3 { font-size: 1.02rem; font-weight: 700; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 0.88rem; }

/* ---------- Approach panel ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 26px;
}
.approach { margin-top: 12px; }
.approach h3 { font-size: 0.92rem; letter-spacing: 0.06em; margin-bottom: 16px; }

.checklist { list-style: none; display: grid; gap: 10px; }
.checklist li {
  color: #c3d0de; font-size: 0.94rem; padding-left: 26px; position: relative;
}
.checklist li::before {
  content: "▸"; color: var(--ok); position: absolute; left: 4px;
  font-family: var(--font-mono); font-weight: 700;
}

/* ---------- Pipeline ---------- */
.pipeline {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px;
  background: var(--card-2); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 18px 22px;
  font-size: 0.78rem;
}
.pipeline .node {
  background: var(--card); border: 1px solid var(--line-soft);
  padding: 7px 14px; border-radius: 8px; color: #c3d0de;
}
.pipeline .node-ok { color: var(--ok); border-color: rgba(16,185,129,.4); }
.pipeline .arrow { color: var(--accent); font-weight: 700; }

/* ---------- Gateway grid ---------- */
.gateway-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start;
}

.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 20px;
  border-bottom: 1px solid var(--line-soft); padding-bottom: 14px;
}
.panel-head h3 { font-size: 0.95rem; letter-spacing: 0.06em; }
.refresh { color: var(--accent); cursor: pointer; font-size: 0.72rem; user-select: none; }
.refresh:hover { text-shadow: 0 0 10px rgba(0,240,255,.6); }

/* Status */
.status-overview {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; font-size: 0.72rem;
}
.chip {
  border: 1px solid var(--line-soft); border-radius: 999px;
  padding: 4px 12px; color: var(--muted); background: var(--card-2);
}
.chip.ok { color: var(--ok); border-color: rgba(16,185,129,.4); background: var(--ok-dim); }

.status-list { list-style: none; display: grid; gap: 8px; font-size: 0.78rem; }
.status-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card-2); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 10px 14px;
  transition: border-color .2s;
}
.status-item:hover { border-color: var(--line); }
.status-led {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--ok); box-shadow: 0 0 8px rgba(16,185,129,.7);
}
.status-led.warn { background: var(--warn); box-shadow: 0 0 8px rgba(245,158,11,.7); }
.status-led.err { background: var(--err); box-shadow: 0 0 8px rgba(244,63,94,.7); }
.status-name { color: var(--text); min-width: 0; }
.status-detail { margin-left: auto; color: var(--muted); font-size: 0.68rem; white-space: nowrap; }

/* ---------- Form ---------- */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { margin-bottom: 14px; }
.field label {
  display: block; font-family: var(--font-mono); font-size: 0.7rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.field input, .field textarea {
  width: 100%; background: var(--card-2);
  border: 1px solid var(--line-soft); border-radius: 10px;
  color: var(--text); font-family: var(--font-sans); font-size: 0.92rem;
  padding: 11px 14px; outline: none;
  transition: border-color .2s, box-shadow .2s;
  resize: vertical;
}
.field input:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.field input.invalid, .field textarea.invalid { border-color: var(--err); }

.form-note { color: var(--muted); font-size: 0.68rem; margin-top: 12px; }

.form-gate {
  padding: 16px 18px; border-radius: 10px; font-size: 0.76rem;
  color: var(--warn); border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.07);
}

.form-result {
  margin-top: 14px; padding: 12px 16px; border-radius: 10px;
  font-size: 0.76rem; border: 1px solid;
}
.form-result.ok { color: var(--ok); border-color: rgba(16,185,129,.4); background: var(--ok-dim); }
.form-result.err { color: var(--err); border-color: rgba(244,63,94,.4); background: rgba(244,63,94,.08); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line-soft); padding: 30px 0; margin-top: 40px; }
.footer-inner {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 0.7rem; color: var(--muted);
}

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-terminal { max-width: 560px; }
  .gateway-grid { grid-template-columns: 1fr; }
  .nav { display: none; }
}

@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
  .status-detail { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .term-body .caret { animation: none; }
  .status-pill::before { animation: none; }
}
