/* Shared components. Class names follow the old Astro components 1:1
   (Button, Tag, Callout, Prose, Pagination, Header, Nav, LangSwitcher,
   Footer, cards, SourceList, CopyField, YouTubeFacade). */

/* --- Button ------------------------------------------------------------ */
.button {
  display: inline-block;
  text-decoration: none;
  font-family: var(--f-sans);
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  line-height: var(--lh-tight);
  cursor: pointer;
}

.button--sm {
  padding: var(--s-1) var(--s-2);
  font-size: var(--fs-sm);
}
.button--md {
  padding: var(--s-1) var(--s-3);
  font-size: var(--fs-base);
}
.button--lg {
  padding: var(--s-2) var(--s-4);
  font-size: var(--fs-lg);
}

.button--primary {
  background: var(--c-button-primary-bg);
  color: #fff;
}
.button--primary:hover {
  background: var(--c-button-primary-bg-hover);
}

.button--secondary {
  background: transparent;
  color: var(--c-primary);
  border-color: var(--c-primary);
}
.button--secondary:hover {
  background: var(--c-bg-subtle);
}

/* --- Tag --------------------------------------------------------------- */
.tag {
  display: inline-block;
  padding: 0.2em 0.6em;
  font-family: var(--f-sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-text-muted);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  text-decoration: none;
}
a.tag:hover {
  color: var(--c-text);
  border-color: var(--c-text-muted);
}

/* --- Callout ----------------------------------------------------------- */
.callout {
  padding: var(--s-2) var(--s-3);
  border-left: 3px solid var(--c-border);
  background: var(--c-bg-subtle);
  font-size: var(--fs-sm);
}
.callout p {
  margin: 0;
}
.callout p + p {
  margin-top: var(--s-1);
}
.callout--note {
  border-left-color: var(--c-primary);
}
.callout--warning {
  border-left-color: var(--c-accent);
}
.callout--legal {
  border-left-color: var(--c-text-muted);
}

/* --- Prose (rendered Markdown) ------------------------------------------ */
.prose {
  max-width: var(--w-prose);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
}
.prose > * + * {
  margin-top: var(--s-3);
}
.prose h2 {
  margin-top: var(--s-5);
  font-size: var(--fs-xl);
}
.prose h3 {
  margin-top: var(--s-4);
  font-size: var(--fs-lg);
}
.prose ul,
.prose ol {
  padding-left: var(--s-3);
  list-style: revert;
}
.prose li + li {
  margin-top: var(--s-1);
}
.prose blockquote {
  border-left: 3px solid var(--c-border);
  padding-left: var(--s-3);
  color: var(--c-text-muted);
  font-style: italic;
}
.prose a {
  color: var(--c-primary);
  text-decoration: underline;
}
.prose img {
  border-radius: var(--radius);
}
.prose figcaption {
  margin-top: var(--s-1);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.prose hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin-block: var(--s-5);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.prose th,
.prose td {
  border: 1px solid var(--c-border);
  padding: var(--s-1) var(--s-2);
  text-align: left;
}

/* --- Pagination --------------------------------------------------------- */
.pagination__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
}
.pagination__list a {
  display: inline-block;
  padding: var(--s-1) var(--s-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  text-decoration: none;
}
.pagination__list a[aria-current='page'] {
  background: var(--c-button-primary-bg);
  border-color: var(--c-button-primary-bg);
  color: #fff;
}

/* --- Header ------------------------------------------------------------- */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
}
.header__bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-2);
  padding-block: var(--s-2);
}
.header__brand {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  font-family: var(--f-serif);
  font-weight: 700;
  font-size: var(--fs-lg);
  text-decoration: none;
}
.header__brand img {
  height: 1.75rem;
  width: auto;
}
.header__actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.header__search {
  display: flex;
  color: var(--c-text);
}
.header__search:hover {
  color: var(--c-primary);
}

@media (min-width: 768px) {
  .header__bar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
  /* Longer translations ("Про нас", "Über uns") must not break onto two lines. */
  .nav__list a,
  .nav__dropdown summary {
    white-space: nowrap;
  }
}

/* --- Nav ---------------------------------------------------------------- */
/* The burger toggle is progressive enhancement: without JS (no `.js` class
   on <html>) the full list stays visible and every link works. */
.nav__toggle {
  display: none;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-1) var(--s-2);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.nav__list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding-top: var(--s-2);
}
.nav__dropdown > summary {
  cursor: pointer;
}
.nav__dropdown > summary::-webkit-details-marker {
  display: none;
}
.nav__dropdown > summary::marker {
  content: '';
}
.nav__dropdown ul {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  padding-left: var(--s-2);
  padding-top: var(--s-1);
}
.nav a[aria-current='page'] {
  font-weight: 600;
}

@media (max-width: 767px) {
  .js .nav__toggle {
    display: inline-flex;
  }
  .js .nav__list {
    display: none;
  }
  .js .nav--open .nav__list {
    display: flex;
  }
}

@media (min-width: 768px) {
  .nav__list {
    flex-direction: row;
    align-items: center;
    gap: var(--s-4);
    padding-top: 0;
  }
  .nav__dropdown {
    position: relative;
  }
  .nav__dropdown ul {
    position: absolute;
    top: 100%;
    left: 0;
    flex-direction: column;
    min-width: 12rem;
    padding: var(--s-2);
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    z-index: 10;
  }
}

