/**
 * Branding Component
 */

.site-branding {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: fit-content;
  gap: var(--branding-gap-base);
  box-sizing: border-box;
  align-self: center;
}

.site-logo-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  /* CRITICAL FIX: Remove max-width constraint to allow title to display properly */
  max-width: none;
  width: auto;
  flex-shrink: 0;
  text-align: center;
}

/* Apply max-width only to logo image, not the link container */
.site-logo-link .site-logo {
  max-width: var(--branding-logo-size-mobile);
  max-height: var(--branding-logo-size-mobile);
}

/* Remove any underline from logo link */
.site-logo-link::after,
.site-logo-link::before {
  display: none;
  content: none;
}

.site-logo-link:hover {
  text-decoration: none;
}

.site-logo-link a {
  text-decoration: none;
}

.site-logo {
  height: 100%;
  width: 100%;
  object-fit: contain;
}

.site-header .header-main .site-branding .site-title,
.site-header .header-main .branding-component .site-title,
header#site-header .header-main .site-branding .site-title,
header#site-header .header-main .branding-component .site-title {
  display: block;
  text-align: center;
  font-family: "Al-Jazeera-Arabic", Arial, sans-serif;
  font-size: var(--branding-font-size);
  font-weight: bold;
  color: var(--color-primary);
  margin: 0;
  margin-top: 0;
  padding: 0;
  padding-top: 0;
  line-height: 1.2;
  width: auto;
  max-width: 100%;
  white-space: normal;
  /* CRITICAL FIX: Prevent word breaking - only break at <br> tags */
  word-wrap: var(--branding-word-wrap);
  word-break: var(--branding-word-break);
  overflow-wrap: var(--branding-overflow-wrap);
  hyphens: var(--branding-hyphens);
  -webkit-hyphens: var(--branding-hyphens);
  -moz-hyphens: var(--branding-hyphens);
  -ms-hyphens: var(--branding-hyphens);
  transform: translateY(-0px); /* ✅ إضافة هذا السطر لرفع اسم الجامعة قليلاً */
}

/* Ensure <br> tags create line breaks - only break at <br>, never break words */
.site-header .header-main .site-branding .site-title br,
.site-header .header-main .branding-component .site-title br,
header#site-header .header-main .site-branding .site-title br,
header#site-header .header-main .branding-component .site-title br {
  display: block;
  margin: 0;
  padding: 0;
  line-height: 0;
  height: 0;
  content: "";
  width: 100%;
}

/* Force no word breaking on any text inside site-title */
.site-header .header-main .site-branding .site-title,
.site-header .header-main .site-branding .site-title *,
.site-header .header-main .branding-component .site-title,
.site-header .header-main .branding-component .site-title *,
header#site-header .header-main .site-branding .site-title,
header#site-header .header-main .site-branding .site-title *,
header#site-header .header-main .branding-component .site-title,
header#site-header .header-main .branding-component .site-title * {
  word-break: var(--branding-word-break);
  word-wrap: var(--branding-word-wrap);
  overflow-wrap: var(--branding-overflow-wrap);
}

/* ============================================
   Responsive Styles
   ============================================ */

/* Hide site title on Mobile/Tablet */
@media (max-width: 991px) {
  .site-header .header-main .site-branding .site-title,
  .site-header .header-main .branding-component .site-title,
  header#site-header .header-main .site-branding .site-title,
  header#site-header .header-main .branding-component .site-title {
    display: none;
  }

  .site-branding {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

/* Show site title on Desktop */
@media (min-width: 992px) {
  .site-title {
    display: block;
  }

  .site-branding {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   Hover Effects
   ============================================ */

.site-logo-link:hover .site-title {
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

/* ============================================
   Desktop: Ensure logo link has enough width for title
   ============================================ */
@media (min-width: 992px) {
  .site-logo-link {
    max-width: 350px !important; /* Allow enough space for two-line Arabic title */
    width: auto !important;
  }

  .site-logo-link .site-logo {
    max-width: var(--branding-logo-size-desktop) !important;
    max-height: var(--branding-logo-size-desktop) !important;
  }
}
