/*
 * global.css — Shared design tokens, typography, colors, and components
 * used across all pages on the OSI website.
 *
 * Loaded before page-specific stylesheets (e.g. home.css) so that tokens
 * and utility classes are available everywhere.
 */

/* ==========================================================================
   CSS Custom Properties (Design Tokens)
   ========================================================================== */
:root {
  /* Brand blues (from OSI logo) */
  --osi-primary-blue: #0093C7;
  --osi-dark-blue: #004C82;
  --osi-navy: #111827;
  --osi-light-blue: #E0F2FE;
  --osi-ice-blue: #F0F9FF;

  /* Brand green (from OSI logo) */
  --osi-accent-green: #07A77F;
  --osi-light-green: #ECFDF5;

  /* Accent purple (for gradients, borrowed from reference) */
  --osi-accent-purple: #7C3AED;
  --osi-light-purple: #EDE9FE;

  /* Neutrals */
  --osi-white: #FFFFFF;
  --osi-gray-50: #F9FAFB;
  --osi-gray-100: #F3F4F6;
  --osi-gray-200: #E5E7EB;
  --osi-gray-300: #D1D5DB;
  --osi-gray-400: #9CA3AF;
  --osi-gray-500: #6B7280;
  --osi-gray-600: #4B5563;
  --osi-gray-700: #374151;
  --osi-gray-800: #1F2937;
  --osi-gray-900: #111827;

  /* Spacing */
  --osi-spacing-xs: 0.4rem;
  --osi-spacing-sm: 0.8rem;
  --osi-spacing-md: 1.6rem;
  --osi-spacing-lg: 3.2rem;
  --osi-spacing-xl: 4.8rem;

  /* Bootstrap body overrides */
  --bs-body-font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --bs-body-font-weight: 400;
  --bs-body-font-size: 0.85rem;
  --bs-body-line-height: 1.5;

  /* Font scale */
  --osi-font-small: 0.75rem;
  --osi-font-caption: 0.8rem;
  --osi-font-body: 0.85rem;
  --osi-font-lead: 0.875rem;

  /* Heading tokens */
  --osi-font-heading-sm: 0.8rem;
  --osi-font-heading-md: 0.875rem;
  --osi-font-heading-lg: 1rem;
  --osi-font-heading-xl: 1.15rem;

  /* Bootstrap link overrides */
  --bs-link-color: var(--osi-dark-blue);
  --bs-link-color-rgb: 0, 76, 130;
  --bs-link-hover-color: var(--osi-primary-blue);
  --bs-link-decoration: none;
}


/* ==========================================================================
   Material for MkDocs — Custom Palette
   ========================================================================== */

[data-md-color-primary=custom] {
  --md-primary-fg-color:        var(--osi-primary-blue);
  --md-primary-fg-color--light: var(--osi-light-blue);
  --md-primary-fg-color--dark:  var(--osi-dark-blue);
  --md-primary-bg-color:        var(--osi-white);
  --md-primary-bg-color--light: rgba(255, 255, 255, 0.7);
  --md-typeset-a-color:         var(--osi-dark-blue);
}

[data-md-color-accent=custom] {
  --md-accent-fg-color:              var(--osi-primary-blue);
  --md-accent-fg-color--transparent: rgba(0, 147, 199, 0.1);
}


/* ==========================================================================
   Global Link Styles
   ========================================================================== */

a {
  text-decoration: none;
}

.md-typeset a {
  text-decoration: none;
}


/* ==========================================================================
   Heading Overrides
   ========================================================================== */

h1, .h1, .md-typeset h1 {
  font-size: var(--osi-font-heading-xl);
  font-weight: 700;
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 0 0 0.625em;
  color: var(--osi-gray-900);
}

h2, .h2, .md-typeset h2 {
  font-size: var(--osi-font-heading-lg);
  font-weight: 700;
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin: 0.64em 0 0.4em;
  color: var(--osi-gray-900);
}

h3, .h3, .md-typeset h3 {
  font-size: var(--osi-font-heading-md);
  font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.4;
  letter-spacing: -0.01em;
  margin: 0.8em 0 0.4em;
  color: var(--osi-gray-900);
}

h4, .h4, .md-typeset h4 {
  font-size: var(--osi-font-heading-sm);
  font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.4;
  margin: 1em 0;
  color: var(--osi-gray-800);
}

