/* =====================================================================
   MS-102 Study Notes — Microsoft / Azure inspired design system
   Author: Marco Grimaldi (marcogrimaldi29.com)
   ===================================================================== */

:root {
  /* Microsoft / Azure palette */
  --ms-blue: #0078d4;
  --ms-blue-dark: #005a9e;
  --ms-blue-darker: #004578;
  --ms-blue-light: #50a0e0;
  --azure-cyan: #00bcf2;
  --ms-purple: #5c2d91;
  --ms-teal: #008575;
  --ms-green: #107c10;
  --ms-amber: #ffb900;
  --ms-orange: #d83b01;
  --ms-red: #d13438;

  /* Domain accent colors */
  --d1: #0078d4; /* tenant   */
  --d2: #5c2d91; /* identity */
  --d3: #d13438; /* defender */
  --d4: #008575; /* purview  */

  /* Light theme surfaces */
  --bg: #f3f6fb;
  --bg-grad-1: #eef4fc;
  --bg-grad-2: #f7f9fc;
  --surface: #ffffff;
  --surface-2: #f6f9fd;
  --surface-3: #eef3f9;
  --border: #e1e6ee;
  --border-strong: #cdd6e4;
  --text: #1b1f27;
  --text-soft: #4a5160;
  --text-muted: #6a7180;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08), 0 2px 4px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1240px;
  --header-h: 60px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "Consolas", "SF Mono", Menlo, monospace;
}

html[data-theme="dark"] {
  --bg: #0b0f17;
  --bg-grad-1: #0d1320;
  --bg-grad-2: #0a0e16;
  --surface: #141a25;
  --surface-2: #1a2230;
  --surface-3: #212b3b;
  --border: #283142;
  --border-strong: #364254;
  --text: #e8edf5;
  --text-soft: #b4bdcc;
  --text-muted: #8590a3;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
  --ms-blue: #2b9bf4;
  --ms-blue-light: #5ab2f7;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--bg-grad-1), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, var(--bg-grad-2), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ms-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ===================== Header / top nav ===================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; color: var(--text); white-space: nowrap; }
.brand img { height: 30px; width: auto; }
.brand:hover { text-decoration: none; }

.top-nav { display: flex; gap: 4px; margin-left: 6px; flex-wrap: nowrap; }
.top-nav a {
  color: var(--text-soft); font-weight: 600; font-size: .9rem;
  padding: 7px 12px; border-radius: 8px; white-space: nowrap;
}
.top-nav a:hover { background: var(--surface-3); text-decoration: none; }
.top-nav a.active { color: var(--ms-blue); background: color-mix(in srgb, var(--ms-blue) 12%, transparent); }

.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); cursor: pointer; font-size: 1.05rem; transition: .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ms-blue); border-color: var(--border-strong); }
.ghub-link { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: .88rem;
  padding: 7px 13px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); }
.ghub-link:hover { background: var(--surface-3); text-decoration: none; color: var(--ms-blue); }
.ghub-link svg { width: 16px; height: 16px; flex: none; }

.nav-toggle { display: none; }

/* ===================== Layout ===================== */
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 34px;
  max-width: var(--maxw); margin: 0 auto; padding: 28px 24px 80px; }
.page-wide { max-width: var(--maxw); margin: 0 auto; padding: 28px 24px 80px; }

/* Sidebar TOC */
.toc {
  position: sticky; top: calc(var(--header-h) + 24px);
  align-self: start; max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto; padding-right: 6px;
}
.toc h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-muted);
  margin: 0 0 10px; padding-left: 12px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc li a { display: block; padding: 6px 12px; font-size: .87rem; color: var(--text-soft);
  border-left: 2px solid transparent; margin-left: -2px; border-radius: 0 6px 6px 0; }
.toc li a:hover { background: var(--surface-3); text-decoration: none; }
.toc li a.toc-h3 { padding-left: 24px; font-size: .82rem; color: var(--text-muted); }
.toc li a.active { color: var(--ms-blue); border-left-color: var(--ms-blue); font-weight: 600;
  background: color-mix(in srgb, var(--ms-blue) 8%, transparent); }

.content { min-width: 0; }

