/* Persistent desktop masthead for the fixed controls and site wordmark. */
@media (min-width: 769px) {
    .top-bar {
        isolation: isolate;
    }

    .top-bar::before {
        content: "";
        position: fixed;
        z-index: -1;
        top: 0;
        right: 0;
        left: 0;
        height: 82px;
        background-color: var(--paper);
        background-image: url("https://www.transparenttextures.com/patterns/cream-paper.png");
        border-bottom: 1px solid color-mix(in srgb, var(--gold) 46%, transparent);
        box-shadow: 0 6px 20px rgba(32, 19, 12, 0.06);
        pointer-events: none;
    }

    .topbar-brand {
        position: fixed;
        z-index: 1;
        top: 30px;
        left: clamp(24px, 4vw, 64px);
        display: inline-flex;
        align-items: center;
        color: var(--maroon);
        font-family: 'Cinzel', serif;
        font-size: 0.78rem;
        font-weight: 600;
        letter-spacing: 0.22em;
        line-height: 1;
        white-space: nowrap;
        text-decoration: none;
        transition: color 180ms ease;
    }

    .topbar-brand:hover {
        color: var(--gold);
    }

    header {
        padding-top: 112px;
    }
}

/* Festival welcome card: contained on wide screens and fluid on phones. */
#festival-special-card.premium-festival-card {
    box-sizing: border-box;
    width: min(100%, 1160px);
    max-width: 100%;
    margin: clamp(20px, 2.4vw, 32px) auto clamp(30px, 3.6vw, 48px);
    padding: clamp(30px, 4vw, 46px) clamp(22px, 5vw, 64px);
    overflow: visible;
    border-radius: 20px;
    background:
        radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--gold) 12%, transparent), transparent 68%),
        linear-gradient(145deg, var(--card-bg), var(--paper));
    box-shadow: 0 18px 48px rgba(17, 12, 22, 0.14);
}

#festival-special-card .festival-badge {
    position: absolute;
    top: -12px;
    right: auto;
    bottom: auto;
    left: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    margin: 0;
    padding: 6px 18px;
    transform: translateX(-50%);
    background: var(--gold);
    color: #fff;
    border-radius: 30px;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--gold) 32%, transparent);
    font: 700 0.7rem/1.35 'Lato', sans-serif;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    z-index: 10;
}

body[data-palette="diwali"] #festival-special-card .festival-badge {
    background: #ff4500;
    box-shadow: 0 4px 12px rgba(255, 69, 0, 0.28);
}

#festival-special-card .festival-heading {
    max-width: 100%;
    margin: 0 auto 12px;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.55rem, 3vw, 2.35rem);
    font-weight: 600;
    line-height: 1.28;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow-wrap: normal;
}

#festival-special-card .festival-divider {
    margin: 0 auto 16px;
}

#festival-special-card .festival-wish {
    max-width: 760px;
    margin: 0 auto 18px;
    font-size: clamp(0.92rem, 1.2vw, 1.04rem);
    line-height: 1.75;
    text-wrap: pretty;
    overflow-wrap: anywhere;
}

#festival-special-card .festival-sher {
    max-width: 900px;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 auto !important;
    padding: 0 !important;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(1.15rem, 2vw, 1.65rem) !important;
    font-weight: 400;
    direction: ltr;
    line-height: 1.9 !important;
    text-align: center;
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    #festival-special-card.premium-festival-card {
        width: 100%;
        margin: 20px auto 30px;
        padding: 30px 14px 16px;
        border-radius: 17px;
    }

    #festival-special-card .festival-badge {
        top: -11px;
        max-width: calc(100% - 24px);
        padding: 5px 14px;
        font-size: clamp(0.56rem, 2.6vw, 0.66rem);
        letter-spacing: 0.08em;
    }

    #festival-special-card .festival-heading {
        margin-bottom: 9px;
        font-size: clamp(1rem, 5vw, 1.5rem);
        line-height: 1.2;
    }

    #festival-special-card .festival-wish {
        margin-bottom: 12px;
        font-size: clamp(0.78rem, 3.5vw, 0.88rem);
        line-height: 1.55;
    }

    #festival-special-card .festival-sher {
        font-size: clamp(0.62rem, 3.1vw, 0.92rem) !important;
        line-height: 1.55 !important;
        letter-spacing: -0.015em;
        white-space: nowrap;
    }
}

@media (max-width: 360px) {
    #festival-special-card.premium-festival-card {
        padding: 26px 10px 12px;
        border-radius: 15px;
    }

    #festival-special-card .festival-badge {
        font-size: 0.56rem;
        letter-spacing: 0.06em;
    }
}

@media (max-width: 768px) {
    .topbar-brand {
        display: none;
    }
}

