/*
 * TSV Instagram Feed
 *
 * Colours can be changed without touching this file, e.g. in Divi's
 * "Additional CSS":   .tsvig { --tsvig-navy: #123456; --tsvig-yellow: #ffd500; }
 *
 * Fonts are inherited from the theme on purpose: the title is a real <h3>, so
 * it uses the heading font of the site; everything else uses the body font.
 * Selectors start with ".tsvig" so that theme rules for h3, a and img (which
 * have the same or lower specificity as a single class) do not win.
 */

.tsvig {
  --tsvig-navy: #184274;
  --tsvig-yellow: #ffe807;
  --tsvig-text: #666;
  --tsvig-border: #d9d9d9;
  --tsvig-gap: 8px;

  box-sizing: border-box;
  max-width: 100%;
  margin: 0 0 30px;
  overflow: hidden; /* clips the yellow title bar to the card's rounded corners */
  background: #fff;
  border: 1px solid var(--tsvig-border);
  border-radius: 6px;
  color: var(--tsvig-text);
  font-family: inherit;
}

.tsvig *,
.tsvig *::before,
.tsvig *::after {
  box-sizing: border-box;
}

/* Title bar, like the widget titles in the sidebar. No font-family on purpose; the size follows the sidebar titles. */
.tsvig .tsvig__title {
  margin: 0;
  padding: 12px 16px;
  background: var(--tsvig-yellow);
  color: var(--tsvig-navy);
  font-size: var(--tsvig-title-size, 28px);
  line-height: 1.2;
  text-align: center;
}

/* Grid: desktop N columns, tablet (<= 980px) and phone (<= 767px) use the capped counts set by the renderer. */
.tsvig .tsvig__grid {
  display: grid;
  grid-template-columns: repeat(var(--tsvig-cols, 3), minmax(0, 1fr));
  gap: var(--tsvig-gap);
  padding: 16px 16px 0;
}

@media (max-width: 980px) {
  .tsvig .tsvig__grid {
    grid-template-columns: repeat(var(--tsvig-cols-tablet, 3), minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .tsvig .tsvig__grid {
    grid-template-columns: repeat(var(--tsvig-cols-phone, 2), minmax(0, 1fr));
  }
}

/* Tiles */
.tsvig .tsvig__item {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 4px;
  background: #e8edf3;
  line-height: 0;
  text-decoration: none;
  box-shadow: none;
}

.tsvig .tsvig__img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  object-fit: cover;
}

/* Hover / focus: navy veil with a yellow Instagram symbol. */
.tsvig .tsvig__item::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: var(--tsvig-navy);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tsvig .tsvig__hover {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tsvig-yellow);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tsvig .tsvig__item:hover::after,
.tsvig .tsvig__item:focus-visible::after {
  opacity: 0.55;
}

.tsvig .tsvig__item:hover .tsvig__hover,
.tsvig .tsvig__item:focus-visible .tsvig__hover {
  opacity: 1;
}

/* Video / carousel symbol, top right. */
.tsvig .tsvig__type {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  color: #fff;
  line-height: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
  pointer-events: none;
}

/* Keyboard focus: a navy ring is visible on the white card (yellow would not be). */
.tsvig .tsvig__item:focus-visible,
.tsvig .tsvig__button:focus-visible {
  outline: 3px solid var(--tsvig-navy);
  outline-offset: 2px;
}

/* "Auf Instagram folgen", styled like the sidebar buttons. */
.tsvig .tsvig__follow {
  margin: 0;
  padding: 16px;
  text-align: center;
}

.tsvig .tsvig__button {
  display: inline-block;
  padding: 8px 22px;
  background: var(--tsvig-navy);
  border: 2px solid var(--tsvig-yellow);
  border-radius: 4px;
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.tsvig .tsvig__button:hover {
  background: var(--tsvig-yellow);
  color: var(--tsvig-navy);
}

@media (prefers-reduced-motion: reduce) {
  .tsvig .tsvig__item::after,
  .tsvig .tsvig__hover,
  .tsvig .tsvig__button {
    transition: none;
  }
}
