/* =========================================================================
   GID Theme — main stylesheet
   Editorial, minimal magazine layout. Plain CSS, no frameworks.
   Mirrors the live globalimpactdeutschland.de design.
   ========================================================================= */

:root {
  --max-content: 740px;
  --max-wide: 1100px;
  --color-bg: #f1ede4;          /* warm cream background */
  --color-text: #1a1a1a;
  --color-muted: #6b6b6b;
  --color-border: #d8d2c6;      /* warm divider */
  --color-accent: #e8821e;      /* logo orange (used sparingly) */
  --font-heading: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-size-base: 18px;
  --line-height-body: 1.7;

  --space-gutter: 24px;
  --space-section: 64px;
}

/* -------------------------------------------------------------------------
   Reset / base
   ------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--color-text);
  /* German has long compound words; let them break rather than overflow. */
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

a {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: opacity 0.15s ease;
}

a:hover,
a:focus {
  opacity: 0.6;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

figure {
  margin: 0;
}

/* Accessibility helpers */

.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  word-wrap: normal !important;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  color: var(--color-text);
  padding: 12px 20px;
  border: 1px solid var(--color-border);
}

.skip-link:focus {
  left: 8px;
  top: 8px;
}

/* Section eyebrow heading: EMPFOHLEN / NEUESTE / WEITERLESEN */

.section-heading {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 0 0 24px;
  padding-top: 14px;
}

/* -------------------------------------------------------------------------
   Layout wrappers
   ------------------------------------------------------------------------- */

.content-wrap {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: var(--space-section) var(--space-gutter);
}

.home-wrap {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: var(--space-section) var(--space-gutter);
}

/* -------------------------------------------------------------------------
   Header — nav (left) · logo (centre) · search (right)
   ------------------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 22px var(--space-gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.site-nav {
  justify-self: start;
}

.site-branding {
  justify-self: center;
}

.site-tools {
  justify-self: end;
}

.site-branding .custom-logo-link {
  display: inline-block;
}

.site-branding .custom-logo {
  width: 200px;          /* logo at least 200px wide */
  max-width: 100%;
  height: auto;
}

.site-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--color-text);
}

.site-nav .nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 30px;
}

.site-nav .nav-menu a {
  font-family: var(--font-body);
  font-size: 1rem;
  text-decoration: none;
  color: var(--color-text);
}

.site-nav .nav-menu a:hover,
.site-nav .nav-menu a:focus,
.site-nav .nav-menu .current-menu-item > a {
  opacity: 1;
  text-decoration: underline;
}

/* Search toggle */

.site-tools {
  display: flex;
  align-items: center;
}

.search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
}

.search-toggle:hover,
.search-toggle:focus {
  opacity: 0.6;
}

.site-search {
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

.site-search__inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 18px var(--space-gutter);
}

.site-search .search-form {
  display: flex;
  gap: 10px;
}

.site-search .search-field {
  flex: 1;
  font: inherit;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text);
}

.site-search .search-submit {
  font: inherit;
  padding: 10px 18px;
  border: 1px solid var(--color-text);
  background: var(--color-text);
  color: var(--color-bg);
  cursor: pointer;
}

/* Mobile nav toggle — hidden on desktop */

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
  padding: 0;
}

.nav-toggle__bar,
.nav-toggle__bar::before,
.nav-toggle__bar::after {
  content: '';
  position: absolute;
  left: 8px;
  width: 24px;
  height: 2px;
  background: var(--color-text);
}

.nav-toggle__bar {
  top: 19px;
}

.nav-toggle__bar::before {
  top: -7px;
}

.nav-toggle__bar::after {
  top: 7px;
}

/* -------------------------------------------------------------------------
   Shared entry typography
   ------------------------------------------------------------------------- */

.entry-title a {
  text-decoration: none;
  color: var(--color-text);
}

.entry-title a:hover,
.entry-title a:focus {
  opacity: 1;
  text-decoration: underline;
}

.entry-date {
  display: block;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-top: 10px;
}

.entry-excerpt {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--color-text);
}

.entry-excerpt p {
  margin: 0;
}

/* -------------------------------------------------------------------------
   Homepage — featured hero
   ------------------------------------------------------------------------- */

.featured-hero {
  margin-bottom: var(--space-section);
  background: #fff;
  border: 1px solid var(--color-border);
}

/* With a featured image: image left fills its half to the full card height
   (cropped to fit), headline + snippet stacked right. */
.featured-hero--has-image {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}

.featured-hero__image {
  display: block;
  min-width: 0;
  height: 100%;
}

.featured-hero__image img {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
}

/* Text padding inside the card. With no image this block is the whole card
   and simply spans full width. */
