/* =============================================================================
   Aeberli Digital — News & Blog stylesheet
   Used by /news.php (index) and /news-template.php (single article).
   Builds on colors_and_type.css tokens (--ad-red, --ad-paper, etc.).
   ============================================================================= */

/* =============================================================================
   INDEX PAGE — quiet magazine layout mirroring aeberli.ch/de/news:
   restrained masthead + two-column staggered card grid.
   ============================================================================= */

/* Local content variables — scoped to .kx-body so they don't leak to the
   header/footer chrome (which keep using the global --ad-wrap from site.css).
   --kx-wrap controls the news content lane only. */
.kx-body {
  background: var(--ad-paper);
  --kx-wrap: 1440px;
  --kx-wrap-pad: clamp(1.5rem, 5vw, 4rem);
}
.kx-body main { max-width: none; }
.kx-wrap {
  max-width: var(--kx-wrap);
  margin: 0 auto;
  padding: 0 var(--kx-wrap-pad);
}

/* ── Masthead — quiet title block ─────────────────────────────────────────── */
.kx-mast {
  padding: clamp(3rem, 6vw, 5rem) 0 clamp(2.5rem, 5vw, 4rem);
}
.kx-mast__title {
  font-size: clamp(2.4rem, 5.5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -.028em;
  line-height: 1.05;
  margin: 0;
  color: var(--ad-fg);
}
.kx-mast__title em {
  font-family: var(--ad-serif-italic);
  font-style: italic;
  font-weight: 400;
  color: var(--ad-red);
}

/* ── Three-column card grid — matches aeberli.ch/de/news exactly ─────────── */
.kx-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.25rem, 2.5vw, 2rem);
  padding-bottom: clamp(3rem, 6vw, 6rem);
}
@media (max-width: 980px) { .kx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kx-grid { grid-template-columns: 1fr; } }

/* Each card is its own light-grey container (matches the #f8f8f8 blocks
   on aeberli.ch). Image goes edge-to-edge at the top; padded content
   sits below. */
.kx-card {
  display: flex; flex-direction: column;
  background: #f8f8f8;
  transition: background var(--ad-dur, .3s) var(--ad-ease, ease);
}
.kx-card:hover { background: #f2f2f2; }

.kx-card__img {
  display: block;
  overflow: hidden;
  background: #eee;
  transition: opacity var(--ad-dur, .3s) var(--ad-ease, ease);
}
.kx-card__img:hover { opacity: .92; }
.kx-card__img img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: cover;
}

.kx-card__body {
  display: flex; flex-direction: column; flex: 1;
  padding: clamp(1.25rem, 2vw, 1.75rem);
}
.kx-card__rule {
  display: block;
  width: 42px; height: 1px;
  background: var(--ad-red);
  margin-bottom: 1rem;
}
.kx-card__date {
  font-size: .82rem;
  color: var(--ad-fg-2);
  margin: 0 0 .75rem;
  font-variant-numeric: tabular-nums;
}
.kx-card__title {
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.3;
  margin: 0 0 1rem;
  text-wrap: balance;
}
.kx-card__title a {
  color: var(--ad-fg);
  text-decoration: none;
  transition: color var(--ad-dur, .3s) var(--ad-ease, ease);
}
.kx-card__title a:hover { color: var(--ad-red); }
.kx-card__excerpt {
  font-size: .92rem;
  line-height: 1.6;
  color: var(--ad-fg-2);
  margin: 0 0 1.5rem;
}
.kx-card__more {
  display: inline-flex; align-items: center; gap: .75rem;
  color: var(--ad-red);
  text-decoration: none;
  font-size: .95rem;
  align-self: flex-start;
  margin-top: auto;   /* pushes the CTA to the bottom regardless of copy length */
}
.kx-card__more em {
  font-family: var(--ad-serif-italic);
  font-style: italic;
  font-weight: 400;
}
.kx-card__more-rule {
  display: block;
  width: 28px; height: 1px;
  background: var(--ad-red);
  transition: width var(--ad-dur, .3s) var(--ad-ease, ease);
}
.kx-card__more:hover .kx-card__more-rule { width: 44px; }

