/* =============================================
   AVIO Journal – interaktives Magazin (Startseite)
   Logik: js/journal.js · Inhalte: tools/build-journal.py
   Alles unter .journal gekapselt.
============================================= */
.journal {
  --j-ink: #0a0a0b;
  --j-paper: #f4f4f3;
  --j-paper-2: #e7e7e4;
  --j-muted: #6c6c70;
  position: relative;
  background: var(--c-black);
  color: var(--c-white);
  /* oben knapp: folgt direkt auf #referenzen-teaser (der bereits 9rem Abstand unten mitbringt) */
  padding: clamp(1rem, 2vw, 2rem) 0 clamp(4rem, 7vw, 7rem);
  overflow: hidden;
}

.journal__inner {
  width: var(--media-w);
  margin-inline: auto;
}

.journal__head {
  margin-bottom: clamp(2.5rem, 5vw, 4.5rem);
}

.journal__title {
  margin: 0;
  font-size: var(--home-h2-size, clamp(2.4rem, 7vw, 7rem));
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--c-white);
}

.journal__lead {
  max-width: 38em;
  margin: clamp(1.25rem, 2.4vw, 2rem) 0 0;
  font-size: clamp(1.05rem, 1.35vw, 1.4rem);
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.62);
}

/* ── Buchseiten (gemeinsam für Quelle, Slots und Blatt) ── */
.jpage {
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  height: 100%;
  padding: 6% 7% 5%;
  background: var(--j-paper);
  color: var(--j-ink);
  container-type: inline-size;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* Falz: innere Seitenränder dunkeln zum Buchrücken hin ab */
.jpage--l::after,
.jpage--r::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12%;
  pointer-events: none;
}

.jpage--l::after {
  right: 0;
  background: linear-gradient(to left, rgba(10, 10, 11, 0.16), rgba(10, 10, 11, 0.04) 35%, transparent);
}

.jpage--r::after {
  left: 0;
  background: linear-gradient(to right, rgba(10, 10, 11, 0.16), rgba(10, 10, 11, 0.04) 35%, transparent);
}

.jpage--intro {
  background: var(--j-paper-2);
}

.jpage--blank {
  background: var(--j-paper);
}

.jpage__top,
.jpage__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  font-size: clamp(9px, 1.65cqi, 12px);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--j-muted);
}

.jpage__foot {
  margin-top: auto;
  padding-top: 3cqi;
}

.jpage__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--avio-green);
}

/* Titelblatt */
.jcover__title {
  margin: auto 0;
  font-size: clamp(26px, 10.5cqi, 84px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.jcover__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
}

.jcover__brand .avio-power {
  width: 1.15em;
  background-color: var(--j-ink);
}

/* Einführung + Inhalt */
.jintro__title {
  margin: 12cqi 0 0;
  font-size: clamp(20px, 6.2cqi, 48px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.jintro__label {
  margin: auto 0 2.4cqi;
  font-size: clamp(9px, 1.65cqi, 12px);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--j-muted);
}

.jtoc {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid rgba(10, 10, 11, 0.14);
}

.jtoc li {
  border-bottom: 1px solid rgba(10, 10, 11, 0.14);
}

.jtoc__item {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 2.6em minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1em;
  padding: 1.9cqi 0;
  font-size: clamp(12px, 2.5cqi, 17px);
  color: var(--j-ink);
  text-decoration: none;
  transition: color 0.25s ease;
}

.jtoc__num {
  font-size: 0.78em;
  font-weight: 700;
  color: var(--j-muted);
}

.jtoc__title {
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform 0.35s var(--ease);
}

.jtoc__cat {
  font-size: 0.72em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--j-muted);
  white-space: nowrap;
}

/* Artikel – linke Seite */
.jpage__fig {
  flex: 1 1 auto;
  min-height: 0;
  margin: 4cqi 0 4.5cqi;
  overflow: hidden;
  background: #d9d9d6;
}

.jpage__fig img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(0.15) contrast(1.02);
}

.jpage__title {
  margin: 0;
  font-size: clamp(22px, 7.6cqi, 58px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--j-ink);
}

