/* ===========================
   OpenCode Best Practices
   Styles
   =========================== */

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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-hover: #1f2937;
  --border: #30363d;
  --accent: #2f81f7;
  --accent-light: #58a6ff;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --green: #3fb950;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17.6px;
  line-height: 1.6;
}

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

/* ---- Navbar ---- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
}

.nav-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  white-space: nowrap;
}
.nav-brand:hover { text-decoration: none; color: var(--accent-light); }

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}
.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* ---- Hero ---- */
.hero {
  position: relative;
  background:
    radial-gradient(circle, rgba(88,166,255,0.09) 1px, transparent 1px),
    linear-gradient(160deg, #1c2333 0%, #0d1117 55%, #0f1923 100%);
  background-size: 28px 28px, 100% 100%;
  border-bottom: 1px solid var(--border);
  padding: 3.5rem 2rem 3rem;
  text-align: center;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(47,129,247,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 0.4rem;
  background: linear-gradient(90deg, #58a6ff 0%, #a5d6ff 35%, #79c0ff 65%, #58a6ff 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 6s ease infinite;
}

@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hero .powered-by {
  font-size: clamp(0.9rem, 2vw, 1.4rem);
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 1rem;
  opacity: 0.85;
}

.hero .subtitle {
  color: var(--accent-light);
  max-width: 800px;
  margin: 0 auto 0.75rem;
  font-size: 1.05rem;
}

.hero .subtitle-secondary {
  color: var(--text-muted);
  max-width: 800px;
  margin: 0 auto 0.75rem;
  font-size: 0.9rem;
  line-height: 1.65;
  opacity: 0.85;
}

.hero .byline {
  font-size: 0.85rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.hero-author {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-light);
  margin-top: 0.75rem;
}

.hero-thanks {
  font-size: 0.8rem;
  color: var(--accent-light);
  margin-top: 0.25rem;
  opacity: 0.75;
}

.hero-contact {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

/* ---- Main container ---- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* ---- Topic groups ---- */
.topic-group {
  margin-bottom: 3rem;
}

.group-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, var(--accent-light), var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Card grid ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s, background 0.15s, transform 0.1s, box-shadow 0.15s;
  color: var(--text);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.card:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: translateY(-2px);
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

/* Status-coloured borders: green for Live, orange for Work in progress.
   Uses :has() to detect the status badge inside the card. */
.card:has(.card-status.live) {
  border-color: rgba(63, 185, 80, 0.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 0 14px rgba(63,185,80,0.07);
}
.card:has(.card-status.live) .card-number {
  color: var(--green);
}
.card:has(.card-status.live):hover {
  border-color: var(--green);
}
.card:has(.card-status.draft) {
  border-color: rgba(180, 100, 20, 0.5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 0 14px rgba(180,100,20,0.06);
}
.card:has(.card-status.draft) .card-number {
  color: #c97d30;
}
.card:has(.card-status.draft):hover {
  border-color: #c97d30;
}

.card-number {
  position: absolute;
  top: 0.6rem;
  right: 0.9rem;
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--accent-light);
  opacity: 0.06;
  z-index: -1;
  line-height: 1;
  pointer-events: none;
  letter-spacing: -0.02em;
}

.card h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card p {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.55;
  flex: 1;
}

.card-status {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  width: fit-content;
}

.card-tag {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  width: fit-content;
  background: rgba(47, 129, 247, 0.08);
  color: var(--accent-light);
  border: 1px solid rgba(47, 129, 247, 0.2);
}

.card-external:hover {
  border-color: var(--accent-light);
}

.card-status.draft {
  background: rgba(180, 100, 20, 0.15);
  color: #c97d30;
  border: 1px solid rgba(180, 100, 20, 0.35);
}

.card-status.live {
  background: rgba(63, 185, 80, 0.12);
  color: var(--green);
  border: 1px solid rgba(63, 185, 80, 0.3);
}

/* ---- Individual section pages ---- */
.page-header {
  border-bottom: 1px solid var(--border);
  padding: 2.5rem 2rem 2rem;
  background: var(--surface);
  text-align: center;
}

.page-header .back-link {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: inline-block;
  margin-bottom: 1rem;
}
.page-header .back-link:hover { color: var(--text); text-decoration: none; }

.page-header .section-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-light);
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.page-header h1 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.page-header .lead {
  color: var(--text-muted);
  max-width: 640px;
  font-size: 1rem;
  margin: 0 auto;
}

.page-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.page-content h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.page-content p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.page-content ul, .page-content ol {
  color: var(--text-muted);
  padding-left: 1.4rem;
  margin-bottom: 1rem;
}

.page-content li { margin-bottom: 0.4rem; }

.callout {
  background: rgba(47, 129, 247, 0.08);
  border: 1px solid rgba(47, 129, 247, 0.25);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.callout strong { color: var(--text); }

.wip-banner {
  background: rgba(63, 185, 80, 0.08);
  border: 1px dashed rgba(63, 185, 80, 0.3);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}
.wip-banner strong { color: var(--green); }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
}

.footer-location {
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
}

.footer-contact {
  display: inline-flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-link:hover {
  color: var(--accent);
}

/* ---- Starfield canvas ---- */
#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

[data-theme="light"] #starfield {
  display: none;
}

/* ---- Glossary bar ---- */
.glossary-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 2.5rem;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.glossary-bar:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  border-left-color: var(--accent-light);
  text-decoration: none;
  transform: translateY(-1px);
}

.glossary-bar-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(47, 129, 247, 0.12);
  color: var(--accent-light);
  border-radius: 50%;
  font-weight: 700;
  font-size: 1.1rem;
}

.glossary-bar-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.glossary-bar-text strong {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.glossary-bar-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.glossary-bar-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: transform 0.15s, color 0.15s;
}

.glossary-bar:hover .glossary-bar-arrow {
  transform: translateX(3px);
  color: var(--accent-light);
}

/* ---- Search ---- */
.search-wrap {
  position: relative;
  max-width: 540px;
  margin: 2rem auto 2.5rem;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}

.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent); }

