/* ============================================================
   BUGCATCH LANDING PAGE
   Fonts: Instrument Serif (display) + IBM Plex Mono (body/ui)
   Palette: near-black bg · off-white text · red accent
   ============================================================ */


/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* Background layers */
  --color-bg:             #09090b;
  --color-surface:        #111114;
  --color-surface-raised: #16161a;

  /* Borders */
  --color-border:         #1d1d22;
  --color-border-bright:  #2a2a32;

  /* Text */
  --color-text:           #eeeeed;
  --color-text-secondary: #9292aa;
  --color-text-muted:     #60606e;

  /* Accent — error red */
  --color-accent:         #e53e3e;
  --color-accent-dim:     rgba(229, 62, 62, 0.08);
  --color-accent-mid:     rgba(229, 62, 62, 0.2);

  /* Syntax highlighting */
  --code-bg:              #0d0d11;
  --code-text:            #c0c0cc;
  --code-keyword:         #7aa2f7;
  --code-string:          #9ece6a;
  --code-comment:         #5e5e7a;
  --code-property:        #e0af68;
  --code-function:        #7dcfff;
  --code-bool:            #ff9e64;

  /* Typography */
  --font-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-mono:    'Space Mono', 'Courier New', monospace;

  /* Spacing (4px base) */
  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  20px;
  --s-6:  24px;
  --s-8:  32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;
  --s-20: 80px;
  --s-24: 96px;
  --s-32: 128px;

  /* Layout */
  --container-max:     1100px;
  --container-pad:     var(--s-6);

  /* Radii */
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 10px;
}


/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Subtle dot-grid texture across the entire page */
  background-image: radial-gradient(circle at 1px 1px, var(--color-border) 1px, transparent 0);
  background-size: 28px 28px;
}

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

ul, ol { list-style: none; }

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

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

em {
  font-style: italic;
}

h1, h2, h3 {
  font-weight: normal;
  line-height: 1.1;
}

/* Focus visible outline */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}


/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

section {
  padding-block: var(--s-24);
}


/* ============================================================
   TYPOGRAPHY — SHARED
   ============================================================ */
.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-5);
}

.section-label::before {
  content: '';
  display: block;
  width: 18px;
  height: 1px;
  background: var(--color-accent);
  flex-shrink: 0;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 52px);
  font-weight: normal;
  color: var(--color-text);
  margin-bottom: var(--s-6);
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.section-subtitle {
  font-size: 14px;
  color: var(--color-text-secondary);
  max-width: 520px;
  margin-bottom: var(--s-10);
}


/* ============================================================
   COMPONENTS — BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.03em;
  padding: 10px var(--s-5);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-primary:hover {
  background: #c53030;
  border-color: #c53030;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: var(--color-border-bright);
}

.btn-ghost:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

.btn-lg {
  padding: 12px var(--s-8);
  font-size: 14px;
}


/* ============================================================
   COMPONENTS — CODE WINDOW
   ============================================================ */
.code-window {
  background: var(--code-bg);
  border: 1px solid var(--color-border-bright);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.code-window-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-border-bright);
  flex-shrink: 0;
}

.dot:nth-child(1) { background: #ff5f57; }
.dot:nth-child(2) { background: #febc2e; }
.dot:nth-child(3) { background: #28c840; }

.code-window-title {
  margin-left: auto;
  font-size: 11px;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

.code-block {
  padding: var(--s-6);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.75;
  color: var(--code-text);
}

/* Syntax highlighting spans */
.kw   { color: var(--code-keyword); }
.str  { color: var(--code-string); }
.cmt  { color: var(--code-comment); font-style: italic; }
.prop { color: var(--code-property); }
.fn   { color: var(--code-function); }
.bool { color: var(--code-bool); }


/* ============================================================
   COMPONENTS — INSTALL BAR
   ============================================================ */
.install-bar {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border-bright);
  border-radius: var(--radius-md);
  padding: var(--s-3) var(--s-4);
  max-width: 100%;
  margin-bottom: var(--s-12);
}

.install-prompt {
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 14px;
  user-select: none;
  flex-shrink: 0;
}

.install-cmd {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--color-text);
  flex: 1;
  white-space: nowrap;
}

.copy-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.copy-btn:hover {
  color: var(--color-text-secondary);
  border-color: var(--color-border-bright);
}

.copy-btn.is-copied {
  color: var(--code-string);
  border-color: var(--code-string);
}


/* ============================================================
   HEADER & NAV
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 9, 11, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: var(--s-6);
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  margin-left: auto;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-text-secondary);
  transition: color 0.15s ease;
}

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

.nav-cta {
  background: var(--color-accent);
  color: #fff !important;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  transition: background-color 0.15s ease !important;
}

.nav-cta:hover {
  background: #c53030 !important;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--s-2);
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--color-text-secondary);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}


/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding-block: var(--s-24) var(--s-20);
  position: relative;
  overflow: hidden;
}

/* Red glow behind code area */
.hero::after {
  content: '';
  position: absolute;
  top: 0;
  right: -5%;
  width: 50%;
  height: 100%;
  background: radial-gradient(ellipse at 80% 30%, rgba(229, 62, 62, 0.07) 0%, transparent 65%);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  column-gap: var(--s-12);
  row-gap: var(--s-8);
  position: relative;
  z-index: 1;
}

.hero-title {
  grid-column: 1;
  grid-row: 1;
  font-family: var(--font-display);
  font-size: clamp(48px, 7vw, 96px);
  font-weight: normal;
  letter-spacing: -0.025em;
  line-height: 1.0;
  color: var(--color-text);
}

.hero-title em {
  font-style: italic;
  color: var(--color-text-secondary);
}

.hero-content {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: var(--s-6);
  align-self: start;
}

.hero-description {
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text-secondary);
  max-width: 400px;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-3);
}

