/* ============================================================
   AIMG · SFMC Growth · Manual Web
   styles.css
   ============================================================ */

/* ── Reset & Variables ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:    #1B3F7A;
  --cyan:    #2FA8E0;
  --cyan-lt: #EBF5FB;
  --gray:    #4D4D4D;
  --lgray:   #F4F6F9;
  --mgray:   #9AA5B4;
  --white:   #ffffff;
  --green:   #27AE60;
  --red:     #E74C3C;
  --orange:  #F39C12;
  --shadow:  0 2px 12px rgba(27,63,122,.10);
  --radius:  8px;
  --sidebar-w: 270px;
  --content-max: 760px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'Consolas', 'Fira Code', monospace;
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--white);
  color: var(--gray);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── Progress Bar ──────────────────────────────────────────── */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--navy), var(--cyan));
  z-index: 9999;
  transition: width .1s linear;
}

/* ── Top Header ────────────────────────────────────────────── */
#site-header {
  position: fixed;
  top: 3px; left: 0; right: 0;
  height: 56px;
  background: var(--navy);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  gap: 16px;
}

#site-header img.logo {
  height: 28px;
  width: auto;
  object-fit: contain;
}

#site-header .header-title {
  color: var(--white);
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

#menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--white);
  flex-shrink: 0;
}
#menu-toggle svg { display: block; }

/* ── Layout ────────────────────────────────────────────────── */
#layout {
  display: flex;
  padding-top: 59px; /* header height + progress */
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: 59px;
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - 59px);
  overflow-y: auto;
  background: var(--lgray);
  border-right: 1px solid #e2e8f0;
  padding: 20px 0 40px;
  z-index: 900;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  scrollbar-width: thin;
  scrollbar-color: var(--mgray) transparent;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: var(--mgray); border-radius: 2px; }

.sidebar-section-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mgray);
  padding: 18px 20px 6px;
}

#sidebar nav ul { list-style: none; }

#sidebar nav ul li a {
  display: block;
  padding: 7px 20px 7px 20px;
  font-size: .82rem;
  color: var(--gray);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all .18s;
  line-height: 1.4;
}
#sidebar nav ul li a:hover {
  color: var(--navy);
  background: rgba(47,168,224,.08);
  border-left-color: var(--cyan);
}
#sidebar nav ul li a.active {
  color: var(--navy);
  font-weight: 600;
  background: rgba(47,168,224,.12);
  border-left-color: var(--cyan);
}

/* Sub-items */
#sidebar nav ul li.sub a {
  padding-left: 34px;
  font-size: .79rem;
  color: #6b7280;
}
#sidebar nav ul li.sub a.active { color: var(--navy); }

#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 850;
}

/* ── Main Content ───────────────────────────────────────────── */
#main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

.content-wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 48px 32px 80px;
}

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4 { color: var(--navy); line-height: 1.3; }

h1 {
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--cyan);
}
h1 .section-tag {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--cyan);
  color: var(--white);
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
  vertical-align: middle;
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 36px 0 10px;
  padding-left: 12px;
  border-left: 4px solid var(--cyan);
}

h3 {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 22px 0 8px;
  color: #334155;
}

p { margin-bottom: 14px; }

strong { color: var(--navy); }

em { color: var(--gray); }

/* ── Section dividers ──────────────────────────────────────── */
.section-hero {
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius);
  padding: 32px 28px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
.section-hero::after {
  content: attr(data-num);
  position: absolute;
  right: 20px;
  bottom: -10px;
  font-size: 6rem;
  font-weight: 900;
  color: rgba(255,255,255,.06);
  line-height: 1;
}
.section-hero .num {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--cyan);
  display: block;
  line-height: 1;
}
.section-hero h1 {
  color: var(--white);
  border-bottom-color: var(--cyan);
  margin-top: 6px;
}
.section-hero .tag {
  background: rgba(47,168,224,.25);
  color: var(--cyan);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
  display: inline-block;
}