/* ── No-posts empty state ─────────────────────────────────────────────────── */
.kx-empty {
  max-width: var(--kx-wrap);
  margin: 0 auto;
  padding: clamp(4rem, 8vw, 7rem) var(--kx-wrap-pad);
  text-align: center;
  color: var(--ad-fg-2);
  font-family: var(--ad-sans);
}
.kx-empty .big {
  font-family: var(--ad-serif-italic);
  font-style: italic;
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--ad-fg-3, #b8b3ad);
  margin: 0 0 1rem;
}

/* ── Single-post page ─────────────────────────────────────────────────────── */

.nb-post {
  padding: clamp(2rem, 4vw, 3rem) 0 clamp(3rem, 5vw, 5rem);
}

.nb-post-back {
  margin-bottom: 1.5rem;
}
.nb-post-back a {
  font-size: .85rem; color: var(--ad-muted); text-decoration: none;
}
.nb-post-back a:hover { color: var(--ad-red); }

.nb-post-header {
  max-width: 100%;   /* left-aligned; sits above the 2-col layout */
  margin: 0 0 2.5rem;
}
.nb-post-tags {
  display: flex; flex-wrap: wrap; gap: .35rem;
  margin-bottom: 1.5rem;
}
.nb-tag-chip {
  display: inline-block;
  font-size: .68rem; font-weight: 600;
  letter-spacing: var(--ad-track-mini); text-transform: uppercase;
  color: var(--ad-fg-2);
  padding: .3rem .65rem;
  border: 1px solid var(--ad-border);
  border-radius: var(--ad-radius-pill);
  background: #fff;
  text-decoration: none;
}
.nb-tag-chip:hover { border-color: var(--ad-red); color: var(--ad-red); }
.nb-tag-chip--layout {
  background: rgba(218,41,28,.06);
  border-color: rgba(218,41,28,.25);
  color: var(--ad-red);
}

.nb-block-h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  font-weight: 700; line-height: 1.08;
  letter-spacing: var(--ad-track-tight);
  color: var(--ad-fg);
  margin: 0 0 1.25rem;
}
.nb-block-h1 em {
  font-family: var(--ad-serif-italic); font-style: italic;
  font-weight: 400; color: var(--ad-red);
}

.nb-block-p {
  font-size: 1.02rem; line-height: 1.75;
  color: var(--ad-fg-2);
  margin: 0 0 1.25rem;
}
.nb-block-p--lead {
  font-size: 1.2rem; line-height: 1.65;
  color: var(--ad-fg-2);
  margin-bottom: 2rem;
}

.nb-post-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: .6rem;
  font-size: .85rem; color: var(--ad-muted);
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--ad-border);
}
.nb-author { font-weight: 500; color: var(--ad-fg-2); }
.nb-author__name { color: var(--ad-fg); font-weight: 600; }

/* Hero image — stays inside the article column, scales fluidly, keeps
   its native aspect ratio. Was previously "full-bleed" via negative
   `calc(50% - 50vw)` margins which overflowed on browsers whose 100vw
   includes the scrollbar, clipping the right edge of the image. */
.nb-block-hero-fullbleed {
  width: 100%;
  max-width: 100%;
  margin: 0 0 2.5rem;
  background: var(--ad-paper-2);
  border-radius: var(--ad-radius-1);
  overflow: hidden;
  /* Titelbild immer vollständig zeigen (Banner wie „UP|DATE“ nicht beschneiden):
     eigenes Seitenverhältnis, Hoch-/Quadratformate höchstens 720 px hoch und mittig */
  display: flex; justify-content: center; align-items: center;
}
.nb-block-hero-fullbleed img {
  width: 100%;
  height: auto;
  max-height: 720px;
  object-fit: contain;
  display: block;
}

