@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   Power BI Audit — Documentation
   Mobile-first responsive design
   ============================================================ */

:root {
  --blue-900: #0f2340;
  --blue-800: #17375e;
  --blue-700: #1e4d82;
  --blue-600: #2563a8;
  --blue-500: #3b82c4;
  --blue-400: #60a5d8;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;

  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;

  --accent: #f59e0b;
  --green: #16a34a;
  --red: #dc2626;
  --orange: #ea580c;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.10);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --sidebar-w: 260px;
  --topbar-h: 56px;
}

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

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

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--slate-50);
  color: var(--slate-800);
  line-height: 1.7;
}

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

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--blue-400);
  outline-offset: 2px;
}

img,
svg,
video {
  max-width: 100%;
}

img {
  height: auto;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
}

p,
li,
td,
th,
.card__title,
.card__desc,
.domain-header__title,
.domain-header__sub {
  overflow-wrap: break-word;
}

/* ── Google Fonts ────────────────────────────────────────── */
/* ── Top bar ─────────────────────────────────────────────── */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 200;
  height: var(--topbar-h);
  background: var(--blue-900);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

.topbar__logo {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
}

.topbar__logo svg {
  flex: 0 0 auto;
}

.topbar__logo > span:not(.topbar__product-name) {
  white-space: nowrap;
}

.topbar__product-name {
  display: none;
  color: rgba(255,255,255,.55);
  font-weight: 400;
  font-size: .8rem;
  margin-left: 2px;
  white-space: nowrap;
}

.topbar__spacer {
  flex: 1 1 auto;
  min-width: 0;
}

.topbar__lang {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.topbar__lang a {
  min-width: 44px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.7);
  font-size: .78rem;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}

.topbar__lang a:hover,
.topbar__lang a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  text-decoration: none;
}

.topbar__lang .sep {
  color: rgba(255,255,255,.3);
}

.topbar__menu-btn {
  order: -1;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  color: #fff;
}

/* ── Layout ──────────────────────────────────────────────── */
.layout {
  display: block;
  min-height: 100vh;
  padding-top: var(--topbar-h);
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  inset: var(--topbar-h) auto 0 0;
  z-index: 150;
  width: min(var(--sidebar-w), 88vw);
  background: #fff;
  border-right: 1px solid var(--slate-200);
  overflow-y: auto;
  padding: 24px 0 40px;
  transform: translateX(-105%);
  transition: transform .25s ease;
  box-shadow: var(--shadow-lg);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar__section {
  padding: 0 16px;
  margin-bottom: 24px;
}

.sidebar__section-title {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--slate-400);
  padding: 0 8px;
  margin-bottom: 6px;
}

.sidebar__nav,
.sidebar__sub {
  list-style: none;
}

.sidebar__nav li a {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: var(--slate-700);
}

.sidebar__nav li a:hover,
.sidebar__nav li a.active {
  background: var(--blue-50);
  color: var(--blue-700);
  text-decoration: none;
}

.sidebar__nav li a.active {
  font-weight: 600;
}

.sidebar__nav li a svg {
  flex: 0 0 auto;
  opacity: .6;
}

.sidebar__nav li a.active svg {
  opacity: 1;
}

.sidebar__sub {
  padding-left: 28px;
}

.sidebar__sub li a {
  min-height: 36px;
  font-size: .82rem;
  color: var(--slate-500);
  padding: 6px 8px;
}

.sidebar__sub li a:hover {
  color: var(--blue-600);
  background: transparent;
}

/* ── Main content ────────────────────────────────────────── */
.main {
  width: 100%;
  min-width: 0;
  padding: 28px 16px 60px;
  overflow: clip;
}

.content-wrap {
  width: 100%;
  max-width: 820px;
  min-width: 0;
  margin-inline: auto;
}

/* ── Page header ─────────────────────────────────────────── */
.page-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--slate-200);
}

.page-eyebrow,
.hero__eyebrow {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.page-eyebrow {
  color: var(--blue-500);
  margin-bottom: 8px;
}

.page-header h1 {
  font-size: clamp(1.65rem, 7vw, 2rem);
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1.2;
  letter-spacing: -.02em;
  margin-bottom: 12px;
}

.page-header .lead {
  font-size: 1rem;
  color: var(--slate-600);
  max-width: 600px;
}

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-700) 100%);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  margin-bottom: 36px;
  color: #fff;
}

.hero::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -100px;
  width: 240px;
  height: 240px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
  pointer-events: none;
}

.hero__eyebrow {
  position: relative;
  color: var(--blue-400);
  margin-bottom: 12px;
}

.hero h1 {
  position: relative;
  font-size: clamp(1.55rem, 7vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.18;
  margin-bottom: 16px;
}

.hero p {
  position: relative;
  max-width: 520px;
  font-size: 1rem;
  color: rgba(255,255,255,.78);
  margin-bottom: 24px;
}

.hero__cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  background: #fff;
  color: var(--blue-800);
  font-weight: 600;
  font-size: .9rem;
  padding: 10px 20px;
  border-radius: var(--radius);
}

