/* ==========================================================================
   SelfClaw — design tokens
   ========================================================================== */
:root {
  --bg: #111917;
  --bg-elevated: #18221f;
  --bg-code: #0c1210;
  --bg-code-header: #0f1613;

  --text-heading: #f2f0e9;
  --text-body: #b8c0bb;
  --text-muted: #7c8985;
  --text-faint: #5a655f;

  --border: #2a332f;
  --border-soft: #232b28;

  --accent-orange: #ef7954;
  --accent-orange-hover: #e0673f;
  --accent-teal: #6eb39f;
  --accent-teal-hover: #5da28e;
  --accent-green: #25ae50;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Menlo, Consolas, monospace;

  --container-max: 1320px;
  --side-pad: 2.5rem;

  --radius: 3px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

ul {
  margin: 0;
  padding: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent-orange);
  color: #111;
  padding: 0.75rem 1.25rem;
  z-index: 999;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

:focus-visible {
  outline: 2px solid var(--accent-orange);
  outline-offset: 2px;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--side-pad);
}

/* ==========================================================================
   Typography helpers
   ========================================================================== */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--accent-orange);
  margin: 0 0 1.1rem;
  text-transform: uppercase;
}

.section-heading {
  font-size: clamp(1.9rem, 3.4vw, 2.65rem);
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 1.4rem;
  max-width: 850px;
}

.section-copy {
  font-size: 1.05rem;
  color: var(--text-body);
  max-width: 760px;
  margin: 0 0 1.5rem;
  line-height: 1.6;
}

.accent-orange {
  color: var(--accent-orange);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.9rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity .15s ease;
  line-height: 1.2;
}

.btn-primary {
  background: var(--accent-orange);
  color: #17110d;
}

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

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-heading);
}

.btn-outline:hover {
  border-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
}

.btn-teal {
  background: var(--accent-teal);
  color: #0d1a16;
}

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

.btn-small {
  padding: 0.55rem 1.1rem;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  margin-bottom: 2.5rem;
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  gap: 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.logo-mark {
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
  height: 24px;

}

.logo-mark span {
  display: block;
  width: 5px;
  background: var(--accent-green);
  border-radius: 1px;
}

.logo-mark span:nth-child(1) {
  height: 60%;
}

.logo-mark span:nth-child(2) {
  height: 100%;
}

.logo-mark span:nth-child(3) {
  height: 78%;
}

.logo-text {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--text-heading);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 2.1rem;
  flex: 1;
  justify-content: center;
}

.main-nav a {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-body);
  transition: color 0.15s ease;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-shrink: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-body);
  font-size: 1.15rem;
  border-radius: var(--radius);
  transition: color 0.15s ease, background-color .15s ease;
}

.icon-btn:hover {
  color: var(--text-heading);
  background: rgba(255, 255, 255, 0.04);
}

.menu-toggle {
  display: none;
}

/* ==========================================================================
   Mobile menu
   ========================================================================== */

.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: min(360px, 92vw);
  height: 100%;
  background: var(--bg);
  border-left: 1px solid var(--border);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.mobile-menu.open {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  border-bottom: 1px solid var(--border);
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.mobile-nav-links a {
  padding: 1.15rem 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-heading);
  border-bottom: 1px solid var(--border-soft);
}

.mobile-nav-links a:last-child {
  border-bottom: none;
}

.mobile-menu-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
}

.mobile-theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: var(--text-body);
  padding: 0.5rem;
}

.mobile-menu-footer .btn {
  width: 100%;
}

.mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 190;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.mobile-menu-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

body.menu-open {
  overflow: hidden;
}

/* ==========================================================================
   Meta bar
   ========================================================================== */

.meta-bar {
  border-bottom: 1px solid var(--border-soft);
}

.meta-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 0.85rem 0;
  flex-wrap: wrap;
}