/* Responsive home-page width: uses desktop space without stretching to unreadable lengths. */
#home-view {
    width: 100%;
}

#feed-view #profile-container .blog-page-intro {
    box-sizing: border-box;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 34px;
    padding: 39px 24px 30px;
    text-align: center;
    border-bottom: 1px solid color-mix(in srgb, var(--gold) 32%, transparent);
    background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--gold) 10%, transparent), transparent 72%);
}

#feed-view #profile-container .blog-page-kicker {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 11px;
    color: var(--gold);
    font: 700 9px/1.4 'Lato', sans-serif;
    letter-spacing: .2em;
}

#feed-view #profile-container .blog-page-kicker i {
    font-size: 12px;
    font-style: normal;
}

#feed-view #profile-container .blog-page-intro h1 {
    margin: 12px 0 7px;
    color: var(--maroon);
    font: 600 clamp(2rem, 3vw, 2.55rem)/1.2 'Cinzel', serif;
    letter-spacing: .025em;
}

#feed-view #profile-container .blog-page-intro p {
    max-width: 660px;
    margin: 10px auto 0;
    color: var(--ink);
    font: 400 1rem/1.75 'Lato', sans-serif;
    opacity: .76;
}

@media (max-width: 768px) {
    #feed-view #profile-container .blog-page-intro {
        margin-bottom: 25px;
        padding: 29px 15px 23px;
    }

    #feed-view #profile-container .blog-page-kicker {
        font-size: 8px;
        letter-spacing: .15em;
    }

    #feed-view #profile-container .blog-page-intro h1 {
        font-size: 1.7rem;
    }

    #feed-view #profile-container .blog-page-intro p {
        font-size: .9rem;
    }
}

#home-view > .container {
    box-sizing: border-box;
    width: min(96vw, 1840px);
    max-width: 1840px;
    padding: 0 clamp(20px, 3vw, 48px) 80px;
}

@media (min-width: 1200px) {
    #home-view > header .search-wrap {
        max-width: 820px !important;
    }

    #home-view .library-nav {
        width: min(100%, 1200px);
        margin-left: auto;
        margin-right: auto;
    }

    #home-view .library-nav {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    #home-view .library-nav > .full-width-card,
    #home-view .library-nav > #toggle-features-btn {
        grid-column: 1 / -1;
    }

    #home-view .library-nav > #extra-features-box {
        grid-column: 1 / -1 !important;
    }

    #home-view #extra-features-box {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    #home-view #extra-features-box > .full-width-card {
        grid-column: auto;
    }

    #home-view #toggle-features-btn {
        justify-self: center;
        width: min(100%, 420px);
    }

    #sher-of-moment,
    #sher-of-the-week,
    #daily-picks,
    #lafziyat-container,
    #sod-container,
    #top-feed,
    #ghazal-list,
    #nazm-list,
    #poet-grid {
        width: min(100%, 1200px);
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }

    #home-view > .container > .section-label {
        width: min(100%, 1200px);
        margin-left: auto;
        margin-right: auto;
    }

    #main-image-poetry-container,
    #collections-grid {
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }

    #tasweeri-shayari-main {
        width: min(100%, 1200px);
        max-width: 1200px;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    #home-view > .container > div:has(+ #collections-grid) {
        width: min(100%, 1200px);
        max-width: 1200px;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    #poet-cat-nav,
    #poet-load-more-container {
        width: min(100%, 1200px);
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }

    #poet-cat-nav {
        justify-content: center;
        flex-wrap: wrap;
        overflow: visible;
    }

    #poet-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        grid-auto-rows: 1fr;
    }

    #poet-grid .poet-tile {
        min-height: 132px;
    }

    #profile-container,
    #main-feed {
        width: 100%;
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (min-width: 769px) and (max-width: 1199px) {
    #home-view #extra-features-box {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #home-view #extra-features-box > .full-width-card {
        grid-column: auto;
    }
}