.hero__cta:hover {
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  transform: translateY(-1px);
}

/* ── Cards ───────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 32px;
}

.card {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.card__title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--slate-900);
}

.card__desc {
  min-width: 0;
  font-size: .88rem;
  color: var(--slate-500);
  line-height: 1.5;
  flex: 1;
}

.card a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 4px;
  margin-top: auto;
  font-size: .82rem;
  font-weight: 500;
  color: var(--blue-600);
}

/* ── Sections & typography ───────────────────────────────── */
.section {
  min-width: 0;
  margin-bottom: 40px;
}

h2 {
  scroll-margin-top: calc(var(--topbar-h) + 16px);
  font-size: clamp(1.25rem, 5vw, 1.45rem);
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -.015em;
  margin-bottom: 14px;
  padding-top: 8px;
}

h3 {
  scroll-margin-top: calc(var(--topbar-h) + 16px);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--slate-800);
  margin: 26px 0 10px;
}

h4 {
  font-size: .9rem;
  font-weight: 600;
  color: var(--slate-700);
  margin: 18px 0 8px;
}

p {
  margin-bottom: 14px;
  color: var(--slate-700);
  font-size: .95rem;
}

ul,
ol {
  margin-bottom: 14px;
  padding-left: 22px;
}

li {
  margin-bottom: 6px;
  font-size: .95rem;
  color: var(--slate-700);
}

/* ── Steps ───────────────────────────────────────────────── */
.steps {
  list-style: none;
  padding: 0;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  display: flex;
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--slate-100);
}

.steps li:last-child {
  border-bottom: 0;
}

.steps li::before {
  content: counter(step);
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  background: var(--blue-600);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 700;
  margin-top: 2px;
}

.steps li strong {
  display: block;
  color: var(--slate-900);
  margin-bottom: 4px;
}

/* ── Callouts ────────────────────────────────────────────── */
.callout {
  min-width: 0;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: .9rem;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.callout > div {
  min-width: 0;
}

.callout--info {
  background: var(--blue-50);
  border-left: 3px solid var(--blue-500);
  color: var(--blue-900);
}

.callout--warning {
  background: #fffbeb;
  border-left: 3px solid var(--accent);
  color: #78350f;
}

.callout--tip {
  background: #f0fdf4;
  border-left: 3px solid var(--green);
  color: #14532d;
}

.callout__icon {
  flex: 0 0 auto;
  margin-top: 1px;
}

/* ── Badges / tags ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}

.badge--high { background: #fee2e2; color: #991b1b; }
.badge--medium { background: #ffedd5; color: #9a3412; }
.badge--low { background: #fef9c3; color: #854d0e; }
.badge--info { background: var(--blue-100); color: var(--blue-800); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.tag--mod { background: #ede9fe; color: #4c1d95; }
.tag--dax { background: #dbeafe; color: #1e3a5f; }
.tag--gov { background: #d1fae5; color: #064e3b; }
.tag--vpq { background: #fce7f3; color: #831843; }
.tag--per { background: #fef3c7; color: #78350f; }
.tag--pqy { background: #e0f2fe; color: #0c4a6e; }

/* ── Responsive data tables ─────────────────────────────── */
.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 32px;
  border-radius: var(--radius-lg);
}

.table-scroll .rules-table {
  margin-bottom: 0;
}

/* Tables remain real tables; on narrow screens the container scrolls. */
.rules-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: .875rem;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.rules-table thead th {
  background: var(--slate-800);
  color: #fff;
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
}

.rules-table tbody tr {
  border-bottom: 1px solid var(--slate-100);
}

.rules-table tbody tr:last-child {
  border-bottom: 0;
}

.rules-table tbody tr:hover {
  background: var(--slate-50);
}

.rules-table td {
  padding: 12px 16px;
  color: var(--slate-700);
  vertical-align: top;
}

.rules-table td:first-child {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--slate-500);
  white-space: nowrap;
}

.rules-table td:nth-child(2) {
  font-weight: 500;
  color: var(--slate-900);
}

/* ── Domain section header ───────────────────────────────── */
.domain-header {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.domain-header__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.domain-header__title {
  min-width: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--slate-900);
  margin: 0;
  padding: 0;
  letter-spacing: normal;
}

.domain-header__sub {
  min-width: 0;
  font-size: .82rem;
  color: var(--slate-500);
  margin-top: 2px;
}

.domain-header__weight {
  grid-column: 2;
  margin-left: 0;
  flex: 0 0 auto;
  text-align: right;
}

.domain-header__pct {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--blue-700);
  line-height: 1;
}

.domain-header__pct-label {
  font-size: .7rem;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ── Scores ──────────────────────────────────────────────── */
.score-gauge-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 28px;
}

.score-card {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.score-card__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1;
}

.score-card__label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--slate-400);
  margin-top: 6px;
}