.hero-stack {
  font-size: 11px;
  color: var(--color-text-muted);
  letter-spacing: 0.06em;
}

.hero-code {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}


/* ============================================================
   ABOUT
   ============================================================ */
.about {
  padding-block: var(--s-20);
}

.about-rule {
  border: none;
  border-top: 1px solid var(--color-border);
  margin-bottom: var(--s-16);
  position: relative;
}

.about-rule::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 64px;
  height: 1px;
  background: var(--color-accent);
}

.about-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--s-12);
}

.about-aside {
  padding-top: var(--s-1);
}

.about-statement {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: normal;
  line-height: 1.35;
  color: var(--color-text);
  margin-bottom: var(--s-6);
  letter-spacing: -0.01em;
}

.about-statement em {
  font-style: italic;
  color: var(--color-text-secondary);
}

.about-para {
  font-size: 14px;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin-bottom: var(--s-4);
}


/* ============================================================
   HOW IT WORKS
   ============================================================ */
.how {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.flow-steps {
  display: flex;
  align-items: flex-start;
  gap: var(--s-4);
  margin-top: var(--s-10);
  flex-wrap: wrap;
}

.flow-step {
  flex: 1;
  min-width: 180px;
}

.flow-num {
  display: block;
  font-size: 11px;
  color: var(--color-accent);
  letter-spacing: 0.1em;
  margin-bottom: var(--s-2);
}

.flow-step-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--s-2);
}

.flow-step-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.65;
}

.flow-step-desc code {
  color: var(--code-property);
  background: var(--color-border);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.flow-arrow {
  color: var(--color-text-muted);
  font-size: 18px;
  padding-top: 30px;
  flex-shrink: 0;
  user-select: none;
}


/* ============================================================
   FEATURES
   ============================================================ */
.features {
  padding-block: var(--s-24);
}

.features-list {
  margin-top: var(--s-10);
  border-top: 1px solid var(--color-border);
}

.feature-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: baseline;
  gap: var(--s-4) var(--s-6);
  padding-block: var(--s-6);
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.12s ease;
}

.feature-item:hover {
  background: var(--color-accent-dim);
  border-radius: var(--radius-sm);
}

.feature-item:hover .feature-name {
  color: var(--color-accent);
}

.feature-num {
  font-size: 10px;
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  padding-top: 2px;
}

.feature-body {
  min-width: 0;
}

.feature-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--s-1);
  transition: color 0.12s ease;
}

.feature-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  max-width: 600px;
}

.feature-tag {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  background: var(--color-border);
  border: 1px solid var(--color-border-bright);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  white-space: nowrap;
  align-self: start;
  margin-top: 2px;
}


/* ============================================================
   INTEGRATION
   ============================================================ */
.integration {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.code-examples {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-6);
}

.code-label {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: var(--s-3);
  letter-spacing: 0.04em;
}

.code-label code {
  color: var(--code-property);
}


/* ============================================================
   SELF-HOSTED
   ============================================================ */
.self-hosted {
  padding-block: var(--s-24);
  /* Subtle diagonal stripe texture */
  background-image:
    radial-gradient(circle at 1px 1px, var(--color-border) 1px, transparent 0),
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 24px,
      rgba(255, 255, 255, 0.012) 24px,
      rgba(255, 255, 255, 0.012) 25px
    );
  background-size: 28px 28px, auto;
}

.self-hosted-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-12);
  background: var(--color-surface);
  border: 1px solid var(--color-border-bright);
  border-radius: var(--radius-lg);
  padding: var(--s-12);
  position: relative;
  overflow: hidden;
}