/* Blog and sponsored banner had separate narrow inline width caps. */
@media (min-width: 769px) {
    .blog-feature-wrapper {
        width: min(calc(96vw - clamp(40px, 6vw, 96px)), 1200px) !important;
        max-width: 1200px !important;
    }

    #ishtehaar-section {
        width: min(calc(96vw - clamp(40px, 6vw, 96px)), 1200px) !important;
        max-width: 1200px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

@media (min-width: 992px) {
    .blog-feature-wrapper > div {
        flex-direction: row !important;
        align-items: stretch;
    }

    .blog-feature-wrapper > div > div:first-child {
        flex: 0 0 53%;
        width: 53% !important;
        height: auto;
        min-height: 390px;
        aspect-ratio: auto !important;
    }

    .blog-feature-wrapper > div > div:first-child img {
        position: absolute;
        inset: 0;
    }

    .blog-feature-wrapper > div > div:nth-child(2) {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: clamp(26px, 4vw, 58px) !important;
    }

    #ishtehaar-section .ish-box-final {
        display: grid;
        grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr);
        grid-template-areas: "title banner" "desc banner" "contact banner" "sponsored sponsored";
        align-items: center;
        column-gap: clamp(24px, 3vw, 48px);
        text-align: left !important;
        padding: clamp(28px, 3vw, 46px) !important;
    }

    #ishtehaar-section .ish-title-final { grid-area: title; }
    #ishtehaar-section .ish-desc-final { grid-area: desc; max-width: none; margin: 0; }
    #ishtehaar-section .ish-banner-wrap { grid-area: banner; max-width: 100%; margin: 0; }
    #ishtehaar-section .ish-banner-wrap img {
        display: block;
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 380px !important;
        object-fit: contain;
        margin: 0 auto;
    }
    #ishtehaar-section .ish-btn-final { grid-area: contact; margin: 0; justify-self: start; }
    #ishtehaar-section .ish-box-final > div:last-child { grid-area: sponsored; }
}

@media (min-width: 769px) {
    #feed-view > .container {
        box-sizing: border-box;
        width: min(calc(96vw - clamp(40px, 6vw, 96px)), 1200px);
        max-width: 1200px;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    #feed-view .clean-blog-grid {
        width: 100%;
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }

    #native-blog-modal .blog-modal-inner {
        width: min(96vw, 1200px);
        max-width: 1200px;
        box-sizing: border-box;
    }

    #native-blog-modal .blog-modal-body {
        width: 100%;
        max-width: 1000px;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }

    /* Tasweeri Shayari: keep the original one-card-per-row gallery. */
    #feed-view #image-poetry-feed {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    #feed-view #image-poetry-feed .poetry-img-card {
        width: 100%;
        max-width: 380px !important;
        margin: 0 auto 35px !important;
    }
}

@media (min-width: 992px) {
    #feed-view .clean-blog-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px;
        padding: 10px 0 40px;
    }

    #feed-view .c-blog-card {
        min-width: 0;
    }
}

@media (min-width: 769px) and (max-width: 991px) {
    #feed-view .clean-blog-grid {
        display: flex;
        flex-direction: column;
        max-width: 900px;
        gap: 28px;
        padding: 10px 0 40px;
    }
}

@media (max-width: 768px) {
    #home-view > .container {
        width: 100%;
        max-width: 100%;
        padding-bottom: 0;
    }
}

/* Fluid layouts for compact phones, foldables, and tablet widths. */
@media (max-width: 768px) {
    html,
    body {
        min-width: 0;
        max-width: 100%;
    }

    #home-view,
    #feed-view,
    #home-view > .container,
    #feed-view > .container,
    #profile-container,
    #main-feed {
        box-sizing: border-box;
        min-width: 0;
        max-width: 100%;
    }

    .top-bar {
        box-sizing: border-box;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        width: min(96%, 420px);
        max-width: 100%;
        padding-left: max(4px, env(safe-area-inset-left));
        padding-right: max(4px, env(safe-area-inset-right));
        gap: 8px !important;
    }

    .top-bar .icon-btn {
        flex: 0 0 34px;
    }

    #home-view > .container > *,
    #feed-view > .container > *,
    #main-feed > *,
    #profile-container > * {
        min-width: 0;
        max-width: 100%;
    }

    .library-nav > *,
    .poet-grid > * {
        min-width: 0;
    }

    img,
    video,
    iframe {
        max-width: 100%;
    }

    #splash-screen {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        box-sizing: border-box;
    }
}

@media (min-width: 769px) and (max-width: 1023px) {
    #poet-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 145px), 1fr));
    }
}

@media (min-width: 769px) {
    #poet-profiles-section {
        box-sizing: border-box;
        width: min(100%, 1200px);
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }

    #poet-profiles-section > .section-label {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

@media (min-width: 1024px) {
    #poet-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }
}

@media (max-width: 360px) {
    .top-bar {
        width: 100%;
        max-width: 340px;
        margin-top: 8px;
        gap: 7px !important;
    }

    .top-bar .icon-btn {
        width: 34px;
        height: 34px;
    }

    .diwan-title {
        font-size: clamp(1.55rem, 8vw, 2rem) !important;
        letter-spacing: 0.04em;
    }

    .section-label span {
        font-size: clamp(0.95rem, 5vw, 1.1rem);
    }
}

