/* =========================================
   NT Clinical Insight · main.css
   NeuroThrottle — Clinical-Premium Design
   ========================================= */

:root {
  --navy: #0A2342;
  --navy-mid: #0E3060;
  --blue: #1565C0;
  --blue-light: #1976D2;
  --azure: #42A5F5;
  --azure-pale: #E3F2FD;
  --white: #FFFFFF;
  --off-white: #F8FAFB;
  --surface: #F0F4F8;
  --border: #D9E4EE;
  --border-dark: #B0C4D8;
  --text: #0D1B2A;
  --text-mid: #2C4A6E;
  --text-muted: #6B8CAE;
  --green: #00897B;
  --green-light: #E0F2F1;
  --amber: #F57C00;
  --amber-light: #FFF3E0;
  --red: #C62828;
  --red-light: #FFEBEE;
  --ok: #2E7D32;
  --shadow-sm: 0 1px 4px rgba(10,35,66,0.08);
  --shadow-md: 0 4px 16px rgba(10,35,66,0.10);
  --shadow-lg: 0 12px 40px rgba(10,35,66,0.14);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--off-white);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  overflow-x: hidden;
}

/* ---- HEADER ---- */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 64px;
}
.header-inner {
  max-width: 1300px; margin: 0 auto; padding: 0 32px;
  height: 100%; display: flex; align-items: center; gap: 32px;
}
.logo-group { display: flex; align-items: center; gap: 12px; }
.logo-cube {
  width: 36px; height: 36px; background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-family: 'DM Mono', monospace;
  font-size: 13px; font-weight: 500; letter-spacing: -0.5px;
}
.logo-cube.sm { width: 28px; height: 28px; font-size: 11px; border-radius: 6px; }
.logo-n { color: #FF7043; }
.logo-t { color: #FFFFFF; }
.logo-title { display: block; font-weight: 600; font-size: 15px; color: var(--navy); line-height: 1.1; }
.logo-sub { display: block; font-size: 11px; color: var(--text-muted); letter-spacing: 0.02em; }
.header-nav { display: flex; align-items: center; gap: 28px; margin-left: auto; }
.header-nav a { text-decoration: none; color: var(--text-mid); font-size: 14px; font-weight: 500; transition: color 0.2s; }
.header-nav a:hover { color: var(--navy); }
.nav-cta {
  background: var(--navy); color: var(--white) !important;
  padding: 8px 18px; border-radius: 20px; font-size: 13px !important;
  transition: background 0.2s !important;
}
.nav-cta:hover { background: var(--blue-light) !important; }
.header-status { display: flex; align-items: center; gap: 8px; padding-left: 24px; border-left: 1px solid var(--border); }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(0,137,123,0.2);
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 3px rgba(0,137,123,0.2); }
  50% { box-shadow: 0 0 0 6px rgba(0,137,123,0.08); }
}
.status-label { font-size: 12px; color: var(--green); font-weight: 500; }

