/* CodeLoupe marketing site — layout and components on top of tokens.css. */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--type-body);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

a {
  color: var(--accent-text);
  text-decoration: none;
}

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

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection {
  background: rgba(255, 107, 74, 0.35);
}

code,
.mono {
  font: var(--type-mono);
}

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

.section {
  padding: var(--space-section) 0;
}

.section--tight {
  padding: clamp(48px, 6vw, 80px) 0 var(--space-section);
}

.section-head {
  max-width: 640px;
  margin: 0 0 40px;
}

.section-head h2 {
  font: var(--type-h2);
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}

.section-head p {
  font: var(--type-lead);
  color: var(--text-2);
  margin: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: var(--type-mono);
  color: var(--text-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 8px 16px;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-mint);
  flex: none;
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}

.nav.is-scrolled {
  border-bottom-color: var(--line);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--gutter);
  max-width: var(--container);
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 600 18px/1 var(--font-sans);
  color: var(--text);
}

.brand img {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  font: var(--type-small);
  color: var(--text-2);
}

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

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-2);
  background: var(--btn2);
  color: var(--text);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--btn2-hover);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.menu-btn {
  display: none;
}

.mobile-menu {
  display: none;
}

.mobile-menu.is-open {
  display: block;
  border-top: 1px solid var(--line);
}

.mobile-menu a {
  padding: 12px 0;
  color: var(--text-2);
  font: var(--type-small);
}

@media (max-width: 860px) {
  .nav-links {
    display: none;
  }
  .nav-actions .btn {
    display: none;
  }
  .menu-btn {
    display: inline-flex;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  font: 600 15px/1.3 var(--font-sans);
  cursor: pointer;
  border: 1px solid transparent;
  max-width: 100%;
  text-align: center;
}

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

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

.btn-secondary {
  background: var(--btn2);
  border-color: var(--line-2);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--btn2-hover);
  color: var(--text);
}

.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.btn-tag {
  font: var(--type-mono-sm);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--chip);
  margin-left: 4px;
}

/* Hero */
.hero {
  padding: clamp(56px, 9vw, 104px) 0 0;
  text-align: center;
}

.hero h1 {
  font: var(--type-display);
  letter-spacing: -0.04em;
  margin: 22px auto 20px;
  max-width: 900px;
}

.hero-lead {
  font: var(--type-lead);
  color: var(--text-2);
  max-width: 620px;
  margin: 0 auto 34px;
}

.hero-ctas {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.hero-meta {
  font: var(--type-mono-sm);
  color: var(--text-3);
  margin-bottom: 48px;
}

.hero-meta span + span::before {
  content: "\00b7";
  margin: 0 8px;
}

/* IDE mock frame */
.ide-frame {
  max-width: 1040px;
  margin: 0 auto;
  border: 1px solid var(--ide-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--ide-bg);
  overflow: hidden;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.55);
}

.ide-titlebar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ide-line);
}

.ide-dots {
  display: flex;
  gap: 7px;
}

.ide-dots span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

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

.ide-repo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: var(--type-mono-sm);
  color: var(--ide-text-2);
}

.ide-repo-badge {
  background: var(--brand-mint);
  color: #06251b;
  font-weight: 700;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 10px;
}

.ide-toolbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ide-line);
  font: var(--type-small);
  color: var(--ide-text-2);
  flex-wrap: wrap;
}

.ide-tabs {
  display: flex;
  gap: 4px;
}

.ide-tab {
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 600;
  color: var(--ide-text-2);
}

.ide-tab.is-active {
  background: var(--ide-sel);
  color: var(--ide-text);
}

.ide-select {
  border: 1px solid var(--ide-line);
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--ide-text-2);
  background: transparent;
}

.hero-map,
.map-demo {
  position: relative;
  height: 460px;
  background: var(--map-bg);
}

@media (max-width: 640px) {
  .hero-map,
  .map-demo {
    height: 320px;
  }
}

/* Problem / how it works */
.problem-lead {
  font: var(--type-lead);
  color: var(--text-2);
  max-width: 720px;
}

.problem-stat {
  color: var(--text);
  font-weight: 600;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 56px;
}

@media (max-width: 860px) {
  .steps {
    grid-template-columns: 1fr;
  }
}

.step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--chip);
  color: var(--text);
  font: 600 14px var(--font-mono);
  margin-bottom: 16px;
}

.step h3 {
  font: var(--type-h3);
  margin: 0 0 8px;
}

.step p {
  color: var(--text-2);
  margin: 0 0 14px;
  font: var(--type-small);
}

.step-chip {
  font: var(--type-mono-sm);
  color: var(--text-3);
  background: var(--chip);
  border-radius: 6px;
  padding: 6px 10px;
  display: inline-block;
}

/* Features */
.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 24px 0 16px;
}

.color-by {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip-btn {
  font: var(--type-small);
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--btn2);
  color: var(--text-2);
  cursor: pointer;
}

.chip-btn:hover {
  color: var(--text);
}

.chip-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.map-hint {
  font: var(--type-small);
  color: var(--text-3);
}

