/* The website ( giegling.net ): the three parts of a page on a computer screen —
     the left side ( the dates or a text ), the tile in the center ( always fixed, centered in the window, any aspect ratio ) with an
     optional caption under it, the right side ( the shop, the tickets or a text ).
   The tile gets smaller before the sides would come closer to it than --side-gap, the sides get narrower too. With the shop open
   only the right side scrolls ( body.shop-open ), otherwise the page.
   On a phone ( < 992px ) everything is one column: the tile, the left side, the right side. */

:root {
  --font: courier, monospace;
  --font-size: 12px;
  --link: rgb(100, 100, 100);
  --link-hover: black;
  --grayed: rgb(178, 178, 178);
  --warning: #cd0000;
  --margin: 10px;

  --side-top: 30px;
  --side-gap: 40px;            /* the least space between the tile and a side */
  --side-min: 260px;           /* the tile leaves at least this much for each side */
  --tile-base: 400px;
  --left-x: 45px;
  --left-width: 300px;
  --right-x: 50px;
  --right-width: 260px;
}

@media (min-width: 1200px) {
  :root {
    --tile-base: 500px;
    --left-x: 60px;
    --left-width: 400px;
    --right-x: clamp(50px, calc(50vw - 750px), 150px);
    --right-width: 300px;
  }
}

/* ---- general ---- */

body, input, button, textarea, select {
  font-size: var(--font-size);
  font-family: var(--font);
}

body { margin: 0; }

p { margin: 0; }
h3 { margin-top: 0; }
small { font-size: calc(var(--font-size) - 2px); }
a img { border: none; }

a, a:visited, a:focus, a:active {
  color: var(--link);
  text-decoration: none;
  outline: none;
}

a:hover, a.selected, a.selected:hover { color: var(--link-hover); }

ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

.grayed { color: var(--grayed); }
.bold { font-weight: bold; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.subtle { color: var(--link); }
.hidden, [hidden] { display: none !important; }

.mb-1 { margin-bottom: var(--margin); }
.mb-2 { margin-bottom: calc(var(--margin) * 2); }
.mb-3 { margin-bottom: calc(var(--margin) * 3); }
.mt-1 { margin-top: var(--margin); }
.mt-2 { margin-top: calc(var(--margin) * 2); }
.mt-3 { margin-top: calc(var(--margin) * 3); }

/* a white box behind a text, readable over pictures and videos */
.over-cover {
  background-color: white;
  padding: 1px 3px 0 3px;
  display: inline-block;
}

.border-h3 {
  margin-top: 20px;
  font-weight: normal;
}

.border-h3::after { content: "\2014\2014\2014"; }

.popup {
  display: none;
  position: fixed;
  padding: calc(var(--margin) * 2);
  background: white;
  border: 1px solid gray;
}

/* ---- the tile in the center ----
   --ratio: width / height of its content ( the template sets it ), the tile is a square of --tile and the content fits in it */

#center-article {
  --ratio: 1;
  --offset-x: 0px;
  --offset-y: 0px;
  position: relative;
}

#center-article-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

#center-article-wrapper > img,
#center-article-wrapper > a > img,
#center-article-wrapper > iframe,
#center-article-wrapper > video,
.gallery-image-wrapper > img,
.book > img,
#cover-container img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* the caption under the tile and the text above it: they do not move the tile */
#under-center-article {
  text-align: center;
}

#under-center-article a {
  color: black;
  font-weight: bold;
}

/* the text of an image, shown on a click */
.text-behind-image {
  position: absolute;
  inset: 0;
  margin: auto;
  height: fit-content;
  text-align: center;
  background: rgba(255, 255, 255, 0.8);
  padding: 3px 0;
}

/* ---- the sides ---- */

#left-side li, #side-header { margin: 25px 0; }

#left-footer ul li, #footer-navigation ul li {
  display: inline-block;
  margin-right: 5px;
}

#freestyle-nav { margin-bottom: 25px; }
#shop-header { margin-bottom: 20px; }
.success-message { font-weight: bold; }

#contact-footer {
  position: fixed;
  z-index: 0;
}

/* ---- the shop ---- */

#shop:not(.open) { display: none; }
.event-date { margin-bottom: 1lh; }

.cart li, .product-list li { margin: 0 0 25px 0; }
.product-list { margin-top: 25px; }
.status-list { margin-bottom: 50px; }
.book { display: block; }

.form-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: start;
  margin-top: 5px;
}

.form-row.distant, .distant { margin-top: 10px; }
.form-row.wide { display: block; }
.form-row > .form-label:empty::after { content: "\00a0"; }

.form-input input:not([type="radio"], [type="checkbox"]),
.form-input select,
.form-input textarea {
  box-sizing: border-box;
  width: 100%;
  max-width: 190px;
}

input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], textarea {
  border: 1px solid #aaa;
  padding: 1px 0 0 3px;
}

