@font-face {
  font-family: "CMM Coda";
  src: url("../fonts/CMMCodaNormalizedUnlicensedTrial-Proportional.otf")
    format("opentype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  ascent-override: 70%;
  descent-override: 0%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Fabio XM";
  src: url("../fonts/FabioXM-Regular.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== RAW COLOR TOKENS ===== */
:root {
  --orange: #ea5b0c;
  --red: #c90c0f;
  --magenta: #b82585;
  --black: #000000;
  --white: #ffffff;
  --orange-lm: color-mix(in srgb, var(--orange) 55%, var(--black));
  --orange-dm: color-mix(in srgb, var(--orange) 25%, var(--white));
  --red-lm: color-mix(in srgb, var(--red) 45%, var(--black));
  --red-dm: color-mix(in srgb, var(--red) 20%, var(--white));
  --magenta-lm: color-mix(in srgb, var(--magenta) 50%, var(--black));
  --magenta-dm: color-mix(in srgb, var(--magenta) 20%, var(--white));
  /* Dynamic accent color (set by JS on page load) */
  --accent-base: var(--magenta);
  --accent-lm: color-mix(in srgb, var(--accent-base) 40%, var(--black));
  --accent-dm: color-mix(in srgb, var(--accent-base) 20%, var(--white));
}

/* ===== SEMANTIC COLOR VARIABLES (Light Mode) ===== */
:root {
  --text: var(--black);
  --background: var(--white);
  --accent: var(--accent-lm);
  --border: color-mix(in srgb, var(--accent) 50%, transparent);
  --accent-text: var(--white);
  --sidebar-accent: var(--accent-lm);
  --sidebar-accent-text: var(--white);
  --sidebar-accent-contrast: var(--white);
  --secondary-1: var(--orange-lm);
  --secondary-2: var(--red-lm);
  --secondary-3: var(--magenta-lm);
}

/* ===== SEMANTIC COLOR VARIABLES (Dark Mode) ===== */
[data-theme="dark"] {
  --text: var(--white);
  --background: var(--black);
  --accent: var(--accent-dm);
  --border: color-mix(in srgb, var(--accent) 50%, transparent);
  --accent-text: var(--black);
  --sidebar-accent: var(--accent-dm);
  --sidebar-accent-text: var(--black);
  --sidebar-accent-contrast: var(--black);
  --secondary-1: var(--orange-dm);
  --secondary-2: var(--red-dm);
  --secondary-3: var(--magenta-dm);
}

/* ===== GRADIENTS ===== */
:root {
  --gradient-orange: linear-gradient(
    to left,
    var(--orange),
    color-mix(in srgb, var(--orange), transparent 100%)
  );
  --gradient-red: linear-gradient(
    to left,
    var(--red),
    color-mix(in srgb, var(--red), transparent 100%)
  );
  --gradient-magenta: linear-gradient(
    to left,
    var(--magenta),
    color-mix(in srgb, var(--magenta), transparent 100%)
  );
}

/* ===== TYPOGRAPHY ===== */
:root {
  --h1-size: 2.3rem;
  --h2-size: 1.575rem;
  --h3-size: 1.3rem;
  --h4-size: 0.95rem;
  --h5-size: 0.85rem;
  --body-size: 1rem;
  --padding: 2.222rem;
  --border-size: 1px;
  --border-radius: 4px;
  --font-heading: "CMM Coda", monospace;
  --font-body: "Fabio XM", sans-serif;
  --sidebar-width: 270px;
}

/* ===== BASE STYLES ===== */
html {
  color: var(--text);
  background: var(--background);
  overflow-x: clip;
}

h1,
h2,
h3,
h4,
h5 {
  line-height: 1.2 !important;
}

h1 {
  font: normal var(--h1-size) var(--font-heading);
  margin-bottom: 0.5rem;
}

h2 {
  font: normal var(--h2-size) var(--font-heading);
}

h3 {
  font: normal var(--h3-size) var(--font-heading);
}

h4 {
  font: normal var(--h4-size) var(--font-heading);
}

h5 {
  font: normal var(--h5-size) var(--font-body);
  text-transform: uppercase;
}

img {
  width: 100%;
  border-radius: var(--border-radius);
}

body {
  font: 300 var(--body-size)/1.5 var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Fixed background gradient that stays in place while scrolling */
.background-gradient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: linear-gradient(
    to bottom,
    var(--background),
    color-mix(in srgb, var(--accent-base) 20%, var(--background))
  );
  z-index: 0;
  pointer-events: none;
}

.sidebar-heading {
  margin-bottom: 0.3rem;
}

li {
  list-style: none;
}

a {
  color: currentColor;
  text-decoration: none;
}

button {
  font: inherit;
  background: none;
  border: 0;
  color: currentColor;
  cursor: pointer;
}

header h1 {
  line-height: 1.5 !important;
  margin-bottom: 1.5rem;
}

.color-grey {
  color: var(--text-grey);
}

.logo {
  padding: 1rem;
  display: flex;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
}

.menu {
  display: flex;
  gap: 0.5rem;
}

.menu-item {
  text-align: center;
  padding: 0.4rem 0;
  text-transform: uppercase;
  border: solid var(--border-size) var(--border);
  border-radius: var(--border-radius);
}

.menu-item:hover {
  color: var(--accent-text);
  background: var(--sidebar-accent);
}

[data-theme="dark"] .menu-item:hover {
  color: var(--accent-text);
}

.menu-item[aria-current] {
  color: var(--accent-text);
  background-color: var(--accent);
}

.layout-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) 2fr;
  gap: var(--padding);
  align-items: start;
  padding: var(--padding) var(--padding) 0 var(--padding);
  flex: 1;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}

/* ===== MAIN CONTENT ===== */
.main {
  position: relative;
  min-width: 0; /* Allow grid children to shrink and enable overflow scroll */
}

/* Page header - uniform spacing after headline */
/* ===== SITE TOGGLES (Top Right Dropdowns) ===== */
.site-toggles {
  position: absolute;
  top: var(--padding);
  right: var(--padding);
  display: flex;
  gap: 0.5rem;
  z-index: 100;
}

.site-dropdown {
  position: relative;
}

.site-toggle-btn {
  padding: 0.4rem 0.5rem;
  border-radius: var(--border-radius);
  border: var(--border-size) solid var(--border);
  background: var(--background);
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-heading);
  font-size: var(--h5-size);
}