/* hide the browser's native clear button — we don't need it */
.search-input::-webkit-search-cancel-button { display: none; }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.search-result {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background 0.1s;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--surface-hover); text-decoration: none; }

.search-result-section {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-light);
  opacity: 0.7;
}

.search-result-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.search-result-summary {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.search-result mark {
  background: rgba(47, 129, 247, 0.25);
  color: var(--accent-light);
  border-radius: 2px;
  padding: 0 1px;
}

.search-empty {
  padding: 1rem 1.1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .nav-links { display: none; }
  .card-grid { grid-template-columns: 1fr; }
}

/* ---- Public/Internal markers ----
   Internal site shows everything by default.
   data-public-only blocks are hidden here so they don't appear on the internal site
   (they only appear on the public site, after the build script unwraps them).
   data-public-skip blocks remain visible internally (they are the internal-only content).
*/
[data-public-only] { display: none; }

/* ---- Language bar ---- */
.lang-bar {
  background: #58a6ff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
  box-shadow: 0 2px 8px rgba(88, 166, 255, 0.25);
}

.lang-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.5rem 2rem;
  flex-wrap: wrap;
}

.lang-bar-icon {
  font-size: 1rem;
  line-height: 1;
}

.lang-bar-label {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.lang-bar-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.lang-bar-list a {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.lang-bar-list a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  text-decoration: none;
}

.lang-bar-list a.is-active {
  color: #58a6ff;
  background: #fff;
  font-weight: 600;
}

@media (max-width: 720px) {
  .lang-bar-inner { padding: 0.5rem 1rem; }
  .lang-bar-label { display: none; }
}

/* ---- RTL support (Arabic, Hebrew, etc.) ---- */
[dir="rtl"] .page-header,
[dir="rtl"] .page-content,
[dir="rtl"] .hero { text-align: right; }

[dir="rtl"] .hero { text-align: center; } /* keep hero centred */

[dir="rtl"] .back-link::before { content: "→ "; }
[dir="rtl"] .back-link { display: inline-block; }

[dir="rtl"] .callout {
  border-left: 1px solid rgba(47, 129, 247, 0.25);
  border-right: 3px solid var(--accent);
}

[dir="rtl"] .wip-banner {
  border-left: 1px solid rgba(247, 181, 47, 0.3);
  border-right: 3px solid #f7b52f;
}

[dir="rtl"] .nav-links { flex-direction: row-reverse; }
[dir="rtl"] .page-content ul,
[dir="rtl"] .page-content ol { padding-right: 1.5rem; padding-left: 0; }

[dir="rtl"] pre,
[dir="rtl"] code { direction: ltr; text-align: left; }

/* ===========================
   Language fallback toast
   =========================== */
.lang-toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1f6feb;
  color: #fff;
  padding: 0.65rem 1.1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  z-index: 10000;
  max-width: 90%;
  text-align: center;
  opacity: 1;
  transition: opacity 0.5s ease;
}
.lang-toast-fade { opacity: 0; }

