/* functor.dev — calm, professional retro theme shared by the landing page,
   sandbox, and docs. Dark-violet identity; cyan is the primary accent, pink
   is reserved for the hero wordmark and the gradient rule. */

:root {
  --bg: #0f0c1d;
  --bg-panel: #161226;
  --bg-raised: #1e1833;
  --line: #2b2542;
  --text: #e9e6f2;
  --text-dim: #9b94b3;
  --pink: #e858b8;
  --cyan: #41d8e6;
  --amber: #eec877;
  --green: #6fdc92;
  --red: #f2637f;
  --font-display: "Orbitron", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  line-height: 1.6;
}

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

a:hover {
  text-decoration: underline;
}

/* Theme every scrollbar (page, code panels, editors) — the OS-default silver
   bars glare against the dark panels. Slim, track-less, thumb on --line. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track,
*::-webkit-scrollbar-corner {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: #3d3560;
  background-clip: padding-box;
}

/* Flourish (b): the one decorative divider — a thin cyan→pink rule. */
.gradient-rule {
  height: 1px;
  border: 0;
  max-width: 780px;
  margin: 0 auto;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
}

/* ------------------------------------------------------------- site header */

/* Shared top bar across the landing, sandbox, and docs pages: wordmark left,
   nav right (the sandbox slots its scene controls in between). */
.site-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 12px 24px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
}

.site-nav a {
  font-size: 0.85rem;
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

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

/* ---------------------------------------------------------------- landing */

/* Hero mini-sandbox band: copy left, a live demo card right; stacks below 900px. */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 56px;
  max-width: 1160px;
  min-height: 72vh;
  margin: 0 auto;
  padding: 56px 24px;
}

.hero-copy {
  min-width: 0;
}

.hero-demo {
  min-width: 0;
}

/* The demo card frames the live player iframe; its built-in scrubber and
   mouse-look chrome overlay inside, clipped by the rounded card. */
.hero-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #0d0221;
  box-shadow: 0 24px 60px -34px rgba(0, 0, 0, 0.85);
}

.hero-scene {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 0;
  background: #0d0221;
}

.hero-caption {
  margin: 14px 2px 0;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
}

/* The live code panel below the scene, inside the card. ~8 visible lines of
   the editable region; the mini-editor carries the shared synthwave theme. */
.hero-editor {
  border-top: 1px solid var(--line);
  height: 172px;
  overflow: auto;
  background: #161226;
}

.hero-editor .cm-editor {
  height: 100%;
}

/* A small status dot pinned to the card corner: green live / red on a broken
   edit. The message lives in its tooltip (title) — calm, not a banner. */
.hero-status {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--text-dim);
  box-shadow: 0 0 0 4px rgba(15, 12, 29, 0.55);
  z-index: 2;
}

.hero-status[data-state="live"] {
  background: var(--green);
}

.hero-status[data-state="busy"] {
  background: var(--amber);
}

.hero-status[data-state="error"] {
  background: var(--red);
}

/* Flourish (a): the gradient-clipped wordmark — the one big statement. */
.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  letter-spacing: 0.08em;
  margin: 0;
  background: linear-gradient(180deg, var(--cyan) 0%, #a9a2c6 55%, var(--pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-tagline {
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 1.4vw, 1rem);
  line-height: 1.7;
  letter-spacing: 0.06em;
  color: var(--text);
  margin: 14px 0 0;
}

.hero-sub {
  max-width: 560px;
  color: var(--text-dim);
  margin: 18px 0 0;
}

.hero-actions {
  display: flex;
  gap: 16px;
  margin-top: 32px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.button-primary,
.button-ghost {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 12px 24px;
  border-radius: 4px;
  font-size: 0.85rem;
  line-height: 1.4;
}

.button-primary {
  color: var(--bg);
  background: var(--cyan);
  border: 1px solid var(--cyan);
}

.button-primary:hover {
  text-decoration: none;
  background: #5ce2ee;
  border-color: #5ce2ee;
}

.button-ghost {
  color: var(--text-dim);
  border: 1px solid var(--line);
}

.button-ghost:hover {
  text-decoration: none;
  color: var(--cyan);
  border-color: var(--cyan);
}

/* Differentiators + section titles. */
.section-title {
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  color: var(--text);
  font-size: 1.15rem;
  max-width: 1180px;
  margin: 0 auto;
  padding: 64px 24px 0;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 24px 0;
}

.feature {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 20px 22px 18px;
}

.feature h2 {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cyan);
  margin: 0 0 10px;
}

.feature p {
  color: var(--text-dim);
  font-size: 0.92rem;
}

.code-sample,
.how-it-works {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 24px 0;
}

.code-sample h2,
.how-it-works h2 {
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  color: var(--text);
}

.code-sample p,
.how-it-works li {
  color: var(--text-dim);
}

.code-sample pre {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: 6px;
  padding: 20px;
  overflow-x: auto;
  font-size: 0.85rem;
}

/* The one-line LLM-native banner under the differentiators. */
.llm-banner {
  max-width: 1180px;
  margin: 28px auto 0;
  padding: 16px 22px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--pink);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.llm-banner strong {
  color: var(--text);
}

/* Closing call-to-action band. */
.cta-band {
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
  padding: 72px 24px 24px;
}

.cta-band h2 {
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  color: var(--text);
}

.cta-band p {
  color: var(--text-dim);
  margin-bottom: 24px;
}

