/* UCSD Supernetwork Prototype, shared styles
   Brand: Eurekamedia affiliate visual system. White paper, charcoal body, red #0047BA accent. */

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

:root {
  --bg: #FFFFFF;
  --bg-soft: #F7F7F7;
  --bg-card: #FFFFFF;
  --text: #2D2D2D;
  --text-dim: #555;
  --text-muted: #888;
  --accent: #0047BA;
  --border: #E8E8E8;
  --shadow: 0 2px 16px rgba(0,0,0,.06);
  --radius-sm: 8px;
  --radius: 14px;
}

html, body {
  font-family: 'Red Hat Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

a { color: inherit; text-decoration: none; }

img, svg { max-width: 100%; height: auto; display: block; }

/* Page header (shared) */
.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.page-header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px clamp(16px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-header-logo img { height: 22px; width: auto; }
.page-header-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.page-header-eyebrow .sep {
  color: var(--border);
  margin: 0 8px;
  letter-spacing: 0;
}
.back-to-deck {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: color .15s ease, border-color .15s ease;
}
.back-to-deck:hover { color: var(--accent); border-color: var(--accent); }
.ai-notice {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
}
.ai-notice strong { color: var(--text-dim); font-weight: 600; }
.chat-emergency {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.4;
  font-weight: 500;
  color: #8A1C1C;
  background: #FBEDED;
  border: 1px solid #E7C3C3;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  margin-bottom: 12px;
}
.chat-emergency svg { flex: 0 0 auto; }
.chat-emergency strong { font-weight: 700; }
.spec-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
  max-width: 1140px;
}
.spec-tile {
  display: flex;
  flex-direction: row;
  align-items: center;
  text-align: left;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.spec-tile:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}
.spec-tile-photo {
  width: 88px;
  height: 88px;
  border-radius: 14px;
  flex-shrink: 0;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 26px;
  color: var(--accent);
  overflow: hidden;
}
.spec-tile-photo img { width: 100%; height: 100%; object-fit: cover; }
.spec-tile-body { display: flex; flex-direction: column; min-width: 0; }
.spec-tile-name { font-weight: 800; font-size: 16px; color: var(--text); letter-spacing: -0.2px; line-height: 1.2; }
.spec-tile-spec { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.35; }
.spec-tile-cta { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-top: 10px; }
@media (max-width: 560px) { .spec-tiles { grid-template-columns: 1fr; } }

/* Brand */
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.rule {
  width: 48px; height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin: 14px 0 20px;
}

h1, h2, h3, h4 { font-weight: 800; letter-spacing: -.02em; color: var(--text); }
h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.08; }
h2 { font-size: clamp(22px, 3.6vw, 32px); line-height: 1.15; }
h3 { font-size: clamp(17px, 2.4vw, 21px); }
p  { color: var(--text-dim); }
.lede { font-size: clamp(15px, 2vw, 18px); color: var(--text-dim); max-width: 640px; line-height: 1.6; }

/* Layout */
.shell {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) clamp(16px, 4vw, 32px) 120px;
}
.shell-wide { max-width: 1180px; }

/* Hero block */
.hero { padding-top: clamp(20px, 4vw, 40px); }
.hero h1 { margin-top: 8px; }
.hero p.lede { margin-top: 18px; }

/* Chat */
.chat {
  margin-top: clamp(28px, 4vw, 40px);
  background: var(--bg-soft);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: clamp(18px, 3vw, 24px);
}
.chat-stream {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}
.bubble {
  padding: 12px 16px;
  border-radius: 14px;
  max-width: 90%;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bubble.bot {
  background: #fff;
  border: 1px solid var(--border);
  align-self: flex-start;
  border-top-left-radius: 6px;
}
.bubble.user {
  background: var(--text);
  color: #fff;
  align-self: flex-end;
  border-top-right-radius: 6px;
}
.bubble.system {
  background: var(--accent);
  color: #fff;
  align-self: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 999px;
}
.bubble.typing {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-muted);
  align-self: flex-start;
  font-style: italic;
}

.chat-input {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-input textarea {
  flex: 1;
  resize: none;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  min-height: 48px;
  max-height: 160px;
}
.chat-input textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(204,32,39,.12);
}
.chat-input button {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .15s ease;
  min-height: 48px;
  white-space: nowrap;
}
.chat-input button:hover { opacity: .88; }
.chat-input button:disabled { opacity: .4; cursor: default; }

