:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-muted: #f4f6f8;
  --text: #111111;
  --muted: #6b6b6b;
  --accent: #2f6feb;
  --border: #e5e5e5;
  --success: #17a34a;
  --warn: #eab308;
  --danger: #dc2626;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-raised: 0 2px 8px color-mix(in oklab, var(--text), transparent 92%);
  --shadow-soft: 0 18px 40px color-mix(in oklab, var(--accent), transparent 92%);
  --container: 1200px;
  --gutter: 24px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

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

.muted {
  color: var(--muted);
}

.site-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--bg), transparent 8%);
  backdrop-filter: blur(14px);
}

.site-header-inner,
.site-footer-inner {
  width: min(var(--container), calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 76px;
  padding: 14px 0;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: color-mix(in oklab, var(--accent), white 88%);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title,
.footer-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-tagline,
.footer-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.site-nav {
  display: flex;
  flex: 1 1 320px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.site-nav a,
.footer-links a {
  color: var(--muted);
  transition: color 150ms cubic-bezier(0.23, 1, 0.32, 1), background 150ms cubic-bezier(0.23, 1, 0.32, 1);
}

.site-nav a {
  padding: 10px 14px;
  border-radius: 999px;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface);
}

.header-cta,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--surface);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms cubic-bezier(0.23, 1, 0.32, 1), border-color 150ms cubic-bezier(0.23, 1, 0.32, 1), color 150ms cubic-bezier(0.23, 1, 0.32, 1), transform 150ms cubic-bezier(0.23, 1, 0.32, 1);
}

.header-cta:hover,
.btn:hover {
  background: color-mix(in oklab, var(--accent), black 8%);
}

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

.btn-secondary:hover {
  background: var(--surface);
  color: var(--accent);
  border-color: color-mix(in oklab, var(--accent), var(--border) 50%);
}

.btn-small {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.site-nav a:focus-visible,
.header-cta:focus-visible,
.btn:focus-visible,
.search:focus-visible,
.filter:focus-visible,
.thumb-row button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent), transparent 74%);
  border-color: color-mix(in oklab, var(--accent), var(--border) 40%);
}

.app {
  width: min(var(--container), calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
  padding: 36px 0 80px;
  flex: 1;
  min-width: 0;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.page-intro {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 900px;
}

.page-title,
.page > h1,
.detail-overview h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.page-kicker,
.hero-kicker,
.section-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.page-summary,
.detail-one-liner {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.6;
}

.page-lead,
.hero-summary,
.detail-summary,
.section-note,
.results-summary,
.contact-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.hero-panel,
.surface-card,
.filter-shell,
.detail-media-card,
.detail-overview,
.detail-section,
.contact-card,
.market-empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  gap: 28px;
  padding: clamp(24px, 4vw, 40px);
}

.hero-copy,
.hero-aside,
.detail-media-card,
.detail-overview,
.contact-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hero-actions,
.results-row,
.detail-action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.pill.accent {
  background: color-mix(in oklab, var(--accent), white 88%);
  border-color: color-mix(in oklab, var(--accent), white 75%);
  color: var(--accent);
}

.pill.ghost {
  background: transparent;
}

.stat-grid,
.industry-grid,
.detail-stats-grid,
.metric-grid,
.dataset-grid,
.contact-grid {
  display: grid;
  gap: 14px;
}

.stat-grid,
.metric-grid,
.dataset-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.industry-grid,
.contact-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.detail-stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.stat-card,
.industry-card,
.mini-stat,
.metric-card,
.dataset-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.stat-value,
.mini-stat-value,
.metric-value,
.dataset-value {
  display: block;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 700;
}

.stat-label,
.mini-stat-label,
.metric-label,
.dataset-label,
.industry-count,
.contact-label {
  color: var(--muted);
  font-size: 13px;
}

.industry-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.industry-card strong {
  font-size: 16px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.section-head h2,
.detail-section h3,
.contact-card h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.algo-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-raised);
  transition: transform 200ms cubic-bezier(0.23, 1, 0.32, 1), border-color 200ms cubic-bezier(0.23, 1, 0.32, 1), box-shadow 200ms cubic-bezier(0.23, 1, 0.32, 1);
}

