/* ── Brand Variables ── */
:root {
  --royal:       #1B3A6B;
  --terracotta:  #ff7828;
  --cream:       #FDFBF7;
  --ink:         #2B2D31;
  --ink-muted:   #6B6F76;
  --shadow-hard: 4px 4px 0 0 #2B2D31;
  --shadow-sm:   2px 2px 0 0 #2B2D31;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
body { background: var(--cream); color: var(--ink); font-family: system-ui, -apple-system, sans-serif; }

/* ── Site Header ── */
.site-header {
  background: var(--cream);
  border-bottom: 2px solid var(--ink);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand-name {
  font-family: 'Raleway', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--royal);
  line-height: 1.2;
  white-space: nowrap;
}
.brand-sub {
  font-size: 0.62rem;
  color: var(--ink-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.site-nav { display: flex; align-items: center; gap: 2px; }
.site-nav-link {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  padding: 5px 10px;
  letter-spacing: .03em;
  text-transform: uppercase;
  border: 2px solid transparent;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.site-nav-link:hover,
.site-nav-link.active { color: var(--royal); border-bottom-color: var(--royal); }

/* ── Buttons ── */
.btn-brand {
  background: var(--royal);
  color: #fff !important;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 7px 14px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  border-radius: 0;
  line-height: 1.4;
  white-space: nowrap;
}
.btn-brand:hover { transform: translate(-1px,-1px); box-shadow: var(--shadow-hard); }
.btn-brand:active { transform: translate(2px,2px); box-shadow: none; }
.btn-brand-sm { font-size: 0.67rem; padding: 4px 10px; }
.btn-brand-outline {
  background: transparent;
  color: var(--ink) !important;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
}
.btn-danger-brand { background: var(--terracotta); }

/* ── Inputs ── */
.brand-input {
  border: 2px solid var(--ink);
  padding: 10px 14px;
  background: #fff;
  color: var(--ink);
  font-size: 0.88rem;
  width: 100%;
  border-radius: 0;
  outline: none;
  transition: box-shadow .12s;
  font-family: inherit;
}
.brand-input:focus { box-shadow: var(--shadow-hard); }
.brand-input.is-invalid { border-color: var(--terracotta); }
textarea.brand-input { resize: vertical; min-height: 90px; }
.field-label {
  font-size: 0.71rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink);
  margin-bottom: 5px;
  display: block;
}
.field-hint { font-size: 0.67rem; color: var(--ink-muted); margin-top: 4px; }
.char-badge {
  font-size: 0.63rem;
  font-weight: 700;
  padding: 2px 6px;
  letter-spacing: .04em;
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
}
.char-ok   { background: rgba(22,163,74,0.1);  color: #16a34a; border: 1px solid #16a34a; }
.char-warn { background: rgba(255,120,40,0.09); color: var(--terracotta); border: 1px solid var(--terracotta); }

/* ── Cards ── */
.brand-card {
  background: #fff;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

/* ── Post Cards ── */
.post-card {
  background: #fff;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: transform .12s, box-shadow .12s;
}
.post-card:hover { transform: translate(-2px,-2px); box-shadow: var(--shadow-hard); }
.post-card[data-href] { cursor: pointer; }
.post-card[data-href]:focus-visible { outline: 2px solid var(--royal); outline-offset: 3px; }
.post-card-kw-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  margin-bottom: 6px;
}
.post-card-kw {
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--terracotta);
  border: 1.5px solid var(--terracotta);
  padding: 2px 8px;
  display: inline-block;
  width: fit-content;
}
.post-card-topic {
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #fff;
  background: var(--royal);
  padding: 2px 8px;
  display: inline-block;
  width: fit-content;
}
.post-card-author {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.post-card-title {
  font-family: 'Raleway', sans-serif;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 0;
  display: block;
  line-height: 1.35;
}
.post-card-title:hover { color: var(--royal); }
.post-card-excerpt {
  font-size: 0.81rem;
  color: var(--ink-muted);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 14px;
}
.post-card-meta {
  font-size: 0.67rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-top: 1px solid rgba(43,45,49,0.1);
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}
.post-card-read {
  font-size: 0.71rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--royal);
  text-decoration: none;
}
.post-card-read:hover { text-decoration: underline; }
.post-card-admin {
  border-top: 1px solid rgba(43,45,49,0.1);
  padding-top: 12px;
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

/* ── Blog Hero ── */
.blog-hero {
  background: var(--royal);
  border-bottom: 2px solid var(--ink);
  padding: 40px 20px 32px;
}
.blog-hero-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  margin-bottom: 6px;
}
.blog-hero-title {
  font-family: 'Raleway', sans-serif;
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 6px;
  line-height: 1.15;
}
.blog-hero-sub {
  color: rgba(255,255,255,0.65);
  font-size: 0.83rem;
  margin-bottom: 22px;
}
.blog-search-bar {
  position: relative;
  max-width: 560px;
}
.blog-search-input {
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 12px 44px 12px 16px;
  font-size: 0.92rem;
  background: #fff;
  color: var(--ink);
  outline: none;
  width: 100%;
  border-radius: 0;
  transition: box-shadow .12s;
  font-family: inherit;
}
.blog-search-input:focus { box-shadow: var(--shadow-hard); }
.blog-search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
}

/* ── Blog layout: topic sidebar + article grid ── */
.blog-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 20px 80px;
  width: 100%;
}
.blog-layout {
  display: flex;
  align-items: flex-start;
  gap: 32px;
}
.blog-sidebar {
  width: 210px;
  flex-shrink: 0;
  position: sticky;
  top: 81px; /* clears the sticky .site-header (65px) + 16px gap */
}
.blog-sidebar-heading {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-muted);
  margin-bottom: 10px;
}
.blog-topic-list {
  display: flex;
  flex-direction: column;
  border-top: 2px solid var(--ink);
}
.blog-topic-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 2px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(43,45,49,0.12);
  transition: color .12s, padding-left .12s;
}
.blog-topic-link:hover { color: var(--royal); padding-left: 6px; }
.blog-topic-link.active {
  color: var(--royal);
  font-weight: 800;
}
.blog-topic-count {
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--ink-muted);
  border: 1.5px solid rgba(43,45,49,0.2);
  padding: 1px 7px;
  min-width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.blog-topic-link.active .blog-topic-count {
  background: var(--royal);
  color: #fff;
  border-color: var(--royal);
}
.blog-content { flex: 1; min-width: 0; }

