/* ==========================================================================
   Apify Actors Portfolio (george.the.developer)
   Philosophy: One page. One 3D scene. Everything else is type and space.
   ========================================================================== */

:root {
  --bg: #06080d;
  --text-100: #ffffff;
  --text-60: rgba(255, 255, 255, 0.6);
  --text-40: rgba(255, 255, 255, 0.4);

  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 255, 255, 0.25);

  --accent: #ff7043;
  --emerald: #10b981;

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

  --max-width: 1080px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg);
  color: var(--text-100);
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-100);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--text-100);
  color: var(--bg);
}

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

/* Layout */
.wrap {
  width: min(calc(100% - 48px), var(--max-width));
  margin-inline: auto;
}

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

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 72px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 8, 13, 0.82);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
}

/* Same grid as the body copy, so the brand lines up with the H1 below it. */
.site-header .wrap {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}

.header-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  transition: color 140ms ease;
}

.brand:hover {
  color: var(--accent);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid rgba(16, 185, 129, 0.32);
  background: rgba(16, 185, 129, 0.08);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #34d399;
  white-space: nowrap;
}

.brand-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.header-nav {
  display: flex;
  gap: 30px;
  font-size: 15px;
  white-space: nowrap;
}

.header-nav a {
  color: rgba(255, 255, 255, 0.62);
  transition: color 0.18s ease;
}

