/**
 * Gates Foundation–inspired design system
 * Palette & patterns from gatesfoundation.org / Kit of Parts style guide
 */

:root {
  --bg: #f3f3f3;
  --surface: #ffffff;
  --text: #000000;
  --muted: #767676;
  --border: #b8b6b6;
  --primary: #000000;
  --primary-hover: #333333;
  --primary-light: #f3f3f3;
  --accent: #009bdf;
  --accent-green: #72bf44;
  --accent-warm: #ff7529;
  --regulatory: #009bdf;
  --clinical: #72bf44;
  --cmc: #767676;
  --radius: 2px;
  --layout-max: 1370px;
  --layout-gutter: clamp(1.1rem, 2.4vw, 2.2rem);
  --font-sans: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Noto Serif", Georgia, "Times New Roman", serif;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
}

h1, h2, h3, .gates-display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text);
}

h1 { font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.15; }
h2 { font-size: clamp(1.5rem, 2.5vw, 1.875rem); line-height: 1.2; }
h3 { font-size: 1.25rem; }

a {
  color: var(--text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--accent);
}

/* ── Navigation ─────────────────────────────────────────────── */

.navbar {
  min-height: 4rem;
  padding: 0 var(--layout-gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

.nav-logo-link {
  display: flex;
  align-items: center;
  background: #000000;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  line-height: 0;
  text-decoration: none;
}

.nav-logo {
  height: 26px;
  width: auto;
  display: block;
}

.nav-subtitle {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--muted);
  border-left: 1px solid var(--border);
  padding-left: 0.85rem;
  margin-left: 0.15rem;
}

.nav-links a {
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 400;
  padding: 1.35rem 0.85rem;
  border-bottom: 3px solid transparent;
}

.nav-links a:hover {
  color: var(--text);
  background: none;
  border-bottom-color: var(--border);
}

.nav-links a.active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--text);
}

.persona-label,
.persona-badge {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ── Layout & footer ──────────────────────────────────────── */

.container {
  padding: 2rem var(--layout-gutter) 3rem;
}

.footer {
  background: #000000;
  color: #ffffff;
  border-top: none;
  padding: 1.25rem var(--layout-gutter);
  font-size: 0.875rem;
}

.footer span {
  opacity: 0.85;
}

/* ── Buttons ──────────────────────────────────────────────── */

.btn {
  border-radius: var(--radius);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-secondary,
.btn-outline {
  background: var(--surface);
  border: 1px solid var(--text);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--text);
  color: #ffffff;
  border-color: var(--text);
}

.btn-link {
  color: var(--text);
  text-decoration: underline;
}

.btn-link:hover {
  color: var(--accent);
}

/* ── Hero & home ──────────────────────────────────────────── */

.gates-hero {
  background: var(--surface);
  margin: -2rem calc(-1 * var(--layout-gutter)) 2.5rem;
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--layout-gutter);
  border-bottom: 1px solid var(--border);
}

.gates-eyebrow {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.gates-lead {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.55;
  color: var(--muted);
  max-width: 42rem;
  margin: 0;
}

.landing-hero-copy {
  max-width: 44rem;
}

.landing-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.landing-section {
  margin-bottom: 3rem;
}

.landing-section-header {
  margin-bottom: 1.75rem;
  max-width: 40rem;
}

.landing-section-desc {
  color: var(--muted);
  font-size: 1.0625rem;
  line-height: 1.55;
  margin: 0.35rem 0 0;
}

.landing-workflow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.landing-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 100%;
}

.landing-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--text);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.landing-step-body h3 {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.landing-step-body p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}

.landing-workflow-cta {
  margin: 1.5rem 0 0;
  text-align: center;
}

.landing-card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.landing-card {
  position: relative;
}

.landing-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.25rem;
  color: var(--accent);
  font-size: 1.35rem;
}

.landing-card--agent {
  border-style: dashed;
}

.gates-section {
  margin-top: 0.5rem;
}

.gates-section-heading {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
}

.gates-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 1.5rem;
}

.gates-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: box-shadow 0.15s ease;
}

.gates-card:hover {
  box-shadow: var(--shadow-md);
}

.gates-card h2 {
  font-size: 1.375rem;
  margin: 0;
}

.gates-card p {
  color: var(--muted);
  margin: 0;
  flex: 1;
}

.gates-card-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.gates-card-list li + li {
  margin-top: 0.35rem;
}

.gates-card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  text-decoration: none;
  margin-top: 0.25rem;
}

