/* ==========================================================================
   components.css – reusable pieces

   1. Buttons, chips, notices, social links
   2. Date leaf
   3. Event card (upcoming show)
   4. Post rows (past shows, search results)
   5. Play cards (repertoire)
   6. Callout
   7. Photo gallery and lightbox
   8. Pagination and search form
   9. Reveal on scroll
   10. News carousel
   11. Video placeholder
   ========================================================================== */

/* ---------- 1. Buttons, chips, notices ---------- */

/* A chunky button that can be "pressed": the darker edge below it shrinks on hover and click. */
.button {
  display: inline-block;
  padding: 0.7em 1.5em;
  border: 0;
  border-radius: var(--radius-pill);
  font: inherit;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  text-decoration: none;
  background: var(--color-tomato);
  box-shadow: 0 4px 0 var(--color-tomato-dark);
  cursor: pointer;
  transition: translate 0.1s, box-shadow 0.1s;
}

.button:hover {
  color: #fff;
  translate: 0 1px;
  box-shadow: 0 3px 0 var(--color-tomato-dark);
}

.button:active {
  translate: 0 4px;
  box-shadow: none;
}

/* Outlined button for the dark stage. */
.button--ghost {
  color: var(--color-on-stage);
  background: none;
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.5);
}

.button--ghost:hover {
  color: var(--color-sun);
  translate: none;
  box-shadow: inset 0 0 0 2px var(--color-sun);
}

/* Outlined button for light backgrounds, for secondary actions like "back to …". */
.button--quiet {
  color: var(--color-plum);
  background: none;
  box-shadow: inset 0 0 0 2px var(--color-plum);
}

.button--quiet:hover {
  color: #fff;
  translate: none;
  background: var(--color-plum);
  box-shadow: inset 0 0 0 2px var(--color-plum);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
}

.chip {
  padding: 0.2em 0.85em;
  border: 2px solid var(--color-line);
  border-radius: var(--radius-pill);
  font-size: var(--text-small);
  font-weight: 700;
  color: var(--color-plum);
  background: #fff;
}

.stage .chip {
  border-color: transparent;
  color: var(--color-sun);
  background: rgb(255 255 255 / 0.12);
}

.notice {
  max-width: var(--width-content);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-card);
  background: var(--color-butter);
}

/*
 * Links to Facebook and VK. With an icon file a link is a round icon button, without one a pill
 * with the platform's name (see template-parts/social-links.php).
 * Outlined on the stage; "--big" is the filled yellow version in the footer.
 */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-links__link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.95rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-on-stage);
  text-decoration: none;
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.45);
}

.social-links__link:hover {
  color: var(--color-sun);
  box-shadow: inset 0 0 0 2px var(--color-sun);
}

.social-links__link--icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
}

/* The icon file is used as a stencil (mask) and filled with the text color. */
.social-links__icon {
  width: 1.25rem;
  height: 1.25rem;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.social-links--big .social-links__link {
  padding: 0.5rem 1.4rem;
  font-size: 1rem;
  color: var(--color-stage);
  background: var(--color-sun);
  box-shadow: none;
}

.social-links--big .social-links__link:hover {
  color: var(--color-stage);
  background: #fff;
  box-shadow: none;
}

.social-links--big .social-links__link--icon {
  width: 3rem;
  height: 3rem;
  padding: 0;
}

.social-links--big .social-links__icon {
  width: 1.5rem;
  height: 1.5rem;
}

/* ---------- 2. Date leaf ---------- */

/* A date as a little calendar leaf. Sized in em, so a smaller font-size shrinks the whole leaf. */
.date-leaf {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  width: 5.4em;
  padding: 0.6em 0.4em 0.7em;
  border-radius: 1.2em;
  line-height: 1.1;
  color: var(--color-on-stage);
  background: var(--color-plum);
}

.date-leaf__weekday,
.date-leaf__month {
  font-size: 0.85em;
  font-weight: 700;
}

.date-leaf__day {
  font-family: var(--font-display);
  font-size: 2.3em;
  font-weight: var(--font-display-weight);
  color: var(--color-sun);
}

/* ---------- 3. Event card ---------- */

.event-cards {
  position: relative;
  display: grid;
  gap: 1.75rem;
}

/* Two shapes peek out from behind the cards: a peach blob top right, a blue ring bottom left. */
.event-cards::before,
.event-cards::after {
  content: "";
  position: absolute;
}

.event-cards::before {
  top: -2.4rem;
  right: calc(var(--gutter) * -0.7);
  width: 9rem;
  height: 9rem;
  border-radius: 58% 42% 55% 45% / 48% 57% 43% 52%;
  background: var(--color-peach);
}

.event-cards::after {
  bottom: -2rem;
  left: calc(var(--gutter) * -0.7);
  width: 6.5rem;
  height: 6.5rem;
  border: 0.9rem solid var(--color-sky);
  border-radius: 50%;
}

/* White card with a "paper edge" below it. Used by .event-card; the play poster frame uses the same look. */
.event-card {
  position: relative; /* in front of the shapes of .event-cards */
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 17rem);
  gap: 1.25rem 2rem;
  align-items: start;
  padding: clamp(1.1rem, 3vw, 1.75rem);
  border: 2px solid var(--color-line);
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: 0 6px 0 var(--color-line);
}

