/* Brunold Software — site styles
   custom-property driven, dark-mode aware, no framework. */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f2;
  --bg-card: #ffffff;
  --fg: #1a1a1a;
  --fg-muted: #5a5a5a;
  --border: #e3e3e0;
  --accent: #3b4a8a;
  --accent-fg: #ffffff;
  --max-width: 1080px;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.06);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131416;
    --bg-alt: #1c1d20;
    --bg-card: #1c1d20;
    --fg: #ececec;
    --fg-muted: #a4a4a4;
    --border: #2a2b2f;
    --accent: #7d8ed1;
    --accent-fg: #0c0d10;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.45);
  }
}

/* per-product accent override */
body[data-page="dbweave"] { --accent: #3b4a8a; }
body[data-page="jbead"]   { --accent: #6B8E23; }
@media (prefers-color-scheme: dark) {
  body[data-page="dbweave"] { --accent: #7d8ed1; }
  body[data-page="jbead"]   { --accent: #a8c764; }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  line-height: 1.25;
  font-weight: 650;
  margin: 2rem 0 0.75rem;
}
h1 { font-size: 2.25rem; margin-top: 0; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1rem; }

ul { padding-left: 1.25rem; }

/* ---------- header / nav ---------- */

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

.nav-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.brand {
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
  flex: 0 0 auto;
}

.primary-nav { flex: 1 1 auto; }
.primary-nav ul {
  list-style: none;
  display: flex;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.primary-nav a {
  color: var(--fg-muted);
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.primary-nav a:hover { color: var(--fg); text-decoration: none; }
body[data-page="home"]    .primary-nav a[data-nav="home"],
body[data-page="index"]   .primary-nav a[data-nav="home"],
body[data-page="dbweave"] .primary-nav a[data-nav="dbweave"],
body[data-page="jbead"]   .primary-nav a[data-nav="jbead"],
body[data-page="about"]   .primary-nav a[data-nav="about"] {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

.lang-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
}
.lang-toggle:hover { color: var(--fg); border-color: var(--fg-muted); }

/* Hamburger button — hidden on wide screens. */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  margin-left: auto;
}
.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--fg);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-10px) rotate(-45deg);
}

@media (max-width: 640px) {
  .nav-row {
    flex-wrap: wrap;
    gap: 0.75rem;
    column-gap: 1rem;
  }
  .nav-toggle { display: flex; }
  .primary-nav {
    flex: 0 0 100%;
    order: 3;
    display: none;
  }
  .primary-nav.is-open { display: block; }
  .primary-nav ul {
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--border);
  }
  .primary-nav li {
    border-bottom: 1px solid var(--border);
  }
  .primary-nav a {
    display: block;
    padding: 0.75rem 0.25rem;
    border-bottom: none;
  }
  body[data-page="home"]    .primary-nav a[data-nav="home"],
  body[data-page="index"]   .primary-nav a[data-nav="home"],
  body[data-page="dbweave"] .primary-nav a[data-nav="dbweave"],
  body[data-page="jbead"]   .primary-nav a[data-nav="jbead"],
  body[data-page="about"]   .primary-nav a[data-nav="about"] {
    border-bottom: none;
    border-left: 3px solid var(--accent);
    padding-left: 0.6rem;
  }
}

/* ---------- hero ---------- */

.hero {
  padding: 3rem 0 1rem;
}
.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.02em;
}
.hero .lede {
  font-size: 1.2rem;
  color: var(--fg-muted);
  max-width: 40em;
}

/* ---------- product cards (home) ---------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0 3rem;
}

.product-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--fg);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  border-top: 3px solid var(--card-accent, var(--accent));
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
  border-color: var(--card-accent, var(--accent));
}
.product-card h2 { margin-top: 0; color: var(--card-accent, var(--accent)); }
.product-card .tagline { color: var(--fg-muted); }
.product-card .more {
  margin-top: auto;
  padding-top: 1rem;
  font-weight: 600;
  color: var(--card-accent, var(--accent));
}

/* ---------- product page ---------- */

.product-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
  padding: 2rem 0;
}
@media (min-width: 760px) {
  .product-hero { grid-template-columns: 1.2fr 1fr; }
}
.product-hero h1 { color: var(--accent); letter-spacing: -0.02em; }
.product-hero .tagline { font-size: 1.2rem; color: var(--fg-muted); }
.product-hero .screenshot {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--bg-alt);
}

.feature-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem 2rem;
  margin: 1.5rem 0;
}
.feature-groups h3 {
  color: var(--accent);
  margin-top: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.feature-groups ul { margin: 0; }

/* ---------- downloads ---------- */

.downloads {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
}
.downloads h2 { margin-top: 0; }
.downloads-version { color: var(--fg-muted); margin-bottom: 1rem; }

.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.75rem;
}