.meta-left,
.meta-right {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.meta-right {
  text-align: right;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  padding: 5.5rem 0 3rem;
}

.hero-heading {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.07;
  letter-spacing: -0.02em;
  margin: 0 0 1.75rem;
  max-width: 1150px;
}

.hero-copy {
  font-size: 1.15rem;
  color: var(--text-body);
  max-width: 700px;
  line-height: 1.6;
  margin: 0 0 2.25rem;
}

.stats-row {
  display: flex;
  gap: 3.5rem;
  flex-wrap: wrap;
  padding-top: 2.25rem;
  border-top: 1px solid var(--border-soft);
}

.stat-number {
  font-family: var(--font-sans);
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-heading);
  margin: 0 0 0.2rem;
  line-height: 1;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0;
  text-transform: uppercase;
}

/* ==========================================================================
   Sections
   ========================================================================== */

.section {
  padding: 4rem 0;
  border-top: 1px solid var(--border-soft);
}

/* ==========================================================================
   Four layers grid
   ========================================================================== */

.layers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 2.5rem;
}

.layer-card {
  padding: 1.75rem 1.6rem;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.layer-card:first-child {
  border-left: none;
}

.layer-index {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.layer-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 0.85rem;
}

.layer-copy {
  font-size: 0.92rem;
  color: var(--text-body);
  line-height: 1.55;
  flex: 1;
  margin: 0 0 1.5rem;
}

.tag-live {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--accent-teal);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.tag-live i {
  font-size: 0.5rem;
}

.tag-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-orange);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  transition: gap 0.15s ease;
}

.tag-link:hover {
  gap: 0.6rem;
}

/* ==========================================================================
   Pills
   ========================================================================== */

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-body);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  background: var(--bg-elevated);
}

/* ==========================================================================
   Runtime panel
   ========================================================================== */

.runtime-panel {
  position: relative;
  background: var(--bg-code);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent-orange);
  border-radius: var(--radius);
  padding: 2.75rem 2.75rem 2.75rem 5.5rem;
}

.runtime-index {
  position: absolute;
  top: 2.4rem;
  left: 1.9rem;
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--border);
  margin: 0;
  line-height: 1;
}

.runtime-content .section-heading,
.runtime-content .section-copy {
  max-width: 900px;
}

.runtime-subcopy {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 820px;
  margin: 0 0 2.25rem;
}

.runtime-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2.75rem;
  margin-bottom: 2.25rem;
}

.runtime-stats .stat-number {
  color: var(--text-heading);
}

.runtime-btn-row {
  margin-bottom: 0;
  align-items: center;
}

.slots-remaining {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Roadmap cards
   ========================================================================== */

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

.roadmap-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.75rem;
}

.tag-box {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--accent-teal);
  border: 1px solid rgba(110, 179, 159, 0.35);
  border-radius: var(--radius);
  padding: 0.3rem 0.7rem;
  margin-bottom: 1.5rem;
}

.roadmap-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 0.75rem;
}

.roadmap-copy {
  font-size: 0.92rem;
  color: var(--text-body);
  line-height: 1.55;
  margin: 0;
}

/* ==========================================================================
   Integrations bar
   ========================================================================== */

.integrations-bar {
  margin-top: 3.5rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.5rem 2.5rem;
}

.integrations-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0;
  white-space: nowrap;
}

.integrations-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2.25rem;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--text-body);
}

.integrations-logos a:hover {
  color: var(--text-heading);
}

.integrations-note {
  font-size: 0.82rem;
  color: var(--text-faint);
  margin: 0;
  max-width: 260px;
  line-height: 1.5;
}

/* ==========================================================================
   Identity equation
   ========================================================================== */

.equation-heading {
  font-family: var(--font-mono);
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  font-weight: 600;
  color: var(--text-heading);
  margin: 0 0 1.4rem;
  max-width: 900px;
  line-height: 1.4;
}

/* ==========================================================================
   Code blocks
   ========================================================================== */

.code-blocks {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 2.5rem 0 2.5rem;
}

.code-block {
  background: var(--bg-code);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}

.code-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-code-header);
}

.code-block pre {
  margin: 0;
  padding: 1.5rem;
  overflow-x: auto;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  color: #e5e5e5;
  white-space: pre;
}

