/* BPI look (bpi-oxford.com): palette + fonts + home hero + footer only.
   Inner pages stay native Material. Keep this file small. */
@import url("https://fonts.googleapis.com/css2?family=Schibsted+Grotesk:wght@500;700&display=swap");

:root {
  --bpi-blue: #0052cc;
  --bpi-blue-dark: #0041a3;
  --bpi-blue-light: #3374d6;
  --bpi-blue-tint: #7fa8e5;
  --bpi-ink: #0a0f1d;
  --bpi-navy: #102a43;
  --bpi-slate: #3f5468;
  --bpi-bg: #f4f6f8;
  --bpi-border: #e1e3e6;
  --bpi-heading-font: "Schibsted Grotesk", "IBM Plex Sans", Helvetica, Arial, sans-serif;
}

/* ---- Palette mapped onto Material ---- */
/* Top bar: Oxford blue with white text; links/buttons in the page: BPI blue. */
:root { --oxford-blue: #002147; --oxford-blue-light: #1d4f8c; }
[data-md-color-primary="custom"] {
  --md-primary-fg-color: var(--oxford-blue);
  --md-primary-fg-color--light: var(--oxford-blue-light);
  --md-primary-fg-color--dark: #00152e;
  --md-primary-bg-color: #ffffff;
  --md-primary-bg-color--light: rgba(255, 255, 255, 0.75);
}
[data-md-color-accent="custom"] {
  --md-accent-fg-color: var(--bpi-blue-dark);
  --md-accent-fg-color--transparent: rgba(0, 82, 204, 0.1);
}
:root > * {
  --md-typeset-a-color: var(--bpi-blue);
  --md-default-fg-color: var(--bpi-ink);
  --md-footer-bg-color: var(--bpi-navy);
  --md-footer-bg-color--dark: var(--bpi-ink);
}
.md-header { box-shadow: none; }
.md-tabs { background-color: var(--oxford-blue); }
.md-tabs__link { opacity: 0.85; }
.md-tabs__link--active, .md-tabs__item--active .md-tabs__link, .md-tabs__link:hover { opacity: 1; color: #fff; }
.md-tabs__item--active .md-tabs__link { box-shadow: inset 0 -3px 0 var(--bpi-blue-tint); }
.md-header__button.md-logo { padding-top: .5rem; padding-bottom: .5rem; }
.md-header__button.md-logo img { height: 1.7rem; width: auto; }

/* ---- Top tabs: hover dropdowns (overrides/partials/tabs-item.html, from pyHisto).
   Shown on :hover and keyboard :focus-within. Material clips the tab bar, so it is
   made overflow-visible where tabs are shown (>= 76.25em). ---- */
@media screen and (min-width: 76.25em) {
  .md-tabs, .md-tabs__list { overflow: visible; contain: none; }
  .md-tabs__item.bia-tabs-item--dropdown { position: relative; }
  .bia-tabs-dropdown {
    display: none; position: absolute; top: 100%; left: 0; z-index: 10;
    min-width: 13rem; max-width: 22rem; max-height: calc(100vh - 6rem); overflow-y: auto;
    margin: 0; padding: .4rem 0; list-style: none; white-space: normal;
    background: #fff; color: var(--oxford-blue); border-radius: .4rem;
    border: 1px solid #00214726;
    box-shadow: 0 .2rem .5rem #0000001f, 0 .6rem 1.4rem #00214726;
    font-size: .68rem; line-height: 1.35;
  }
  .bia-tabs-item--dropdown:hover > .bia-tabs-dropdown,
  .bia-tabs-item--dropdown:focus-within > .bia-tabs-dropdown { display: block; }
  .md-tabs[hidden] .bia-tabs-dropdown { display: none !important; }
  .bia-tabs-dropdown__sublist { margin: 0; padding: 0; list-style: none; }
  .bia-tabs-dropdown__link { display: block; padding: .3rem .9rem; color: var(--oxford-blue); text-decoration: none; }
  .bia-tabs-dropdown__sublist .bia-tabs-dropdown__link { padding-left: 1.5rem; }
  .bia-tabs-dropdown__link:hover, .bia-tabs-dropdown__link:focus-visible { background: #e8eef7; color: var(--oxford-blue); outline: none; }
  .bia-tabs-dropdown__link:focus-visible { box-shadow: inset 3px 0 0 var(--bpi-blue); }
  .bia-tabs-dropdown__link--active { font-weight: 700; box-shadow: inset 3px 0 0 var(--bpi-blue); }
  .bia-tabs-dropdown__heading {
    display: block; padding: .45rem .9rem .15rem; font-weight: 700; color: var(--bpi-slate);
    font-size: .6rem; text-transform: uppercase; letter-spacing: .04em;
  }
}
@media screen and (max-width: 76.2344em) { .bia-tabs-dropdown { display: none; } }

/* ---- Fonts ---- */
.md-typeset h1, .md-typeset h2, .md-typeset h3, .bia-hero h1 {
  font-family: var(--bpi-heading-font);
  color: var(--bpi-ink);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.md-header__title { font-family: var(--bpi-heading-font); font-weight: 700; cursor: pointer; }

/* ---- Small badges used by the data-driven cards ---- */
.bia-tag, .bia-status, .bia-licence {
  display: inline-block; font-size: 0.68rem; line-height: 1.6;
  padding: 0 0.5em; border-radius: 999px; margin: 0 0.15em 0.2em 0;
  border: 1px solid var(--bpi-border); color: var(--bpi-slate); background: var(--bpi-bg);
}
.bia-status--released { background: #e6f4ea; border-color: #b7dfc3; color: #1e6b34; }
.bia-status--beta { background: rgba(0, 82, 204, 0.08); border-color: var(--bpi-blue-tint); color: var(--bpi-blue-dark); }
.bia-status--in-development { background: #fff4e5; border-color: #ffd28c; color: #8a5300; }

/* ---- Home page (overrides/home.html) ---- */
.bia-hero {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(1200px 500px at 85% 20%, rgba(127,168,229,0.35), transparent 60%),
              linear-gradient(135deg, var(--oxford-blue) 0%, var(--bpi-navy) 55%, var(--bpi-blue-dark) 100%);
}
.bia-hero__media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: right center; }
/* Oxford-blue fade on the text side; the tracking on the right stays visible. */
.bia-hero__shade { position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,33,71,.97) 0%, rgba(0,33,71,.92) 38%, rgba(0,33,71,.45) 62%, rgba(0,33,71,.05) 85%); }
@media screen and (max-width: 60em) { .bia-hero__shade { background: rgba(0,33,71,.86); } }
.bia-hero__inner { position: relative; padding: 5rem 0.8rem 4.5rem; }
.bia-hero h1 { color: #fff; font-size: clamp(2rem, 4.5vw, 3.2rem); margin: 0 0 0.6rem; line-height: 1.1; max-width: 22ch; }
.bia-hero p { font-size: 1.05rem; max-width: 58ch; color: rgba(255,255,255,0.88); }
.bia-hero__credit { position: absolute; right: 0.8rem; bottom: 0.5rem; font-size: 0.6rem; line-height: 1.45; text-align: right; opacity: 0.9; background: rgba(0,33,71,.6); padding: .25rem .5rem; border-radius: 3px; }
.bia-btn {
  display: inline-block; padding: 0.65em 1.3em; border-radius: 6px; margin: 0.8rem 0.6rem 0 0;
  font-size: 0.8rem; font-weight: 600; background: var(--bpi-blue); color: #fff !important; border: 1px solid var(--bpi-blue);
}
.bia-btn:hover { background: var(--bpi-blue-dark); }
.bia-btn--ghost { background: transparent; border-color: rgba(255,255,255,0.6); }
.bia-btn--ghost:hover { background: rgba(255,255,255,0.1); }

.bia-section { padding: 3rem 0.8rem; }
.bia-section--alt { background: var(--bpi-bg); }
.bia-section h2 { font-family: var(--bpi-heading-font); font-size: 1.6rem; margin: 0 0 0.4rem; color: var(--bpi-ink); }
.bia-lead { color: var(--bpi-slate); max-width: 70ch; margin-bottom: 1.6rem; }
.bia-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: stretch; }
.bia-grid > .bia-card { height: 100%; box-sizing: border-box; }
.bia-card {
  display: block; background: #fff; border: 1px solid var(--bpi-border); border-radius: 10px;
  padding: 1.2rem; color: var(--bpi-ink) !important; transition: box-shadow .15s, transform .15s;
}
a.bia-card:hover { box-shadow: 0 8px 24px rgba(16,42,67,0.12); transform: translateY(-2px); }
.bia-card h3 { font-family: var(--bpi-heading-font); margin: 0.2rem 0 0.4rem; font-size: 1.05rem; }
.bia-card p { margin: 0; color: var(--bpi-slate); font-size: 0.85rem; }
.bia-hero__kicker { text-transform: none; letter-spacing: .06em; font-size: 1rem !important; font-weight: 600; color: var(--bpi-blue-tint) !important; margin: 0 0 .4rem; }
.bia-hero p + p { margin-top: .4rem; }
.bia-grid--media { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.bia-card--media { padding: 0; overflow: hidden; }
.bia-card__img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #0a0f1d; }
.bia-card__img--contain-dark { object-fit: contain; background: #000; }
.bia-card__img--contain { object-fit: contain; background: #fff; padding: .6rem; }
.bia-card__body { padding: 1.1rem 1.2rem 1.3rem; }
.bia-card h3 + p { margin-top: .2rem; }
/* Media cards: equal height in a row, credit line pinned to the bottom so they align. */
.bia-card--media { display: flex; flex-direction: column; }
.bia-card--media .bia-card__body { flex: 1; display: flex; flex-direction: column; }
.bia-card p.bia-card__credit { margin-top: auto; padding-top: .8rem; font-size: .65rem; opacity: .75; }
.bia-card__kicker { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--bpi-blue); font-weight: 600; }
.bia-stat { font-family: var(--bpi-heading-font); font-size: 2rem; color: var(--bpi-blue); line-height: 1; }

@media (prefers-reduced-motion: reduce) {
  .bia-hero__media { display: none; }   /* poster/gradient only */
  a.bia-card:hover { transform: none; }
}

/* ---- Footer (overrides/partials/footer.html) ---- */
.bia-footer { background: var(--bpi-navy); color: rgba(255,255,255,0.85); font-size: 0.75rem; }
.bia-footer__inner { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); padding: 2rem 0.8rem 1rem; }
.bia-footer h4 { color: #fff; margin: 0 0 0.5rem; font-family: var(--bpi-heading-font); font-size: 0.85rem; }
.bia-footer a { color: #fff; }
.bia-footer a:hover { color: var(--bpi-blue-tint); }
.bia-footer address { font-style: normal; line-height: 1.6; }
.bia-footer ul { list-style: none; margin: 0; padding: 0; line-height: 1.8; }
.bia-logos { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: center; padding: 1rem 0.8rem; border-top: 1px solid rgba(255,255,255,0.12); }
.bia-logos img { display: block; height: 36px; width: auto; max-width: 160px; object-fit: contain; background: #fff; border-radius: 4px; padding: 6px 12px; }
.bia-footer__legal { padding: 0.6rem 0.8rem 1.2rem; opacity: 0.7; text-align: center; }
.bia-footer__gh a { display: inline-flex; align-items: center; gap: 0.4em; }
.bia-gh-icon svg { width: 1.1em; height: 1.1em; fill: currentColor; vertical-align: middle; }
.bia-center { text-align: center; margin-top: 1.6rem; }

/* Research page: image on top of each grid card */
.md-typeset .grid.cards img.bia-card-img,
.md-typeset .grid.cards img.bia-research-img {
  display: block; width: calc(100% + 1.6rem); max-width: none; margin: -.8rem -.8rem .6rem;
  aspect-ratio: 16 / 9; object-fit: cover; background: #0a0f1d; border-radius: .1rem .1rem 0 0;
}
.md-typeset .grid.cards img.bia-card-img[src$='.svg'], .md-typeset .grid.cards img.bia-card-img[src$='.png'],
.md-typeset .grid.cards img.bia-research-img[src$='.svg'] { object-fit: contain; background: #fff; padding: .4rem; }
.md-typeset .grid.cards img.bia-card-img[src*='-logo.png'] { padding: 1.4rem 2rem; }

/* Pop-up detail windows (docs/javascripts/dialogs.js) */
.bia-dialog { max-width: 42rem; width: calc(100% - 2rem); border: none; border-radius: 10px; padding: 1.2rem 1.6rem;
  box-shadow: 0 1rem 3rem rgba(0, 33, 71, .35); color: var(--bpi-ink); }
.bia-dialog::backdrop { background: rgba(0, 33, 71, .55); }
.bia-dialog .md-button { margin-top: .4rem; }
.bia-dialog__close { float: right; font-size: 1.6rem; line-height: 1; background: none; border: none; cursor: pointer; color: var(--bpi-slate); }
.bia-dialog__close:hover { color: var(--bpi-blue); }
.md-typeset .bia-dialog__title { font-family: var(--bpi-heading-font); font-size: 1.05rem; font-weight: 700; margin: .2rem 0 .8rem; }

/* Figures reused from the GloBIAS 2026 poster */
.md-typeset img.bia-figure { display: block; width: 100%; max-width: 46rem; margin: .6rem auto 1rem; border-radius: 6px; }
.bia-dialog--image { max-width: min(92vw, 70rem); width: auto; padding: .6rem; background: #fff; }
.bia-dialog--image img { display: block; max-width: 100%; max-height: 88vh; width: auto; height: auto; margin: 0 auto; }
.bia-dialog--image .bia-dialog__close { position: absolute; top: .3rem; right: .6rem; float: none; z-index: 1; }

/* ---- Phone layout (Material's small-screen breakpoint) ---- */
@media screen and (max-width: 44.9375em) {
  /* hero: lighter fade so the image shows, full-width stacked buttons */
  .bia-hero__inner { padding: 2.2rem .8rem 4.2rem; }
  .bia-hero p { font-size: .95rem; }
  .bia-hero__kicker { font-size: .8rem !important; }
  .bia-hero__shade { background: linear-gradient(180deg, rgba(0,33,71,.55) 0%, rgba(0,33,71,.82) 45%, rgba(0,33,71,.9) 100%); }
  .bia-btn { display: block; text-align: center; margin: .6rem 0 0; }
  .bia-hero__credit { font-size: .55rem; right: .6rem; bottom: .4rem; }
  .bia-section { padding: 1.8rem .2rem; }
  .bia-section h2 { font-size: 1.35rem; }
  .bia-dialog { padding: 1rem 1.1rem; }

  /* tables: one labelled card per row (labels from docs/javascripts/tables.js) */
  .md-typeset__scrollwrap { overflow: visible; margin: 0; }
  .md-typeset__table { display: block; padding: 0; }
  .md-typeset table[data-bia-stack] { display: block; border: none; font-size: .75rem; box-shadow: none; background: none; }
  .md-typeset table[data-bia-stack] thead { display: none; }
  .md-typeset table[data-bia-stack] tbody, .md-typeset table[data-bia-stack] tr { display: block; }
  .md-typeset table[data-bia-stack] tr { background: #fff; border: 1px solid var(--bpi-border); border-radius: 8px; padding: .45rem .7rem; margin-bottom: .6rem; }
  .md-typeset table[data-bia-stack] td { display: flex; gap: .6rem; border: none !important; padding: .18rem 0 !important; }
  .md-typeset table[data-bia-stack] td::before { content: attr(data-label); flex: 0 0 6.2rem; font-weight: 600; color: var(--bpi-slate); }
  .md-typeset table[data-bia-stack] td:empty { display: none; }
}

/* Home: the OME-Zarr diagram is drawn in light strokes; lift it to match the other two cards */
.bia-card--media img[src$="ome-zarr-chunking.svg"] { filter: contrast(1.35) saturate(1.6); }