/* ── Penalty pills ───────────────────────────────────────── */
.penalty-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.penalty-pill {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
}

.penalty-pill--high { background: #fee2e2; }
.penalty-pill--medium { background: #ffedd5; }
.penalty-pill--low { background: #fef9c3; }

.penalty-pill__pts {
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
}

.penalty-pill--high .penalty-pill__pts { color: #991b1b; }
.penalty-pill--medium .penalty-pill__pts { color: #9a3412; }
.penalty-pill--low .penalty-pill__pts { color: #854d0e; }

.penalty-pill__label {
  min-width: 0;
  font-size: .78rem;
  color: var(--slate-600);
}

/* ── Code ────────────────────────────────────────────────── */
.code-block {
  max-width: 100%;
  background: var(--slate-900);
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 18px 16px;
  font-family: var(--font-mono);
  font-size: .78rem;
  line-height: 1.65;
  overflow-x: auto;
  margin-bottom: 16px;
  position: relative;
  white-space: pre;
  -webkit-overflow-scrolling: touch;
}

.code-block::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--slate-500);
}

.code-block .kw { color: #93c5fd; }
.code-block .str { color: #86efac; }
.code-block .num { color: #fca5a5; }
.code-block .cmt { color: #64748b; }

p code,
li code,
td code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ── TOC ─────────────────────────────────────────────────── */
.toc {
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 32px;
}

.toc__title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--blue-600);
  margin-bottom: 10px;
}

.toc ol {
  list-style: decimal;
  padding-left: 20px;
  margin-bottom: 0;
}

.toc li {
  font-size: .85rem;
  margin-bottom: 4px;
}

.toc a {
  color: var(--blue-700);
}

/* ── Filter bar ──────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.filter-btn {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--slate-200);
  background: #fff;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--slate-600);
}

.filter-btn:hover,
.filter-btn.active {
  border-color: var(--blue-500);
  background: var(--blue-50);
  color: var(--blue-700);
}

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  width: 100%;
  background: var(--slate-800);
  color: rgba(255,255,255,.5);
  font-size: .78rem;
  padding: 18px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
}

.footer span {
  overflow-wrap: anywhere;
}

.footer a {
  color: rgba(255,255,255,.6);
}

.footer a:hover {
  color: #fff;
}

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  border: 0;
  border-top: 1px solid var(--slate-200);
  margin: 32px 0;
}


/* ── Two-card audience group ─────────────────────────────── */
.cards-grid--audience {
  grid-template-columns: 1fr;
}
@media (min-width: 601px) {
  .cards-grid--audience {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Tablet / desktop enhancements ───────────────────────── */
@media (min-width: 601px) {
  .topbar {
    padding-inline: 20px;
  }

  .topbar__product-name {
    display: inline;
  }

  .main {
    padding: 40px 32px 72px;
  }

  .hero {
    padding: 40px 36px;
  }

  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .score-gauge-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .penalty-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .penalty-pill {
    flex-direction: column;
    align-items: flex-start;
  }

  .toc {
    padding: 18px 22px;
  }
}

@media (min-width: 901px) {
  .topbar {
    gap: 16px;
    padding-inline: 24px;
  }

  .topbar__menu-btn {
    display: none;
  }

  .topbar__product-name {
    margin-left: 4px;
  }

  .layout {
    display: flex;
    align-items: stretch;
  }

  .sidebar {
    position: fixed;
    inset: var(--topbar-h) auto 0 0;
    transform: none;
    box-shadow: none;
  }

  .main {
    flex: 1 1 auto;
    width: calc(100% - var(--sidebar-w));
    margin-left: var(--sidebar-w);
    padding: 48px 56px 80px;
  }

  .footer {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    padding-inline: 56px;
  }

  .hero {
    padding: 48px 52px;
    margin-bottom: 48px;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
  }

  .card {
    padding: 24px;
  }

  .domain-header {
    display: flex;
    align-items: center;
    padding: 18px 22px;
    gap: 14px;
  }

  .domain-header__weight {
    grid-column: auto;
    margin-left: auto;
  }
}

/* ── Mobile-first safety & interaction refinements ─────── */
.hero h1 {
  text-wrap: balance;
}

.page-header h1,
.domain-header__title,
.card__title {
  text-wrap: balance;
}

.card,
.score-card,
.callout,
.domain-header,
.hero,
.toc {
  overflow-wrap: anywhere;
}

/* Do not turn every textual link into a large block. Target controls only. */
button,
.hero__cta,
.filter-btn,
.sidebar__nav li a,
.topbar__lang a {
  touch-action: manipulation;
}

@media (max-width: 600px) {
  .topbar__logo > span:not(.topbar__product-name) {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hero {
    border-radius: 12px;
  }

  .hero h1 {
    font-size: clamp(1.5rem, 8vw, 2rem);
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .domain-header__weight {
    text-align: left;
  }

  .table-scroll {
    scrollbar-width: thin;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
