/* =========================================================================
   Phlux — Editorial Ghost Theme by Philipp Magnus Koch
   Domine + Roboto · 9 color themes · Light/Dark mode · Configurable radius
   ========================================================================= */

/* -----  0. Local font-face declarations  ------------------------------- */
/* Fonts are self-hosted under assets/fonts/ for GDPR compliance, faster
   loading and independence from Google's CDN. Both fonts are licensed
   under SIL Open Font License (OFL), self-hosting is permitted.
   See assets/fonts/README.md for required font files. */

@font-face {
  font-family: "Domine";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/domine-variable.woff2") format("woff2");
}

@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("../fonts/roboto-variable.woff2") format("woff2");
}

@font-face {
  font-family: "Roboto";
  font-style: italic;
  font-weight: 300 900;
  font-display: swap;
  src: url("../fonts/roboto-italic-variable.woff2") format("woff2");
}

/* -----  1. Design Tokens & Theme Variables  ---------------------------- */
:root {
  /* Theme defaults: Domine for headings, Roboto for body.
     Ghost admin font selection (when not "Theme default") overrides via the
     --gh-font-* variables, which default.hbs sets only if non-empty. */
  --font-heading: var(--gh-font-heading, "Domine", "Iowan Old Style", Georgia, serif);
  --font-body: var(--gh-font-body, "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif);

  /* Default theme: Light (zinc palette) */
  --base: #09090b;
  --base-50: #fafafa;
  --base-100: #eeeeee;
  --base-200: #e2e2e2;
  --base-300: #d2d2d2;
  --base-400: #aaaaaa;
  --base-500: #818183;
  --base-600: #59595b;
  --base-700: #313133;
  --base-800: #212123;
  --base-900: #151517;
  --base-950: #09090b;

  --accent: var(--base);

  --bg: #ffffff;
  --bg-100: var(--base-100);
  --bg-200: var(--base-200);
  --heading: var(--base-950);
  --text: var(--base-950);
  --submenu: var(--base-950);
  --submenu-text: #ffffff;
  --footer: var(--base-950);
  --footer-heading: #ffffff;
  --footer-text: #ffffff;
  --footer-btn: #ffffff;
  --footer-btn-text: var(--base-950);
  --btn: var(--base-950);
  --btn-text: #ffffff;
  --border: var(--base-100);
  --link: currentColor;
  --contrast: #ffffff;
  --radius: 0;
  --btn-radius: 0;

  --transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  /* Semantic accent colors used by Callout cards and CTA cards.
     Defined once at root, used by both card types for consistency.
     Dark mode overrides further down (search ":root.dark"). */
  --c-blue-bg: rgba(59, 130, 246, 0.1);
  --c-blue-text: rgb(30, 65, 180);
  --c-green-bg: rgba(16, 185, 129, 0.1);
  --c-green-text: rgb(16, 110, 80);
  --c-yellow-bg: rgba(250, 204, 21, 0.15);
  --c-yellow-text: rgb(133, 100, 4);
  --c-red-bg: rgba(239, 68, 68, 0.1);
  --c-red-text: rgb(180, 30, 30);
  --c-pink-bg: rgba(236, 72, 153, 0.1);
  --c-pink-text: rgb(180, 40, 110);
  --c-purple-bg: rgba(168, 85, 247, 0.1);
  --c-purple-text: rgb(110, 40, 200);
}

/* Dark mode overrides for semantic accent colors (Callout + CTA share these) */
:root.dark {
  --c-blue-bg: rgba(59, 130, 246, 0.18);
  --c-blue-text: rgb(140, 175, 240);
  --c-green-bg: rgba(16, 185, 129, 0.15);
  --c-green-text: rgb(110, 220, 175);
  --c-yellow-bg: rgba(250, 204, 21, 0.18);
  --c-yellow-text: rgb(220, 180, 60);
  --c-red-bg: rgba(239, 68, 68, 0.18);
  --c-red-text: rgb(240, 130, 130);
  --c-pink-bg: rgba(236, 72, 153, 0.18);
  --c-pink-text: rgb(240, 140, 190);
  --c-purple-bg: rgba(168, 85, 247, 0.18);
  --c-purple-text: rgb(200, 150, 240);
}

/* Theme: Default — inherits Light palette, but uses the Ghost accent
   color (set in Brand admin) for buttons, links and accent surfaces.
   Falls back to Phlux black if no accent color is set. */
:root[data-theme="Default"] {
  --accent: var(--accent-color, #09090b);
  --link: var(--accent);
  --btn: var(--accent);
  --btn-text: #ffffff;
  --footer: var(--accent);
  --footer-heading: #ffffff;
  --footer-text: #ffffff;
  --footer-btn: #ffffff;
  --footer-btn-text: var(--accent);
}

/* Theme: Default — Dark mode override */
:root[data-theme="Default"].dark {
  --bg: #0e0e0e;
  --bg-100: #181818;
  --bg-200: #232323;
  --heading: #fafafa;
  --text: #fafafa;
  --footer: var(--accent);
  --footer-heading: #ffffff;
  --footer-text: #ffffff;
  --footer-btn: #ffffff;
  --footer-btn-text: var(--accent);
  --btn: var(--accent);
  --btn-text: #ffffff;
  --border: #232323;
}

/* Theme: Beige */
:root[data-theme="Beige"] {
  --base: #121212;
  --base-50: #fbf7f0;
  --base-100: #efece5;
  --base-200: #e4e0da;
  --base-300: #d4d1cb;
  --base-400: #adaba6;
  --base-500: #878581;
  --base-600: #605e5c;
  --base-700: #393837;
  --base-800: #292928;
  --base-900: #1e1d1d;
  --base-950: #121212;
  --bg: var(--base-50);
  --bg-100: var(--base-100);
  --bg-200: var(--base-200);
  --heading: var(--base-950);
  --text: var(--base-950);
  --footer: var(--base-950);
  --border: var(--base-100);
}

/* Theme: Green */
:root[data-theme="Green"] {
  --base: #35503e;
  --base-50: #fffef3;
  --base-100: #f3f2e8;
  --base-200: #e7e6dc;
  --base-300: #d7d6cd;
  --base-400: #aeafa7;
  --base-500: #868781;
  --base-600: #5e5f5c;
  --base-700: #353836;
  --base-800: #252827;
  --base-900: #191c1b;
  --base-950: #0d1010;
  --accent: var(--base);
  --bg: var(--base-50);
  --heading: var(--base);
  --text: var(--base);
  --submenu: var(--base);
  --footer: var(--base);
  --btn: var(--base);
  --border: var(--base-100);
}

/* Theme: Blue */
:root[data-theme="Blue"] {
  --base: #174fff;
  --base-50: #f4f3f2;
  --base-100: #e8e7e7;
  --base-200: #dddcdb;
  --base-300: #cdcccc;
  --base-400: #a6a5a7;
  --base-500: #7e7e81;
  --base-600: #57585b;
  --base-700: #303136;
  --base-800: #212127;
  --base-900: #15161b;
  --base-950: #090a10;
  --accent: var(--base);
  --bg: var(--base-50);
  --heading: var(--base);
  --text: var(--base);
  --submenu: var(--base);
  --footer: var(--base);
  --btn: var(--base);
  --border: var(--base-100);
}

/* Theme: Orange */
:root[data-theme="Orange"] {
  --base: #ff4600;
  --base-50: #f9f5f0;
  --base-100: #ede9e4;
  --base-200: #e0ddd8;
  --base-300: #d0ccc8;
  --base-400: #a6a3a0;
  --base-500: #7c7a78;
  --base-600: #535250;
  --base-700: #2a2928;
  --base-800: #191918;
  --base-900: #0c0c0c;
  --base-950: #000;
  --accent: var(--base);
  --bg: var(--base-50);
  --heading: var(--base);
  --text: var(--base);
  --submenu: var(--base);
  --footer: var(--base);
  --btn: var(--base);
  --border: var(--base-100);
}

/* Theme: Red */
:root[data-theme="Red"] {
  --base: #eb0000;
  --base-50: #fffcf5;
  --base-100: #f2efe9;
  --base-200: #e6e3dd;
  --base-300: #d5d2cc;
  --base-400: #aaa8a3;
  --base-500: #807e7a;
  --base-600: #555452;
  --base-700: #2b2a29;
  --base-800: #1a1919;
  --base-900: #0d0d0c;
  --base-950: #000;
  --accent: var(--base);
  --bg: var(--base-50);
  --heading: var(--base);
  --text: var(--base);
  --submenu: var(--base);
  --footer: var(--base);
  --btn: var(--base);
  --border: var(--base-100);
}

/* Theme: Wood */
:root[data-theme="Wood"] {
  --base: #4a382b;
  --base-50: #fefbf4;
  --base-100: #f2efe9;
  --base-200: #e6e3dd;
  --base-300: #d6d4ce;
  --base-400: #aeaca7;
  --base-500: #878581;
  --base-600: #5f5d5b;
  --base-700: #373634;
  --base-800: #272625;
  --base-900: #1b1a1a;
  --base-950: #0f0e0e;
  --accent: var(--base);
  --bg: var(--base-50);
  --heading: var(--base);
  --text: var(--base);
  --submenu: var(--base);
  --footer: var(--base);
  --btn: var(--base);
  --border: var(--base-100);
}

/* Dark mode (toggleable on every theme) */
:root.dark {
  --bg: var(--base-900);
  --bg-100: var(--base-800);
  --bg-200: var(--base-700);
  --heading: var(--base-50);
  --text: var(--base-50);
  --submenu: var(--base-800);
  --submenu-text: var(--base-50);
  --footer: var(--base-950);
  --footer-heading: var(--base-50);
  --footer-text: var(--base-50);
  --footer-btn: var(--base-50);
  --footer-btn-text: var(--base-950);
  --btn: var(--base-50);
  --btn-text: var(--base-900);
  --border: var(--base-800);
}

/* Theme is forced to Dark — always dark, no toggle */
:root[data-theme="Dark"] {
  --bg: #0e0e0e;
  --bg-100: #181818;
  --bg-200: #232323;
  --heading: #fafafa;
  --text: #fafafa;
  --submenu: #181818;
  --submenu-text: #fafafa;
  --footer: #000000;
  --footer-heading: #fafafa;
  --footer-text: #fafafa;
  --footer-btn: #fafafa;
  --footer-btn-text: #0e0e0e;
  --btn: #fafafa;
  --btn-text: #0e0e0e;
  --border: #232323;
}

/* Radius: single setting that controls both card-radius and button-radius.
   None = sharp everything. Small/Medium = matching gentle rounding.
   Large = rounded cards + pill-shaped buttons (pill-shaped). */
:root[data-radius="Small"] {
  --radius: 0.25rem;
  --btn-radius: 0.25rem;
}
:root[data-radius="Medium"] {
  --radius: 0.5rem;
  --btn-radius: 0.5rem;
}
:root[data-radius="Large"] {
  --radius: 0.75rem;
  --btn-radius: 9999px;
}

/* -----  2. Reset & Baseline  -------------------------------------------- */
*, *::before, *::after { border: 0 solid; box-sizing: border-box; }

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
  /* Mobile horizontal-scroll safety net: clip on both html AND body
     because some browsers only respect it on one of them. */
  overflow-x: clip;
}

body {
  margin: 0;
  line-height: inherit;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition), color var(--transition);
  /* Safety net only — the structural fix is .canvas sitting outside .container.
     `clip` is preferred over `hidden` because it doesn't create a new
     scroll container or break position: sticky descendants. */
  overflow-x: clip;
}