/* Red accent line at the top of the panel */
.self-hosted-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 30%;
  height: 2px;
  background: linear-gradient(90deg, var(--color-accent) 0%, transparent 100%);
}

.self-hosted-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.5vw, 42px);
  font-weight: normal;
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin-block: var(--s-5) var(--s-6);
  line-height: 1.1;
}

.self-hosted-title em {
  font-style: italic;
  color: var(--color-text-secondary);
}

.self-hosted-desc {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--s-6);
}

.self-hosted-points {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.self-hosted-points li {
  font-size: 13px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.self-hosted-points li::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0;
}

.self-hosted-code {
  align-self: center;
}


/* ============================================================
   CTA
   ============================================================ */
.cta {
  text-align: center;
  padding-block: var(--s-32);
  position: relative;
  overflow: hidden;
}

/* Glow under the CTA */
.cta::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-border-bright), transparent);
}

.cta .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-6);
}

.cta .section-label {
  justify-content: center;
}

.cta-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 72px);
  font-weight: normal;
  letter-spacing: -0.025em;
  color: var(--color-text);
  line-height: 1.05;
  max-width: 14ch;
}

.cta-title em {
  font-style: italic;
  color: var(--color-text-secondary);
}

.cta-install {
  margin-bottom: 0;
}

.cta-actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  justify-content: center;
}


/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding-block: var(--s-10);
}

.footer-inner {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  flex-wrap: wrap;
}

.footer-logo {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text);
  margin-right: auto;
}

.footer-tagline {
  font-size: 13px;
  color: var(--color-text-muted);
  flex: 1;
  min-width: 200px;
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  flex-wrap: wrap;
}

.footer-nav a {
  font-size: 13px;
  color: var(--color-text-muted);
  transition: color 0.15s ease;
}

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


/* ============================================================
   RESPONSIVE — TABLET (max 900px)
   ============================================================ */
@media (max-width: 900px) {
  section {
    padding-block: var(--s-16);
  }

  /* Hero */
  .hero-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    row-gap: var(--s-8);
  }

  .hero-title {
    grid-column: 1;
    grid-row: 1;
    font-size: clamp(48px, 10vw, 80px);
  }

  .hero-content {
    grid-column: 1;
    grid-row: 2;
  }

  .hero-code {
    grid-column: 1;
    grid-row: 3;
  }

  /* About */
  .about-grid {
    grid-template-columns: 1fr;
    gap: var(--s-6);
  }

  /* Features */
  .feature-item {
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto;
  }

  .feature-tag {
    grid-column: 2;
    justify-self: start;
  }

  /* Integration */
  .code-examples {
    grid-template-columns: 1fr;
  }

  /* Self-hosted */
  .self-hosted-panel {
    grid-template-columns: 1fr;
    gap: var(--s-8);
  }

  /* CTA */
  .cta-title {
    font-size: clamp(32px, 8vw, 56px);
  }

  /* Footer */
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s-4);
  }

  .footer-logo {
    margin-right: 0;
  }
}


/* ============================================================
   RESPONSIVE — MOBILE (max 640px)
   ============================================================ */
@media (max-width: 640px) {
  :root {
    --container-pad: var(--s-5);
  }

  section {
    padding-block: var(--s-12);
  }

  /* Nav toggle visible */
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    position: fixed;
    inset: 60px 0 0 0;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    flex-direction: column;
    align-items: flex-start;
    padding: var(--s-8) var(--container-pad);
    gap: var(--s-6);
    z-index: 99;
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a {
    font-size: 16px;
  }

  .nav-cta {
    align-self: flex-start;
  }

  /* Hero */
  .hero {
    padding-block: var(--s-12) var(--s-10);
  }

  .hero-title {
    font-size: clamp(38px, 12vw, 56px);
  }

  .hero-description {
    font-size: 14px;
  }

  /* About */
  .about {
    padding-block: var(--s-12);
  }

  /* Flow */
  .flow-steps {
    flex-direction: column;
    gap: var(--s-8);
  }

  .flow-arrow {
    display: none;
  }

  /* Features */
  .feature-item {
    grid-template-columns: 1fr;
    gap: var(--s-2);
    padding-block: var(--s-5);
  }

  .feature-num {
    display: none;
  }

  .feature-tag {
    grid-column: 1;
  }

  /* Self-hosted panel */
  .self-hosted-panel {
    padding: var(--s-8);
  }

  /* CTA */
  .cta {
    padding-block: var(--s-20);
  }

  .cta-title {
    font-size: clamp(30px, 10vw, 44px);
  }

  .cta-actions {
    flex-direction: column;
    width: 100%;
  }

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

  /* Install bar */
  .install-bar {
    width: 100%;
    max-width: 100%;
  }

  .install-cmd {
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}


/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
