@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap');

/* Colours */
:root[data-theme="dark"], [data-theme="dark"] {
  --light-color: #eee;
  --dark-color: #0e0e0e;
  --gray-1: #222;
  --gray-2: #555;
  --gray-3: #aaa;
  --gray-4: #f6f6f6;
  --light-blue: #007acc;
  --dark-blue: #005bb5;
  --light-red: #ff3838;
  --dark-red: #cc0000;

  --pico-primary: #007acc;
  --pico-primary-hover: #005bb5;
  --pico-primary-border: #007acc;
  --q2-accent-color: #007acc;
  --pico-ins-color: #007acc;

  --pico-del-color: #ff3838;

  --pico-background-color: #0e0e0e;
  /* Main background */
  --pico-card-background-color: #222222;
  /* Cards & dropdowns */
  --pico-form-element-background-color: #222222;

  --pico-color: #eeeeee;
  /* Primary body text */
  --pico-h1-color: #f8fafc;
  /* Main headings */
  --pico-h2-color: #f8fafc;
  --pico-h3-color: #f8fafc;
  --pico-muted-color: #aaaaaa;

  --pico-border-color: rgba(255, 255, 255, 0.12);
  --pico-card-border-color: rgba(255, 255, 255, 0.08);
  --pico-card-border-color-hover: rgba(255, 255, 255, 0.15);
  --pico-form-element-border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="light"],
:root:not([data-theme="dark"]) {
  /* Accent & Interactive Colors */
  --pico-primary: #005bb5;
  --pico-primary-hover: #007acc;
  --pico-primary-border: #005bb5;
  --q2-accent-color: #005bb5;
  --pico-ins-color: #005bb5;

  /* Utility Status Colors */
  --pico-del-color: #cc0000;

  /* Background Surface Colors */
  --pico-background-color: #f6f6f6;
  --pico-card-background-color: #fdfdfd;
  --pico-form-element-background-color: #fdfdfd;

  /* Typography Colors */
  --pico-color: #0e0e0e;
  --pico-h1-color: #0e0e0e;
  --pico-h2-color: #0e0e0e;
  --pico-h3-color: #0e0e0e;
  --pico-muted-color: #555555;

  /* Borders & Dividers */
  --pico-border-color: #e5e7eb;
  --pico-card-border-color: #e5e7eb;
  --pico-form-element-border-color: #d1d5db;
}

.text-justify {
  text-align: justify;
  hyphens: auto;
}

.gray-text {
  color: var(--pico-muted-color);
}
.blue-text {
  color: var(--q2-accent-color);
}
.red-text {
  color: var(--pico-del-color);
}

.search-container input, .filter-group select {
  background-color: var(--pico-form-element-background-color);
  border: 1px solid var(--pico-form-element-border-color);
}

.modular-hero h1 {
  font-family: 'Libre Baskerville', serif;
  font-weight: 700;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.modular-hero h6 {
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.modular-hero p {
  font-size: 1.1rem;
  max-width: 38rem;
  margin-bottom: 2rem;
  margin-left: 0;
  margin-right: auto;
}

.hero-buttons {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  column-gap: 1.5rem;
  row-gap: 1rem;
  align-items: center;
  width: 100%;
}

/* --- Pill buttons ---------------------------------------------------------
 * One shape for every pill on the site: the hero buttons (hero.md), the
 * "View All News" button and "Back to News". The `.hero-buttons` selectors
 * are kept because the hero links also carry Quark 2's `.btn` / `a.btn`
 * classes and must out-rank them. */
.pill-btn,
.hero-buttons .pill-btn {
  display: inline-block;
  border-radius: 1.85rem;
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.3s ease;
}

/* Filled accent pill */
.pill-btn-primary,
.hero-buttons .hero-btn {
  background-color: var(--pico-ins-color);
  border: 1px solid var(--pico-primary-hover);
}

.pill-btn-primary,
.pill-btn-primary:hover {
  color: #fff;
}

.pill-btn-primary:hover {
  background-color: var(--pico-primary-hover);
  border-color: var(--pico-primary-border);
  transform: translateY(-2px);
}

/* Outline pill (hero only) */
.hero-buttons .hero-btn-outline {
  background-color: transparent;
  border: 1px solid var(--pico-muted-color);
}

/* --- Hero buttons: 3-D hover / press ----------------------------------------
 * The hero pills already have Quark 2's top-edge highlight (.btn). On hover
 * they stay in place but look raised: brighter top bevel, darker bottom edge
 * for thickness, a soft drop shadow underneath and a light gloss. On click
 * they press down. The hero always sits on a dark image, so white/black
 * shading works in both light and dark mode. */
/* Resting bevel. Quark 2's .btn uses --q2-shadow-hl, which is a clear 2px
 * highlight in light mode but nearly invisible in dark mode (1px at 6%).
 * The hero is always on a dark photo, so use the light-mode bevel in both. */
.hero-buttons .hero-btn,
.hero-buttons .hero-btn-outline {
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.15);
}

.hero-buttons .hero-btn:hover,
.hero-buttons .hero-btn:focus-visible {
  background-color: var(--pico-primary-hover);
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 60%);
  border-color: var(--pico-primary-border);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.3),
    inset 0 -3px 0 rgba(0, 0, 0, 0.2),
    0 8px 16px -6px rgba(0, 0, 0, 0.55);
  opacity: 1; /* cancel Quark 2's .btn:hover fade */
}