.gates-card-link:hover {
  color: var(--accent);
}

.gates-card-link i {
  font-size: 0.75rem;
}

/* Legacy hero/features (other pages) */
.hero {
  text-align: left;
  padding: 0;
  margin-bottom: 2rem;
}

.hero h1 {
  margin-bottom: 0.75rem;
}

.hero-sub {
  margin: 0 0 1.5rem;
  max-width: 42rem;
  font-size: 1.125rem;
}

.features-grid {
  gap: 1.5rem;
}

.feature-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: none;
  padding: 1.75rem;
}

.demo-scenario {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

/* ── Forms & alerts ─────────────────────────────────────────── */

.form-group input,
.form-group select,
.form-group textarea,
.login-form input {
  border-radius: var(--radius);
  border-color: var(--border);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.login-form input:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}

.alert-info {
  background: #eef8fd;
  color: var(--text);
  border-color: #b8e4f5;
}

.alert-success {
  background: #eef8ea;
  color: var(--text);
  border-color: #c8e6b8;
}

.page-header h1 {
  font-family: var(--font-display);
  margin-bottom: 0.5rem;
}

.page-header > p {
  color: var(--muted);
  font-size: 1.0625rem;
  max-width: 42rem;
  line-height: 1.55;
}

/* ── Onboarding & persona ─────────────────────────────────── */

.onboarding h1 {
  margin-bottom: 0.5rem;
}

.section-desc {
  color: var(--muted);
  font-size: 1.0625rem;
  max-width: 40rem;
  margin-bottom: 1.5rem;
}

.persona-card {
  border-radius: var(--radius);
  border-width: 1px;
}

.persona-card:has(input:checked) {
  border-color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--text);
}

.persona-icon {
  color: var(--text);
}

.step.active {
  background: var(--text);
}

.system-workflow {
  border-radius: var(--radius);
}

.system-workflow-steps li {
  border-radius: var(--radius);
}

/* ── Login ──────────────────────────────────────────────────── */

.login-card {
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.login-logo {
  height: 52px;
  width: auto;
  margin-bottom: 1.25rem;
  background: #000000;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  image-rendering: -webkit-optimize-contrast;
}

.login-brand h1 {
  font-family: var(--font-display);
}

/* ── Agent chat ─────────────────────────────────────────────── */

.agent-chat-toggle {
  background: var(--primary);
  border-radius: var(--radius);
}

.agent-chat-toggle:hover {
  background: var(--primary-hover);
}

.agent-chat-panel {
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.agent-service-badge {
  background: var(--primary-light);
  color: var(--muted);
}

/* ── Timeline editor accents ────────────────────────────────── */

.milestone-card-header {
  border-left-color: var(--accent) !important;
}

.milestone-wrapper--expanded {
  border-color: var(--text);
}

.milestone-tag--regulator {
  color: var(--text);
  border-color: var(--border);
  background: var(--primary-light);
}

.timeline-scenario-badge,
.optimization-section h4,
.subgroup-route-comparison-header h4 {
  color: var(--text);
}

.avaref-route-wrapper .milestone-card-header {
  border-left-color: var(--accent-green) !important;
}

/* ── Risk dashboard ─────────────────────────────────────────── */

.risk-hub-header h1 {
  font-family: var(--font-sans);
}

.risk-list-tile,
.risk-hub-kpis .kpi-card,
.risk-category-block {
  border-radius: var(--radius);
}

.risk-detail-panel,
.risk-doc-viewer {
  border-radius: var(--radius);
}

.source-tag--document {
  background: var(--primary-light);
  color: var(--text);
}

.severity-tag--high {
  background: #000;
  color: #fff;
}

/* ── Settings / LLM ───────────────────────────────────────── */

.llm-workflow-step.is-active {
  border-color: var(--text);
}

.llm-section-nav button.is-active {
  background: var(--text);
  color: #fff;
}

/* ── Utilities ──────────────────────────────────────────────── */

.hint {
  color: var(--muted);
}

@media (max-width: 1024px) {
  .landing-workflow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .landing-card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .gates-hero {
    margin-left: calc(-1 * var(--layout-gutter));
    margin-right: calc(-1 * var(--layout-gutter));
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .landing-hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .landing-hero-actions .btn {
    width: 100%;
    text-align: center;
  }

  .landing-workflow {
    grid-template-columns: 1fr;
  }

  .nav-links > a.active {
    background: var(--primary-light);
    border-bottom: none;
    font-weight: 600;
  }
}
