/* =============================================================================
   CS THEME — style.css
   Subtheme of Olivero for Charity Sustainability

   Structure:
   1.  Design tokens (CSS variables)
   2.  Olivero overrides — typography, backgrounds, spacing, navigation
   3.  Olivero block spacing fix — suppress --sp vertical margin
   4.  Layout — structural rules for regions and featured areas
   5.  Header & navigation
   6.  Footer
   7.  Card grid system
   8.  Card component
   9.  Badges
   10. Content fields — standfirst, image captions, dates
   11. Utilities & helpers
   ============================================================================= */


/* =============================================================================
   1. DESIGN TOKENS
   ============================================================================= */

:root {
  /* Colours */
  --cs-blue:        #2C4A6E;
  --cs-amber:       #A07028;
  --cs-off-white:   #F8F7F4;
  --cs-rule:        #D4D0C8;
  --cs-text:        #222222;
  --cs-text-mid:    #444444;
  --cs-text-light:  #888888;
  --cs-white:       #ffffff;

  /* Typography */
  --cs-font-serif:  Palatino, 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --cs-font-sans:   'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;

  /* Spacing & shape */
  --cs-radius:      4px;
  --cs-gap:         1.5rem;
}


/* =============================================================================
   2. OLIVERO OVERRIDES
   Targeting Olivero's own class names to match CS style.
   ============================================================================= */

/* ── Body text ── */
.text-content,
.text-content p,
.text-content li,
.text-content td {
  font-family: var(--cs-font-sans);
  color: var(--cs-text);
}

/* ── Headings — all levels ── */
html body h1,
html body h2,
html body h3,
html body h4,
html body h5,
html body h6,
html body .text-content h1,
html body .text-content h2,
html body .text-content h3 {
  font-family: var(--cs-font-serif) !important;
  color: var(--cs-blue) !important;
}

/* ── Page title / H1 ── */
html body h1,
html body .page-title,
html body [dir="ltr"] h1,
html body [dir="rtl"] h1 {
  font-size: 2rem !important;
  line-height: 1.2;
  font-weight: 400;
  hyphens: none;
}

/* ── Site header bar ── */
.site-header__inner {
  background-color: var(--cs-white);
  border-bottom: 1px solid var(--cs-rule);
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
}

.site-header__initial {
  display: none;
}

/* ── Site branding / name ── */
.site-branding,
[dir="ltr"] .site-branding,
[dir="rtl"] .site-branding {
  background-image: none !important;
  background-color: var(--cs-white) !important;
}

.site-branding__name,
.site-branding__name a {
  font-family: var(--cs-font-serif);
  color: var(--cs-blue);
  text-decoration: none;
}

/* ── Primary navigation ── */
.primary-nav__menu-link,
.primary-nav__menu-link-inner,
.primary-nav__menu-item a {
  font-family: var(--cs-font-sans) !important;
  color: var(--cs-blue) !important;
  font-weight: 600;
  text-decoration: none;
  background: none !important;
}

.primary-nav__menu-link:hover,
.primary-nav__menu-link-inner:hover,
.primary-nav__menu-item a:hover {
  color: var(--cs-amber) !important;
}

.primary-nav__menu-link--active-trail,
.primary-nav__menu-link--active,
a.primary-nav__menu-link.is-active {
  color: var(--cs-blue) !important;
  border-bottom: 2px solid var(--cs-amber);
  background: none !important;
}

/* Olivero adds extra classes to nav spans — target all variants */
span.primary-nav__menu-link-inner,
.primary-nav__menu-link-inner,
.primary-nav__menu-link span,
.primary-nav__menu-item a span,
html body nav .primary-nav__menu-link span,
html body nav span.primary-nav__menu-link-inner,
html body .primary-nav .primary-nav__menu-item a span,
html body nav ul li a span {
  font-family: var(--cs-font-sans) !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  letter-spacing: normal !important;
}

/* ── Remove Olivero background patterns ── */
.main-content,
main.main-content,
.layout-container {
  background-image: none !important;
  background-color: var(--cs-white) !important;
}

.featured-bottom,
.featured-bottom--first,
.featured-bottom--second {
  background-color: var(--cs-white) !important;
}

