/*
 * CLI DOCS — forge(1)
 * ====================
 * Concept: "A man page someone cared about." The terminal IS the native
 * environment, so monospace dominates. But the tool name in serif gives
 * it authorship — this was crafted, not generated.
 *
 * Hook: The man-page header/footer format (tool(1) / General Commands Manual)
 * grounds it in UNIX tradition. But the typography and color lift it beyond
 * a raw terminal dump.
 *
 * Why Fraunces? A wonky, characterful serif for the display name only.
 * It has personality that contrasts beautifully with the strict mono body.
 * The tool has a name that someone thought about.
 *
 * Why JetBrains Mono? This is CLI docs — the code IS the content.
 * JetBrains Mono is optimized for code readability with distinctive
 * character shapes and coding ligatures.
 *
 * Color: Phosphor green on deep charcoal. Not literal terminal green —
 * warmed up, desaturated. References the terminal without cosplaying it.
 */

:root {
  --font-display: 'Fraunces', Georgia, serif;
  --font-mono:    'JetBrains Mono', 'Consolas', monospace;

  --bg:         #141816;
  --bg-code:    #1a1e1c;
  --text:       #d0dcd4;
  --text-mid:   #88a090;
  --text-quiet: #506860;
  --accent:     #78b890;   /* desaturated phosphor — warm terminal green */
  --accent-dim: #78b89020;
  --rule:       #242e28;

  /* Syntax highlighting */
  --c-comment:  #506860;
  --c-key:      #78b890;
  --c-attr:     #d0dcd4;
  --c-str:      #b8c878;
  --c-num:      #c8a868;

  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:         #f0f4f2;
    --bg-code:    #e4eae6;
    --text:       #1a2420;
    --text-mid:   #506858;
    --text-quiet: #88a898;
    --accent:     #2e7850;
    --accent-dim: #2e785018;
    --rule:       #d0dcd4;
    --c-comment:  #88a898;
    --c-key:      #2e7850;
    --c-attr:     #1a2420;
    --c-str:      #587020;
    --c-num:      #8a6828;
  }
}

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

body {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  max-width: 740px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--bg); }
code { font-family: var(--font-mono); font-size: inherit; }

/* HEADER — man page style: tool(1) on both sides */
.header {
  margin-bottom: 3rem;
}

.header__top {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-quiet);
  letter-spacing: 0.03em;
  margin-bottom: 1.5rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--rule);
}

.header__name {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 300;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.header__desc {
  font-size: 0.9rem;
  color: var(--text-mid);
  margin-bottom: 2rem;
}

/* Install bar */
.install-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-code);
  border: 1px solid var(--rule);
  overflow: hidden;
}

.install-cmd {
  flex: 1;
  padding: 0.7rem 1rem;
  font-size: 0.8rem;
  color: var(--text);
  user-select: all;
}

.copy-btn {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-quiet);
  background: none;
  border: none;
  border-left: 1px solid var(--rule);
  padding: 0.7rem 1rem;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}

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

/* MAN SECTIONS */
.man-section {
  margin-bottom: 2.5rem;
  /* reveal */
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.man-section.is-visible { opacity: 1; transform: translateY(0); }

.man-heading {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}

.man-section > p {
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.75;
  margin-bottom: 0.8rem;
}

.man-section > p code {
  color: var(--text);
  background: var(--bg-code);
  padding: 0.1rem 0.35rem;
}

.man-section > p strong {
  color: var(--text);
  font-weight: 500;
}

/* Synopsis */
.synopsis {
  background: var(--bg-code);
  border: 1px solid var(--rule);
  padding: 1rem 1.2rem;
  font-size: 0.8rem;
  line-height: 1.8;
  overflow-x: auto;
}

.synopsis strong { color: var(--accent); font-weight: 500; }

/* Commands */
.cmd {
  margin-bottom: 2rem;
  padding-left: 1.2rem;
  border-left: 2px solid var(--rule);
  transition: border-color 0.3s var(--ease);
}

.cmd:hover { border-left-color: var(--accent); }

.cmd__name {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.cmd__desc {
  font-size: 0.82rem;
  color: var(--text-mid);
  line-height: 1.7;
  margin-bottom: 0.8rem;
}

.cmd__desc code {
  color: var(--text);
  background: var(--bg-code);
  padding: 0.1rem 0.3rem;
}

/* Flags */
.flags {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.flag {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
  font-size: 0.78rem;
  align-items: baseline;
}

.flag__name { color: var(--text); font-weight: 400; }
.flag__desc { color: var(--text-mid); }

/* Code blocks */
.codeblock {
  background: var(--bg-code);
  border: 1px solid var(--rule);
  padding: 1.2rem 1.5rem;
  font-size: 0.78rem;
  line-height: 1.8;
  overflow-x: auto;
}

.c-comment { color: var(--c-comment); }
.c-key     { color: var(--c-key); }
.c-attr    { color: var(--c-attr); }
.c-str     { color: var(--c-str); }
.c-num     { color: var(--c-num); }

/* Examples */
.example { margin-bottom: 1.2rem; }

.example__desc {
  font-size: 0.8rem;
  color: var(--text-mid);
  margin-bottom: 0.3rem;
}

.example__cmd {
  background: var(--bg-code);
  border: 1px solid var(--rule);
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
}

.example__cmd code { color: var(--text); }

/* Footer — man page style */
.man-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--rule);
  font-size: 0.68rem;
  color: var(--text-quiet);
  letter-spacing: 0.03em;
}

/* RESPONSIVE */
@media (max-width: 640px) {
  body { padding: 2rem 1rem; }
  .header__top { font-size: 0.6rem; }
  .flag { grid-template-columns: 1fr; gap: 0.1rem; }
  .man-footer { font-size: 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .man-section { opacity: 1; transform: none; transition: none; }
}
