/* =========================
   FONT: Source Sans Pro (local + web fallback)
   ========================= */
@font-face {
  font-family: 'Source Sans Pro';
  src: url('fonts/SourceSansPro-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Source Sans Pro';
  src: url('fonts/SourceSansPro-SemiBold.ttf') format('truetype');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Source Sans Pro';
  src: url('fonts/SourceSansPro-Italic.ttf') format('truetype');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Source Sans Pro';
  src: url('fonts/SourceSansPro-SemiBoldItalic.ttf') format('truetype');
  font-weight: 600; font-style: italic; font-display: swap;
}
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600&display=swap');

/* Brand colours */
:root{
  --iab-blue:   #003F7D;
  --iab-petrol: #0C7FA7;
  --iab-ltgrey: #F2F2F2; /* 5% black */
  --iab-mdgrey: #A6A6A6; /* 35% black */
  --iab-subgrey:#D9D9D9; /* 15% black */
}

/* Base typography */
html { font-size: 16px; -webkit-text-size-adjust:100%; text-size-adjust:100%; }
body, .book { font-family:'Source Sans Pro', Arial, sans-serif; font-size:16px; line-height:1.55; color:#000; }

/* Links */
a {
  color: var(--iab-blue);
}

a:hover {
  color: var(--iab-petrol);
}

a:focus,
a:focus-visible {
  color: var(--iab-petrol);
  text-decoration: underline;
  outline: 2px solid var(--iab-petrol);
  outline-offset: 2px;
}
/* Sidebar / TOC */
.book .book-summary,
.book .book-summary .summary,
.book .book-summary .summary li,
.book .book-summary .summary li a{
  font-family:'Source Sans Pro', Arial, sans-serif !important;
  font-size:14px !important; line-height:1.4 !important;
}
.summary li a{ color:#333; font-weight:600; text-decoration:none; }
.summary li a:hover{ color:var(--iab-blue); }
.summary li a:focus,
.summary li a:focus-visible {
  outline: 2px solid var(--iab-blue);
  outline-offset: 2px;
  text-decoration: underline;
}
.summary li.active > a{
  color:#000; background: var(--iab-ltgrey);
  border-left: 4px solid var(--iab-blue);
}

/* Headings */
h1,h2,h3,h4,h5,h6{
  font-family:'Source Sans Pro', Arial, sans-serif;
  font-weight:600; line-height:1.25; color:var(--iab-blue);
  margin-top:1.2em;
}

/* Sizes in rem (~px) — base 16px text */
h1{ font-size:1.6rem; }  
h2{ font-size:1.3rem; } 
h3{ font-size:1.1rem; }   
h4{ font-size:1.00rem; }   /* 16px */

/* --- Force new small headings to match spec --- */
.book .book-body .page-inner h4,
.book .book-body .page-inner h5 {
  font-family: 'Source Sans Pro', Arial, sans-serif !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;
  color: var(--iab-blue) !important;
  margin-top: 1.2em !important;
}

/* Sizes: H4 = 16px, H5 = 16px (body size) */
.book .book-body .page-inner h4 { font-size: 1rem !important; } /* 16px */
.book .book-body .page-inner h5 { font-size: 1rem !important; } /* 16px */

/* Body paragraphs & lists */
.book .book-body .page-inner p,
.section p,
.book .book-body .page-inner ul,
.book .book-body .page-inner ol,
.book .book-body .page-inner dl{
  font-family:'Source Sans Pro', Arial, sans-serif !important;
  font-size:16px; line-height:1.55; color:#000;
  margin: 0 0 0.75rem;
}

/* Code font */
pre, code, kbd, samp{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
p code { white-space: inherit; }
pre     { word-break: normal; word-wrap: normal; }
pre code{ white-space: inherit; }

/* =========================
   TABLES — BRAND STYLE
   ========================= */
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  border-left: none;
  border-right: none;
  font-size: 1rem; /* 16pt for table body */
  color: #000;
}

/* Table captions */
caption, p.caption {
  font-size: 1rem; /* 16pt */
  font-weight: 600;
  text-align: left;
  color: #000;
  margin-bottom: .25rem;
  font-family:'Source Sans Pro', Arial, sans-serif;
}

/* Header look & alignment */
thead th {
  background: var(--iab-ltgrey);
  border-top: 1px solid var(--iab-mdgrey);
  border-bottom: 1px solid var(--iab-mdgrey);
  color: #000;
  font-weight: 600;
  text-align: center;
  padding: .5rem;
}

/* Body cells */
tbody td, tbody th {
  border-bottom: 1px solid var(--iab-mdgrey);
  padding: .45rem .5rem;
}

/* Left category column */
tbody th, tbody td:first-child {
  text-align: left;
}

/* Numeric values (add class="num" in HTML output) */
tbody td.num {
  text-align: right;
}

/* No vertical borders (open left/right) */
table, tr, td, th {
  border-left: none !important;
  border-right: none !important;
}

/* Zebra striping (optional) */
.table-striped tbody tr:nth-child(odd) td {
  background: #f9f9f9;
}

/* Subheading rows */
tr.table-subheading > td {
  background: var(--iab-subgrey);
}

/* Group header rows from kableExtra::group_rows */
tr.group > td {
  background: #e6e6e6;
  border-top: 1px solid var(--iab-mdgrey);
  border-bottom: 1px solid var(--iab-mdgrey);
}

/* Alt text below tables */
.table-alt {
  font-size: 0.667rem; /* 8pt */
  margin-top: .25rem;
  color: #333;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Cover behaviour & hide YAML title block on index */
#header, h1.title, p.author, p.date { display:none !important; }
.book .book-body .page-inner{ padding-top:0; }
.book .book-body .page-inner img{ max-width:100%; height:auto; }
.book .book-body .page-inner div#cover > h1,
.book .book-body .page-inner section#cover > h1,
.book .book-body .page-inner h1#cover{ display:none !important; }
.book .book-body .page-inner div#cover > h1 .anchorjs-link,
.book .book-body .page-inner section#cover > h1 .anchorjs-link,
.book .book-body .page-inner h1#cover .anchorjs-link{ display:none !important; }

/* Ensure GitBook icons render */
.fa, .fa::before, i.fa, span.fa,
.glyphicon, .glyphicon::before,
.book .book-summary .fa, .book .book-summary .fa::before,
.navigation .fa, .navigation .fa::before,
.header-links .fa, .header-links .fa::before {
  font-family:"FontAwesome" !important; font-weight:normal !important; font-style:normal !important;
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
}

/* Keep Share + Font-settings removed (your current toolbar config) */
.book .book-header .btn.share,
.book .book-header .btn.font-settings{ display:none !important; }

.page-break { break-before: page; page-break-before: always; margin-top: 2rem; }
.cover-wrap { margin:0; padding:0; }
.cover-wrap img { width:100%; height:auto; display:block; margin:0; padding:0; }
/* Optional: stretch cover to page-inner edges in GitBook */
.book .book-body .page-inner .cover-wrap { margin-left:-50px; margin-right:-50px; }

/* =========================
   GRAPHICS — GLOBAL CONTAINER STYLES
   ========================= */
.book .book-body .page-inner figure,
.book .book-body .page-inner p > img {
  background: #fff;       /* white background per CD */
  margin: 1rem 0;
}

/* Figure captions (knitr may emit <p class="caption">) */
.book .book-body .page-inner figcaption,
p.caption {
  font-family: 'Source Sans Pro', Arial, sans-serif;
  font-size: 1rem; /* 16px */
  line-height: 1.35;
  color: #000;
  margin-top: 0.35rem;
}

/* Optional padded frame utility if you wrap a plot */
.iab-figure {
  background: #fff;
  padding: 0.5rem 0.5rem 0.75rem;
  border: 1px solid var(--iab-ltgrey);
}

/* Ensure SVG text uses our brand font in HTML */
svg text {
  font-family: 'Source Sans Pro', Arial, sans-serif !important;
  fill: #000;
}

/* Screen-reader only helper (used for HTML alt text if needed) */
.sr-only {
      position: absolute !important;
      width: 1px !important;
      height: 1px !important;
      padding: 0 !important;
      margin: -1px !important;
      overflow: hidden !important;
      clip: rect(0,0,0,0) !important;
      white-space: nowrap !important;
      border: 0 !important;
}

/* =========================
   Compact style for LOF/LOT
   ========================= */
.list-block p {
  margin: 0.2rem 0;   /* small vertical spacing */
  font-size: 0.95rem; /* slightly smaller text (optional) */
  line-height: 1.3;   /* tighter line spacing */
}
.figure-alt {
  font-size: 0.667rem;   /* ~8pt */
  margin-top: 0.25rem;
  color: #333;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* =====================
   BIBLIOGRAPHY (CSL)
   ===================== */

/* Container for reference list */
#refs, .references, .csl-bib-body {
  font-family: 'Source Sans Pro', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: #000;
}

/* Each reference entry */
.csl-entry {
  margin-bottom: 0.35cm;   /* spacing between references */
}

/* Hanging indent: first line flush, subsequent lines indented */
.csl-entry {
  padding-left: 1.5em;
  text-indent: -1.5em;
}

/* Left/right margin spans used by some CSLs */
.csl-left-margin,
.csl-right-inline {
  font-family: 'Source Sans Pro', Arial, sans-serif;
}

.fdz-text {
  margin-top: 1.5em;     /* spacing above */
  text-align: justify;   /* justification */
}

/* Global keyboard focus visibility */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--iab-petrol);
  outline-offset: 2px;
}

.num-marker {
  white-space: nowrap;
}

/* =========================
   Mobile scrolling for wide tables
   ========================= */

/* =========================
   Mobile table behaviour
   ========================= */

@media (max-width: 768px) {

  .table-scroll-mobile {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Table 5.1 */
  .core-datasets-table {
    min-width: 1100px;
  }

  /* Table 5.2 */
  .crosssection-indicators-table {
    min-width: 950px;
  }

  /* Table 5.3 */
  .spell-indicators-table {
    min-width: 850px;
  }
  
  /* Table 6.2 */
  .covid-impact-table {
    min-width: 1050px;
}
/* Table 4.1 */
.thematic-household-table {
  min-width: 980px;
}

/* Table 1.1 */
.pass-complete-table {
  min-width: 950px;
}
}

/* Tight wave-column spacing for thematic tables */
table.tightwaves td:nth-child(n+2),
table.tightwaves th:nth-child(n+2) {
  padding-left: 1.5px !important;
  padding-right: 1.5px !important;
}

/* Optional smaller font for wave columns */
/*
table.tightwaves td:nth-child(n+2),
table.tightwaves th:nth-child(n+2) {
  font-size: 13px;
}
*/