/* ── Info / Note / Warning boxes ───────────────────────────── */
.box {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 16px 0;
  font-size: .9rem;
  line-height: 1.6;
  border-left: 4px solid;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.box .icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.box-info    { background: var(--cyan-lt); border-color: var(--cyan); }
.box-warning { background: #fff8e7;        border-color: var(--orange); }
.box-success { background: #f0fdf4;        border-color: var(--green); }
.box-error   { background: #fef0f0;        border-color: var(--red); }
.box-quote   {
  background: var(--lgray);
  border-color: var(--mgray);
  font-style: italic;
  font-size: 1rem;
}

/* ── Lists ──────────────────────────────────────────────────── */
ul.content-list, ol.content-list {
  padding-left: 0;
  list-style: none;
  margin: 10px 0 16px;
}
ul.content-list li, ol.content-list li {
  padding: 5px 0 5px 24px;
  position: relative;
  font-size: .92rem;
  line-height: 1.55;
}
ul.content-list li::before {
  content: '';
  position: absolute;
  left: 6px; top: 14px;
  width: 7px; height: 7px;
  background: var(--cyan);
  border-radius: 50%;
}

ol.content-list { counter-reset: ol-counter; }
ol.content-list li { counter-increment: ol-counter; }
ol.content-list li::before {
  content: counter(ol-counter);
  position: absolute;
  left: 0; top: 5px;
  width: 20px; height: 20px;
  background: var(--cyan);
  color: var(--white);
  border-radius: 50%;
  font-size: .7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Steps (numbered) ───────────────────────────────────────── */
.steps {
  margin: 16px 0;
  counter-reset: step-counter;
}
.steps .step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid #f0f4f8;
  counter-increment: step-counter;
}
.steps .step:last-child { border-bottom: none; }
.steps .step-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  background: var(--navy);
  color: var(--white);
  border-radius: 50%;
  font-size: .78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.steps .step-text { font-size: .9rem; padding-top: 4px; line-height: 1.5; }

/* ── Checklists ─────────────────────────────────────────────── */
.checklist-group {
  background: var(--lgray);
  border-radius: var(--radius);
  padding: 20px 20px 14px;
  margin: 16px 0;
}
.checklist-group h4 {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--navy);
  margin-bottom: 14px;
}
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid #e5eaf0;
  cursor: pointer;
  transition: background .15s;
  border-radius: 4px;
  padding: 8px 6px;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item:hover { background: rgba(47,168,224,.07); }
.checklist-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 2px solid var(--cyan);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 1px;
  cursor: pointer;
  position: relative;
  background: var(--white);
  transition: all .15s;
}
.checklist-item input[type="checkbox"]:checked {
  background: var(--cyan);
  border-color: var(--cyan);
}
.checklist-item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px; top: 0px;
  width: 8px; height: 12px;
  border: 2px solid var(--white);
  border-top: none; border-left: none;
  transform: rotate(45deg);
}
.checklist-item label {
  font-size: .88rem;
  cursor: pointer;
  line-height: 1.45;
  flex: 1;
  transition: color .15s;
}
.checklist-item.done label {
  color: var(--mgray);
  text-decoration: line-through;
}
.checklist-progress {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .78rem;
  color: var(--mgray);
}
.checklist-progress .bar {
  flex: 1;
  height: 4px;
  background: #dde4ee;
  border-radius: 2px;
  overflow: hidden;
}
.checklist-progress .bar-fill {
  height: 100%;
  background: var(--cyan);
  border-radius: 2px;
  transition: width .3s;
}
.checklist-reset {
  font-size: .75rem;
  color: var(--mgray);
  background: none;
  border: 1px solid #dde4ee;
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all .15s;
}
.checklist-reset:hover { border-color: var(--red); color: var(--red); }

/* ── Two-column contrast blocks ─────────────────────────────── */
.split-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}
.split-before {
  background: #f8f8f8;
  border-radius: var(--radius);
  padding: 16px;
  border-top: 3px solid var(--mgray);
}
.split-after {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 16px;
  border-top: 3px solid var(--cyan);
  color: var(--white);
}
.split-after p,
.split-after li,
.split-after em,
.split-after span { color: var(--white); }
.split-after strong { color: var(--cyan); }
.split-after ul.content-list li::before { background: var(--cyan); }
.split-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: block;
}
.split-before .split-label { color: var(--mgray); }
.split-after  .split-label { color: var(--cyan); }

/* ── Brand cards ─────────────────────────────────────────────── */
.brand-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 20px 0;
  box-shadow: var(--shadow);
}
.brand-card .brand-panel {
  padding: 24px 20px;
  color: var(--white);
}
.brand-card .brand-panel h3 {
  color: var(--white);
  font-size: 1.3rem;
  margin: 0 0 4px;
}
.brand-card .brand-panel .sub { font-size: .8rem; opacity: .75; margin-bottom: 14px; }
.brand-card .brand-panel ul { list-style: none; padding: 0; }
.brand-card .brand-panel ul li {
  font-size: .82rem;
  padding: 4px 0;
  padding-left: 14px;
  position: relative;
  opacity: .9;
}
.brand-card .brand-panel ul li::before {
  content: '›';
  position: absolute;
  left: 0;
  font-weight: 700;
}
.brand-card .brand-content { padding: 20px; background: var(--lgray); }

/* ── Glossary ────────────────────────────────────────────────── */
.glossary-entry {
  border-bottom: 1px solid #e5eaf0;
  padding: 14px 0;
}
.glossary-entry:last-child { border-bottom: none; }
.glossary-term {
  font-weight: 700;
  color: var(--navy);
  font-size: .95rem;
  margin-bottom: 4px;
}
.glossary-def { font-size: .88rem; color: var(--gray); line-height: 1.55; }