/* ── Main content region padding ── */
.region--content {
  padding: 1.5rem 1.5rem 0 1.5rem !important;
}

.layout__region--content {
  padding-bottom: 0 !important;
}

/* ── Hide front page title ── */
.path--frontpage .block-field-blocknodelanding2title {
  display: none;
}


/* =============================================================================
   3. OLIVERO BLOCK SPACING FIX
   Olivero's variables.css defines --sp: 1.25rem and applies it via:
     .region > *:where(:not([data-big-pipe-placeholder-id])) { margin-block-end: var(--sp); }
   This collapses vertical gaps between blocks. The fix below zeroes the
   vertical component only, leaving horizontal spacing untouched.
   ============================================================================= */

.region > *:where(:not([data-big-pipe-placeholder-id])) {
  margin-block-end: 0 !important;
}


/* =============================================================================
   4. LAYOUT
   ============================================================================= */

/* ── Featured bottom regions — full width ── */
.featured-bottom {
  background: var(--cs-off-white);
  padding: 2rem 0;
}

.featured-bottom .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.featured-bottom--first,
.featured-bottom--second {
  padding: 2rem 1.5rem;
}

/* Ensure regions span full width */
.region-featured-bottom-first,
.region-featured-bottom-second {
  width: 100%;
}

.region--featured-bottom-first,
.region--featured-bottom-second,
.featured-bottom--first .region,
.featured-bottom--second .region {
  width: 100% !important;
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}


/* =============================================================================
   5. HEADER & NAVIGATION
   (Olivero-specific header overrides are in Section 2.
    This section covers generic/fallback header rules.)
   ============================================================================= */

#header {
  background: var(--cs-white);
  border-bottom: 1px solid var(--cs-rule);
}

/* Generic nav link fallback */
.nav-link {
  font-family: var(--cs-font-sans);
  color: var(--cs-blue);
  font-weight: 600;
}

.nav-link:hover,
.nav-link.active {
  color: var(--cs-amber);
}


/* =============================================================================
   6. FOOTER
   ============================================================================= */

.site-footer {
  background: var(--cs-blue);
  color: var(--cs-white);
  padding: 2rem 0 0;
}

.site-footer a {
  color: var(--cs-white);
}

.site-footer a:hover {
  color: var(--cs-amber);
}

.site-footer__top {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  margin-bottom: 1rem;
}

.site-footer__bottom {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

/* Remove extra space from Layout Builder wrappers inside copyright block */
.site-footer__bottom .layout--onecol,
.site-footer__bottom .layout__region,
.site-footer__bottom .block__content {
  padding: 0 !important;
  margin: 0 !important;
}

/* Prevent double padding from nested .site-footer__bottom */
.site-footer__bottom .site-footer__bottom {
  padding: 0 !important;
}

.site-footer__inner.container {
  padding-bottom: 0.75rem;
}


/* =============================================================================
   7. CARD GRID SYSTEM

   NOTE ON VIEWS FORMAT
   Use Views > Format: Unformatted List (not Bootstrap Grid).
   In Format settings set:
     Wrapper class:  cards-grid cards-grid--featured   (or --taxonomy)
     Row class:      card
   ============================================================================= */

.cards-grid {
  display: grid;
  gap: var(--cs-gap);
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Featured: 2-column grid */
.cards-grid--featured {
  grid-template-columns: 1fr;
}

.cards-grid--featured .view-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--cs-gap);
  width: 100%;
}

@media (max-width: 639px) {
  .cards-grid--featured .view-content {
    grid-template-columns: 1fr;
  }
}

.cards-grid--featured .view-content .card {
  width: 100%;
  min-width: 0;
}