/* ---- Use-cases bar (mirrors glossary-bar in blue) ---- */
.usecases-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid #049fd9;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 2.5rem;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.usecases-bar:hover {
  background: var(--surface-hover);
  border-color: #049fd9;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(4, 159, 217, 0.15);
}
.usecases-bar-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 159, 217, 0.15);
  color: #049fd9;
  border-radius: 50%;
  font-weight: 700;
  font-size: 1.1rem;
}
.usecases-bar-text { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.usecases-bar-text strong {
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(90deg, #049fd9, #7ee8fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.usecases-bar-sub { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }
.usecases-bar-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: transform 0.15s, color 0.15s;
}
.usecases-bar:hover .usecases-bar-arrow {
  transform: translateX(3px);
  color: #7ee8fa;
}

/* ---- Vault card (Escape the Code Vault) ---- */
.card.card-vault {
  background: linear-gradient(180deg, #1c1c2e 0%, #12121f 100%);
  border: 1px solid #25253d;
  position: relative;
  overflow: hidden;
}
.card.card-vault::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #d4a64a 50%, transparent 100%);
  opacity: 0.5;
  transition: opacity 0.3s ease;
}
.card.card-vault:hover {
  border-color: #d4a64a;
  background: linear-gradient(180deg, #25253d 0%, #1c1c2e 100%);
  box-shadow: 0 4px 30px rgba(212, 166, 74, 0.18);
}
.card.card-vault:hover::before { opacity: 1; }
.card.card-vault h3 { color: #f4c668; }
.card.card-vault .card-number {
  color: #f4c668;
  filter: drop-shadow(0 0 6px rgba(244, 198, 104, 0.4));
}
.card-status.vault {
  background: rgba(212, 166, 74, 0.12);
  color: #f4c668;
  border: 1px solid rgba(212, 166, 74, 0.4);
}

/* ---- Efficiency page: cheap vs expensive habits comparison ---- */
.habits-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0 2rem;
}
.habits-col {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
  background: var(--surface);
}
.habits-col h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  letter-spacing: 0.02em;
}
.habits-col ul {
  margin: 0;
  padding-left: 1.1rem;
}
.habits-col li {
  margin-bottom: 0.55rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.habits-col li strong { color: var(--text); }
.habits-good {
  border-color: rgba(63, 185, 80, 0.45);
  background: rgba(63, 185, 80, 0.05);
}
.habits-good h3 { color: var(--green); }
.habits-bad {
  border-color: rgba(201, 125, 48, 0.5);
  background: rgba(201, 125, 48, 0.05);
}
.habits-bad h3 { color: #c97d30; }

/* ---- Efficiency page: model multiplier table ---- */
.model-buckets {
  margin: 1.25rem 0 1rem;
  overflow-x: auto;
}
.model-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.model-table th,
.model-table td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.model-table th {
  background: var(--surface-hover);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.model-table tr:last-child td { border-bottom: none; }
.model-table tr.bucket-free td:first-child,
.model-table tr.bucket-free td:nth-child(2) { color: var(--green); font-weight: 600; }
.model-table tr.bucket-cheap td:first-child,
.model-table tr.bucket-cheap td:nth-child(2) { color: #7ee8fa; font-weight: 600; }
.model-table tr.bucket-balanced td:first-child,
.model-table tr.bucket-balanced td:nth-child(2) { color: var(--accent-light); font-weight: 600; }
.model-table tr.bucket-heavy td:first-child,
.model-table tr.bucket-heavy td:nth-child(2) { color: #c97d30; font-weight: 600; }
.model-table tr.bucket-extreme td:first-child,
.model-table tr.bucket-extreme td:nth-child(2) { color: #e85d5d; font-weight: 600; }

.muted-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: -0.25rem;
}

.callout--warn {
  background: rgba(201, 125, 48, 0.08);
  border: 1px solid rgba(201, 125, 48, 0.3);
  border-left: 3px solid #c97d30;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.callout--warn strong { color: #e8a44a; }

.callout--green {
  background: rgba(63, 185, 80, 0.07);
  border: 1px solid rgba(63, 185, 80, 0.3);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.callout--green strong { color: var(--green); }

.prompt-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.9rem 1.25rem;
  margin: 1rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.prompt-box .prompt-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent-light);
  margin-bottom: 0.4rem;
  opacity: 0.75;
}
.prompt-box em {
  color: var(--text);
  font-style: normal;
  font-weight: 500;
}

/* ---- File-type panels (three-up grid) ---- */
.file-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}
.file-type-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.file-type-card .ftc-icon {
  font-size: 1.4rem;
  line-height: 1;
  margin-bottom: 0.25rem;
}
.file-type-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}
.file-type-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
  flex: 1;
}
.file-type-card .ftc-status {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  width: fit-content;
  margin-top: 0.25rem;
}
.ftc--blue {
  background: rgba(47, 129, 247, 0.07);
  border-color: rgba(47, 129, 247, 0.35);
}
.ftc--blue h3 { color: #58a6ff; }
.ftc--blue .ftc-status {
  background: rgba(47, 129, 247, 0.12);
  color: #58a6ff;
  border: 1px solid rgba(47, 129, 247, 0.3);
}
.ftc--green {
  background: rgba(63, 185, 80, 0.06);
  border-color: rgba(63, 185, 80, 0.35);
}
.ftc--green h3 { color: var(--green); }
.ftc--green .ftc-status {
  background: rgba(63, 185, 80, 0.1);
  color: var(--green);
  border: 1px solid rgba(63, 185, 80, 0.3);
}
.ftc--orange {
  background: rgba(201, 125, 48, 0.06);
  border-color: rgba(201, 125, 48, 0.35);
}
.ftc--orange h3 { color: #c97d30; }
.ftc--orange .ftc-status {
  background: rgba(201, 125, 48, 0.1);
  color: #e8a44a;
  border: 1px solid rgba(201, 125, 48, 0.3);
}

/* ---- Setup steps (numbered) ---- */
.setup-steps {
  list-style: none;
  padding: 0;
  margin: 1rem 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  counter-reset: step-counter;
}
.setup-steps li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem 0.9rem 3.25rem;
  font-size: 0.93rem;
  color: var(--text-muted);
  line-height: 1.65;
  position: relative;
  counter-increment: step-counter;
}
.setup-steps li::before {
  content: counter(step-counter);
  position: absolute;
  left: 1rem;
  top: 0.9rem;
  width: 1.5rem;
  height: 1.5rem;
  background: rgba(47, 129, 247, 0.15);
  color: var(--accent-light);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.setup-steps li strong { color: var(--text); }

@media (max-width: 720px) {
  .file-type-grid { grid-template-columns: 1fr; }
}

/* ---- Comparison cards (two-up coloured panels) ---- */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}
.compare-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.4rem 1.5rem;
}
.compare-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.compare-card ul {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.93rem;
  line-height: 1.7;
}
.compare-card ul li { margin-bottom: 0.25rem; }
.compare-card--blue {
  background: rgba(47, 129, 247, 0.07);
  border-color: rgba(47, 129, 247, 0.35);
}
.compare-card--blue h3 { color: #58a6ff; }
.compare-card--purple {
  background: rgba(163, 113, 247, 0.07);
  border-color: rgba(163, 113, 247, 0.35);
}
.compare-card--purple h3 { color: #c792ea; }

/* ---- Tabs ---- */
.tab-group { margin: 1.5rem 0; }
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  padding-bottom: 0;
}
.tab-btn {
  background: none;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 0.45rem 1rem;
  position: relative;
  top: 1px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--text); background: var(--surface); }
.tab-btn.active {
  background: var(--surface);
  border-color: var(--border);
  border-bottom-color: var(--surface);
  color: var(--accent-light);
}
.tab-panel {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 1.5rem;
}
.tab-panel.active { display: block; }
.tab-panel h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-light);
  margin: 1.2rem 0 0.4rem;
}
.tab-panel h4:first-child { margin-top: 0; }
.tab-panel p, .tab-panel li { font-size: 0.93rem; color: var(--text-muted); line-height: 1.7; }
.tab-panel li { margin-bottom: 0.2rem; }
.tab-panel ul, .tab-panel ol { padding-left: 1.25rem; margin: 0.4rem 0 0.75rem; }
.tab-panel pre { margin: 0.75rem 0; }
.tab-panel .tab-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  margin-left: 0.5rem;
  vertical-align: middle;
  font-weight: 500;
}
.tab-tag--local { background: rgba(47,129,247,0.15); color: #58a6ff; }
.tab-tag--remote { background: rgba(163,113,247,0.15); color: #c792ea; }

/* ---- Lessons list ---- */
.lessons-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.lessons-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  font-size: 0.93rem;
  color: var(--text-muted);
  line-height: 1.65;
}
.lessons-list li strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

/* ── MCP Marketplace promo box ─────────────────────────────── */
.mcp-marketplace-box {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 1.5rem 0 1.75rem;
  padding: 1.25rem 1.5rem;
  background: #0d1117;
  border-radius: 12px;
  border: 1px solid rgba(124, 58, 237, 0.45);
  border-left: 4px solid;
  border-image: linear-gradient(180deg, #7c3aed, #a855f7) 1;
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 0 0 transparent;
}
.mcp-marketplace-box:hover {
  border-color: rgba(168, 85, 247, 0.7);
  box-shadow: 0 4px 24px rgba(124, 58, 237, 0.25);
  text-decoration: none;
}
.mcp-marketplace-box__icon {
  font-size: 2rem;
  flex-shrink: 0;
  line-height: 1;
}
.mcp-marketplace-box__body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.mcp-marketplace-box__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}
.mcp-marketplace-box__sub {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.65);
  line-height: 1.55;
}
.mcp-marketplace-box__cta {
  color: #a78bfa;
  font-weight: 600;
}

@media (max-width: 720px) {
  .habits-compare { grid-template-columns: 1fr; }
  .model-table { font-size: 0.82rem; }
  .model-table th, .model-table td { padding: 0.55rem 0.65rem; }
  .compare-grid { grid-template-columns: 1fr; }
  .tab-btn { font-size: 0.82rem; padding: 0.4rem 0.75rem; }
  .mcp-marketplace-box { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}

/* ---- Efficiency page: top-5 levers grid ---- */
.levers-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 2rem 0 0.75rem;
}
.levers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 2rem;
}
.lever-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.1rem 1.25rem 1rem;
  text-decoration: none;
  transition: transform 0.1s, border-color 0.15s, box-shadow 0.15s;
  position: relative;
}
.lever-card:hover {
  transform: translateY(-2px);
  text-decoration: none;
}
.lever-num {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.55;
}
.lever-card strong {
  font-size: 0.97rem;
  font-weight: 700;
  display: block;
  line-height: 1.3;
}
.lever-card p {
  font-size: 0.86rem;
  line-height: 1.55;
  margin: 0;
  flex: 1;
  color: var(--text-muted);
}
.lever-link {
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 0.5rem;
  opacity: 0.75;
  transition: opacity 0.15s;
}
.lever-card:hover .lever-link { opacity: 1; }