a { color: inherit; text-decoration: inherit; }

button {
  color: inherit;
  font-family: inherit;
  font-size: 100%;
  font-weight: inherit;
  line-height: inherit;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dd, dl, hr, pre { margin: 0; }
ul, ol, menu { list-style: none; margin: 0; padding: 0; }
img, svg, video, canvas { display: block; vertical-align: middle; max-width: 100%; }
img { height: auto; }

::selection { background: var(--accent); color: var(--contrast); }

/* Keyboard focus indicator (WCAG 2.4.7).
   Only shown for keyboard navigation (focus-visible), never on mouse click.
   3px solid outline + 2px offset for high visibility against any background. */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* -----  3. Container + Canvas Grid (5-column subgrid) ----------------- */
.container {
  margin-left: auto;
  margin-right: auto;
  max-width: calc(1536px + 6rem);
  padding-left: 1rem;
  padding-right: 1rem;
  width: 100%;
}

@media (min-width: 640px) {
  .container { padding-left: 1.5rem; padding-right: 1.5rem; }
}

@media (min-width: 1024px) {
  .container { padding-left: 3rem; padding-right: 3rem; }
}

.canvas {
  --padding: 1rem;
  --main: min(640px, 100% - var(--padding) * 2);
  --wide: minmax(0, calc((1536px - var(--main)) / 2));
  --full: minmax(var(--padding), 1fr);
  display: grid;
  grid-template-columns:
    [full-start] var(--full)
    [wide-start] var(--wide)
    [main-start] var(--main)
    [main-end] var(--wide)
    [wide-end] var(--full)
    [full-end];
  max-width: 100%;
  width: 100%;
  /* Prevent oversized children from making the grid wider than its parent */
  overflow-x: clip;
}

@media (min-width: 640px) { .canvas { --padding: 1.5rem; } }
@media (min-width: 1024px) { .canvas { --padding: 3rem; } }

.canvas > * { grid-column: main; }
.canvas-main { grid-column: main; }
.canvas-wide { grid-column: wide; }
.canvas-full { grid-column: full; }

/* Mobile horizontal-scroll fix: grid items default to min-width: auto, which
   means they won't shrink below their content's intrinsic min-width. Long
   words, wide tables, or full-width cards with large headings can push the
   grid wider than the viewport. Setting min-width: 0 lets them shrink to fit. */
.canvas > * { min-width: 0; max-width: 100%; }

/* Long unbreakable strings (URLs, code, German compound words) can't push
   their parent wider than the viewport. */
.prose { overflow-wrap: break-word; word-wrap: break-word; }

/* Ghost members-form utility class — without this, loading/success/error
   spans render simultaneously and can blow out the card width on mobile. */
.sf-hidden { display: none !important; }

/* -----  4. Typography (editorial heading scale)  ----------------------- */
.heading,
.heading-sm, .heading-base, .heading-lg, .heading-xl,
.heading-2xl, .heading-3xl, .heading-4xl, .heading-5xl, .heading-6xl {
  color: var(--heading);
  font-family: var(--font-heading);
  font-weight: 400;
}

.heading-sm   { font-size: 0.875rem; line-height: 1.25rem; }
.heading-base { font-size: 1rem; line-height: 1.5rem; }
.heading-lg   { font-size: 1.125rem; line-height: 1.75rem; }
.heading-xl   { font-size: 1.25rem; line-height: 1.75rem; }
.heading-2xl  { font-size: 1.5rem; line-height: 2rem; }
.heading-3xl  { font-size: 1.875rem; line-height: 2.25rem; }
.heading-4xl  { font-size: 2.25rem; line-height: 2.5rem; }
.heading-5xl  { font-size: 3rem; line-height: 1; }
.heading-6xl  { font-size: 3.75rem; line-height: 1; }

/* -----  5. Buttons (configurable radius)  ------------------------------ */
.btn, .btn-xs, .btn-sm, .btn-base {
  align-items: center;
  border-color: transparent;
  border-radius: var(--btn-radius);
  border-width: 1px;
  column-gap: 0.4rem;
  display: inline-flex;
  font-family: var(--font-body);
  font-weight: 500;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  transition: opacity var(--transition);
}

.btn:hover, .btn-xs:hover, .btn-sm:hover, .btn-base:hover { opacity: 0.85; }

.btn-xs   { font-size: 0.875rem; line-height: 1.25rem; padding: 0.25rem 0.875rem; }
.btn-sm   { font-size: 0.9375rem; line-height: 1.5rem; padding: 0.4rem 1rem; }
.btn-base { font-size: 1rem; line-height: 1.5rem; padding: 0.625rem 1.5rem; }

.var-base    { border-color: currentColor; color: var(--text); }
.var-fill    { background-color: var(--btn); color: var(--btn-text); border-color: var(--btn); }
.var-footer  { background-color: var(--footer-btn); color: var(--footer-btn-text); border-color: var(--footer-btn); }

/* -----  6. SVG icon helper  -------------------------------------------- */
.svg { height: 1em; width: 1em; overflow: visible; }

/* -----  7. Header (sticky w/ submenu)  --------------------------------- */

/* Skip link — visually hidden until keyboard focus.
   WCAG 2.4.1 (Bypass Blocks) compliance for keyboard users.
   Becomes visible at top-left when focused, allowing users to skip
   past the header navigation directly to main content. */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
  background-color: var(--bg);
  color: var(--text);
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0.5rem);
  outline: 0;
}
.skip-link:focus { outline: 0; }

/* Main content anchor — needs focusable to receive focus from skip link
   in older browsers. tabindex="-1" + outline: 0 prevents visual outline
   on programmatic focus. */
.main:focus { outline: 0; }
.site-header {
  position: relative;
  z-index: 50;
  background-color: var(--bg);
}

.site-header[data-navbar="open"] {
  position: sticky;
  top: 0;
}

@media (min-width: 1024px) {
  .site-header[data-navbar="open"] { position: relative; }
}

.site-header__inner {
  display: grid;
  gap: 2.5rem 1rem;
  padding-block: 1.5rem;
}

.site-header[data-navbar="open"] .site-header__inner {
  grid-template-rows: auto 1fr;
  height: 100vh;
  max-height: 100dvh;
}

@media (min-width: 1024px) {
  .site-header__inner {
    grid-template-columns: auto 1fr;
    grid-template-rows: 1fr;
    align-items: center;
    column-gap: 3rem;
  }
  .site-header[data-navbar="open"] .site-header__inner {
    grid-template-rows: 1fr;
    height: auto;
    max-height: none;
  }
}

.site-header__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  column-gap: 1.5rem;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  height: 2rem;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 2rem;
  letter-spacing: -0.01em;
  transition: opacity var(--transition);
}
.site-logo:hover { opacity: 0.8; }
.site-logo img { width: auto; max-height: 100%; }

/* Logo dark/light variants */
.site-logo__light { display: inline-block; }
.site-logo__dark { display: none; }

:root.dark .site-logo__light,
:root[data-theme="Dark"] .site-logo__light { display: none; }
:root.dark .site-logo__dark,
:root[data-theme="Dark"] .site-logo__dark { display: inline-block; }

.site-header__actions-mobile {
  display: flex;
  align-items: center;
  column-gap: 0.75rem;
}

@media (min-width: 1024px) {
  .site-header__actions-mobile { display: none; }
}

/* Navbar toggle: closed/open states use SVG icons (not Unicode glyphs)
   so both states have identical button width and the icon aligns
   precisely on the text baseline. */
.navbar-toggle { min-width: 5.5rem; }
.navbar-toggle__icon {
  display: inline-flex;
  align-items: center;
  column-gap: 0.4rem;
  justify-content: center;
}
.navbar-toggle__svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.site-header__main {
  display: none;
  flex-direction: column;
  align-items: center;
  row-gap: 3rem;
  column-gap: 1.5rem;
  overflow: hidden;
}

.site-header[data-navbar="open"] .site-header__main {
  display: flex;
  overflow-y: auto;
}

/* Mobile open-state layout:
   - Nav sits centered in the available vertical space
   - CTAs (Suchen / Subscribe) stick to the bottom of the viewport
   `margin: auto 0` on the nav consumes equal flex space above and below,
   pushing CTAs to the end of the column. */
.site-header[data-navbar="open"] .site-nav { margin-block: auto; }

@media (min-width: 1024px) {
  .site-header__main {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    overflow: visible;
    column-gap: 1.5rem;
  }
  /* Reset auto-margins on desktop so the nav sits inline with the CTAs */
  .site-header[data-navbar="open"] .site-nav { margin-block: 0; }
}

