/*
  Ebook-Shop: gemeinsames Stylesheet für Landingpage, Rechtsseiten
  und die vom Dienst gerenderten Seiten (/danke, Fehlerseiten).
  Klassen laut planning/schnittstellen_final.md.
  Schriften lokal (SIL Open Font License 1.1, siehe fonts/LICENSE-*.txt).
*/

/* ---------- Schriften ---------- */

@font-face {
  font-family: "Young Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/young-serif-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
}

/* ---------- Design-Tokens ---------- */

:root {
  color-scheme: light dark;

  --font-display: "Young Serif", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Hell: kühles Salbei-Papier, tiefes Kiefergrün, Limetten-Marker */
  --bg: #eef1ec;
  --bg-deep: #e2e8e1;
  --surface: #fafbf8;
  --ink: #15231e;
  --ink-muted: #46564f;
  --line: #c3cec6;
  --accent: #1d5a48;
  --accent-hover: #154536;
  --on-accent: #ffffff;
  --marker: #d6e86b;
  --on-marker: #15231e;
  --spine-1: #1d5a48;
  --spine-2: #3b5f7a;
  --spine-3: #6b5a2e;
  --focus: #0f5bd8;
  --error: #9e2a1f;
  --error-bg: #f8e6e3;
  --info-bg: #f1f6d6;

  --radius: 6px;
  --radius-lg: 14px;
  --shadow: 0 1px 0 rgba(21, 35, 30, 0.06), 0 8px 24px -12px rgba(21, 35, 30, 0.25);
  --measure: 66ch;
  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1713;
    --bg-deep: #0b120f;
    --surface: #17221d;
    --ink: #e5ece7;
    --ink-muted: #a5b4ac;
    --line: #2d3d35;
    --accent: #cfe36a;
    --accent-hover: #e0ef93;
    --on-accent: #0f1713;
    --marker: #cfe36a;
    --on-marker: #0f1713;
    --spine-1: #cfe36a;
    --spine-2: #8fb8d6;
    --spine-3: #d8b86a;
    --focus: #8fc1ff;
    --error: #ffb4a8;
    --error-bg: #2c1814;
    --info-bg: #1d2a17;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
  }
}

/* ---------- Basis ---------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(1.0625rem, 0.3vw + 1rem, 1.1875rem);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.25rem, 5.5vw + 1rem, 4.25rem);
}

h2 {
  font-size: clamp(1.625rem, 2.2vw + 1rem, 2.5rem);
}

h3 {
  font-size: clamp(1.25rem, 0.8vw + 1rem, 1.5rem);
}

p,
ul,
ol,
dl {
  margin: 0 0 1em;
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.16em;
}

strong {
  font-weight: 700;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--marker);
  color: var(--on-marker);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  border-radius: var(--radius);
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
}

/* Platzhalter sichtbar machen, bis sie ersetzt sind */
.placeholder {
  background: var(--marker);
  color: var(--on-marker);
  padding: 0 0.2em;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ---------- Seitenrahmen ---------- */

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page > main {
  flex: 1 0 auto;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.site-header > *,
.site-header__inner {
  max-width: var(--wrap);
  margin-inline: auto;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem var(--gutter);
}

@media (max-width: 39.99rem) {
  .site-header__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding-block: 0.85rem 0.6rem;
  }

  .site-nav ul {
    gap: 0.25rem 1rem;
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1;
  text-decoration: none;
  color: var(--ink);
}

.brand__mark {
  width: 1.9rem;
  height: 1.9rem;
  flex: none;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: inline-block;
  padding: 0.35rem 0;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
}

.site-nav a:hover {
  text-decoration: underline;
}

.site-footer {
  margin-top: clamp(3rem, 8vw, 6rem);
  border-top: 1px solid var(--line);
  background: var(--bg-deep);
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.site-footer__inner {
  max-width: var(--wrap);
  margin-inline: auto;
  padding: 2rem var(--gutter) 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer a {
  color: var(--ink);
  display: inline-block;
  padding: 0.25rem 0;
}

.site-footer p {
  margin: 0;
}

/* Fallback, falls der Dienst Kopf/Fuß ohne __inner rendert */
.site-header:not(:has(.site-header__inner)),
.site-footer:not(:has(.site-footer__inner)) {
  padding: 1rem var(--gutter);
}

/* ---------- Abschnitte Landingpage ---------- */

.section {
  padding-block: clamp(3rem, 7vw, 5.5rem);
}

.section__head {
  max-width: var(--measure);
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.lead {
  font-size: clamp(1.125rem, 0.8vw + 1rem, 1.375rem);
  color: var(--ink-muted);
  max-width: 38ch;
}

/* Hero */
.hero {
  padding-block: clamp(3rem, 9vw, 7rem) clamp(2.5rem, 6vw, 4.5rem);
  border-bottom: 1px solid var(--line);
}

.hero__grid {
  display: grid;
  gap: 2.5rem;
  align-items: end;
}

.hero h1 {
  max-width: 14ch;
  margin-bottom: 0.4em;
}

.hero__mark {
  background-image: linear-gradient(transparent 62%, var(--marker) 62%, var(--marker) 92%, transparent 92%);
  padding-inline: 0.05em;
}

@media (prefers-color-scheme: dark) {
  .hero__mark {
    background-image: none;
    color: var(--marker);
  }
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  margin-top: 1.75rem;
}

.hero__note {
  font-size: 0.95rem;
  color: var(--ink-muted);
  margin: 0;
}

.hero__points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
}

.hero__points li {
  font-size: 1rem;
}

@media (min-width: 52rem) {
  .hero__grid {
    grid-template-columns: 1.6fr 1fr;
    gap: 4rem;
  }
}

/* ---------- Buttons ---------- */

.button,
.ebook-card__buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.875rem;
  padding: 0.7rem 1.35rem;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.button:hover,
.ebook-card__buy:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
  text-decoration: none;
}

.button:active,
.ebook-card__buy:active {
  transform: translateY(1px);
}

.button--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.button--ghost:hover {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--ink-muted);
}

/* ---------- Ebook-Raster und Karten ---------- */

.ebook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17.5rem), 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.ebook-card {
  --spine: var(--spine-1);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 100%;
  padding: 1.5rem 1.5rem 1.5rem 2.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius-lg) var(--radius-lg) var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Buchrücken links */
.ebook-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.75rem;
  background: var(--spine);
  box-shadow: inset -2px 0 0 rgba(0, 0, 0, 0.15);
}