.algo-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in oklab, var(--accent), var(--border) 56%);
  box-shadow: var(--shadow-soft);
}

.algo-card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface-muted);
}

.algo-card-media img,
.card-media-empty {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-media-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.media-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 5px 10px;
  border: 1px solid color-mix(in oklab, var(--border), transparent 8%);
  border-radius: 999px;
  background: color-mix(in oklab, var(--surface), transparent 6%);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 700;
}

.algo-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.algo-card-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.algo-card-title-row h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.algo-card-id {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.algo-card-summary {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.algo-card-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.algo-card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: end;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.filter-shell {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(180px, 0.6fr));
  gap: 12px;
}

.search,
.filter {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.search::placeholder {
  color: var(--muted);
}

.results-row {
  justify-content: space-between;
}

.market-empty {
  padding: 48px 28px;
  text-align: center;
  color: var(--muted);
}

.detail-shell,
.detail-sections {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail-hero-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.96fr) minmax(0, 1.14fr);
  gap: 24px;
  align-items: start;
}

.detail-media-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-self: start;
  position: sticky;
  top: 108px;
}

.detail-media-card,
.detail-overview,
.detail-section,
.detail-side-card,
.contact-card {
  padding: 22px;
}

.detail-main-media {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.detail-main-media img,
.detail-main-media .card-media-empty {
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.thumb-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 10px;
}

.thumb-row button {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 150ms cubic-bezier(0.23, 1, 0.32, 1), transform 150ms cubic-bezier(0.23, 1, 0.32, 1);
}

.thumb-row button:hover {
  transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--accent), var(--border) 55%);
}

.thumb-row img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.detail-breadcrumb {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-side-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-raised);
}

.detail-side-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.detail-side-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-side-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.detail-side-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.detail-side-label {
  color: var(--muted);
  font-size: 13px;
}

.detail-side-value {
  font-size: 14px;
  line-height: 1.5;
  text-align: right;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-section p,
.detail-section ul {
  margin: 0;
}

.bullets {
  padding-left: 18px;
}

.titled-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.titled-block:first-child {
  padding-top: 0;
  border-top: 0;
}

.titled-block strong {
  font-size: 15px;
}

.contact-card {
  gap: 10px;
}

.contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.contact-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface), var(--bg) 70%);
}

.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0 28px;
  flex-wrap: wrap;
}

.footer-brand,
.footer-links {
  display: flex;
  gap: 6px;
}

.footer-brand {
  flex-direction: column;
}

.footer-links {
  flex-wrap: wrap;
  gap: 16px;
}

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

@media (max-width: 1024px) {
  .hero-panel,
  .detail-hero-grid {
    grid-template-columns: 1fr;
  }

  .detail-media-stack {
    position: static;
    top: auto;
  }
}

@media (max-width: 900px) {
  .site-header-inner {
    gap: 16px;
  }

  .site-nav {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .header-cta {
    margin-left: 0;
  }

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

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
  }

  .app {
    padding: 24px 0 48px;
  }

  .hero-panel,
  .detail-media-card,
  .detail-overview,
  .detail-section,
  .filter-shell,
  .contact-card,
  .market-empty {
    padding: 18px;
  }

  .stat-grid,
  .metric-grid,
  .dataset-grid,
  .industry-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .algo-card-footer,
  .results-row,
  .site-footer-inner {
    align-items: flex-start;
  }

  .algo-card-footer,
  .results-row {
    flex-direction: column;
  }

  .algo-card-meta {
    align-items: flex-start;
    text-align: left;
  }

  .site-nav {
    gap: 4px;
  }

  .detail-side-row {
    flex-direction: column;
  }

  .detail-side-value {
    text-align: left;
  }
}
