/* ForgeDialog site. Hand-written, no build step, no dependencies. */

:root {
  color-scheme: light dark;

  --page: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #14171c;
  --muted: #5b6270;
  --border: #e0e3e9;
  --accent: #4c5fd7;
  --accent-text: #ffffff;
  --code-bg: #14161d;
  --code-text: #e6e8ef;
  --radius: 12px;
  --wrap: 1080px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-fd-theme='light']) {
    --page: #0e1014;
    --surface: #171a21;
    --surface-2: #1f232c;
    --text: #eceef3;
    --muted: #9aa1ad;
    --border: #2b303a;
    --accent: #8896ff;
    --accent-text: #0e1014;
  }
}

:root[data-fd-theme='dark'] {
  --page: #0e1014;
  --surface: #171a21;
  --surface-2: #1f232c;
  --text: #eceef3;
  --muted: #9aa1ad;
  --border: #2b303a;
  --accent: #8896ff;
  --accent-text: #0e1014;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--page);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 20px;
}

/* Header ------------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  /* Wraps rather than overflowing: on a narrow phone the nav takes a second
     row instead of pushing the page sideways. */
  flex-wrap: wrap;
  gap: 8px 16px;
  min-height: 60px;
  padding-block: 8px;
}

@media (max-width: 560px) {
  .site-header .wrap {
    gap: 6px 12px;
  }

  .brand {
    /* Own the first row so the links wrap together underneath it. */
    flex: 1 0 100%;
    margin-inline-end: 0;
  }

  /* The mark carries no information the adjacent wordmark does not, so it is
   decorative: alt="" keeps a screen reader from announcing the name twice. */
  .brand-mark {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    flex: none;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  margin-inline-end: auto;
}

.version {
  font: 600 0.72rem/1 var(--mono);
  color: var(--muted);
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}

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

/* Buttons ----------------------------------------------------------------- */

.btn {
  font: inherit;
  font-size: 0.92rem;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition:
    background-color 140ms ease,
    border-color 140ms ease;
}

.btn:hover {
  background: var(--surface-2);
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.btn--primary:hover {
  filter: brightness(1.08);
  background: var(--accent);
}

.btn--sm {
  padding: 6px 11px;
  font-size: 0.85rem;
}

/* Hero -------------------------------------------------------------------- */

.hero {
  padding: 72px 0 56px;
  text-align: center;
}

.hero-eyebrow {
  margin: 0 0 12px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero h1 {
  font-size: clamp(2.1rem, 6vw, 3.3rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

.hero p.lead {
  font-size: clamp(1rem, 2.4vw, 1.18rem);
  color: var(--muted);
  max-width: 62ch;
  margin: 0 auto 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}

.install {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--code-bg);
  color: var(--code-text);
  font: 0.92rem/1 var(--mono);
  padding: 12px 12px 12px 18px;
  border-radius: 10px;
}

.install code {
  font: inherit;
}

.copy {
  font: inherit;
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #3a3f4d;
  background: #232833;
  color: var(--code-text);
  cursor: pointer;
}

.copy:hover {
  background: #2d323e;
}

/* Sections ---------------------------------------------------------------- */

section {
  padding: 56px 0;
  border-top: 1px solid var(--border);
}

section h2 {
  font-size: clamp(1.4rem, 3.4vw, 1.9rem);
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

section p.section-lead {
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 66ch;
}

/* Features ---------------------------------------------------------------- */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 16px;
}

.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.feature h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.feature p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Playground -------------------------------------------------------------- */

.playground {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 820px) {
  .playground {
    grid-template-columns: minmax(0, 1fr);
  }
}

.controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 14px;
}

.control {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
}

.control label {
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.control output {
  font: 0.8rem/1 var(--mono);
  color: var(--text);
}

.control input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
}

.control input[type='color'] {
  width: 100%;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  cursor: pointer;
}

.control--row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.85rem;
  color: var(--muted);
}

.control--row input {
  accent-color: var(--accent);
}

pre {
  margin: 0;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  font: 0.86rem/1.65 var(--mono);
  tab-size: 2;
}

pre code {
  font: inherit;
}

.snippet {
  position: relative;
  /* The code inside scrolls; the snippet itself must not widen its column. */
  min-width: 0;
}

.snippet .copy {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
}

.examples {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
}

.example h3 {
  font-size: 0.95rem;
  margin: 0 0 10px;
}

/* Footer ------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 48px;
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  justify-content: space-between;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 1ms !important;
  }
}

/* Docs -------------------------------------------------------------------- */

.docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  padding-top: 40px;
  padding-bottom: 64px;
}

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

.docs-nav {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  font-size: 0.86rem;
}

@media (max-width: 900px) {
  .docs-nav {
    position: static;
    max-height: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
  }
}

.docs-nav a {
  display: block;
  padding: 4px 0 4px 10px;
  color: var(--muted);
  text-decoration: none;
  border-inline-start: 2px solid transparent;
}

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

.docs-nav a[aria-current] {
  color: var(--accent);
  border-inline-start-color: var(--accent);
  font-weight: 600;
}

.docs-nav__group {
  margin: 16px 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text);
}