/* Taxonomy landing: 3 columns on desktop, 2 on tablet, 1 on mobile */
.cards-grid--taxonomy {
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .cards-grid--taxonomy {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 960px) {
  .cards-grid--taxonomy {
    grid-template-columns: 1fr 1fr 1fr;
  }
}


/* =============================================================================
   8. CARD COMPONENT
   ============================================================================= */

.card {
  background: var(--cs-white);
  border: 1px solid var(--cs-rule);
  border-radius: var(--cs-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card a {
  text-decoration: none;
  color: inherit;
}

/* Featured image */
.card .field--name-field-featured-image img,
.card .views-field-field-featured-image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

/* Card body padding wrapper */
.card__body {
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Badges row */
.card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 0.6rem;
}

/* Internal field padding */
.card .views-field {
  padding: 0 1.25rem;
}

.card .views-field:first-child {
  padding: 0;
}

.card .views-field:last-child {
  padding-bottom: 1.25rem;
}

/* Title */
.card .views-field-title {
  font-family: var(--cs-font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.5rem;
  color: var(--cs-blue);
}

/* Standfirst (card context — compact size) */
.card .views-field-field-standfirst {
  font-size: 0.9rem;
  color: var(--cs-text-mid);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

/* Trimmed body */
.card .views-field-body {
  font-size: 0.875rem;
  color: #555;
  line-height: 1.5;
  margin-bottom: 0.75rem;
  flex: 1;
}

/* Date */
.card .views-field-field-date,
.card .views-field-field-date-published {
  font-size: 0.78rem;
  color: var(--cs-text-light);
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--cs-rule);
}

/* Helper class for 4-card grid title alignment */
.grid-4-card-title {
  min-height: 100px;
}

.grid-4-card {
  padding-left: 20px;
  padding-right: 20px;
}


/* =============================================================================
   9. BADGES
   ============================================================================= */

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  display: inline-block;
  line-height: 1.6;
}

.badge--type {
  background-color: var(--cs-blue);
  color: var(--cs-white);
}

.badge--topic {
  background-color: var(--cs-amber);
  color: var(--cs-white);
}


/* =============================================================================
   10. CONTENT FIELDS — STANDFIRST, IMAGE CAPTIONS, DATES
   ============================================================================= */

/* ── Standfirst (full article / node context) ──
   Note: card context standfirst is in Section 8 above.
   field-standfirst and field-standfirst1 are treated identically. */

div.field--name-field-standfirst,
div.field--name-field-standfirst1 {
  font-family: var(--cs-font-serif);
  font-size: 1.4rem;
  line-height: 2rem;
  color: #505050;
  padding-bottom: 30px;
  max-width: 90%;
}

div.field--name-field-standfirst p,
div.field--name-field-standfirst1 p {
  font-family: var(--cs-font-serif);
  font-size: 1.4rem;
  line-height: 2rem;
  color: #505050;
}

/* ── Image captions ── */

div.field--name-field-imagecaption {
  max-width: 560px;
  width: 100%;
}

div.field--name-field-featured-imagecaption p {
  font-family: var(--cs-font-sans);
  color: #999999;
  font-weight: 400;
  font-size: 1rem;
  margin-top: 10px;
  margin-bottom: 40px;
  line-height: 1.3;
}

/* ── Dates ── */

div.field.field--name-field-date.field--type-datetime.field--label-inline {
  font-family: var(--cs-font-sans);
  margin-top: 30px;
  margin-bottom: 20px;
}

div.field.field--name-field-date.field--type-datetime.field--label-hidden.field__item {
  font-family: var(--cs-font-sans);
  font-size: 1.1rem;
  font-weight: 400;
  color: #999;
  margin-top: 30px;
  margin-bottom: 20px;
}

.date-published {
  font-family: var(--cs-font-sans);
  font-size: 1rem;
  font-weight: 400;
  color: #999;
  margin-top: 30px;
  margin-bottom: 20px;
}

.date-published-view {
  font-family: var(--cs-font-sans);
  font-size: 1rem;
  font-weight: 400;
  color: #767e84;
  margin-top: 20px;
  margin-bottom: 10px;
}

div.field.field--name-field-date-updated {
  font-family: var(--cs-font-sans);
  font-size: 0.9rem;
  color: #999;
  margin-bottom: 20px;
}


/* =============================================================================
   11. UTILITIES & HELPERS
   ============================================================================= */

.text-serif {
  font-family: var(--cs-font-serif);
}

.standfirst {
  font-size: 1.1rem;
  color: var(--cs-text-mid);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.clearfix::after {
  content: '';
  display: table;
  clear: both;
}

.padding-l-r-10 {
  padding-left: 10px;
  padding-right: 10px;
}
.padding-l-r-5 {
  padding-left: 10px;
  padding-right: 10px;
}
.padding-l-r-2 {
  padding-left: 10px;
  padding-right: 10px;
}