.site-toggle-btn:hover {
  color: var(--accent-text);
  background: var(--accent);
}

.site-toggle-btn[aria-expanded="true"] {
  background: var(--accent);
  color: var(--accent-text);
}

.site-toggle-btn[aria-expanded="true"] .theme-icon {
  border-color: var(--accent-text);
}

.site-toggle-btn[aria-expanded="true"] .theme-icon::after {
  background: var(--accent-text);
}

/* Theme icon (half-moon) */

.site-toggle-btn.site-toggle-theme {
  padding: 0.5rem;
}

.theme-icon {
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--accent);
  border-radius: 50%;
  position: relative;
  overflow: hidden;
}

.theme-icon::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background: var(--accent);
}

.site-toggle-btn:hover .theme-icon {
  border-color: var(--accent-text);
}

.site-toggle-btn:hover .theme-icon::after {
  background: var(--accent-text);
}

/* Dropdown menu */
.site-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  border-radius: var(--border-radius);
  border: var(--border-size) solid var(--border);
  background: var(--background);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.5rem);
}

.site-dropdown[data-open="true"] .site-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  overflow: hidden;
}

.site-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  /* border-radius: var(--border-radius); */
  background: transparent;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: var(--h5-size);
  text-decoration: none;
  cursor: pointer;
}

/* .site-dropdown-item:hover {
  background: color-mix(in srgb, var(--accent) 100%, transparent);
} */

.site-dropdown-item.is-active {
  color: var(--accent-text);
  background: var(--accent);
}

.site-dropdown-divider {
  height: 1px;
  /* margin: 0.4rem 0; */
  border: none;
  background: var(--border);
}

/* Accent color dot */
.accent-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--dot-color);
  flex-shrink: 0;
}