/* --- Language switcher ---------------------------------------------------- */
.lang-switcher__summary {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
}
.lang-switcher__summary::-webkit-details-marker {
  display: none;
}
.lang-switcher__summary::marker {
  content: '';
}
.lang-switcher__list {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  margin-top: var(--s-1);
}
.lang-switcher a[aria-current='true'] {
  font-weight: 600;
}

@media (min-width: 768px) {
  .lang-switcher {
    position: relative;
  }
  .lang-switcher__list {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 10rem;
    padding: var(--s-2);
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    z-index: 10;
  }
}

/* --- Footer --------------------------------------------------------------- */
.footer {
  margin-top: var(--s-7);
  padding-block: var(--s-6);
  background: var(--c-bg-subtle);
  border-top: 1px solid var(--c-border);
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}
.footer__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-4);
}
.footer__col ul {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
.footer__brand {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  font-family: var(--f-serif);
  font-weight: 700;
  font-size: var(--fs-lg);
  color: var(--c-text);
}
.footer__brand img {
  height: 1.5rem;
  width: auto;
}
.footer__heading {
  font-family: var(--f-sans);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-text);
  margin-bottom: var(--s-2);
}
.footer__legal-line {
  margin-bottom: var(--s-1);
}
.footer__bottom {
  margin-top: var(--s-5);
  padding-top: var(--s-3);
  border-top: 1px solid var(--c-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-2);
}

@media (min-width: 900px) {
  .footer__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* --- Article card ---------------------------------------------------------- */
.article-card {
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.article-card:hover h3 {
  text-decoration: underline;
}
.article-card__media img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}
.article-card__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-1);
  padding: var(--s-2);
}
.article-card__date {
  color: var(--c-text-muted);
  font-size: var(--fs-xs);
}
.article-card__body h3 {
  font-size: var(--fs-lg);
}
.article-card__summary {
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}
.article-card--compact .article-card__body h3 {
  font-size: var(--fs-base);
}
.article-card--compact .article-card__summary {
  display: none;
}

/* --- Programme card (horizontal on mobile, not squares: spec §7) ------------ */
.programme-card {
  display: flex;
  flex-direction: row;
  gap: var(--s-3);
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.programme-card:hover h3 {
  text-decoration: underline;
}
.programme-card__media {
  position: relative;
  flex: 0 0 40%;
}
.programme-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.programme-card__icon {
  position: absolute;
  bottom: var(--s-1);
  left: var(--s-1);
  width: 2rem;
  height: 2rem;
  padding: 0.4rem;
  color: #fff;
  background: rgba(20, 24, 31, 0.6);
  border-radius: var(--radius);
}
.programme-card__icon svg {
  width: 100%;
  height: 100%;
}
.programme-card__body {
  flex: 1;
  padding: var(--s-2);
}
.programme-card__body h3 {
  margin-bottom: var(--s-1);
  font-size: var(--fs-lg);
}
.programme-card__body p {
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}

@media (min-width: 768px) {
  .programme-card {
    flex-direction: column;
  }
  .programme-card__media {
    flex: none;
    aspect-ratio: 3 / 2;
  }
}

/* --- Source list ---------------------------------------------------------- */
.source-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  padding-left: var(--s-3);
  list-style: decimal;
  font-size: var(--fs-sm);
}
.source-list__meta {
  display: block;
  color: var(--c-text-muted);
  font-size: var(--fs-xs);
}

/* --- Copy field ------------------------------------------------------------ */
.copy-field__label {
  display: block;
  margin-bottom: var(--s-1);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.copy-field__row {
  display: flex;
  gap: var(--s-1);
}
.copy-field__input {
  flex: 1;
  min-width: 0;
  padding: var(--s-1) var(--s-2);
  font-family: var(--f-sans);
  font-size: var(--fs-base);
  background: var(--c-bg-subtle);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  color: var(--c-text);
}
.copy-field__button {
  padding: var(--s-1) var(--s-2);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.copy-field__button:hover {
  border-color: var(--c-text-muted);
}

@media (max-width: 480px) {
  .copy-field__row {
    flex-direction: column;
  }
  .copy-field__input {
    padding-inline: var(--s-1);
    font-size: var(--fs-sm);
  }
  .copy-field__button {
    align-self: flex-start;
  }
}

/* --- YouTube facade -------------------------------------------------------- */
.youtube-facade__trigger {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  cursor: pointer;
  background: none;
}
.youtube-facade__trigger img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
}
.youtube-facade__play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4rem;
  height: 4rem;
  transform: translate(-50%, -50%);
  background: rgba(20, 24, 31, 0.75);
  border-radius: 50%;
}
.youtube-facade__play::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 55%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 0.8rem 0 0.8rem 1.3rem;
  border-color: transparent transparent transparent #fff;
}
.youtube-facade__trigger:focus-visible .youtube-facade__play {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}
.youtube-facade__title {
  margin-top: var(--s-2);
  font-weight: 600;
}
.youtube-facade__link {
  margin-top: var(--s-1);
  font-size: var(--fs-sm);
}
.youtube-facade__iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: var(--radius);
}
/* No preview image uploaded: a plain panel behind the play button. */
.youtube-facade__blank {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--c-bg-subtle);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

/* --- Figure (picture inside article text) ----------------------------------- */
.figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}
.figure figcaption {
  margin-top: var(--s-1);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.figure__credit {
  font-size: var(--fs-xs);
}

/* --- Footer social links ------------------------------------------------------- */
.footer__social {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-2);
}