.featured-hero__text {
  min-width: 0;
  padding: 44px 48px;
}

.featured-hero--has-image .featured-hero__text {
  align-self: center;
}

.entry-title--featured {
  font-size: 2.2rem;
  line-height: 1.1;
  margin: 0 0 16px;
}

.entry-excerpt--featured {
  font-size: 1.1rem;
  line-height: 1.55;
}

.entry-excerpt--featured + .entry-date {
  margin-top: 18px;
}

.featured-hero__more {
  margin: 22px 0 0;
}

/* -------------------------------------------------------------------------
   Homepage — recent: two most recent posts, two columns
   ------------------------------------------------------------------------- */

.home-recent {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-bottom: var(--space-section);
  padding-bottom: var(--space-section);
  border-bottom: 1px solid var(--color-border);
}

.card--recent .card__title {
  font-size: 1.35rem;
}

/* -------------------------------------------------------------------------
   Cards (secondary items, grids, related)
   ------------------------------------------------------------------------- */

.card {
  min-width: 0;
}

.card__image {
  display: block;
  margin-bottom: 14px;
}

.card__image img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.card__title {
  font-size: 1.2rem;
  line-height: 1.2;
  margin: 0;
}

.card--grid .card__title {
  font-size: 1.15rem;
}

.card__excerpt {
  margin-top: 10px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--color-text);
  /* clamp long excerpts so cards stay tidy */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card--secondary .card__title {
  font-size: 1.15rem;
}

/* -------------------------------------------------------------------------
   Homepage — NEUESTE grid
   ------------------------------------------------------------------------- */

.posts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 48px 36px;
}

/* Blog index ("News" page): simple repeating three-column grid. */
.posts-grid--blog {
  grid-template-columns: repeat(3, 1fr);
}

/* "Weitere Artikel" link under the NEUESTE grid. */
.home-neueste__more {
  margin: 48px 0 0;
}

.more-link {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-text);
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: 3px;
}

.more-link:hover,
.more-link:focus {
  opacity: 1;
  color: var(--color-accent);
}

/* -------------------------------------------------------------------------
   News page / archive — single-column list
   ------------------------------------------------------------------------- */

.post-list {
  display: flex;
  flex-direction: column;
}

.post-list__item {
  padding-bottom: 32px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--color-border);
}

.post-list__item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.entry-title--list {
  font-size: 1.6rem;
  margin: 0 0 4px;
}

.post-list__item .entry-excerpt {
  margin-top: 12px;
}

.entry-title--search span {
  color: var(--color-muted);
}

/* -------------------------------------------------------------------------
   Single post / page
   ------------------------------------------------------------------------- */

.content-wrap article.post {
  max-width: var(--max-content);
  margin: 0 auto;
}

.entry-header .entry-title {
  font-size: 2.5rem;
  line-height: 1.1;
  margin: 0 0 12px;
}

.entry-header .entry-date {
  margin-top: 0;
  margin-bottom: 8px;
}

.entry-featured-image {
  margin: 28px 0 32px;
}

.entry-content {
  font-size: 1.0625rem;
}

.entry-content p,
.entry-content ul,
.entry-content ol,
.entry-content blockquote,
.entry-content figure,
.entry-content pre {
  margin: 0 0 1.5em;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
  margin: 2em 0 0.6em;
}

.entry-content h2 {
  font-size: 1.6rem;
}

.entry-content h3 {
  font-size: 1.3rem;
}

.entry-content img {
  margin: 0 auto;
}

.entry-content blockquote {
  border-left: 3px solid var(--color-border);
  padding-left: 20px;
  color: var(--color-muted);
  font-style: italic;
}

/* -------------------------------------------------------------------------
   Share row (single post)
   ------------------------------------------------------------------------- */

.post-share {
  max-width: var(--max-content);
  margin: 40px auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 16px;
}

.post-share__label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.post-share__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.share-btn:hover,
.share-btn:focus {
  opacity: 1;
  color: var(--color-bg);
  background: var(--color-text);
  border-color: var(--color-text);
}

.share-btn__icon {
  flex: 0 0 auto;
}

.share-btn.is-copied {
  color: var(--color-bg);
  background: var(--color-accent);
  border-color: var(--color-accent);
}

/* -------------------------------------------------------------------------
   Weiterlesen (related posts on single)
   ------------------------------------------------------------------------- */

.weiterlesen {
  border-top: 1px solid var(--color-border);
}

.weiterlesen__inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: var(--space-section) var(--space-gutter);
}

.posts-grid--related {
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  align-items: start;
}

.card--lead .card__title {
  font-size: 1.5rem;
}

.card--lead .card__excerpt {
  -webkit-line-clamp: 3;
}

