/* White background, no grid — clear contrast to dark image pages */
body.text-page::before {
  background-image: none;
}

body.text-page::after {
  background-color: var(--color-surface);
  background-image: none;
}

/* Text pages scroll with the document itself — no nested scroll box. Body
   is left to grow to its content's natural height (min-height keeps short
   pages filling the viewport); .tp-container just sizes to its content. */
html.is-text-page {
  height: auto;
  overflow-x: hidden;
}

body.text-page {
  height: auto;
  min-height: 100dvh;
}

.tp-container {
  /* nav is a fixed 50px pill floating 50px above the viewport bottom (100px
     total) — it isn't part of the document flow, so nothing here pushes it
     out of the way automatically. margin-bottom reserves that clearance at
     the true end of the page, so content can never end up permanently
     hidden underneath it once you've scrolled all the way down. */
  margin-bottom: 130px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 8vw 24px 24px;
}

.tp-content {
  max-width: 480px;
  width: 100%;
  margin-bottom: 20px;
}

.tp-content h1 {
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  font-weight: 620;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 2rem;
}

.tp-content h2 {
  font-size: 0.65rem;
  font-weight: 620;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.tp-content p {
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--ink-muted);
}

.tp-content p + p {
  margin-top: 0.9em;
}

.tp-content h2 + p {
  margin-top: 0;
}

.tp-content hr {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  margin: 2rem 0;
}

.tp-link {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.7em 1.6em;
  background: var(--accent);
  color: var(--ink-on-accent);
  text-decoration: none;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: background var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard);
}

.tp-link:hover {
  background: color-mix(in oklch, var(--accent) 95%, black);
  transform: translateY(-2px);
}
.tp-link:active { transform: translateY(0) scale(0.97); }
.tp-link:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }

.tp-bmc {
  margin-top: 1.5rem;
}

.tp-bmc-tagline {
  font-size: 0.8rem;
  color: var(--ink-faint);
  line-height: 1.45;
  margin-bottom: 0.9rem;
}

/* Title page: card band */
.tp-card-band {
  position: fixed;
  bottom: -30px;
  left: 0;
  right: 0;
  height: 220px;
  pointer-events: none;
  z-index: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(-200px, calc(-160px + 8vw), -60px);
}

.tp-card-band img {
  width: auto;
  flex-shrink: 0;
  height: clamp(180px, 28vh, 300px);
  transform: rotate(var(--rot));
  transform-origin: center 20%;
  border-radius: 3px;

}

/* Title page is a fixed, single-viewport hero — unlike intro/random text
   pages it never needs to scroll, so it keeps the old fixed-height,
   internally-centered box instead of growing with the document. */
body.is-title {
  height: 100dvh;
  min-height: 100dvh;
}

body.is-title .tp-container {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin-bottom: 0;
}

/* Card band: show 2 on narrow, 4 on medium, 6 on wide */
@media (max-width: 900px) {
  .tp-card-band img:nth-child(1),
  .tp-card-band img:nth-child(6) { display: none; }
}
@media (max-width: 480px) {
  .tp-card-band img:nth-child(2),
  .tp-card-band img:nth-child(5) { display: none; }
  .tp-card-band img { height: clamp(180px, 28vh, 300px); }
}

/* Title page: hero layout */
body.is-title .tp-container {
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
}

body.is-title .tp-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.is-title h1 {
  font-size: clamp(2rem, 8vw, 3.2rem);
  margin-bottom: 1rem;
  line-height: 1;
}

body.is-title nav {
  display: none;
}

.tp-start-btn {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.65em 2em;
  background: var(--accent);
  color: var(--ink-on-accent);
  text-decoration: none;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  transition: background var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard);
}
.tp-start-btn:hover {
  background: color-mix(in oklch, var(--accent) 95%, black);
  transform: translateY(-2px);
}
.tp-start-btn:active { transform: translateY(0) scale(0.97); }
.tp-start-btn:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }

/* Two-column layout (intro page) — iPad landscape and wider */
@media (min-width: 1024px) {
  body.layout-two-col .tp-content {
    max-width: 86ch;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "title    title"
      "text     features"
      "text     bmc";
    column-gap: 2.5rem;
    align-items: start;
  }

  body.layout-two-col .tp-container {
    padding-left: max(24px, 4vw);
    padding-right: max(24px, 4vw);
  }

  body.layout-two-col .tp-content > h1 {
    grid-area: title;
  }

  body.layout-two-col .tp-text-col {
    grid-area: text;
  }

  body.layout-two-col .tp-features {
    grid-area: features;
    margin: 0;
    width: 100%;
    --bleed: 0px;
  }

  body.layout-two-col .tp-bmc {
    grid-area: bmc;
    margin-top: 0.75rem;
  }
}

/* Feature card grid (sections with icon) */
.tp-features {
  /* Break out of the 480px text column when the screen has room.
     tp-container has 24px padding each side, so available space beyond
     the text column is (100vw - 48px - 480px) / 2, capped at 80px. */
  --bleed: clamp(0px, calc((100vw - 48px - 480px) / 2), 80px);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-top: 2rem;
  margin-left: calc(-1 * var(--bleed));
  margin-right: calc(-1 * var(--bleed));
  width: calc(100% + var(--bleed) * 2);
}

.tp-feature {
  background: var(--surface-sunken);
  border-radius: var(--radius-md);
  padding: 1rem 1rem 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-fast) var(--ease-standard);
}
.tp-feature:hover {
  box-shadow: var(--shadow-md);
}

.tp-feature:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.tp-feature .icon {
  width: 20px;
  height: 20px;
  color: var(--ink);
  margin-bottom: 0.65rem;
}

.tp-feature h2 {
  margin-top: 0;
  margin-bottom: 0.35rem;
}

.tp-feature p {
  margin: 0;
  font-size: 0.83rem;
  line-height: 1.55;
  color: var(--ink-muted);
}

@media (max-width: 520px) {
  .tp-features {
    grid-template-columns: 1fr;
  }
}

/* Nav delay */
body.text-page nav {
  transition: opacity 0.6s;
}
html[data-nav-delay] nav {
  opacity: 0;
  pointer-events: none;
}

/* Hide gallery-specific nav elements on text pages */
body.text-page #slideshow-button,
body.text-page #share-button,
body.text-page #jump-control,
body.text-page a[href="/suche.php"],
body.text-page a[title="Kommentare"] {
  display: none !important;
}

/* Nav is not a shared element on text pages — transitions as part of root crossfade */
body.text-page nav {
  view-transition-name: none;
}