h5, .h5, .md-typeset h5 {
  font-size: 0.875rem;
  font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.4;
  margin: 1.25em 0;
}

h6, .h6, .md-typeset h6 {
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.4;
  margin: 1.25em 0;
}

.lead { font-size: var(--osi-font-lead); }


/* ==========================================================================
   Text Colors
   ========================================================================== */

.osi-text-dark-blue { color: var(--osi-dark-blue); }
.osi-text-dark-gray { color: var(--osi-gray-600); }
.osi-text-gray      { color: var(--osi-gray-500); }
.osi-text-primary   { color: var(--osi-primary-blue); }

/* Gradient text utility */
.osi-text-gradient {
  background: linear-gradient(135deg, var(--osi-primary-blue), var(--osi-accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}


/* ==========================================================================
   Custom Header: single-bar layout (logo | nav links | search)
   ========================================================================== */

.md-header,
.md-header[data-md-state],
.md-header[data-md-state="shadow"] {
  background-color: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid var(--osi-gray-200);
  color: var(--osi-gray-700) !important;
}

.md-header .md-header__button {
  color: var(--osi-gray-700);
}

/* Compact header height */
.md-header[data-md-component="header"] {
  font-size: 0.8rem;
}

.md-header .md-logo img,
.md-header .md-logo svg {
  height: 1.2rem;
  width: auto;
}

.md-tabs {
  display: none;
}

.md-header__inner {
  display: flex;
  align-items: center;
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}

.md-header__left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.md-header__center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.md-header__right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.md-header__nav {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1.5rem;
}

.md-header__nav-link {
  color: var(--osi-gray-700);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0;
  transition: color 0.15s;
}

.md-header__nav-link:hover {
  color: var(--osi-primary-blue);
}

.osi-external-icon {
  width: 0.65em;
  height: 0.65em;
  margin-left: 0.25em;
  vertical-align: baseline;
  position: relative;
  top: -0.05em;
}

.md-post--external .md-post__content > h2 a::after,
.md-post--external .md-post__content > h1 a::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-left: 0.3em;
  vertical-align: baseline;
  position: relative;
  top: -0.05em;
  background-color: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M352 0c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9L370.7 96 201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L416 141.3l41.4 41.4c9.2 9.2 22.9 11.9 34.9 6.9s19.8-16.6 19.8-29.6l0-128c0-17.7-14.3-32-32-32L352 0zM80 32C35.8 32 0 67.8 0 112L0 432c0 44.2 35.8 80 80 80l320 0c44.2 0 80-35.8 80-80l0-160c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 160c0 8.8-7.2 16-16 16L80 448c-8.8 0-16-7.2-16-16l0-320c0-8.8 7.2-16 16-16l160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L80 32z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M352 0c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9L370.7 96 201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L416 141.3l41.4 41.4c9.2 9.2 22.9 11.9 34.9 6.9s19.8-16.6 19.8-29.6l0-128c0-17.7-14.3-32-32-32L352 0zM80 32C35.8 32 0 67.8 0 112L0 432c0 44.2 35.8 80 80 80l320 0c44.2 0 80-35.8 80-80l0-160c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 160c0 8.8-7.2 16-16 16L80 448c-8.8 0-16-7.2-16-16l0-320c0-8.8 7.2-16 16-16l160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L80 32z'/%3E%3C/svg%3E");
  mask-size: contain;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
}

.md-header__nav-link:active {
  color: var(--osi-primary-blue);
}

.md-header__nav-item--active .md-header__nav-link {
  color: var(--osi-primary-blue);
}

@media (max-width: 76.1875em) {
  .md-header__center {
    display: none;
  }

  .md-nav--primary,
  .md-nav--primary .md-nav {
    background-color: var(--osi-white) !important;
  }

  .md-nav--primary .md-nav__title {
    background-color: var(--osi-white) !important;
    color: var(--osi-gray-900) !important;
    border-bottom: 1px solid var(--osi-gray-200);
  }

  .md-nav--primary .md-nav__title[for="__drawer"] {
    background-color: var(--osi-white) !important;
    color: var(--osi-gray-900) !important;
  }

  .md-nav--primary .md-nav__title .md-nav__icon {
    color: var(--osi-gray-600) !important;
  }

  .md-nav--primary .md-nav__title .md-nav__button {
    color: var(--osi-gray-600) !important;
  }

  .md-nav--primary .md-nav__item .md-nav__link {
    color: var(--osi-gray-700) !important;
  }

  .md-nav--primary .md-nav__item .md-nav__link:hover,
  .md-nav--primary .md-nav__item .md-nav__link:focus {
    color: var(--osi-primary-blue) !important;
  }

  .md-nav--primary .md-nav__item--active > .md-nav__link {
    color: var(--osi-primary-blue) !important;
    font-weight: 600;
  }

  [data-md-toggle="drawer"] ~ .md-header .md-header__button {
    color: var(--osi-gray-700) !important;
  }
}

@media (min-width: 76.25em) {
  .md-header__hamburger {
    display: none;
  }
}


/* ==========================================================================
   Bootstrap Button Overrides (OSI brand colors)
   ========================================================================== */

.btn-primary {
  --bs-btn-bg: var(--osi-primary-blue);
  --bs-btn-border-color: var(--osi-primary-blue);
  --bs-btn-hover-bg: var(--osi-dark-blue);
  --bs-btn-hover-border-color: var(--osi-dark-blue);
  --bs-btn-active-bg: var(--osi-dark-blue);
  --bs-btn-active-border-color: var(--osi-dark-blue);
  font-weight: 600;
  border-radius: 0.5rem;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 147, 199, 0.3);
}