/* -------------------------------------------------------------------------
   Pagination
   ------------------------------------------------------------------------- */

.pagination {
  margin-top: var(--space-section);
  border-top: 1px solid var(--color-border);
  padding-top: 28px;
}

.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.pagination .page-numbers {
  display: inline-block;
  padding: 6px 12px;
  text-decoration: none;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.pagination .page-numbers.current {
  background: var(--color-text);
  color: var(--color-bg);
  border-color: var(--color-text);
}

.pagination .page-numbers.dots {
  border: 0;
}

.no-posts {
  color: var(--color-muted);
}

/* -------------------------------------------------------------------------
   Footer — logo (left) · nav (centre)
   ------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-section);
}

/* Three customizable footer widget columns. */
.site-footer__widgets {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: var(--space-section) var(--space-gutter) 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px;
}

/* Adapt the grid when fewer than three columns hold widgets. */
.site-footer__widgets[data-cols="1"] {
  grid-template-columns: 1fr;
}

.site-footer__widgets[data-cols="2"] {
  grid-template-columns: repeat(2, 1fr);
}

.footer-column {
  min-width: 0;
  text-align: center;
}

.footer-widget {
  margin-bottom: 28px;
}

.footer-widget:last-child {
  margin-bottom: 0;
}

.footer-widget__title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 0 0 16px;
}

.footer-widget ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-widget li {
  margin-bottom: 10px;
}

.footer-widget a {
  text-decoration: none;
  color: var(--color-text);
}

.footer-widget a:hover,
.footer-widget a:focus {
  text-decoration: underline;
}

.site-footer__inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 40px var(--space-gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}

.site-footer__branding {
  justify-self: start;
}

.site-footer__branding .custom-logo {
  width: 150px;
  max-width: 100%;
  height: auto;
}

.site-footer__nav {
  justify-self: center;
}

.site-footer__spacer {
  justify-self: end;
}

.site-footer__nav .footer-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 24px;
}

.site-footer__nav a {
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--color-text);
}

.site-footer__nav a:hover,
.site-footer__nav a:focus {
  opacity: 0.6;
}

/* -------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------- */

/* Tablet: collapse multi-column grids to two columns. */
@media (max-width: 1024px) {
  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 40px 32px;
  }

  .posts-grid--blog {
    grid-template-columns: repeat(2, 1fr);
  }

  .posts-grid--related {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Keep the related lead card from forcing a lopsided first column. */
  .posts-grid--related .card--lead {
    grid-column: 1 / -1;
  }

  .featured-hero--has-image {
    gap: 36px;
  }

  .site-footer__widgets,
  .site-footer__widgets[data-cols="2"] {
    grid-template-columns: repeat(2, 1fr);
    gap: 36px;
  }
}

/* Small tablet / large phone: stack the hero and two-up recent row. */
@media (max-width: 768px) {
  .featured-hero--has-image {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  /* Stacked: the image sits on top, so show it at a clean 16:9 instead of
     stretching to an undefined row height. */
  .featured-hero--has-image .featured-hero__image,
  .featured-hero--has-image .featured-hero__text {
    align-self: stretch;
  }

  .featured-hero__image img {
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .home-recent {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .entry-title--featured {
    font-size: 2.2rem;
  }
}

/* Mobile: single column everywhere, stacked nav. */
@media (max-width: 640px) {
  :root {
    --space-section: 40px;
  }

  .site-header__inner {
    grid-template-columns: auto 1fr auto;
  }

  .nav-toggle {
    display: block;
  }

  .site-nav .nav-menu {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 50;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 8px var(--space-gutter) 16px;
  }

  .site-header {
    position: relative;
  }

  .site-nav.is-open .nav-menu {
    display: flex;
  }

  .site-nav .nav-menu li {
    width: 100%;
    padding: 8px 0;
  }

  .site-branding .custom-logo {
    width: 170px;
  }

  .posts-grid,
  .posts-grid--blog,
  .posts-grid--related {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .featured-hero__text {
    padding: 28px 24px;
  }

  .entry-title--featured {
    font-size: 1.9rem;
  }

  .entry-excerpt--featured {
    font-size: 1.05rem;
  }

  .entry-header .entry-title {
    font-size: 1.9rem;
  }

  .entry-title--list {
    font-size: 1.35rem;
  }

  .site-footer__widgets,
  .site-footer__widgets[data-cols="2"],
  .site-footer__widgets[data-cols="3"] {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }

  .site-footer__inner {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 20px;
  }

  .site-footer__branding,
  .site-footer__nav {
    justify-self: center;
  }

  .site-footer__spacer {
    display: none;
  }
}