/* ── Blog index: fixed viewport — only the article grid scrolls,
   header/hero/sidebar stay in place. Desktop only; mobile keeps its
   normal scrolling page with the collapsed topic-chip row. ── */
@media (min-width: 769px) {
  body.blog-page-fixed {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    margin: 0;
  }
  body.blog-page-fixed .site-header,
  body.blog-page-fixed .blog-hero {
    flex-shrink: 0;
  }
  body.blog-page-fixed .blog-main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    padding: 32px 20px 24px;
  }
  body.blog-page-fixed .blog-layout {
    flex: 1;
    min-height: 0;
    width: 100%;
    align-items: stretch;
  }
  body.blog-page-fixed .blog-sidebar {
    position: static;
    overflow-y: auto;
  }
  body.blog-page-fixed .blog-content {
    overflow-y: auto;
    padding-right: 4px;
  }
}

/* ── Article view ── */
.article-meta-band {
  background: var(--ink);
  color: rgba(255,255,255,0.75);
  padding: 10px 20px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.article-title {
  font-family: 'Raleway', sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--royal);
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.article-body { font-size: 1rem; line-height: 1.85; color: var(--ink); }
.article-body h2, .article-body h3 {
  font-family: 'Raleway', sans-serif;
  font-weight: 700;
  color: var(--royal);
  margin-top: 2.2rem;
  margin-bottom: .6rem;
}
.article-body p  { margin-bottom: 1.2rem; }
.article-body ul, .article-body ol { margin-bottom: 1.2rem; padding-left: 1.5rem; }
.article-body a  { color: var(--royal); }
.article-body blockquote {
  border-left: 4px solid var(--terracotta);
  padding: 10px 20px;
  background: rgba(255,120,40,0.06);
  font-style: italic;
  margin: 1.5rem 0;
  color: var(--ink-muted);
}
.article-kw-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--terracotta);
  border: 1.5px solid var(--terracotta);
  padding: 3px 10px;
  display: inline-block;
  margin-bottom: 14px;
}

