@font-face {
  font-family: 'Chicago';
  src: url('../ChicagoFLF.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0C0C0B;
  --bg-elevated: #141413;
  --bg-surface: #1A1A18;
  --cream: #EDE8DF;
  --cream-dim: rgba(237, 232, 223, 0.5);
  --cream-ghost: rgba(237, 232, 223, 0.06);
  --accent: #74418F;
  --accent-dim: rgba(116, 65, 143, 0.12);
  --accent-glow: rgba(116, 65, 143, 0.3);
  --red: #E63926;
  --green: #2ECC71;
  --green-dim: rgba(46, 204, 113, 0.1);
  --border: rgba(237, 232, 223, 0.06);
  --border-strong: rgba(237, 232, 223, 0.1);

  /* Pain card gradient: lightest → darkest (dark mode) */
  --pain-step-0: var(--bg-surface);
  --pain-step-1: var(--bg-elevated);
  --pain-step-2: var(--bg);

  /* Mono size tiers */
  --mono-xs: 0.7rem;
  --mono-sm: 0.75rem;
  --mono-md: 0.8rem;
  --mono-lg: 0.85rem;
}

/* ========== LIGHT THEME ========== */
[data-theme="light"] {
  --bg: #F5F3EF;
  --bg-elevated: #FFFFFF;
  --bg-surface: #EDEAE4;
  --cream: #1A1A18;
  --cream-dim: rgba(26, 26, 24, 0.55);
  --cream-ghost: rgba(26, 26, 24, 0.06);
  --accent: #74418F;
  --accent-dim: rgba(116, 65, 143, 0.08);
  --accent-glow: rgba(116, 65, 143, 0.15);
  --red: #E63926;
  --green: #1B9E52;
  --green-dim: rgba(27, 158, 82, 0.1);
  --border: rgba(26, 26, 24, 0.08);
  --border-strong: rgba(26, 26, 24, 0.15);

  /* Pain card gradient: lightest → darkest (light mode) */
  --pain-step-0: var(--bg-elevated);
  --pain-step-1: var(--bg);
  --pain-step-2: var(--bg-surface);
}

[data-theme="light"] ::selection {
  color: #FFFFFF;
}

/* Light mode: soften scanlines */
[data-theme="light"] body::before {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.015) 2px,
    rgba(0,0,0,0.015) 4px
  );
}

/* Light mode: reduce noise */
[data-theme="light"] body::after {
  opacity: 0.3;
}

/* Light mode: hero dots */
[data-theme="light"] .hero-dots {
  background-image: radial-gradient(circle, rgba(26,26,24,0.06) 1px, transparent 1px);
}


/* Light mode: chat frame container adjustments */
[data-theme="light"] .chat-frame {
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 60px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Light mode: button hover */
[data-theme="light"] .btn-main {
  color: #FFFFFF;
}
[data-theme="light"] .btn-main:hover {
  background: #9563AF;
}

/* Light mode: footer */
[data-theme="light"] .foot-left {
  color: rgba(26,26,24,0.3);
}
[data-theme="light"] .foot-right a {
  color: rgba(26,26,24,0.3);
}
[data-theme="light"] .foot-right a:hover {
  color: rgba(26,26,24,0.6);
}

/* Light mode: hero glyph */
[data-theme="light"] .hero-glyph {
  color: var(--cream);
  opacity: 0.03;
}

/* Light mode: status dot glow */
[data-theme="light"] .status-dot {
  box-shadow: 0 0 6px var(--green);
}

/* ========== THEME TOGGLE ========== */
.theme-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--cream);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.3s, transform 0.3s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.1);
}

/* will-change hints for scrub-animated elements */
.hero-content,
.hero-glyph,
.arch-header-num {
  will-change: transform;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--cream);
  font-family: 'Space Grotesk', sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* ========== SCANLINES + NOISE — CRT texture ========== */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
  pointer-events: none;
  z-index: 10000;
}

body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 10001;
}

/* ========== NAV — minimal, stays out of the way ========== */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 0 2.5rem;
  height: 3.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
}

.nav-logo {
  font-family: 'Chicago', sans-serif;
  font-size: var(--mono-sm);
  letter-spacing: 0.4em;
  color: var(--cream);
  text-decoration: none;
}

.nav-right {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-right a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-md);
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--cream-dim);
  text-decoration: none;
  transition: color 0.3s;
}
.nav-right a:hover { color: var(--cream); }

/* Mobile menu toggle — hidden on desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--cream);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Body scroll lock when menu is open */
body.menu-open {
  overflow: hidden;
}

/* ========== HERO — full takeover ========== */
.hero {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 2.5rem 0;
  position: relative;
  overflow: hidden;
}

/* Massive background glyph */
.hero-glyph {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'EB Garamond', serif;
  font-size: min(65vw, 55vh);
  font-weight: 700;
  color: var(--cream);
  opacity: 0.015;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

/* Floating grid of dots */
.hero-dots {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(circle, rgba(237,232,223,0.07) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 70%);
}

/* Accent line — architectural */
.hero-accent-line {
  position: absolute;
  top: 3.25rem;
  left: 2.5rem;
  width: 2px;
  height: calc(100% - 3.25rem);
  background: var(--accent);
  transform-origin: top;
  transform: scaleY(0);
  animation: drawLine 1.5s ease-out 0.5s forwards;
  box-shadow: 0 0 20px var(--accent-glow);
  will-change: transform;
}

@keyframes drawLine {
  to { transform: scaleY(1); }
}

.hero-content {
  position: relative;
  z-index: 2;
  padding-bottom: 3rem;
  padding-left: 2rem;
}

.hero-status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-md);
  letter-spacing: 0.15em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  opacity: 0;
}

