/*
   The header's links to the public pages a school switches on in «تنظیمات سایت»
   (Views/Shared/_PublicPagesNav.cshtml): the «مدرسهٔ ما» menu and the search button. Loaded by
   every public header - the shared layout's and the two galleries' own - so the menu looks the
   same wherever it is drawn. Everything is under .ppn-, and nothing here touches the links
   around it.
*/

.ppn-more {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.ppn-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.25rem 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 500;
    font-size: inherit;
    color: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.25s ease;
}

.ppn-more-btn svg {
    width: 15px;
    height: 15px;
    transition: transform 0.25s ease;
}

.ppn-more:hover .ppn-more-btn,
.ppn-more.is-open .ppn-more-btn,
.ppn-more.is-here .ppn-more-btn,
.ppn-more-btn:focus-visible {
    color: #db2777;
}

.ppn-more.is-here .ppn-more-btn { font-weight: 700; }

.ppn-more:hover .ppn-more-btn svg,
.ppn-more.is-open .ppn-more-btn svg {
    transform: rotate(180deg);
}

.ppn-more-menu {
    position: absolute;
    top: calc(100% + 14px);
    right: 50%;
    transform: translate(50%, 8px);
    z-index: 400;
    width: 290px;
    padding: 8px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(219, 39, 119, 0.12);
    box-shadow: 0 24px 50px -20px rgba(123, 42, 107, 0.45), 0 2px 8px rgba(123, 42, 107, 0.06);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

/* The gap between the button and the menu still belongs to the menu, so the pointer can cross it. */
.ppn-more-menu::before {
    content: '';
    position: absolute;
    inset: -16px 0 auto 0;
    height: 16px;
}

.ppn-more:hover .ppn-more-menu,
.ppn-more:focus-within .ppn-more-menu,
.ppn-more.is-open .ppn-more-menu {
    opacity: 1;
    visibility: visible;
    transform: translate(50%, 0);
}

.ppn-more-menu a {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 10px 12px !important;
    border-radius: 12px;
    color: #2b1731 !important;
    text-decoration: none;
    white-space: normal;
    transition: background 0.2s ease;
}

.ppn-more-menu a::after { display: none !important; }

.ppn-more-menu a:hover,
.ppn-more-menu a:focus-visible,
.ppn-more-menu a.is-here {
    background: linear-gradient(135deg, #fdf2f8, #f6f1fd);
}

.ppn-more-icon {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, #e0487f 0%, #b945b8 55%, #8b4fd8 100%);
    box-shadow: 0 8px 16px -8px rgba(185, 69, 184, 0.7);
}

.ppn-more-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ppn-more-menu b {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.6;
}

.ppn-more-menu small {
    display: block;
    font-size: 0.74rem;
    color: #7b6983;
    line-height: 1.7;
}

/* In the shared layout's header the links have their own size and colour (home-theme.css). */
.nav-links .ppn-more-btn { font-size: 0.94rem; color: #4b5563; }

@media (max-width: 1300px) and (min-width: 1180.02px) {
    .nav-links .ppn-more-btn { font-size: 0.88rem; }
}

/* In the row of links the button is smaller than a link is tall, so the row keeps its height. */
.nav-links .ppn-search { width: 36px; height: 36px; border-radius: 11px; }
.nav-links .ppn-search::after { display: none !important; }

/* With «مدرسهٔ ما» and the search the row is two items longer than the header was drawn for
   (its box stops at 1200px whatever the screen): drawn a little tighter, only when they are in it. */
@media (min-width: 1300.02px) {
    .nav-links:has(.ppn-more, .ppn-search) { gap: 0.8rem; }
    .nav-links:has(.ppn-more, .ppn-search) a,
    .nav-links:has(.ppn-more, .ppn-search) .ppn-more-btn { font-size: 0.9rem; }
}

@media (max-width: 1300px) and (min-width: 1180.02px) {
    .nav-links:has(.ppn-more, .ppn-search) { gap: 0.55rem; }
    .nav-links:has(.ppn-more, .ppn-search) a,
    .nav-links:has(.ppn-more, .ppn-search) .ppn-more-btn { font-size: 0.82rem; }
    .nav-links:has(.ppn-more, .ppn-search) .ppn-search { width: 32px; height: 32px; }
}

/* The two galleries draw their own header (Tailwind's gap-6 between the links): a little closer
   when «مدرسهٔ ما» is among them. */
.site-nav-wide > a { white-space: nowrap; }
.site-nav-wide-btn { white-space: nowrap; flex-shrink: 0; }
.site-nav-wide:has(.ppn-more) { gap: 1rem; }

@media (max-width: 1300px) {
    .site-nav-wide:has(.ppn-more) { gap: 0.7rem; font-size: 0.82rem; }
}

/* Beside the phone's menu button, only where the row of links is folded away. */
.ppn-search-narrow { display: none; }

@media (max-width: 1180px) {
    .ppn-search-narrow { display: inline-flex; margin-inline-start: auto; }
}

@media (max-width: 576px) {
    .ppn-search { width: 36px; height: 36px; border-radius: 10px; }
    .ppn-search svg { width: 17px; height: 17px; }
}

/* ── the search button ─────────────────────────────────────────────── */

.ppn-search {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    color: #9d2c6b;
    background: rgba(253, 231, 239, 0.75);
    border: 1px solid rgba(219, 39, 119, 0.14);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.ppn-search svg { width: 19px; height: 19px; }

.ppn-search:hover,
.ppn-search:focus-visible,
.ppn-search.is-here {
    color: #fff;
    background: linear-gradient(135deg, #e0487f, #8b4fd8);
    transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
    .ppn-more-menu, .ppn-more-btn svg, .ppn-search { transition: none; }
}
