/* ═══════════════════════════════════════════════
   mathewjohnson.ai — Clinical Design System
   Chart paper cream · Vitals red · Medical precision
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;500&family=IBM+Plex+Sans:wght@300;400;500;600&family=IBM+Plex+Serif:ital,wght@0,400;0,500;1,400&display=swap');

/* ── Tokens ── */
:root {
  /* Chart paper palette */
  --bg:          #f5f0e8;
  --bg-2:        #ede8df;
  --bg-card:     #faf7f2;
  --bg-header:   #f0ebe2;

  /* Ink */
  --text:        #1a1510;
  --text-2:      #3d3628;
  --text-3:      #8a7f6e;

  /* Borders — ruled line feel */
  --border:      #d8d0c0;
  --border-2:    #c8bfae;

  /* Vitals red */
  --red:         #9b2335;
  --red-dim:     #c0394d;
  --red-glow:    rgba(155, 35, 53, 0.06);

  /* Clinical teal — secondary only */
  --teal:        #2a7a6e;
  --blue:        #2a5a8a;
  --blue-dim:    #3a6a9a;
  --blue-glow:   rgba(42, 90, 138, 0.06);

  /* Typography */
  --display:     'IBM Plex Sans', sans-serif;
  --body:        'IBM Plex Sans', sans-serif;
  --mono:        'IBM Plex Mono', monospace;
  --serif:       'IBM Plex Serif', serif;

  /* Layout */
  --radius:      2px;
  --wrap:        1160px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Subtle grid — like ruled chart paper */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: repeating-linear-gradient(
    transparent,
    transparent 27px,
    rgba(155, 35, 53, 0.04) 27px,
    rgba(155, 35, 53, 0.04) 28px
  );
  pointer-events: none;
  z-index: 0;
}

/* ── Sticky Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-id {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-name {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.nav-tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--red);
  letter-spacing: 0.06em;
}

.nav-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.08em;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  animation: pulse 2.5s ease-in-out infinite;
}

/* ── Footer ── */
.site-footer {
  padding: 28px 0;
  border-top: 1px solid var(--border);
}

.footer-left {
  display: flex;
  gap: 24px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Utilities ── */
.wrap-wide { max-width: var(--wrap); }

/* ── Animations ── */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.85); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Product links ── */
.product-link {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  text-decoration: none;
  background: var(--bg-card);
  transition: border-color 0.2s, background 0.2s;
}

.product-link:hover {
  border-color: var(--red);
  background: var(--red-glow);
}

.product-link-name {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}

.product-link-desc {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
  margin-bottom: 8px;
}

.product-link-arrow {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--red);
  letter-spacing: 0.06em;
}

/* ── CV Items (accordion) ── */
.cv-items {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

.cv-item {
  border-bottom: 1px solid var(--border);
}

.cv-item:last-child { border-bottom: none; }

.cv-item-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
  gap: 16px;
}

.cv-item-trigger:hover { background: var(--red-glow); }

.cv-item-trigger[aria-expanded="true"] { background: var(--red-glow); }

.cv-item-left {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.cv-item-num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--red);
  letter-spacing: 0.1em;
  padding-top: 2px;
  flex-shrink: 0;
}

.cv-item-title {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
}

.cv-item-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

.cv-item-plus {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--text-3);
  flex-shrink: 0;
  transition: transform 0.2s, color 0.2s;
}

.cv-item-trigger[aria-expanded="true"] .cv-item-plus {
  transform: rotate(45deg);
  color: var(--red);
}

.cv-item-body {
  display: none;
  padding: 0 24px 20px 56px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.8;
  animation: fadeUp 0.2s ease forwards;
}

.cv-item-body.open { display: block; }

.cv-item-body p { margin-bottom: 10px; }
.cv-item-body p:last-child { margin-bottom: 0; }
.cv-item-body strong { color: var(--text); font-weight: 500; }

/* Stats row inside cv items */
.stat-row {
  display: flex;
  gap: 32px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 12px 0;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
  color: var(--red);
  letter-spacing: -0.02em;
}

.stat-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Flagship build badge */
.flagship-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--red);
  padding: 3px 8px;
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.flagship-header {
  margin-bottom: 4px;
}

.flagship-title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.flagship-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.06em;
}

/* Nursing block */
.nursing-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 24px 28px;
}

.nursing-title {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.nursing-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--red);
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.nursing-body {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.8;
}

.nursing-body p { margin-bottom: 10px; }
.nursing-body p:last-child { margin-bottom: 0; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }


/* ═══════════════════════════════════════════════
   SOAP Demo — Page-specific styles
   Extends the Clinical Design System
   ═══════════════════════════════════════════════ */

/* ── SOAP token overrides — darker cream ── */
:root {
  --bg:        #ddd5c0;
  --bg-2:      #d4cbb5;
  --bg-card:   #e6dece;
  --bg-header: #d6ccb8;
  --border:    #bfb49e;
  --border-2:  #b0a48e;
}