.status-dot {
  width: 5px; height: 5px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--green);
  animation: statusPulse 2.5s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--green); }
  50% { opacity: 0.4; box-shadow: 0 0 2px var(--green); }
}

.hero-headline {
  font-family: 'EB Garamond', serif;
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1.2;
  margin-bottom: 0;
}

.hero-headline h1 {
  font: inherit;
  letter-spacing: inherit;
  margin: 0;
}

.hero-headline .h-line {
  display: block;
}

.hero-headline .h-line span {
  display: block;
  opacity: 0;
  transform: translateY(100%);
}

@keyframes revealLine {
  to { opacity: 1; transform: translateY(0); }
}

/* Typewriter cursor — block caret after text */
.typewriter-cursor::after {
  content: '';
  display: inline-block;
  width: 0.5ch;
  height: 1.1em;
  background: currentColor;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 0.6s steps(1) infinite;
}

.h-large {
  font-size: clamp(4.5rem, 10vw, 9rem);
  color: var(--cream);
  min-height: 1.3em;
}

.h-italic {
  font-size: clamp(4.5rem, 10vw, 9rem);
  color: var(--accent);
  font-style: normal;
  min-height: 1.3em;
}

.h-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(0.85rem, 1.3vw, 1rem);
  font-weight: 300;
  font-style: normal;
  letter-spacing: 0.06em;
  line-height: 1.6;
  color: var(--cream-dim);
  margin-top: 0.75rem;
  margin-bottom: 0;
}

/* Hero bottom bar */
.hero-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 2.5rem 2rem 2rem;
  position: relative;
  z-index: 2;
  opacity: 0;
}

.hero-ctas {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.btn-main {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-md);
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
  padding: 1rem 2.5rem;
  background: var(--accent);
  color: var(--cream);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.3s, box-shadow 0.3s, transform 0.3s;
  position: relative;
}

.btn-main:hover {
  background: #9563AF;
  box-shadow: 0 4px 24px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-line {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-md);
  letter-spacing: 0.06em;
  line-height: 1.4;
  color: var(--cream-dim);
  text-decoration: none;
  padding: 1rem 1.5rem;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  transition: border-color 0.3s, color 0.3s;
}

.btn-line:hover {
  border-color: var(--cream-dim);
  color: var(--cream);
}

.hero-scroll-hint {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cream-dim);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0.5;
}

.scroll-line {
  width: 24px;
  height: 1px;
  background: var(--cream-dim);
  position: relative;
  overflow: hidden;
}

.scroll-line::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: var(--cream);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0% { left: -100%; }
  50% { left: 100%; }
  100% { left: 100%; }
}

/* ========== TERMINAL SECTION — the wow moment ========== */
.terminal-section {
  padding: 0 2.5rem;
  position: relative;
  z-index: 2;
}

.terminal-intro {
  padding: 6rem 0 3rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 1px solid var(--border);
}

.terminal-intro-left h2 {
  font-family: 'EB Garamond', serif;
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.terminal-intro-left h2 em {
  font-style: normal;
  color: var(--accent);
}

/* The terminal — MASSIVE, full width, the centerpiece */
.terminal-stage {
  position: relative;
  margin-bottom: 6rem;
}

.term-dots {
  display: flex;
  gap: 6px;
}

.term-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
}
.term-dot:nth-child(1) { background: #FF5F57; }
.term-dot:nth-child(2) { background: #FEBC2E; }
.term-dot:nth-child(3) { background: #28C840; }

/* ========== CHAT DEMO ========== */
.chat-frame {
  /* Scoped dark palette — chat stays dark in both themes */
  --cf-bg: #141413;
  --cf-surface: #1A1A18;
  --cf-text: #EDE8DF;
  --cf-accent: #74418F;
  --cf-green: #2ECC71;
  --cf-text-70: rgba(237, 232, 223, 0.7);
  --cf-text-50: rgba(237, 232, 223, 0.5);
  --cf-text-40: rgba(237, 232, 223, 0.4);
  --cf-text-35: rgba(237, 232, 223, 0.35);
  --cf-text-30: rgba(237, 232, 223, 0.3);
  --cf-text-25: rgba(237, 232, 223, 0.25);
  --cf-text-15: rgba(237, 232, 223, 0.15);
  --cf-border-10: rgba(237, 232, 223, 0.1);
  --cf-border-08: rgba(237, 232, 223, 0.08);
  --cf-border-06: rgba(237, 232, 223, 0.06);
  --cf-border-04: rgba(237, 232, 223, 0.04);
  --cf-border-03: rgba(237, 232, 223, 0.03);

  background: var(--cf-bg);
  color: var(--cf-text);
  border: 1px solid var(--cf-border-10);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: row;
}

.chat-content-area {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

/* Glowing accent border on top (same as old terminal) */
.chat-frame::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--cf-accent), var(--cf-accent) 30%, transparent 100%);
  opacity: 0.6;
  border-radius: 8px 8px 0 0;
}

.chat-chrome {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--cf-border-06);
  background: var(--cf-surface);
  border-radius: 8px 8px 0 0;
}

.chat-tabs {
  display: flex;
  gap: 0;
  margin-left: 2rem;
}

.chat-tab {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-md);
  letter-spacing: 0.08em;
  line-height: 1.4;
  padding: 0.4rem 1.25rem;
  color: var(--cf-text-25);
  border: 1px solid transparent;
  border-bottom: none;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  background: transparent;
}

