/* ================================================================
   HE Guardrail — Product Site CSS
   ================================================================ */

:root {
  --bg: #0a0e1a;
  --bg-dark: #060910;
  --bg-card: #111827;
  --bg-card2: #0f1623;
  --border: #1e2d45;
  --border-bright: #2a4066;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #38bdf8;
  --accent2: #818cf8;
  --green: #34d399;
  --red: #f87171;
  --yellow: #fbbf24;
  --orange: #fb923c;
  --grad-start: #38bdf8;
  --grad-end: #818cf8;
  --font: 'Inter', sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── Utilities ── */
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.section { padding: 96px 0; }
.bg-dark { background: var(--bg-dark); }

.grad {
  background: linear-gradient(90deg, var(--grad-start), var(--grad-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 48px;
}

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── NAV ── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 24px;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.logo-accent { color: var(--accent); }
.nav-links { list-style: none; display: flex; gap: 28px; align-items: center; }
.nav-links a { text-decoration: none; color: var(--text-muted); font-size: 0.9rem; transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.btn-nav {
  background: var(--accent); color: #000 !important;
  padding: 6px 16px; border-radius: 6px; font-weight: 600;
}
.btn-nav:hover { background: #7dd3fc !important; }

/* ── HERO ── */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 120px 24px 80px;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
}
#matrixCanvas {
  width: 100%; height: 100%;
  opacity: 0.15;
}
.hero-content {
  position: relative; z-index: 1;
  max-width: 860px;
  text-align: center;
}
.badge {
  display: inline-block;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(2.2rem, 5.5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 24px;
}
.hero-sub {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 36px;
}
.hero-cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 64px; }
.btn-primary {
  display: inline-block;
  background: linear-gradient(90deg, var(--grad-start), var(--grad-end));
  color: #000;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 13px 28px;
  border-radius: 8px;
  text-decoration: none;
  transition: transform .2s, box-shadow .2s;
  border: none; cursor: pointer;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(56,189,248,0.3); }
.btn-ghost {
  display: inline-block;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 13px 28px;
  border-radius: 8px;
  border: 1px solid var(--border-bright);
  text-decoration: none;
  transition: background .2s, border-color .2s;
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); border-color: var(--accent); }

.hero-stats {
  display: flex; gap: 40px; justify-content: center; flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 36px;
}
.stat { text-align: center; }
.stat-num { display: block; font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); }

/* ── PROBLEM ── */
.problem-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 640px) { .problem-grid { grid-template-columns: 1fr; } }
.problem-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 32px;
  border: 1px solid var(--border);
}
.problem-card.bad { border-color: rgba(248, 113, 113, 0.3); }
.problem-card.good { border-color: rgba(52, 211, 153, 0.3); }
.card-icon { font-size: 2.5rem; margin-bottom: 16px; }
.problem-card h3 { font-size: 1.2rem; margin-bottom: 16px; }
.problem-card ul { list-style: none; }
.problem-card ul li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}
.problem-card ul li:last-child { border-bottom: none; }
.problem-card.bad ul li::before { content: "✗ "; color: var(--red); }
.problem-card.good ul li::before { content: "✓ "; color: var(--green); }
.problem-card.good ul li strong { color: var(--green); }

/* ── WHY EMBEDDINGS ── */
.why-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 48px; }
.why-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
}
.why-num { font-size: 2.5rem; font-weight: 800; color: var(--border-bright); margin-bottom: 12px; font-family: var(--mono); }
.why-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 10px; }
.why-card p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.65; }
.why-card em { color: var(--accent); font-style: normal; }

.why-compare { overflow-x: auto; }
.compare-title { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.1em; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.compare-table th {
  text-align: left; padding: 10px 16px;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  color: var(--text-muted); font-weight: 600;
}
.compare-table td { padding: 10px 16px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.compare-table tr.highlight td { background: rgba(56, 189, 248, 0.06); color: var(--text); }
.compare-table tr.highlight td:first-child { color: var(--accent); font-weight: 700; }
.check { color: var(--green) !important; font-weight: 600; }
.x { color: var(--red) !important; }
.half { color: var(--yellow) !important; }

/* ── HE COMPARE ── */
.he-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 700px) { .he-compare { grid-template-columns: 1fr; } }
.he-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}
.highlight-box { border-color: rgba(56, 189, 248, 0.4); }
.he-box h3 { font-size: 1.05rem; margin-bottom: 20px; }
.pipeline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; font-size: 0.8rem; }
.pipe-step {
  padding: 6px 12px; border-radius: 6px; font-weight: 600; font-family: var(--mono);
}
.pipe-step.plain { background: rgba(251, 191, 36, 0.15); color: var(--yellow); border: 1px solid rgba(251,191,36,0.3); }
.pipe-step.cipher { background: rgba(56, 189, 248, 0.15); color: var(--accent); border: 1px solid rgba(56,189,248,0.3); }
.pipe-arrow { color: var(--text-dim); font-size: 0.75rem; }
.pipe-arrow.red { color: var(--red); }
.pipe-arrow.green { color: var(--green); }
.he-desc { font-size: 0.875rem; color: var(--text-muted); line-height: 1.65; }
.he-desc strong { color: var(--text); }
.ckks-badge {
  margin-top: 16px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56,189,248,0.25);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.8rem;
  color: var(--accent);
  font-family: var(--mono);
  line-height: 1.5;
}