/* site-nav fills horizontal space on desktop (allowing the CTAs to sit
   right-aligned). On mobile, this would stretch the nav to the full
   viewport height inside the open off-canvas menu, pushing CTAs to the
   bottom. So restrict flex-grow to desktop only. */
.site-nav { flex: 0 0 auto; width: 100%; position: relative; overflow: hidden; }
@media (min-width: 1024px) { .site-nav { flex: 1 1 0%; overflow: visible; } }

.site-nav__list {
  display: flex;
  flex-direction: column;
  align-items: center;
  row-gap: 0.5rem;
  column-gap: 2rem;
  font-family: var(--font-heading);
}

@media (min-width: 1024px) {
  .site-nav__list {
    flex-direction: row;
    justify-content: flex-start;
    font-family: var(--font-body);
  }
}

.site-nav__link {
  display: block;
  font-size: 1.5rem;
  line-height: 2rem;
  transition: text-decoration var(--transition);
}
.site-nav__link:hover { text-decoration: underline; }

@media (min-width: 1024px) {
  .site-nav__link { font-size: 0.9375rem; line-height: 1.5rem; font-weight: 500; }
}

.site-nav__submenu-toggle {
  display: none;
  align-items: center;
  column-gap: 0.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: text-decoration var(--transition);
}
.site-nav__submenu-toggle:hover { text-decoration: underline; }

@media (min-width: 1024px) {
  .site-nav__submenu-toggle { display: flex; }
}

.site-nav__submenu-icon {
  width: 0.875em;
  height: 0.875em;
  transition: transform var(--transition);
}

.site-nav__item--has-submenu[data-submenu="open"] .site-nav__submenu-icon {
  transform: rotate(180deg);
}

.site-nav__submenu {
  display: flex;
  flex-direction: column;
  align-items: center;
  row-gap: 0.5rem;
}

@media (min-width: 1024px) {
  .site-nav__submenu {
    position: absolute;
    top: 100%;
    inset-inline-start: 0;
    align-items: stretch;
    row-gap: 0.75rem;
    min-width: 11rem;
    background-color: var(--submenu);
    color: var(--submenu-text);
    padding: 1.5rem;
    margin-top: 0.75rem;
    border-radius: var(--radius);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity var(--transition), visibility var(--transition), transform var(--transition);
    box-shadow: 0 10px 40px rgba(0,0,0,.15);
  }
  .site-nav__item--has-submenu[data-submenu="open"] .site-nav__submenu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
  }
}

.site-header__cta {
  display: flex;
  justify-content: center;
  align-items: center;
  column-gap: 0.75rem;
}

@media (min-width: 1024px) {
  .site-header__cta {
    flex-direction: row;
    column-gap: 0.5rem;
  }
}

.theme-toggle {
  display: none;
  justify-content: center;
  align-items: center;
  width: 2rem;
  height: 2rem;
  font-size: 1.25rem;
  transition: opacity var(--transition);
}
.theme-toggle:hover { opacity: 0.8; }

@media (min-width: 1024px) {
  .theme-toggle { display: inline-flex; }
}

/* When Theme is forced Dark, hide toggle entirely */
:root[data-theme="Dark"] .theme-toggle { display: none !important; }

.theme-toggle__icon-light, .theme-toggle__icon-dark { display: block; }
.theme-toggle__icon-dark { display: none; }
:root.dark .theme-toggle__icon-light { display: none; }
:root.dark .theme-toggle__icon-dark { display: block; }

.site-header__actions-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

@media (min-width: 1024px) {
  .site-header__actions-row { justify-content: normal; column-gap: 0.5rem; }
}

/* -----  8. Main + Footer wrapper  -------------------------------------- */
.main {
  padding-block: 4rem;
}

@media (min-width: 1024px) {
  .main { padding-block: 6rem; }
}

/* -----  9. Hero block (homepage)  -------------------------------------- */
.hero {
  display: grid;
  row-gap: 1.5rem;
  column-gap: 1.5rem;
  margin-bottom: 4rem;
}

@media (min-width: 768px) {
  .hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) { .hero { column-gap: 2.5rem; margin-bottom: 5rem; } }

.hero__title {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  line-height: 2.5rem;
  font-weight: 400;
  color: var(--heading);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

@media (min-width: 1024px) {
  .hero__title { font-size: 3rem; line-height: 1.05; }
}

.hero__description {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.5rem;
}

@media (min-width: 768px) {
  .hero__description { align-self: flex-end; text-align: end; }
}

@media (min-width: 1024px) {
  .hero__description { font-size: 1rem; line-height: 1.5rem; }
}

/* -----  10. Card grid – mobile single column  -------------------------- */
.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) { .card-grid { gap: 1.5rem; } }

@media (min-width: 768px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) { .card-grid { gap: 2.5rem; } }

/* Featured layout: first card spans full width with bigger aspect ratio */
@media (min-width: 768px) {
  .card-grid--featured > .card:first-child {
    grid-column: 1 / -1;
  }
  .card-grid--featured > .card:first-child .card__media {
    aspect-ratio: 21 / 9;
  }
  .card-grid--featured > .card:first-child .card__title {
    font-size: 2rem;
    line-height: 2.25rem;
  }
}

@media (min-width: 1024px) {
  .card-grid--featured > .card:first-child .card__title {
    font-size: 2.5rem;
    line-height: 2.75rem;
  }
}

/* Featured layout shows only 11 cards initially (1 wide + 10 in 2-col grid).
   The 12th from posts_per_page is hidden until JS marks the grid as "extended"
   after the user clicks Load More. Then all subsequent cards stay visible. */
.card-grid--featured > .card:nth-child(12) { display: none; }
.card-grid--featured.is-extended > .card:nth-child(12) { display: block; }

/* Lazy-load fade in for newly appended cards */
.card-grid .card.is-loading {
  opacity: 0;
  transform: translateY(10px);
}

.card-grid .card.is-loaded {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s var(--transition), transform 0.4s var(--transition);
}

/* Load-More button states */
.pagination__btn[data-loading="true"] {
  pointer-events: none;
  opacity: 0.5;
}

.pagination[data-state="hidden"] { display: none; }

/* -----  11. Card  ------------------------------------------------------ */
.card {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background-color: var(--bg-100);
}

.card__media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover .card__image { transform: scale(1.04); }

.card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
    rgba(0, 0, 0, 0.6) 0%,
    rgba(0, 0, 0, 0.1) 50%,
    transparent 80%);
  pointer-events: none;
  z-index: 10;
}

.card__content {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 20;
  padding: 1.5rem;
  color: white;
}

.card__title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  line-height: 1.5rem;
  font-weight: 400;
  color: white;
  letter-spacing: -0.005em;
}

@media (min-width: 1024px) {
  .card__title { font-size: 1.5rem; line-height: 2rem; }
}

.card__tag {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 0.125rem;
}

.card__badges {
  position: absolute;
  top: 1.25rem;
  inset-inline-end: 1.25rem;
  z-index: 20;
  display: flex;
  gap: 0.5rem;
}

.card__badge {
  display: inline-flex;
  align-items: center;
  column-gap: 0.375rem;
  border-radius: var(--btn-radius);
  border: 1px solid rgba(255,255,255,0.5);
  padding: 0.2rem 0.7rem;
  font-size: 0.75rem;
  line-height: 1rem;
  background-color: rgba(255, 255, 255, 0.18);
  color: white;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.card__badge .svg { width: 0.875rem; height: 0.875rem; }

/* -----  12. Footer (pill-shaped grid)  ------------------------------ */
.site-footer {
  background-color: var(--footer);
  color: var(--footer-text);
  padding-bottom: 2.5rem;
}

/* Outer grid: auto for CTA + 1fr for nav-area
   On mobile: stacked (1 column) */
.site-footer__inner {
  display: grid;
  row-gap: 4rem;
  column-gap: 1.5rem;
  padding-block: 4rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
  .site-footer__inner {
    /* CTA hugs its content (auto), nav-area takes remaining space (1fr) */
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .site-footer__inner {
    padding-block: 6rem;
    column-gap: 2.5rem;
  }
}

.site-footer__cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  row-gap: 1.5rem;
}

.site-footer__cta-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  line-height: 2.25rem;
  font-weight: 400;
  color: var(--footer-heading);
  margin: 0;
  text-wrap: balance;
  max-width: 28ch;
}

@media (min-width: 1024px) {
  .site-footer__cta-title { font-size: 3rem; line-height: 1.05; }
}

/* Nav-area: a 6-column inner grid; the actual nav content sits in cols 4-6 (right half) */
.site-footer__nav-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
  .site-footer__nav-area {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    column-gap: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .site-footer__nav-area { column-gap: 2.5rem; }
}

/* The nav content: col-span-6 on mobile, col-start-4 col-span-3 on desktop = right half */
.site-footer__nav {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 1.5rem;
  font-family: var(--font-body);
}

@media (min-width: 768px) {
  .site-footer__nav {
    grid-column: 4 / -1;  /* right half (cols 4-6) */
  }
}

.site-footer__nav-list {
  display: flex;
  flex-direction: column;
  row-gap: 1rem;
  font-size: 0.9375rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer__nav-link { transition: opacity var(--transition); }
.site-footer__nav-link:hover { opacity: 0.7; }

/* When navigation helper is used inside footer, give those links footer styling */
.site-footer__nav-list .site-nav__link {
  transition: opacity var(--transition);
  font-size: 0.9375rem;
  font-family: var(--font-body);
}
.site-footer__nav-list .site-nav__link:hover { opacity: 0.7; }

.site-footer__nav-link--external {
  display: inline-flex;
  align-items: center;
  column-gap: 0.25rem;
}

.site-footer__bottom {
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--footer-text);
  opacity: 0.7;
}

@media (min-width: 640px) {
  .site-footer__bottom { flex-direction: row; gap: 1.5rem; }
}

.site-footer__back-to-top {
  display: inline-flex;
  align-items: center;
  column-gap: 0.25rem;
  transition: opacity var(--transition);
}

.site-footer__back-to-top:hover { opacity: 1; }