/* ── Two-column layout: main article + right sidebar ─────────────────────── */
.nb-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
@media (max-width: 960px) {
  .nb-layout { grid-template-columns: 1fr; }
}
.nb-main { min-width: 0; }
.nb-side { min-width: 0; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.nb-side__block {
  background: #f8f8f8;
  padding: clamp(1.25rem, 2vw, 1.5rem);
  margin-bottom: 1.25rem;
}
.nb-side__title {
  font-size: 1rem; font-weight: 700; letter-spacing: -.005em;
  color: var(--ad-fg);
  margin: 0 0 1rem;
}

/* Related posts list */
.nb-related { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1rem; }
.nb-related__link {
  display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: .85rem;
  text-decoration: none; color: inherit; align-items: center;
}
.nb-related__thumb {
  width: 68px; height: 68px;
  background-size: cover; background-position: center;
  background-color: #eee;
  flex-shrink: 0;
}
.nb-related__body { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.nb-related__title {
  font-size: .88rem; font-weight: 600; line-height: 1.35;
  color: var(--ad-fg);
  transition: color var(--ad-dur, .3s) var(--ad-ease, ease);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.nb-related__link:hover .nb-related__title { color: var(--ad-red); }
.nb-related__date { font-size: .74rem; color: var(--ad-fg-2); font-variant-numeric: tabular-nums; }

/* Tag cloud */
.nb-side__tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.nb-side__tag {
  display: inline-block;
  font-size: .7rem; font-weight: 500;
  color: var(--ad-fg-2);
  padding: .3rem .65rem;
  border: 1px solid var(--ad-border);
  border-radius: var(--ad-radius-pill);
  background: #fff;
}
.nb-side__tag--cat { color: var(--ad-red); border-color: rgba(218,41,28,.35); background: rgba(218,41,28,.06); }

/* Share icons */
.nb-share { display: flex; gap: .5rem; }
.nb-share__link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: #fff;
  border: 1px solid var(--ad-border);
  color: var(--ad-fg-2);
  text-decoration: none;
  transition: all var(--ad-dur, .25s) var(--ad-ease, ease);
}
.nb-share__link:hover { background: var(--ad-red); border-color: var(--ad-red); color: #fff; }

/* Body content — was centered with max-width: 70ch; now left-aligned in
   the main column with a slightly wider measure since the sidebar takes
   ~320px on the right. */
.nb-measure {
  max-width: 78ch;
  font-size: 1.05rem; line-height: 1.75;
  color: var(--ad-fg-2);
}
.nb-measure h2 {
  font-size: 1.65rem; font-weight: 700;
  letter-spacing: var(--ad-track-snug);
  color: var(--ad-fg);
  margin: 2.25rem 0 1rem;
  padding-top: .75rem;
}
.nb-measure h3 {
  font-size: 1.25rem; font-weight: 700;
  color: var(--ad-fg);
  margin: 1.75rem 0 .85rem;
}
.nb-measure p {
  margin: 0 0 1.25rem;
}
.nb-measure a {
  color: var(--ad-red); text-decoration: underline;
  text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.nb-measure a:hover { text-decoration-thickness: 2px; }
.nb-measure strong { color: var(--ad-fg); font-weight: 600; }
.nb-measure em { font-style: italic; }
.nb-measure ul, .nb-measure ol {
  margin: 0 0 1.25rem; padding-left: 1.4rem;
}
.nb-measure li { margin: .35rem 0; }
.nb-measure blockquote {
  margin: 2rem 0; padding: 1rem 1.25rem;
  border-left: 3px solid var(--ad-red);
  background: var(--ad-paper-2);
  font-family: var(--ad-serif-italic); font-style: italic;
  font-size: 1.15rem; line-height: 1.6; color: var(--ad-fg);
}
.nb-measure img {
  max-width: 100%; height: auto; display: block;
  margin: 1.5rem 0;
  border-radius: var(--ad-radius-1);
}

/* ── Layout-specific tweaks ───────────────────────────────────────────────────
   Each .nb-layout-* hook lets us style the same article markup differently
   depending on the editor's choice. Kept minimal here — refine per template
   in future iterations.
   ──────────────────────────────────────────────────────────────────────────── */

/* Press release: tighter, more sober */
.nb-layout-press .nb-block-h1 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
.nb-layout-press .nb-block-p--lead { font-size: 1.05rem; }
.nb-layout-press .nb-block-hero-fullbleed { display: none; }

/* Announcement: centered, condensed */
.nb-layout-announcement .nb-post-header { text-align: center; }
.nb-layout-announcement .nb-post-tags { justify-content: center; }
.nb-layout-announcement .nb-post-meta { justify-content: center; }

/* Photo-essay: image-first, smaller text */
.nb-layout-photo-essay .nb-block-hero-fullbleed { height: clamp(360px, 65vh, 720px); }

/* Tutorial: tighter, code-friendly measure */
.nb-layout-tutorial .nb-measure { max-width: 75ch; }
.nb-layout-tutorial .nb-measure h2 {
  font-size: 1.4rem;
  color: var(--ad-red);
  font-family: var(--ad-sans);
}

/* Interview: lead text larger, body italic-friendly */
.nb-layout-interview .nb-block-p--lead { font-size: 1.3rem; }
.nb-layout-interview .nb-measure h2 {
  font-size: 1.3rem;
  color: var(--ad-red);
}

/* Case study: stronger lead emphasis */
.nb-layout-case .nb-block-p--lead {
  border-left: 3px solid var(--ad-red);
  padding-left: 1.25rem;
}

/* Editorial: default, no overrides needed */


/* =============================================================================
   STRUCTURED LAYOUT BLOCKS — rendered when article.layoutData is set
   ============================================================================= */

/* ── Podcast ──────────────────────────────────────────────────────────────── */
.nb-pod { margin-bottom: 2rem; }
.nb-pod__player {
  width: 100%; display: block;
  margin-bottom: 1.25rem;
  border-radius: var(--ad-radius-1);
  background: var(--ad-paper-2);
}
.nb-pod__embed {
  position: relative;
  aspect-ratio: 16 / 5;
  border-radius: var(--ad-radius-1);
  overflow: hidden;
  margin-bottom: 1.25rem;
  background: var(--ad-paper-2);
}
.nb-pod__embed iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%; border: 0;
}
.nb-pod__meta,
.nb-vid__meta,
.nb-tut__meta {
  display: flex; flex-wrap: wrap; gap: 1.5rem;
  margin: 0 0 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--ad-paper-2);
  border-radius: var(--ad-radius-1);
  border-left: 3px solid var(--ad-red);
}
.nb-pod__meta div,
.nb-vid__meta div,
.nb-tut__meta div { min-width: 0; }
.nb-pod__meta dt,
.nb-vid__meta dt,
.nb-tut__meta dt {
  font-size: .65rem; font-weight: 600;
  letter-spacing: var(--ad-track-eyebrow); text-transform: uppercase;
  color: var(--ad-muted);
  margin: 0 0 .15rem;
}
.nb-pod__meta dd,
.nb-vid__meta dd,
.nb-tut__meta dd {
  font-size: 1rem; font-weight: 600;
  color: var(--ad-fg);
  margin: 0;
}
.nb-pod__meta dd span,
.nb-vid__meta dd span {
  font-weight: 400; color: var(--ad-muted);
}
.nb-pod__bio {
  margin: 0;
  font-size: .95rem; color: var(--ad-fg-2);
  line-height: 1.6;
  font-style: italic;
}

/* ── Video / Talk ─────────────────────────────────────────────────────────── */
.nb-vid { margin-bottom: 2rem; }
.nb-vid__embed {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--ad-radius-1);
  overflow: hidden;
  margin-bottom: 1.25rem;
  background: #000;
}
.nb-vid__embed iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%; border: 0;
}