/* Artikel – rechte Seite */
.jpage__deck {
  margin: 9cqi 0 0;
  max-width: 24ch;
  font-size: clamp(18px, 5.6cqi, 42px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.jpage__text {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  max-width: 40em;
  margin: 6cqi 0 0;
  padding-top: 4.5cqi;
  border-top: 1px solid rgba(10, 10, 11, 0.14);
  overflow: hidden;
  font-size: clamp(13px, 2.75cqi, 18px);
  line-height: 1.62;
  color: #3a3a3d;
  /* blendet nur aus, wenn der Text wirklich bis zum Seitenende reicht */
  -webkit-mask-image: linear-gradient(#000 calc(100% - 2.6em), transparent);
  mask-image: linear-gradient(#000 calc(100% - 2.6em), transparent);
}

.jpage__more {
  position: relative;
  z-index: 1;
  display: inline-flex;
  gap: 0.45em;
  font-size: clamp(11px, 2.1cqi, 15px);
  letter-spacing: 0.02em;
  text-transform: none;
  font-weight: 700;
  color: var(--j-ink);
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  padding-bottom: 2px;
  transition: background-size 0.45s var(--ease);
}

.jpage__more span[aria-hidden] {
  display: inline-block;
  color: var(--avio-green);
  transition: transform 0.35s var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  .jpage__more:hover {
    background-size: 100% 1px;
  }
  .jpage__more:hover span[aria-hidden] {
    transform: translate3d(2px, -2px, 0);
  }
  .jtoc__item:hover .jtoc__title {
    transform: translate3d(4px, 0, 0);
  }
}

.jpage__more:focus-visible,
.jtoc__item:focus-visible {
  outline: 2px solid var(--avio-green);
  outline-offset: 3px;
}

/* ── Ohne JS: alle Doppelseiten untereinander lesbar ── */
.journal__source .jspread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 2rem;
  aspect-ratio: 1.68;
}

@media (max-width: 700px) {
  .journal__source .jspread {
    grid-template-columns: 1fr;
    aspect-ratio: auto;
  }
  .journal__source .jpage {
    aspect-ratio: 0.72;
  }
}

/* ── Buch (wird von js/journal.js aufgebaut) ── */
.journal__book.is-ready .journal__source {
  display: none;
}

.journal__stage {
  --book-w: min(88vw, 1480px, (100vh - 190px) * 1.68);
  /* svh: iOS-Toolbar darf das Heft nicht über den Bildschirm schieben */
  --book-w: min(88vw, 1480px, (100svh - 190px) * 1.68);
  position: relative;
  width: var(--book-w);
  aspect-ratio: 1.68;
  margin-inline: auto;
  perspective: 2600px;
  perspective-origin: 50% 40%;
  /* bewusst KEIN preserve-3d: Seiten und Blatt sollen per z-index
     geschichtet werden, nicht per Tiefensortierung (Z-Fighting in Safari) */
  outline: none;
  touch-action: pan-y;
}

/* Papierstapel an den Außenkanten + weicher Bodenschatten */
.journal__stage::before {
  content: "";
  position: absolute;
  inset: 0.6% -0.5% -1.2%;
  border-radius: 3px;
  background:
    repeating-linear-gradient(to right, #cfcfcb 0 1px, #ebebe8 1px 3px) left / 0.8% 100% no-repeat,
    repeating-linear-gradient(to left, #cfcfcb 0 1px, #ebebe8 1px 3px) right / 0.8% 100% no-repeat;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9), 0 18px 40px -20px rgba(0, 0, 0, 0.7);
}

.journal__slot {
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 0;
  width: 50%;
  transform-origin: left center;
  transition: transform 0.6s var(--ease);
}

.journal__slot--l { left: 0; }
.journal__slot--r { left: 50%; }

.journal__slot > .jpage {
  height: 100%;
}

/* Buchrücken */
.journal__spine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(rgba(10, 10, 11, 0.25), rgba(10, 10, 11, 0.4), rgba(10, 10, 11, 0.25));
  pointer-events: none;
  z-index: 3;
}

/* Schatten, den das Blatt auf die Seiten wirft */
.journal__cast {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

.journal__slot--r .journal__cast {
  background: linear-gradient(to right, rgba(10, 10, 11, 0.55), rgba(10, 10, 11, 0.12) 45%, transparent 80%);
}

.journal__slot--l .journal__cast {
  background: linear-gradient(to left, rgba(10, 10, 11, 0.55), rgba(10, 10, 11, 0.12) 45%, transparent 80%);
}

/* Das umblätternde Blatt: Vorder- und Rückseite */
.journal__leaf {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 50%;
  z-index: 4;
  transform-origin: left center;
  transform-style: preserve-3d;
  visibility: hidden;
  pointer-events: none;
  will-change: transform;
}

.journal__leaf.is-active {
  visibility: visible;
}

.journal__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

.journal__face--back {
  transform: rotateY(180deg);
}

.journal__face > .jpage {
  height: 100%;
}

.journal__shade {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

.journal__face--front .journal__shade {
  background: linear-gradient(to right, rgba(10, 10, 11, 0.5), rgba(10, 10, 11, 0.15) 60%, rgba(255, 255, 255, 0.08));
}

.journal__face--back .journal__shade {
  background: linear-gradient(to left, rgba(10, 10, 11, 0.5), rgba(10, 10, 11, 0.15) 60%, rgba(255, 255, 255, 0.08));
}

/* Klickflächen: Seiten sind anklickbar (außer Links) */
.journal__stage .journal__slot--r { cursor: pointer; }
.journal__stage .journal__slot--l { cursor: pointer; }
.journal__stage.is-first .journal__slot--l,
.journal__stage.is-last .journal__slot--r { cursor: default; }

/* Hover-Hinweis: die äußere Blattkante hebt sich minimal */
@media (hover: hover) and (pointer: fine) {
  .journal__stage.is-peek-next .journal__slot--r {
    transform: rotateY(-5deg);
  }
  .journal__stage.is-peek-next .journal__slot--r .journal__cast {
    opacity: 0.18;
    transition: opacity 0.6s var(--ease);
  }
  .journal__stage.is-peek-prev .journal__slot--l {
    transform-origin: right center;
    transform: rotateY(5deg);
  }
}

.journal__stage:focus-visible {
  box-shadow: 0 0 0 2px var(--c-black), 0 0 0 4px var(--avio-green);
}

/* Während des Blätterns/Ziehens: Seiten stehen still */
.journal__stage.is-flipping .journal__slot {
  transition: none;
  transform: none !important;
}

.journal__stage.is-dragging {
  cursor: grabbing;
}

/* Tablet: Doppelseite nutzt fast die volle Breite */
@media (max-width: 1100px) {
  .journal__stage {
    --book-w: min(94vw, (100vh - 170px) * 1.68);
    --book-w: min(94vw, (100svh - 170px) * 1.68);
  }
}

/* Smartphone quer (sehr niedrige Höhe): Heft darf fast die ganze Höhe nutzen */
@media (max-height: 520px) and (orientation: landscape) {
  .journal__stage {
    --book-w: min(94vw, (100vh - 70px) * 1.68);
    --book-w: min(94vw, (100svh - 70px) * 1.68);
  }
}

/* Einzelseiten-Modus (Smartphone ≤ 700px) – zusätzlich über die Höhe
   begrenzt, damit die Seite auch im Querformat ganz sichtbar bleibt */
.journal__stage.is-single {
  --book-w: min(92vw, 640px, (100vh - 170px) * 0.7);
  --book-w: min(92vw, 640px, (100svh - 170px) * 0.7);
  aspect-ratio: 0.7;
}

.journal__stage.is-single .journal__slot--r,
.journal__stage.is-single .journal__leaf {
  left: 0;
  width: 100%;
}

.journal__stage.is-single .journal__slot--l,
.journal__stage.is-single .journal__spine {
  display: none;
}

.journal__stage.is-single .jpage::after {
  display: none;
}


/* Steuerleiste */
.journal__bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 2vw, 1.75rem);
  width: min(var(--media-w), 560px);
  margin: clamp(1.75rem, 3vw, 2.5rem) auto 0;
}

.journal__bar[hidden] {
  display: none;
}

.journal__nav {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: var(--c-white);
  cursor: pointer;
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease), opacity 0.3s var(--ease);
}

.journal__nav svg {
  width: 18px;
  height: 18px;
  transition: transform 0.35s var(--ease);
}

.journal__nav:disabled {
  opacity: 0.3;
  cursor: default;
}

@media (hover: hover) and (pointer: fine) {
  .journal__nav:not(:disabled):hover {
    border-color: rgba(255, 255, 255, 0.4);
    background-color: rgba(255, 255, 255, 0.05);
  }
  .journal__nav--next:not(:disabled):hover svg { transform: translate3d(2px, 0, 0); }
  .journal__nav--prev:not(:disabled):hover svg { transform: translate3d(-2px, 0, 0); }
}

.journal__nav:focus-visible {
  outline: 2px solid var(--avio-green);
  outline-offset: 3px;
}

.journal__progress {
  position: relative;
  flex: 1 1 auto;
  height: 1px;
  background: rgba(255, 255, 255, 0.16);
}

.journal__progress span {
  position: absolute;
  left: 0;
  top: -0.5px;
  height: 2px;
  width: 0;
  background: var(--c-white);
  transition: width 0.8s var(--ease);
}

.journal__count {
  margin: 0;
  min-width: 4.5em;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.7);
}

.journal__all {
  margin: clamp(2.5rem, 4vw, 3.5rem) 0 0;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .journal__slot,
  .journal__progress span {
    transition: none;
  }
}