/* ---- HERO ---- */
.hero {
  position: relative; padding: 140px 32px 80px;
  min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center; overflow: hidden;
  background: linear-gradient(160deg, #ffffff 0%, #EBF4FF 50%, #DCE9F7 100%);
}
.hero-bg {
  position: absolute; inset: 0; pointer-events: none;
}
#ecg-canvas { width: 100%; height: 100%; opacity: 0.18; }

.hero-content {
  position: relative; max-width: 700px; margin: 0 auto;
  text-align: center; animation: fadeUp 0.8s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-badge {
  display: inline-block; margin-bottom: 24px;
  background: var(--azure-pale); border: 1px solid var(--azure);
  color: var(--blue); padding: 6px 16px; border-radius: 20px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
}
.hero-title {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(36px, 5vw, 58px); line-height: 1.15;
  color: var(--navy); margin-bottom: 20px;
}
.hero-title em { font-style: italic; color: var(--blue-light); }
.hero-sub { color: var(--text-mid); font-size: 17px; line-height: 1.7; margin-bottom: 36px; }
.hero-actions { display: flex; gap: 16px; justify-content: center; }
.btn-primary {
  background: var(--navy); color: var(--white); padding: 13px 28px;
  border-radius: 28px; text-decoration: none; font-weight: 600; font-size: 15px;
  transition: all 0.2s; box-shadow: var(--shadow-md);
  border: none; cursor: pointer; display: inline-block;
}
.btn-primary:hover { background: var(--blue-light); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-primary.full-w { width: 100%; text-align: center; margin-top: 8px; }
.btn-ghost {
  color: var(--navy); border: 2px solid var(--navy); padding: 11px 28px;
  border-radius: 28px; text-decoration: none; font-weight: 600; font-size: 15px;
  transition: all 0.2s;
}
.btn-ghost:hover { background: var(--navy); color: var(--white); }

.hero-metrics {
  position: relative; display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; max-width: 800px; margin: 60px auto 0;
  animation: fadeUp 0.9s 0.2s ease both;
}
.metric-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 16px;
  text-align: center; box-shadow: var(--shadow-sm);
}
.metric-val { display: block; font-family: 'DM Mono', monospace; font-size: 28px; font-weight: 500; color: var(--navy); }
.metric-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-top: 4px; display: block; }

/* ---- PIPELINE SECTION ---- */
.pipeline-section {
  padding: 80px 32px; max-width: 1400px; margin: 0 auto;
}
.section-label {
  font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 500;
  color: var(--blue); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 12px;
}
.section-title {
  font-family: 'Instrument Serif', serif; font-size: clamp(26px, 3vw, 36px);
  color: var(--navy); margin-bottom: 12px; line-height: 1.2;
}
.section-title.centered { text-align: center; }
.section-desc { color: var(--text-mid); font-size: 16px; max-width: 680px; margin-bottom: 48px; line-height: 1.7; }
.section-desc.centered { text-align: center; margin: 0 auto 48px; }

.pipeline-container {
  display: grid; grid-template-columns: 1fr 220px 1fr;
  gap: 24px; align-items: start;
}

.arch-group { display: flex; flex-direction: column; gap: 4px; }
.arch-group-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 12px; padding-left: 4px;
}
.arch-nodes { display: flex; flex-direction: column; gap: 0; }

.arch-node {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow-sm); transition: box-shadow 0.2s, border-color 0.2s;
  animation: nodeIn 0.4s ease both;
}
.arch-node:hover { box-shadow: var(--shadow-md); border-color: var(--border-dark); }
.arch-node.final { border-color: var(--navy); background: linear-gradient(135deg, #f0f6ff, white); }

@keyframes nodeIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.node-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.node-num {
  font-family: 'DM Mono', monospace; font-size: 11px;
  color: var(--text-muted); font-weight: 500; flex-shrink: 0;
}
.node-name { font-weight: 600; font-size: 14px; color: var(--navy); flex: 1; }
.node-badge {
  font-size: 10px; font-weight: 700; padding: 3px 8px;
  border-radius: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--surface); color: var(--text-muted);
  transition: all 0.3s;
}
.node-badge.active { background: var(--green-light); color: var(--green); }
.node-badge.secure { background: #E8F5E9; color: #2E7D32; }
.node-badge.processing { background: var(--azure-pale); color: var(--blue); }
.node-badge.final-badge { background: var(--navy); color: white; }

.node-body { font-size: 13px; }
.node-detail { color: var(--text-mid); margin-bottom: 3px; }
.node-detail strong { color: var(--text); }
.ok { color: var(--ok) !important; }

.node-bar {
  height: 3px; background: var(--surface); border-radius: 2px;
  margin-top: 10px; overflow: hidden;
}
.node-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--azure), var(--blue));
  border-radius: 2px; transition: width 1.5s ease;
}
.processing-bar {
  background: linear-gradient(90deg, var(--azure), var(--blue-light));
  position: relative; overflow: hidden;
}