.hero-buttons .hero-btn-outline:hover,
.hero-buttons .hero-btn-outline:focus-visible {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -2px 0 rgba(0, 0, 0, 0.25),
    0 8px 16px -6px rgba(0, 0, 0, 0.55);
  opacity: 1;
}

.hero-buttons .hero-btn:active,
.hero-buttons .hero-btn-outline:active {
  background-image: none;
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.3);
  transform: translateY(1px);
  transition-duration: 0.05s;
}

@media (prefers-reduced-motion: reduce) {
  .hero-buttons .pill-btn,
  .hero-buttons .pill-btn:hover,
  .hero-buttons .pill-btn:focus-visible,
  .hero-buttons .pill-btn:active {
    transform: none;
  }
}

.hero.overlay-left-dark-gradient::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.6) 50%, rgba(0, 0, 0, 0.1) 100%);
  z-index: 1;
}

.hero.overlay-left-dark-gradient .container {
  position: relative;
  z-index: 2;
  text-align: left;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

.hero.hero-fullscreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  background-size: cover;
  background-position: center;
}

.text-image-split {
  display: flex;
  flex-direction: column;
  column-gap: 5rem;
  row-gap: 1rem;
  align-items: center;
  margin-block: 2rem;
}

@media (min-width: 768px) {
  .text-image-split {
    flex-direction: row;
  }

  .text-image-split>div:first-child {
    flex: 3;
    /* Gives text 60% width */
  }

  .text-image-split>div:last-child {
    flex: 2;
    /* Gives image 40% width */
  }
}

.text-image-split img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.facility-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.facility-card {
  background-color: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color);
  border-radius: 12px;
  padding: 1.75rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.facility-card:hover {
  border-color: var(--pico-card-border-color-hover);
  transform: translateY(-2px);
}

.facility-card .icon-box {
  width: 42px;
  height: 42px;
  background-color: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.facility-card .icon-box i {
  font-size: 1.2rem;
  color: var(--pico-ins-color);
}

.columns .column {
  background-color: var(--pico-card-background-color);
  border-radius: 1rem;
  box-shadow: inset 0 0 0 1px var(--pico-card-border-color);
}

.frame-box .grid .card {
  background-color: var(--pico-card-background-color);
  border-radius: 1rem;
  box-shadow: inset 0 0 0 1px var(--pico-card-border-color);
}

.topic-details .detail-name {
  margin-bottom: 0;
}
.topic-details .detail-numbers {
  color: var(--pico-muted-color);
}

.detail-return a {
  background-color: var(--pico-ins-color);
  transition: transform 0.2s ease;
}
.detail-return a:hover {
  background-color: var(--pico-primary-hover);
  transform: translateY(-2px);
}

/* --- Footer ----------------------------------------------------------------
 * The footer reuses Quark 2's `.columns`/`.column` markup, so it would pick up
 * the `.columns .column` card style above. `#footer ...` selectors out-rank
 * that (and Pico's list styles) without needing !important. */
#footer .columns {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 30px;
}

#footer .footer-col {
    flex: 1;
    min-width: 250px;
    margin-bottom: 2rem;
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 0;
    text-align: left;
}

/* First column (site name + tagline) gets twice the width of the others */
#footer .footer-col:first-child {
    flex: 2;
}

#footer .footer-col .footer-title {
    text-align: left;
}

#footer .footer-col p {
    text-align: left;
    margin-bottom: 1rem;
}

#footer .footer-links {
    text-align: left;
    list-style: none;
    padding-left: 0;
    margin-left: 0;
}

#footer .footer-links li {
    list-style-type: none;
}

#footer .footer-links a {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
}

#footer .footer-links a:hover {
    transform: translateX(5px);
}

#footer .footer-links i {
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

#footer .footer-bottom {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(128, 128, 128, 0.2);
    text-align: center;
    width: 100%;
}

#footer .footer-bottom p {
    font-size: 0.85rem;
    margin: 0;
    text-align: center;
}