.site-footer__credit a { text-decoration: underline; text-underline-offset: 2px; }
.site-footer__credit a:hover { opacity: 0.7; }

/* -----  13. Post / Article layout  ------------------------------------- */
.post {
  display: grid;
  row-gap: 2.5rem;
}

/* Reading progress bar: thin accent-colored line at top of viewport that
   fills as the reader scrolls through the post.
   Modern: pure CSS via scroll-driven animations (Chrome 115+, Firefox 132+).
   Fallback: JS sets --progress on the bar in older browsers. */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 60;
  pointer-events: none;
  background-color: transparent;
}
.reading-progress__bar {
  height: 100%;
  width: 100%;
  background-color: var(--accent);
  transform-origin: 0 0;
  transform: scaleX(var(--progress, 0));
}
@supports (animation-timeline: scroll()) {
  .reading-progress__bar {
    animation: reading-progress-fill linear;
    animation-timeline: scroll(root);
    transform: scaleX(0);
  }
  @keyframes reading-progress-fill {
    to { transform: scaleX(1); }
  }
}
@media (prefers-reduced-motion: reduce) {
  .reading-progress { display: none; }
}

/* Grid items default to min-width: auto, which prevents shrinking below
   intrinsic content width. On mobile this can push children (especially
   the .canvas with its long words and full-width cards) wider than the
   viewport. min-width: 0 lets them shrink properly. */
.post > * { min-width: 0; max-width: 100%; }

/* Inside .post, the .container wraps header + figure as siblings. They
   need vertical spacing the same way other .post children do. */
.post > .container > * + * { margin-top: 2.5rem; }

@media (min-width: 1024px) {
  .post { row-gap: 4rem; }
  .post > .container > * + * { margin-top: 4rem; }
}

.post-header {
  display: grid;
  row-gap: 1.25rem;
  column-gap: 1.5rem;
}

@media (min-width: 768px) {
  .post-header { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .post-header { column-gap: 2.5rem; }
}

.post-header__title {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  line-height: 2.5rem;
  font-weight: 500;
  color: var(--heading);
  text-wrap: balance;
  margin: 0;
}

@media (min-width: 1024px) {
  .post-header__title { font-size: 3rem; line-height: 1.05; }
}

.post-header__byline {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--text);
  opacity: 0.85;
}

.post-header__excerpt {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.5rem;
}

@media (min-width: 768px) {
  .post-header__excerpt { align-self: flex-end; text-align: end; }
}

@media (min-width: 1024px) {
  .post-header__excerpt { font-size: 1rem; line-height: 1.5rem; }
}

.post-feature-image {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  background-color: var(--bg-100);
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.post-feature-image-caption {
  text-align: center;
  font-size: 0.8125rem;
  line-height: 1.25rem;
  margin-top: 0.75rem;
  color: var(--text);
  opacity: 0.7;
}

/* -----  14. Prose (article content)  ------------------------------------ */
.prose {
  font-size: 1.125rem;
  line-height: 1.687;
  font-family: var(--font-body);
  font-weight: 100;
  /* German hyphenation — body text only by default.
     Controlled by data-hyphens on <html>:
       "body" (default) — body text hyphenates, headings don't
       "auto" — everything hyphenates including headings
       "off"  — nothing hyphenates */
  hyphens: auto;
  -webkit-hyphens: auto;
  hyphenate-limit-chars: 6 3 3;
  hyphenate-limit-lines: 2;
}

/* Body-only mode (default): headings explicitly disabled */
:where([data-hyphens="body"], :not([data-hyphens])) .prose :where(h1, h2, h3, h4, h5, h6) {
  hyphens: manual;
  -webkit-hyphens: manual;
  text-wrap: balance;
}

/* Full-auto mode: headings hyphenate too (with looser limits to avoid ugly breaks) */
[data-hyphens="auto"] .prose :where(h1, h2, h3, h4, h5, h6) {
  hyphens: auto;
  -webkit-hyphens: auto;
  hyphenate-limit-chars: 8 4 4;
  text-wrap: balance;
}

/* Off mode: nothing hyphenates */
[data-hyphens="off"] .prose,
[data-hyphens="off"] .prose :where(h1, h2, h3, h4, h5, h6) {
  hyphens: none;
  -webkit-hyphens: none;
}

/* Pre/code blocks: never hyphenate, regardless of mode */
.prose :where(pre, code, kbd) {
  hyphens: none;
  -webkit-hyphens: none;
}

/* Spacing: margin-bottom on each child (pill-shaped), so the rhythm
   accumulates downward and the last child has no trailing space. */
.prose > * { margin-bottom: 1.5rem; }
.prose > *:last-child { margin-bottom: 0; }

.prose :where(h1, h2, h3, h4, h5, h6):not(:where(.kg-card *)) {
  color: var(--heading);
  font-family: var(--font-heading);
  font-weight: 500;
  margin-top: 2.5rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0em;
  line-height: 1.2;
}

.prose :where(h1):not(:where(.kg-card *)) { font-size: 2.50rem; line-height: 3.750rem; font-weight: 500; }
.prose :where(h2):not(:where(.kg-card *)) { font-size: 2.25rem; line-height: 3.375rem; font-weight: 500; }
.prose :where(h3):not(:where(.kg-card *)) { font-size: 2.00rem; line-height: 3.000rem; font-weight: 500; }
.prose :where(h4):not(:where(.kg-card *)) { font-size: 1.75rem; line-height: 2.625rem; font-weight: 500; }
.prose :where(h5):not(:where(.kg-card *)) { font-size: 1.50rem; line-height: 2.250rem; font-weight: 500; }
.prose :where(h6):not(:where(.kg-card *)) { font-size: 1.25rem; line-height: 1.875rem; font-weight: 500; }

.prose :where([id] + [id], [id]:first-child):not(:where(.kg-card *)) { margin-top: 0; }

.prose :where(a):not(:where(.kg-card *)) {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity var(--transition);
}
.prose :where(a):not(:where(.kg-card *)):hover { opacity: 0.75; }

.prose :where(b, strong):not(:where(.kg-card *)) { font-weight: 600; }

.prose :where(blockquote):not(:where(.kg-blockquote-alt)) {
  font-style: normal;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.875;
}

.kg-blockquote-alt {
  color: var(--heading);
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1.25;
  text-align: left;
  margin: 2rem 0;
}

@media (min-width: 640px) {
  .kg-blockquote-alt {
    font-size: 2.5em;
    line-height: 1.3;
  }
}

.prose :where(mark) { background-color: yellow; color: black; }

.prose :where(hr) {
  border-color: var(--border);
  border-top-width: 1px;
  margin: 3rem 0;
}

.prose :where(ol) { list-style-type: decimal; padding-inline-start: 1.5rem; }
.prose :where(ul) { list-style-type: disc; padding-inline-start: 1.5rem; }
.prose :where(* > ol > li > ol) { list-style-type: lower-alpha; }
.prose :where(* > ul > li > ul) { list-style-type: circle; }
.prose :where(ol ol, ol ul, ul ul, ul ol) { margin-bottom: 0.75rem; margin-top: 0.75rem; }
.prose :where(li) { margin-bottom: 0.5rem; }
.prose :where(li::marker) { color: currentColor; }

.prose :where(code, kbd):not(:where(pre *)) {
  background-color: var(--bg-100);
  border-radius: var(--btn-radius);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  padding: 0.15rem 0.45rem;
}

.prose :where(pre) {
  background-color: var(--bg-100);
  border-radius: var(--radius);
  color: var(--text);
  direction: ltr;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  overflow-x: auto;
  padding: 1.5rem;
}

.prose :where(table) {
  display: block;
  font-size: 0.9375rem;
  line-height: 1.5rem;
  overflow: hidden;
  overflow-x: auto;
  width: 100%;
}

.prose :where(thead) { background-color: var(--bg-100); }

.prose :where(thead th) {
  color: var(--heading);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5rem;
  vertical-align: bottom;
}

.prose :where(tbody tr) { border-bottom-width: 1px; border-color: var(--border); }
.prose :where(tbody td) { vertical-align: baseline; color: var(--text); }
.prose :where(th, td) { text-align: start; }
.prose :where(thead th, tbody td, tfoot td) { padding: 0.625rem 1rem; }
.prose :where(tbody tr:last-child) { border-bottom-width: 0; }

/* Dark mode: tables pasted from external sources often carry inline
   color styles from light-mode contexts that become unreadable. Force
   theme text color in the body. */
:root.dark .prose :where(tbody td),
:root[data-theme="Dark"] .prose :where(tbody td) {
  color: var(--text) !important;
}

.prose :where(picture):not(:where(.kg-card, .kg-card *)) { display: block; }

.prose :where(img):not(:where(.kg-card *)) {
  background-color: var(--bg-100);
  border-radius: var(--radius);
}

.prose :where(figcaption) {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  line-height: 1.25rem;
  margin-top: 0.75rem;
  text-align: center;
  color: var(--text);
  opacity: 0.7;
}

/* Drop cap (only on first paragraph)
   Two paths:
   - Modern (Safari, Firefox 130+): initial-letter: 3 1
     → 3 lines tall, top aligned with cap-height of line 1
   - Fallback (older browsers): float with size calibrated to ~3 lines */
[data-dropcaps] > p:first-of-type::first-letter {
  float: inline-start;
  font-family: var(--font-heading);
  font-size: 5.3rem;
  font-weight: 500;
  line-height: 1;
  margin-top: 0.15rem;
  margin-inline-end: 1rem;
  color: var(--heading);
}

@supports (initial-letter: 1 1) {
  [data-dropcaps] > p:first-of-type::first-letter {
    float: none;
    font-size: inherit;
    margin-top: 0;
    margin-inline-end: 1rem;
    initial-letter: 3 1;
  }
}

/* -----  15. Koenig cards (Ghost editor)  ------------------------------ */
.kg-width-main { grid-column: main; }
.kg-width-wide { grid-column: wide; }
.kg-width-full { grid-column: full; }

/* Full-width breakout is structural now: .canvas sits directly under <main>
   (not inside .container), so grid-column: full naturally spans the
   viewport width through the canvas grid's [full-start..full-end] columns.
   No more 100vw + negative-margin hacks. */
.kg-width-full img { border-radius: 0; max-width: 100%; height: auto; display: block; }

.kg-card { margin: 1rem 0; }

.kg-card svg { height: 1em; width: 1em; fill: currentColor; }

.kg-image-card img { background-color: var(--bg-100); }
.kg-image-card :where(img):not(:where(.kg-width-full *)) { border-radius: var(--radius); }

.kg-image-card.kg-card-hascaption figcaption,
.kg-embed-card figcaption,
.kg-video-card figcaption,
.kg-audio-card figcaption {
  text-align: center;
  font-size: 0.8125rem;
  line-height: 1.25rem;
  margin-top: 0.75rem;
  opacity: 0.7;
}

/* Gallery card */
.kg-gallery-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 100%;
}

