:root {
  --bg: #fafafa;
  --bg-muted: #f0f0f2;
  --surface: #ffffff;
  --text: #111114;
  --text-muted: #5c5c66;
  --border: #e2e2e8;
  --accent: #1a1a22;
  --accent-hover: #2d2d38;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Inter", system-ui, sans-serif;
  --radius: 8px;
  --max-width: 1080px;
  --narrow: 680px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

.container {
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
}

.narrow {
  max-width: var(--narrow);
  margin-inline: auto;
}

.mono {
  font-family: var(--mono);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(250, 250, 250, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.logo {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

nav a:hover {
  color: var(--text);
}

.nav-cta {
  color: var(--text) !important;
  font-weight: 500;
}

/* Hero */
.hero {
  padding: 5rem 0 4rem;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 1rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 1.25rem;
  max-width: 22ch;
}

.subheadline {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 62ch;
  margin: 0 0 2rem;
}

.hero-note {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0.75rem 0 0;
}

.hero-analyzer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 720px;
}

.analyzer-helper {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 0.85rem;
}

.hero-textarea {
  width: 100%;
  min-height: 160px;
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  line-height: 1.55;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}

.hero-textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.analyzer-actions {
  margin-top: 0.85rem;
}

.analyzer-model-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}

.hero-results {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.hero-results-error {
  margin: 0;
  font-size: 0.9rem;
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.savings-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 0.25rem;
}

.savings-highlight {
  font-family: var(--mono);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 500;
  margin: 0 0 1.25rem;
  color: #166534;
}

.savings-highlight.savings-muted {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.result-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.result-row:last-of-type {
  margin-bottom: 1rem;
}

.result-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.result-value {
  font-size: 0.95rem;
  font-weight: 500;
}

.waste-section {
  margin: 1rem 0;
}

.waste-heading {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.waste-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

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

.estimate-disclaimer {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 1rem 0 0;
  line-height: 1.5;
}

.hero-cta-block {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.hero-cta-text {
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.hero-cta-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.section-body {
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.section-closing {
  margin: 1.25rem 0 0;
  font-weight: 500;
}

.solution-flow {
  margin-top: 1.25rem;
}

.before-after-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.before-after-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.section-muted .before-after-col {
  background: var(--bg);
}

.before-after-col-after {
  border-color: var(--accent);
}

.before-after-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.before-after-sub {
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0 0 0.75rem;
}

.bullet-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.bullet-list li + li {
  margin-top: 0.4rem;
}

.before-after-result {
  font-size: 1rem;
  margin: 0;
  color: var(--text-muted);
}

.before-after-result strong {
  color: var(--text);
}

.inline-code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

.trust-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 0;
}

.feature-list {
  margin: 0 0 1.5rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.feature-list li + li {
  margin-top: 0.4rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

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

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: #c8c8d0;
}

.btn-full {
  width: 100%;
}

/* Sections */
.section {
  padding: 4rem 0;
}

.section-muted {
  background: var(--bg-muted);
  border-block: 1px solid var(--border);
}

.section h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
}

.section-intro {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.legal-content h2 {
  margin-top: 2rem;
  font-size: 1.125rem;
}

.legal-content ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.legal-content li + li {
  margin-top: 0.35rem;
}

.legal-content a {
  color: var(--text);
  font-weight: 500;
}

.problem-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
}

.problem-list li + li {
  margin-top: 0.5rem;
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Stats */
.stats-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.stat {
  flex: 1;
  min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.stat-highlight {
  border-color: var(--accent);
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.2;
}

.stat-desc {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.stat-arrow {
  font-size: 1.25rem;
  color: var(--text-muted);
}

/* Code */
.code-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 0;
}

.code-block code {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-block-sm {
  margin-top: 1rem;
}

/* Form */
.key-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.optional {
  font-weight: 400;
  color: var(--text-muted);
}

.required {
  color: #c44;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field input.invalid {
  border-color: #c44;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-notice {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.form-notice a {
  color: var(--text);
  font-weight: 500;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.875rem;
  line-height: 1.45;
  cursor: pointer;
}

.checkbox-field input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.form-status {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.form-status.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.form-status.loading {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.key-box {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.key-output {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.85rem 1rem;
  background: var(--bg-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.key-output::placeholder {
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 0.875rem;
}

.key-output.key-output-ready {
  background: #f0fdf4;
  border: 1px solid #86efac;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.btn-copy {
  flex-shrink: 0;
}

.btn-copy:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.warning {
  font-size: 0.85rem;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  margin: 0.75rem 0 0;
}

.usage-panel {
  margin-top: 1.25rem;
}

.usage-label {
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
}

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

.site-footer p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--text);
}

.section-footer-link {
  margin-top: 1rem;
}

.section-footer-link a {
  color: var(--text);
  font-weight: 500;
}

.logo-link {
  color: inherit;
  text-decoration: none;
  line-height: 0;
}

.logo-link:hover {
  color: var(--text);
}

.logo-img {
  display: block;
  height: 2.25rem;
  width: auto;
}

.logo-link:hover .logo-img {
  opacity: 0.85;
}

.nav-active {
  color: var(--text) !important;
  font-weight: 500;
}

/* Docs layout */
.docs-page {
  padding: 2.5rem 0 4rem;
}

.docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

.docs-sidebar {
  position: sticky;
  top: 4.5rem;
}

.docs-sidebar-title {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.docs-toc {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.docs-toc a {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.2rem 0;
  line-height: 1.4;
}

.docs-toc a:hover,
.docs-toc a.active {
  color: var(--text);
}

.docs-toc a.active {
  font-weight: 500;
}

.docs-content h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  line-height: 1.2;
}

.docs-lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 0 0 2.5rem;
  max-width: 60ch;
}

.docs-section {
  padding-top: 2.5rem;
  margin-top: 2.5rem;
  border-top: 1px solid var(--border);
}

.docs-section:first-of-type {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}

.docs-section h2 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}

.docs-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
}

.docs-section p {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.docs-section p:last-child {
  margin-bottom: 0;
}

.docs-section ul,
.docs-section ol {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
}

.docs-section li + li {
  margin-top: 0.35rem;
}

.steps-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
}

.steps-list li + li {
  margin-top: 0.5rem;
}

.steps-list a {
  color: var(--text);
}

.endpoint-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1.25rem;
}

.endpoint-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.method-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.method-get {
  background: #e8f5e9;
  color: #2e7d32;
}

.method-post {
  background: #e3f2fd;
  color: #1565c0;
}

.endpoint-path {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
}

.endpoint-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.auth-badge {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  margin-bottom: 1rem;
}

.param-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0 0 1.25rem;
}

.param-table th,
.param-table td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  vertical-align: top;
}

.param-table th {
  background: var(--bg-muted);
  font-weight: 500;
  color: var(--text);
}

.param-table td {
  color: var(--text-muted);
}

.param-table code {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0 0 1rem;
}

.ref-table th,
.ref-table td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  vertical-align: top;
}

.ref-table th {
  background: var(--bg-muted);
  font-weight: 500;
}

.ref-table td {
  color: var(--text-muted);
}

.ref-table code {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
}

.code-block-wrap {
  position: relative;
  margin: 0 0 1.25rem;
}

.code-block-wrap:last-child {
  margin-bottom: 0;
}

.code-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.code-block-wrap .code-block {
  margin: 0;
  padding-right: 4.5rem;
}

.code-copy-btn {
  position: absolute;
  right: 0.65rem;
  bottom: 0.65rem;
  padding: 0.35rem 0.65rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.code-copy-btn:hover {
  color: var(--text);
  border-color: #c8c8d0;
}

.info-box {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 0 0 1rem;
}

.workflow-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0 0 1rem;
}

.workflow-arrow {
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .docs-sidebar {
    position: static;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
  }

  .docs-toc {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
  }
}

@media (max-width: 600px) {
  .hero {
    padding: 3rem 0 2.5rem;
  }

  .hero-analyzer {
    padding: 1rem;
  }

  .hero h1 {
    max-width: none;
  }

  .before-after-grid {
    grid-template-columns: 1fr;
  }

  .result-row {
    flex-direction: column;
    gap: 0.25rem;
  }

  .workflow-steps {
    flex-direction: column;
    align-items: flex-start;
  }

  .workflow-arrow {
    display: none;
  }

  .analyzer-actions .btn {
    width: 100%;
  }

  .hero-cta-block .btn {
    width: 100%;
  }

  .stat-arrow {
    display: none;
  }

  .key-box {
    flex-direction: column;
  }

  .param-table,
  .ref-table {
    display: block;
    overflow-x: auto;
  }
}
