* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Cairo", Arial, sans-serif;
    background: #030303;
    color: #f3f4f6;
}

.solution-page {
    min-height: 100vh;
    padding: 1.2rem;
    position: relative;
    overflow: hidden;
}

.glow {
    position: absolute;
    width: 380px;
    height: 380px;
    border-radius: 999px;
    filter: blur(70px);
    opacity: 0.22;
    pointer-events: none;
}

.glow-left {
    background: #7c3aed;
    top: -140px;
    left: -90px;
}

.glow-right {
    background: #0ea5e9;
    right: -130px;
    bottom: -120px;
}

.container {
    width: min(980px, 100%);
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.blessing {
    text-align: center;
    font-family: "Aref Ruqaa Ink", serif;
    font-size: clamp(1.35rem, 4vw, 1.95rem);
    line-height: 1.5;
    color: #f5f3ff;
    margin: 0 0 0.65rem;
}

.date-bar {
    margin-bottom: 1rem;
    padding: 0.65rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.92rem;
    color: #e5e7eb;
    text-align: center;
}

.hero-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    padding: 1.1rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
}

h1 {
    margin: 0;
    font-size: clamp(1.6rem, 3.2vw, 2.3rem);
}

.subtitle {
    margin: 0.5rem 0 0;
    color: #d1d5db;
}

.sol-hub-cross-link {
    position: relative;
    overflow: hidden;
    margin: 0 auto 1rem;
    padding: 0.95rem 1.1rem;
    max-width: min(980px, 100%);
    border-radius: 14px;
    border: 1px solid rgba(45, 212, 191, 0.38);
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.16), rgba(15, 23, 42, 0.45));
    text-align: center;
    animation: sol-marks-banner-pulse 3.8s ease-in-out infinite;
}

.sol-hub-cross-link:hover {
    animation-play-state: paused;
}

@keyframes sol-marks-banner-pulse {
    0%,
    100% {
        border-color: rgba(45, 212, 191, 0.38);
        box-shadow:
            0 0 0 0 rgba(45, 212, 191, 0),
            inset 0 0 0 0 rgba(45, 212, 191, 0);
    }

    50% {
        border-color: rgba(45, 212, 191, 0.68);
        box-shadow:
            0 6px 28px rgba(13, 148, 136, 0.2),
            inset 0 0 26px rgba(45, 212, 191, 0.05);
    }
}

.sol-hub-cross-link__title {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 700;
    color: #ccfbf1;
}

.sol-hub-cross-link__hint {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    line-height: 1.55;
    color: #a7f3d0;
    opacity: 0.94;
}

@keyframes sol-marks-btn-invite {
    0%,
    100% {
        box-shadow:
            0 2px 14px rgba(45, 212, 191, 0.22),
            0 0 0 0 rgba(45, 212, 191, 0.28);
        transform: translateY(0);
    }

    50% {
        box-shadow:
            0 10px 34px rgba(45, 212, 191, 0.45),
            0 0 18px rgba(94, 234, 212, 0.2);
        transform: translateY(-3px);
    }
}

.sol-hub-cross-link__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem 1.25rem;
    border-radius: 11px;
    border: 1px solid rgba(45, 212, 191, 0.55);
    background: rgba(45, 212, 191, 0.15);
    color: #ecfdf5;
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    transition:
        background 0.18s ease,
        color 0.18s ease;
    animation: sol-marks-btn-invite 2.2s ease-in-out infinite;
}

.sol-hub-cross-link__btn:hover {
    animation-play-state: paused;
    background: rgba(45, 212, 191, 0.32);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(45, 212, 191, 0.4);
}

.sol-hub-cross-link__btn:focus-visible {
    outline: 2px solid rgba(251, 191, 36, 0.95);
    outline-offset: 3px;
    animation-play-state: paused;
}

.sol-hub-cross-link__btn:active {
    animation: none;
    transform: scale(0.97);
}

@media (prefers-reduced-motion: reduce) {
    .sol-hub-cross-link,
    .sol-hub-cross-link__btn {
        animation: none !important;
    }

    .sol-hub-cross-link__btn:hover {
        transform: none;
        box-shadow: none;
    }

    .sol-hub-cross-link__btn:active {
        transform: scale(0.98);
    }
}

.solution-page-views-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    color: #c4b5fd;
}

.solution-page-views-stat__icon {
    display: block;
    flex-shrink: 0;
}

.solution-page-views-stat__value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.95rem;
    color: #ddd6fe;
}

.solution-page-stats-row--standalone {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.85rem;
}

.solution-page-stats-row--standalone .solution-page-views-stat {
    padding: 0.35rem 0.5rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.22);
}

.solution-hero-heading {
    margin: 0;
    font-size: clamp(1.6rem, 3.2vw, 2.3rem);
    line-height: 1.35;
}

.solution-hero-heading__line {
    display: block;
}

.solution-hero-heading__line + .solution-hero-heading__line {
    margin-top: 0.35em;
    font-size: 0.88em;
    opacity: 0.92;
}

.empty-state {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 1rem;
}

.solutions-list {
    display: grid;
    gap: 1rem;
}

.solution-card {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 1rem;
    backdrop-filter: blur(8px);
}

.solution-card h2 {
    margin: 0;
    font-size: 1.18rem;
}

.meta {
    margin: 0.45rem 0 0;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    color: #cbd5e1;
    font-size: 0.9rem;
}

.solution-gallery + .solution-author-meta {
    margin-top: 1rem;
}