.kg-gallery-row {
  display: grid;
  gap: 0.5rem;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
}

.kg-gallery-image {
  cursor: zoom-in;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
}

.kg-gallery-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--transition);
}

.kg-gallery-image:hover img { transform: scale(1.04); }

/* Bookmark card — 2-column layout: content left, thumbnail right.
   On narrow widths it stacks (image on top, content below). */
.kg-bookmark-card .kg-bookmark-container {
  background-color: var(--bg-100);
  border-radius: var(--radius);
  display: flex;
  flex-direction: row;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: opacity var(--transition);
  min-height: 8rem;
}

.kg-bookmark-card .kg-bookmark-container:hover {
  opacity: 0.92;
}

.kg-bookmark-content {
  flex: 1 1 auto;
  padding: 1.5rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.4rem;
}

.kg-bookmark-title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  line-height: 1.5rem;
  font-weight: 500;
  color: var(--heading);
  margin: 0;
}

.kg-bookmark-description {
  font-size: 0.875rem;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: 0.8;
}

.kg-bookmark-metadata {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  margin-top: auto;
  padding-top: 0.6rem;
  opacity: 0.8;
  flex-wrap: wrap;
}

.kg-bookmark-icon {
  width: 1rem;
  height: 1rem;
  margin-right: 0.25rem;
}

.kg-bookmark-author,
.kg-bookmark-publisher {
  display: inline;
  font-weight: 500;
}

.kg-bookmark-publisher::before {
  content: "·";
  margin: 0 0.4rem;
  opacity: 0.6;
}

.kg-bookmark-thumbnail {
  flex: 0 0 auto;
  width: 33%;
  max-width: 240px;
  display: flex;
  align-items: stretch;
}

.kg-bookmark-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 600px) {
  .kg-bookmark-card .kg-bookmark-container { flex-direction: column-reverse; }
  .kg-bookmark-thumbnail { width: 100%; max-width: none; }
  .kg-bookmark-thumbnail img { aspect-ratio: 16 / 9; height: auto; }
}

/* Callout card */
.kg-callout-card {
  border-radius: var(--radius);
  column-gap: 0.75rem;
  display: flex;
  padding: 1.5rem;
  align-items: flex-start;
}

.kg-callout-card-grey { background-color: var(--bg-100); color: var(--text); }
.kg-callout-card-white { background-color: var(--bg); color: var(--text); border: 1px solid var(--border); }
.kg-callout-card-green  { background-color: var(--c-green-bg);  color: var(--c-green-text); }
.kg-callout-card-yellow { background-color: var(--c-yellow-bg); color: var(--c-yellow-text); }
.kg-callout-card-red    { background-color: var(--c-red-bg);    color: var(--c-red-text); }
.kg-callout-card-blue   { background-color: var(--c-blue-bg);   color: var(--c-blue-text); }
.kg-callout-card-pink   { background-color: var(--c-pink-bg);   color: var(--c-pink-text); }
.kg-callout-card-purple { background-color: var(--c-purple-bg); color: var(--c-purple-text); }
.kg-callout-card-accent { background-color: var(--accent); color: var(--contrast); }

.kg-callout-emoji { font-size: 1.25rem; line-height: 1.5; flex-shrink: 0; }
.kg-callout-text { flex: 1 1 auto; }

/* CTA card — derived from callout pattern.
   Background variants reuse the exact same colors as callouts above.
   Layout variants:
   - kg-cta-minimal:   image (5rem square) | text + button — flex-row on >=640px
   - kg-cta-immersive: image (full width) on top, text + button below
   - kg-cta-centered:  text + button centered (combines with immersive)
   - kg-cta-has-img:   adds image rendering
   - kg-cta-bg-none:   no padding, no background; optional borders for content
*/
.kg-cta-card {
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
  overflow: hidden;
  position: relative;
}

/* Background variants — same palette as callouts for consistency */
.kg-cta-bg-grey { background-color: var(--bg-100); color: var(--text); }
.kg-cta-bg-white { background-color: var(--bg); color: var(--text); border: 1px solid var(--border); }
.kg-cta-bg-green  { background-color: var(--c-green-bg);  color: var(--c-green-text); }
.kg-cta-bg-yellow { background-color: var(--c-yellow-bg); color: var(--c-yellow-text); }
.kg-cta-bg-red    { background-color: var(--c-red-bg);    color: var(--c-red-text); }
.kg-cta-bg-blue   { background-color: var(--c-blue-bg);   color: var(--c-blue-text); }
.kg-cta-bg-pink   { background-color: var(--c-pink-bg);   color: var(--c-pink-text); }
.kg-cta-bg-purple { background-color: var(--c-purple-bg); color: var(--c-purple-text); }
.kg-cta-bg-accent { background-color: var(--accent); color: var(--contrast); }
.kg-cta-bg-none { background-color: transparent; padding: 0; }

/* Sponsor label — appears above content, separated by a thin border */
.kg-cta-sponsor-label-wrapper {
  border-bottom: 1px solid var(--bg-200);
  padding-bottom: 1rem;
}
.kg-cta-bg-none .kg-cta-sponsor-label-wrapper { border-bottom-color: var(--border); }
.kg-cta-has-img .kg-cta-sponsor-label-wrapper:not(.kg-cta-bg-none .kg-cta-sponsor-label-wrapper):not(.kg-cta-minimal .kg-cta-sponsor-label-wrapper) {
  border-bottom: 0;
  padding-bottom: 0;
}
.kg-cta-sponsor-label {
  color: var(--heading);
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kg-cta-sponsor-label a { color: var(--link); text-decoration: underline; transition: opacity var(--transition); }
.kg-cta-sponsor-label a:hover { opacity: 0.8; }
.kg-cta-link-accent .kg-cta-sponsor-label a { color: var(--accent); }

/* Content layouts */
.kg-cta-content {
  display: flex;
  gap: 1.5rem;
}

/* Minimal: image left, text right (stacks on small screens) */
.kg-cta-minimal .kg-cta-content { flex-direction: column; }
@media (min-width: 640px) {
  .kg-cta-minimal .kg-cta-content { flex-direction: row; }
}

/* Immersive: image on top, text below */
.kg-cta-immersive .kg-cta-content { flex-direction: column; }

/* Spacing borders for bg-none variants only — visual separation
   replaces the missing background panel */
.kg-cta-bg-none .kg-cta-content {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
}
.kg-cta-bg-none .kg-cta-content:not(.kg-cta-sponsor-label-wrapper + .kg-cta-content) {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.kg-cta-content-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1 1 auto;
  min-width: 0;
}
.kg-cta-immersive.kg-cta-centered .kg-cta-content-inner { align-items: center; }

/* Image container */
.kg-cta-image-container { flex-shrink: 0; }
.kg-cta-image-container img {
  border-radius: var(--radius);
  object-fit: cover;
  width: 100%;
  display: block;
  margin: 0;
}
.kg-cta-minimal .kg-cta-image-container img {
  aspect-ratio: 1 / 1;
  background-color: var(--bg);
  width: 5rem;
}
.kg-cta-bg-none.kg-cta-minimal .kg-cta-image-container img { background-color: var(--bg-100); }

/* Text block */
.kg-cta-text > * + * { margin-top: 1rem; }
.kg-cta-text p { margin: 0; }
.kg-cta-text strong, .kg-cta-text b {
  color: var(--heading);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 400;
  display: block;
  margin-bottom: 0.5rem;
}
.kg-cta-immersive.kg-cta-centered .kg-cta-text { text-align: center; }
.kg-cta-text a {
  color: var(--link);
  text-decoration: underline;
  transition: opacity var(--transition);
}
.kg-cta-text a:hover { opacity: 0.8; }
.kg-cta-link-accent .kg-cta-text a { color: var(--accent); }

/* CTA button — uses theme button variables, fits content by default */
.kg-cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--btn);
  color: var(--btn-text) !important;
  border: 1px solid transparent;
  border-radius: var(--btn-radius);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 500;
  padding: 0.5rem 2rem;
  width: fit-content;
  text-decoration: none !important;
  transition: opacity var(--transition);
}
.kg-cta-button:hover { opacity: 0.85; }
/* Immersive + has image: button stretches full width */
.kg-cta-immersive.kg-cta-has-img a.kg-cta-button { width: 100%; }

/* Dark mode: User-chosen button colors from the editor (e.g. black bg /
   white text) become unreadable when the card background is dark.
   Override inline styles with !important to use theme button colors. */
:root.dark .kg-cta-button,
:root[data-theme="Dark"] .kg-cta-button {
  background-color: var(--btn) !important;
  color: var(--btn-text) !important;
}

/* Same applies to header card and signup card buttons — both can have
   inline color/bg styles set by the editor. */
:root.dark .kg-header-card-button,
:root[data-theme="Dark"] .kg-header-card-button,
:root.dark .kg-signup-card-button,
:root[data-theme="Dark"] .kg-signup-card-button {
  background-color: var(--btn) !important;
  color: var(--btn-text) !important;
}

/* Toggle card — initial state closed, click expands. Ghost stores
   open/closed in data-kg-toggle-state which our JS toggles. */
.kg-toggle-card {
  background-color: var(--bg-100);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.kg-toggle-card:has(+ .kg-toggle-card) {
  margin-bottom: 1.5rem;
}

.kg-toggle-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  margin: 0;
  gap: 1rem;
}