/* ── Case study ───────────────────────────────────────────────────────────── */
.nb-case__client {
  margin: 0 auto 1.5rem;
  max-width: 70ch;
  font-size: .95rem; color: var(--ad-fg-2);
}
.nb-case__kpis {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 0 auto 2.5rem;
  max-width: 70ch;
}
@media (max-width: 720px) {
  .nb-case__kpis { grid-template-columns: 1fr; }
}
.nb-case__kpi {
  background: #fff;
  border: 1px solid var(--ad-border);
  border-radius: var(--ad-radius-1);
  padding: 1.25rem 1.1rem;
  text-align: center;
}
.nb-case__kpi-value {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  color: var(--ad-red);
  letter-spacing: -.02em;
  margin-bottom: .25rem;
  font-feature-settings: "tnum";
}
.nb-case__kpi-label {
  font-size: .82rem;
  color: var(--ad-muted);
  line-height: 1.4;
}
.nb-case__quote {
  margin: 2.5rem auto 1.5rem !important;
  max-width: 70ch;
  padding: 1.5rem 1.75rem !important;
  background: var(--ad-paper-2) !important;
  border-left: 3px solid var(--ad-red);
  font-family: var(--ad-serif-italic) !important;
  font-style: italic !important;
  font-size: 1.2rem !important;
  line-height: 1.55 !important;
  color: var(--ad-fg) !important;
  border-radius: 0 var(--ad-radius-1) var(--ad-radius-1) 0;
  position: relative;
}
.nb-case__quote cite {
  display: block;
  margin-top: .85rem;
  font-family: var(--ad-sans);
  font-style: normal;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ad-muted);
}