/* ── Author bio trigger (meta band) ── */
.author-trigger {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.35);
  text-underline-offset: 2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.author-trigger:hover,
.author-trigger:focus-visible { color: #fff; text-decoration-color: #fff; }

/* ── Modal (shared: author bio, etc.) ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(43,45,49,0.55);
  z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
  padding: 16px;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-card {
  background: var(--cream);
  border: 2px solid var(--ink);
  box-shadow: 8px 8px 0 0 var(--ink);
  padding: 24px;
  width: 100%; max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.97) translateY(6px);
  transition: transform .2s;
  -webkit-overflow-scrolling: touch;
}
.modal-overlay.open .modal-card { transform: scale(1) translateY(0); }
.modal-heading {
  font-family: 'Raleway', sans-serif;
  font-size: 1.2rem; font-weight: 700; color: var(--royal);
}
.modal-close-x {
  background: none;
  border: 1px solid var(--ink);
  color: var(--ink-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: clamp(28px, 6vw, 40px);
  height: clamp(28px, 6vw, 40px);
  transition: background .15s, color .15s;
}
.modal-close-x:hover { background: var(--ink); color: var(--cream); }

/* ── Author modal specifics ── */
.author-modal-avatar {
  width: 52px; height: 52px; flex-shrink: 0;
  background: var(--royal);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  border: 2px solid var(--ink);
}
.author-modal-role {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-muted);
}
.author-modal-quals {
  font-size: 0.75rem; color: var(--terracotta); font-weight: 700;
  margin-bottom: 10px; display: flex; align-items: center; gap: 5px;
}
.author-modal-tertiary-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px;
}
.author-modal-tertiary-badge {
  font-size: 0.68rem; font-weight: 600; color: var(--ink);
  border: 1.5px solid rgba(43,45,49,0.2);
  padding: 3px 9px;
}
.author-modal-bio {
  font-size: 0.85rem; color: var(--ink); line-height: 1.6;
  margin-bottom: 14px;
}
.author-modal-linkedin {
  font-size: 0.78rem; font-weight: 700; color: var(--royal);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.author-modal-linkedin:hover { text-decoration: underline; }

/* ── SEO Panel ── */
.seo-panel {
  background: #fff;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 26px;
  margin-bottom: 28px;
}
.seo-panel-heading {
  font-family: 'Raleway', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--royal);
  margin-bottom: 3px;
}
.seo-panel-step {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--terracotta);
  margin-bottom: 3px;
}
.seo-panel-sub { font-size: 0.75rem; color: var(--ink-muted); margin-bottom: 22px; }

