/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  background: #141414;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  z-index: 1000;
  transition: top .15s ease;
}
.skip-link:focus {
  top: 8px;
  outline: 3px solid #C7D92E;
  outline-offset: 2px;
}

/* Global focus indicator for all interactive elements */
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  border-radius: inherit;
}
body[data-theme="dark"] :focus-visible {
  outline-color: var(--lime);
}

/* ---------- Tweakable defaults (persisted) ---------- */
/* (the JS below reads this block from the inline script) */

:root {
  --lime: #C7D92E;
  --lime-ink: #B5C627;
  --lime-soft: #E4EE8A;
  --accent-text: #6B7A00; /* WCAG-safe accent for text on paper: ~4.7:1 on white */
  --ink: #141414;
  --ink-2: #2a2a2a;
  --paper: #ffffff;
  --paper-2: #faf9f4;
  --muted: #6a6a6a;
  --line: #e8e6dc;
  --coral: #e8674c; /* pulled from the cover's red trousers */
  --radius: 14px;
  --shadow-soft: 0 1px 0 rgba(0,0,0,.04), 0 8px 28px rgba(20,20,20,.06);
  --shadow-lift: 0 20px 60px rgba(20,20,20,.18);
}

/* Theme: green (default) is defined above. */
body[data-theme="dark"] {
  --paper: #15181a;
  --paper-2: #1c1f21;
  --ink: #f4f1e6;
  --ink-2: #d9d4c3;
  --muted: #9a968a;
  --line: #2a2e31;
  --lime: #C7D92E;
  --lime-ink: #D7E746;
  --lime-soft: #2e3417;
  --accent-text: #C7D92E; /* bright lime is readable on dark paper */
}
body[data-theme="minimal"] {
  --paper: #ffffff;
  --paper-2: #f6f5f0;
  --ink: #111111;
  --ink-2: #2a2a2a;
  --muted: #6e6e6e;
  --line: #ececec;
  --lime: #d6e24a;
  --lime-ink: #3d3d3d;
  --lime-soft: #efefe9;
  --coral: #333333;
  --accent-text: #3d3d3d;
}

/* Honor OS dark-mode preference when no explicit data-theme is set. */
@media (prefers-color-scheme: dark) {
  body[data-theme="green"] {
    --paper: #15181a;
    --paper-2: #1c1f21;
    --ink: #f4f1e6;
    --ink-2: #d9d4c3;
    --muted: #9a968a;
    --line: #2a2e31;
    --lime-ink: #D7E746;
    --lime-soft: #2e3417;
    --accent-text: #C7D92E;
  }
}

/* Typography pairings */
body[data-type="kalam"]     { --f-display: 'Kalam', cursive;  --f-body: 'Roboto', system-ui, sans-serif; --display-weight: 700; --display-lh: 0.95; --display-tracking: -0.005em; }
body[data-type="caveat"]    { --f-display: 'Caveat', cursive; --f-body: 'Inter', system-ui, sans-serif; --display-weight: 700; --display-lh: 0.92; --display-tracking: 0; }
body[data-type="patrick"]   { --f-display: 'Patrick Hand', cursive; --f-body: 'Roboto', system-ui, sans-serif; --display-weight: 400; --display-lh: 1.0; --display-tracking: 0; }
body[data-type="editorial"] { --f-display: 'Roboto', system-ui, sans-serif; --f-body: 'Roboto', system-ui, sans-serif; --display-weight: 900; --display-lh: 0.95; --display-tracking: -0.02em; }

* { box-sizing: border-box; }
html { font-size: 100%; scroll-padding-top: 80px; /* honor user font-size preference + offset sticky nav for in-page anchors */ }
html, body { margin: 0; padding: 0; background: var(--paper); color: var(--ink); font-family: var(--f-body); }
section[id] { scroll-margin-top: 80px; }
body { font-size: 1.0625rem; line-height: 1.55; -webkit-font-smoothing: antialiased; } /* 17px @ default */
img { display: block; max-width: 100%; }
a { color: inherit; }