.chat-tab.active {
  color: var(--cf-text);
  background: var(--cf-bg);
  border-color: var(--cf-border-10);
  border-bottom: 1px solid var(--cf-bg);
  margin-bottom: -1px;
}

.chat-tab:hover:not(.active) {
  color: var(--cf-text-50);
}

.chat-version {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  letter-spacing: 0.1em;
  color: var(--cf-text-15);
  margin-left: auto;
  text-transform: uppercase;
}

.chat-body {
  padding: 2rem 2.5rem 1.5rem;
  min-height: 360px;
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--cf-border-10) transparent;
}

.chat-body::-webkit-scrollbar {
  width: 4px;
}
.chat-body::-webkit-scrollbar-track {
  background: transparent;
}
.chat-body::-webkit-scrollbar-thumb {
  background: var(--cf-border-10);
  border-radius: 2px;
}

/* --- Messages --- */
.chat-msg {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.chat-msg.visible {
  opacity: 1;
  transform: translateY(0);
}

/* User messages: right-aligned bubble, no avatar */
.chat-msg.user {
  display: flex;
  justify-content: flex-end;
}

.chat-msg.user .chat-bubble {
  background: rgba(116, 65, 143, 0.15);
  border: 1px solid rgba(116, 65, 143, 0.3);
  padding: 0.75rem 1.25rem;
  border-radius: 12px 12px 2px 12px;
  max-width: 75%;
}


/* Cosimo messages: sender label + response wrapper */
.chat-sender {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.chat-sender-icon {
  color: var(--cf-accent);
  font-size: 0.9rem;
  line-height: 1;
}

.chat-sender-name {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-md);
  color: var(--cf-accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chat-response {
  padding-left: 1.35rem;
}

.chat-bubble {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--cf-text);
  font-weight: 300;
}

.chat-msg.cosimo .chat-bubble {
  background: transparent;
  max-width: 90%;
}

.chat-bubble.typing::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 1em;
  background: var(--cf-text-50);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 1s step-end infinite;
}

.chat-msg.user .chat-bubble.typing::after {
  background: var(--cf-text-40);
}

/* --- Context status bar --- */
.chat-context {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-md);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--cf-border-08);
  margin-bottom: 0.5rem;
}

.chat-context-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cf-green);
  flex-shrink: 0;
}

.chat-context-text {
  color: var(--cf-text-50);
}

.chat-context-sep {
  color: var(--cf-text-15);
  margin: 0 0.1rem;
}

.chat-context-stat {
  color: var(--cf-text-25);
}

/* --- Sources panel --- */
.chat-sources {
  margin-top: 0.75rem;
  border: 1px solid var(--cf-border-08);
  border-radius: 4px;
  overflow: hidden;
  max-width: 90%;
}

.chat-sources-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--cf-border-03);
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  color: var(--cf-text-50);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-sources-icon {
  color: var(--cf-accent);
  font-size: 0.7rem;
}

.chat-sources-list {
  display: flex;
  flex-direction: column;
}

.chat-source-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.4rem 0.75rem;
  border-top: 1px solid var(--cf-border-04);
  gap: 1rem;
}

.chat-source-file {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  color: var(--cf-text-70);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.chat-source-ref {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  color: var(--cf-text-35);
  white-space: nowrap;
  flex-shrink: 0;
}

/* --- Artifact card --- */
.chat-artifact-card {
  margin-top: 0.75rem;
  border: 1px solid rgba(46, 204, 113, 0.25);
  border-radius: 6px;
  background: rgba(46, 204, 113, 0.04);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 90%;
  transform: scale(0.97);
  cursor: pointer;
  transition: transform 0.3s ease 0.15s;
}

.chat-msg.visible .chat-artifact-card {
  transform: scale(1);
}

.chat-artifact-card:hover {
  border-color: rgba(46, 204, 113, 0.5);
  background: rgba(46, 204, 113, 0.08);
}

.chat-artifact-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.chat-artifact-file-icon {
  width: 28px;
  height: 34px;
  border: 1.5px solid var(--cf-green);
  border-radius: 1px;
  position: relative;
  flex-shrink: 0;
}

.chat-artifact-file-icon::before {
  content: '';
  position: absolute;
  top: -1.5px;
  right: -1.5px;
  width: 10px;
  height: 10px;
  background: var(--cf-bg);
  border-bottom: 1.5px solid var(--cf-green);
  border-left: 1.5px solid var(--cf-green);
}

.chat-artifact-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.chat-artifact-card-name {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-md);
  font-weight: 500;
  color: var(--cf-text);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-artifact-card-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  color: var(--cf-text-40);
}

.chat-artifact-ready {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  color: var(--cf-green);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid rgba(46, 204, 113, 0.3);
  padding: 0.25rem 0.6rem;
  border-radius: 2px;
  flex-shrink: 0;
}

/* --- Thinking indicator --- */
.chat-thinking {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.chat-thinking-icon {
  color: var(--cf-accent);
  font-size: 0.9rem;
  line-height: 1;
}

.chat-thinking-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  color: var(--cf-text-30);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chat-thinking-cursor {
  width: 8px;
  height: 16px;
  background: var(--cf-accent);
  animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}


/* ========== ARTIFACT PANEL ========== */

/* Panel-open state: split the chat frame */
.chat-frame.panel-open .chat-content-area {
  width: 45%;
}

.chat-frame.panel-open .chat-chrome {
  border-radius: 8px 0 0 0;
}

.chat-frame.panel-open .chat-body {
  padding: 1.5rem;
}

/* Panel container — absolute so it never affects frame height */
.artifact-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0;
  overflow: hidden;
  border-left: 1px solid var(--cf-border-06);
  display: flex;
  flex-direction: column;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--cf-bg);
  z-index: 5;
}