/* ===================== Hero ===================== */
.hero {
  position: relative; overflow: hidden;
  border-radius: 18px; padding: 54px 44px;
  background: linear-gradient(125deg, var(--ms-blue-darker), var(--ms-blue) 55%, var(--azure-cyan));
  color: #fff; box-shadow: var(--shadow-lg); margin-bottom: 34px;
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 0; opacity: .25; pointer-events: none;
  background-image:
    radial-gradient(circle at 80% 20%, rgba(255,255,255,.4), transparent 35%),
    repeating-linear-gradient(135deg, rgba(255,255,255,.06) 0 2px, transparent 2px 22px);
}
/* Brand mark watermark — faint white silhouette of the site logo */
.hero::before {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  top: 50%; right: -40px; transform: translateY(-50%);
  width: min(48%, 460px); aspect-ratio: 1 / 1;
  background: url("../images/site-mark-no-bg.png") center / contain no-repeat;
  filter: brightness(0) invert(1);
  opacity: .1;
}
/* Keep hero text/content above both decorative layers */
.hero > * { position: relative; z-index: 1; }
.hero h1 { margin: 0 0 10px; font-size: 2.5rem; line-height: 1.1; font-weight: 700; letter-spacing: -.5px; }
.hero p { margin: 0; font-size: 1.12rem; max-width: 720px; color: rgba(255,255,255,.92); }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em; background: rgba(255,255,255,.18);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 16px; }
.hero .hero-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero .hero-meta span { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22);
  padding: 6px 13px; border-radius: 999px; font-size: .85rem; font-weight: 600; }

/* page header (domain pages) */
.page-head { border-left: 5px solid var(--accent, var(--ms-blue)); padding: 4px 0 4px 18px; margin-bottom: 8px; }
.page-head .kicker { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent, var(--ms-blue)); }
.page-head h1 { margin: 4px 0 6px; font-size: 2rem; line-height: 1.15; }
.page-head p { margin: 0; color: var(--text-soft); max-width: 760px; }

/* ===================== Headings & content ===================== */
.content h2 { font-size: 1.5rem; margin: 44px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--border);
  scroll-margin-top: 80px; }
.content h2 .num { color: var(--accent, var(--ms-blue)); font-weight: 800; margin-right: 8px; }
.content h3 { font-size: 1.18rem; margin: 30px 0 10px; scroll-margin-top: 80px; color: var(--text); }
.content h4 { font-size: 1.02rem; margin: 22px 0 8px; color: var(--text-soft); }
.content p, .content li { color: var(--text-soft); }
.content strong { color: var(--text); }
.content ul, .content ol { padding-left: 22px; }
.content li { margin: 5px 0; }
.content code { font-family: var(--mono); font-size: .88em; background: var(--surface-3);
  padding: 2px 6px; border-radius: 5px; color: var(--ms-purple); }
html[data-theme="dark"] .content code { color: #d6a8ff; }

/* ===================== Cards ===================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow-sm); margin: 18px 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; margin: 20px 0; }
/* Below the width where 4 cards fit in one row, switch to an even 2x2 grid
   (avoids an uneven 3 + 1 split), then a single column on narrow screens. */
@media (max-width: 1140px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .card-grid { grid-template-columns: 1fr; } }

.nav-card { display: block; position: relative; overflow: hidden; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm);
  transition: .18s; color: var(--text); }
.nav-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--accent, var(--ms-blue)); }
.nav-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; border-color: var(--border-strong); }
.nav-card .nc-badge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent, var(--ms-blue)); margin-bottom: 8px; }
.nav-card h3 { margin: 0 0 8px; font-size: 1.18rem; }
.nav-card p { margin: 0 0 14px; color: var(--text-soft); font-size: .92rem; }
.nav-card .nc-foot { font-size: .82rem; color: var(--text-muted); font-weight: 600; }

/* ===================== Progress bars ===================== */
.weight-list { display: flex; flex-direction: column; gap: 16px; margin: 4px 0; }
.weight-row .wr-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.weight-row .wr-name { font-weight: 600; color: var(--text); }
.weight-row .wr-pct { font-weight: 700; color: var(--accent, var(--ms-blue)); font-variant-numeric: tabular-nums; }
.progress { height: 12px; background: var(--surface-3); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent, var(--ms-blue)), color-mix(in srgb, var(--accent, var(--ms-blue)) 55%, #fff));
  transition: width 1.1s cubic-bezier(.2,.7,.2,1); }

/* ===================== Callouts ===================== */
.callout { position: relative; border-radius: var(--radius); padding: 16px 18px 16px 52px; margin: 18px 0;
  border: 1px solid var(--border); background: var(--surface-2); box-shadow: var(--shadow-sm); }
.callout::before { position: absolute; left: 16px; top: 15px; font-size: 1.25rem; line-height: 1; }
.callout .ct-title { font-weight: 700; margin: 0 0 4px; }
.callout p:last-child { margin-bottom: 0; }
.callout p { color: var(--text-soft); }

