/* Mastery — public site theme. --accent, --accent-dark, --accent-light and
   --accent-soft are set per site inline from the owner's chosen colour
   scheme (SiteManagement::ACCENTS); everything coloured derives from them. */

:root {
  --accent: #2563EB;
  --accent-dark: #1D4ED8;
  --accent-light: #4F8DF9;
  --accent-soft: #DBEAFE;
  --bg: #FFFCF7;
  --surface: #FFFFFF;
  --ink: #2D2A3E;
  --ink-muted: #6E687F;
  --border: #EFE6DA;
  --radius: 14px;
  --radius-card: 20px;
  --shadow-soft: 0 2px 8px rgba(45, 42, 62, .08);
  --shadow-card: 0 12px 30px rgba(45, 42, 62, .10);
  --font-display: "Avenir Next", "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-body: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

body.site {
  margin: 0;
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

.site-inner { width: 100%; max-width: 900px; margin: 0 auto; padding-inline: 20px; }
.site-main { flex: 1; padding-block: 22px 60px; }

/* ===== Owner bar ===== */

.owner-bar { background: var(--ink); color: #fff; font-size: 0.85rem; }
.owner-bar-inner { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding-block: 6px; }
.owner-bar-label { font-weight: 700; opacity: 0.7; margin-right: 6px; text-transform: uppercase; letter-spacing: 0.5px; font-size: 0.72rem; }
.owner-bar-form { display: inline; margin: 0; }
.owner-bar-link {
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  border-radius: 999px;
  padding: 4px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.4;
}
.owner-bar-link:hover { background: var(--accent); color: #fff; }
.owner-bar-link.danger:hover { background: #E85454; }
.owner-bar-link.disabled { opacity: 0.4; cursor: not-allowed; }
.owner-bar-right { margin-left: auto; background: transparent; opacity: 0.8; }

/* ===== Header ===== */

.site-header {
  background: linear-gradient(100deg, var(--accent-dark) 0%, var(--accent) 55%, var(--accent-light) 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(45, 42, 62, .18);
}
.site-header .site-inner { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-block: 14px; }
.site-brand {
  font-weight: 800;
  font-size: 1.25rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.site-brand::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}
.site-brand:hover { color: #fff; opacity: 0.92; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.site-nav a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 5px 11px;
  border-radius: 999px;
}
.site-nav a:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }

/* ===== Breadcrumbs, titles ===== */

.crumbs { font-size: 0.85rem; color: var(--ink-muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.crumbs a { color: var(--ink-muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent-dark); text-decoration: underline; }
.crumb-sep { opacity: 0.6; }
.crumb-current { color: var(--ink); font-weight: 600; }

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-dark);
}
.page-title { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.15; margin: 0 0 16px; letter-spacing: -0.3px; }
.section-title { font-size: 1.1rem; text-transform: uppercase; letter-spacing: 0.8px; color: var(--accent-dark); margin: 30px 0 12px; }

/* ===== Hero (home) ===== */

.hero {
  padding: 34px 28px;
  margin: 6px 0 22px;
  border-radius: var(--radius-card);
  background:
    radial-gradient(circle at 90% 10%, var(--accent-soft), transparent 45%),
    radial-gradient(circle at 5% 100%, var(--accent-soft), transparent 40%),
    var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--accent);
  box-shadow: var(--shadow-soft);
}
.hero-title { font-size: clamp(2rem, 5vw, 3rem); margin: 0; line-height: 1.1; letter-spacing: -0.5px; }
.hero-tagline { margin: 10px 0 0; font-size: 1.15rem; color: var(--ink-muted); font-family: var(--font-body); }

/* ===== Prose (Markdown) ===== */

.prose { font-family: var(--font-body); font-size: 1.08rem; line-height: 1.7; max-width: 70ch; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--font-display); line-height: 1.25; margin: 1.4em 0 0.5em; }
.prose h1 { font-size: 1.6rem; }
.prose h2 { font-size: 1.35rem; }
.prose h3 { font-size: 1.15rem; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose li { margin: 0.25em 0; }
.prose blockquote { margin: 1em 0; padding: 4px 18px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius) var(--radius) 0; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; background: #F3EFE8; padding: 1px 5px; border-radius: 6px; }
.prose pre { background: #2D2A3E; color: #F7F3EC; padding: 14px 16px; border-radius: var(--radius); overflow-x: auto; font-size: 0.9rem; }
.prose pre code { background: none; color: inherit; padding: 0; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius); }
.prose table { border-collapse: collapse; margin: 0 0 1em; display: block; overflow-x: auto; max-width: 100%; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 1.6em 0; }

/* ===== Category cards ===== */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.topic-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: var(--ink);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
  border-top: 5px solid var(--accent);
}
.topic-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); border-color: var(--accent); color: var(--ink); }
.topic-card.is-empty { opacity: 0.7; border-top-color: var(--border); }
.topic-card-title { font-weight: 800; font-size: 1.15rem; line-height: 1.25; }
.topic-card-text { color: var(--ink-muted); font-size: 0.95rem; font-family: var(--font-body); }
.topic-card-meta { margin-top: auto; font-size: 0.8rem; color: var(--accent-dark); font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.topic-card-meta em { font-style: normal; color: var(--ink-muted); text-transform: none; letter-spacing: 0; font-weight: 500; }

/* ===== Category page sections ===== */

.topic-section { margin-top: 28px; }
.topic-heading { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; font-size: 1.35rem; margin: 0 0 6px; }
.topic-heading a { color: var(--ink); text-decoration: none; }
.topic-heading a:hover { color: var(--accent-dark); }
.topic-count { font-size: 0.8rem; font-weight: 700; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.topic-blurb { margin: 0 0 10px; color: var(--ink-muted); font-family: var(--font-body); }

/* ===== Concept list ===== */

.concept-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.concept-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 120ms ease, transform 120ms ease;
}
.concept-row:hover { border-color: var(--accent); transform: translateX(3px); color: var(--ink); }
.concept-row-icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
.concept-row-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.concept-row-title { font-weight: 700; }
.concept-row-text { font-size: 0.9rem; color: var(--ink-muted); font-family: var(--font-body); }
.badge-draft {
  margin-left: auto;
  flex: none;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #FFF1CC;
  color: #7A5A00;
  border-radius: 999px;
  padding: 3px 9px;
  vertical-align: middle;
}
.page-title .badge-draft { margin-left: 8px; font-size: 0.6em; }

/* ===== Concept page ===== */

.video-frame {
  background: #000;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin: 0 0 24px;
  aspect-ratio: 16 / 9;
  max-width: 100%;
}
.video-frame video { width: 100%; height: 100%; display: block; }
.video-missing {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  color: var(--ink-muted);
  margin: 0 0 24px;
}

.resources { margin-top: 30px; }
.resources h2 { font-size: 1.1rem; text-transform: uppercase; letter-spacing: 0.8px; color: var(--ink-muted); margin: 0 0 10px; }
.resource-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.resource-list li { padding: 9px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.resource-list a { font-weight: 600; text-decoration: none; }
.resource-list a:hover { text-decoration: underline; }
.resource-host { font-size: 0.8rem; color: var(--ink-muted); margin-left: 8px; }

.prev-next { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; }
.prev-next a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 48%;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}
.prev-next a span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-muted); }
.prev-next a.next { text-align: right; margin-left: auto; }
.prev-next a:hover { border-color: var(--accent); color: var(--accent-dark); }

/* ===== Misc ===== */

.site-empty { color: var(--ink-muted); font-style: italic; }
.site-footer { border-top: 3px solid var(--accent); background: var(--surface); font-size: 0.85rem; color: var(--ink-muted); }
.site-footer .site-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-block: 14px; }
.site-footer-links { display: flex; gap: 14px; }
.site-footer-links a { color: var(--ink-muted); text-decoration: none; opacity: 0.8; }
.site-footer-links a:hover { color: var(--accent-dark); text-decoration: underline; opacity: 1; }

.not-found { text-align: center; padding-top: 60px; }
.not-found-code { font-size: 4rem; font-weight: 800; color: var(--accent-soft); margin: 0; line-height: 1; }
.button-link {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}
.button-link:hover { background: var(--accent-dark); color: #fff; }

@media (max-width: 640px) {
  .site-inner { padding-inline: 16px; }
  .hero { padding: 24px 18px; }
  .site-nav { margin-left: 0; }
  .prev-next { flex-direction: column; }
  .prev-next a { max-width: none; }
  .prev-next a.next { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