.node-connector {
  height: 20px; width: 2px; background: linear-gradient(var(--border), var(--azure));
  margin: 0 auto; opacity: 0.5;
}

.signal-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px;
}
.signal-item { display: flex; justify-content: space-between; align-items: center; }
.sig-label { font-size: 12px; color: var(--text-muted); }
.sig-val {
  font-family: 'DM Mono', monospace; font-size: 12px;
  color: var(--navy); font-weight: 500;
}

/* ---- POSM CENTER ---- */
.posm-center {
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; position: sticky; top: 80px;
}
.posm-ring-container { position: relative; width: 160px; height: 160px; }
.posm-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface); stroke-width: 12; }
.ring-fill {
  fill: none; stroke: var(--azure); stroke-width: 12;
  stroke-linecap: round; transition: stroke-dashoffset 1.5s ease, stroke 0.5s;
}
.posm-center-text {
  position: absolute; inset: 0; display: flex;
  flex-direction: column; align-items: center; justify-content: center;
}
.posm-score {
  font-family: 'DM Mono', monospace; font-size: 32px;
  font-weight: 500; color: var(--navy); line-height: 1;
}
.posm-label { font-size: 10px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.06em; margin-top: 4px; }

.posm-vars { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.posm-var { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.posm-var > span:first-child { width: 28px; font-family: 'DM Mono', monospace; font-size: 11px; }
.pv-bar { flex: 1; height: 6px; background: var(--surface); border-radius: 3px; overflow: hidden; }
.pv-fill { height: 100%; background: linear-gradient(90deg, var(--azure), var(--blue)); border-radius: 3px; width: 0%; transition: width 1.5s ease; }
.pv-val { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--navy); width: 30px; text-align: right; }

.posm-action-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; width: 100%; text-align: center;
  transition: all 0.4s;
}
.action-label { display: block; font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.action-result { display: block; font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-mid); }

/* ---- API SLOTS ---- */
.api-slots { display: flex; flex-direction: column; gap: 5px; }
.api-slot {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 500; color: var(--text-mid);
  padding: 5px 8px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  transition: all 0.3s;
}
.api-slot.ext { border-style: dashed; }
.slot-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--border-dark); flex-shrink: 0; transition: all 0.3s;
}
.api-slot.live { background: var(--green-light); border-color: var(--green); color: var(--ok); }
.api-slot.live .slot-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(0,137,123,0.2); }

/* ---- COPILOT ---- */
.copilot-preview {
  font-size: 12px; color: var(--text-muted); font-style: italic;
  line-height: 1.6; min-height: 50px; transition: all 0.4s;
}
.copilot-preview.active { color: var(--text); font-style: normal; }

/* ---- CHAT ---- */
.chat-preview { display: flex; flex-direction: column; gap: 8px; }
.chat-msg { display: flex; flex-direction: column; gap: 2px; }
.chat-msg.self { align-items: flex-end; }
.chat-from { font-size: 10px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.03em; }
.chat-text {
  background: var(--surface); border: 1px solid var(--border);
  padding: 7px 10px; border-radius: 8px; font-size: 12px; color: var(--text-mid);
  max-width: 90%;
}
.chat-msg.self .chat-text { background: var(--azure-pale); border-color: var(--azure); }

/* ---- POSM DETAIL ---- */
.posm-detail-section {
  background: var(--navy); padding: 80px 32px; color: white;
}
.posm-detail-inner {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: start;
}
.posm-detail-section .section-title { color: white; }
.posm-detail-section .section-desc { color: rgba(255,255,255,0.65); }
.posm-detail-section .section-desc em { color: var(--azure); font-style: italic; }

