/* =============================================
   T2 Personal Assistant System
   Design System Stylesheet
   ============================================= */

/* Variables */
:root {
  --bg: #0f1624;
  --surface: #1e293b;
  --surface2: #162032;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --blue: #4fa3e0;
  --blue-dim: #1a3352;
  --green: #22c55e;
  --purple: #a78bfa;
  --red: #f87171;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-w: 960px;
  --prose-w: 820px;
  --r: 8px;
  --r-sm: 4px;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  min-height: 100vh;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* =============================================
   TYPOGRAPHY
   ============================================= */

h1 {
  font-size: 1.875rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 0.5rem;
  margin-top: 1.75rem;
}

p {
  margin-bottom: 1rem;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface);
  color: var(--blue);
  padding: 0.15em 0.4em;
  border-radius: var(--r-sm);
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.8125rem;
  color: var(--text);
  border-radius: 0;
}

/* =============================================
   NAV
   ============================================= */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 22, 36, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  height: 56px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  flex-shrink: 0;
  margin-right: auto;
}

.nav-brand:hover {
  text-decoration: none;
  color: var(--blue);
}

.nav-logo {
  width: 28px;
  height: 28px;
}

.nav-wordmark {
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.nav-wordmark sup {
  font-size: 0.6em;
  vertical-align: super;
  color: var(--purple);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0;
}

.nav-links li a {
  display: block;
  padding: 0 0.75rem;
  height: 56px;
  line-height: 56px;
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
  white-space: nowrap;
}

.nav-links li a:hover,
.nav-links li a.nav-active {
  color: var(--text);
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.2s;
}

/* =============================================
   PAGE WRAPPER
   ============================================= */

.page-body {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* =============================================
   HERO
   ============================================= */

.hero {
  padding: 4rem 0 2rem;
  text-align: center;
}

.status-bar {
  display: flex;
  justify-content: center;
  gap: 0.625rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.agent-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.875rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid;
}

.agent-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pill-tammy {
  color: var(--blue);
  border-color: var(--blue-dim);
  background: rgba(79, 163, 224, 0.06);
}

.pill-tammy .agent-pill-dot {
  background: var(--blue);
  box-shadow: 0 0 5px var(--blue);
}

.pill-trudy {
  color: var(--purple);
  border-color: rgba(167, 139, 250, 0.25);
  background: rgba(167, 139, 250, 0.06);
}

.pill-trudy .agent-pill-dot {
  background: var(--purple);
  box-shadow: 0 0 5px var(--purple);
}

.hero-system-label {
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.hero-headline {
  font-size: clamp(1.5rem, 3.5vw, 2.125rem);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  max-width: 680px;
  margin: 0 auto 0.75rem;
}

.hero-subheadline {
  font-size: clamp(1.05rem, 2.2vw, 1.375rem);
  font-weight: 400;
  line-height: 1.3;
  color: var(--muted);
  max-width: 680px;
  margin: 0 auto 1.25rem;
}

.hero-lead {
  font-size: 1rem;
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.75;
}

.hero-cta {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* =============================================
   BUTTONS
   ============================================= */

.btn-primary,
.btn-secondary {
  display: inline-block;
  padding: 0.625rem 1.375rem;
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  border: 1px solid var(--blue);
}

.btn-primary:hover {
  background: #5ab3f0;
  border-color: #5ab3f0;
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--blue-dim);
}

.btn-secondary:hover {
  border-color: var(--blue);
  text-decoration: none;
}

/* =============================================
   PORTRAIT
   ============================================= */

.t2-portrait {
  display: block;
  margin: 2rem auto 3.5rem;
  max-width: 660px;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  filter: drop-shadow(0 4px 32px rgba(79, 163, 224, 0.15));
}

/* =============================================
   HOMEPAGE SECTIONS
   ============================================= */

.section {
  margin-bottom: 3.5rem;
}

.section-label {
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.625rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.section-desc {
  color: var(--muted);
  max-width: 560px;
  margin-bottom: 1.75rem;
  font-size: 0.9375rem;
  line-height: 1.65;
}

/* =============================================
   ICON GRID
   ============================================= */

.icon-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}

.icon-cell {
  background: var(--surface);
  padding: 1.375rem 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: background 0.15s;
}

.icon-cell:hover {
  background: var(--surface2);
}

.icon-cell img {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.icon-cell-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.icon-cell-desc {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

/* =============================================
   DIVISION (agent cards)
   ============================================= */

.division-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.agent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.375rem 1.25rem;
}

.agent-card-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--border);
}

.agent-card-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.agent-card-tammy .agent-card-dot {
  background: var(--blue);
  box-shadow: 0 0 6px var(--blue);
}

.agent-card-trudy .agent-card-dot {
  background: var(--purple);
  box-shadow: 0 0 6px var(--purple);
}

.agent-card-name {
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.agent-card-model {
  font-size: 0.6875rem;
  color: var(--muted);
  font-family: var(--font-mono);
  margin-left: auto;
  letter-spacing: 0.02em;
}

.agent-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.agent-card ul li {
  font-size: 0.8125rem;
  color: var(--muted);
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  line-height: 1.45;
}

.agent-card ul li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.agent-card ul li::before {
  content: '–';
  color: var(--border);
  flex-shrink: 0;
  margin-top: 0.05em;
}

/* =============================================
   PIPELINE
   ============================================= */

.pipeline {
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}

.pipeline-node {
  flex: 1;
  padding: 1.125rem 0.875rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  border-top: 2px solid transparent;
}

.pipeline-node + .pipeline-node {
  border-left: 1px solid var(--border);
}

.pipeline-node.node-blue { border-top-color: var(--blue); }
.pipeline-node.node-purple { border-top-color: var(--purple); }
.pipeline-node.node-green { border-top-color: var(--green); }
.pipeline-node.node-muted { border-top-color: var(--border); }

.pipeline-icon {
  font-size: 1.125rem;
  margin-bottom: 0.4rem;
  line-height: 1;
}

.pipeline-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.pipeline-sub {
  font-size: 0.6875rem;
  color: var(--muted);
  line-height: 1.4;
}

/* =============================================
   GATE GRID
   ============================================= */

.gate-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.gate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem;
}

.gate-card-label {
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.gate-card-value {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
  font-family: var(--font-mono);
  margin-bottom: 0.375rem;
}

.gate-card-desc {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.gate-card.card-blue .gate-card-value { color: var(--blue); }
.gate-card.card-green .gate-card-value { color: var(--green); }
.gate-card.card-purple .gate-card-value { color: var(--purple); }

/* =============================================
   BUILD STEPS
   ============================================= */

.build-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.build-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem;
}

.build-step-num {
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.build-step-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.build-step-desc {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

/* =============================================
   NCO BOX (callout)
   ============================================= */

.nco-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--r) var(--r) 0;
  padding: 1.125rem 1.5rem;
}

.nco-box-label {
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--blue);
  margin-bottom: 0.5rem;
}

.nco-box p {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.65;
}

.nco-box a { color: var(--blue); }

/* =============================================
   CONTENT / PROSE PAGES
   ============================================= */

.content {
  max-width: var(--prose-w);
  margin: 0 auto;
  padding-top: 2.5rem;
}

.content h1 {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.content h2 {
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.content h3 {
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.content p {
  margin-bottom: 1rem;
  color: var(--muted);
}

.content p strong {
  color: var(--text);
}

.content ul,
.content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  color: var(--muted);
}

.content li {
  margin-bottom: 0.3rem;
}

.content a { color: var(--blue); }
.content a:hover { text-decoration: underline; }

/* =============================================
   PROMPT BLOCK
   ============================================= */

.prompt-block {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.5rem 1.5rem 1.5rem 1.5rem;
  padding-right: 5rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--border);
  color: var(--muted);
  border: none;
  border-radius: var(--r-sm);
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s;
}

.copy-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

/* =============================================
   SKILLS TABLE
   ============================================= */

.table-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border-radius: var(--r);
  border: 1px solid var(--border);
}

.skills-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.skills-table th {
  background: var(--surface2);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.skills-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--muted);
  line-height: 1.5;
}

.skills-table tr:last-child td {
  border-bottom: none;
}

.skills-table td:first-child {
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  white-space: nowrap;
  width: 1%;
}

.skills-table tr.table-divider td {
  background: var(--surface2);
  color: var(--muted);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.5rem 1rem;
  font-family: var(--font-mono);
}

.skills-table tr:hover td {
  background: var(--surface2);
}

.skills-table tr.table-divider:hover td {
  background: var(--surface2);
}

/* =============================================
   CHANGELOG TABLE
   ============================================= */

.changelog-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.changelog-table th {
  background: var(--surface2);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.changelog-table th:first-child {
  width: 140px;
}

.changelog-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--muted);
  line-height: 1.5;
}

