/* =========================================================
   Chemistry@BGS — Molecule of the Week
   ========================================================= */

:root {
  --motw-accent: #176b6f;
  --motw-accent-dark: #0f5558;
  --motw-soft: #eef8f7;
  --motw-line: #cfe4e2;
}


/* ---------- Homepage permanent header link ---------- */

.motw-header-link,
.motw-header-link:visited {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 9px 14px;

  color: var(--motw-accent);
  background: var(--motw-soft);

  border: 1px solid var(--motw-line);
  border-radius: 999px;

  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 800;

  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.motw-header-link:hover {
  color: var(--motw-accent-dark);
  background: #e3f3f1;
  border-color: #a8d1cd;
  transform: translateY(-1px);
}

.motw-header-link__icon {
  font-size: 1.05rem;
  line-height: 1;
}


/*
  On wide desktops use the otherwise-empty visual centre of the homepage
  header. This applies only where molecule-of-week.css is loaded.
*/
@media (min-width: 1450px) {
  .home-page .site-header {
    position: sticky;
  }

  .home-page .motw-header-link {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .home-page .motw-header-link:hover {
    transform:
      translateX(-50%)
      translateY(-1px);
  }
}


/*
  On medium desktop widths, leave the link in normal flex flow rather than
  risking overlap with the brand or main navigation.
*/
@media (min-width: 901px) and (max-width: 1449px) {
  .home-page .motw-header-link {
    margin-left: 24px;
  }
}


/* Mobile: keep it permanent and easy to reach. */
@media (max-width: 900px) {
  .home-page .motw-header-link {
    width: 100%;
    justify-content: center;
    order: 2;
  }

  .home-page .header-actions {
    order: 3;
  }
}


/* ---------- Weekly homepage announcement ---------- */

.molecule-week-popup {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 1200;

  width: min(430px, calc(100vw - 36px));

  padding: 24px 26px 22px;

  background: #f8fcfb;
  border: 1px solid var(--motw-line);
  border-left: 7px solid var(--motw-accent);
  border-radius: 18px;

  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.15);

  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);

  transition:
    opacity 0.2s ease,
    visibility 0.2s ease,
    transform 0.2s ease;
}

.molecule-week-popup.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.molecule-week-popup__eyebrow {
  margin-bottom: 7px;

  color: var(--motw-accent);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.molecule-week-popup h2 {
  margin: 0;

  color: #2f2f2f;
  font-size: 1.45rem;
  line-height: 1.15;
}

.molecule-week-popup p {
  margin: 11px 0 0;

  color: #586271;
  line-height: 1.52;
}

.molecule-week-popup__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;

  margin-top: 18px;
}

.molecule-week-popup__primary,
.molecule-week-popup__primary:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 46px;
  padding: 11px 18px;

  background: var(--motw-accent);
  color: #ffffff !important;

  border-radius: 11px;

  text-decoration: none;
  font-weight: 800;
}

.molecule-week-popup__primary:hover {
  background: var(--motw-accent-dark);
}

.molecule-week-popup__dismiss {
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 8px 4px;

  background: transparent;
  color: #555e69;

  border: 0;
  box-shadow: none;

  font: inherit;
  font-weight: 750;
}

.molecule-week-popup__dismiss:hover {
  background: transparent;
  color: #252a30;
}

@media (max-width: 600px) {
  .molecule-week-popup {
    left: 10px;
    right: 10px;
    bottom: 10px;

    width: auto;
    padding: 20px;
  }

  .molecule-week-popup__actions {
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
  }

  .molecule-week-popup__primary,
  .molecule-week-popup__dismiss {
    width: 100%;
    text-align: center;
  }
}


/* ---------- Full Molecule of the Week page ---------- */

.motw-page {
  width: min(1220px, calc(100% - 48px));
  margin: 0 auto;
  padding: 52px 0 80px;
}

.motw-hero,
.motw-viewer-card {
  background: #ffffff;
  border: 1px solid #e3e3e3;
  border-radius: 20px;
}

.motw-hero {
  padding: 42px 44px;

  background:
    radial-gradient(
      circle at top right,
      rgba(23, 107, 111, 0.10),
      transparent 34%
    ),
    #ffffff;
}

.motw-hero .eyebrow {
  color: var(--motw-accent);
}

.motw-hero h2 {
  margin: 7px 0 12px;

  font-size:
    clamp(2.7rem, 6vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.motw-hero__teaser {
  max-width: 780px;
  margin: 0;

  color: #667085;
  font-size: 1.12rem;
  line-height: 1.6;
}

.motw-week-label {
  display: inline-flex;
  margin-top: 20px;
  padding: 7px 11px;

  color: var(--motw-accent);
  background: var(--motw-soft);
  border: 1px solid var(--motw-line);
  border-radius: 999px;

  font-size: 0.86rem;
  font-weight: 750;
}

.motw-viewer-card {
  margin-top: 28px;
  padding: 24px;
}

.motw-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;

  margin-bottom: 18px;
}

.motw-viewer-toolbar h3 {
  margin: 0;
}

.motw-open-pdf,
.motw-open-pdf:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 11px 16px;

  background: var(--motw-accent);
  color: #ffffff !important;
  border-radius: 10px;

  text-decoration: none;
  font-weight: 800;
}

.motw-open-pdf:hover {
  background: var(--motw-accent-dark);
}

.motw-pdf-frame {
  display: block;

  width: 100%;
  height: min(78vh, 940px);
  min-height: 680px;

  background: #f5f6f7;

  border: 1px solid #d9dee3;
  border-radius: 14px;
}

.motw-empty {
  padding: 40px;

  background: #ffffff;
  border: 1px solid #e3e3e3;
  border-radius: 18px;
}

@media (max-width: 700px) {
  .motw-page {
    width: calc(100% - 20px);
    padding-top: 28px;
  }

  .motw-hero,
  .motw-viewer-card {
    padding: 22px 20px;
    border-radius: 14px;
  }

  .motw-viewer-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .motw-open-pdf {
    width: 100%;
  }

  .motw-pdf-frame {
    min-height: 560px;
    height: 70vh;
  }
}

/* Centre Molecule of the Week between brand and navigation */
@media (min-width: 901px) {
  .home-page .site-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }

  .home-page .brand {
    grid-column: 1;
  }

  .home-page .motw-header-link {
    grid-column: 2;

    position: static;
    justify-self: center;

    margin: 0;

    transform: none;
  }

  .home-page .motw-header-link:hover {
    transform: translateY(-1px);
  }

  .home-page .header-actions {
    grid-column: 3;
  }
}