/* Slightly slimmer primary library cards on mobile home. */
@media (max-width: 768px) {
    #home-view .library-nav {
        gap: 10px;
    }

    #home-view #extra-features-box {
        gap: 10px !important;
    }

    #home-view .library-nav .lib-card {
        padding: 32px 12px;
    }

    #home-view .library-nav .lib-title {
        font-size: clamp(1.04rem, 4.9vw, 1.24rem);
        line-height: 1.25;
    }

    #home-view .library-nav .lib-sub {
        font-size: clamp(.56rem, 2.65vw, .68rem);
        line-height: 1.4;
        letter-spacing: clamp(.06em, .3vw, .09em);
    }
}

/* Fit poet attributions in Sher, Ghazal, and Nazm cards on phones. */
@media (max-width: 768px) {
    .ghazal-card .poet-tag[data-script="urdu"] {
        font-size: 0.95rem !important;
    }

    .ghazal-card .poet-tag[data-script="hindi"] {
        font-size: 0.88rem !important;
    }

    .ghazal-card .poet-tag[data-script="roman"] {
        font-size: 0.78rem !important;
    }

    .ghazal-card .poet-tag[data-script="urdu"].poet-size-compact {
        font-size: 0.88rem !important;
    }

    .ghazal-card .poet-tag[data-script="urdu"].poet-size-small {
        font-size: 0.80rem !important;
    }

    .ghazal-card .poet-tag[data-script="hindi"].poet-size-compact {
        font-size: 0.80rem !important;
    }

    .ghazal-card .poet-tag[data-script="hindi"].poet-size-small {
        font-size: 0.72rem !important;
    }

    .ghazal-card .poet-tag[data-script="roman"].poet-size-compact {
        font-size: 0.71rem !important;
    }

    .ghazal-card .poet-tag[data-script="roman"].poet-size-small {
        font-size: 0.64rem !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
@media (max-width: 600px) {
    .khel-intro { font-size:.84rem; }
    .khel-game-cover { height:clamp(160px,46vw,220px); }
    .khel-game-content { grid-template-columns:minmax(0,1fr); gap:12px; padding:17px 15px; text-align:center; }
    .khel-game-copy h2 { font-size:1.05rem; }
    .khel-play-btn { width:100%; min-width:0; }
    .khel-runner-frame { height:70vh; min-height:430px; }
    .khel-raaz-frame { height:72vh; min-height:500px; }
}

/* Keep top-bar controls perfectly circular on narrow phones. */
@media (max-width: 768px) {
    .top-bar {
        gap: clamp(4px, 1.8vw, 8px) !important;
    }

    .top-bar .icon-btn {
        box-sizing: border-box !important;
        flex: 0 0 clamp(30px, 9.6vw, 36px) !important;
        width: clamp(30px, 9.6vw, 36px) !important;
        min-width: clamp(30px, 9.6vw, 36px) !important;
        height: clamp(30px, 9.6vw, 36px) !important;
        aspect-ratio: 1 / 1 !important;
        padding: 0 !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        line-height: 1 !important;
    }

    .top-bar .palette-control {
        box-sizing: border-box !important;
        flex: 0 0 clamp(30px, 9.6vw, 36px) !important;
        width: clamp(30px, 9.6vw, 36px) !important;
        min-width: clamp(30px, 9.6vw, 36px) !important;
        height: clamp(30px, 9.6vw, 36px) !important;
    }

    .top-bar .palette-control > #palette-toggle {
        flex: 0 0 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 100% !important;
    }
}

/* Keep Roman-script poetry legible against Diwali's dark surfaces. */
body[data-palette="diwali"] .roman {
    color: var(--ink) !important;
}

/* Remove the generic mobile poem padding from the compact Diwali banner. */
#festival-special-card .festival-sher {
    min-height: 0 !important;
    height: auto !important;
    margin: 0 auto !important;
    padding: 0 !important;
}

/* Roman couplets in Taj-e-Sukhan inherited large mobile padding and margins. */
#moment-card > .sher-text.roman {
    margin-bottom: 16px !important;
}

@media (max-width: 768px) {
    .royal-card > .sher-text.roman {
        min-height: 0 !important;
        height: auto !important;
        margin: 8px auto 10px !important;
        padding: 0 !important;
        line-height: 1.65 !important;
    }

    .royal-card > .sher-text.roman + .poet-tag {
        margin: 0 0 15px !important;
    }

    /* Match Sher of the Moment Roman spacing to Taj-e-Sukhan. */
    #moment-card > .sher-text.roman {
        min-height: 0 !important;
        height: auto !important;
        margin: 8px auto 16px !important;
        padding: 0 !important;
        line-height: 1.65 !important;
    }

    #moment-card > .sher-text.roman + .poet-tag {
        margin: 0 0 15px !important;
    }

    #moment-card > .poet-name-urdu { font-size: 1.02rem !important; line-height: 1.9; letter-spacing: 0; }
    #moment-card > .poet-name-hindi { font-size: .94rem !important; line-height: 1.5; letter-spacing: .01em; }
    #moment-card > .poet-name-roman,
    #sher-of-the-week .royal-card > .poet-name-roman {
        font-size: .8rem !important;
        line-height: 1.45 !important;
        letter-spacing: .045em !important;
    }
}

