/* AI Says Workshop Documentation — calibration lab aesthetic */

:root {
  --bg-deep: #070b12;
  --bg-panel: #0e1520;
  --bg-panel-alt: #121c2a;
  --bg-elevated: #182434;
  --text-primary: #e8edf4;
  --text-muted: #93a0b4;
  --text-dim: #5f6d82;
  --accent: #8b6fd6;
  --accent-soft: rgba(139, 111, 214, 0.18);
  --accent-border: rgba(139, 111, 214, 0.45);
  --line: rgba(255, 255, 255, 0.08);
  --grid: rgba(255, 255, 255, 0.03);
  --focus: #b8a0ff;
  --success: #4ecdc4;
  --warning: #f0c674;
  --font-sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Consolas", monospace;
  --sidebar-width: 280px;
  --toc-width: 220px;
  --header-height: 72px;
  --radius: 6px;
  --content-max: 760px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text-primary);
  background:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(139, 111, 214, 0.08), transparent 60%),
    var(--bg-deep);
  background-size: 32px 32px, 32px 32px, auto, auto;
}

img { max-width: 100%; height: auto; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover { color: var(--focus); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--bg-deep);
  font-weight: 600;
}

.skip-link:focus { left: 8px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-height);
  padding: 12px 24px;
  background: rgba(7, 11, 18, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: inherit;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-primary);
}

.brand-sub {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-wrap {
  position: relative;
}

.search-input {
  width: 220px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text-primary);
  font: inherit;
}

.search-input::placeholder { color: var(--text-dim); }

.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(360px, 90vw);
  max-height: 360px;
  overflow: auto;
  background: var(--bg-panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.search-results.open { display: block; }

.search-result {
  display: block;
  padding: 10px 14px;
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.search-result:hover { background: var(--accent-soft); }

.search-result small {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}

.btn:hover {
  background: rgba(139, 111, 214, 0.28);
  color: var(--focus);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #9d84e8;
  color: #fff;
}

.nav-toggle {
  display: none;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
}

/* Layout */
.site-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--toc-width);
  gap: 0;
  max-width: 1600px;
  margin: 0 auto;
}

.site-nav {
  position: sticky;
  top: var(--header-height);
  align-self: start;
  max-height: calc(100vh - var(--header-height));
  overflow: auto;
  padding: 24px 16px 48px 24px;
  border-right: 1px solid var(--line);
}

.nav-group { margin-bottom: 24px; }

.nav-group-title {
  margin: 0 0 8px;
  padding: 0 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.94rem;
}

.nav-list a:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.nav-list a.active {
  background: var(--accent-soft);
  color: var(--focus);
  border: 1px solid var(--accent-border);
}

.site-main {
  min-width: 0;
  padding: 32px 40px 80px;
}

.page-toc {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  align-self: start;
  padding: 32px 24px 48px 0;
  font-size: 0.85rem;
}

.page-toc-title {
  margin: 0 0 12px;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.page-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.page-toc a {
  display: block;
  padding: 4px 0;
  color: var(--text-muted);
  text-decoration: none;
}

.page-toc a:hover { color: var(--text-primary); }

/* Content */
.content {
  max-width: var(--content-max);
}

.content h1 {
  margin: 0 0 16px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.content h2 {
  margin: 40px 0 12px;
  padding-top: 8px;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.content h3 {
  margin: 28px 0 8px;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.content p { margin: 0 0 16px; }

.content ul, .content ol {
  margin: 0 0 16px;
  padding-left: 1.4rem;
}

.content li { margin-bottom: 6px; }

.content li > ul { margin-top: 6px; }

.lead {
  font-size: 1.12rem;
  color: var(--text-muted);
}

.panel {
  margin: 24px 0;
  padding: 20px 22px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}

.panel-warn { border-left-color: var(--warning); }

.panel-success { border-left-color: var(--success); }

.hero {
  margin-bottom: 40px;
  padding: 36px 32px;
  background: linear-gradient(135deg, rgba(139, 111, 214, 0.12), rgba(14, 21, 32, 0.9));
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
}

.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.card {
  padding: 22px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.flow {
  margin: 20px 0;
  padding: 18px 20px;
  background: var(--bg-panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text-muted);
  white-space: pre-line;
}

table {
  width: 100%;
  margin: 16px 0 24px;
  border-collapse: collapse;
  font-size: 0.94rem;
}

th, td {
  padding: 10px 14px;
  border: 1px solid var(--line);
  text-align: left;
}

th {
  background: var(--bg-panel-alt);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

code, kbd {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

kbd {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.status-label {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.status-ok { background: rgba(78, 205, 196, 0.15); color: var(--success); }
.status-warn { background: rgba(240, 198, 116, 0.15); color: var(--warning); }
.status-muted { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 40px 24px;
  border-top: 1px solid var(--line);
  background: rgba(7, 11, 18, 0.85);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: flex-start;
}

.footer-brand strong {
  display: block;
  letter-spacing: 0.12em;
}

.footer-brand span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-links a:hover { color: var(--text-primary); }

.footer-links .placeholder {
  color: var(--text-dim);
  font-size: 0.88rem;
  font-style: italic;
}

/* Mobile */
@media (max-width: 1100px) {
  .site-shell { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
  .page-toc { display: none; }
}

@media (max-width: 860px) {
  .site-shell { display: block; }

  .nav-toggle { display: inline-flex; }

  .site-nav {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    max-height: none;
    background: var(--bg-deep);
    border-right: none;
    padding-bottom: 120px;
  }

  .site-nav.open { display: block; }

  .site-main { padding: 24px 20px 64px; }

  .search-input { width: 140px; }

  .header-actions .btn { padding: 10px 12px; font-size: 0.72rem; }
}

@media (max-width: 480px) {
  .brand-sub { display: none; }
  .hero { padding: 24px 18px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  table { font-size: 0.85rem; }
  th, td { padding: 8px 10px; }
}