.header-nav a:hover,
.header-nav a:focus-visible {
  color: var(--text-100);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.btn-ghost,
.btn-accent {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.btn-ghost {
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-weight: 500;
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.04);
}

.btn-accent {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #0a0d13;
  font-weight: 600;
}

.btn-accent:hover {
  background: #ff8a63;
  border-color: #ff8a63;
}

/* Sticky header would otherwise eat the top of every anchored section. */
[id] {
  scroll-margin-top: 96px;
}

@media (max-width: 1020px) {
  .site-header .wrap {
    grid-template-columns: 1fr auto;
  }

  .header-nav {
    display: none;
  }
}

/* Both outbound links stay reachable on phones; the badge and the word
   "profile" are what get dropped to make room. */
@media (max-width: 560px) {
  .brand-badge,
  .btn-long {
    display: none;
  }

  .site-header .wrap {
    gap: 12px;
  }

  .brand {
    font-size: 15px;
  }

  .btn-ghost,
  .btn-accent {
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* Spacing between major blocks (160px+) */
.section {
  padding: 160px 0;
  border-bottom: 1px solid var(--border);
}

.section:last-of-type {
  border-bottom: none;
}

/* 1. The Constellation Hero */
.hero-section {
  padding: 60px 0 120px;
  border-bottom: 1px solid var(--border);
}

/* Centered composition: tag → wide title → narrower desc, a funnel toward the
   canvas below. Copy and canvas share the page background — one layer. */
.hero-copy {
  max-width: 68ch;
  margin: 0 auto 28px;
  text-align: center;
}

/* Copy, diagram, and readout enter as one unit — same curve, small offsets —
   so the canvas never "pops in" after the static text. */
@keyframes hero-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-copy,
.constellation-stage,
.constellation-readout {
  animation: hero-enter 0.6s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.constellation-stage {
  animation-delay: 0.08s;
}

.constellation-readout {
  animation-delay: 0.16s;
}

.hero-copy .hero-desc + .hero-desc {
  margin-top: 14px;
}

.hero-desc strong {
  color: var(--text-100);
  font-weight: 600;
}

/* The architecture prose reads as the long form of the diagram above it. */
.hero-section .prose-block {
  margin-top: 56px;
}

.hero-tag {
  font-size: 12px;
  color: var(--text-40);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.hero-title {
  font-size: clamp(32px, 4.8vw, 54px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero-desc {
  font-size: 17px;
  color: var(--text-60);
  line-height: 1.6;
}

.hero-copy .hero-desc {
  max-width: 54ch;
  margin-left: auto;
  margin-right: auto;
}

/* The hero canvas sits directly on the page — no card border, no separate
   layer. The swarm section keeps its framed stage. */
#pipeline-canvas-box {
  background: transparent;
  border: 0;
}

/* Constellation Canvas Stage */
.constellation-stage {
  position: relative;
  width: 100%;
  height: 520px;
  background: #000000;
  border: 1px solid var(--border);
}

.constellation-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  cursor: default;
}

/* Fixed Hover Readout Bar beneath the canvas (never chases mouse) */
.constellation-readout {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  font-size: 13px;
  color: var(--text-60);
}

.readout-label {
  color: var(--text-100);
  font-weight: 600;
}

.readout-meta {
  color: var(--text-40);
}

/* 2. Stats Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

.stat-unit {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: clamp(36px, 4.5vw, 56px);
  font-weight: 700;
  line-height: 1;
  color: var(--text-100);
  letter-spacing: -0.02em;
}

.stat-caption {
  font-size: 13px;
  color: var(--text-40);
  margin-top: 8px;
}

/* 3. The Plain List */
.list-header {
  margin-bottom: 40px;
}

.section-heading {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.section-sub {
  color: var(--text-60);
  font-size: 15px;
}

/* Bento cards — top actors with generated diagrams */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 40px;
}

.bento-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  text-decoration: none;
  color: inherit;
  transition: border-color 140ms ease;
  grid-column: span 3;
}

.bento-card:nth-child(1) { grid-column: span 4; }
.bento-card:nth-child(2) { grid-column: span 2; }

.bento-card:hover {
  border-color: var(--border-focus);
}

.bento-card:hover .bento-name {
  color: var(--accent);
}

.bento-canvas {
  position: relative;
  height: 150px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.bento-card:nth-child(1) .bento-canvas {
  height: 190px;
}

.bento-canvas canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.bento-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.bento-name {
  color: var(--text-100);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  transition: color 120ms ease;
}

.bento-desc {
  color: var(--text-60);
  font-size: 13.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bento-meta {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  gap: 14px;
  align-items: baseline;
  font-size: 11.5px;
  color: var(--text-40);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bento-meta .bento-users {
  color: var(--emerald);
}

@media (max-width: 820px) {
  .bento-grid { grid-template-columns: 1fr; }
  .bento-card,
  .bento-card:nth-child(1),
  .bento-card:nth-child(2) { grid-column: span 1; }
  .bento-card:nth-child(1) .bento-canvas { height: 150px; }
}

.search-wrap {
  margin-bottom: 32px;
}

.search-field {
  position: relative;
  max-width: 440px;
}

.search-input {
  width: 100%;
  padding: 10px 44px 10px 14px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-100);
  font-size: 14px;
  outline: none;
  transition: border-color 120ms ease;
}

.search-input:focus {
  border-color: var(--border-focus);
}

.search-input::placeholder {
  color: var(--text-40);
}

.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-40);
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  pointer-events: none;
}

.search-field:focus-within .search-kbd {
  opacity: 0;
}

/* Plain Rows */
.actor-table {
  width: 100%;
  border-top: 1px solid var(--border);
}

.actor-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.8fr) minmax(100px, 0.8fr) minmax(110px, 0.8fr) 100px;
  gap: 16px;
  align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  cursor: pointer;
}

.actor-row:hover .actor-row-name {
  color: var(--accent);
}

.actor-row.is-active {
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 2px 0 0 var(--accent);
}

.actor-row.is-active .actor-row-name {
  color: var(--accent);
}

.actor-row-name {
  color: var(--text-100);
  font-weight: 500;
  transition: color 100ms ease;
}

.actor-row-users {
  color: var(--text-60);
}

.actor-row-cat {
  color: var(--text-40);
  text-transform: uppercase;
  font-size: 12px;
}

.actor-row-link {
  color: var(--text-40);
  text-align: right;
  font-size: 13px;
}

.actor-row-link:hover {
  color: var(--text-100);
}

/* Expandable row description on click/hover */
.actor-row-detail {
  grid-column: 1 / -1;
  color: var(--text-60);
  font-size: 13.5px;
  line-height: 1.5;
  padding-top: 6px;
  display: none;
}

.actor-row.expanded .actor-row-detail {
  display: block;
}

/* 4. How They Work (3 Prose Paragraphs) */
.prose-block {
  max-width: 68ch;
}

.prose-block p {
  color: var(--text-60);
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: 24px;
}

.prose-block p strong {
  color: var(--text-100);
  font-weight: 600;
}

/* 5. Contact Row */
.contact-section {
  padding: 100px 0 140px;
}

.contact-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  font-size: 14px;
}

.contact-label {
  color: var(--text-60);
}

.contact-links {
  display: flex;
  gap: 24px;
}

.contact-links a {
  color: var(--text-100);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--border-focus);
}