/* Consistent extra breathing room between Roman misras on mobile. */
@media (max-width: 768px) {
    #home-view .sher-text.roman,
    #feed-view #main-feed:not(.nazm-mode) .sher-text.roman,
    #feed-view #profile-container .sher-text.roman,
    #zen-mode #zen-content:not(.nazm-mode) .zen-sher.roman {
        line-height: 2 !important;
    }
}

/* Fluid mobile title sizing for the Mash'hoor Ghazals and Nazms lists. */
@media (max-width: 768px) {
    #ghazal-list .ghazal-tile,
    #nazm-list .ghazal-tile {
        align-items: stretch;
        padding: 13px 15px;
    }

    #ghazal-list .ghazal-title-copy,
    #nazm-list .nazm-tile-copy {
        flex-direction: column;
        align-items: stretch;
        gap: 3px;
    }

    #ghazal-list .ghazal-title-copy .ghazal-tile-title,
    #nazm-list .nazm-tile-copy .ghazal-tile-title {
        font-size: clamp(0.8rem, 3.55vw, 0.92rem) !important;
        line-height: 1.45 !important;
        text-wrap: pretty;
        overflow-wrap: normal;
    }

    #ghazal-list .ghazal-title-copy .ghazal-tile-title.urdu,
    #nazm-list .nazm-tile-copy .ghazal-tile-title.urdu {
        font-size: clamp(0.76rem, 3.35vw, 0.88rem) !important;
        line-height: 1.8 !important;
    }

    #ghazal-list .ghazal-title-copy .ghazal-tile-title.hindi,
    #nazm-list .nazm-tile-copy .ghazal-tile-title.hindi {
        font-size: clamp(0.78rem, 3.4vw, 0.9rem) !important;
    }

    #ghazal-list .ghazal-title-copy .ghazal-tile-title.roman,
    #nazm-list .nazm-tile-copy .ghazal-tile-title.roman {
        font-size: clamp(0.78rem, 3.45vw, 0.9rem) !important;
    }

    #ghazal-list .ghazal-title-copy .ghazal-tile-poet,
    #nazm-list .nazm-tile-copy .ghazal-tile-poet {
        width: 100%;
        max-width: none;
        margin: 1px 0 0;
        font-size: clamp(0.7rem, 3vw, 0.78rem);
        line-height: 1.4;
        opacity: 0.68;
    }

    #ghazal-list .ghazal-title-copy .ghazal-tile-poet.urdu,
    #nazm-list .nazm-tile-copy .ghazal-tile-poet.urdu {
        font-size: clamp(0.72rem, 3.1vw, 0.82rem);
        line-height: 1.85;
    }

    #ghazal-list .ghazal-title-copy .ghazal-tile-poet.hindi,
    #ghazal-list .ghazal-title-copy .ghazal-tile-poet.roman,
    #nazm-list .nazm-tile-copy .ghazal-tile-poet.hindi,
    #nazm-list .nazm-tile-copy .ghazal-tile-poet.roman {
        font-size: clamp(0.7rem, 3vw, 0.78rem);
    }

}

/* Mobile Ghazal/Nazm detail header: arrow stays actionable, title takes the Back label's place. */
.sticky-nav-actions {
    display: none;
}

.sticky-nav-brand {
    display: none;
}