/* --- Transparent header: white nav text while over the hero (top of page) --- */
/* At the top of hero pages the header is transparent and sits over the dark
 * hero image, so force white text + white logo until scrolled — excluding the
 * active pill and hover chips (which draw their own background and keep their
 * paired theme contrast color) and non-hero pages (which sit on --q2-bg). */
body.header-transparent:has(.hero, #blog-hero):not(.scrolled) #header,
body.header-transparent:has(.hero, #blog-hero):not(.scrolled) #header .navbar-brand,
body.header-transparent:has(.hero, #blog-hero):not(.scrolled) #header .theme-toggle:not(:hover),
body.header-transparent:has(.hero, #blog-hero):not(.scrolled) #header .login-status-wrapper,
body.header-transparent:has(.hero, #blog-hero):not(.scrolled) #header .dropmenu > ul > li > a:not(.active):not(:hover) {
  color: #ffffff;
}

body.header-transparent:has(.hero, #blog-hero):not(.scrolled) #header .navbar-brand svg path,
body.header-transparent:has(.hero, #blog-hero):not(.scrolled) #header .navbar-brand svg,
body.header-transparent:has(.hero, #blog-hero):not(.scrolled) #header .navbar-brand svg * {
  fill: #ffffff;
}

/* --- News ------------------------------------------------------------------
 * Shared by news.html.twig (listing), modular/news_showcase.html.twig (home
 * page, "compact" cards) and news_item.html.twig (article). Selectors use two
 * classes so they out-rank Quark 2's `.section`, `.container` and
 * `.blog-page-header h1` rules, which the old inline styles used to beat. */

/* Listing page */
.news-listing .blog-page-header .page-title { margin-bottom: 2rem; }
.news-listing .news-grid { display: flex; flex-direction: column; gap: 2rem; }
.news-listing #listing-footer { margin-top: 2.5rem; }

/* Card */
.news-card {
  background-color: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color);
  border-radius: 8px;
  padding: 2rem;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.news-card:hover {
  border-color: var(--pico-primary-border);
  transform: translateY(-2px);
}
.news-card .news-thumbnail {
  margin: -2rem -2rem 1.5rem -2rem;
  border-bottom: 1px solid var(--pico-border-color);
}
.news-card .news-thumbnail > a { display: block; }
.news-card .news-card-title { margin-top: 0; margin-bottom: 0.5rem; }
.news-card .news-card-title a { text-decoration: none; color: var(--pico-h2-color); }
.news-card .news-meta {
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 20px;
  align-items: center;
}
.news-card .news-summary { margin-bottom: 1.5rem; }
.news-card .news-read-more { font-weight: 600; text-decoration: none; }

/* Compact card (home page showcase) */
.news-card.news-card-compact { padding: 1.5rem; display: flex; flex-direction: column; }
.news-card-compact .news-thumbnail { margin: -1.5rem -1.5rem 1.25rem -1.5rem; }
.news-card-compact .news-card-title { font-size: 1.25rem; line-height: 1.3; }
.news-card-compact .news-meta { font-size: 0.8rem; margin-bottom: 1rem; gap: 15px; flex-wrap: wrap; }
.news-card-compact .news-meta svg { vertical-align: -1px; margin-right: 3px; }
.news-card-compact .news-summary { font-size: 0.95rem; line-height: 1.5; flex-grow: 1; }
.news-card-compact .news-read-more { font-size: 0.9rem; margin-top: auto; }

/* Date / author line (cards and article) */
.news-meta svg { vertical-align: text-bottom; margin-right: 4px; }

/* Home page showcase section */
.section.modular-news-showcase { padding: 4rem 0; }
.modular-news-showcase .section-header { text-align: center; margin-bottom: 3rem; }
.modular-news-showcase .section-header h2 { font-size: 2.5rem; margin-bottom: 0.5rem; color: var(--pico-h1-color); }
.modular-news-showcase .section-intro { font-size: 1.1rem; max-width: 600px; margin: 0 auto; }
.news-showcase-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; }
.news-showcase-grid .news-empty { text-align: center; grid-column: 1 / -1; }
.modular-news-showcase .news-showcase-cta { text-align: center; margin-top: 3rem; }
@media (max-width: 900px) {
  .news-showcase-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .news-showcase-grid { grid-template-columns: 1fr; }
}

/* Article page */
.section.news-single { padding: 2rem 0; }
.news-single > .container { max-width: 800px; margin: 0 auto; padding: 0 1.5rem; }
.news-single .page-title {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--pico-h1-color);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.2;
}
.news-single .news-meta {
  font-size: 0.95rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--pico-border-color);
  display: flex;
  gap: 20px;
  flex-wrap: wrap; /* date and author stack on narrow screens */
}
.news-single .news-content { font-size: 1.05rem; line-height: 1.7; }
/* Images added in the Markdown editor scale down on mobile */
.news-single .news-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}
.news-single .news-back { margin-top: 4rem; }