h1, h2, h3 { font-family: var(--f-display); font-weight: var(--display-weight); line-height: var(--display-lh); letter-spacing: var(--display-tracking); margin: 0; overflow-wrap: break-word; hyphens: auto; text-wrap: balance; }
h1 { font-size: clamp(2.25rem, 4.5vw, 3.5rem); }  /* 36px–56px */
h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); }    /* 28px–40px */
h3 { font-size: clamp(1.25rem, 1.8vw, 1.5rem); }  /* 20px–24px */

.container { width: min(1200px, 92vw); margin: 0 auto; }

/* ------------ NAV ------------- */
.nav {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in oklab, var(--paper) 85%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { font-family: var(--f-display); font-weight: var(--display-weight); font-size: 28px; letter-spacing: 0; }
.brand em { font-style: normal; color: var(--accent-text); }
.nav-links { display: flex; gap: 22px; align-items: center; font-size: 14px; color: var(--ink-2); }
.nav-links a { text-decoration: none; }
.nav-links a:not(.cta):hover { color: var(--ink); }
.nav .cta { padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--paper); font-weight: 600; text-decoration: none; font-size: 14px; }
body[data-theme="dark"] .nav .cta { background: var(--lime); color: #141414; }

/* ------------ HERO ------------- */
.hero {
  position: relative;
  padding: 64px 0 48px;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 32px; } }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 12px;
  background: var(--lime); color: #141414;
  border-radius: 999px;
  font-weight: 700; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
}
body[data-theme="minimal"] .eyebrow { background: #141414; color: #fff; }

.hero h1 .accent {
  color: var(--accent-text);
  position: relative;
  display: inline-block;
}

.hero .lede {
  margin-top: 22px;
  font-size: clamp(17px, 1.6vw, 20px);
  color: var(--ink-2);
  max-width: 56ch;
  text-wrap: pretty;
}

.hero-ctas { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  font-weight: 700; text-decoration: none;
  font-size: 15px;
  transition: transform .12s ease, box-shadow .12s ease;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--paper); }
