/**
 * bitbee theme — Courier/monospace identity from legacy apiary CSS (2004–2015),
 * layered on Dropbits brochure structure (base → site → user).
 *
 * Legacy source: /home/htdocs/bitbee.org/._legacy/css/bitbee.css
 * Edit look via :root tokens (or Admin → Appearance → dropbits-user.css).
 */

/* —— Tokens (override in dropbits-user.css) —— */
:root {
  /* Colour — keep the sparse black/white + link greys of the old site */
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-content-bg: #ffffff;
  --color-content-fg: #000000;
  --color-content-heading: #000000;
  --color-text: #000000;
  --color-muted: #777777;
  --color-primary: #0000b4;
  --color-accent: #3300ff;
  --color-border: #e0e0e0;
  --color-link: #444444;
  --color-link-hover: #0000b4;
  --color-nav-fg: #000000;
  --color-gutter: var(--color-bg);
  --color-selected: #cc0000;

  /* Type — Courier identity */
  --font-body: "Courier New", Courier, monospace;
  --font-ui: "Courier New", Courier, monospace;
  --line-body: 1.65;

  /* Layout */
  --max-width: 42rem;
  --space: 1.25rem;
  --radius: 0;
  --header-h: 4.5rem;
  --nav-mobile-max: 900px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: var(--line-body);
  color: var(--color-text);
  background: var(--color-bg);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Hero cover must fill the band (beats the generic img rule above) */
.hero-media img,
.hero-jumbo .hero-media img {
  max-width: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

a:visited {
  color: var(--color-muted);
}

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

a:active {
  color: var(--color-accent);
}

h1,
h2,
h3 {
  font-family: var(--font-body);
  font-weight: bold;
  line-height: 1.25;
  color: var(--color-content-heading);
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.15rem, 2.8vw, 1.45rem);
  margin: 0 0 0.85rem;
}

h2 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
}

h3 {
  font-size: 1rem;
  margin: 1.25rem 0 0.4rem;
}

p {
  margin: 0 0 1rem;
}

/* —— Shell / header / nav —— */
.site-frame {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  position: static;
  min-height: var(--header-h);
  padding: 0.75rem clamp(0.75rem, 3vw, 1.5rem);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-brand {
  display: flex;
  align-items: flex-end;
  gap: 0.85rem;
  text-decoration: none;
  color: var(--color-nav-fg);
}

.site-brand:hover {
  color: var(--color-nav-fg);
  text-decoration: none;
}

.site-brand__bee {
  margin: 0;
  font-family: var(--font-body);
  font-size: 9px;
  line-height: 1.05;
  letter-spacing: 0;
  white-space: pre;
  color: var(--color-text);
}

.site-brand__name {
  font-weight: bold;
  font-size: 1.05rem;
  padding-bottom: 0.15rem;
}

.site-header__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  margin-left: auto;
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-nav-fg);
  cursor: pointer;
}

.nav-toggle__bar {
  display: block;
  width: 1.15rem;
  height: 2px;
  background: currentColor;
}

.site-nav {
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: bold;
}

/* Top-level row only — nested .nav-links are dropdown panels (nav-dropdown.css). */
.site-nav > .nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem 1rem;
}

.site-nav a {
  color: var(--color-nav-fg);
  text-decoration: none;
  padding: 0.15rem 0;
  border-bottom: 1px solid transparent;
}

.site-nav a:hover,
.site-nav a.active,
.site-nav li.active > a,
.site-nav a[aria-current="page"] {
  color: var(--color-selected);
  border-bottom-color: var(--color-selected);
  text-decoration: none;
}

/* —— Page body band —— */
.db-content-band,
.region-main > section.db-widget {
  color: var(--color-content-fg);
}

.db-content-band {
  background: var(--color-content-bg);
  padding-block: 0.25rem 1.5rem;
}

.db-page-body {
  flex: 1 1 auto;
  padding-block: 1rem 2rem;
}

.region-main {
  background: var(--color-content-bg);
  border-radius: var(--radius);
  padding: 0.5rem clamp(0.75rem, 3vw, 1.25rem) 1.5rem;
  max-width: var(--max-width);
  margin-inline: auto;
  width: 100%;
}

/* Bleed / hero in main must escape the narrow content column */
.region-main > section.db-widget.db-widget--bleed,
.region-main > section.db-widget.widget--bleed {
  max-width: none;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-inline: 0;
}