.chat-frame.panel-open .artifact-panel {
  width: 55%;
}

/* Panel chrome */
.artifact-panel-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--cf-border-06);
  background: var(--cf-surface);
  border-radius: 0 8px 0 0;
  flex-shrink: 0;
}

.artifact-panel-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-sm);
  color: var(--cf-text-70);
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artifact-panel-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.artifact-panel-page {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  color: var(--cf-text-30);
  letter-spacing: 0.08em;
}

.artifact-panel-close {
  background: none;
  border: 1px solid var(--cf-border-10);
  color: var(--cf-text-50);
  font-size: 1.1rem;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  line-height: 1;
}

.artifact-panel-close:hover {
  color: var(--cf-text);
  border-color: var(--cf-text-25);
}

/* Panel body */
.artifact-panel-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--cf-border-10) transparent;
  border-radius: 0 0 8px 0;
}

.artifact-panel-body::-webkit-scrollbar {
  width: 4px;
}
.artifact-panel-body::-webkit-scrollbar-track {
  background: transparent;
}
.artifact-panel-body::-webkit-scrollbar-thumb {
  background: var(--cf-border-10);
  border-radius: 2px;
}

/* --- Document page (PDF-style) --- */
.doc-page {
  background: #1E1E1C;
  border: 1px solid rgba(237, 232, 223, 0.06);
  border-radius: 4px;
  padding: 2.5rem 2rem;
  margin-bottom: 1.5rem;
}

.doc-letterhead {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(237, 232, 223, 0.08);
}

.doc-letterhead-name {
  font-family: 'EB Garamond', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--cf-text);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.doc-letterhead-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  color: rgba(237, 232, 223, 0.35);
  letter-spacing: 0.08em;
}

.doc-date {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  color: rgba(237, 232, 223, 0.6);
  margin-bottom: 1.25rem;
}

.doc-addressee {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  color: rgba(237, 232, 223, 0.65);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.doc-re-line {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  color: rgba(237, 232, 223, 0.65);
  line-height: 1.6;
  margin-bottom: 1.25rem;
  font-weight: 500;
}

.doc-body-text {
  font-family: 'EB Garamond', serif;
  font-size: 0.95rem;
  color: rgba(237, 232, 223, 0.75);
  line-height: 1.8;
  margin-bottom: 1rem;
}

.doc-section-ref {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  color: var(--cf-accent);
  background: rgba(116, 65, 143, 0.08);
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
}

.doc-signature-block {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(237, 232, 223, 0.06);
}

.doc-signature-line {
  width: 180px;
  border-bottom: 1px solid rgba(237, 232, 223, 0.3);
  margin-bottom: 0.5rem;
  height: 2rem;
}

.doc-signature-name {
  font-family: 'EB Garamond', serif;
  font-size: 0.9rem;
  color: rgba(237, 232, 223, 0.7);
}

.doc-signature-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  color: rgba(237, 232, 223, 0.4);
}

.doc-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(237, 232, 223, 0.04);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  color: rgba(237, 232, 223, 0.2);
  line-height: 1.6;
  letter-spacing: 0.03em;
}

/* --- Document tables --- */
.doc-section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(237, 232, 223, 0.5);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 1.5rem 0 0.5rem;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1.25rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  display: block;
  overflow-x: auto;
}

.doc-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  color: rgba(237, 232, 223, 0.45);
  border-bottom: 1px solid rgba(237, 232, 223, 0.12);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.doc-table td {
  padding: 0.4rem 0.75rem;
  color: rgba(237, 232, 223, 0.7);
  border-bottom: 1px solid rgba(237, 232, 223, 0.04);
  white-space: nowrap;
}

.doc-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --- Spreadsheet (rent roll) --- */
.doc-spreadsheet {
  overflow-x: auto;
  border: 1px solid var(--cf-border-08);
  border-radius: 4px;
  background: var(--cf-surface);
}

.doc-spreadsheet table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
}

