/* Copyright (c) 2025 Jurjen Stellingwerff                        */
/* SPDX-License-Identifier: LGPL-3.0-or-later                     */
/* Shared stylesheet for all Loft documentation pages.             */
/* Generated by tests/wrap.rs — edit the STYLE_CSS constant there. */

:root {
  --bg: #fff;
  --text: #1a1a2e;
  --code-bg: #f8f9fa;
  --border: #e5e7eb;
  --accent: #2563eb;
  --nav-bg: #f3f4f6;
  --kw: #d1242f;
  --ty: #8250df;
  --st: #0a3069;
  --cm: #6a737d;
  --nm: #0550ae;
  --bi: #953800;
  --en: #1a7f37;
  --dim: #6b7280;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 32px;
}

nav {
  background: var(--nav-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 32px;
  font-size: 0.9em;
}
.nav-links { line-height: 2.2; }
nav a { color: var(--accent); text-decoration: none; margin: 0 3px; }
nav a:hover { text-decoration: underline; }
.cur { font-weight: 700; color: var(--text); margin: 0 3px; }
.nav-sep { color: var(--dim); font-weight: 600; font-size: 0.85em; margin: 0 4px; }

/* ── Search ─────────────────────────────────────────────────────────────── */

.search-wrap { position: relative; display: inline-block; margin-top: 6px; }
#search {
  width: 220px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.88em;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
}
#search:focus { outline: 2px solid var(--accent); border-color: transparent; }
.search-results {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 260px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  z-index: 100;
  overflow: hidden;
}
.search-results a {
  display: flex;
  justify-content: space-between;
  padding: 7px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9em;
  border-bottom: 1px solid var(--border);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--nav-bg); }
.search-kind {
  font-size: 0.78em;
  color: var(--dim);
  align-self: center;
}

h1 {
  font-size: 1.75em;
  margin: 0 0 24px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}
h2 { font-size: 1.1em; font-weight: 700; margin: 2em 0 0.4em; }

p { margin: 0.4em 0 1em; color: #374151; }

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 18px;
  font-size: 0.875em;
  line-height: 1.55;
}