/* ── Header ── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  max-width: 860px;
  margin: 0 auto;
}

/* ── Layout ── */
.wrapper {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* ── Hero ── */
.hero {
  margin-bottom: 40px;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 400;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 12px;
}

.hero h1 em {
  color: var(--red);
  font-style: italic;
}

.hero p {
  font-size: 14px;
  color: var(--text-3);
  max-width: 520px;
  line-height: 1.7;
}

/* ── Laws strip ── */
.laws {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 36px;
  overflow: hidden;
}

.law {
  background: var(--bg-card);
  padding: 14px 16px;
  transition: background 0.2s;
}

.law:hover { background: var(--red-glow); }

.law-num {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--red);
  letter-spacing: 0.15em;
  margin-bottom: 5px;
}

.law-text {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.5;
}

/* ── Input ── */
.input-block { margin-bottom: 24px; }

.field-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

textarea {
  width: 100%;
  min-height: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.7;
  padding: 18px 20px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

textarea::placeholder { color: var(--border-2); }
textarea:focus { border-color: var(--red); background: #fff; }

.char-count {
  text-align: right;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--border-2);
  margin-top: 6px;
}

.char-count.warn { color: var(--red); }

/* ── Generate button ── */
.btn-generate {
  width: 100%;
  padding: 16px 24px;
  background: var(--red-glow);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--red);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.btn-generate:hover:not(:disabled) {
  background: var(--red);
  color: var(--bg);
  border-color: var(--red);
}

.btn-generate:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-generate.loading::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: var(--red);
  animation: progress 1.8s ease-in-out infinite;
}

@keyframes progress {
  0%   { left: -100%; }
  100% { left: 100%; }
}

/* ── Output ── */
.output-block {
  margin-top: 32px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.output-block.visible { opacity: 1; transform: translateY(0); }

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.output-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 28px 32px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 2;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.soap-section-header {
  color: var(--red);
  font-weight: 500;
  letter-spacing: 0.1em;
  display: block;
  margin-top: 4px;
}

/* ── Export button ── */
.btn-export {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-export:hover { border-color: var(--red); color: var(--red); }

/* ── Error ── */
.error-msg {
  background: rgba(155, 35, 53, 0.05);
  border: 1px solid rgba(155, 35, 53, 0.3);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--red);
  margin-top: 16px;
  display: none;
}

/* ── Footer ── */
footer {
  margin-top: 72px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

footer .note {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  max-width: 480px;
  line-height: 1.6;
}

footer .brand {
  font-family: var(--serif);
  font-size: 14px;
  font-style: italic;
  color: var(--border-2);
  white-space: nowrap;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .laws { grid-template-columns: repeat(2, 1fr); }
  .header-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  footer { flex-direction: column; align-items: flex-start; }
}


/* ═══════════════════════════════════════════════
   Dual-Phase Comparison Panel
   ═══════════════════════════════════════════════ */

/* Widen wrapper for side-by-side */
.wrapper {
  max-width: 1280px !important;
}

.header-inner {
  max-width: 1280px !important;
}

/* ── Compare header ── */
.dual-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 16px;
  flex-wrap: wrap;
}

.dual-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dual-hint {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

/* ── Side-by-side grid ── */
.dual-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

/* ── Individual phase panel ── */
.phase-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color 0.25s, opacity 0.25s, box-shadow 0.25s;
}

.phase-panel.is-selected {
  border-color: var(--red);
  box-shadow: 0 0 0 1px var(--red);
}

.phase-panel.is-dimmed {
  opacity: 0.45;
}

/* ── Phase panel header ── */
.phase-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  gap: 12px;
}

.phase-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.phase-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.08em;
}

.phase-desc {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-3);
  letter-spacing: 0.06em;
}

.phase-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ── Use This button ── */
.btn-select {
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-select:hover {
  border-color: var(--red);
  color: var(--red);
}

.btn-select.selected {
  background: var(--red);
  border-color: var(--red);
  color: var(--bg);
}

/* ── Small PDF button ── */
.btn-export-small {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-export-small:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ── Output panel inside phase ── */
.phase-panel .output-panel {
  border: none;
  border-left: 3px solid transparent;
  border-radius: 0;
  transition: border-color 0.25s;
}

.phase-panel.is-selected .output-panel {
  border-left-color: var(--red);
}

/* Bracket additions highlight (Phase 2) */
.bracket-addition {
  color: var(--blue);
  font-style: italic;
}

/* ── Export bar ── */
.export-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 14px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.export-bar.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.export-bar-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.06em;
}

/* ── Responsive ── */
@media (max-width: 860px) {
  .dual-panels {
    grid-template-columns: 1fr;
  }
}


/* ═══════════════════════════════════════════════
   Format Toggle — SOAP / SBAR pill switch
   ═══════════════════════════════════════════════ */

.generate-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 0;
}

/* Pill toggle container */
.format-toggle {
  position: relative;
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}

/* Sliding pill background */
.toggle-pill {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: var(--red);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 0;
}

.toggle-btn {
  position: relative;
  z-index: 1;
  background: transparent;
  border: none;
  padding: 0 24px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.22s;
  white-space: nowrap;
}

.toggle-btn.active {
  color: var(--bg);
}

/* Generate button fills remaining space */
.btn-generate {
  flex: 1;
  margin-bottom: 0;
}
