/*
 * Post-Footer: Jahreszahl, Schriftwechsler, Pfad, Sprechblase „Deine Schrift“
 * Auch für eigenständige Seiten ohne Website-CSS.
 */

.postfooter {
	padding: 30px 0px 40px 0px;
	background-color: transparent;
	margin-top: auto;
}

.postfooter-standalone {
	background-color: var(--clr-surface);
}

.postfooter-content {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
}

.postfooter-left {
	display: flex;
	align-items: center;
	gap: 60px;
	flex-wrap: wrap;
}

.postfooter-right {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.footer-date,
.footer-colophon,
.footer-credits {
	display: inline-block;
	vertical-align: middle;
}

.footer-colophon {
	margin-left: 0;
}

.font-switcher-wrapper {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
}

@media (max-width: 768px) {
  .postfooter-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .postfooter-left,
  .postfooter-right {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .footer-credits {
    display: none;
  }
}

@media (max-width: 480px) {
  .postfooter {
    padding: var(--spacing-4) 0;
  }

  .postfooter .container {
    padding: 0 1rem;
  }

  /* Font-Switcher: Desktop verstecken, Mobile anzeigen */
  .font-switcher-desktop {
    display: none;
  }

  .font-switcher-mobile {
    display: block;
  }
}

/* Font-Switcher: Mobile verstecken, Desktop anzeigen */
@media (min-width: 481px) {
  .font-switcher-desktop {
    display: block;
  }

  .font-switcher-mobile {
    display: none;
  }
}

/* Mobiler Font-Switcher: eine Zeile „Schrift ‹ Name ›“ */
.font-switcher-line {
  display: flex;
  align-items: center;
  gap: 2px;
}

.font-switcher-step {
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  background: none;
  border: 0;
  border-radius: 0;
  font: inherit;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  color: var(--clr-text-muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.font-switcher-step:hover {
  color: var(--clr-text);
}

.font-switcher-name {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  min-height: 44px;
}

.font-switcher-current {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Unsichtbare Systemauswahl über dem Namen (iOS: Drehrad) */
.font-switcher-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 16px; /* verhindert Zoom auf iOS */
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.font-switcher-step:active,
.font-switcher-name:active .font-switcher-current {
  opacity: 0.4;
}

.font-switcher-native:focus-visible {
  opacity: 0;
}

.font-switcher-name:focus-within .font-switcher-current {
  outline: 2px solid var(--clr-primary);
  outline-offset: 2px;
}

/* Jahreszahl: kurz nur mobil */
.footer-date-short {
  display: none;
}

.font-switcher-wrapper {
  position: relative;
}

/* Sprechblase zu „Deine Schrift“ */
.font-hint {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 12px;
  width: max-content;
  max-width: min(320px, calc(100vw - 32px));
  padding: 12px 32px 12px 14px;
  background: color-mix(in srgb, var(--clr-surface) 72%, transparent);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  backdrop-filter: blur(28px) saturate(1.4);
  color: var(--clr-text);
  border: 1px solid var(--clr-gray-border);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  z-index: 1001;
}

.font-hint p {
  margin: 0 0 6px;
}

.font-hint p:last-of-type {
  margin-bottom: 0;
}

.font-hint code {
  font-size: 0.9em;
  user-select: all;
}

/* Spitze der Sprechblase */
.font-hint::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 20px;
  border: 7px solid transparent;
  border-top-color: var(--clr-surface);
  filter: drop-shadow(0 1px 0 var(--clr-gray-border));
}

.font-hint-close {
  position: absolute;
  top: 4px;
  right: 6px;
  padding: 2px 6px;
  margin: 0;
  height: auto;
  line-height: 1;
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--clr-text-muted);
  cursor: pointer;
}

.font-hint-close:hover {
  color: var(--clr-text);
}

/* Mobile Fußzeile: eine Zeile – Jahr links, Schrift mittig, Pfad rechts */
@media (max-width: 480px) {
  .postfooter-content {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0 8px;
  }

  .postfooter-left {
    display: contents;
  }

  .footer-date {
    grid-column: 1;
    white-space: nowrap;
  }

  .footer-date-long,
  .footer-colophon,
  .footer-credits {
    display: none;
  }

  .footer-date-short {
    display: inline;
  }

  /* Letzte Zeile auf derselben Kante wie die Akkordeons darüber */
  .postfooter .container {
    padding: 0 20px;
  }

  .font-switcher-wrapper {
    grid-column: 2;
    justify-self: center;
    min-width: 0;
    max-width: 100%;
  }

  .font-switcher-mobile,
  .font-switcher-line {
    min-width: 0;
    max-width: 100%;
  }

  .font-switcher-step {
    padding: 0 6px;
  }

  .postfooter-right {
    grid-column: 3;
    width: auto;
    justify-self: end;
    white-space: nowrap;
  }

  /* Sprechblase über die ganze Zeile, Spitze mittig über der Schrift */
  .postfooter-content {
    position: relative;
  }

  .postfooter-content .font-switcher-wrapper {
    position: static;
  }

  .font-hint {
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
  }

  .font-hint::after {
    left: 50%;
    margin-left: -7px;
  }
}

/* Seitentitel rechts */
.footer-page-title {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;

}

/* Schriftwechsler-Auswahl so breit wie ihr Inhalt, auch wenn das Seiten-CSS Felder anders setzt */
.postfooter select {
  width: auto;
  max-width: none;
  margin: 0;
}

/* Colophon und Credits schon ab iPad-Breite ausblenden, damit die Zeile Luft hat */
@media (max-width: 1024px) {
  .footer-colophon,
  .footer-credits {
    display: none;
  }
}