.ebook-grid > :nth-child(3n + 2) .ebook-card,
.ebook-grid > .ebook-card:nth-child(3n + 2) {
  --spine: var(--spine-2);
}

.ebook-grid > :nth-child(3n + 3) .ebook-card,
.ebook-grid > .ebook-card:nth-child(3n + 3) {
  --spine: var(--spine-3);
}

.ebook-card__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.375rem, 0.8vw + 1.1rem, 1.625rem);
  line-height: 1.2;
  margin: 0;
}

.ebook-card__subtitle {
  margin: 0;
  color: var(--ink-muted);
  font-size: 1rem;
}

.ebook-card__price {
  margin: auto 0 0;
  padding-top: 1rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* Hinweis "inkl. USt" kann der Dienst als <small> mitgeben */
.ebook-card__price small {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.ebook-card__buy {
  align-self: stretch;
  margin-top: 0.75rem;
}

.ebook-card__soon {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  margin-top: 0.75rem;
  padding: 0.4rem 0.8rem;
  border: 1px dashed var(--ink-muted);
  border-radius: 999px;
  color: var(--ink-muted);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ebook-card__soon::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--marker);
  box-shadow: 0 0 0 1px var(--ink-muted);
}

.ebook-grid__note {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

/* ---------- So läuft der Kauf ---------- */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.5rem;
  counter-reset: step;
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding: 1.25rem 0 0 0;
  border-top: 2px solid var(--ink);
}

.steps > li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--font-display);
  font-size: 2.25rem;
  line-height: 1;
  color: var(--accent);
}

.steps h3 {
  font-size: 1.25rem;
  margin-bottom: 0.4em;
}

.steps p {
  margin: 0;
  color: var(--ink-muted);
}

@media (min-width: 40rem) {
  .steps {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

@media (min-width: 64rem) {
  .steps {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ---------- FAQ ---------- */

.faq {
  max-width: 48rem;
  border-top: 1px solid var(--line);
}

.faq details {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 0;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  flex: none;
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--accent);
  transition: transform 0.2s ease;
}

.faq details[open] summary::after {
  transform: rotate(45deg);
}

.faq details > div {
  padding: 0 0 1.25rem;
  max-width: var(--measure);
  color: var(--ink-muted);
}

.faq details > div p:last-child {
  margin-bottom: 0;
}

/* ---------- Hinweise (Danke-, Fehler-, Entwurfsseiten) ---------- */

.notice {
  max-width: var(--measure);
  margin: 1.5rem 0;
  padding: 1.1rem 1.25rem 1.1rem 1.4rem;
  background: var(--info-bg);
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: var(--radius);
  color: var(--ink);
}

.notice > :first-child {
  margin-top: 0;
}

.notice > :last-child {
  margin-bottom: 0;
}

.notice h1,
.notice h2 {
  font-size: clamp(1.5rem, 2vw + 1rem, 2.25rem);
}

.notice--error {
  background: var(--error-bg);
  border-left-color: var(--error);
}

.notice--error h1,
.notice--error h2,
.notice--error strong {
  color: var(--error);
}

.notice--draft {
  max-width: none;
  margin: 0;
  border-radius: 0;
  border-width: 0 0 1px;
  border-left: 0;
  background: var(--marker);
  color: var(--on-marker);
  text-align: center;
  font-weight: 700;
  padding: 0.75rem var(--gutter);
}

.download-list {
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
  max-width: var(--measure);
}

.download-list > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.download-list > li > :first-child {
  font-family: var(--font-display);
  font-size: 1.2rem;
}

/* Inhaltsbereich für /danke, Fehlerseiten und Rechtsseiten */
.page > main.content,
.content {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding: clamp(2rem, 6vw, 4rem) var(--gutter) 0;
}

/* ---------- Rechtsseiten ---------- */

.legal {
  max-width: var(--measure);
}

.legal h1 {
  font-size: clamp(2rem, 3vw + 1rem, 3rem);
}

.legal h2 {
  font-size: clamp(1.3rem, 1vw + 1rem, 1.6rem);
  margin-top: 2.25em;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.legal h3 {
  font-size: 1.15rem;
  margin-top: 1.5em;
}

.legal address {
  font-style: normal;
  margin-bottom: 1em;
}

.legal ul {
  padding-left: 1.25rem;
}

.legal li + li {
  margin-top: 0.35em;
}

.legal .url {
  overflow-wrap: anywhere;
}

.legal .stand {
  color: var(--ink-muted);
  font-size: 0.95rem;
}

/* ---------- Bewegung reduzieren ---------- */

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* ---------- Druck ---------- */

@media print {
  .site-header,
  .site-footer,
  .skip-link,
  .notice--draft {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}

/* Logo colours as classes, so the CSP needs no inline-style exception */
.logo-fill-accent { fill: var(--accent); }
.logo-fill-bg { fill: var(--bg); }
.logo-stroke-accent { stroke: var(--accent); }
.logo-fill-marker { fill: var(--marker); }