.kg-toggle-heading-text {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  line-height: 1.5rem;
  font-weight: 500;
  color: var(--heading);
  margin: 0;
  flex: 1 1 auto;
}

.kg-toggle-card-icon {
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: inherit;
  transition: transform var(--transition);
}

.kg-toggle-card-icon svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Default state: closed → hide content, point chevron down */
.kg-toggle-content {
  font-size: 0.95em;
  overflow: hidden;
  height: 0;
  opacity: 0;
  transition: opacity var(--transition);
}

/* Open state */
.kg-toggle-card[data-kg-toggle-state="open"] .kg-toggle-content {
  height: auto;
  opacity: 1;
  padding-top: 1rem;
}

.kg-toggle-card[data-kg-toggle-state="open"] .kg-toggle-card-icon {
  transform: rotate(180deg);
}

/* Button card */
.kg-button-card {
  display: flex;
  margin: 1rem 0;
  width: 100%;
}

.kg-button-card.kg-align-center { justify-content: center; }
.kg-button-card.kg-align-left { justify-content: flex-start; }
.kg-button-card-left { text-align: left; }
.kg-button-card-right { text-align: right; }

.kg-button-card :where(.kg-btn, .kg-btn-accent) {
  background-color: var(--btn);
  color: var(--btn-text);
  border-radius: var(--btn-radius);
  border-width: 1px;
  border-style: solid;
  border-color: var(--btn);
  font-size: 1rem;
  line-height: 1.5rem;
  padding: 0.5rem 2rem;
  display: inline-flex;
  align-items: center;
  text-decoration: none !important;
  font-family: inherit;
  font-weight: 500;
  transition: opacity var(--transition);
}
.kg-button-card :where(.kg-btn, .kg-btn-accent):hover { opacity: 0.85; }

/* Audio card — Ghost loads its own player chrome (controls/sliders) via
   card-assets when card_assets.include contains "audio". We override the
   container to use theme background + radius. */
.kg-card.kg-audio-card {
  background-color: var(--bg-100);
  border-radius: var(--radius);
  box-shadow: none;
  color: var(--text);
  min-height: 96px;
  padding: 0.5rem;
}

.kg-audio-thumbnail {
  border-radius: calc(var(--radius) * 0.5);
}

.kg-audio-thumbnail.placeholder {
  background-color: var(--accent);
}

.kg-audio-title {
  font-family: var(--font-heading);
  font-weight: 500;
  color: var(--heading);
}

.kg-audio-current-time,
.kg-audio-duration,
.kg-audio-time { color: inherit; }

/* Video card */
.kg-video-card { position: relative; }

/* Embed card — handles YouTube, Vimeo, Twitter, generic iframes.
   Ghost wraps video embeds in a div with inline styles for aspect ratio:
   <div style="position:relative;padding-bottom:56.25%;height:0px;overflow:hidden">
     <iframe width="200" height="113" ...>
   The HTML width/height attributes need !important to be overridden. */
.kg-embed-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.kg-embed-card > iframe,
.kg-embed-card > .twitter-tweet,
.kg-embed-card > blockquote,
.kg-embed-card > * {
  max-width: 100%;
}

/* The Ghost video wrapper — make it full width and let its inline
   padding-bottom create the 16:9 aspect ratio */
.kg-embed-card > div[style*="padding-bottom"] {
  width: 100%;
  position: relative;
}

/* The iframe inside the wrapper — fill it completely.
   !important is needed to override Ghost's HTML width/height attributes. */
.kg-embed-card > div[style*="padding-bottom"] > iframe {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  border: 0;
  display: block;
}

.kg-embed-card iframe {
  border: 0;
  display: block;
}

/* Direct iframe fallback (older Ghost markups without wrapper div) */
.prose iframe:is([src*="youtube.com"], [src*="youtube-nocookie.com"], [src*="vimeo.com"]) {
  aspect-ratio: 16 / 9;
  height: auto;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* Header card — Ghost's "Hero" content block.
   Implementation follows the same subgrid pattern as .canvas: when full-width, the
   card itself becomes a subgrid (full | wide | main | wide | full) so
   that the bg can be edge-to-edge while the text content sits on the
   `main` track (or `wide` if kg-content-wide is set). This is the same
   trick the .canvas grid uses. */
.kg-header-card {
  background-color: var(--bg-100);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.kg-header-card.kg-style-accent { background-color: var(--accent); }

/* Full-width: card becomes its own subgrid, edge-to-edge background */
.kg-header-card.kg-width-full {
  --padding: 1rem;
  --main: min(640px, 100% - var(--padding) * 2);
  --wide: minmax(0, calc((1536px - var(--main)) / 2));
  --full: minmax(var(--padding), 1fr);
  display: grid;
  grid-template-columns:
    [full-start] var(--full)
    [wide-start] var(--wide)
    [main-start] var(--main)
    [main-end] var(--wide)
    [wide-end] var(--full)
    [full-end];
  max-width: 100%;
  width: 100%;
  border-radius: 0;
}
@media (min-width: 640px) { .kg-header-card.kg-width-full { --padding: 1.5rem; } }
@media (min-width: 1024px) { .kg-header-card.kg-width-full { --padding: 3rem; } }

.kg-header-card.kg-width-full > * { grid-column: main; }

/* Bg image: positioned absolute behind the content */
.kg-header-card-image {
  aspect-ratio: 16 / 9;
  height: 100%;
  object-fit: cover;
  width: 100%;
  margin: 0;
}
.kg-header-card:not(.kg-layout-split) .kg-header-card-image {
  aspect-ratio: auto;
  inset: 0;
  pointer-events: none;
  position: absolute;
}
.kg-header-card.kg-style-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.55), rgba(0,0,0,0.15) 60%, transparent);
  z-index: 1;
}

/* Content wrapper — z-indexed above the bg image */
.kg-header-card-content {
  position: relative;
  z-index: 10;
  min-width: 0;
}

/* Content placement on full-width card (no kg-content-wide):
   content sits on the `full` track (edge to edge, but text-padding handles inner spacing) */
.kg-width-full:not(.kg-content-wide) .kg-header-card-content { grid-column: full; }
/* With kg-content-wide: content sits on the `wide` track (constrained but generous) */
.kg-content-wide .kg-header-card-content { grid-column: wide; align-items: center; }
.kg-content-wide:not(.kg-layout-split) .kg-header-card-content { grid-column: main; }

/* Split layout: image and text side-by-side */
.kg-layout-split .kg-header-card-content { display: grid; }
@media (min-width: 768px) {
  .kg-layout-split .kg-header-card-content {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.kg-layout-split.kg-content-wide .kg-header-card-content {
  column-gap: 1.5rem;
  row-gap: 2.5rem;
  padding-block: 3rem;
}
@media (min-width: 640px) {
  .kg-layout-split.kg-content-wide .kg-header-card-content { padding-block: 5rem; }
}
@media (min-width: 1024px) {
  .kg-layout-split.kg-content-wide .kg-header-card-content { column-gap: 2.5rem; }
}

/* Text padding — varies by width and layout */
.kg-header-card-text {
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
@media (min-width: 640px) {
  .kg-header-card-text { padding: 4rem 3rem; }
}
@media (min-width: 640px) {
  .kg-width-full .kg-header-card-text { padding-block: 5rem; }
}
@media (min-width: 1024px) {
  .kg-width-full .kg-header-card-text { padding-block: 9rem; }
}
.kg-width-full:not(.kg-layout-split) .kg-header-card-text { padding-inline: 0; }
.kg-layout-split:not(.kg-content-wide) .kg-header-card-text { padding-inline: 1rem; }
@media (min-width: 640px) {
  .kg-layout-split:not(.kg-content-wide) .kg-header-card-text { padding-inline: 1.5rem; }
}
@media (min-width: 1024px) {
  .kg-layout-split:not(.kg-content-wide) .kg-header-card-text { padding-inline: 3rem; }
}
.kg-layout-split.kg-content-wide .kg-header-card-text { padding: 0; }

.kg-swapped .kg-header-card-text { order: -9999; }
.kg-header-card-text.kg-align-center { text-align: center; }

/* Split layout: image fills its grid cell completely (matching the
   text column's height). aspect-ratio override is required because
   the default rule above sets it to 16/9 which would create empty
   space below the image when the text column is taller. */
.kg-layout-split .kg-header-card-image {
  background-color: rgba(255,255,255,0.05);
  aspect-ratio: auto;
  height: 100%;
  width: 100%;
  object-fit: cover;
}
.kg-layout-split.kg-content-wide .kg-header-card-image {
  border-radius: var(--radius);
}

/* Heading scales with width */
.kg-header-card-heading {
  color: var(--heading);
  font-family: var(--font-heading);
  font-size: 1.5rem;
  line-height: 1.875rem;
  font-weight: 500;
  margin: 0;
  text-wrap: balance;
}
@media (min-width: 640px) {
  .kg-header-card:not(.kg-width-regular) .kg-header-card-heading {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
}
@media (min-width: 1024px) {
  .kg-header-card:not(.kg-width-regular) .kg-header-card-heading {
    font-size: 2.25rem;
    line-height: 2.5rem;
  }
}
.kg-style-accent .kg-header-card-heading { color: var(--contrast) !important; }

.kg-header-card-subheading {
  font-size: 1.125rem;
  line-height: 1.625;
  margin: 0;
}
@media (min-width: 768px) { .kg-header-card-subheading { text-wrap: balance; } }
.kg-style-accent .kg-header-card-subheading { color: var(--contrast) !important; }
.kg-header-card-heading + .kg-header-card-subheading { margin-top: 1rem; }

/* CTA button — themed, fits content */
.kg-header-card-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--btn);
  color: var(--btn-text);
  border: 1px solid transparent;
  border-radius: var(--btn-radius);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 500;
  padding: 0.5rem 2rem;
  text-decoration: none !important;
  transition: opacity var(--transition);
  width: fit-content;
  column-gap: 0.25rem;
}
.kg-header-card-button:hover { opacity: 0.85; }
.kg-header-card-button.kg-style-accent { color: var(--btn-text) !important; }
.kg-header-card-text > * + .kg-header-card-button { margin-top: 2rem; }
.kg-header-card-text.kg-align-center .kg-header-card-button { align-self: center; }

/* Signup card — same subgrid structure as header card, plus a form */
.kg-signup-card {
  background-color: var(--bg-100);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.kg-signup-card.kg-style-accent { background-color: var(--accent); }

.kg-signup-card.kg-width-full {
  --padding: 1rem;
  --main: min(640px, 100% - var(--padding) * 2);
  --wide: minmax(0, calc((1536px - var(--main)) / 2));
  --full: minmax(var(--padding), 1fr);
  display: grid;
  grid-template-columns:
    [full-start] var(--full)
    [wide-start] var(--wide)
    [main-start] var(--main)
    [main-end] var(--wide)
    [wide-end] var(--full)
    [full-end];
  max-width: 100%;
  width: 100%;
  border-radius: 0;
}
@media (min-width: 640px) { .kg-signup-card.kg-width-full { --padding: 1.5rem; } }
@media (min-width: 1024px) { .kg-signup-card.kg-width-full { --padding: 3rem; } }

.kg-signup-card.kg-width-full > * { grid-column: main; }

.kg-signup-card-image {
  aspect-ratio: 16 / 9;
  height: 100%;
  object-fit: cover;
  width: 100%;
  margin: 0;
}
.kg-signup-card:not(.kg-layout-split) .kg-signup-card-image {
  aspect-ratio: auto;
  inset: 0;
  pointer-events: none;
  position: absolute;
}
.kg-signup-card.kg-style-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.55), rgba(0,0,0,0.15) 60%, transparent);
  z-index: 1;
}

