/* Principles of Data Engineering: branding and components.
   The kit provides tokens.css and base.css; everything here is this site's. */

:root {
  --pd-ink: #092858;          /* navy: the site's text and structure */
  --pd-ink-2: #2D4366;        /* secondary text */
  --pd-muted: #4E6180;        /* labels */
  --pd-link: #1F5A5E;         /* teal links */
  --pd-link-hover: #0E3B3E;
  --pd-panel: #DCE6EE;        /* blue-grey panel */
  --pd-rule: #D9DDE2;
  --pd-rule-soft: #E3E6EA;
  --pd-code-bg: #F5F6F8;
  --pd-serif: "Source Serif 4", Georgia, serif;
  --pd-book: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --pd-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pd-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --pd-max: 1360px;
}

body {
  background: #FFFFFF;
  color: var(--pd-ink);
  font-family: var(--pd-sans);
}

html { scroll-behavior: smooth; }
body { margin: 0; line-height: 1.55; overflow-x: clip; }

a { color: var(--pd-link); text-decoration: none; }
a:hover { color: var(--pd-link-hover); text-decoration: underline; }

.pd-label {
  font-family: var(--pd-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pd-muted);
}

/* ---------- Header and footer ---------- */

.pd-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--pd-rule);
}
.pd-header-inner {
  max-width: var(--pd-max);
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}
.pd-brand {
  font-family: var(--pd-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--pd-ink);
}
.pd-brand:hover { color: var(--pd-ink); text-decoration: none; }
.pd-nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 24px; font-size: 14px; font-weight: 500; }
.pd-nav a { color: var(--pd-ink); }
.pd-nav a[aria-current="page"] { border-bottom: 1px solid var(--pd-ink); padding-bottom: 2px; }

.pd-footer { border-top: 1px solid var(--pd-rule); margin-top: 48px; }
.pd-footer-inner {
  max-width: var(--pd-max);
  margin: 0 auto;
  padding: 24px 32px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  font-family: var(--pd-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pd-muted);
}

/* ---------- Chapter layout ---------- */

.pd-chapter-layout {
  max-width: var(--pd-max);
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: flex-start;
  gap: 56px;
}

.pd-contents {
  flex: 0 0 260px;
  align-self: stretch;
  background: var(--pd-panel);
  padding: 40px 24px;
  font-size: 13.5px;
  line-height: 1.45;
}
.pd-contents > .pd-label { margin-bottom: 18px; }
.pd-contents-part { border-top: 1px solid rgba(9, 40, 88, 0.25); padding: 14px 0; }
.pd-contents-part-title { margin-bottom: 8px; }
.pd-contents-part-title.is-current { color: var(--pd-ink); font-weight: 500; }
.pd-contents ul, .pd-onpage ul, .pd-contents-mobile ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pd-contents a { color: var(--pd-ink-2); }
.pd-contents a[aria-current="page"] {
  color: var(--pd-ink);
  font-weight: 600;
  display: block;
  background: #FFFFFF;
  border-left: 2px solid var(--pd-ink);
  margin-left: -12px;
  padding: 2px 8px 2px 10px;
}

.pd-chapter { flex: 1 1 560px; min-width: 0; max-width: 690px; padding: 56px 0 72px; }