.posm-thresholds { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; }
.threshold-row {
  display: grid; grid-template-columns: 100px 90px 1fr;
  align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: var(--radius-sm); font-size: 13px;
}
.t-range { font-family: 'DM Mono', monospace; font-size: 12px; color: rgba(255,255,255,0.7); }
.t-status { font-weight: 700; }
.t-action { font-family: 'DM Mono', monospace; font-size: 11px; opacity: 0.7; }
.t-stable { background: rgba(0,137,123,0.2); } .t-stable .t-status { color: #80CBC4; }
.t-monitor { background: rgba(66,165,245,0.2); } .t-monitor .t-status { color: #90CAF9; }
.t-alert { background: rgba(245,124,0,0.2); } .t-alert .t-status { color: #FFCC02; }
.t-critical { background: rgba(198,40,40,0.15); } .t-critical .t-status { color: #EF9A9A; }
.t-collapse { background: rgba(198,40,40,0.30); } .t-collapse .t-status { color: #EF5350; }

/* ---- CODE BLOCK ---- */
.code-block {
  background: #0D1B2A; border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.code-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; border-bottom: 1px solid rgba(255,255,255,0.08);
  font-family: 'DM Mono', monospace; font-size: 12px; color: rgba(255,255,255,0.5);
}
.code-lang { color: var(--azure); }
.code-block pre { padding: 24px; overflow-x: auto; }
.code-block code { font-family: 'DM Mono', monospace; font-size: 13px; line-height: 1.8; color: #CBD5E1; }
.kw { color: #7C9EFF; }
.fn { color: #67E8F9; }
.num { color: #FB923C; }
.cm { color: #475569; font-style: italic; }

/* ---- DIFF TABLE ---- */
.diff-section { padding: 80px 32px; background: white; }
.diff-table {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 24px; max-width: 900px; margin: 0 auto;
}
.diff-col { border-radius: var(--radius-lg); overflow: hidden; }
.diff-col-header {
  padding: 16px 20px; font-weight: 700; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.diff-bad .diff-col-header { background: #FFEBEE; color: var(--red); }
.diff-good .diff-col-header { background: #E0F7FA; color: #00695C; }
.diff-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 20px; font-size: 14px; border-top: 1px solid var(--border);
}
.diff-bad .diff-item { background: #FFF8F8; color: #5A3030; }
.diff-good .diff-item { background: #F0FDFC; color: #1A3A38; }
.diff-icon { font-weight: 900; flex-shrink: 0; margin-top: 1px; }
.diff-icon.bad { color: var(--red); }
.diff-icon.good { color: var(--green); }

/* ---- CONTACT ---- */
.contact-section { padding: 80px 32px; background: var(--off-white); }
.contact-inner { max-width: 600px; margin: 0 auto; }
.contact-form-wrap { display: flex; flex-direction: column; gap: 12px; margin-top: 32px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-input, .form-textarea {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 16px; font-size: 14px; font-family: 'DM Sans', sans-serif;
  background: white; color: var(--text); outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21,101,192,0.1);
}
.form-textarea { min-height: 120px; resize: vertical; }

/* ---- FOOTER ---- */
.footer {
  background: var(--navy); color: rgba(255,255,255,0.6);
  padding: 40px 32px 24px;
}
.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 28px; flex-wrap: wrap; gap: 24px;
}
.footer-brand { font-weight: 600; font-size: 14px; color: rgba(255,255,255,0.8); margin-left: 10px; }
.footer-sub { font-size: 12px; margin-top: 8px; padding-left: 38px; }
.footer-right { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-right span {
  font-size: 11px; font-weight: 600; letter-spacing: 0.05em;
  padding: 5px 12px; border-radius: 12px; text-transform: uppercase;
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6);
}
.footer-line {
  max-width: 1200px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px;
  font-size: 12px; flex-wrap: wrap; gap: 8px;
}
.footer-line a { color: var(--azure); text-decoration: none; }
.footer-line a:hover { text-decoration: underline; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1100px) {
  .pipeline-container { grid-template-columns: 1fr; }
  .posm-center { flex-direction: row; flex-wrap: wrap; position: static; }
}
@media (max-width: 768px) {
  .hero-metrics { grid-template-columns: repeat(2,1fr); }
  .posm-detail-inner { grid-template-columns: 1fr; }
  .diff-table { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .header-nav { display: none; }
}