.docs-nav__group:first-child {
  margin-top: 0;
}

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

.docs-body h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

.docs-lead {
  color: var(--muted);
  font-size: 1.02rem;
  margin: 0 0 8px;
  max-width: 68ch;
}

.docs-body section {
  padding: 32px 0 8px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 76px;
}

.docs-body h2 {
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}

.docs-body h3 {
  font-size: 1rem;
  margin: 26px 0 8px;
}

.docs-body p,
.docs-body li {
  max-width: 74ch;
}

.docs-body ul {
  padding-inline-start: 20px;
}

.docs-body li {
  margin-bottom: 8px;
}

.docs-body :not(pre) > code {
  font: 0.86em/1.4 var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  overflow-wrap: anywhere;
}

.docs-body .snippet {
  margin: 14px 0 18px;
}

.docs-body .note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Wide tables scroll inside their own box; the page never scrolls sideways. */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 14px 0 18px;
  background: var(--surface);
}

.table-scroll table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
}

.table-scroll th,
.table-scroll td {
  text-align: start;
  vertical-align: top;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.table-scroll th {
  background: var(--surface-2);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.table-scroll tr:last-child td {
  border-bottom: 0;
}

.table-scroll td:first-child {
  white-space: nowrap;
}

.docs-footer-note {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

/* FAQ and facts ----------------------------------------------------------- */

.faq h3 {
  font-size: 1.02rem;
  margin: 26px 0 6px;
}

.faq h3:first-child {
  margin-top: 0;
}

.faq p {
  margin: 0;
  color: var(--muted);
  max-width: 74ch;
}

.faq code,
#at-a-glance code {
  font: 0.86em/1.4 var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}

#at-a-glance th[scope='row'] {
  background: var(--surface-2);
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.88rem;
  color: var(--text);
}

/* Demo page. Each card pairs a control that really runs with the code behind
   it, so the page doubles as documentation for what it demonstrates. */
.demos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 20px;
}

.demo-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.demo-card h3 {
  margin: 0;
  font-size: 1rem;
}

.demo-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.demo-card .snippet {
  margin-top: auto;
}

.demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.demo-log {
  margin: 0;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--code-bg);
  color: var(--code-text);
  font: 0.86rem/1.65 var(--mono);
  white-space: pre-wrap;
  overflow-x: auto;
  min-height: 120px;
  max-height: 320px;
  overflow-y: auto;
}

.demo-log:empty::after {
  content: 'Results from the demos above appear here.';
  opacity: 0.55;
}

/* Language switcher. Two links, not a select: a crawler follows a link. */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
}

.lang-switch a {
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
}

.lang-switch a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.lang-switch a.active {
  color: var(--accent-text);
  background: var(--accent);
}