code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Syntax highlight classes */
.cm { color: var(--cm); font-style: italic; }
.kw { color: var(--kw); font-weight: 600; }
.ty { color: var(--ty); }
.st, .ch { color: var(--st); }
.nm { color: var(--nm); }
.bi { color: var(--bi); }
.en { color: var(--en); }
.fn-call { color: #005cc5; }

/* stdlib links inside code blocks: inherit span colour, subtle underline */
pre a { color: inherit; text-decoration: underline dotted; }
pre a:hover { text-decoration: underline; }

/* ── Index page ─────────────────────────────────────────────────────────── */

header {
  text-align: center;
  padding: 48px 0 32px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 32px;
}
header h1 { font-size: 3em; margin: 0 0 8px; letter-spacing: -1px; }
.tagline { font-size: 1.1em; color: var(--dim); margin: 0; }
.version { font-size: 0.85em; color: var(--dim); margin: 4px 0 0; opacity: 0.7; }

.index-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.index-hero { text-align: center; }
.index-search { width: 100%; max-width: 400px; }
.index-search #search { width: 100%; font-size: 1em; padding: 8px 14px; }

.intro { margin-bottom: 40px; }
.intro ul { padding-left: 1.4em; }
.intro li { margin: 6px 0; color: #374151; }

.topics-heading {
  font-size: 1.3em;
  margin: 0 0 16px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.card {
  display: block;
  padding: 16px 18px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(37,99,235,.12); }
.card h2 { font-size: 1em; margin: 0 0 6px; color: var(--accent); }
.card p { font-size: .85em; margin: 0; color: #4b5563; line-height: 1.5; }

/* ── vs-Rust comparison page ────────────────────────────────────────────── */

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0.6em 0 0.8em;
}

pre.rust-pre   { background: #fff8f0; border-color: #fcd9ad; }
pre.python-pre { background: #f0f7ff; border-color: #b6d0f5; }

.lang-label {
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.loft-label   { color: #2563eb; }
.rust-label   { color: #b45309; }
.python-label { color: #1a5fa8; }

.verdict {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0.4em 0 1em;
}

.up, .down {
  margin: 0;
  padding: 0.5em 0.75em;
  border-radius: 5px;
  font-size: 0.92em;
  line-height: 1.5;
}
.up   { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.down { background: #fff1f2; border: 1px solid #fecdd3; color: #9f1239; }
.up   strong, .down strong {
  display: block;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.2em;
}

/* vs-rust section headers */
section-header, h2.diff {
  padding: 0.3em 0.7em;
  background: var(--nav-bg);
  border-left: 4px solid var(--accent);
  border-radius: 0 4px 4px 0;
}

/* ── Article section headings (topic pages) ─────────────────────────────── */

article h2 {
  font-size: 1.25em;
  margin-top: 2.8em;
  margin-bottom: 0.4em;
  padding: 0.3em 0.7em;
  border-left: 4px solid var(--accent);
  background: var(--code-bg);
  border-radius: 0 4px 4px 0;
}

article h3 {
  font-size: 1.05em;
  margin-top: 2em;
  margin-bottom: 0.3em;
  color: var(--dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25em;
}

/* ── Featured card (vs Rust on index) ───────────────────────────────────── */

.card-featured {
  border-color: var(--accent);
  background: linear-gradient(135deg, #eff6ff 0%, var(--code-bg) 100%);
}
.card-featured:hover { box-shadow: 0 4px 12px rgba(37,99,235,.2); }
.card-featured h2 { color: var(--accent); }

/* ── Roadmap badges ─────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: .72em;
  font-weight: 600;
  vertical-align: middle;
  letter-spacing: .02em;
}
.badge.planned {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* ── Print / single-page reference ─────────────────────────────────────── */

.print-page { max-width: 1100px; }

.print-header {
  text-align: center;
  padding: 3em 0 2em;
  border-bottom: 3px solid var(--accent);
  margin-bottom: 3em;
}
.print-header h1 { font-size: 2.5em; margin: 0 0 0.3em; }

.print-toc {
  column-count: 2;
  column-gap: 2.5em;
  margin: 2em 0 3em;
  padding: 1.5em 2em;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--code-bg);
  break-inside: avoid;
}
.print-toc h2 { column-span: all; margin: 0 0 1em; font-size: 1.1em; }
.print-toc ul { margin: 0; padding-left: 1.2em; list-style: none; }
.print-toc li { margin: 0.3em 0; font-size: 0.9em; }
.print-toc a { color: var(--accent); text-decoration: none; }
.print-toc a:hover { text-decoration: underline; }
.toc-indent { padding-left: 1.5em; }
.toc-section { font-weight: 700; margin-top: 0.8em; }
.toc-desc { color: var(--dim); font-size: 0.85em; }
.toc-note { color: var(--dim); font-size: 0.8em; font-style: italic; }

.print-section {
  margin-top: 4em;
  padding-top: 2em;
  border-top: 3px solid var(--border);
}
.print-section > h1 {
  font-size: 2em;
  margin: 0 0 1em;
  padding-bottom: 0.4em;
  border-bottom: 2px solid var(--accent);
  color: var(--accent);
}
.print-section article h2 { margin-top: 2em; }

/* ── Print media ─────────────────────────────────────────────────────────── */

@media print {
  nav, .search-wrap { display: none !important; }

  body {
    max-width: 100%;
    padding: 0.5cm 1cm;
    font-size: 10pt;
    line-height: 1.5;
  }

  pre {
    page-break-inside: avoid;
    break-inside: avoid;
    font-size: 0.82em;
  }

  h1, h2, h3 {
    page-break-after: avoid;
    break-after: avoid;
  }

  .print-page { max-width: 100%; }
  .print-toc { page-break-after: always; break-after: page; column-count: 2; }
  .print-section { page-break-before: always; break-before: page; }

  /* Show URLs for external links only */
  a[href^="http"]:after {
    content: " <" attr(href) ">";
    font-size: 0.7em;
    color: #666;
  }
  /* Don't show URLs for internal anchors or nav links */
  a[href^="#"]:after, a[href$=".html"]:after { content: ""; }
}
