.portal-body {
  --bs-primary: var(--portal-primary);
  --bs-primary-rgb: var(--portal-primary-rgb);
  --bs-secondary: var(--portal-secondary);
  --bs-secondary-rgb: var(--portal-secondary-rgb);
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  background: var(--portal-background);
  color: var(--portal-text);
  font-family: var(--portal-font-family);
}

.portal-body h1,
.portal-body h2,
.portal-body h3,
.portal-body h4,
.portal-body h5,
.portal-body h6,
.portal-body .section-title {
  color: var(--portal-heading);
}

.portal-body
  a:not(.btn):not(.nav-link):not(.navbar-brand):not(.portal-menu-card):not(
    .portal-bottom-nav__item
  ) {
  color: var(--portal-primary);
}

.portal-body .text-primary {
  color: var(--portal-primary) !important;
}

.portal-body .text-secondary {
  color: var(--portal-secondary) !important;
}

.portal-body .bg-primary,
.portal-body .badge.bg-primary {
  background-color: var(--portal-primary) !important;
}

.portal-body .bg-secondary,
.portal-body .badge.bg-secondary {
  background-color: var(--portal-secondary) !important;
}

.portal-body .border-primary {
  border-color: var(--portal-primary) !important;
}

.portal-body .btn-primary {
  --bs-btn-color: #ffffff;
  --bs-btn-bg: var(--portal-primary);
  --bs-btn-border-color: var(--portal-primary);
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: color-mix(in srgb, var(--portal-primary) 86%, #000000);
  --bs-btn-hover-border-color: color-mix(
    in srgb,
    var(--portal-primary) 82%,
    #000000
  );
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-bg: color-mix(in srgb, var(--portal-primary) 78%, #000000);
  --bs-btn-active-border-color: color-mix(
    in srgb,
    var(--portal-primary) 74%,
    #000000
  );
  --bs-btn-disabled-color: #ffffff;
  --bs-btn-disabled-bg: var(--portal-primary);
  --bs-btn-disabled-border-color: var(--portal-primary);
}

.portal-body .btn-outline-primary {
  --bs-btn-color: var(--portal-primary);
  --bs-btn-border-color: var(--portal-primary);
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: var(--portal-primary);
  --bs-btn-hover-border-color: var(--portal-primary);
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-bg: var(--portal-primary);
  --bs-btn-active-border-color: var(--portal-primary);
  --bs-btn-disabled-color: var(--portal-primary);
  --bs-btn-disabled-border-color: var(--portal-primary);
}

.portal-body .btn-secondary {
  --bs-btn-color: #ffffff;
  --bs-btn-bg: var(--portal-secondary);
  --bs-btn-border-color: var(--portal-secondary);
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: color-mix(in srgb, var(--portal-secondary) 86%, #000000);
  --bs-btn-hover-border-color: color-mix(
    in srgb,
    var(--portal-secondary) 82%,
    #000000
  );
}

.portal-body .form-control:focus,
.portal-body .form-select:focus {
  border-color: var(--portal-primary);
  box-shadow: 0 0 0 0.25rem rgb(var(--portal-primary-rgb) / 20%);
}

.portal-body .page-link {
  color: var(--portal-primary);
}

.portal-body .active > .page-link,
.portal-body .page-link.active {
  border-color: var(--portal-primary);
  background-color: var(--portal-primary);
  color: #ffffff;
}

.portal-body .text-welcome,
.portal-body .hero-subtitle {
  color: var(--portal-welcome-text) !important;
}

.portal-header {
  z-index: 1030;
  background-color: var(--portal-primary);
  background-image: linear-gradient(
    135deg,
    var(--portal-primary),
    var(--portal-secondary)
  );
  box-shadow: 0 0.25rem 1rem rgb(0 0 0 / 10%);
}

.portal-header .navbar {
  min-height: 64px;
}

.portal-header .navbar-brand,
.portal-header .nav-link {
  color: var(--portal-header-text);
}

.portal-header .navbar-brand {
  max-width: 75%;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-header .nav-link {
  position: relative;
  opacity: 0.86;
}

.portal-header .nav-link:hover,
.portal-header .nav-link.active {
  color: var(--portal-header-text);
  opacity: 1;
}

.portal-header .nav-link.active::after {
  position: absolute;
  right: 0.75rem;
  bottom: 0;
  left: 0.75rem;
  height: 2px;
  border-radius: 999px;
  background: var(--portal-header-text);
  content: "";
}

.portal-main {
  flex: 1;
  width: 100%;
}

.portal-footer {
  margin-top: auto;
  padding: 1.5rem 0;
  background: #ffffff;
  border-top: 1px solid rgb(0 0 0 / 8%);
}

.portal-bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgb(255 255 255 / 96%);
  border-top: 1px solid rgb(0 0 0 / 10%);
  box-shadow: 0 -0.4rem 1.5rem rgb(0 0 0 / 10%);
  backdrop-filter: blur(18px);
}

.portal-bottom-nav__inner {
  display: grid;
  width: 100%;
  max-width: 540px;
  min-height: 70px;
  grid-template-columns: 1fr 88px 1fr;
  align-items: end;
  margin: 0 auto;
}

.portal-bottom-nav__item {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.25rem;
  border: 0;
  background: transparent;
  color: #6c757d;
  flex-direction: column;
  gap: 0.2rem;
  text-decoration: none;
}

.portal-bottom-nav__item:hover,
.portal-bottom-nav__item.active {
  color: var(--portal-primary);
}

.portal-bottom-nav__icon {
  font-size: 1.2rem;
  line-height: 1;
}

.portal-bottom-nav__label {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.72rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-bottom-nav__item--main {
  align-self: start;
  min-height: auto;
  margin-top: -24px;
  color: var(--portal-primary);
}

.portal-bottom-nav__item--main .portal-bottom-nav__icon {
  display: flex;
  width: 62px;
  height: 62px;
  align-items: center;
  justify-content: center;
  border: 5px solid var(--portal-background);
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--portal-primary),
    var(--portal-secondary)
  );
  box-shadow: 0 0.5rem 1.3rem rgb(0 0 0 / 25%);
  color: #ffffff;
  font-size: 1.45rem;
}

.portal-bottom-nav__item--main .portal-bottom-nav__label {
  margin-top: 0.2rem;
  color: var(--portal-primary);
}

.portal-menu-modal {
  overflow: hidden;
  border: 0;
  border-radius: 1.25rem;
}

.portal-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.portal-menu-grid__form {
  display: flex;
  margin: 0;
}

.portal-menu-card {
  display: flex;
  width: 100%;
  min-height: 112px;
  align-items: center;
  justify-content: center;
  padding: 1rem 0.75rem;
  border: 1px solid rgb(0 0 0 / 8%);
  border-radius: 1rem;
  background: #ffffff;
  color: #344054;
  flex-direction: column;
  gap: 0.65rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

button.portal-menu-card {
  cursor: pointer;
}

.portal-menu-card:hover,
.portal-menu-card.active {
  border-color: var(--portal-primary);
  box-shadow: 0 0.5rem 1.25rem rgb(0 0 0 / 10%);
  color: var(--portal-primary);
  transform: translateY(-2px);
}

.portal-menu-card__icon {
  display: flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 0.875rem;
  background: color-mix(in srgb, var(--portal-primary) 12%, white);
  color: var(--portal-primary);
  font-size: 1.25rem;
}

.portal-menu-card--danger {
  color: #dc3545;
}

.portal-menu-card--danger .portal-menu-card__icon {
  background: rgb(220 53 69 / 10%);
  color: #dc3545;
}

.portal-brand-logo {
  display: inline-block;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  object-fit: contain;
  object-position: center;
  border-radius: 0.25rem;
}

.portal-brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  font-size: 1.75rem;
  color: inherit;
}

@media (max-width: 991.98px) {
  .portal-body {
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

  .portal-main {
    overflow-x: hidden;
  }
}

@media (min-width: 480px) {
  .portal-menu-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Media yang disisipkan melalui editor berita. */
.berita-content img,
.berita-content video,
.berita-content iframe {
  max-width: 100%;
}

.berita-content img {
  height: auto;
}

.berita-content iframe,
.berita-content video {
  display: block;
  width: 100%;
  min-height: 320px;
  margin: 1rem 0;
  border: 0;
}

@media (max-width: 575.98px) {
  .berita-content iframe,
  .berita-content video {
    min-height: 210px;
  }
}

/* Media dan fallback halaman detail berita. */
.berita-featured-image {
  max-height: 500px;
  object-fit: cover;
}

.berita-image-placeholder,
.berita-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--portal-primary) 6%, #ffffff);
  text-align: center;
}

.berita-image-placeholder {
  min-height: 300px;
  flex-direction: column;
}

.berita-related-image,
.berita-card-placeholder {
  height: 200px;
  object-fit: cover;
}

.berita-content iframe[data-portal-src] {
  background: linear-gradient(
    90deg,
    rgb(0 0 0 / 4%) 25%,
    rgb(0 0 0 / 8%) 37%,
    rgb(0 0 0 / 4%) 63%
  );
  background-size: 400% 100%;
  animation: berita-media-placeholder 1.4s ease infinite;
}

@keyframes berita-media-placeholder {
  0% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0 50%;
  }
}

.berita-image-placeholder[hidden],
.berita-card-placeholder[hidden] {
  display: none !important;
}

.berita-popular-image,
.berita-popular-placeholder {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  object-fit: cover;
}

.berita-popular-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--portal-primary) 6%, #ffffff);
}