.solution-card > header + .solution-author-meta {
    margin-top: 0.95rem;
}

.meta-author .author-row {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

a.author-row--link {
    color: inherit;
    text-decoration: none;
}

a.author-row--link:hover .author-name,
a.author-row--link:focus-visible .author-name {
    text-decoration: underline;
    text-underline-offset: 0.12em;
}

a.author-row--link:focus-visible {
    outline: 2px solid rgba(251, 191, 36, 0.9);
    outline-offset: 3px;
    border-radius: 10px;
}

.solution-author-avatar {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.solution-author-placeholder {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fbbf24;
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.38), rgba(14, 165, 233, 0.22));
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.solution-author-placeholder--unknown {
    color: #94a3b8;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
}

.author-name {
    line-height: 1.45;
}

.content {
    margin-top: 0.95rem;
    line-height: 1.9;
    white-space: normal;
}

.content.muted {
    color: #9ca3af;
    font-size: 0.95rem;
}

.solution-explanation {
    margin-top: 0;
    margin-bottom: 0;
    font-variant-emoji: emoji;
    /* Emoji fonts first (Noto loaded on solution page); Arabic uses Cairo when glyph missing in emoji stack. */
    font-family:
        "Noto Color Emoji",
        "Apple Color Emoji",
        "Segoe UI Emoji",
        "Segoe UI Symbol",
        emoji,
        "Cairo",
        Arial,
        sans-serif;
}

/* Markdown output from renderedExplanationHtml() */
.solution-explanation--md :where(p, ul, ol) {
    margin: 0 0 0.45em;
}

.solution-explanation--md :where(ul, ol) {
    padding-inline-start: 1.35em;
}

.solution-explanation--md :where(li) {
    margin: 0.15em 0;
}

.solution-explanation--md :where(p:last-child, ul:last-child, ol:last-child) {
    margin-bottom: 0;
}

.solution-explanation-block {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 0.65rem;
    margin-top: 1rem;
    margin-bottom: 0.75rem;
}

.solution-explanation-block > .solution-explanation.content {
    flex: 1;
    min-width: 0;
    margin-top: 0;
}

.solution-explanation-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    flex-shrink: 0;
}

.solution-explanation-toolbar .solution-page-views-stat {
    margin-inline-end: 0.15rem;
}

.explanation-like-btn {
    display: inline-grid;
    place-items: center;
    margin: 0;
    padding: 0.25rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #fda4af;
    cursor: pointer;
    font: inherit;
    line-height: 0;
    transition: color 0.15s ease, transform 0.15s ease;
}

.explanation-like-btn:hover:not(:disabled) {
    color: #fb7185;
    transform: scale(1.06);
}

.explanation-like-btn:focus-visible {
    outline: 2px solid rgba(251, 191, 36, 0.9);
    outline-offset: 3px;
}

.explanation-like-btn:disabled {
    cursor: default;
    transform: none;
}

.explanation-like-btn--liked {
    color: #f43f5e;
}

.explanation-like-btn__svg {
    display: block;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.explanation-like-btn__path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: fill 0.15s ease, stroke-width 0.15s ease;
}

.explanation-like-btn--liked .explanation-like-btn__path {
    fill: currentColor;
    stroke: none;
}

.explanation-like-count {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.95rem;
    color: #fecdd3;
}

.solution-gallery {
    margin-top: 0.95rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.solution-figure {
    margin: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.4);
}

.solution-gallery-thumb {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: zoom-in;
    font: inherit;
    color: inherit;
    vertical-align: middle;
}

.solution-gallery-thumb:hover img {
    opacity: 0.92;
}

.solution-gallery-thumb:focus-visible {
    outline: 2px solid rgba(245, 158, 11, 0.8);
    outline-offset: 3px;
}

.solution-gallery-thumb img {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: middle;
}

body.solution-lightbox-open {
    overflow: hidden;
}

.solution-lightbox {
    box-sizing: border-box;
    position: fixed;
    inset: 0;
    z-index: 9999;
    margin: 0;
    align-items: center;
    justify-content: center;
    padding: clamp(0.75rem, 3vw, 1.75rem);
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(4px);
    cursor: zoom-out;
}

.solution-lightbox[hidden] {
    display: none;
}

.solution-lightbox:not([hidden]) {
    display: flex;
}

.solution-lightbox__surface {
    position: relative;
    cursor: default;
    max-width: min(1120px, 96vw);
    max-height: 92vh;
}

.solution-lightbox__close {
    position: absolute;
    top: -0.25rem;
    inset-inline-end: -0.25rem;
    z-index: 2;
    margin: 0;
    padding: 0;
    border: none;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    font-size: 1.85rem;
    line-height: 1;
    color: #f9fafb;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.35);
    cursor: pointer;
    display: grid;
    place-items: center;
}

.solution-lightbox__close:hover {
    background: rgba(245, 158, 11, 0.35);
    border-color: rgba(251, 191, 36, 0.55);
}

.solution-lightbox__close:focus-visible {
    outline: 2px solid #fbbf24;
    outline-offset: 3px;
}

.solution-lightbox__img {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 1rem);
    width: auto;
    height: auto;
    margin: auto;
    border-radius: 10px;
    object-fit: contain;
    cursor: zoom-out;
}


.attachment-row {
    margin-top: 1.1rem;
}

.download-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.95rem;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.16);
    border: 1px solid rgba(245, 158, 11, 0.42);
    color: #fcd34d;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.download-link:hover {
    background: rgba(245, 158, 11, 0.28);
}