.doc-spreadsheet th {
  position: sticky;
  top: 0;
  background: #222220;
  padding: 0.4rem 0.6rem;
  color: rgba(237, 232, 223, 0.45);
  border-bottom: 2px solid rgba(237, 232, 223, 0.1);
  border-right: 1px solid rgba(237, 232, 223, 0.04);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.doc-spreadsheet td {
  padding: 0.35rem 0.6rem;
  color: rgba(237, 232, 223, 0.65);
  border-bottom: 1px solid rgba(237, 232, 223, 0.03);
  border-right: 1px solid rgba(237, 232, 223, 0.03);
  white-space: nowrap;
}

.doc-spreadsheet tr.flagged td {
  background: rgba(230, 57, 38, 0.06);
  color: rgba(237, 232, 223, 0.8);
}

.doc-spreadsheet .flag-icon {
  color: #E63926;
  font-size: 0.6rem;
}

.doc-spreadsheet .sheet-tabs {
  display: flex;
  border-top: 1px solid var(--cf-border-06);
  background: var(--cf-surface);
}

.doc-spreadsheet .sheet-tab {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  padding: 0.4rem 0.8rem;
  color: rgba(237, 232, 223, 0.3);
  border-right: 1px solid rgba(237, 232, 223, 0.04);
}

.doc-spreadsheet .sheet-tab.active {
  color: rgba(237, 232, 223, 0.7);
  background: #222220;
}

/* ========== PAIN SECTION ========== */
.pain-section {
  padding: 0.5rem 2.5rem 0;
  border-top: 1px solid var(--border);
}

.pain-content {
  max-width: 900px;
  margin: 0 auto;
}

.pain-headline-wrap {
  position: relative;
  text-align: center;
  margin-bottom: 1.25rem;
}

.pain-headline,
.pain-headline-after {
  font-family: 'EB Garamond', serif;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-align: center;
}

.pain-headline {
  color: var(--cream);
}

.pain-headline-after {
  color: var(--cream);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.pain-stack-wrapper {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 0.5rem;
}

.pain-stack-viewport {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  flex: 1 1 auto;
  min-height: 0;
}

.pain-stack-cards {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pain-card {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(0.875rem, 1.5vw + 0.5rem, 1rem);
  line-height: 1.65;
  padding: 1.2rem 2rem 1.2rem 2.25rem;
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--border);
  position: relative;
  will-change: transform, opacity;
}

.pain-card-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  letter-spacing: 0.2em;
  color: var(--cream-dim);
  margin-right: 0.75rem;
  display: inline-block;
  min-width: 2rem;
}

/* Progressive darkening + left border heat map */
.pain-card[data-card-index="0"] {
  background: var(--pain-step-0);
  color: var(--cream);
  border-left-color: var(--border-strong);
}
.pain-card[data-card-index="1"] {
  background: var(--pain-step-1);
  color: var(--cream);
  border-left-color: var(--border);
}
.pain-card[data-card-index="2"] {
  background: var(--pain-step-2);
  color: var(--cream);
  border-left-color: var(--accent-dim);
}
.pain-card[data-card-index="3"] {
  background: var(--pain-step-2);
  color: var(--cream-dim);
  border-left-color: var(--accent-dim);
  box-shadow: inset 0 0 0 999px rgba(0,0,0,0.08);
}
.pain-card[data-card-index="4"] {
  background: var(--pain-step-2);
  color: var(--cream-dim);
  border-left-color: var(--accent);
  box-shadow: inset 0 0 0 999px rgba(0,0,0,0.15);
}
.pain-card[data-card-index="5"] {
  background: var(--pain-step-2);
  color: var(--cream-dim);
  border-color: var(--accent-dim);
  border-left-color: var(--accent);
  box-shadow: inset 0 0 0 999px rgba(0,0,0,0.22);
}

/* ---- Running Toll ---- */
.pain-toll {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 0;
  margin-top: 1.5rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
}

.pain-toll-metric {
  flex: 1;
  text-align: center;
  padding: 0 1.5rem;
}

.pain-toll-divider {
  width: 1px;
  height: 4rem;
  background: var(--border-strong);
  align-self: center;
  flex-shrink: 0;
}

.pain-toll-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-sm);
  line-height: 1.4;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.pain-toll-value {
  position: relative;
  height: clamp(3.5rem, 7vw, 5.5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pain-toll-before,
.pain-toll-after {
  font-family: 'EB Garamond', serif;
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
  position: absolute;
  white-space: nowrap;
  will-change: transform, opacity;
}

.pain-toll-before {
  color: #EDE8DF;
  will-change: transform, opacity, font-size;
}

[data-theme="light"] .pain-toll-before {
  color: #1A1A18;
}

.pain-toll-after {
  color: var(--accent);
  text-shadow: 0 0 60px var(--accent-glow), 0 0 120px var(--accent-dim);
}

/* ---- Result Sub ---- */
.pain-result-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-lg);
  letter-spacing: 0.08em;
  line-height: 1.6;
  color: var(--cream);
  opacity: 0.7;
  text-align: center;
  margin-top: 0.75rem;
}

/* ========== ARCHITECTURE SECTION ========== */
.arch-section {
  padding: 8rem 2.5rem;
  border-top: 1px solid var(--border);
  position: relative;
}

.arch-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 5rem;
}

.arch-header h2 {
  font-family: 'EB Garamond', serif;
  font-size: clamp(2.5rem, 4.5vw, 4rem);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.03em;
  max-width: 960px;
}

.arch-header-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 5rem;
  font-weight: 300;
  color: var(--cream-ghost);
  line-height: 1;
}

.arch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.arch-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  padding: 3rem 2.5rem;
  position: relative;
  overflow: hidden;
  transition: background 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.arch-card::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 0;
  background: var(--accent-dim);
  transition: height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 0;
}

.arch-card:hover::before { height: 100%; }

.arch-card > * { position: relative; z-index: 1; }

.arch-card-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  letter-spacing: 0.25em;
  color: var(--accent);
  margin-bottom: 2rem;
}

.arch-card-icon {
  width: 48px; height: 48px;
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
  font-size: 1.2rem;
  color: var(--cream-dim);
  transition: border-color 0.3s;
}

.arch-card:hover .arch-card-icon {
  border-color: var(--accent);
}

.arch-card-title {
  font-family: 'EB Garamond', serif;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 500;
  margin: 0 0 0.75rem 0;
  color: var(--cream);
}

.arch-card-text {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--cream-dim);
  font-weight: 300;
}

/* ========== USE CASES ========== */
.cases-section {
  border-top: 1px solid var(--border);
  padding: 6rem 2.5rem;
}

.cases-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 4rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.cases-header h2 {
  font-family: 'EB Garamond', serif;
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 400;
  line-height: 1.15;
}

.cases-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.case-card {
  padding: 0;
  border: 1px solid var(--border);
  margin-bottom: -1px;
  position: relative;
  overflow: hidden;
  transition: background 0.4s;
  cursor: default;
  display: flex;
  flex-direction: row;
}

.case-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 2px; height: 0;
  background: var(--accent);
  transition: height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.case-card:hover::after { height: 100%; }
.case-card:hover { background: var(--bg-elevated); }