.berita-popular-placeholder[hidden] {
  display: none !important;
}

/* Logo kecil pada brand portal. */
.portal-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
}

.portal-brand-logo {
    display: block;
    width: 36px;
    height: 36px;
    object-fit: contain;
    object-position: center;
    border-radius: 0.35rem;
}

.portal-brand-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 1.75rem;
    color: inherit;
}

/* PATCH DETAIL BERITA MEDIA MODERN 16071606 */

/* Ukuran media artikel. Diletakkan di akhir agar mengalahkan aturan lama. */
.berita-content img {
    height: auto;
    border-radius: 0.75rem;
}

.berita-content iframe,
.berita-content video {
    display: block;
    width: 100% !important;
    max-width: 760px !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 16 / 9;
    margin: 1.75rem auto !important;
    border: 0;
    border-radius: 0.875rem;
    background: #111827;
    box-shadow: 0 0.75rem 1.75rem rgb(15 23 42 / 12%);
}

.berita-content video {
    object-fit: contain;
}

/* Detail berita bergaya portal media. */
.news-detail-page {
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--portal-primary) 5%, #ffffff) 0,
      var(--portal-background) 280px
    );
}

.news-detail-container {
  width: min(100%, 1440px);
  padding-inline: clamp(1rem, 3vw, 2.5rem);
}