.form-input label, .form-row label.form-label { display: inline-block; }
.form-input > div > div { margin-bottom: 4px; }

label.required::after, .form-label.required::after { content: "*"; }

/* radio buttons and checkboxes: a gray square ( a circle ), filled when chosen */
input[type="radio"], input[type="checkbox"] {
  appearance: none;
  box-sizing: border-box;
  width: var(--font-size);
  height: var(--font-size);
  margin: 3px 3px calc(var(--font-size) / 2) 3px;
  border: 1px solid gray;
  background: white;
  vertical-align: middle;
}

input[type="radio"] { border-radius: 50%; }

input[type="radio"]:checked, input[type="checkbox"]:checked {
  background: gray;
  box-shadow: inset 0 0 0 1px white;
}

.required-warning, .form-warning, .stock-warning, .has-error { color: var(--warning); }
.has-success { color: green; }

#order-form, .update-form { margin-bottom: var(--side-top); }
#terms-label { display: inline; }
.cart-item-amount input { width: 30px; }
.cart-item-donation { width: 90px; }
.cart-item-donation.warning::placeholder { color: var(--warning); }

/* the tickets */
.ticket-group-title {
  display: block;
  font-weight: bold;
}

.ticket-sold-out { text-decoration: line-through; }
.ticket-not-on-sale, .ticket-sold-out { color: #dadada; }
.ticket-edition.selected, .multi-purchase-edition.selected { text-decoration: underline; }

.ticket-edition.selectable, .multi-purchase-edition.selectable, .open-ticket-shop {
  color: var(--link);
  cursor: pointer;
}

.ticket-edition.selectable:hover, .multi-purchase-edition.selectable:hover { color: var(--link-hover); }
input[name="numtickets"] { max-width: 50px; }

/* ---- the player of the records ( the snippets ) ---- */

#player-buttons, #video-player-buttons {
  position: absolute;
  top: 50%;
  left: 10%;
  width: 80%;
  translate: 0 -50%;
  text-align: center;
  font-size: 30px;
  z-index: 5;
}

#video-player-buttons-secondary {
  position: absolute;
  right: var(--margin);
  bottom: var(--margin);
  font-size: 30px;
  z-index: 5;
}

.light-buttons a, #video-player-buttons a, #video-player-buttons-secondary a { color: rgba(150, 150, 150, 0.5); }
.light-buttons a:hover, #video-player-buttons a:hover, #video-player-buttons-secondary a:hover { color: rgba(200, 200, 200, 0.5); }
.dark-buttons a { color: rgba(200, 200, 200, 0.5); }
.dark-buttons a:hover { color: rgba(250, 250, 250, 0.5); }

#video-player-buttons, #video-player-buttons-secondary { display: none; }
#center-article-wrapper:hover #video-player-buttons, #center-article-wrapper:hover #video-player-buttons-secondary,
.video-paused #video-player-buttons { display: block; }

#player-statusbar, #player-position, #player-loading {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 10px;
}

#player-statusbar { cursor: pointer; }
#player-loading { background-color: #ddd; }
#player-position { background-color: #ccc; }

#player-timing, #player-current-track {
  position: absolute;
  bottom: 20px;
  background-color: rgba(255, 255, 255, 0.5);
  padding-top: 1px;
}

#player-timing { right: 0; padding: 1px 10px 0 3px; }
#player-current-track { left: 0; padding: 1px 3px 0 10px; max-width: 70%; }

#player-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.6);
  z-index: 2;
  padding: 30px 10px 0 60px;
}

#player-overlay p { margin-bottom: 12px; }

#player-meta {
  position: absolute;
  top: 5px;
  right: 20px;
  font-size: 20px;
  z-index: 3;
  display: none;
}

#center-article-wrapper:hover ~ #player-meta, #player-meta:hover, #center-article:hover #player-meta { display: block; }

video { background: white; }
:fullscreen, video:fullscreen { background: black !important; }

/* the gallery */
.gallery-nav {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 20px;
  opacity: 0;
  transition: opacity 0.2s;
}

#center-article-wrapper:hover .gallery-nav { opacity: 1; }
.gallery-dot::after { content: "\2022"; font-size: 28px; vertical-align: middle; }
.gallery-previous::after { content: "\25C0"; }
.gallery-next::after { content: "\25B6"; }

.gallery-dot, .gallery-previous, .gallery-next {
  color: #999;
  margin: 0 4px;
}