@media (max-width: 768px) {
    body:has(#feed-view .sticky-nav.brand-nav) .top-bar {
        margin-bottom: 10px !important;
    }

    #feed-view .sticky-nav.brand-nav,
    #feed-view .sticky-nav.nav-actions-visible {
        background-color: var(--paper);
        background-image: url("https://www.transparenttextures.com/patterns/cream-paper.png");
        background-repeat: repeat;
        box-shadow: 0 2px 10px var(--shadow);
    }

    #feed-view .sticky-nav.brand-nav {
        justify-content: center;
        box-sizing: border-box;
        min-height: 50px;
        padding: 0 14px;
    }

    #feed-view .sticky-nav.brand-nav + .container #main-feed {
        margin-top: 12px !important;
    }

    #feed-view .sticky-nav.brand-nav .back-link,
    #feed-view .sticky-nav.brand-nav .nav-title {
        display: none !important;
    }

    #feed-view .sticky-nav.brand-nav .sticky-nav-brand,
    #feed-view .sticky-nav.nav-actions-visible .sticky-nav-brand {
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        min-width: 0;
        margin: 0 auto 0 0;
        padding: 5px 0;
        border: 0;
        background: transparent;
        color: var(--maroon);
        font: 600 .79rem/1.2 'Cinzel', Georgia, serif;
        letter-spacing: .075em;
        white-space: nowrap;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    #feed-view .sticky-nav.brand-nav:not(.nav-actions-visible) .sticky-nav-brand {
        margin: 0 auto;
        transform: translateY(3px);
    }

    #feed-view .sticky-nav.poetry-detail-nav,
    #feed-view .sticky-nav.poetry-scroll-nav {
        justify-content: flex-start;
        gap: 10px;
        padding: 10px 12px;
    }

    #feed-view .sticky-nav.poetry-detail-nav .back-link,
    #feed-view .sticky-nav.poetry-scroll-nav .back-link {
        box-sizing: border-box;
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
        justify-content: center;
        padding: 0;
        border-radius: 50%;
        letter-spacing: 0;
    }

    #feed-view .sticky-nav.poetry-detail-nav .back-label,
    #feed-view .sticky-nav.poetry-scroll-nav .back-label {
        display: none;
    }

    #feed-view .sticky-nav.poetry-detail-nav .nav-title,
    #feed-view .sticky-nav.poetry-scroll-nav .nav-title {
        display: block;
        flex: 1 1 auto;
        min-width: 0;
        color: var(--maroon);
        font-family: 'Source Serif 4', Georgia, serif;
        font-size: clamp(0.9rem, 4vw, 1.12rem);
        font-weight: 600;
        line-height: 1.45;
        letter-spacing: 0.01em;
        text-align: left;
        text-wrap: balance;
        overflow-wrap: anywhere;
    }

    #feed-view .sticky-nav.poetry-detail-nav .nav-title.urdu,
    #feed-view .sticky-nav.poetry-scroll-nav .nav-title.urdu {
        font-family: 'Noto Nastaliq Urdu', serif;
        font-size: clamp(0.9rem, 3.8vw, 1.08rem);
        font-weight: 500;
        line-height: 1.8;
        direction: rtl;
        text-align: right;
    }

    #feed-view .sticky-nav.poetry-detail-nav .nav-title.roman,
    #feed-view .sticky-nav.poetry-scroll-nav .nav-title.roman {
        color: var(--maroon) !important;
        -webkit-text-fill-color: currentColor;
        font-family: 'Source Serif 4', Georgia, serif;
        font-weight: 600;
    }

    #feed-view .sticky-nav.poetry-detail-nav .nav-title.hindi,
    #feed-view .sticky-nav.poetry-scroll-nav .nav-title.hindi {
        font-family: 'Mukta', sans-serif;
        text-align: left;
    }

    #feed-view .sticky-nav.poetry-detail-nav .back-link:focus-visible,
    #feed-view .sticky-nav.poetry-scroll-nav .back-link:focus-visible {
        outline: 2px solid var(--gold);
        outline-offset: 3px;
    }

    #feed-view .sticky-nav.poetry-detail-nav + .container #main-feed .poetry-card-title {
        display: none !important;
    }

    #feed-view .sticky-nav.poetry-scroll-nav + .container #main-feed .poetry-card-title {
        display: none !important;
    }

    #feed-view .sticky-nav.nav-actions-visible {
        box-sizing: border-box;
        min-height: 50px;
        justify-content: flex-start;
        gap: 6px;
        padding: 8px 14px;
    }

    #feed-view .sticky-nav.nav-actions-visible .back-link {
        box-sizing: border-box;
        flex: 0 0 34px;
        width: 34px;
        height: 34px;
        justify-content: center;
        padding: 0;
        border-radius: 50%;
    }

    #feed-view .sticky-nav.nav-actions-visible .back-label,
    #feed-view .sticky-nav.nav-actions-visible .nav-title {
        display: none;
    }

    #feed-view .sticky-nav.nav-actions-visible .back-link {
        display: none;
    }

    #feed-view .sticky-nav.nav-actions-visible .sticky-nav-actions {
        display: flex;
        flex: 1 1 auto;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
        min-width: 0;
    }

    #feed-view .sticky-nav.nav-actions-visible .sticky-nav-action.icon-btn {
        display: inline-flex;
        flex: 0 0 30px !important;
        align-items: center;
        justify-content: center;
        width: 30px !important;
        height: 30px !important;
        padding: 0;
        font-size: 1rem;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    #feed-view .sticky-nav.nav-actions-visible .sticky-nav-action.icon-btn:active {
        transform: scale(.94);
    }

    .sticky-nav-action-wrap {
        position: relative;
        display: flex;
        flex: 0 0 30px;
    }

    .sticky-nav-popover {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        z-index: 100001;
        display: none;
        min-width: 128px;
        flex-direction: column;
        overflow: hidden;
        border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent);
        border-radius: 12px;
        background: var(--card-bg);
        box-shadow: 0 8px 24px var(--shadow, rgba(0,0,0,.18));
    }

    .sticky-nav-popover.is-open {
        display: flex;
    }

    .sticky-nav-popover > button {
        min-height: 39px;
        padding: 8px 13px;
        border: 0;
        border-bottom: 1px solid color-mix(in srgb, var(--gold) 18%, transparent);
        background: transparent;
        color: var(--ink);
        font: 500 .82rem/1.2 'Lato', sans-serif;
        text-align: left;
        white-space: nowrap;
    }

    .sticky-language-popover > button[data-lang="urdu"] {
        font: 500 1rem/1.5 'Noto Nastaliq Urdu', serif;
        text-align: right;
    }

    .sticky-language-popover > button[data-lang="hindi"] {
        font-family: 'Mukta', sans-serif;
        font-size: .9rem;
    }

    .sticky-nav-popover > button:last-child {
        border-bottom: 0;
    }

    .sticky-nav-popover > button:active {
        background: color-mix(in srgb, var(--gold) 12%, var(--card-bg));
    }
}