/* ── Role cards ──────────────────────────────────────────────── */
.role-card {
  background: var(--lgray);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}
.role-card .role-header {
  background: var(--navy);
  color: var(--white);
  font-size: .85rem;
  font-weight: 700;
  padding: 10px 16px;
}
.role-card .role-body { padding: 12px 16px; }
.role-card .role-body li {
  font-size: .88rem;
  padding: 4px 0 4px 18px;
  position: relative;
}
.role-card .role-body li::before {
  content: '✓';
  position: absolute; left: 0;
  color: var(--green);
  font-weight: 700;
}

/* ── Error cards ─────────────────────────────────────────────── */
.error-card {
  background: #fef0f0;
  border-radius: var(--radius);
  border-left: 4px solid var(--red);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.error-card .error-title {
  font-weight: 700;
  color: var(--red);
  font-size: .9rem;
  margin-bottom: 4px;
}
.error-card .error-problem { font-size: .85rem; margin-bottom: 4px; }
.error-card .error-solution {
  font-size: .85rem;
  color: var(--green);
  font-weight: 600;
}

/* ── Table ───────────────────────────────────────────────────── */
table.content-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  margin: 16px 0;
}
table.content-table th {
  background: var(--navy);
  color: var(--white);
  padding: 10px 14px;
  text-align: left;
  font-size: .8rem;
}
table.content-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #e5eaf0;
  vertical-align: top;
}
table.content-table tr:nth-child(even) td { background: var(--lgray); }

/* ── Back to top ─────────────────────────────────────────────── */
#back-to-top {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 42px; height: 42px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(27,63,122,.35);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s, transform .25s;
  z-index: 800;
}
#back-to-top.visible { opacity: 1; transform: translateY(0); }
#back-to-top:hover { background: var(--cyan); }
#back-to-top svg { pointer-events: none; }

/* ── Cover / hero section ────────────────────────────────────── */
.cover-hero {
  background: linear-gradient(135deg, var(--navy) 60%, #1E4F8C 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 40px 32px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}
.cover-hero::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 220px; height: 100%;
  background: var(--cyan);
  clip-path: polygon(30% 0, 100% 0, 100% 100%, 0% 100%);
  opacity: .12;
}
.cover-hero .cover-tag {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 8px;
}
.cover-hero h1 {
  color: var(--white);
  border-bottom-color: var(--cyan);
  font-size: 2rem;
  margin-bottom: 10px;
}
.cover-hero p {
  font-size: .95rem;
  color: rgba(255,255,255,.75);
  margin-bottom: 0;
}
.cover-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.cover-pills span {
  background: rgba(47,168,224,.2);
  color: var(--cyan);
  border: 1px solid rgba(47,168,224,.4);
  font-size: .75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}

/* ── TOC (index) table ───────────────────────────────────────── */
.toc-table a {
  color: var(--navy);
  text-decoration: none;
  font-size: .88rem;
}
.toc-table a:hover { color: var(--cyan); text-decoration: underline; }
.toc-sub td:first-child { padding-left: 28px; color: var(--mgray); font-size: .83rem; }

/* ── Inline pill ─────────────────────────────────────────────── */
.pill {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
  vertical-align: middle;
}
.pill-cyan  { background: var(--cyan-lt); color: var(--navy); }
.pill-navy  { background: var(--navy); color: var(--white); }
.pill-green { background: #f0fdf4; color: var(--green); border: 1px solid var(--green); }
.pill-red   { background: #fef0f0; color: var(--red); border: 1px solid var(--red); }

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }

  #sidebar {
    width: 280px;
    transform: translateX(-100%);
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar-overlay.open { display: block; }

  #menu-toggle { display: flex; }

  #main-content { margin-left: 0; }

  .content-wrap { padding: 32px 18px 60px; }

  .split-block { grid-template-columns: 1fr; }

  .brand-card { grid-template-columns: 1fr; }
  .brand-card .brand-panel { padding: 20px; }

  h1 { font-size: 1.55rem; }
  h2 { font-size: 1.1rem; }

  #back-to-top { bottom: 16px; right: 14px; }
}

@media (max-width: 480px) {
  .cover-hero { padding: 28px 18px; }
  .cover-hero h1 { font-size: 1.4rem; }
  .content-wrap { padding: 24px 14px 60px; }
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  #site-header, #sidebar, #progress-bar, #back-to-top { display: none !important; }
  #main-content { margin-left: 0 !important; }
  .content-wrap { padding: 0; max-width: 100%; }
  h1, h2 { page-break-after: avoid; }
}