.case-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  flex-shrink: 0;
  width: 300px;
  padding: 2.5rem;
  border-left: 1px solid var(--border);
  order: 1;
}

.case-stat-val {
  font-family: 'EB Garamond', serif;
  font-size: clamp(1.8rem, 5vw, 3rem);
  color: var(--cream);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.case-stat-lbl {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-sm);
  line-height: 1.4;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.case-content {
  flex: 1;
  padding: 2.5rem;
}

.case-title {
  font-family: 'EB Garamond', serif;
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  font-weight: 500;
  color: var(--cream);
  margin: 0 0 1.5rem 0;
}

.case-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.case-before,
.case-after {
  padding: 1.25rem 1.5rem;
}

.case-before {
  border-right: 1px solid var(--border);
}

.case-before-label,
.case-after-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-xs);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.case-before-label {
  color: var(--cream-dim);
}

.case-after-label {
  color: var(--accent);
}

.case-before p {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--cream-dim);
  font-weight: 300;
  margin: 0;
}

.case-after p {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--cream);
  font-weight: 300;
  margin: 0;
}

/* ========== INEVITABILITY ========== */
.inevitability-section {
  padding: 0 2.5rem;
  text-align: center;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.inevitability-text {
  font-family: 'EB Garamond', serif;
  font-size: clamp(1.6rem, 3.5vw, 2.6rem);
  font-weight: 400;
  color: var(--cream);
  letter-spacing: -0.01em;
  line-height: 1.4;
  max-width: 700px;
  margin: 0 auto;
}

.inevitability-line-2 {
  margin-top: 1rem;
  color: var(--accent);
}

/* ========== CTA ========== */
.cta-section {
  padding: 10rem 2.5rem;
  text-align: center;
  border-top: 1px solid var(--border);
  position: relative;
}

.cta-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-sm);
  letter-spacing: 0.2em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2rem;
}

.cta-headline {
  font-family: 'EB Garamond', serif;
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 1.5rem;
}

.cta-headline em {
  font-style: normal;
  color: var(--accent);
}

.pilot-timeline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--border-strong);
  max-width: 900px;
  margin: 3rem auto;
  text-align: left;
}

.pilot-step {
  padding: 2rem;
  border-right: 1px solid var(--border-strong);
}
.pilot-step:last-child {
  border-right: none;
}

.pilot-step-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-sm);
  letter-spacing: 0.2em;
  color: var(--cream-dim);
  margin-bottom: 0.75rem;
}

.pilot-step-duration {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-sm);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.pilot-step-title {
  font-family: 'EB Garamond', serif;
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--cream);
  margin: 0 0 0.75rem 0;
}

.pilot-step-desc {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--cream-dim);
  font-weight: 300;
}

.pilot-confidence {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-lg);
  letter-spacing: 0.02em;
  color: var(--cream-dim);
  max-width: 600px;
  margin: 0 auto 3rem;
  line-height: 1.7;
  opacity: 0.8;
}

.cta-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

/* ========== MAILTO FALLBACK MODAL ========== */
#mailto-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 12, 11, 0.7);
  z-index: 10002;
  opacity: 0;
  transition: opacity 0.3s;
  cursor: pointer;
}
#mailto-overlay.visible { opacity: 1; }
[data-theme="light"] #mailto-overlay {
  background: rgba(26, 26, 24, 0.4);
}

#mailto-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  opacity: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 2.5rem 3rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  z-index: 10003;
  transition: opacity 0.3s, transform 0.3s;
  max-width: 420px;
  width: 90vw;
}
#mailto-toast.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

#mailto-toast .mailto-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
}
#mailto-toast .mailto-msg {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--cream);
  font-weight: 300;
}
#mailto-toast a {
  display: inline-block;
  padding: 1rem 2.5rem;
  background: var(--accent);
  color: #FFFFFF;
  text-decoration: none;
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-md);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: background 0.3s, box-shadow 0.3s, transform 0.3s;
}
#mailto-toast a:hover {
  background: #9563AF;
  box-shadow: 0 4px 24px var(--accent-glow);
  transform: translateY(-1px);
}
#mailto-toast button {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  background: none;
  border: none;
  color: var(--cream-dim);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.2s;
}
#mailto-toast button:hover { color: var(--cream); }

/* ========== FOOTER ========== */
footer {
  padding: 1.5rem 2.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Footer text uses rgba(237,232,223,0.2) — intentionally dimmer than --cream-dim */
.foot-left {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-sm);
  line-height: 1.4;
  letter-spacing: 0.1em;
  color: rgba(237,232,223,0.2);
}

.foot-right {
  display: flex; gap: 2rem;
  padding-right: 3rem;
}

.foot-right a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--mono-sm);
  line-height: 1.4;
  letter-spacing: 0.1em;
  color: rgba(237,232,223,0.2);
  text-decoration: none;
  transition: color 0.3s;
}
.foot-right a:hover { color: var(--cream-dim); }

/* ========== UTILITY ========== */

a, button, .btn-main, .btn-line {
  cursor: pointer;
}


/* ========== FAQ ========== */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

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

.faq-question {
  font-family: 'EB Garamond', serif;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--cream);
  padding: 1.5rem 0;
  cursor: pointer;
  list-style: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::marker {
  content: '';
}

.faq-answer {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--cream-dim);
  padding: 0 0 1.5rem 0;
  margin: 0;
}

/* ========== SUB-PAGES (FAQ, Privacy) ========== */
.sub-page {
  padding: 8rem 2.5rem 6rem;
  max-width: 720px;
  margin: 0 auto;
}