@media (max-width: 380px) {
    #feed-view .sticky-nav.nav-actions-visible .sticky-nav-action.icon-btn {
        flex-basis: 28px !important;
        width: 28px !important;
        height: 28px !important;
    }

    #feed-view .sticky-nav.nav-actions-visible .sticky-nav-action-wrap {
        flex-basis: 28px;
    }

    #feed-view .sticky-nav.nav-actions-visible .sticky-nav-brand {
        font-size: .69rem;
        letter-spacing: .04em;
    }

    #feed-view .sticky-nav.nav-actions-visible .sticky-nav-actions {
        gap: 5px;
    }

    #feed-view .sticky-nav.nav-actions-visible {
        padding-right: 12px;
        padding-left: 12px;
    }
}

@media (max-width: 360px) {
    #feed-view .sticky-nav.brand-nav {
        min-height: 48px;
        padding-right: 10px;
        padding-left: 10px;
    }

    #feed-view .sticky-nav.nav-actions-visible {
        gap: 4px;
        padding-right: 10px;
        padding-left: 10px;
    }

    #feed-view .sticky-nav.nav-actions-visible .sticky-nav-actions {
        gap: 4px;
    }

    #feed-view .sticky-nav.nav-actions-visible .sticky-nav-action.icon-btn {
        flex-basis: 27px !important;
        width: 27px !important;
        height: 27px !important;
    }

    #feed-view .sticky-nav.nav-actions-visible .sticky-nav-action-wrap {
        flex-basis: 27px;
    }

    #feed-view .sticky-nav.nav-actions-visible .sticky-nav-brand {
        font-size: .63rem;
        letter-spacing: .025em;
    }
}

body[data-palette="diwali"] #feed-view .sticky-nav.poetry-detail-nav .nav-title,
body[data-palette="diwali"] #feed-view .sticky-nav.poetry-scroll-nav .nav-title,
body[data-palette="diwali"] #main-feed.ghazal-mode .poetry-card-title,
body[data-palette="diwali"] #main-feed.nazm-mode .poetry-card-title {
    color: #ffad54 !important;
    -webkit-text-fill-color: #ffad54;
}

/* Keep title, poet, and verse spacing deliberate inside long-poetry cards. */
@media (max-width: 768px) {
    .ghazal-card > .poetry-card-title {
        margin-bottom: 6px;
        font-size: clamp(1rem, 4.1vw, 1.22rem);
    }

    .ghazal-card > .poetry-card-title.urdu {
        font-size: clamp(0.94rem, 3.9vw, 1.12rem);
        line-height: 1.9;
    }

    .ghazal-card > .poetry-card-title + .poet-tag {
        margin-bottom: 13px;
    }
}

/* Match featured Roman titles to the editorial Ghazal/Nazm detail heading. */
#ghazal-list .ghazal-title-copy .ghazal-tile-title.roman,
#nazm-list .nazm-tile-copy .ghazal-tile-title.roman {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.45;
}

/* Aaj Ke Picks reuse the compact Ghazal/Nazm editorial list tile. */
#daily-picks-section {
    box-sizing: border-box;
    width: min(100%, 1200px);
    margin-left: auto;
    margin-right: auto;
}

#daily-picks .daily-pick-card {
    appearance: none;
    width: 100%;
    min-width: 0;
    margin: 0;
    position: relative;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--gold) 36%, transparent);
    border-radius: 12px;
    padding: 16px 20px;
    text-align: start;
    color: var(--ink);
    background: linear-gradient(135deg, var(--card-bg), var(--paper));
    font: inherit;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .05);
    transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}

#daily-picks .daily-pick-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--gold);
    transition: width .25s ease, background-color .25s ease;
}