.region-main > section.db-widget + section.db-widget {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

/* Article readability — renderer emits widget-richtext / data-field=richtext */
.widget-richtext,
.widget-richtext [data-field="richtext"],
[data-field="richtext"] {
  font-size: 15px;
  line-height: 1.7;
}

.widget-richtext a,
[data-field="richtext"] a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.widget-richtext ul,
.widget-richtext ol,
[data-field="richtext"] ul,
[data-field="richtext"] ol {
  padding-left: 1.25rem;
  margin: 0 0 1rem;
}

.widget-richtext .further-reading,
[data-field="richtext"] .further-reading {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0.35rem 0 1rem;
}

.widget-richtext .further-reading li,
[data-field="richtext"] .further-reading li {
  margin: 0 0 0.4rem;
}

.widget-richtext blockquote,
[data-field="richtext"] blockquote {
  margin: 0 0 1rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--color-border);
  color: var(--color-muted);
}

.span-selected,
.selected {
  color: var(--color-selected);
}

/* —— Footer —— */
.site-footer {
  margin-top: auto;
  padding: 1.5rem clamp(0.75rem, 3vw, 1.5rem) 2rem;
  text-align: center;
  font-size: 11px;
  line-height: 1.5;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
}

.site-footer__line,
.site-footer__note {
  margin: 0 0 0.35rem;
}

.site-footer a {
  color: var(--color-muted);
}

/* Quiet footer login chip — muted text, not a pill/button */
.site-footer-auth,
.site-footer .db-login-chip {
  margin: 0.65rem 0 0;
  font-size: 11px;
  color: var(--color-muted);
}

.site-footer-auth::before,
.site-footer .db-login-chip::before {
  content: "· ";
  color: var(--color-muted);
}

.site-footer-auth a,
.site-footer .db-login-chip a {
  color: var(--color-muted);
  text-decoration: none;
  border: 0;
  padding: 0;
  background: none;
  border-radius: 0;
}

.site-footer-auth a:hover,
.site-footer .db-login-chip a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

/* —— Richtext Class picker (keep in sync with theme-classes.json + kernel base) —— */
.headline {
  font-family: var(--font-body);
  font-size: clamp(1.25rem, 2.8vw, 1.55rem);
  font-weight: bold;
  line-height: 1.25;
  margin: 0 0 0.75rem;
  color: var(--color-content-heading);
}

.lede {
  font-size: 1.05em;
  line-height: 1.55;
  margin: 0 0 1rem;
  color: var(--color-text);
}

.callout {
  display: block;
  margin: 1rem 0;
  padding: 0.65rem 0.85rem;
  border-left: 2px solid var(--color-border);
  background: color-mix(in srgb, var(--color-border) 35%, var(--color-content-bg));
  color: var(--color-text);
}

.text-center {
  text-align: center;
}

.btn {
  display: inline-block;
  font-family: var(--font-ui);
  font-weight: bold;
  padding: 0.35em 0.85em;
  border: 1px solid var(--color-text);
  background: var(--color-content-bg);
  color: var(--color-text);
  text-decoration: none;
  border-radius: var(--radius);
  line-height: 1.3;
}

.btn:hover {
  color: var(--color-link-hover);
  border-color: var(--color-link-hover);
  text-decoration: none;
}

/* BitBee hero chrome — proportions via data-aspect presets in page-layout.css.
 * Title scrim: shell sets html[data-hero-scrim] (kernel hero.css pattern B). */
.hero-jumbo {
  background: color-mix(in srgb, var(--color-primary) 8%, var(--color-bg));
}

.hero-title,
.hero-subtitle {
  font-family: var(--font-body);
}

html.db-nav-compact .site-header .nav-toggle {
  display: flex;
}

html.db-nav-compact .site-header .main-nav.site-nav {
  display: none;
  width: 100%;
  order: 3;
  flex-basis: 100%;
}

html.db-nav-compact .site-header .main-nav.site-nav.open {
  display: block;
}

html.db-nav-compact .site-header .main-nav.site-nav.open > .nav-links {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  padding: 0.35rem 0 0.5rem;
}

html.db-nav-compact .site-header .main-nav.site-nav.open > .nav-links a {
  display: block;
  padding: 0.55rem 0.15rem;
}

/* —— Mobile —— */
@media (max-width: 640px) {
  .site-header {
    align-items: flex-start;
  }

  .site-brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .site-brand__bee {
    font-size: 8px;
  }

  .region-main {
    padding-inline: 0.75rem;
  }
}