.gallery-dot.active { color: #fff; }

.gallery.automatic #center-article-wrapper { display: grid; }

.gallery.automatic .gallery-image-wrapper {
  grid-area: 1 / 1;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}

.gallery.automatic .gallery-image-wrapper.active { opacity: 1; }

/* ---- a phone or a small tablet: one column ---- */

@media (max-width: 991px) {
  :root {
    --font-size: 18px;
    --margin-mobile: 20px;
  }

  body {
    margin: var(--margin-mobile);
    line-height: 22px;
  }

  button, select, input:not([type="radio"], [type="checkbox"]) { height: 36px; }
  button.small-mobile { height: 24px; font-size: 14px; }
  small { font-size: 12px; }

  .hidden-mobile { display: none !important; }

  #center-article { width: 100%; }
  #center-article-wrapper { aspect-ratio: var(--ratio); height: auto; }
  #center-article.fullscreen #center-article-wrapper { aspect-ratio: auto; }
  #under-center-article { margin-top: 20px; }
  #above-center-article { margin-bottom: 20px; }

  #content-wrapper, #left-side { margin-bottom: var(--margin-mobile); }
  #right-side { margin-bottom: 90px; }

  .mb-1 { margin-bottom: var(--margin-mobile); }
  .mb-2 { margin-bottom: calc(var(--margin-mobile) * 2); }

  #contact-footer {
    bottom: var(--margin-mobile);
    right: var(--margin-mobile);
  }

  .form-row { grid-template-columns: minmax(0, 1fr); margin-bottom: 10px; }
  .form-row.distant, .distant { margin-top: 40px; }
  .form-input input:not([type="radio"], [type="checkbox"]), .form-input select, .form-input textarea { max-width: none; height: 22px; }
  .form-input select { height: 36px; }
  .form-input textarea { height: auto; }
  .cart-item-donation { width: 140px; }

  /* the player of the records: a bar at the bottom of the screen, from the top: the name of the track and the time, the buttons,
     the progress */
  #player-statusbar {
    position: fixed;
    height: 92px;
    background: white;
    border-top: gray dotted 1px;
    z-index: 1;
  }

  #player-buttons {
    position: fixed;
    top: auto;
    bottom: 20px;
    left: 0;
    width: 100%;
    translate: none;
    line-height: 36px;
  }

  #player-loading, #player-position { height: 18px; }

  #player-current-track, #player-timing {
    position: fixed;
    bottom: 62px;
    z-index: 2;
    white-space: nowrap;
  }

  #player-current-track {
    max-width: calc(100% - 15ch);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body:has(#player-statusbar) #right-side { margin-bottom: 120px; }
}

/* ---- a computer screen: the tile in the middle, the sides left and right of it ---- */

@media (min-width: 992px) {
  :root {
    /* the size of the square of the tile: smaller on a low window and before it would come too close to the sides */
    --tile: min(var(--tile-base), calc(100vh - 2 * var(--side-top)), calc(100vw - 2 * var(--side-min)));
    --side-room: calc((100vw - var(--tile)) / 2 - var(--side-gap));
  }

  .visible-mobile { display: none !important; }

  #center-article {
    position: fixed;
    left: 50%;
    top: 50%;
    width: calc(var(--tile) * min(1, var(--ratio)));
    height: calc(var(--tile) * min(1, 1 / var(--ratio)));
    translate: calc(-50% - var(--offset-x)) calc(-50% - var(--offset-y));
  }

  #center-article.fullscreen {
    inset: 0;
    width: auto;
    height: auto;
    translate: none;
  }

  #under-center-article, #above-center-article {
    position: absolute;
    left: 50%;
    width: max(100%, var(--tile));
    translate: -50% 0;
  }

  #under-center-article { top: 100%; margin-top: 20px; }
  #above-center-article { bottom: 100%; margin-bottom: 20px; text-align: center; }

  #left-side, #right-side {
    position: absolute;
    top: var(--side-top);
    box-sizing: border-box;
  }

  #left-side {
    left: var(--left-x);
    width: min(var(--left-width), calc(var(--side-room) - var(--left-x)));
    z-index: 100;
  }

  #right-side {
    right: var(--right-x);
    width: min(var(--right-width), calc(var(--side-room) - var(--right-x)));
    z-index: 100;
  }

  /* the shop is open: only the right side scrolls ( it reaches to the edge of the window, its scrollbar is there ) */
  body.shop-open { overflow: hidden; }

  body.shop-open #right-side {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: calc(min(var(--right-width), calc(var(--side-room) - var(--right-x))) + var(--right-x));
    padding: var(--side-top) var(--right-x) 0 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  #contact-footer {
    right: 10px;
    bottom: 10px;
    padding: 1px 0 0 3px;
  }

  /* the forms in a narrow side: the labels above the fields */
  #right-side, #left-side { container-type: inline-size; }
}

@container (max-width: 279px) {
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .form-row > .form-label:empty { display: none; }
  .form-input input:not([type="radio"], [type="checkbox"]), .form-input select, .form-input textarea { max-width: none; }
}

#cover-container, #cover-container > a, .book {
  display: block;
  width: 100%;
  height: 100%;
}

.form-warning:empty, .required-warning:empty { display: none; }
.form-input label { background-color: white; padding: 1px 3px 0 3px; }