.map-demo {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Table */
.table-wrap {
  margin-top: 56px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  overflow-x: auto;
}

table.hotspot-table {
  width: 100%;
  border-collapse: collapse;
  font: var(--type-mono-sm);
  min-width: 720px;
}

.hotspot-table thead th {
  text-align: left;
  padding: 12px 16px;
  background: var(--surface-2);
  color: var(--text-2);
  font: 600 12px/1 var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.hotspot-table thead th:hover {
  color: var(--text);
}

.hotspot-table thead th.is-sorted {
  color: var(--accent-text);
}

.hotspot-table tbody td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.hotspot-table tbody tr:last-child td {
  border-bottom: none;
}

.hotspot-table tbody tr:hover {
  background: var(--chip);
}

.table-path {
  color: var(--text);
  font-weight: 500;
}

.table-dir {
  color: var(--text-3);
  font-weight: 400;
}

.score-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 7px;
  vertical-align: middle;
}

/* Views grid (coupling / knowledge map / trends / export) */
.views-head {
  margin-top: 64px;
}

.views-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (max-width: 720px) {
  .views-grid {
    grid-template-columns: 1fr;
  }
}

.view-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.view-card h3 {
  font: var(--type-h3);
  margin: 0 0 8px;
}

.view-card p {
  color: var(--text-2);
  font: var(--type-small);
  margin: 0 0 14px;
}

.coupling-pair {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font: var(--type-mono-sm);
  padding: 8px 0;
  border-top: 1px solid var(--line);
  gap: 12px;
}

.coupling-pair:first-of-type {
  border-top: none;
}

.coupling-files {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.coupling-degree {
  color: var(--accent-text);
  flex: none;
}

.author-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.author-swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: var(--type-mono-sm);
  color: var(--text-2);
}

.author-swatch i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
}

.sparkline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hs-sparkline rect {
  fill: var(--brand-mint);
}

/* Privacy band */
.band {
  background: var(--band);
  color: var(--brand-ink);
}

.band .section-head p,
.band .section-head h2 {
  color: var(--brand-ink);
}

.privacy-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 8px;
}

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

.privacy-stat {
  border: 1px solid rgba(232, 234, 246, 0.14);
  border-radius: var(--radius-md);
  padding: 16px;
}

.privacy-stat-label {
  font: var(--type-small);
  color: rgba(232, 234, 246, 0.65);
  margin-bottom: 6px;
}

.privacy-stat-value {
  font: 600 20px var(--font-mono);
}

/* Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

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

@media (max-width: 560px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--surface);
}

.metric-card h3 {
  font: 600 15px var(--font-sans);
  margin: 0 0 6px;
}

.metric-card p {
  font: var(--type-small);
  color: var(--text-2);
  margin: 0;
}

.metrics-cta {
  margin-top: 28px;
}

/* FAQ */
.faq {
  max-width: 760px;
}

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

.faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
  background: none;
  border: none;
  text-align: left;
  font: 600 16px var(--font-sans);
  color: var(--text);
  cursor: pointer;
}

.faq-q-plus {
  font: 400 20px var(--font-mono);
  color: var(--text-3);
  transition: transform 0.15s;
  flex: none;
}

.faq-item.is-open .faq-q-plus {
  transform: rotate(45deg);
}

.faq-a {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.2s ease;
}

.faq-item.is-open .faq-a {
  max-height: 240px;
}

.faq-a p {
  margin: 0 0 20px;
  color: var(--text-2);
  font: var(--type-body);
}

/* Install */
.install {
  text-align: center;
  border-top: 1px solid var(--line);
}

.install h2 {
  font: var(--type-h2);
  letter-spacing: -0.03em;
  margin: 0 0 16px;
}

.install-sub {
  font: var(--type-mono-sm);
  color: var(--text-3);
  margin-top: 18px;
}

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

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-links {
  display: flex;
  gap: 22px;
  font: var(--type-small);
  color: var(--text-2);
  flex-wrap: wrap;
}

/* Docs page */
.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  max-width: var(--container);
  margin: 0 auto;
  padding: 48px var(--gutter) 96px;
  align-items: start;
}

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

.docs-nav {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font: var(--type-small);
}

.docs-nav a {
  color: var(--text-2);
  padding: 6px 0;
}

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

.docs-title {
  font: var(--type-h2);
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}

.docs-lead {
  font: var(--type-lead);
  color: var(--text-2);
  max-width: 640px;
  margin: 0 0 48px;
}

.docs-section {
  padding: 36px 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 84px;
}

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

.docs-section h2 {
  font: var(--type-h3);
  font-size: 24px;
  margin: 0 0 14px;
}

.docs-section p {
  color: var(--text-2);
  margin: 0 0 14px;
}

.formula {
  font: var(--type-mono);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 0 0 16px;
  overflow-x: auto;
}

.docs-example {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  font: var(--type-mono-sm);
  margin: 0 0 16px;
}

.docs-example-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}

.docs-note {
  color: var(--text-3);
  font: var(--type-small);
}

.settings-grid {
  display: grid;
  gap: 14px;
}

.settings-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.settings-row:first-child {
  border-top: none;
}

.settings-row dt {
  font: 600 14px var(--font-sans);
}

.settings-row dd {
  margin: 0;
  color: var(--text-2);
  font: var(--type-small);
}

.back-link {
  display: inline-block;
  margin-top: 8px;
}