.download-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.85rem;
  align-items: center;
  padding: 1rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  text-decoration: none;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.download-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
  box-shadow: var(--shadow);
}
.download-card[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

.dl-icon {
  grid-row: 1 / span 2;
  font-size: 1.6rem;
  color: var(--accent);
  line-height: 1;
}
.dl-os { font-weight: 650; }
.dl-meta { color: var(--fg-muted); font-size: 0.875rem; }

/* recommended (set by platform.js) */
.download-card.recommended {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-card));
  position: relative;
  grid-column: 1 / -1;
}
.download-card.recommended::after {
  content: attr(data-recommended-label);
  position: absolute;
  top: -0.6rem;
  right: 0.9rem;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}
.download-card.recommended .dl-icon { font-size: 2.2rem; }
.download-card.recommended .dl-os   { font-size: 1.2rem; }

/* ---------- aux sections ---------- */

/* ---------- help / manual ---------- */

.help-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: 2rem 0 3rem;
  align-items: start;
}
@media (min-width: 860px) {
  .help-shell { grid-template-columns: 240px minmax(0, 1fr); }
}

.help-sidebar {
  position: sticky;
  top: 4.25rem;
  align-self: start;
  font-size: 0.92rem;
  border-right: 1px solid var(--border);
  padding-left: 1rem;
  padding-right: 1rem;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
}
@media (max-width: 859px) {
  .help-sidebar { position: static; border-right: 0; padding-left: 0; padding-right: 0; max-height: none; }
}
.help-sidebar-title {
  margin: 0 0 1rem;
  font-weight: 700;
  color: var(--fg);
}
.help-sidebar-title a { color: inherit; }
.help-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.help-chapter { margin: 0.1rem 0; }
.help-chapter-link {
  display: block;
  padding: 0.35rem 0;
  color: var(--fg-muted);
  text-decoration: none;
}
.help-chapter-link:hover { color: var(--fg); }
.help-chapter.is-current > .help-chapter-link { color: var(--fg); font-weight: 600; }
.help-chapter > ul {
  padding-left: 0.6rem;
  margin: 0.25rem 0 0.75rem;
  border-left: 2px solid var(--border);
}
.help-chapter > ul li { padding: 0.15rem 0; }
.help-chapter > ul a {
  color: var(--fg-muted);
  display: block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-decoration: none;
}
.help-chapter > ul a:hover { color: var(--fg); background: var(--bg-alt); }
.help-chapter > ul a.is-active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.help-breadcrumb {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin: 0 0 1.25rem;
}
.help-breadcrumb a { color: inherit; }

.help-content { max-width: 70ch; }
.help-content h1 { font-size: 2rem; margin: 0 0 1rem; }
.help-content h2 {
  margin-top: 2.5rem;
  padding-top: 0.5rem;
  font-size: 1.4rem;
  border-top: 1px solid var(--border);
}
.help-content h2:first-of-type { border-top: 0; padding-top: 0; }
.help-content h3 { font-size: 1.1rem; margin-top: 1.75rem; }
.help-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-alt);
}
/* When a paragraph is just a row of images, lay them out as an inline gallery. */
.help-content p > img {
  display: inline-block;
  vertical-align: top;
  margin: 0.25rem 0.4rem 0.25rem 0;
  max-height: 320px;
  width: auto;
}
.help-content img.icon {
  display: inline-block;
  width: auto;
  max-height: 1.2em;
  border: 0;
  border-radius: 0;
  background: transparent;
  vertical-align: middle;
}
.help-content code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  background: var(--bg-alt);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.92em;
}
.help-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.95rem;
}
.help-content th, .help-content td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.help-content th {
  font-weight: 650;
  background: var(--bg-alt);
  color: var(--fg);
}
.help-content tbody tr:hover { background: var(--bg-alt); }

.help-content blockquote {
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-alt);
  color: var(--fg-muted);
}

.help-prevnext {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.help-prevnext a {
  display: inline-flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  text-decoration: none;
  min-width: 40%;
}
.help-prevnext a:hover { border-color: var(--accent); }
.help-prevnext .label { font-size: 0.8rem; color: var(--fg-muted); }
.help-prevnext .next { text-align: right; margin-left: auto; }

/* help index landing page (TOC grid) */
.help-toc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}
.help-toc-grid a {
  display: block;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
}
.help-toc-grid a:hover { border-color: var(--accent); color: var(--accent); }

.license-text {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  color: var(--fg-muted);
  overflow-x: auto;
}

.platform-note {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-card));
  border-radius: var(--radius);
}
.platform-note h2 { margin: 0 0 0.5rem; font-size: 1.15rem; color: var(--accent); }
.platform-note p { margin: 0 0 0.75rem; }
.platform-note p:last-child { margin-bottom: 0; }
.platform-note .platform-link {
  display: inline-block;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  text-decoration: none;
}
.platform-note .platform-link:hover {
  background: var(--accent);
  color: var(--accent-fg);
  text-decoration: none;
}

.aux-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.9rem;
}
.site-footer a { color: var(--fg-muted); }
.site-footer a:hover { color: var(--fg); }
.site-footer p { margin: 0.25rem 0; }
.legal-links { font-size: 0.85rem; }