#daily-picks .daily-pick-card:hover,
#daily-picks .daily-pick-card:focus-visible {
    transform: translateY(-2px);
    border-color: var(--gold);
    box-shadow: 0 8px 25px color-mix(in srgb, var(--gold) 15%, transparent);
}

#daily-picks .daily-pick-card:hover::before,
#daily-picks .daily-pick-card:focus-visible::before {
    width: 6px;
    background: var(--maroon);
}

#daily-picks .daily-pick-card:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

#daily-picks .daily-pick-tile-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

#daily-picks .daily-pick-title { color: var(--ink); font-size: .94rem; line-height: 1.4; }
#daily-picks .daily-pick-title.urdu { font-family: 'Noto Nastaliq Urdu', serif; font-size: .9rem; line-height: 1.8; font-weight: 400; }
#daily-picks .daily-pick-title.hindi { font-family: 'Mukta', sans-serif; font-size: .92rem; }
#daily-picks .daily-pick-title.roman {
    font-family: 'Cinzel', Georgia, serif;
    font-size: .92rem;
    font-weight: 700;
    letter-spacing: .015em;
}
#daily-picks .daily-pick-description { margin: 0; opacity: .72; font-size: .74rem; line-height: 1.4; }
#daily-picks .daily-pick-description.urdu { font-family: 'Noto Nastaliq Urdu', serif; font-size: .72rem; line-height: 1.7; }
#daily-picks .daily-pick-description.hindi { font-family: 'Mukta', sans-serif; font-size: .73rem; }
#daily-picks .daily-pick-description.roman {
    font-family: 'Lato', sans-serif;
    font-size: .72rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    #daily-picks { gap: 12px; }
    #daily-picks .daily-pick-card {
        align-items: stretch;
        margin-bottom: 0 !important;
        padding: 12px 15px;
    }
    #daily-picks .daily-pick-tile-copy { gap: 2px; }
    #daily-picks .daily-pick-title { font-size: clamp(.8rem, 3.55vw, .88rem) !important; line-height: 1.4 !important; }
    #daily-picks .daily-pick-title.urdu { font-size: clamp(.82rem, 3.9vw, .94rem) !important; line-height: 1.9 !important; }
    #daily-picks .daily-pick-title.hindi { font-size: clamp(.86rem, 4vw, .96rem) !important; line-height: 1.5 !important; }
    #daily-picks .daily-pick-title.roman {
        font-size: clamp(.78rem, 3.4vw, .86rem) !important;
        letter-spacing: .01em;
    }
    #daily-picks .daily-pick-description { width: 100%; margin-top: 1px; font-size: clamp(.72rem, 3.05vw, .78rem); line-height: 1.4; }
    #daily-picks .daily-pick-description.urdu { font-size: clamp(.78rem, 3.45vw, .86rem); line-height: 1.85; }
    #daily-picks .daily-pick-description.hindi { font-size: clamp(.82rem, 3.6vw, .9rem); line-height: 1.5; }
    #daily-picks .daily-pick-description.roman { font-size: clamp(.72rem, 3.05vw, .78rem); font-weight: 600; }
}

/* Tighten only the phone layout; desktop keeps its original spacing. */
@media (max-width: 768px) {
    #home-view > .container > #sher-of-moment #moment-card {
        margin-bottom: 0 !important;
    }

    #home-view > .container > #sher-of-moment + .library-nav {
        margin-top: 26px !important;
    }
}

/* Bring the laptop script selector closer to the search field. */
@media (min-width: 1024px) {
    #home-view > header {
        padding-bottom: 16px;
    }

    #home-view > header .search-wrap {
        margin-bottom: 8px !important;
    }

    #home-view > .container > .script-bar {
        margin-top: 8px;
    }
}

/* Long-poetry titles use their writing direction on larger screens in every feed. */
@media (min-width: 769px) {
    #feed-view #main-feed .ghazal-card > .poetry-card-title.urdu {
        direction: rtl !important;
        text-align: right !important;
    }

    #feed-view #main-feed .ghazal-card > .poetry-card-title.hindi,
    #feed-view #main-feed .ghazal-card > .poetry-card-title.roman {
        direction: ltr !important;
        text-align: left !important;
    }
}

/* Keep long Roman poet names compact only in the mobile Poet Profiles grid. */
@media (max-width: 768px) {
    #poet-grid .poet-name.roman {
        font-size: .65rem !important;
        line-height: 1.3 !important;
        letter-spacing: .02em !important;
        word-break: normal !important;
    }
}

.poet-collection-heading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-transform: none !important;
}

.poet-collection-name {
    display: block;
    line-height: 1.2;
}

.poet-collection-subtitle {
    display: block;
    font-family: 'Lato', sans-serif;
    font-size: .68em;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: .14em;
    text-transform: uppercase;
    opacity: .78;
}