.sub-page-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.sub-page-title {
  font-family: 'EB Garamond', serif;
  font-size: 2.4rem;
  font-weight: 500;
  color: var(--cream);
  margin: 0 0 3rem 0;
}

.sub-page-effective {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: var(--cream-dim);
  margin: -2rem 0 3rem 0;
}

/* Legal body (Privacy Policy) */
.legal-body h2 {
  font-family: 'EB Garamond', serif;
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--cream);
  margin: 2.5rem 0 1rem 0;
}

.legal-body h3 {
  font-family: 'EB Garamond', serif;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--cream);
  margin: 1.5rem 0 0.75rem 0;
}

.legal-body p {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--cream-dim);
  margin: 0 0 1rem 0;
}

.legal-body ul {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--cream-dim);
  padding-left: 1.5rem;
  margin: 0 0 1rem 0;
}

.legal-body li {
  margin-bottom: 0.4rem;
}

.legal-body a {
  color: var(--accent);
  text-decoration: none;
}

.legal-body a:hover {
  text-decoration: underline;
}

/* ========== SECTION HEADER WORD SPANS ========== */
.word-span {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px);
}

/* ========== RESPONSIVE: WIDE TABLET (max-width: 1200px) ========== */
@media (max-width: 1200px) {
  .nav-right { gap: 1.25rem; }
  .arch-section { padding: 6rem 2rem; }
  .cta-section { padding: 8rem 2rem; }
  .cases-section { padding: 5rem 2rem; }
}

/* ========== RESPONSIVE: TABLET (max-width: 1024px) ========== */
@media (max-width: 1024px) {
  .arch-grid {
    grid-template-columns: 1fr;
  }
  .terminal-intro {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  .arch-header {
    flex-direction: column;
    gap: 1rem;
  }
  .arch-card { padding: 2.25rem 2rem; }
  .cta-section { padding: 6rem 2rem; }
  .terminal-stage { margin-bottom: 4rem; }
  .cases-header { margin-bottom: 3rem; }
  .case-stat { width: auto; min-width: 200px; }
  .nav-right a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
  }
  .arch-header h2 { font-size: clamp(2rem, 4vw, 3.2rem); }
  .cta-headline { font-size: clamp(2.5rem, 5vw, 4rem); }
  .case-stat-val { font-size: clamp(2rem, 4.5vw, 2.8rem); }
}

/* ========== RESPONSIVE: LARGE MOBILE (max-width: 768px) ========== */
@media (max-width: 768px) {
  .case-card {
    flex-direction: column;
  }

  .case-stat {
    width: auto;
    border-left: none;
    border-top: 1px solid var(--border);
    flex-direction: row;
    align-items: baseline;
    gap: 0.75rem;
    padding: 1.5rem 2rem;
    order: 1;
  }

  .pilot-timeline {
    grid-template-columns: 1fr;
  }
  .pilot-step {
    border-right: none;
    border-bottom: 1px solid var(--border-strong);
  }
  .pilot-step:last-child {
    border-bottom: none;
  }

  .pain-section {
    padding: 5rem 1.25rem 0;
  }
  .pain-stack-viewport {
    min-height: 0;
  }
  .pain-card {
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 0.75rem 1rem 0.75rem 1.25rem;
  }
  .pain-card-num {
    font-size: var(--mono-xs);
    min-width: 1.5rem;
    margin-right: 0.5rem;
  }
  .pain-toll {
    padding: 0.75rem 0;
    margin-top: 1rem;
  }
  .pain-toll-metric {
    padding: 0 0.75rem;
  }
  .pain-toll-label {
    font-size: var(--mono-xs);
    margin-bottom: 0.4rem;
  }
  .pain-toll-divider {
    height: 2.5rem;
  }
  .pain-toll-before,
  .pain-toll-after {
    font-size: clamp(1.4rem, 3vw, 2rem);
  }
  .pain-toll-value {
    height: 3.5rem;
  }

  .hero-headline .h-large {
    font-size: clamp(2.5rem, 10vw, 4rem);
  }
  .hero-headline .h-italic {
    font-size: clamp(2.5rem, 10vw, 4rem);
  }
  .arch-section { padding: 4rem 1.5rem; }
  .arch-card { padding: 2rem 1.5rem; }
  .cta-section { padding: 5rem 1.5rem; }
  .cta-headline { font-size: clamp(1.8rem, 5vw, 2.5rem); }
  .terminal-intro { padding: 4rem 0 2rem; }
  .terminal-stage { margin-bottom: 3rem; }
  .cases-section { padding: 4rem 1.5rem; }
  .hero-ctas { flex-wrap: wrap; }
  .foot-right { padding-right: 1.5rem; }
  .terminal-intro-left h2 { font-size: clamp(1.6rem, 4.5vw, 2.5rem); }
  .arch-header h2 { font-size: clamp(1.6rem, 4.5vw, 2.5rem); }
  .pain-result-sub { font-size: var(--mono-md); }
}