.kg-signup-card-content {
  position: relative;
  z-index: 10;
  min-width: 0;
}

.kg-width-full:not(.kg-content-wide) .kg-signup-card-content { grid-column: full; }
.kg-content-wide .kg-signup-card-content { grid-column: wide; align-items: center; }
.kg-content-wide:not(.kg-layout-split) .kg-signup-card-content { grid-column: main; }

.kg-layout-split .kg-signup-card-content { display: grid; }
@media (min-width: 768px) {
  .kg-layout-split .kg-signup-card-content {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.kg-layout-split.kg-content-wide .kg-signup-card-content {
  column-gap: 1.5rem;
  row-gap: 2.5rem;
  padding-block: 3rem;
}
@media (min-width: 640px) {
  .kg-layout-split.kg-content-wide .kg-signup-card-content { padding-block: 5rem; }
}
@media (min-width: 1024px) {
  .kg-layout-split.kg-content-wide .kg-signup-card-content { column-gap: 2.5rem; }
}

.kg-signup-card-text {
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
@media (min-width: 640px) {
  .kg-signup-card-text { padding: 4rem 3rem; }
}
@media (min-width: 640px) {
  .kg-width-full .kg-signup-card-text { padding-block: 5rem; }
}
@media (min-width: 1024px) {
  .kg-width-full .kg-signup-card-text { padding-block: 9rem; }
}
.kg-width-full:not(.kg-layout-split) .kg-signup-card-text { padding-inline: 0; }
.kg-layout-split:not(.kg-content-wide) .kg-signup-card-text { padding-inline: 1rem; }
@media (min-width: 640px) {
  .kg-layout-split:not(.kg-content-wide) .kg-signup-card-text { padding-inline: 1.5rem; }
}
@media (min-width: 1024px) {
  .kg-layout-split:not(.kg-content-wide) .kg-signup-card-text { padding-inline: 3rem; }
}
.kg-layout-split.kg-content-wide .kg-signup-card-text { padding: 0; }

.kg-swapped .kg-signup-card-text { order: -9999; }
.kg-signup-card-text.kg-align-center { text-align: center; }

/* Split layout: image fills its grid cell completely */
.kg-layout-split .kg-signup-card-image {
  aspect-ratio: auto;
  height: 100%;
  width: 100%;
  object-fit: cover;
}
.kg-layout-split.kg-content-wide .kg-signup-card-image {
  border-radius: var(--radius);
}

.kg-signup-card-heading {
  color: var(--heading);
  font-family: var(--font-heading);
  font-size: 1.5rem;
  line-height: 1.875rem;
  font-weight: 500;
  margin: 0;
  text-wrap: balance;
}
@media (min-width: 640px) {
  .kg-signup-card:not(.kg-width-regular) .kg-signup-card-heading {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
}
@media (min-width: 1024px) {
  .kg-signup-card:not(.kg-width-regular) .kg-signup-card-heading {
    font-size: 2.25rem;
    line-height: 2.5rem;
  }
}
.kg-style-accent .kg-signup-card-heading { color: var(--contrast) !important; }

.kg-signup-card-subheading {
  font-size: 1.125rem;
  line-height: 1.625;
  margin: 0;
}
@media (min-width: 768px) { .kg-signup-card-subheading { text-wrap: balance; } }
.kg-style-accent .kg-signup-card-subheading { color: var(--contrast) !important; }
.kg-signup-card-heading + .kg-signup-card-subheading { margin-top: 1rem; }

/* Form: input + button in a contrasting container, all using theme radii.
   Container, input and button all follow --radius / --btn-radius from
   the theme settings (None / Small / Medium / Large). */
.kg-signup-card-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}
.kg-signup-card.kg-align-center .kg-signup-card-form,
.kg-align-center .kg-signup-card-form { align-items: center; }
.kg-signup-card-text > * + .kg-signup-card-form { margin-top: 2rem; }

.kg-signup-card-fields {
  background-color: var(--bg);
  border: 1px solid var(--border);
  /* Outer radius = inner button radius + padding distance.
     This is the only mathematically correct way for nested rounded
     shapes to look concentric. At Large (--btn-radius: 9999px) the
     calc still resolves to a very large value, keeping the container
     a pill that matches the button. */
  border-radius: calc(var(--btn-radius) + 0.25rem);
  display: flex;
  gap: 0.25rem;
  max-width: 32rem;
  padding: 0.25rem;
  width: 100%;
  min-width: 0;
}

.kg-signup-card-input {
  background-color: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5rem;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: var(--btn-radius);
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  outline: 0;
}
.kg-signup-card-input::placeholder { color: currentColor; opacity: 0.6; }
.kg-signup-card-input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }

.kg-signup-card-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--btn);
  color: var(--btn-text);
  border: 1px solid transparent;
  border-radius: var(--btn-radius);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 500;
  padding: 0.5rem 1.5rem;
  text-decoration: none !important;
  transition: opacity var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  column-gap: 0.25rem;
  position: relative;
}
.kg-signup-card-button:hover { opacity: 0.85; }
.kg-signup-card-button.kg-style-accent { color: var(--btn-text) !important; }

/* Loading/Success/Error visibility — Ghost emits .sf-hidden, but also uses
   class state on the form for default/loading/success/error transitions */
.kg-signup-card-button-loading {
  font-size: 1.25rem;
  line-height: 1.75rem;
  position: absolute;
  visibility: hidden;
}
.kg-signup-card-form.loading .kg-signup-card-button-default { visibility: hidden; }
.kg-signup-card-form.loading .kg-signup-card-button-loading { visibility: visible; }

.kg-signup-card-form :where(.kg-signup-card-success, .kg-signup-card-error) {
  display: none;
  font-size: 0.875rem;
  line-height: 1.25rem;
  margin-top: 1rem;
}
.kg-signup-card-form.success .kg-signup-card-success { display: block; }
.kg-signup-card-form.error .kg-signup-card-error { display: block; }
.kg-style-accent :where(.kg-signup-card-success, .kg-signup-card-error) { color: var(--contrast) !important; }

.kg-signup-card-disclaimer {
  font-size: 0.875rem;
  line-height: 1.25rem;
  margin-top: 1rem;
  opacity: 0.8;
}
.kg-style-accent .kg-signup-card-disclaimer { color: var(--contrast) !important; opacity: 0.85; }
.kg-signup-card-text:has(.success, .error) .kg-signup-card-disclaimer { display: none; }

/* File card — content area left (title + caption + filename/size),
   download icon fixed right. */
.kg-file-card .kg-file-card-container {
  background-color: var(--bg-100);
  border-radius: var(--radius);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  padding: 1.5rem;
  min-height: 112px;
  width: 100%;
  text-decoration: none;
  color: inherit;
  transition: opacity var(--transition);
  gap: 1rem;
}

.kg-file-card .kg-file-card-container:hover { opacity: 0.92; }

.kg-file-card-contents {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.4rem;
}

.kg-file-card-title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  line-height: 1.5rem;
  font-weight: 500;
  color: var(--heading);
  margin: 0;
}

.kg-file-card-caption {
  font-size: 0.875rem;
  line-height: 1.4;
  margin: 0;
  opacity: 0.8;
}

.kg-file-card-metadata {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  margin-top: auto;
  flex-wrap: wrap;
}

.kg-file-card-filename {
  display: inline;
  font-weight: 500;
  opacity: 0.9;
}

.kg-file-card-filesize {
  display: inline;
  opacity: 0.6;
}

.kg-file-card-filename + .kg-file-card-filesize::before {
  content: "·";
  margin-right: 0.4rem;
  opacity: 0.6;
}

.kg-file-card-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  align-self: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.5;
  transition: opacity var(--transition);
}

.kg-file-card-icon svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.kg-file-card .kg-file-card-container:hover .kg-file-card-icon { opacity: 0.8; }

/* Size variants — Ghost emits these for medium/small files */
.kg-file-card-medium .kg-file-card-container { min-height: 96px; padding: 1.25rem; }
.kg-file-card-small .kg-file-card-container { min-height: 72px; padding: 1rem; }
.kg-file-card-small .kg-file-card-icon { width: 2.5rem; height: 2.5rem; }

/* Product card — Grid layout:
   Row 1: Image spans both columns
   Row 2: Title (col 1) | Rating (col 2)
   Row 3: Description spans both columns
   Row 4: Buy button spans both columns */