/* Border radius slider */
.border-radius-slider {
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.75rem 0.1rem 0.75rem;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.border-radius-slider::-webkit-slider-runnable-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  border: none;
}

.border-radius-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  margin-top: -4.5px;
}

.border-radius-slider::-moz-range-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  border: none;
}

.border-radius-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

/* ===== BLOCK CONTENT TYPOGRAPHY ===== */
.text {
  line-height: 1.6;
}

.text > *:not(.feature-cards-grid):not(.gallery):not(.video-player) {
  max-width: 40rem;
}

.text > :first-child:not(h1) {
  margin-top: 0;
}

.text > :last-child {
  margin-bottom: 0;
}

/* Paragraph and list spacing */
.text p,
.text ul,
.text ol {
  margin-bottom: 1.5rem;
}

/* Nested lists */
.text ul p,
.text ol p {
  margin-bottom: 0;
}

/* List styling */
.text ul,
.text ol {
  margin-left: 1.5rem;
}

.text ul > li {
  list-style: disc;
  margin-bottom: 0.5rem;
}

.text ol > li {
  list-style: decimal;
  margin-bottom: 0.5rem;
}

.text ul ol,
.text ul ul,
.text ol ul,
.text ol ol {
  margin-bottom: 0;
  margin-top: 0.5rem;
}

/* Heading hierarchy */
.text h1 {
  font-size: var(--h1-size);
  margin-top: 2.5rem;
  line-height: 1.2;
}

/* Prevent margin collapse when h1 is first child of a text block */
div.text > h1:first-child {
  /* padding-top: 2.5rem; */
  margin-top: 0;
}

.text h2 {
  font-size: var(--h2-size);
  margin-top: 2rem;
  margin-bottom: 0.6rem;
}

.text > h2:first-child {
  margin-top: 0;
}

.text h3 {
  font-size: var(--h3-size);
  margin-top: 1.35rem;
  margin-bottom: 0.7rem;
  font-weight: normal;
}

/* Blockquote styling */
.text blockquote {
  font-size: 1.25rem;
  line-height: 1.4;
  border-left: var(--border-size) solid var(--border);
  padding-left: 1.5rem;
  margin: 3rem 0;
  font-style: italic;
  max-width: 35rem;
}

.text blockquote footer {
  font-size: 0.875rem;
  font-style: normal;
  margin-top: 1rem;
  color: var(--text);
  opacity: 0.7;
}

/* Code block styling */
.text .codeblock {
  display: grid;
}

.text code {
  font-family: var(--font-heading);
  font-size: 0.9em;
  background: var(--accent);
  color: var(--accent-text);
  padding: 0.1rem 0.4rem;
  border-radius: var(--border-radius);
}

.text pre {
  margin: 3rem 0;
  background: var(--text);
  color: var(--background);
  padding: 1.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  line-height: 1.5;
  border-radius: var(--border-radius);
}

.text pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: 0.85rem;
}

/* Figure and image styling */
.text figure {
  margin: 3rem 0;
}

.text figure a {
  display: flex;
}

.text figcaption {
  padding-top: 0.75rem;
  font-size: 0.875rem;
  opacity: 0.7;
}

.text figure ul {
  line-height: 0;
  display: grid;
  gap: 1.5rem;
  margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}

.text figure ul li {
  list-style: none;
}

/* Style links in article text blocks as link-buttons, excluding image links inside <figure> */
article .text a:not(figure a), .feature-card-text a {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: var(--h4-size);
  padding: 0.3rem 0.5rem;
  border: var(--border-size) solid var(--border);
  border-radius: var(--border-radius);
  line-height: 1.2;
  margin: 0.25rem 0.25rem 0.25rem 0;
  text-decoration: none;
}