body[data-theme="dark"] .btn-primary { background: var(--lime); color: #141414; }
.btn-primary:hover { box-shadow: 0 14px 30px rgba(0,0,0,.18); }
.btn-lime { background: var(--lime); color: #141414; }
.btn-lime:hover { box-shadow: 0 14px 30px rgba(199,217,46,.35); }
body[data-theme="minimal"] .btn-lime { background: #141414; color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }

.meta-row { margin-top: 16px; font-size: 13px; color: var(--muted); display: flex; gap: 18px; flex-wrap: wrap; }
.meta-row strong { color: var(--ink); font-weight: 600; }

/* Book cover showcase on the right */
.cover-stage {
  position: relative;
  width: fit-content;
  justify-self: center;
  border-radius: var(--radius);
  overflow: hidden;
  background:
    radial-gradient(1200px 400px at 20% 20%, rgba(255,255,255,.05), transparent 60%),
    linear-gradient(180deg, #1f2022 0%, #2a2c2e 60%, #1a1c1e 100%);
  box-shadow: var(--shadow-lift);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
/* chalkboard texture */
.cover-stage::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 2px 2px;
  mix-blend-mode: screen;
  opacity: .6;
}
.cover-image {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  max-width: 322px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 30px 60px rgba(0,0,0,.5), 0 2px 0 rgba(255,255,255,.04) inset;
}

/* ------------ PROBLEM / LÖSUNG ------------- */
.section { padding: 96px 0; }
.section-sm { padding: 72px 0; }
.section-alt { background: var(--paper-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.two-col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: start;
}
@media (max-width: 1024px) { .two-col { grid-template-columns: 1fr; gap: 36px; } }

.section h2 .accent { color: var(--accent-text); }

.prose p { font-size: 18px; line-height: 1.65; color: var(--ink-2); text-wrap: pretty; }
.prose p + p { margin-top: 18px; }
.underline-wavy { text-decoration: underline wavy; text-decoration-color: var(--accent-text); text-underline-offset: 6px; text-decoration-thickness: 2px; }

.pullquote {
  font-family: var(--f-display);
  font-weight: var(--display-weight);
  font-size: clamp(24px, 2.4vw, 32px);
  line-height: 1.15;
  color: var(--ink);
  padding: 28px;
  background: var(--paper-2);
  border-left: 4px solid var(--lime);
  border-radius: 8px;
}
body[data-theme="dark"] .pullquote { background: var(--paper-2); }

.image-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4/3;
  background: #ddd;
  box-shadow: var(--shadow-soft);
}
.image-card img { width: 100%; height: 100%; object-fit: cover; }
.image-card .badge {
  position: absolute; left: 14px; bottom: 14px;
  background: var(--lime); color: #141414;
  font-family: var(--f-display); font-weight: var(--display-weight);
  padding: 6px 12px; border-radius: 999px;
  transform: rotate(-2deg);
  font-size: 18px;
}

/* ------------ INHALTE (Bullet-Cards) ------------ */
.content-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
@media (max-width: 900px) { .content-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .content-grid { grid-template-columns: 1fr; } }

.content-card {
  position: relative;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 26px 22px 24px;
  overflow: hidden;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.content-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); border-color: color-mix(in oklab, var(--lime) 60%, var(--line)); }
.content-card .num {
  font-family: var(--f-display); font-weight: var(--display-weight);
  font-size: 44px; color: var(--accent-text); line-height: 1;
}
.content-card h3 { margin-top: 12px; font-family: var(--f-body); font-weight: 700; font-size: 18px; line-height: 1.3; letter-spacing: 0; }
body[data-type="editorial"] .content-card h3 { font-weight: 800; }
.content-card p { margin: 8px 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.5; }

.content-card.accent {
  background: var(--lime);
  color: #141414;
  border-color: transparent;
}
.content-card.accent .num { color: #141414; opacity: .9; }
.content-card.accent p { color: #2a2a2a; }
body[data-theme="minimal"] .content-card.accent { background: #141414; color: #fff; }
body[data-theme="minimal"] .content-card.accent p { color: #d4d4d4; }
body[data-theme="minimal"] .content-card.accent .num { color: #fff; }

/* ------------ ÜBER SAMUEL ------------ */
.author {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 36px;
  align-items: center;
}
@media (max-width: 720px) { .author { grid-template-columns: 1fr; } }

.author-avatar {
  width: 220px; height: 220px; border-radius: 50%;
  box-sizing: border-box;
  border: 2px dashed var(--lime-ink);
  padding: 8px;
  box-shadow: 0 20px 40px rgba(0,0,0,.08);
}
.author-avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.sign-off {
  margin-top: 16px;
  font-family: var(--f-display);
  font-weight: var(--display-weight);
  font-size: 28px;
  color: var(--ink);
}

/* ------------ KAUF / CTA ------------ */
/* .buy is intentionally a dark CTA card across all themes/OS modes —
   pin colors so they don't flip when --ink/--paper invert under dark theme
   (otherwise .lede's hard-coded white text lands on a light background). */
.buy {
  background: #0b0d0e;
  color: #f4f1e6;
  border-radius: 24px;
  padding: clamp(32px, 5vw, 64px);
  position: relative;
  overflow: hidden;
}
body[data-theme="minimal"] .buy { background: #0f0f0f; }
body[data-theme="dark"] .buy { border: 1px solid var(--line); }

.buy::before {
  content: ""; position: absolute; right: -80px; top: -80px;
  width: 280px; height: 280px; background: var(--lime); border-radius: 50%;
  filter: blur(0); opacity: .95;
}
.buy::after {
  content: ""; position: absolute; left: -60px; bottom: -60px;
  width: 180px; height: 180px; background: var(--coral); border-radius: 50%;
  opacity: .9;
}
body[data-theme="minimal"] .buy::before { background: #fff; opacity: .08; }
body[data-theme="minimal"] .buy::after { background: #fff; opacity: .05; }

.buy-inner { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: end; }
@media (max-width: 800px) { .buy-inner { grid-template-columns: 1fr; align-items: start; } }
.buy h2 { color: inherit; }
.buy .price-row strong { color: #fff; }
.buy .lede { color: rgba(255,255,255,.75); max-width: 50ch; margin-top: 12px; text-wrap: pretty; }

.shops { display: flex; gap: 12px; flex-wrap: wrap; }
.shop-btn {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: var(--paper); color: var(--ink);
  padding: 14px 20px; border-radius: 14px;
  text-decoration: none; font-weight: 700; font-size: 15px;
  transition: transform .12s ease, box-shadow .12s ease;
  border: 1px solid var(--line);
}
.shop-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0,0,0,.2); }
.shop-btn .k { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.shop-btn.primary { background: var(--lime); color: #141414; border-color: transparent; }
.shop-btn.primary .k { color: #2c2c2c; }

.price-row { color: rgba(255,255,255,.75); margin-top: 14px; font-size: 14px; display: flex; gap: 16px; flex-wrap: wrap; }
.price-row strong { color: var(--paper); font-weight: 700; }

/* ------------ FOOTER ------------ */
footer { padding: 48px 0 64px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); margin-top: 72px; }
footer .foot-grid { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
footer a { color: inherit; }

/* ------------ TWEAKS PANEL ------------- */
.tweaks-panel {
  position: fixed; right: 18px; bottom: 18px; z-index: 100;
  width: 280px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  font-family: var(--f-body);
  overflow: hidden;
  display: none;
}
.tweaks-panel.open { display: block; }
.tweaks-head { padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: space-between; }
.tweaks-head .title { font-family: var(--f-display); font-weight: var(--display-weight); font-size: 20px; }
.tweaks-body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 16px; }
.tweak-group label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; display: block; margin-bottom: 8px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg.typo { grid-template-columns: repeat(2, 1fr); }
.seg button {
  font-family: var(--f-body);
  font-size: 12px; font-weight: 600;
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: all .12s ease;
}
.seg button:hover { border-color: var(--ink); }
.seg button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
body[data-theme="dark"] .seg button.active { background: var(--lime); color: #141414; border-color: var(--lime); }

.tweak-close {
  background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1;
  min-width: 32px; min-height: 32px; padding: 4px 8px; /* 24x24 touch-target floor */
}

/* chalk dust, just a little mood */
.chalk-row { font-family: var(--f-display); font-weight: var(--display-weight); color: var(--muted); opacity: .6; font-size: 20px; letter-spacing: 4px; margin-top: 14px; }

/* Hero bg flourish */
.hero-bg {
  position: absolute; pointer-events: none;
  inset: 0;
  background:
    radial-gradient(600px 240px at 85% 0%, color-mix(in oklab, var(--lime) 40%, transparent), transparent 60%),
    radial-gradient(400px 160px at 0% 100%, color-mix(in oklab, var(--lime) 25%, transparent), transparent 60%);
  opacity: .7;
  z-index: 0;
}
.hero > .container { position: relative; z-index: 1; }

/* Selection color */
::selection { background: var(--lime); color: #141414; }

/* ------------ MOBILE OVERRIDES (placed last to win specificity ties) ------------- */
@media (max-width: 900px) {
  .cover-stage { padding: 24px; max-width: 500px; margin: 0 auto; }
  .section { padding: 56px 0; }
  .section-sm { padding: 40px 0; }
  .hero { padding: 40px 0 32px; }
}

/* Below ~720px the four long German nav labels overflow the bar.
   Hide the deep-section anchors and keep only brand + "Buch kaufen" CTA;
   in-page sections remain reachable via scrolling. */
@media (max-width: 720px) {
  .nav-links { gap: 12px; }
  .nav-links a:not(.cta) { display: none; }
}