.kg-product-card {
  display: flex;
  justify-content: center;
}

.kg-product-card .kg-product-card-container {
  background-color: var(--bg-100);
  border-radius: var(--radius);
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  max-width: 36rem;
  padding: 1.5rem;
  width: 100%;
}

.kg-product-card-image {
  background-color: var(--bg);
  border-radius: var(--radius);
  grid-column: span 2 / span 2;
  overflow: hidden;
  width: 100%;
  height: auto;
  margin: 0;
  object-fit: cover;
}

.kg-product-card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 400;
  color: var(--heading);
  margin: 0;
}

/* Title container wraps only the H4 — rating is its sibling.
   Both sit naturally in the 2-column grid (col 1 + col 2). */
.kg-product-card-title-container {
  align-self: center;
  min-width: 0;
}

.kg-product-card-rating {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 0.25rem;
  font-size: 1rem;
  line-height: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.kg-product-card-rating > :not(.kg-product-card-rating-active) {
  opacity: 0.2;
}

.kg-product-card-rating-star {
  display: inline-flex;
  width: 1.25rem;
  height: 1.25rem;
}

.kg-product-card-rating-star svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.kg-product-card-rating-active { opacity: 1; }

.kg-product-card-description {
  font-size: 1rem;
  line-height: 1.5rem;
  grid-column: span 2 / span 2;
  margin: 0;
  margin-bottom: 0.375rem;
}

.kg-product-card-description:empty { display: none; }

.kg-product-card :where(.kg-product-card-button, .kg-product-card-btn-accent) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  grid-column: span 2 / span 2;
  background-color: var(--btn);
  color: var(--btn-text) !important;
  border-radius: var(--btn-radius);
  border: 1px solid transparent;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  column-gap: 0.25rem;
  transition: opacity var(--transition);
}
.kg-product-card :where(.kg-product-card-button, .kg-product-card-btn-accent):hover {
  opacity: 0.8;
}

/* NFT card — stub styles for Ghost compatibility (rarely used) */
.kg-nft-card .kg-nft-card-container {
  background-color: var(--bg-100);
  border-radius: var(--radius);
  display: block;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  max-width: 36rem;
  margin: 0 auto;
  transition: opacity var(--transition);
}
.kg-nft-card .kg-nft-card-container:hover { opacity: 0.92; }
.kg-nft-image { width: 100%; height: auto; display: block; }
.kg-nft-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem 0.5rem; gap: 1rem; }
.kg-nft-title { font-family: var(--font-heading); font-size: 1.125rem; font-weight: 500; color: var(--heading); margin: 0; }
.kg-nft-opensea-logo { width: 1.5rem; height: 1.5rem; flex: 0 0 auto; }
.kg-nft-metadata { padding: 0.5rem 1.5rem 1rem; display: flex; flex-direction: column; gap: 0.4rem; }
.kg-nft-creator { font-size: 0.875rem; opacity: 0.8; }
.kg-nft-description { font-size: 0.875rem; line-height: 1.4; opacity: 0.9; margin: 0; }

/* Before/After card — stub styles for Ghost compatibility */
.kg-before-after-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
}
.kg-before-after-card-image-before,
.kg-before-after-card-image-after {
  display: block;
  width: 100%;
  height: auto;
}

/* -----  16. Members upgrade banner  ----------------------------------- */
/* Ghost auto-renders <aside class="gh-post-upgrade-cta"> inside member-only
   post content. We hide it entirely and render our own theme-styled banner
   from post.hbs, so colors/fonts/radius are fully under theme control. */
.gh-post-upgrade-cta { display: none !important; }

/* Theme-controlled banner */
.restricted-cta {
  background-color: var(--bg-100);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  margin-top: 2rem;
  color: var(--text);
}

.restricted-cta__title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 400;
  color: var(--heading);
  margin: 0 0 1.5rem;
}

.restricted-cta__signin {
  margin-top: 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  text-align: center;
}

.restricted-cta__signin a {
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity var(--transition);
  color: inherit;
}
.restricted-cta__signin a:hover { opacity: 0.7; }

/* -----  17. Tags + Share (post footer)  -------------------------------- */
.post-footer {
  display: grid;
  row-gap: 1.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.post-footer__row {
  display: flex;
  flex-direction: column;
  row-gap: 1.5rem;
}

@media (min-width: 640px) {
  .post-footer__row { flex-direction: row; justify-content: space-between; gap: 1.5rem; }
}

.post-footer__label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.75rem;
  line-height: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.6;
  margin-bottom: 0.5rem;
}

.post-footer__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid currentColor;
  border-radius: var(--btn-radius);
  padding: 0.2rem 0.7rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  transition: opacity var(--transition);
}
.tag-pill:hover { opacity: 0.7; }

.share {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.share__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  font-size: 1rem;
  border-radius: var(--btn-radius);
  transition: opacity var(--transition), background-color var(--transition);
}
.share__btn:hover { opacity: 0.7; }
.share__btn .svg { width: 1rem; height: 1rem; }

/* -----  18. Pagination / Load More  ------------------------------------ */
.pagination {
  display: flex;
  justify-content: center;
  margin-top: 3rem;
}

@media (min-width: 1024px) { .pagination { margin-top: 4rem; } }

/* -----  19. Tag/Author archive (matched to home spacing)  -------------- */
.archive-header {
  display: grid;
  row-gap: 1rem;
  margin-bottom: 4rem;
}

@media (min-width: 1024px) { .archive-header { margin-bottom: 5rem; } }

.archive-header__title {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  line-height: 2.5rem;
  font-weight: 500;
  color: var(--heading);
  text-wrap: balance;
}

@media (min-width: 1024px) {
  .archive-header__title { font-size: 3rem; line-height: 1.05; }
}

.archive-header__description {
  font-size: 0.9375rem;
  line-height: 1.5rem;
  max-width: 36rem;
}

@media (min-width: 1024px) {
  .archive-header__description { font-size: 1rem; }
}

.author-bio {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

@media (min-width: 768px) {
  .author-bio { flex-direction: row; align-items: center; }
}

.author-bio__avatar {
  width: 5rem;
  height: 5rem;
  border-radius: 9999px;
  object-fit: cover;
  background-color: var(--bg-100);
}

/* -----  20. Error page  ----------------------------------------------- */
.error-page {
  display: grid;
  place-items: center;
  text-align: center;
  row-gap: 1.5rem;
  padding-block: 4rem;
}

@media (min-width: 1024px) { .error-page { padding-block: 7rem; } }

.error-page__code {
  font-family: var(--font-heading);
  font-size: 6rem;
  line-height: 1;
  font-weight: 400;
  color: var(--heading);
}

@media (min-width: 1024px) { .error-page__code { font-size: 8rem; } }

/* -----  21. Lightbox (image gallery)  --------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lightbox.is-open { display: flex; }

.lightbox__image {
  max-width: 100%;
  max-height: calc(100vh - 4rem);
  object-fit: contain;
  user-select: none;
}

.lightbox__close,
.lightbox__prev,
.lightbox__next {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 9999px;
  cursor: pointer;
  border: 0;
  transition: background-color var(--transition);
}

.lightbox__close:hover,
.lightbox__prev:hover,
.lightbox__next:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox__close {
  top: 1rem;
  right: 1rem;
}

.lightbox__prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 1rem; top: 50%; transform: translateY(-50%); }

.lightbox__counter {
  position: absolute;
  top: 1rem;
  left: 1rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.875rem;
  font-family: var(--font-body);
  background: rgba(0, 0, 0, 0.4);
  padding: 0.4rem 0.75rem;
  border-radius: 9999px;
}

.lightbox__close .svg,
.lightbox__prev .svg,
.lightbox__next .svg { width: 1.25rem; height: 1.25rem; }

/* When a single image (no gallery), hide prev/next + counter */
.lightbox.is-single .lightbox__prev,
.lightbox.is-single .lightbox__next,
.lightbox.is-single .lightbox__counter { display: none; }

/* -----  22. Utility helpers  ------------------------------------------- */
.u-sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.u-text-balance { text-wrap: balance; }

/* -----  21. Print stylesheet  ------------------------------------------ */
@media print {
  /* Hide non-content chrome */
  .site-header,
  .site-footer,
  .post-footer,
  .pagination,
  .skip-link,
  .navbar-toggle,
  .theme-toggle,
  .share,
  .pswp,
  .lightbox,
  [data-portal] { display: none !important; }

  /* Reset color tokens for legibility on paper */
  :root, :root.dark {
    --bg: white;
    --bg-100: #f5f5f5;
    --bg-200: #e5e5e5;
    --text: black;
    --heading: black;
    --border: #cccccc;
    --link: black;
    --btn: black;
    --btn-text: white;
  }

  body {
    background: white !important;
    color: black !important;
    font-size: 11pt;
    line-height: 1.5;
  }

  /* Avoid orphaned headings + force page-break-after for h1 */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    page-break-inside: avoid;
  }

  p, li, blockquote, figure {
    page-break-inside: avoid;
    orphans: 3;
    widows: 3;
  }

  /* Show URLs after links */
  .prose a[href]:not([href^="#"]):not([href^="javascript:"])::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    word-wrap: break-word;
  }

  /* Images: no shadows, no border-radius, scaled to fit */
  img {
    max-width: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  /* Cards: simplified borders, no backgrounds */
  .kg-callout-card,
  .kg-cta-card,
  .kg-bookmark-container,
  .kg-product-card-container,
  .kg-toggle-card,
  .kg-file-card .kg-file-card-container,
  .kg-audio-card,
  .kg-header-card,
  .kg-signup-card {
    background: white !important;
    border: 1px solid #cccccc !important;
    page-break-inside: avoid;
  }

  /* Toggle: always show contents in print */
  .kg-toggle-card[data-kg-toggle-state] .kg-toggle-content {
    height: auto !important;
    opacity: 1 !important;
  }

  /* Layout: no full-width breakouts in print */
  .canvas { display: block; }
  .canvas > *,
  .kg-width-full,
  .kg-width-wide { grid-column: auto; max-width: 100% !important; width: auto !important; }
}