/* ── Interview Q&A ────────────────────────────────────────────────────────── */
.nb-interview__who {
  margin: 1.5rem 0 .5rem !important;
  font-size: .95rem;
  color: var(--ad-muted);
}
.nb-interview__who strong { color: var(--ad-fg); }
.nb-qa { margin: 1.5rem 0 2rem; }
.nb-qa__pair {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--ad-border);
}
.nb-qa__pair:last-child {
  border-bottom: 0; padding-bottom: 0;
}
.nb-qa__q {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ad-red);
  margin: 0 0 .65rem !important;
  line-height: 1.4;
}
.nb-qa__q::before {
  content: "F: ";
  font-family: var(--ad-serif-italic);
  font-style: italic;
  font-weight: 400;
}
.nb-qa__a {
  font-size: 1rem;
  color: var(--ad-fg-2);
  line-height: 1.7;
  margin: 0 !important;
}
.nb-qa__a::before {
  content: "A: ";
  font-family: var(--ad-serif-italic);
  font-style: italic;
  font-weight: 400;
  color: var(--ad-red);
}

/* ── Tutorial steps ───────────────────────────────────────────────────────── */
.nb-tut__meta {
  max-width: 75ch;
  margin: 0 auto 1.5rem !important;
}
.nb-steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 1.5rem 0 0;
}
.nb-steps__item {
  counter-increment: step;
  position: relative;
  padding: 1.25rem 1.25rem 1.25rem 4rem;
  background: #fff;
  border: 1px solid var(--ad-border);
  border-radius: var(--ad-radius-1);
  margin-bottom: 1rem;
}
.nb-steps__item::before {
  content: counter(step);
  position: absolute;
  top: 1.25rem; left: 1rem;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--ad-red);
  color: #fff;
  font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-feature-settings: "tnum";
}
.nb-steps__title {
  margin: 0 0 .35rem !important;
  font-size: 1.15rem;
  color: var(--ad-fg);
  line-height: 1.35;
  letter-spacing: -.005em;
}
.nb-steps__body {
  margin: 0 !important;
  color: var(--ad-fg-2);
  line-height: 1.6;
  font-size: .95rem;
}

/* ── Photo-essay gallery ──────────────────────────────────────────────────── */
.nb-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}
.nb-gallery__item {
  margin: 0;
  background: var(--ad-paper-2);
  border-radius: var(--ad-radius-1);
  overflow: hidden;
}
.nb-gallery__item img {
  width: 100%; height: auto; display: block;
  border-radius: 0 !important;
  margin: 0 !important;
}
.nb-gallery__item figcaption {
  padding: .75rem 1rem;
  font-size: .82rem;
  color: var(--ad-muted);
  font-style: italic;
  line-height: 1.4;
}

/* ── Announcement highlight ───────────────────────────────────────────────── */
.nb-announce__hl {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 1rem;
  text-align: inherit;
}
.nb-layout-announcement .nb-announce__hl {
  text-align: center;
}