/* ========== RESPONSIVE: MOBILE (max-width: 640px) ========== */
@media (max-width: 640px) {
  #mailto-toast { padding: 2rem 1.5rem; }
  #mailto-toast a { padding: 0.85rem 1.5rem; font-size: var(--mono-sm); }
  /* Artifact panel: full overlay on mobile */
  .chat-frame.panel-open .chat-content-area {
    width: 100%;
  }
  .chat-frame.panel-open .artifact-panel {
    width: 100%;
    border-radius: 8px;
  }
  .doc-page {
    padding: 1.25rem 1rem;
  }

  nav {
    padding: 0 1.25rem;
  }

  /* Hamburger visible on mobile */
  .nav-toggle {
    display: flex;
  }

  /* Full-screen drawer overlay */
  .nav-right {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: var(--bg);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
  }

  .nav-right.open {
    transform: translateX(0);
  }

  .nav-right a {
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    color: var(--cream-dim);
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
  }

  .nav-right a:last-child {
    margin-top: 1rem;
    background: var(--accent);
    color: var(--cream);
    padding: 1rem 2rem;
    font-size: 0.9rem;
    letter-spacing: 0.12em;
  }

  [data-theme="light"] .nav-right a:last-child {
    color: #FFFFFF;
  }

  .hero {
    padding: 0 1.25rem;
  }
  .hero-content {
    padding-left: 0.5rem;
  }
  .hero-bottom {
    padding: 0 1.25rem 2rem 1.75rem;
    flex-direction: column;
    gap: 1.5rem;
    align-items: flex-start;
  }
  .hero-accent-line {
    left: 1.25rem;
  }

  .terminal-section,
  .arch-section,
  .cases-section,
  .cta-section,
  .pain-section,
  .inevitability-section {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .sub-page {
    padding: 6rem 1.25rem 3rem;
  }

  .sub-page-title {
    font-size: 1.8rem;
  }

  .inevitability-section {
    min-height: 100vh;
  }

  .case-split {
    grid-template-columns: 1fr;
  }

  .case-before {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  /* Chat demo mobile */
  .chat-chrome {
    position: relative;
  }
  .chat-chrome::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3rem;
    background: linear-gradient(to right, transparent, var(--cf-surface));
    pointer-events: none;
    z-index: 1;
  }
  .chat-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .chat-tabs::-webkit-scrollbar {
    display: none;
  }
  .chat-tab {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: var(--mono-sm);
    padding: 0.6rem 1rem;
    min-height: 44px;
  }
  .chat-version {
    display: none;
  }

  .hero-status {
    font-size: var(--mono-sm);
    letter-spacing: 0.12em;
  }

  .pilot-confidence {
    font-size: var(--mono-md);
  }
  .chat-body {
    padding: 1.5rem;
    min-height: 300px;
    max-height: 50vh;
  }
  .chat-msg.user .chat-bubble {
    max-width: 85%;
  }
  .chat-response {
    padding-left: 1rem;
  }
  .chat-sources {
    max-width: 100%;
  }
  .chat-source-item {
    flex-direction: column;
    gap: 0.15rem;
  }
  .chat-artifact-card {
    flex-direction: column;
    align-items: flex-start;
    max-width: 100%;
  }
  .chat-artifact-ready {
    align-self: flex-end;
  }

  footer {
    padding: 1.5rem 1.25rem;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  .foot-right a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .cta-actions {
    flex-direction: column;
    width: 100%;
  }
  .cta-actions .btn-main,
  .cta-actions .btn-line {
    width: 100%;
    text-align: center;
  }

  .hero-scroll-hint {
    display: none;
  }

  /* Pain toll: stay horizontal on mobile — vertical wastes too much pinned height */
  .pain-toll {
    flex-direction: row;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem 0;
    margin-top: 0.75rem;
  }
  .pain-toll-divider {
    width: 1px;
    height: 2rem;
  }
  .pain-toll-metric {
    padding: 0 0.5rem;
  }
  .pain-toll-label {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    margin-bottom: 0.25rem;
  }
  .pain-toll-value {
    height: 2.5rem;
  }
  .pain-toll-before,
  .pain-toll-after {
    font-size: clamp(1.1rem, 4vw, 1.6rem);
  }
  .pain-headline-wrap {
    margin-bottom: 0.75rem;
  }
  .pain-stack-wrapper {
    min-height: 100svh;
  }
  .pain-card {
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 0.6rem 0.75rem 0.6rem 1rem;
  }
  .pain-card-num {
    font-size: 0.7rem;
    min-width: 1.25rem;
    margin-right: 0.4rem;
  }
  .pain-stack-cards {
    gap: 0.15rem;
  }
  .pain-result-sub {
    font-size: var(--mono-sm);
  }

  .arch-section { padding: 3rem 1.25rem; }
  .arch-card { padding: 1.5rem 1.25rem; }
  .cta-section { padding: 3rem 1.25rem; }
  .terminal-stage { margin-bottom: 2rem; }
  .terminal-intro { padding: 3rem 0 1.5rem; }
  .foot-right { padding-right: 0; gap: 1.5rem; }
  .cases-section { padding: 3rem 1.25rem; }
  .cases-header { margin-bottom: 2rem; padding-bottom: 1.5rem; }
  .cases-header h2 { font-size: clamp(1.5rem, 4vw, 2rem); }

  .hero-ctas {
    flex-direction: column;
    width: 100%;
  }
  .hero-ctas .btn-main,
  .hero-ctas .btn-line {
    width: 100%;
    text-align: center;
  }
}

/* ========== RESPONSIVE: SMALL MOBILE (max-width: 380px) ========== */
@media (max-width: 380px) {
  .hero-headline .h-large {
    font-size: clamp(1.8rem, 8vw, 2.2rem);
  }
  .hero-headline .h-italic {
    font-size: clamp(1.8rem, 8vw, 2.2rem);
  }

  .cta-headline {
    font-size: clamp(1.6rem, 5vw, 2rem);
  }
  .pain-toll-value {
    height: 2rem;
  }
  .pain-card {
    padding: 0.5rem 0.6rem 0.5rem 0.8rem;
  }
  .arch-card { padding: 1.25rem 1rem; }
  .btn-main, .btn-line { padding: 0.85rem 1.5rem; font-size: var(--mono-sm); }
}