.tok-k { color: var(--pink); }
.tok-t { color: var(--amber); }
.tok-n { color: #b7a9e0; }
.tok-c { color: #6c6685; font-style: italic; }
.tok-s { color: var(--green); }
.tok-a { color: var(--amber); }
.tok-o { color: var(--text-dim); }

.how-it-works ol {
  padding-left: 20px;
}

.how-it-works li {
  margin-bottom: 12px;
}

.how-it-works code {
  color: var(--green);
}

.landing-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 56px 24px 32px;
}

/* Hero stacks to one column on narrow viewports. */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 32px;
    min-height: 0;
    padding: 40px 24px;
  }
}

/* ---------------------------------------------------------------- sandbox */

.sandbox-page,
.ide-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sandbox-controls {
  flex-wrap: wrap;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text);
  font-size: 0.8rem;
}

.wordmark-accent {
  color: var(--pink);
}

.sandbox-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.picker-label {
  color: var(--text-dim);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#example-picker,
#reset,
#download,
#restart {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 10px;
}

#reset,
#download,
#restart {
  cursor: pointer;
}

#reset:hover,
#download:hover,
#restart:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.status-pill {
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.status-pill[data-state="live"] {
  color: var(--green);
  border-color: rgba(111, 220, 146, 0.4);
}

.status-pill[data-state="error"] {
  color: var(--red);
  border-color: rgba(242, 99, 127, 0.5);
}

.status-pill[data-state="busy"] {
  color: var(--amber);
}

.sandbox-split {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(360px, 44%) 1fr;
  min-height: 0;
}

.editor-pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  min-width: 0;
  min-height: 0;
}

#editor {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#editor .cm-editor {
  height: 100%;
}

#status-log {
  margin: 0;
  padding: 10px 14px;
  max-height: 30%;
  overflow: auto;
  font-size: 0.78rem;
  color: var(--red);
  background: #1a1220;
  border-top: 1px solid rgba(242, 99, 127, 0.4);
  white-space: pre-wrap;
}

.preview-pane {
  min-width: 0;
  min-height: 0;
}

#player {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--bg);
}

.sandbox-footer {
  padding: 8px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg-panel);
}

.sandbox-footer p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-dim);
}

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

  .editor-pane {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

/* --------------------------------------------------------------------- ide */

/* Three panes: file sidebar | editor | preview. Reuses .editor-pane,
   #editor, .preview-pane, #player, #status-log, .status-pill from the
   sandbox rules above. */
.ide-split {
  flex: 1;
  display: grid;
  grid-template-columns: 200px minmax(300px, 40%) 1fr;
  min-height: 0;
}

.file-pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--bg-panel);
  min-height: 0;
}

.file-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.file-pane-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

#new-file {
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 4px;
  width: 24px;
  height: 24px;
  cursor: pointer;
}

#new-file:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.file-list {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 0 12px;
}

.file-row.active {
  background: var(--bg-raised);
  box-shadow: inset 2px 0 0 var(--pink);
}

.file-name {
  flex: 1;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
  background: none;
  border: 0;
  padding: 8px 0;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row.active .file-name {
  color: var(--cyan);
}

.file-delete {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1;
  color: var(--text-dim);
  background: none;
  border: 0;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 4px;
}

.file-delete:hover {
  color: var(--red);
}

.file-pane-note {
  margin: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  font-size: 0.68rem;
  line-height: 1.5;
  color: var(--text-dim);
}

.file-pane-note code {
  font-family: var(--font-mono);
  color: var(--text);
}

.editor-tab {
  padding: 7px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--cyan);
}

@media (max-width: 900px) {
  .ide-split {
    grid-template-columns: 150px 1fr;
    grid-template-rows: 1fr 300px;
  }
  .file-pane {
    grid-row: span 2;
  }
  .preview-pane {
    border-top: 1px solid var(--line);
  }
}

/* ------------------------------------------------------------------- docs */

.docs-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 780px);
  gap: 40px;
  max-width: 1060px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.docs-nav {
  position: sticky;
  top: 24px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
}

.docs-nav a {
  color: var(--text-dim);
  border-left: 2px solid var(--line);
  padding-left: 12px;
}

.docs-nav a:hover {
  color: var(--cyan);
  border-left-color: var(--cyan);
  text-decoration: none;
}

.docs-main h1 {
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  font-size: 1.7rem;
}

.docs-main h2 {
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  font-size: 1.15rem;
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--text);
}

.docs-main h3 {
  font-size: 0.95rem;
  color: var(--amber);
  margin-top: 28px;
}

.docs-main p,
.docs-main li {
  color: var(--text-dim);
  font-size: 0.92rem;
}

.docs-main strong,
.docs-main em {
  color: var(--text);
}

.docs-main code {
  color: var(--green);
  font-size: 0.88em;
}

.docs-main pre {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: 6px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 0.83rem;
  line-height: 1.55;
  color: var(--text);
}

.docs-main pre.shell {
  border-left-color: var(--amber);
  color: var(--text-dim);
}

.docs-main table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85rem;
}

.docs-main th,
.docs-main td {
  text-align: left;
  padding: 8px 12px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  vertical-align: top;
}

.docs-main th {
  color: var(--text);
  background: var(--bg-panel);
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.try-button {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--bg);
  background: var(--cyan);
  border-radius: 3px;
  padding: 4px 10px;
  text-transform: uppercase;
}

.try-button:hover {
  text-decoration: none;
  background: #5ce2ee;
}

.docs-footnote {
  margin-top: 32px;
  font-size: 0.8rem;
  font-style: italic;
}

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

  .docs-nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }
}