/* colour variants */
.lever-card--green {
  background: rgba(63, 185, 80, 0.06);
  border-color: rgba(63, 185, 80, 0.35);
}
.lever-card--green:hover { border-color: var(--green); box-shadow: 0 4px 20px rgba(63,185,80,0.12); }
.lever-card--green .lever-num,
.lever-card--green strong,
.lever-card--green .lever-link { color: var(--green); }

.lever-card--blue {
  background: rgba(47, 129, 247, 0.06);
  border-color: rgba(47, 129, 247, 0.35);
}
.lever-card--blue:hover { border-color: var(--accent-light); box-shadow: 0 4px 20px rgba(47,129,247,0.14); }
.lever-card--blue .lever-num,
.lever-card--blue strong,
.lever-card--blue .lever-link { color: var(--accent-light); }

.lever-card--teal {
  background: rgba(4, 159, 217, 0.06);
  border-color: rgba(4, 159, 217, 0.35);
}
.lever-card--teal:hover { border-color: #7ee8fa; box-shadow: 0 4px 20px rgba(4,159,217,0.14); }
.lever-card--teal .lever-num,
.lever-card--teal strong,
.lever-card--teal .lever-link { color: #7ee8fa; }

.lever-card--purple {
  background: rgba(163, 113, 247, 0.06);
  border-color: rgba(163, 113, 247, 0.35);
}
.lever-card--purple:hover { border-color: #c792ea; box-shadow: 0 4px 20px rgba(163,113,247,0.14); }
.lever-card--purple .lever-num,
.lever-card--purple strong,
.lever-card--purple .lever-link { color: #c792ea; }

.lever-card--orange {
  background: rgba(201, 125, 48, 0.06);
  border-color: rgba(201, 125, 48, 0.35);
}
.lever-card--orange:hover { border-color: #e8a44a; box-shadow: 0 4px 20px rgba(201,125,48,0.14); }
.lever-card--orange .lever-num,
.lever-card--orange strong,
.lever-card--orange .lever-link { color: #e8a44a; }

/* 5th card spans both columns */
.lever-card--wide { grid-column: 1 / -1; }

@media (max-width: 720px) {
  .levers-grid { grid-template-columns: 1fr; }
  .lever-card--wide { grid-column: auto; }
}

/* ---- 3-box explainer ---- */
.explainer-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.explainer-box {
  border-radius: 10px;
  padding: 1rem 1.25rem;
}

.explainer-box--blue   { background: #111827; border: 1px solid #2a3f6f; }
.explainer-box--purple { background: #130f22; border: 1px solid #3d2f7a; }
.explainer-box--green  { background: #091a10; border: 1px solid #1a5c28; }

.explainer-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.explainer-label--blue   { color: #7c9fd4; }
.explainer-label--purple { color: #a78bfa; }
.explainer-label--green  { color: #69db7c; }

.explainer-box-text {
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.5;
}

.explainer-operator {
  color: #7c9fd4;
  font-size: 1.4rem;
  font-weight: 300;
  text-align: center;
  padding: 0 0.25rem;
}

/* ---- Peers bar ---- */
.peers-bar {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.5;
  margin-bottom: 2rem;
}

.peers-bar strong { color: rgba(255,255,255,0.7); }

/* ---- Theme toggle button ---- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}

.icon-sun,
.icon-moon {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* Dark mode default: show sun (click to switch to light) */
.icon-moon { display: none; }
.icon-sun  { display: block; }

/* Light mode: show moon (click to switch back to dark) */
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ===========================
   Light Mode
   =========================== */
[data-theme="light"] {
  --bg: #f6f8fa;
  --surface: #fff;
  --surface-hover: #f0f2f4;
  --border: #d0d7de;
  --text: #1f2328;
  --text-muted: #57606a;
  --accent: #0969da;
  --accent-light: #1f6feb;
  --green: #1a7f37;
}

[data-theme="light"] .hero {
  background:
    radial-gradient(circle, rgba(9,105,218,0.06) 1px, transparent 1px),
    linear-gradient(160deg, #e8f0fe 0%, #f6f8fa 55%, #eef2f7 100%);
  background-size: 28px 28px, 100% 100%;
}

[data-theme="light"] .hero h1 {
  background: none;
  -webkit-text-fill-color: var(--accent);
  background-clip: initial;
  animation: none;
}

[data-theme="light"] .card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

[data-theme="light"] .explainer-box--blue   { background: #eff6ff; border-color: #bfdbfe; }
[data-theme="light"] .explainer-box--purple { background: #faf5ff; border-color: #ddd6fe; }
[data-theme="light"] .explainer-box--green  { background: #f0fdf4; border-color: #bbf7d0; }

[data-theme="light"] .explainer-label--blue   { color: #2563eb; }
[data-theme="light"] .explainer-label--purple { color: #7c3aed; }
[data-theme="light"] .explainer-label--green  { color: #15803d; }

[data-theme="light"] .explainer-box-text { color: var(--text); }
[data-theme="light"] .explainer-operator { color: #2563eb; }

[data-theme="light"] .peers-bar {
  background: #f8f9fa;
  border-color: var(--border);
  color: var(--text-muted);
}

[data-theme="light"] .peers-bar strong { color: var(--text); }

[data-theme="light"] .card-vault {
  background: linear-gradient(180deg, #fffbf0 0%, #fef9e7 100%) !important;
  border-color: rgba(212,166,74,0.4);
}

[data-theme="light"] .card-vault h3 { color: #92400e; }

[data-theme="light"] .search-results {
  background: var(--surface);
  border-color: var(--border);
}

/* ---- Light mode: visual theme overrides ---- */
[data-theme="light"] .hero::before {
  background: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(9,105,218,0.06) 0%, transparent 70%);
}

[data-theme="light"] .group-label {
  background: none;
  -webkit-text-fill-color: var(--text-muted);
  background-clip: initial;
  border-left-color: var(--accent);
}

[data-theme="light"] .card {
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.04);
}

[data-theme="light"] .card:has(.card-status.live) {
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.04), 0 0 14px rgba(26,127,55,0.07);
}

[data-theme="light"] .card:has(.card-status.draft) {
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.04), 0 0 14px rgba(180,100,20,0.06);
}
