/* Persistent site chrome — load in <head> so the top banner renders before site.js */
.site-chrome {
  view-transition-name: site-chrome;
}

.site-top-bar {
  min-height: 2.35rem;
  background: linear-gradient(135deg, #0a1628 0%, #131b2a 50%, #0d1612 100%);
  border-bottom: 1px solid rgba(180, 130, 50, 0.12);
}

@media (min-width: 640px) {
  .site-top-bar { min-height: 2.85rem; }
}

.site-top-bar__inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0.35rem 0.5rem;
  text-align: center;
}

@media (min-width: 640px) {
  .site-top-bar__inner { padding: 0.5rem 2rem; }
}

.site-top-bar__grid {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

@media (min-width: 768px) {
  .site-top-bar__grid { gap: 1.25rem; }
}

.site-top-bar__block {
  line-height: 1.15;
  flex: 1 1 0;
  min-width: 0;
}

.site-top-bar__ar {
  color: rgba(252, 211, 140, 0.92);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  .site-top-bar__ar {
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
}

.site-top-bar__en {
  color: rgba(148, 163, 184, 0.85);
  font-size: 0.5625rem;
  letter-spacing: 0.03em;
  margin-top: 0.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  .site-top-bar__en {
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
    margin-top: 0.1rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
}

.site-top-bar__block:first-child .site-top-bar__en {
  text-transform: uppercase;
}

.site-top-bar__block--dua .site-top-bar__en {
  font-style: italic;
  letter-spacing: 0.01em;
  font-size: 0.7rem;
}

.site-top-bar__divider {
  flex-shrink: 0;
  width: 1px;
  height: 1.65rem;
  background: linear-gradient(180deg, transparent, rgba(212, 168, 83, 0.25), transparent);
  font-size: 0;
  line-height: 1;
  user-select: none;
}

@media (min-width: 768px) {
  .site-top-bar__divider { height: 2rem; }
}

/* Keep chrome visible during in-site tab switches */
html.site-internal-nav .site-chrome {
  opacity: 1 !important;
  transition: none !important;
}

html.site-internal-nav main,
html.site-internal-nav main.site-page,
html.site-internal-nav #homeMain {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

::view-transition-old(site-chrome),
::view-transition-new(site-chrome) {
  animation: none !important;
}

/* Nav labels — must load in <head> so mobile never flashes long titles during tab switches */
.nav-long {
  display: none;
}
.nav-short {
  display: inline;
}
@media (min-width: 640px) {
  .nav-long {
    display: inline;
  }
  .nav-short {
    display: none;
  }
}

@media (max-width: 639px) {
  .site-nav a .nav-long {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
  }
  .site-nav a .nav-short {
    display: inline !important;
  }
}

/* Active tab styling before site.js runs (prevents pulse on in-site navigation) */
.nav-page-home [data-nav="home"],
.nav-page-biography [data-nav="biography"],
.nav-page-clips [data-nav="clips"],
.nav-page-videos [data-nav="videos"],
.nav-page-audio [data-nav="audio"],
.nav-page-pdfs [data-nav="pdfs"] {
  background-color: #d4a853;
  color: #020617;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(212, 168, 83, 0.2);
}

/* Stable nav pill sizing — active/inactive share weight + border box */
.site-nav a[data-nav] {
  font-weight: 600;
  border: 1px solid transparent;
  box-sizing: border-box;
}

/* Reserve mobile search slot before site.js wraps the header */
@media (max-width: 639px) {
  .site-header__inner > .site-nav {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    padding-right: 3.5rem;
    scroll-padding-inline-end: 3.5rem;
    -webkit-mask-image: linear-gradient(
      90deg,
      transparent 0,
      #000 0.5rem,
      #000 calc(100% - 4.25rem),
      transparent calc(100% - 0.75rem)
    );
    mask-image: linear-gradient(
      90deg,
      transparent 0,
      #000 0.5rem,
      #000 calc(100% - 4.25rem),
      transparent calc(100% - 0.75rem)
    );
  }

  .site-header__inner:not(:has(.site-header__actions)) {
    position: relative;
  }
}

/* No main-area view transition on in-site tab switches */
html.site-internal-nav .site-main-vt,
html.site-internal-nav main.site-page {
  view-transition-name: none !important;
}

html.site-internal-nav ::view-transition-old(site-main),
html.site-internal-nav ::view-transition-new(site-main) {
  animation: none !important;
}

/* Site-wide header — stable chrome height + logo size (no mobile flicker) */
.site-header {
  overflow: visible;
  min-height: 3.65rem;
}

@media (min-width: 640px) {
  .site-header {
    min-height: 4.75rem;
  }
}

a.site-header__title {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-size: 1.25rem !important;
  line-height: 1.3 !important;
  font-weight: 700 !important;
  letter-spacing: 0 !important;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  flex-shrink: 0;
  display: block;
}

@media (max-width: 639px) {
  a.site-header__title {
    min-height: 1.625rem;
  }
}

@media (min-width: 640px) {
  a.site-header__title {
    font-size: 1.875rem !important;
    line-height: 1.25 !important;
  }
}

@media (max-width: 639px) {
  .site-header__inner {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  width: 100%;
  min-width: 0;
}

@media (max-width: 639px) {
  .site-header__actions {
    position: relative;
    align-items: center;
  }

  .site-header__actions .site-nav {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    padding-right: 3.5rem;
    scroll-padding-inline-end: 3.5rem;
    -webkit-mask-image: linear-gradient(
      90deg,
      transparent 0,
      #000 0.5rem,
      #000 calc(100% - 4.25rem),
      transparent calc(100% - 0.75rem)
    );
    mask-image: linear-gradient(
      90deg,
      transparent 0,
      #000 0.5rem,
      #000 calc(100% - 4.25rem),
      transparent calc(100% - 0.75rem)
    );
  }

  .site-header__actions .home-search {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
  }

  html.global-search-open .site-header__actions {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  html.global-search-open .site-header__actions .home-search {
    position: static;
    transform: none;
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    z-index: 6;
  }

  html.global-search-open .site-header__actions .site-nav {
    order: 2;
    flex: 1 1 100%;
    padding-right: 0;
    scroll-padding-inline-end: 0;
    -webkit-mask-image: none;
    mask-image: none;
    opacity: 0.4;
    pointer-events: none;
  }
}

@media (min-width: 640px) {
  .site-header__actions {
    width: auto;
    margin-left: auto;
  }
}

.home-search {
  position: relative;
  flex-shrink: 0;
}

.home-search__bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.375rem;
}

.home-search__toggle {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #334155;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.65);
  transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease, transform 0.15s ease;
}

.home-search__toggle:hover,
.home-search.is-open .home-search__toggle {
  border-color: rgba(212, 168, 83, 0.45);
  color: #d4a853;
  background: rgba(212, 168, 83, 0.12);
}

.home-search__toggle:active {
  transform: scale(0.94);
}

.home-search__field {
  display: flex;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: max-width 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}

.home-search.is-open .home-search__field {
  max-width: min(18rem, 58vw);
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 640px) {
  .home-search.is-open .home-search__field {
    max-width: 15rem;
  }
}

@media (min-width: 1024px) {
  .home-search.is-open .home-search__field {
    max-width: 19rem;
  }
}

.home-search__inner {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  min-width: 11.5rem;
  border: 1px solid rgba(212, 168, 83, 0.35);
  border-radius: 999px;
  background: rgba(12, 18, 32, 0.96);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  padding: 0.3rem 0.45rem 0.3rem 0.85rem;
}

.home-search__input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #f1f5f9;
  font-size: 1rem;
  padding: 0.35rem 0;
}

@media (min-width: 640px) {
  .home-search__input {
    font-size: 0.875rem;
  }
}

.home-search__input::placeholder {
  color: #64748b;
}

.home-search__close {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: color 0.2s ease, background 0.2s ease;
}

.home-search__close:hover {
  color: #d4a853;
  background: rgba(212, 168, 83, 0.1);
}

.home-search__results {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  width: min(22rem, calc(100vw - 2rem));
  z-index: 80;
  border-radius: 0.75rem;
  border: 1px solid #334155;
  background: #0c1220;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  max-height: min(24rem, 60vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 639px) {
  .home-search__results {
    position: fixed;
    left: 1rem;
    right: 1rem;
    top: auto;
    width: auto;
    max-height: min(20rem, 50vh);
  }

  html.global-search-open .home-search__results {
    top: calc(var(--global-search-top, 5.5rem) + 0.5rem);
  }
}

.home-search__results:not(.hidden) {
  animation: home-search-drop 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes home-search-drop {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.home-search-result:active {
  background: rgba(30, 41, 59, 0.9);
}

html.global-search-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .home-search__field,
  .home-search__toggle,
  .home-search__results:not(.hidden) {
    transition: none !important;
    animation: none !important;
  }

  .home-search.is-open .home-search__field {
    opacity: 1;
  }
}

/* Archive appeal — help us find missing lectures */
.archive-appeal {
  margin-bottom: 1.5rem;
}
.archive-appeal--dismissed {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
.archive-appeal__card {
  position: relative;
  border-radius: 1rem;
  border: 1px solid rgba(212, 168, 83, 0.28);
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.92) 0%, rgba(20, 28, 44, 0.78) 55%, rgba(12, 20, 18, 0.85) 100%);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  padding: 1rem 1.125rem;
}
.archive-appeal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.625rem;
}
.archive-appeal__close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  border: 1px solid rgba(100, 116, 139, 0.45);
  background: rgba(15, 23, 42, 0.55);
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.archive-appeal__close:hover {
  color: #e2e8f0;
  border-color: rgba(212, 168, 83, 0.4);
  background: rgba(15, 23, 42, 0.85);
}
@media (min-width: 640px) {
  .archive-appeal__card { padding: 1.25rem 1.5rem; }
}
.archive-appeal__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #d4a853;
  margin: 0;
}
.archive-appeal__salam {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 0.5rem;
}
.archive-appeal__body {
  font-size: 0.875rem;
  line-height: 1.65;
  color: #cbd5e1;
  margin-bottom: 1rem;
}
.archive-appeal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}
@media (min-width: 480px) {
  .archive-appeal__actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}
.archive-appeal__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(212, 168, 83, 0.35);
  background: rgba(212, 168, 83, 0.08);
  color: #e8c97a;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.archive-appeal__btn:hover {
  background: rgba(212, 168, 83, 0.16);
  border-color: rgba(212, 168, 83, 0.55);
  color: #f8fafc;
}
.archive-appeal__signoff {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #94a3b8;
}