.news-article-card,
.news-sidebar-card,
.news-related-card {
  border: 1px solid rgb(15 23 42 / 8%);
  background: #ffffff;
  box-shadow: 0 1rem 2.5rem rgb(15 23 42 / 7%);
}

.news-article-card {
  overflow: hidden;
  border-radius: 1.25rem;
}

.news-article-header {
  padding: clamp(1.5rem, 3.5vw, 3.25rem);
  padding-bottom: clamp(1.25rem, 2.5vw, 2rem);
}

.news-article-category,
.news-related-category,
.news-sidebar-category,
.news-sidebar-kicker {
  color: var(--portal-primary);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.news-article-category {
  display: inline-flex;
  margin-bottom: 1rem;
  text-decoration: none;
}

.news-article-title {
  max-width: 1050px;
  margin: 0;
  color: var(--portal-heading);
  font-size: clamp(2rem, 4.2vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.news-article-deck {
  max-width: 920px;
  margin: 1.25rem 0 0;
  color: color-mix(in srgb, var(--portal-text) 78%, #ffffff);
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  line-height: 1.65;
}

.news-article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  margin-top: 1.5rem;
  color: color-mix(in srgb, var(--portal-text) 68%, #ffffff);
  font-size: 0.9rem;
}

.news-article-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.news-featured-media {
  width: 100%;
  margin: 0;
  background: #eef2f7;
}

.news-featured-media .berita-featured-image,
.news-featured-media > img {
  display: block;
  width: 100%;
  max-height: 650px;
  object-fit: cover;
}

.news-featured-media.berita-image-placeholder,
.news-featured-media .berita-image-placeholder {
  min-height: clamp(280px, 42vw, 520px);
  border-radius: 0;
}

.news-article-content {
  padding: clamp(1.5rem, 3.5vw, 3.25rem);
  color: var(--portal-text);
  font-size: clamp(1rem, 1.15vw, 1.12rem);
  line-height: 1.85;
}

.news-article-content > :first-child {
  margin-top: 0;
}

.news-article-content > :last-child {
  margin-bottom: 0;
}

.news-article-content h2,
.news-article-content h3,
.news-article-content h4 {
  margin-top: 2rem;
  color: var(--portal-heading);
  font-weight: 800;
  line-height: 1.3;
}

.news-article-content blockquote {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--portal-primary);
  border-radius: 0 0.75rem 0.75rem 0;
  background: color-mix(in srgb, var(--portal-primary) 6%, #ffffff);
  font-size: 1.08em;
}

.news-article-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin: 0 clamp(1.5rem, 3.5vw, 3.25rem);
  padding: 1.5rem 0 clamp(1.5rem, 3.5vw, 3rem);
  border-top: 1px solid rgb(15 23 42 / 10%);
}

.news-share-button {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.news-sidebar-stack {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 992px) {
  .news-sidebar-stack {
    position: sticky;
    top: 1.5rem;
  }
}

.news-sidebar-card {
  overflow: hidden;
  border-radius: 1rem;
}

.news-sidebar-heading {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgb(15 23 42 / 8%);
}

.news-sidebar-heading h2,
.news-section-heading h2 {
  margin: 0.2rem 0 0;
  color: var(--portal-heading);
  font-size: 1.35rem;
  font-weight: 800;
}

.news-sidebar-list {
  padding: 0 1.25rem;
}

.news-sidebar-item {
  position: relative;
  display: grid;
  grid-template-columns: 26px 78px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid rgb(15 23 42 / 8%);
}

.news-sidebar-item--latest {
  grid-template-columns: 78px minmax(0, 1fr);
}

.news-sidebar-item:last-child {
  border-bottom: 0;
}

.news-sidebar-rank {
  color: color-mix(in srgb, var(--portal-primary) 72%, #ffffff);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.news-sidebar-thumb,
.news-sidebar-thumb img,
.news-sidebar-thumb-fallback {
  width: 78px;
  height: 68px;
  border-radius: 0.6rem;
}

.news-sidebar-thumb {
  overflow: hidden;
  background: #eef2f7;
}

.news-sidebar-thumb img {
  display: block;
  object-fit: cover;
}

.news-sidebar-thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  background: #eef2f7;
}

.news-sidebar-thumb-fallback[hidden] {
  display: none !important;
}

.news-sidebar-copy {
  min-width: 0;
}

.news-sidebar-copy h3 {
  margin: 0.2rem 0 0.45rem;
  font-size: 0.94rem;
  font-weight: 750;
  line-height: 1.35;
}

.news-sidebar-copy h3 a {
  display: -webkit-box;
  overflow: hidden;
  color: var(--portal-heading);
  text-decoration: none;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.news-sidebar-copy h3 a:hover {
  color: var(--portal-primary);
}

.news-sidebar-meta,
.news-related-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  color: #64748b;
  font-size: 0.75rem;
}

.news-sidebar-meta span,
.news-related-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.news-related-section {
  margin-top: clamp(2.5rem, 5vw, 4.5rem);
}

.news-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.news-related-card {
  overflow: hidden;
  border-radius: 1rem;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.news-related-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 1.25rem 2.75rem rgb(15 23 42 / 12%);
}

.news-related-media,
.news-related-media img,
.news-related-media .berita-card-placeholder {
  width: 100%;
  height: 220px;
}

.news-related-media {
  overflow: hidden;
  background: #eef2f7;
}

.news-related-media img {
  display: block;
  object-fit: cover;
  transition: transform 250ms ease;
}

.news-related-card:hover .news-related-media img {
  transform: scale(1.035);
}

.news-related-card .card-title a {
  color: var(--portal-heading);
}

.news-related-card .card-title a:hover {
  color: var(--portal-primary);
}

@media (max-width: 991.98px) {
  .news-article-title {
    font-size: clamp(2rem, 7vw, 3.2rem);
  }

  .news-sidebar-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .news-detail-container {
    padding-inline: 0.85rem;
  }

  .news-article-card,
  .news-sidebar-card,
  .news-related-card {
    border-radius: 0.875rem;
  }

  .news-article-header,
  .news-article-content {
    padding: 1.25rem;
  }

  .news-article-title {
    font-size: clamp(1.75rem, 9vw, 2.6rem);
  }

  .news-article-deck {
    font-size: 1rem;
  }

  .news-article-footer {
    align-items: flex-start;
    flex-direction: column;
    margin-inline: 1.25rem;
    padding-bottom: 1.5rem;
  }

  .news-sidebar-stack {
    grid-template-columns: 1fr;
  }

  .news-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 575.98px) {
  .berita-content iframe,
  .berita-content video {
    max-width: 100% !important;
    margin-block: 1.25rem !important;
    border-radius: 0.625rem;
  }
}

@media (max-width: 420px) {
  .news-sidebar-item,
  .news-sidebar-item--latest {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .news-sidebar-rank {
    display: none;
  }

  .news-sidebar-thumb,
  .news-sidebar-thumb img,
  .news-sidebar-thumb-fallback {
    width: 64px;
    height: 58px;
  }
}

/* Gambar dan keterangan di dalam isi berita. */
.news-article-content .news-content-figure,
.news-article-content figure,
.portal-body .news-content-figure {
  width: min(100%, 820px);
  margin: 2rem auto;
}

.news-article-content .news-content-image,
.news-article-content figure > img,
.portal-body .news-content-figure > .news-content-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 0.85rem;
}

.news-article-content .news-content-caption,
.news-article-content figcaption,
.portal-body .news-content-figure > .news-content-caption {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.7rem;
  color: #6b7280;
  font-size: 0.84rem;
  line-height: 1.55;
  text-align: left;
}

.news-article-content .news-content-caption-text {
  color: #4b5563;
}

.news-article-content .news-content-caption-credit,
.portal-body .news-content-caption-credit {
  color: #8b95a5;
  font-size: 0.78rem;
  font-style: italic;
}

@media (max-width: 575.98px) {
  .news-article-content .news-content-figure,
  .news-article-content figure,
  .portal-body .news-content-figure {
    margin: 1.5rem auto;
  }

  .news-article-content .news-content-caption,
  .news-article-content figcaption,
  .portal-body .news-content-caption {
    font-size: 0.78rem;
  }
}


/* Brand mobile memakai seluruh ruang header tanpa memotong nama sekolah. */
.portal-header .navbar-brand {
  min-width: 0;
}

.portal-header .navbar-brand > span:last-child {
  min-width: 0;
}

@media (max-width: 991.98px) {
  .portal-header .navbar .container {
    max-width: none;
  }

  .portal-header .navbar-brand {
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .portal-header .navbar-brand > span:last-child {
    display: block;
    overflow: visible;
    font-size: clamp(0.88rem, 4vw, 1.05rem);
    line-height: 1.15;
    overflow-wrap: anywhere;
    white-space: normal;
  }
}