.event-card__title {
  margin-bottom: 0.6em;
  font-size: clamp(1.5rem, 1.2vw + 1.1rem, 2rem); /* a little smaller than h2: play names are long and the font is wide */
}

.event-card__title a {
  text-decoration: none;
}

.event-card__poster img {
  display: block;
  width: 100%;
  border-radius: 18px;
}

.event-details {
  display: grid;
  gap: 0.5rem;
  margin: 0;
}

.event-details > div {
  display: grid;
  grid-template-columns: 4.2rem minmax(0, 1fr);
  gap: 0.75rem;
}

.event-details dt {
  padding-top: 0.15em;
  font-size: var(--text-small);
  font-weight: 700;
  color: var(--color-ink-soft);
}

.event-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Below this width the poster moves under the text, so the title keeps a full line. */
@media (max-width: 999px) {
  .event-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .event-card__poster {
    grid-column: 1 / -1;
    max-width: 24rem;
  }
}

@media (max-width: 479px) {
  .event-card {
    grid-template-columns: 1fr;
  }

  .event-card .date-leaf {
    flex-direction: row;
    gap: 0.5em;
    align-items: baseline;
    width: fit-content;
    padding: 0.3em 1em 0.4em;
  }
}

/* ---------- 4. Post rows ---------- */

.post-rows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr));
  gap: 0.5rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-row__link {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
  padding: 0.6rem;
  border-radius: var(--radius-card);
  color: var(--color-ink);
  text-decoration: none;
  transition: background-color 0.15s;
}

.post-row__link:hover {
  color: var(--color-ink);
  background: var(--color-peach);
}

/* Past dates are quieter than the plum leaf of an upcoming show. */
.post-row .date-leaf {
  font-size: 0.8rem;
  color: var(--color-ink);
  background: var(--color-peach);
}

.post-row .date-leaf__day {
  color: var(--color-plum);
}

.post-row__link:hover .date-leaf {
  background: #fff;
}

.post-row__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.post-row__headline {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: var(--font-display-weight);
  line-height: 1.25;
  color: var(--color-plum);
}

.post-row__context {
  display: -webkit-box;
  overflow: hidden;
  font-size: var(--text-small);
  color: var(--color-ink-soft);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* ---------- 5. Play cards ---------- */

.play-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(45%, 13rem), 1fr));
  gap: 2.25rem 1.75rem;
}

.play-card {
  text-align: center;
}

.play-card__link {
  display: block;
  text-decoration: none;
}

/* The poster hangs slightly crooked, like pinned to a board, and straightens when touched. */
.play-card__poster {
  display: block;
  aspect-ratio: 3 / 4;
  padding: 0.5rem;
  border: 2px solid var(--color-line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 6px 0 var(--color-line);
  rotate: -1.5deg;
  transition: rotate 0.25s, translate 0.25s;
}

.play-card:nth-child(even) .play-card__poster {
  rotate: 1.5deg;
}

.play-card__link:hover .play-card__poster,
.play-card__link:focus-visible .play-card__poster {
  rotate: 0deg;
  translate: 0 -4px;
}

.play-card__poster img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  object-fit: contain;
}

.play-card__title {
  margin: 1rem 0 0.5rem;
  font-size: 1.2rem;
}

.play-card .chips {
  justify-content: center;
}

/* On the butter band the white chip needs no border. */
.band .chip {
  border-color: transparent;
}

/* ---------- 6. Callout ---------- */

.callout__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.callout__text {
  max-width: 38rem;
}

.callout__text p:last-child {
  margin: 1.5rem 0 0;
}

.callout__puppet {
  flex: none;
  width: auto;
  height: clamp(9rem, 22vw, 17rem);
}

@media (max-width: 599px) {
  .callout__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .callout__puppet {
    align-self: flex-end;
    margin-top: -5rem;
  }
}

/* ---------- 7. Photo gallery and lightbox ---------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(45%, 13rem), 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery-grid a {
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  background: var(--color-line);
}

.gallery-grid img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: scale 0.3s;
}

.gallery-grid a:hover img {
  scale: 1.05;
}

/* The lightbox is a <dialog> that main.js creates when a photo is opened. */
.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox::backdrop {
  background: rgb(26 12 36 / 0.93);
}

.lightbox__image {
  max-width: 92vw;
  max-height: 86dvh;
  border-radius: 14px;
}

.lightbox__button {
  position: fixed;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 1;
  color: #fff;
  background: rgb(255 255 255 / 0.16);
  cursor: pointer;
}

.lightbox__button:hover {
  color: var(--color-stage);
  background: var(--color-sun);
}

.lightbox__button--close { top: 1rem; right: 1rem; }
.lightbox__button--previous { top: 50%; left: 1rem; translate: 0 -50%; }
.lightbox__button--next { top: 50%; right: 1rem; translate: 0 -50%; }

/* ---------- 8. Pagination and search form ---------- */

.pagination {
  margin-top: 2.5rem;
}