.code-kw {
  color: #e5989b;
}

.code-str {
  color: #a8d5ba;
}

.code-fn {
  color: #8ab6d6;
}

.code-comment {
  color: var(--text-faint);
  font-style: italic;
}

/* ==========================================================================
   Referral
   ========================================================================== */

.referral-section {
  padding: 2.5rem 0;
}

.referral-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.referral-copy {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0;
}

/* ==========================================================================
   FAQ
   ========================================================================== */

.faq-list {
  margin-top: 2.5rem;
  border-top: 1px solid var(--border-soft);
}

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

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.6rem 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
  text-align: left;
}

.faq-question i {
  font-size: 1.2rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.faq-item.open .faq-question i {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
}

.faq-item.open .faq-answer {
  max-height: 320px;
  padding-bottom: 1.6rem;
}

.faq-answer p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-body);
  line-height: 1.6;
  max-width: 760px;
}

.faq-more {
  margin-top: 2.5rem;
  display: flex;
  justify-content: center;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--text-heading);
  padding: 2.5rem 0 2.25rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  margin-bottom: 2rem;
}

.footer-links a {
  font-size: 0.88rem;
  color: var(--text-body);
}

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

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-soft);
}

.footer-bottom p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-faint);
}

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

/* ==========================================================================
   Light theme (best-effort toggle)
   ========================================================================== */

body.light {
  --bg: #f7f6f2;
  --bg-elevated: #ffffff;
  --bg-code: #10201b;
  --bg-code-header: #0d1a16;
  --text-heading: #14201c;
  --text-body: #40453f;
  --text-muted: #767f78;
  --text-faint: #98a099;
  --border: #dcdad2;
  --border-soft: #e7e5dd;
}

body.light .btn-primary {
  color: #17110d;
}

body.light .site-footer {
  border-top-color: var(--text-heading);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1080px) {
  .layers-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .layer-card:nth-child(3) {
    border-left: none;
  }

  .layer-card:nth-child(1),
  .layer-card:nth-child(3) {
    border-left: none;
  }

  .layer-card:nth-child(2n) {
    border-left: 1px solid var(--border-soft);
  }

  .layer-card {
    border-bottom: 1px solid var(--border-soft);
  }

  .layer-card:nth-last-child(-n+2) {
    border-bottom: none;
  }

  .roadmap-grid {
    grid-template-columns: 1fr 1fr;
  }

  .integrations-bar {
    grid-template-columns: 1fr;
  }

  .integrations-note {
    max-width: 100%;
  }
}

@media (max-width: 900px) {
  .main-nav {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  :root {
    --side-pad: 1.5rem;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 2.75rem 0 2rem;
  }

  .section {
    padding: 2.75rem 0;
  }

  .meta-bar-inner {
    justify-content: flex-start;
  }

  .meta-left {
    display: none;
  }

  .meta-right {
    text-align: left;
  }

  .btn-row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-row .btn {
    width: 100%;
  }

  .stats-row {
    gap: 1.75rem;
  }

  .layers-grid {
    grid-template-columns: 1fr;
    border: 1px solid var(--border-soft);
  }

  .layer-card,
  .layer-card:nth-child(2n),
  .layer-card:first-child {
    border-left: none;
    border-bottom: 1px solid var(--border-soft);
    min-height: 0;
  }

  .layer-card:last-child {
    border-bottom: none;
  }

  .roadmap-grid {
    grid-template-columns: 1fr;
  }

  .runtime-panel {
    padding: 2rem 1.5rem 2rem 1.75rem;
    border-left-width: 3px;
  }

  .runtime-index {
    display: none;
  }

  .runtime-stats {
    gap: 1.5rem 2rem;
  }

  .runtime-btn-row {
    flex-direction: column;
    align-items: stretch;
  }

  .runtime-btn-row .slots-remaining {
    text-align: center;
  }

  .integrations-logos {
    gap: 0.5rem 1.5rem;
  }

  .referral-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .referral-inner .btn {
    width: 100%;
    justify-content: center;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.6rem;
  }
}