.btn-outline-secondary {
  --bs-btn-color: var(--osi-gray-700);
  --bs-btn-border-color: var(--osi-gray-300);
  --bs-btn-hover-bg: var(--osi-gray-50);
  --bs-btn-hover-border-color: var(--osi-gray-400);
  --bs-btn-hover-color: var(--osi-gray-900);
  font-weight: 600;
  border-radius: 0.5rem;
}

.btn-outline-light:hover {
  color: var(--osi-dark-blue);
}

.btn svg {
  vertical-align: middle;
  margin-right: 0.5rem;
}


/* ==========================================================================
   Responsive Breakpoints (Global)
   ========================================================================== */

@media (max-width: 768px) {
  h1, .h1 {
    font-size: var(--osi-font-heading-lg);
  }

  h2, .h2 {
    font-size: var(--osi-font-heading-md);
  }
}

/* ── Compact updates list ────────────────────────────────────────────── */
.osi-update-row {
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--osi-gray-100);
}

.osi-update-row:last-child {
  border-bottom: none;
}

.osi-update-row__header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.osi-update-row__date {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--osi-gray-400);
  white-space: nowrap;
}

.osi-update-row__sep {
  color: var(--osi-gray-300);
  font-size: 0.72rem;
}

.osi-update-row__title {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.osi-update-row__title a {
  color: var(--osi-primary-blue);
  text-decoration: none;
}

.osi-update-row__title a:hover {
  color: var(--osi-dark-blue);
}

.osi-update-row__title .osi-external-icon {
  width: 0.6em;
  height: 0.6em;
  margin-left: 0.3em;
  opacity: 0.4;
  vertical-align: baseline;
  position: relative;
  top: -0.05em;
}

.osi-update-row__summary {
  margin: 0.1rem 0 0 0 !important;
  font-size: 0.72rem;
  color: var(--osi-gray-500);
  line-height: 1.3;
}

.md-typeset .md-post--excerpt {
  margin-bottom: 0;
}

.md-typeset .md-post--excerpt + .md-post--excerpt {
  margin-top: 0;
}

.md-post--excerpt .md-post__header,
.md-post--excerpt .md-post__content,
.md-post--excerpt .md-post__action {
  display: none;
}

@media (max-width: 480px) {
  .osi-update-row__header {
    flex-wrap: wrap;
  }
}


/* ── Blog post page ────────────────────────────────────────────────── */
.md-content--post .md-typeset {
  font-size: 0.76rem;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

.md-content--post .md-typeset h1 {
  font-size: 1rem;
}

.md-content--post .md-typeset h2 {
  font-size: 0.88rem;
}

.md-content--post .md-typeset h3 {
  font-size: 0.8rem;
}

.md-content--post .md-typeset h4 {
  font-size: 0.76rem;
}

.md-content--post .md-typeset p,
.md-content--post .md-typeset li {
  font-size: 0.76rem;
  color: var(--osi-gray-700);
}

.md-content--post .md-typeset table {
  font-size: 0.74rem;
}