.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.pagination .page-numbers {
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  text-decoration: none;
  background: var(--color-peach);
}

.pagination .page-numbers.current {
  color: #fff;
  background: var(--color-plum);
}

.pagination .page-numbers.dots {
  background: none;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block: 1.5rem;
}

.search-form__field {
  flex: 1 1 14rem;
  padding: 0.65em 1.2em;
  border: 2px solid var(--color-line);
  border-radius: var(--radius-pill);
  font: inherit;
  color: var(--color-ink);
  background: #fff;
}

/* ---------- 9. Reveal on scroll ---------- */

/*
 * Elements with .reveal fade in gently when they scroll into view (main.js adds .is-visible).
 * Without JavaScript they are simply visible.
 */
.js .reveal {
  opacity: 0;
  translate: 0 16px;
  transition: opacity 0.6s ease-out, translate 0.6s ease-out;
}

.js .reveal.is-visible {
  opacity: 1;
  translate: 0;
}

/* ---------- 10. News carousel ---------- */

/*
 * A row of cards that scrolls sideways and snaps to the cards. It works by swiping, with a trackpad
 * and with the arrow keys; main.js adds the two arrow buttons when there is more than fits.
 */
.carousel__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0 1.5rem;
}

.carousel__buttons {
  display: flex;
  gap: 0.5rem;
}

.carousel__buttons[hidden] {
  display: none;
}

.carousel__button {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0 0 0.15em;
  border: 0;
  border-radius: 50%;
  font-size: 1.7rem;
  line-height: 1;
  color: #fff;
  background: var(--color-plum);
  cursor: pointer;
}

.carousel__button:hover {
  background: var(--color-tomato);
}

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

.carousel__track {
  display: grid;
  grid-auto-columns: min(100%, 21rem);
  grid-auto-flow: column;
  gap: 1.5rem;
  margin: 0;
  padding: 0 0 0.75rem; /* room for the cards' paper edge */
  overflow-x: auto;
  list-style: none;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
}

/* With JavaScript the arrow buttons replace the scrollbar. */
.js .carousel__track {
  scrollbar-width: none;
}

.carousel__slide {
  scroll-snap-align: start;
}

.news-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 2px solid var(--color-line);
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: 0 6px 0 rgb(42 21 56 / 0.08);
}

.news-card__image img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

/* No picture: a puppet stands in, on a pastel background of the same size. */
.news-card__image--puppet {
  position: relative;
  display: block;
  aspect-ratio: 3 / 2;
  background: var(--color-sky);
}

.news-card__image--puppet img {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: auto;
  height: 88%;
  aspect-ratio: auto;
  translate: -50% 0;
}

.news-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.25rem 1.5rem 1.5rem;
}

.news-card__date {
  margin: 0 0 0.4rem;
  font-size: var(--text-small);
  font-weight: 700;
  color: var(--color-ink-soft);
}

.news-card__title {
  font-size: 1.3rem;
}

.news-card__title a {
  text-decoration: none;
}

.news-card__excerpt {
  font-size: 1rem;
}

.news-card__more {
  margin-top: auto;
  font-weight: 700;
}

/* A single news post fills the row: picture left, text right. */
.carousel__track--single {
  grid-auto-columns: 100%;
}

@media (min-width: 700px) {
  .carousel__track--single .news-card {
    flex-direction: row;
  }

  .carousel__track--single .news-card__image {
    flex: 0 0 40%;
  }

  .carousel__track--single .news-card__image:not(.news-card__image--puppet) img {
    height: 100%;
  }

  .carousel__track--single .news-card__body {
    justify-content: center;
    padding: 2rem 2.5rem;
  }

  .carousel__track--single .news-card__title {
    font-size: var(--text-h3);
  }
}

/* ---------- 11. Video placeholder ---------- */

/*
 * Stands in for a YouTube player until the visitor clicks "Video abspielen" (see inc/embeds.php).
 * It is built from <span> elements, so everything is switched to block or flex here.
 */
.video-consent {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  aspect-ratio: 16 / 9;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-card);
  line-height: 1.45;
  color: var(--color-on-stage);
  text-align: center;
  background:
    radial-gradient(ellipse 60% 90% at 50% 0%, rgb(255 210 63 / 0.26), transparent 70%),
    var(--color-stage);
}

.video-consent__title {
  font-family: var(--font-display);
  font-size: var(--text-large);
}

/* A play triangle in front of the button text. */
.video-consent__button::before {
  content: "";
  display: inline-block;
  margin-right: 0.6em;
  border: solid transparent;
  border-width: 0.4em 0 0.4em 0.65em;
  border-left-color: currentColor;
}

.video-consent__note {
  max-width: 30rem;
  font-size: 0.85rem;
  color: var(--color-on-stage-soft);
}

.video-consent__note a {
  margin-left: 0.4em;
  color: var(--color-on-stage);
  white-space: nowrap;
}

.video-consent__note a:hover {
  color: var(--color-sun);
}

/* Inside the editor's embed block the frame already has the video's proportions. */
.wp-embed-responsive .wp-has-aspect-ratio .wp-block-embed__wrapper .video-consent {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
  overflow: auto;
}