article .text a:not(figure a):hover, .feature-card-text a:hover {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

article .text p a:not(figure a) {
  margin: 0;
}

/* Tighten spacing for paragraphs containing only links */
article .text p:has(> a):not(:has(> :not(a))) {
  margin-bottom: 0.2rem;
}

.image-source {
  position: absolute;
  bottom: 0;
  right: 0;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  color: var(--accent-text);
  background: var(--accent);
  padding: 0.4rem 0.7rem;
  line-height: 1;
  z-index: 1;
  pointer-events: auto;
  border: var(--border-size) solid var(--border);
  border-radius: var(--border-radius) 0 var(--border-radius) 0;
}

.image-source a {
  text-decoration: none;
}

.basicLightbox .image-source {
  position: fixed;
  bottom: 0;
  right: 0;
}

/* Horizontal rule */
.text hr {
  margin: 4rem 0;
  border: none;
  border-top: var(--border-size) solid var(--border);
}

/* Definition lists */
.text dt {
  font-weight: 600;
  margin-top: 1rem;
}

.text dd {
  margin-left: 1.5rem;
}

.chip {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: var(--h5-size);
  padding: 0.25rem 0.4rem;
  border: var(--border-size) solid var(--border);
  border-radius: var(--border-radius);
  color: var(--text);
  width: fit-content;
  line-height: 1rem;
}

.curriculum-course-title {
  font-family: var(--font-heading);
}

/* Hover card pattern: accent background with inverted chip */
.hover-card:hover {
  background: var(--accent);
  color: var(--accent-text);
}

.hover-card:hover .chip {
  color: var(--accent);
  background: var(--accent-text);
}

/* ===== FOOTER ===== */
.footer {
  position: relative;
  z-index: 1;
  margin-top: 4rem;
  padding: var(--padding);
  background-color: var(--background);
  font-family: var(--font-heading);
  border-top: var(--border-size) solid var(--border);
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 2rem;
  align-items: start;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.footer-logos {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}

.footer-logos svg {
  width: auto;
  height: 50px;
}

[data-theme="dark"] .footer-logos svg path {
  fill: var(--white);
}

.footer-address {
  font-style: normal;
  line-height: 1.5;
}

.footer-links {
  display: flex;
  gap: 3rem;
  justify-content: center;
}

.footer-column ul {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.footer-heading {
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.footer-right {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.footer-cta {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem 0.7rem;
  border: var(--border-size) solid var(--accent);
  border-radius: var(--border-radius);
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
}

.footer-cta:hover {
  background-color: var(--accent);
  color: var(--background);
}

.footer-contact {
  font-style: normal;
  text-align: right;
  line-height: 1.5;
}

/* ===== MENU TOGGLE (hidden on desktop, shown on mobile) ===== */
.site-toggle-menu {
  display: none;
  font-size: var(--h5-size);
}

/* ===== FOOTER TOGGLES (hidden on desktop, shown on mobile) ===== */
.footer-toggles {
  display: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .layout-grid {
    padding: calc(var(--padding) / 2) calc(var(--padding) / 2) 0
      calc(var(--padding) / 2);
    grid-template-columns: 1fr;
  }

  .site-toggle-menu {
    display: flex;
  }

  .footer-content {
    grid-template-columns: 1fr 1fr;
  }

  .site-toggles {
    top: calc(var(--padding) / 2);
    right: calc(var(--padding) / 2);
  }

  .footer {
    padding: calc(var(--padding) / 2);
  }

  .footer-brand {
    order: 0;
  }

  .footer-right {
    display: contents;
  }

  .footer-contact {
    order: 1;
    text-align: left;
  }

  .footer-links {
    order: 2;
    grid-column: 1 / -1;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 2rem;
  }

  .footer-cta {
    order: 3;
    grid-column: 1 / -1;
    width: 100%;
  }

  .footer-toggles {
    display: block;
    order: 0;
    text-align: right;
  }

  .footer-toggles .site-toggles {
    position: static;
    justify-content: flex-end;
  }

  .footer-toggles .site-toggle-menu {
    display: none;
  }

  .layout-grid > .site-toggles > .site-dropdown {
    display: none;
  }
}

/* ===== PORTRAIT ===== */
.report-cover {
  display: block;
  width: 100%;
  overflow: hidden;
  margin-top: 5rem;
  margin-bottom: 1rem;
}

.report-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--border-radius);
  border: solid var(--border-size) var(--border);
}