/* ── STEPS ── */
.steps { display: flex; flex-direction: column; gap: 0; }
.step {
  display: flex; gap: 24px; align-items: flex-start;
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
}
.step:last-child { border-bottom: none; }
.step-num {
  min-width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--grad-start), var(--grad-end));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; color: #000;
  flex-shrink: 0;
}
.step-content { flex: 1; }
.step-zone {
  display: inline-block;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em;
  padding: 3px 10px; border-radius: 4px; margin-bottom: 8px;
}
.client-zone { background: rgba(251,191,36,0.15); color: var(--yellow); }
.server-zone { background: rgba(248,113,113,0.12); color: #fca5a5; }
.secure-zone { background: rgba(52,211,153,0.12); color: var(--green); }
.step-content h3 { font-size: 1.1rem; margin-bottom: 8px; }
.step-content p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 16px; }
.code-block {
  background: #050810;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  font-family: var(--mono);
  font-size: 0.8rem;
  overflow-x: auto;
  line-height: 1.6;
}
.code-block .cm { color: var(--text-dim); }
.code-block pre { color: var(--text); }

/* ── FLOW DIAGRAM ── */
.flow-diagram {
  display: flex; align-items: flex-start; gap: 0;
  overflow-x: auto; padding-bottom: 16px;
  margin-bottom: 48px;
}
.flow-actor {
  min-width: 220px; flex: 1;
}
.flow-actor-label {
  text-align: center;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em;
  padding: 8px 12px; border-radius: 8px 8px 0 0; margin-bottom: 2px;
}
.flow-actor-label.client { background: rgba(251,191,36,0.15); color: var(--yellow); }
.flow-actor-label.server { background: rgba(248,113,113,0.12); color: #fca5a5; }
.flow-actor-label.secure { background: rgba(52,211,153,0.12); color: var(--green); }
.flow-items {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.flow-item {
  border-radius: 8px;
  padding: 12px;
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid transparent;
}
.plain-item { background: rgba(251,191,36,0.07); border-color: rgba(251,191,36,0.2); }
.cipher-item { background: rgba(56,189,248,0.07); border-color: rgba(56,189,248,0.2); }
.public-item { background: rgba(129,140,248,0.07); border-color: rgba(129,140,248,0.2); }
.secure-item { background: rgba(52,211,153,0.07); border-color: rgba(52,211,153,0.2); }
.result-item { background: rgba(251,113,133,0.07); border-color: rgba(251,113,133,0.2); }
.flow-item-icon { font-size: 1.2rem; min-width: 24px; }
.flow-item-text { flex: 1; }
.flow-item-text strong { font-size: 0.82rem; display: block; margin-bottom: 2px; }
.flow-item-text span { font-size: 0.75rem; color: var(--text-muted); font-family: var(--mono); }
.plain-badge, .cipher-badge, .public-badge, .secure-badge, .result-badge {
  font-size: 0.65rem; font-weight: 700; padding: 2px 6px; border-radius: 4px; white-space: nowrap; align-self: flex-start;
}
.plain-badge { background: rgba(251,191,36,0.2); color: var(--yellow); }
.cipher-badge { background: rgba(56,189,248,0.2); color: var(--accent); }
.public-badge { background: rgba(129,140,248,0.2); color: var(--accent2); }
.secure-badge { background: rgba(52,211,153,0.2); color: var(--green); }
.result-badge { background: rgba(251,113,133,0.2); color: #fca5a5; }
.flow-down-arrow { text-align: center; color: var(--text-dim); font-size: 0.78rem; padding: 4px 0; }

.flow-transfer {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 12px; min-width: 100px;
}
.transfer-arrow {
  writing-mode: vertical-lr; transform: rotate(180deg);
  font-size: 0.8rem; color: var(--accent); font-weight: 600;
  padding: 8px 0;
}
@media (max-width: 900px) {
  .flow-diagram { flex-direction: column; }
  .flow-transfer { flex-direction: row; padding: 8px 0; writing-mode: unset; }
  .transfer-arrow { writing-mode: unset; transform: none; }
}
.transfer-note { font-size: 0.7rem; color: var(--text-dim); text-align: center; max-width: 90px; }

/* ── SUMMARY ── */
.plaintext-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}
.plaintext-summary h3 { font-size: 1.1rem; margin-bottom: 24px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.summary-col ul { list-style: none; }
.summary-col ul li { font-size: 0.85rem; color: var(--text-muted); padding: 6px 0; border-bottom: 1px solid var(--border); }
.summary-col ul li:last-child { border-bottom: none; }
.summary-head { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; padding: 6px 10px; border-radius: 6px; margin-bottom: 12px; display: inline-block; }
.plain-head { background: rgba(251,191,36,0.15); color: var(--yellow); }
.cipher-head { background: rgba(56,189,248,0.15); color: var(--accent); }
.never-head { background: rgba(248,113,113,0.15); color: var(--red); }

/* ── KEY MANAGEMENT ── */
.key-arch { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
@media (max-width: 640px) { .key-arch { grid-template-columns: 1fr; } }
.tier-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 10px; }
.key-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}
.key-card h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 16px; }
.key-item { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.key-item:last-child { border-bottom: none; }
.key-type {
  font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; display: inline-block; width: fit-content;
}
.key-type.pub { background: rgba(129,140,248,0.2); color: var(--accent2); }
.key-type.sec { background: rgba(52,211,153,0.2); color: var(--green); }
.key-type.rot { background: rgba(251,191,36,0.2); color: var(--yellow); }
.key-type.tenant { background: rgba(56,189,248,0.2); color: var(--accent); }
.key-item code { font-size: 0.78rem; margin-top: 2px; }
.key-desc { font-size: 0.8rem; color: var(--text-muted); }
.key-note {
  background: rgba(251,191,36,0.06);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: 10px;
  padding: 20px 24px;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.key-note strong { color: var(--yellow); }

/* ── OPENAI SECTION ── */
.openai-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 40px; }
.openai-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  transition: border-color .2s;
}
.openai-card:hover { border-color: var(--accent); }
.openai-icon { font-size: 2rem; margin-bottom: 12px; }
.openai-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.openai-card p { font-size: 0.875rem; color: var(--text-muted); line-height: 1.65; }

.embedding-vs {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}
.ev-title { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.1em; }
.ev-row { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.ev-label { min-width: 160px; font-size: 0.82rem; color: var(--text-muted); }
.ev-bar { flex: 1; display: flex; height: 32px; border-radius: 6px; overflow: hidden; }
.ev-segment {
  display: flex; align-items: center; padding: 0 10px;
  font-size: 0.72rem; font-weight: 500; white-space: nowrap; overflow: hidden;
}
.bad-seg { background: rgba(248,113,113,0.2); color: #fca5a5; }
.good-seg { background: rgba(251,191,36,0.2); color: var(--yellow); }
.cipher-seg { background: rgba(56,189,248,0.2); color: var(--accent); }

/* ── DEMO CTA ── */
.demo-cta-card {
  display: flex; align-items: center; justify-content: space-between; gap: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  padding: 36px 40px;
  flex-wrap: wrap;
}
.demo-cta-left { flex: 1; min-width: 280px; }
.demo-cta-steps {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px;
}
.demo-cta-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; font-weight: 600; color: var(--text-muted);
}
.demo-cta-num {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--grad-start), var(--grad-end));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 800; color: #000;
}
.demo-cta-arrow { color: var(--border-bright); font-size: 1rem; }
.demo-cta-desc { font-size: 0.9rem; color: var(--text-muted); line-height: 1.65; }
.demo-cta-btn { white-space: nowrap; font-size: 1rem; padding: 16px 32px; flex-shrink: 0; }

/* ── TECH GRID ── */
.tech-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.tech-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  transition: border-color .2s, transform .2s;
}
.tech-item:hover { border-color: var(--accent); transform: translateY(-3px); }
.tech-logo { font-size: 2rem; margin-bottom: 10px; }
.tech-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; }
.tech-role { font-size: 0.75rem; color: var(--text-muted); line-height: 1.5; }

/* ── FOOTER ── */
.footer {
  background: var(--bg-dark);
  border-top: 1px solid var(--border);
  padding: 60px 0 24px;
}
.footer-inner { display: flex; gap: 48px; margin-bottom: 48px; flex-wrap: wrap; }
.footer-brand { flex: 1; min-width: 200px; }
.footer-brand p { color: var(--text-muted); font-size: 0.875rem; margin-top: 10px; line-height: 1.6; }
.footer-links { display: flex; gap: 48px; flex-wrap: wrap; }
.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-col h4 { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.footer-col a { font-size: 0.875rem; color: var(--text-dim); text-decoration: none; transition: color .2s; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero-content { animation: fadeInUp .8s ease both; }

@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}