/* SERP Preview */
.serp-preview {
  background: #fff;
  border: 2px solid rgba(43,45,49,0.15);
  padding: 14px 18px;
  margin-top: 20px;
  margin-bottom: 6px;
}
.serp-label {
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.serp-title {
  font-size: 1.05rem;
  color: #1a0dab;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: underline;
}
.serp-url  { font-size: 0.78rem; color: #006621; margin-bottom: 4px; }
.serp-desc { font-size: 0.82rem; color: #545454; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Editor gating */
.editor-section { background: #fff; border: 2px solid var(--ink); padding: 26px; }
.editor-section-heading {
  font-family: 'Raleway', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--royal);
  margin-bottom: 3px;
}
.editor-wrap { position: relative; }
.editor-locked { opacity: 0.42; pointer-events: none; user-select: none; }
.editor-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(253,251,247,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border: 2px dashed var(--ink-muted);
  text-align: center;
  padding: 24px;
}
.editor-lock-overlay p {
  font-size: 0.83rem;
  color: var(--ink-muted);
  font-weight: 600;
  max-width: 300px;
  margin: 0;
}

/* ── Alert ── */
.brand-alert {
  border: 2px solid;
  padding: 11px 14px;
  font-size: 0.81rem;
  font-weight: 600;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-alert-err { border-color: var(--terracotta); color: var(--terracotta); background: rgba(255,120,40,0.07); }
.brand-alert-ok  { border-color: #16a34a; color: #16a34a; background: rgba(22,163,74,0.07); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  border: 2px dashed rgba(43,45,49,0.18);
  color: var(--ink-muted);
}
.empty-state i { font-size: 2.6rem; display: block; margin-bottom: 10px; }

/* ── Login ── */
.login-wrap {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-hard);
  padding: 36px;
}
.login-heading {
  font-family: 'Raleway', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--royal);
  margin-bottom: 4px;
}
.login-sub { font-size: 0.78rem; color: var(--ink-muted); margin-bottom: 24px; }

/* ── Footer ── */
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  background: var(--cream);
  border-top: 2px solid var(--ink);
  padding: 0 20px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.footer-copy {
  font-size: 0.65rem;
  color: var(--ink-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 600;
}
.footer-link {
  font-size: 0.65rem;
  color: var(--terracotta);
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.footer-link:hover { text-decoration: underline; }

/* Reserve space so fixed footer never covers page content */
body { padding-bottom: 60px; }

/* ── Keyword tag input ── */
.tag-input-wrap {
  border: 2px solid var(--ink);
  background: #fff;
  padding: 6px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  cursor: text;
  min-height: 48px;
  transition: box-shadow .12s;
}
.tag-input-wrap:focus-within { box-shadow: var(--shadow-hard); }
.tag-input-wrap.is-invalid   { border-color: var(--terracotta); }
.kw-tag {
  background: var(--royal);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: .03em;
  white-space: nowrap;
}
.kw-tag-remove {
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
}
.kw-tag-remove:hover { color: #fff; }
.tag-input-field {
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.86rem;
  font-family: inherit;
  color: var(--ink);
  flex: 1;
  min-width: 130px;
}
.kw-count-badge {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2px 7px;
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
}

/* ── Quill override ── */
.ql-container { font-family: system-ui, sans-serif; font-size: 1rem; }
.ql-editor { min-height: 400px; line-height: 1.75; }
.ql-snow .ql-picker.ql-font .ql-picker-label,
.ql-snow .ql-picker.ql-size .ql-picker-label { padding-right: 18px; }
.ql-toolbar { border: 2px solid var(--ink) !important; border-bottom: 1px solid rgba(43,45,49,0.2) !important; }
.ql-container.ql-snow { border: 2px solid var(--ink) !important; border-top: none !important; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .blog-layout   { flex-direction: column; gap: 22px; }
  .blog-sidebar  { width: 100%; position: static; }
  .blog-topic-list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    border-top: none;
    border-bottom: 2px solid var(--ink);
    padding-bottom: 12px;
    gap: 8px;
  }
  .blog-topic-link {
    border: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    padding: 6px 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .blog-topic-link.active { background: var(--royal); color: #fff; }
  .blog-topic-link.active .blog-topic-count { background: #fff; color: var(--royal); border-color: #fff; }
}
@media (max-width: 480px) {
  .site-header { padding: 8px 12px; }
  .brand-sub   { display: none; }
  .site-nav    { display: none; }
  .blog-hero-title { font-size: 1.5rem; }
}