.changelog-table td:first-child {
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.changelog-table tr:last-child td {
  border-bottom: none;
}

.changelog-table tr:hover td {
  background: var(--surface2);
}

/* =============================================
   FILE TREE
   ============================================= */

.file-tree {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.25rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.8;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.file-tree .dir { color: var(--text); }
.file-tree .comment { color: var(--border); }

/* =============================================
   COMPARE GRID (Token Trim before/after)
   ============================================= */

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.compare-panel h3 {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.compare-panel pre {
  margin-bottom: 0;
  font-size: 0.75rem;
  line-height: 1.6;
}

.compare-panel pre code {
  font-size: 0.75rem;
}

@media (max-width: 768px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }
}

/* =============================================
   GENERIC TABLE (Token Trim results, etc.)
   ============================================= */

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table-wrap table th {
  background: var(--surface2);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table-wrap table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--muted);
  line-height: 1.5;
}

.table-wrap table tr:last-child td {
  border-bottom: none;
}

.table-wrap table tr:hover td {
  background: var(--surface2);
}

.table-wrap table tr.table-divider td {
  background: var(--surface2);
  font-weight: 600;
  color: var(--text);
}

/* =============================================
   FOOTER
   ============================================= */

.footer {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.75;
}

.footer a { color: var(--muted); }
.footer a:hover { color: var(--blue); text-decoration: none; }
.footer p { margin-bottom: 0.25rem; }

/* =============================================
   MOBILE
   ============================================= */

@media (max-width: 768px) {
  .nav-hamburger {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.5rem 0;
  }

  .nav.nav-open .nav-links {
    display: flex;
  }

  .nav-links li a {
    height: auto;
    line-height: normal;
    padding: 0.75rem 1.5rem;
  }

  .icon-grid {
    grid-template-columns: 1fr;
  }

  .division-grid {
    grid-template-columns: 1fr;
  }

  .gate-grid {
    grid-template-columns: 1fr;
  }

  .build-grid {
    grid-template-columns: 1fr;
  }

  .pipeline {
    flex-direction: column;
  }

  .pipeline-node + .pipeline-node {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .hero-headline {
    font-size: 1.5rem;
  }

  .hero-subheadline {
    font-size: 1.05rem;
  }

  .page-body {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