.contact-links a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* Responsive */
@media (max-width: 860px) {
  .section {
    padding: 100px 0;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
  .actor-row {
    grid-template-columns: 1fr auto;
  }
  .actor-row-cat, .actor-row-users {
    display: none;
  }
  .constellation-stage {
    height: 400px;
  }

  /* The pipeline is framed to its width, so a tall box on a phone is just
     empty sky above and below the run. */
  #pipeline-canvas-box {
    height: 320px;
  }
}

@media (max-width: 540px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .contact-line {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Pipeline scene */
.pipeline-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Labels ride above the canvas; pointer-events are re-enabled only on the
   clickable lane labels so they don't block canvas raycasting. */
.pipeline-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pipeline-label {
  position: absolute;
  top: 0;
  left: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-40);
  white-space: nowrap;
  transition: color 0.18s ease;
}

.pipeline-label.is-lane {
  pointer-events: auto;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(6, 8, 13, 0.75);
  color: var(--text-60);
  cursor: pointer;
}

.pipeline-label.is-lane span {
  margin-left: 6px;
  color: var(--emerald);
}

.pipeline-label.is-lane:hover,
.pipeline-label.is-lane:focus-visible {
  border-color: var(--accent);
  color: var(--text-100);
  outline: none;
}

.pipeline-label.is-hot {
  color: var(--accent);
}

/* Category chip */
.search-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-40);
}

.category-chip {
  padding: 3px 9px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: none;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.category-chip:hover {
  background: rgba(255, 112, 67, 0.12);
}

/* Simulator */
.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 40px;
}

.sim-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.015);
}

.sim-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
}

.sim-panel-label {
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-40);
}

.sim-select {
  flex: 1;
  min-width: 0;
  max-width: 60%;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-100);
  font-size: 12px;
}

.sim-select:focus-visible {
  outline: none;
  border-color: var(--border-focus);
}

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

.sim-tab {
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--text-40);
  font-size: 12px;
  cursor: pointer;
}

.sim-tab:hover {
  color: var(--text-100);
}

.sim-tab.is-active {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-100);
}

.sim-copy {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  color: var(--text-60);
  font-size: 12px;
  cursor: pointer;
}

.sim-copy:hover {
  border-color: var(--border-focus);
  color: var(--text-100);
}

.sim-code {
  height: 340px;
  padding: 16px;
  border: 0;
  background: none;
  color: var(--text-60);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  tab-size: 2;
  overflow: auto;
  white-space: pre;
  resize: none;
}

textarea.sim-code {
  color: var(--emerald);
}

textarea.sim-code:focus-visible {
  outline: none;
}

.sim-code.is-error {
  color: var(--accent);
}

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

  .sim-code {
    height: 260px;
  }
}

/* ==========================================================================
   Docs
   ========================================================================== */

.docs-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.docs-step {
  display: flex;
  gap: 14px;
  padding: 22px 20px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}

.docs-step-num {
  font-size: 12px;
  color: var(--accent);
  line-height: 2;
  flex-shrink: 0;
}

.docs-step-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

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

.docs-step-desc a {
  color: var(--text-100);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-focus);
}

.docs-step-desc a:hover {
  text-decoration-color: var(--accent);
}

.docs-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.docs-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  transition: border-color 140ms ease, background 140ms ease;
}

.docs-link:hover {
  border-color: var(--border-focus);
  background: rgba(255, 255, 255, 0.035);
}

.docs-link-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.docs-link-desc {
  font-size: 11px;
  color: var(--text-40);
  letter-spacing: 0.04em;
}

.docs-agents-head {
  margin: 26px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.docs-agents-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.docs-agents-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-60);
  max-width: 74ch;
}

.docs-agents-desc .mono {
  font-size: 11.5px;
  color: var(--accent);
}

.docs-agents {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.agent-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}

.agent-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.agent-name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.agent-path {
  font-size: 10.5px;
  color: var(--text-40);
  letter-spacing: 0.04em;
  text-align: right;
}

.agent-code {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-60);
  white-space: pre;
  overflow-x: auto;
}

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

  .docs-links {
    grid-template-columns: repeat(2, 1fr);
  }

  .docs-agents {
    grid-template-columns: 1fr;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