.callout.exam { border-left: 5px solid var(--ms-amber); background: color-mix(in srgb, var(--ms-amber) 10%, var(--surface)); }
.callout.exam::before { content: "🎯"; }
.callout.exam .ct-title { color: #946200; }
html[data-theme="dark"] .callout.exam .ct-title { color: var(--ms-amber); }

.callout.tip { border-left: 5px solid var(--ms-green); background: color-mix(in srgb, var(--ms-green) 9%, var(--surface)); }
.callout.tip::before { content: "💡"; }
.callout.tip .ct-title { color: var(--ms-green); }

.callout.warn { border-left: 5px solid var(--ms-orange); background: color-mix(in srgb, var(--ms-orange) 9%, var(--surface)); }
.callout.warn::before { content: "⚠️"; }
.callout.warn .ct-title { color: var(--ms-orange); }

.callout.note { border-left: 5px solid var(--ms-blue); background: color-mix(in srgb, var(--ms-blue) 8%, var(--surface)); }
.callout.note::before { content: "📘"; }
.callout.note .ct-title { color: var(--ms-blue); }

.callout.ps { border-left: 5px solid var(--ms-purple); background: color-mix(in srgb, var(--ms-purple) 8%, var(--surface)); }
.callout.ps::before { content: "⌨️"; }
.callout.ps .ct-title { color: var(--ms-purple); }
html[data-theme="dark"] .callout.ps .ct-title { color: #c79bf0; }

/* ===================== Tables ===================== */
.table-wrap { overflow-x: auto; margin: 18px 0; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--surface); min-width: 520px; }
table.tbl thead th { background: linear-gradient(180deg, var(--ms-blue), var(--ms-blue-dark)); color: #fff;
  text-align: left; padding: 11px 14px; font-weight: 600; position: sticky; top: 0; }
table.tbl.t-purple thead th { background: linear-gradient(180deg, var(--ms-purple), #45216e); }
table.tbl.t-red thead th { background: linear-gradient(180deg, var(--ms-red), #a32a2d); }
table.tbl.t-teal thead th { background: linear-gradient(180deg, var(--ms-teal), #006052); }
table.tbl.t-slate thead th { background: linear-gradient(180deg, #4a5568, #2d3748); }
table.tbl td, table.tbl th { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text-soft); }
table.tbl tbody tr:nth-child(even) { background: var(--surface-2); }
table.tbl tbody tr:hover { background: var(--surface-3); }
table.tbl td strong { color: var(--text); }
table.tbl td:first-child { color: var(--text); font-weight: 600; }

/* pills / badges */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700;
  line-height: 1.5; white-space: nowrap; }
.pill.p-blue { background: color-mix(in srgb, var(--ms-blue) 16%, transparent); color: var(--ms-blue); }
.pill.p-green { background: color-mix(in srgb, var(--ms-green) 16%, transparent); color: var(--ms-green); }
.pill.p-amber { background: color-mix(in srgb, var(--ms-amber) 22%, transparent); color: #8a6100; }
.pill.p-red { background: color-mix(in srgb, var(--ms-red) 16%, transparent); color: var(--ms-red); }
.pill.p-purple { background: color-mix(in srgb, var(--ms-purple) 16%, transparent); color: var(--ms-purple); }
.pill.p-gray { background: var(--surface-3); color: var(--text-muted); }
html[data-theme="dark"] .pill.p-amber { color: var(--ms-amber); }
html[data-theme="dark"] .pill.p-purple { color: #c79bf0; }

/* ===================== Mermaid ===================== */
.mermaid-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin: 20px 0; box-shadow: var(--shadow-sm); overflow-x: auto; text-align: center; }
.mermaid-wrap .mm-cap { font-size: .82rem; color: var(--text-muted); margin-top: 8px; font-style: italic; }
.mermaid { display: flex; justify-content: center; }

/* code blocks */
pre.code { background: #1b2030; color: #e6edf3; border-radius: var(--radius-sm); padding: 14px 16px;
  overflow-x: auto; font-family: var(--mono); font-size: .85rem; line-height: 1.55; border: 1px solid #2a3142; margin: 16px 0; }
pre.code code { background: none; color: inherit; padding: 0; }
pre.code .cm { color: #7d8aa3; }
pre.code .kw { color: #79c0ff; }
pre.code .st { color: #a5d6a7; }

/* key-term definition list */
dl.terms { margin: 16px 0; }
dl.terms dt { font-weight: 700; color: var(--text); margin-top: 12px; }
dl.terms dd { margin: 2px 0 0; color: var(--text-soft); }

/* steps */
ol.steps { counter-reset: step; list-style: none; padding-left: 0; }
ol.steps > li { position: relative; padding-left: 44px; margin: 14px 0; }
ol.steps > li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: -2px;
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent, var(--ms-blue)); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .9rem; }

/* ===================== Footer ===================== */
.site-footer { border-top: 1px solid var(--border); background: var(--surface);
  padding: 40px 24px 30px; margin-top: 40px; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 30px 44px; }
.footer-col { flex: 1 1 200px; min-width: 0; }
.footer-col-author { flex: 2.2 1 320px; }
.footer-inner h5 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin: 0 0 12px; }
.maintainer-badge { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--ms-green);
  background: color-mix(in srgb, var(--ms-green) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--ms-green) 38%, transparent);
  padding: 3px 10px; border-radius: 999px; margin-bottom: 7px; }
.contrib-note { margin-top: 12px; font-size: .86rem; color: var(--text-muted); line-height: 1.5; }
.contrib-note strong { color: var(--text-soft); }
.footer-inner a { color: var(--text-soft); display: block; padding: 3px 0; font-size: .92rem; }
.footer-inner a:hover { color: var(--ms-blue); }
.author-card { display: flex; gap: 14px; align-items: center; }
.author-card > img { width: 60px; height: 60px; border-radius: 50%; border: 2px solid var(--ms-blue); object-fit: cover; }
.author-card .ac-name { font-weight: 700; color: var(--text); }
.author-card .ac-role { font-size: .85rem; color: var(--text-muted); }
.author-links { display: flex; gap: 8px; margin-top: 10px; }
.author-links a { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600;
  padding: 6px 11px; border-radius: 8px; border: 1px solid var(--border); }
.author-links a:hover { background: var(--surface-3); }
.author-links a svg { width: 16px; height: 16px; flex: none; }
.author-links a img { width: 16px; height: 16px; flex: none; }
.star-cta { background: color-mix(in srgb, var(--ms-amber) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ms-amber) 40%, var(--border));
  border-radius: var(--radius); padding: 14px 16px; margin-top: 6px; font-size: .9rem; color: var(--text-soft); }
.footer-bottom { max-width: var(--maxw); margin: 28px auto 0; padding-top: 18px; border-top: 1px solid var(--border);
  font-size: .82rem; color: var(--text-muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* prev / next */
.pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 46px; flex-wrap: wrap; }
.pager a { flex: 1 1 240px; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px;
  background: var(--surface); box-shadow: var(--shadow-sm); transition: .15s; }
.pager a:hover { border-color: var(--ms-blue); text-decoration: none; box-shadow: var(--shadow-md); }
.pager .pg-dir { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.pager .pg-title { font-weight: 600; color: var(--text); }
.pager a.next { text-align: right; }

/* misc */
.lead { font-size: 1.08rem; color: var(--text-soft); }
.divider { height: 1px; background: var(--border); margin: 30px 0; border: 0; }
.back-top { position: fixed; right: 22px; bottom: 22px; z-index: 60; opacity: 0; pointer-events: none; transition: .25s; }
.back-top.show { opacity: 1; pointer-events: auto; }

.stat-grid { display: flex; flex-wrap: wrap; gap: 16px; margin: 20px 0; }
.stat { flex: 1 1 200px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: center; box-shadow: var(--shadow-sm); }
.stat .s-num { font-size: 1.8rem; font-weight: 800; color: var(--accent, var(--ms-blue)); line-height: 1; }
.stat .s-lbl { font-size: .82rem; color: var(--text-muted); margin-top: 6px; }

/* ===================== Responsive ===================== */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .toc { display: none; }
  /* Author spans the full row; the two link columns pair up side-by-side below */
  .footer-col-author { flex-basis: 100%; }
  /* Collapse the nav into a dropdown before the tabs would wrap to two lines */
  .top-nav { position: fixed; top: var(--header-h); left: 0; right: 0; flex-direction: column;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 14px;
    transform: translateY(-140%); transition: .25s; box-shadow: var(--shadow-md); }
  .top-nav.open { transform: translateY(0); }
  .nav-toggle { display: inline-flex; }
}
@media (max-width: 760px) {
  .hero { padding: 36px 24px; }
  .hero h1 { font-size: 1.9rem; }
  .brand .brand-full { display: none; }
  .ghub-link span { display: none; }
}

@media print {
  .site-header, .toc, .site-footer, .back-top, .pager { display: none; }
  .layout { grid-template-columns: 1fr; }
  body { background: #fff; }
}