.pd-kicker {
  font-family: var(--pd-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pd-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.pd-kicker-sep { color: #A8BCD9; }
.pd-chapter-title {
  font-family: var(--pd-serif);
  font-weight: 600;
  font-size: 46px;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 18px 0;
}
.pd-lede {
  font-family: var(--pd-serif);
  font-style: italic;
  font-size: 22px;
  line-height: 1.45;
  color: var(--pd-ink-2);
  margin: 0 0 32px;
}
.pd-rule { height: 1px; background: var(--pd-ink); margin-bottom: 36px; }

.pd-onpage { flex: 0 0 200px; position: sticky; top: 88px; padding: 64px 0; font-size: 13px; line-height: 1.5; }
.pd-onpage > .pd-label { margin-bottom: 12px; }
.pd-onpage ul { border-left: 1px solid var(--pd-rule); padding-left: 14px; gap: 8px; }
.pd-onpage a { color: var(--pd-ink-2); }
.pd-onpage-meta { margin-top: 32px; padding-top: 14px; border-top: 1px solid var(--pd-rule); }

.pd-contents-mobile { display: none; }

.pd-pager {
  margin-top: 64px;
  border-top: 1px solid var(--pd-rule);
  padding-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}
.pd-pager a { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; color: var(--pd-ink); }
.pd-pager-next { text-align: right; margin-left: auto; }
.pd-pager-title { font-family: var(--pd-serif); font-size: 18px; }

@media (max-width: 1100px) {
  .pd-onpage { display: none; }
}
@media (max-width: 900px) {
  .pd-chapter-layout { padding: 0 20px; display: block; }
  .pd-contents { display: none; }
  .pd-chapter { padding-top: 24px; }
  .pd-chapter-title { font-size: 34px; }
  .pd-contents-mobile {
    display: block;
    border-top: 1px solid var(--pd-rule);
    border-bottom: 1px solid var(--pd-rule);
    margin-bottom: 32px;
    font-size: 15px;
  }
  .pd-contents-mobile summary { padding: 14px 0; cursor: pointer; font-family: var(--pd-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
  .pd-contents-mobile .pd-label { margin: 14px 0 6px; }
  .pd-contents-mobile ul { padding-bottom: 8px; }
  .pd-contents-mobile a[aria-current="page"] { font-weight: 600; color: var(--pd-ink); }
}

/* ---------- Book prose ---------- */

.pd-prose {
  font-family: var(--pd-book);
  font-size: 18px;
  line-height: 1.8;
  letter-spacing: 0.01em;
  color: var(--pd-ink);
}
.pd-prose p, .pd-prose ul, .pd-prose ol { margin: 0 0 1.1em; }
.pd-prose ul, .pd-prose ol { padding-left: 1.3em; }
.pd-prose li { margin: 0.25em 0; }
.pd-prose h2, .pd-prose h3, .pd-prose h4 {
  font-family: var(--pd-serif);
  font-weight: 600;
  color: var(--pd-ink);
  letter-spacing: -0.01em;
  scroll-margin-top: 88px;
}
.pd-prose h2 { font-size: 28px; line-height: 1.2; margin: 2.2em 0 0.6em; }
.pd-prose h2:first-child { margin-top: 0; }
.pd-prose h3 { font-size: 22px; line-height: 1.25; margin: 1.8em 0 0.5em; }
.pd-prose h4 { font-size: 18px; margin: 1.5em 0 0.4em; }
.pd-prose blockquote {
  margin: 1.6em 0;
  padding: 2px 0 2px 24px;
  border-left: 1px solid var(--pd-ink);
  font-size: 20px;
  line-height: 1.55;
}
.pd-prose blockquote p:last-child { margin-bottom: 0; }
.pd-prose blockquote.pd-note {
  margin: 2em 0;
  padding: 20px 24px;
  border-left: 3px solid var(--pd-ink);
  background: #F3F6F9;
  font-size: 18px;
}
.pd-figure { margin: 1.8em 0; overflow-x: auto; }
.pd-figure svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.pd-prose code {
  font-family: var(--pd-mono);
  font-size: 0.85em;
  letter-spacing: 0;
  background: var(--pd-code-bg);
  padding: 0.08em 0.3em;
}
.pd-prose pre {
  margin: 1.4em 0 1.8em;
  padding: 16px 20px;
  background: var(--pd-code-bg);
  border: 1px solid var(--pd-rule-soft);
  overflow-x: auto;
  line-height: 1.6;
}
.pd-prose pre code { background: none; padding: 0; font-size: 14px; }
.pd-prose hr { border: 0; border-top: 1px solid var(--pd-rule); margin: 2.4em 0; }
.pd-prose img, .pd-prose svg { max-width: 100%; height: auto; }

.table-wrap { overflow-x: auto; margin: 1.6em 0 2em; }
.pd-prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--pd-sans);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
  border-top: 1.5px solid var(--pd-ink);
  border-bottom: 1.5px solid var(--pd-ink);
}
.pd-prose th { text-align: left; font-weight: 600; padding: 10px 16px 10px 0; border-bottom: 1px solid var(--pd-ink); }
.pd-prose td { padding: 10px 16px 10px 0; border-bottom: 1px solid var(--pd-rule-soft); color: var(--pd-ink-2); vertical-align: top; }
.pd-prose tr:last-child td { border-bottom: 0; }

/* ---------- Landing pages ---------- */

.pd-wrap { max-width: 1280px; margin: 0 auto; padding: 0 40px; }
.pd-section { padding: 72px 0; border-bottom: 1px solid var(--pd-rule); }
.pd-split { display: flex; flex-wrap: wrap; gap: 32px 64px; }
.pd-split > .pd-label { flex: 1 1 240px; }
.pd-split > .pd-split-body { flex: 3 1 560px; min-width: 0; }

.pd-hero { padding: 112px 0 72px; position: relative; }
.pd-hero h1 {
  font-family: var(--pd-serif);
  font-weight: 600;
  font-size: clamp(44px, 7vw, 88px);
  line-height: 1.03;
  letter-spacing: -0.03em;
  margin: 24px 0 0;
  max-width: 980px;
}
.pd-hero .pd-rule { margin: 48px 0 56px; max-width: 760px; height: 1.5px; }
.pd-manifesto { font-family: var(--pd-book); font-size: 21px; line-height: 1.65; max-width: 720px; }
.pd-manifesto p { margin: 0 0 26px; }
.pd-questions { font-style: italic; display: flex; flex-direction: column; gap: 6px; margin: 0 0 36px; }
.pd-questions p { margin: 0; }
.pd-price { list-style: none; margin: 0 0 26px; padding: 0 0 0 22px; border-left: 1px solid var(--pd-ink); display: flex; flex-direction: column; gap: 12px; }
.pd-definition { font-family: var(--pd-serif); font-weight: 600; font-size: clamp(23px, 2.6vw, 30px); line-height: 1.25; letter-spacing: -0.01em; margin: 0 0 22px; }

.pd-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); border-top: 1.5px solid var(--pd-ink); }
.pd-card { display: block; padding: 28px 24px 32px; border-bottom: 1px solid var(--pd-rule); border-right: 1px solid var(--pd-rule); color: var(--pd-ink); }
.pd-card:last-child { border-right: 0; }
.pd-card:hover { text-decoration: none; background: #FAFBFC; }
.pd-card h3 { font-family: var(--pd-serif); font-size: 24px; font-weight: 600; line-height: 1.2; margin: 14px 0 10px; }
.pd-card p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--pd-ink-2); }