.disclaimer {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Specialist match cards (rendered after triage decides) */
.matches {
  margin-top: 32px;
  display: grid;
  gap: 16px;
}
@media (min-width: 720px) { .matches { grid-template-columns: 1fr 1fr 1fr; } }

.match-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, border-color .15s ease;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.match-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.match-rank {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}
.match-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.01em;
  color: var(--text);
}
.match-subspec {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .02em;
}
.match-reason {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.55;
}
.match-cta {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Specialist intake header */
.specialist-header {
  padding: clamp(20px, 4vw, 40px) 0 clamp(16px, 3vw, 28px);
  border-bottom: 1px solid var(--border);
  margin-bottom: clamp(20px, 4vw, 32px);
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 24px);
}
.specialist-photo {
  width: clamp(56px, 10vw, 84px);
  height: clamp(56px, 10vw, 84px);
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  overflow: hidden;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: -.02em;
}
.specialist-photo img { width: 100%; height: 100%; object-fit: cover; }
.specialist-name { font-weight: 800; font-size: clamp(20px, 3vw, 26px); letter-spacing: -.02em; }
.specialist-subtitle { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

.triage-context {
  background: var(--bg-soft);
  border-left: 4px solid var(--accent);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 18px;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
}
.triage-context-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
  display: block;
}

/* Lead form */
.lead-form {
  margin-top: 20px;
  padding: 22px 20px;
  background: #fff;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
}
.lead-form h3 { margin-bottom: 4px; }
.lead-form .lead-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 18px; }
.lead-form-row {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}
@media (min-width: 560px) {
  .lead-form-row.two-col { grid-template-columns: 1fr 1fr; }
}
.lead-form label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.lead-form input, .lead-form select {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.lead-form input:focus, .lead-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(204,32,39,.12);
}
.lead-form button {
  margin-top: 10px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  width: 100%;
}
.lead-form button:hover { opacity: .9; }

.lead-success {
  margin-top: 20px;
  padding: 22px 20px;
  background: var(--bg-soft);
  border-left: 4px solid #009578;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.lead-success h3 { color: #009578; margin-bottom: 6px; }
.lead-success p { color: var(--text-dim); font-size: 14px; }

/* Referral suggestion banner (from specialist chat) */
.refer-banner {
  margin-top: 16px;
  padding: 18px 20px;
  background: #fff;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
}
.refer-banner-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
  display: block;
}
.refer-banner h4 { margin-bottom: 8px; font-size: 17px; }
.refer-banner p { font-size: 14px; color: var(--text-dim); margin-bottom: 12px; }
.refer-banner a {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Corner Eurekamedia logo (every page) */
.em-corner {
  position: fixed;
  bottom: 14px;
  right: 18px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
}
.em-corner img { height: 18px; width: auto; display: block; }
@media (max-width: 600px) {
  .em-corner { bottom: 10px; right: 12px; }
  .em-corner img { height: 14px; }
}

/* Admin */
.admin-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}
@media (min-width: 720px) {
  .admin-row { grid-template-columns: 1.4fr 1fr 0.8fr 0.6fr; align-items: center; }
}
.admin-row .col-summary { font-size: 14px; color: var(--text); }
.admin-row .col-summary .label { font-size: 11px; color: var(--text-muted); display: block; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; margin-bottom: 2px; }
.admin-row .col-specialist { font-size: 13px; font-weight: 700; color: var(--text); }
.admin-row .col-time { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pill.new { background: rgba(204,32,39,.12); color: var(--accent); }
.pill.review { background: rgba(180,83,9,.14); color: #B45309; }
.pill.scheduled { background: rgba(26,127,55,.14); color: #009578; }
.pill.referred { background: rgba(45,45,45,.08); color: var(--text); }

.preview-banner {
  background: #FFF8E1;
  border: 1px solid #F1D27B;
  color: #6B4F00;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 20px;
}

/* balanced-text: no orphans/widows */
h1,h2,h3,.headline,.dname,.lede,.cred-line,.section-sub,.section-head,.note,.proposed,footer,.eyebrow,.section-eyebrow,.vname{text-wrap:balance}
p,.bio-p,.dtitle,.one,blockquote,.pub-list .pt,.form-note,.vdesc,.inprog,.exp-note{text-wrap:pretty}