.pd-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 22px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid var(--pd-ink);
  color: var(--pd-ink);
  background: #FFFFFF;
  font-family: var(--pd-sans);
}
.pd-button:hover { text-decoration: none; color: var(--pd-ink); background: #F3F6F9; }
.pd-button-solid { background: var(--pd-ink); color: #FFFFFF; }
.pd-button-solid:hover { background: #0E3570; color: #FFFFFF; }

/* Book page */
.pd-opening { padding: 48px 0 0; }
.pd-opening a { font-family: var(--pd-serif); font-size: clamp(21px, 2.2vw, 26px); font-weight: 600; color: var(--pd-ink); }
.pd-heart { color: #C9162F; }
.pd-landing { padding: 56px 0 96px; }
.pd-landing .pd-prose { max-width: 760px; }
.pd-cta { margin: 28px 0 0; }
.pd-book-hero { padding: 96px 0 72px; border-bottom: 1.5px solid var(--pd-ink); }
.pd-book-hero h1 { font-family: var(--pd-serif); font-weight: 600; font-size: clamp(42px, 5.5vw, 68px); line-height: 1.04; letter-spacing: -0.025em; margin: 20px 0 24px; }
.pd-book-sub { font-family: var(--pd-serif); font-style: italic; font-size: 24px; line-height: 1.45; color: var(--pd-ink-2); margin: 0 0 32px; max-width: 620px; }
.pd-book-intro { font-family: var(--pd-book); font-size: 19px; line-height: 1.75; max-width: 620px; }
.pd-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.pd-book-contents { background: var(--pd-panel); padding: 32px; align-self: flex-start; }
.pd-book-contents .pd-part { border-top: 1px solid rgba(9, 40, 88, 0.3); padding: 12px 0; }
.pd-book-contents .pd-part:first-of-type { border-top-color: var(--pd-ink); }
.pd-book-contents .pd-part a { font-family: var(--pd-serif); font-size: 20px; font-weight: 600; color: var(--pd-ink); }

.pd-carousel-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.pd-carousel-head h2 { font-family: var(--pd-serif); font-size: 36px; font-weight: 600; letter-spacing: -0.01em; margin: 10px 0 0; }
.pd-carousel-controls { display: flex; gap: 12px; }
.pd-carousel-controls button { width: 44px; height: 44px; border: 1px solid var(--pd-ink); background: #FFFFFF; color: var(--pd-ink); font-size: 18px; cursor: pointer; }
.pd-carousel-controls button:last-child { background: var(--pd-ink); color: #FFFFFF; }
.pd-carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, calc((100% - 56px) / 3));
  gap: 28px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  border-top: 1.5px solid var(--pd-ink);
  padding-bottom: 8px;
}
.pd-chapter-card { scroll-snap-align: start; display: flex; flex-direction: column; gap: 14px; min-height: 220px; padding: 28px 0 32px; border-bottom: 1px solid var(--pd-rule); color: var(--pd-ink); }
.pd-chapter-card:hover { text-decoration: none; }
.pd-chapter-card:hover h3 { color: var(--pd-link); }
.pd-chapter-card h3 { font-family: var(--pd-serif); font-size: 28px; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0; }
.pd-chapter-card p { font-family: var(--pd-book); font-style: italic; font-size: 19px; line-height: 1.55; color: var(--pd-ink-2); margin: 0; }

.pd-principles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); column-gap: 32px; border-top: 1.5px solid var(--pd-ink); }
.pd-principles li { padding: 18px 0; border-bottom: 1px solid var(--pd-rule); display: flex; gap: 16px; align-items: baseline; font-family: var(--pd-serif); font-size: 22px; }
.pd-principles li span { font-family: var(--pd-mono); font-size: 12px; color: var(--pd-muted); }

.pd-band { background: var(--pd-panel); margin-top: 72px; padding: 56px 40px 64px; }
.pd-band-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; margin-top: 24px; }
.pd-band-card { background: #FFFFFF; padding: 36px 32px 32px; display: flex; flex-direction: column; gap: 14px; border-top: 3px solid var(--pd-ink); }
.pd-band-card h3 { font-family: var(--pd-serif); font-size: 30px; font-weight: 600; line-height: 1.15; margin: 0; }
.pd-band-card p { font-family: var(--pd-book); font-size: 18px; line-height: 1.6; color: var(--pd-ink-2); margin: 0; flex-grow: 1; }
.pd-band-card .pd-button { align-self: flex-start; }

@media (max-width: 700px) {
  .pd-wrap { padding: 0 20px; }
  .pd-band { padding: 40px 20px 48px; }
  .pd-hero { padding-top: 64px; }
  .pd-card { border-right: 0; padding-left: 0; }
}

/* Landing geometry: fragments of reality, captured. */
.pd-geo { position: absolute; right: 0; top: 96px; pointer-events: none; }
@media (max-width: 1180px) { .pd-geo { display: none; } }

/* Contents listings (/docs/ and part pages) */
.pd-contents-listing { margin-top: 36px; max-width: 820px; }
.pd-contents-listing h2 { margin: 0 0 8px; }
.pd-contents-listing ol { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--pd-ink); }
.pd-contents-listing li a { display: flex; flex-direction: column; gap: 4px; padding: 16px 0; border-bottom: 1px solid var(--pd-rule); color: var(--pd-ink); }
.pd-contents-listing li a:hover { text-decoration: none; }
.pd-contents-listing li a:hover .pd-listing-title { color: var(--pd-link); }
.pd-listing-title { font-family: var(--pd-serif); font-size: 22px; font-weight: 600; }
.pd-listing-lede { font-family: var(--pd-book); font-style: italic; font-size: 17px; color: var(--pd-ink-2); }

/* Code blocks: DAX highlighting and the wrap toggle come from clipboard.js */
.pd-prose code.language-dax .dax-keyword,
.pd-prose code.language-dax .dax-function { color: var(--pd-link); font-weight: 600; }
.pd-prose code.language-dax .dax-comment,
.pd-prose code.language-dax .dax-number { color: var(--pd-muted); }
.pd-prose code.language-dax .dax-string,
.pd-prose code.language-dax .dax-table { color: #8B5B24; }
.pd-prose .book-codeblock-wrap-toggle {
  display: block;
  margin: 1rem 0 -0.9rem auto;
  padding: 2px 9px;
  border: 1px solid #A8BCD9;
  background: #FFFFFF;
  color: var(--pd-ink-2);
  font-family: var(--pd-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.pd-prose .book-codeblock-with-toggle.is-wrapped,
.pd-prose .book-codeblock-with-toggle.is-wrapped code { white-space: pre-wrap; overflow-wrap: anywhere; }

h1, h2, h3, h4 { color: var(--pd-ink); }

/* Search */
.pd-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.pd-search-form { margin-left: auto; }
.pd-search-form + .pd-nav { margin-left: 0; }
.pd-search-form input {
  width: 220px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #C5D0DC;
  background: #FFFFFF;
  color: var(--pd-ink);
  font: 14px var(--pd-sans);
}
.pd-search-form input:focus, .pd-search-big input:focus { outline: 2px solid var(--pd-link); outline-offset: 1px; border-color: var(--pd-ink); }
.pd-search-page { max-width: 820px; }
.pd-search-big { margin: 16px 0 12px; }
.pd-search-big input {
  width: 100%;
  box-sizing: border-box;
  min-height: 56px;
  padding: 0 16px;
  border: 1px solid var(--pd-ink);
  font: 20px var(--pd-serif);
  color: var(--pd-ink);
}
.pd-search-status { font-size: 14px; color: var(--pd-muted); min-height: 1.5em; }
.pd-search-results { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1.5px solid var(--pd-ink); }
.pd-search-results a { display: flex; flex-direction: column; gap: 6px; padding: 18px 0; border-bottom: 1px solid var(--pd-rule); color: var(--pd-ink); }
.pd-search-results a:hover { text-decoration: none; }
.pd-search-results a:hover .pd-search-title { color: var(--pd-link); }
.pd-search-title { font-family: var(--pd-serif); font-size: 22px; font-weight: 600; }
.pd-search-excerpt { font-family: var(--pd-book); font-size: 16px; line-height: 1.6; color: var(--pd-ink-2); }
.pd-search-excerpt mark { background: var(--pd-panel); color: var(--pd-ink); padding: 0 2px; }
@media (max-width: 700px) {
  .pd-search-form { order: 3; width: 100%; margin-left: 0; }
  .pd-nav { width: 100%; justify-content: space-between; gap: 8px 12px; font-size: 13px; }
  .pd-search-form input { width: 100%; box-sizing: border-box; }
}
