/**
 * Portal homepage styles (hero, software block, articles section).
 */

/* —— Homepage —— */
.portal-home {
    background: transparent;
}

.portal-hero {
    position: relative;
    padding: 4.25rem 0 4.5rem;
    color: var(--text-dark);
    overflow: hidden;
    background: transparent;
    border-bottom: none;
}

.portal-hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.portal-hero-bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(72px);
    opacity: 1;
    will-change: transform;
}

.portal-hero-bg-glow--1 {
    width: min(48vw, 480px);
    height: min(48vw, 480px);
    top: -22%;
    left: -10%;
    background: radial-gradient(circle, rgba(15, 118, 110, 0.08) 0%, transparent 68%);
    animation: portal-hero-float-a 20s ease-in-out infinite;
}

.portal-hero-bg-glow--2 {
    width: min(44vw, 440px);
    height: min(44vw, 440px);
    top: 0;
    right: -12%;
    background: radial-gradient(circle, rgba(210, 232, 229, 0.5) 0%, transparent 70%);
    animation: portal-hero-float-b 24s ease-in-out infinite;
}

.portal-hero-bg-glow--3 {
    width: min(38vw, 380px);
    height: min(38vw, 380px);
    bottom: -28%;
    left: 38%;
    background: radial-gradient(circle, rgba(231, 239, 244, 0.6) 0%, transparent 72%);
    animation: portal-hero-float-c 22s ease-in-out infinite;
}

.portal-hero-bg-grid {
    position: absolute;
    inset: 0;
    opacity: 0.5;
    background-image:
        linear-gradient(rgba(15, 118, 110, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 118, 110, 0.1) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 92% 82% at 42% 32%, #000 18%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse 92% 82% at 42% 32%, #000 18%, transparent 78%);
}

.portal-hero-bg-noise {
    position: absolute;
    inset: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 180px 180px;
}

.portal-hero-bg-fade {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 140px;
    background: linear-gradient(180deg, transparent 0%, rgba(233, 240, 236, 0.45) 50%, #e9f0ec 100%);
    pointer-events: none;
}

@keyframes portal-hero-float-a {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(2%, 3%) scale(1.04); }
}

@keyframes portal-hero-float-b {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-3%, 1%) scale(1.03); }
}

@keyframes portal-hero-float-c {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(1%, -2%) scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
    .portal-hero-bg-glow {
        animation: none;
    }
}

:root[data-theme="dark"] .portal-hero {
    color: var(--text-dark);
    background: transparent;
    border-bottom: none;
}

:root[data-theme="dark"] .portal-hero-bg-glow--1 {
    background: radial-gradient(circle, rgba(45, 212, 191, 0.08) 0%, transparent 68%);
}

:root[data-theme="dark"] .portal-hero-bg-glow--2 {
    background: radial-gradient(circle, rgba(99, 179, 237, 0.06) 0%, transparent 70%);
}

:root[data-theme="dark"] .portal-hero-bg-glow--3 {
    background: radial-gradient(circle, rgba(45, 212, 191, 0.06) 0%, transparent 72%);
}

:root[data-theme="dark"] .portal-hero-title {
    background: linear-gradient(
        118deg,
        #f8fafc 0%,
        #a7f3d0 45%,
        var(--primary-light) 78%,
        #5eead4 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

:root[data-theme="dark"] .portal-hero-bg-fade {
    background: linear-gradient(180deg, transparent 0%, rgba(20, 28, 34, 0.65) 55%, #141c22 100%);
}

:root[data-theme="dark"] .portal-hero-bg-grid {
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
}

.portal-hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
    gap: 2.5rem;
    align-items: center;
}

.portal-hero-copy {
    max-width: 38rem;
}

.portal-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.75rem;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--primary-dark);
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    line-height: 1.2;
}

.portal-hero-eyebrow::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary-color);
    flex-shrink: 0;
}

.portal-hero-title {
    font-size: clamp(2.1rem, 4.5vw, 3.35rem);
    font-weight: 800;
    line-height: 1.08;
    max-width: 14ch;
    margin-bottom: 1rem;
    text-shadow: none;
    background: linear-gradient(
        118deg,
        #1e293b 0%,
        #134e4a 38%,
        var(--primary-color) 68%,
        #1e4b6a 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.portal-hero-lead {
    font-size: clamp(1.05rem, 2vw, 1.2rem);
    line-height: 1.65;
    color: var(--text-gray);
    max-width: 36rem;
    margin-bottom: 1.6rem;
}

.portal-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.portal-hero .portal-hero-btn-primary {
    box-shadow: var(--shadow-primary);
}

.portal-hero-btn-ghost {
    background: var(--bg-white);
    border: 1px solid var(--border-strong);
    color: var(--text-dark);
}

.portal-hero-btn-ghost:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    color: var(--primary-dark);
}

.portal-hero-categories-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 0.55rem;
}

.portal-hero-category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.portal-hero-category-pill {
    display: inline-flex;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-dark);
    text-decoration: none;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.portal-hero-category-pill:hover {
    background: var(--primary-bg);
    border-color: var(--border-strong);
    color: var(--primary-dark);
    transform: translateY(-1px);
}

/* Hero visual mosaic */
.portal-hero-visual {
    min-height: 320px;
}

.portal-hero-mosaic {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    min-height: 320px;
}

.portal-hero-tile {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text-dark);
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.portal-hero-tile:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
}

.portal-hero-tile-1 { transform: rotate(-2deg); }
.portal-hero-tile-2 { transform: rotate(1.5deg); margin-top: 0.75rem; }
.portal-hero-tile-3 { transform: rotate(1deg); margin-top: -0.5rem; }
.portal-hero-tile-4 { transform: rotate(-1.5deg); }

.portal-hero-tile-1:hover,
.portal-hero-tile-2:hover,
.portal-hero-tile-3:hover,
.portal-hero-tile-4:hover {
    transform: translateY(-4px) rotate(0deg) scale(1.02);
}

.portal-hero-tile-media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 88px;
    padding: 0.85rem;
    background: linear-gradient(180deg, var(--bg-lighter) 0%, var(--bg-white) 100%);
}

.portal-hero-tile-media img {
    max-width: 100%;
    max-height: 64px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.portal-hero-tile-fallback,
.portal-hero-tile-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary-dark);
    background: var(--primary-bg);
}

.portal-hero-tile-placeholder {
    width: 100%;
    height: 100%;
    min-height: 120px;
    font-size: 1.1rem;
    letter-spacing: 0.04em;
    background: linear-gradient(145deg, var(--bg-white), var(--bg-lighter));
    color: var(--primary-dark);
}

.portal-hero-tile-body {
    padding: 0.75rem 0.9rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.portal-hero-tile-type {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-color);
}

.portal-hero-tile-name {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.3;
}

:root[data-theme="dark"] .portal-hero-tile {
    background: var(--bg-light);
    box-shadow: none;
}

:root[data-theme="dark"] .portal-hero-tile-media {
    background: transparent;
}

.portal-section-head {
    margin-bottom: 1.75rem;
}

.portal-section-head-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    margin-bottom: 0.5rem;
}

.portal-section-head-row .portal-section-title {
    margin-bottom: 0;
}

.portal-section-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--primary-color);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease, gap 0.15s ease;
}

.portal-section-link:hover {
    color: var(--primary-dark, var(--primary-color));
    gap: 0.5rem;
}

.portal-section-title {
    font-size: clamp(1.375rem, 2vw, 1.75rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--text-dark);
    text-align: left;
    margin-bottom: 0.5rem;
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: unset !important;
    background-clip: unset !important;
}

.portal-section-description {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-gray);
    max-width: 38rem;
    text-align: left;
    margin: 0;
}

/* Shared hover arrow on homepage cards */
.portal-home .guide-article-link {
    position: relative;
}

.portal-card-hover-arrow {
    position: absolute;
    bottom: 1.15rem;
    right: 1.15rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-1);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, opacity 0.2s ease, border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
    opacity: 0;
    transform: scale(0.88);
    z-index: 2;
    pointer-events: none;
}

.portal-home .guide-article-card:hover .portal-card-hover-arrow {
    opacity: 1;
    transform: scale(1);
    background: var(--primary-bg);
    border-color: var(--primary-light);
    color: var(--primary-dark);
}

.portal-card-hover-arrow svg {
    width: 16px;
    height: 16px;
}

:root[data-theme="dark"] .portal-card-hover-arrow {
    background: var(--bg-lighter);
    border-color: var(--border-color);
    color: var(--primary-light);
}

:root[data-theme="dark"] .portal-home .guide-article-card:hover .portal-card-hover-arrow {
    background: rgba(13, 148, 136, 0.14);
    border-color: var(--border-strong);
    color: var(--primary-light);
}

.portal-software {
    padding: 3.5rem 0 5rem;
    background: linear-gradient(
        180deg,
        #e9f0ec 0%,
        #f0eae7 25%,
        #f7f2f0 60%,
        #faf6f4 100%
    );
    border-top: none;
}

:root[data-theme="dark"] .portal-software {
    background: linear-gradient(
        180deg,
        #152229 0%,
        #141c22 35%,
        var(--bg-white) 100%
    );
}

.portal-courses {
    padding: 3.5rem 0 5rem;
    background: linear-gradient(
        180deg,
        #e8eef5 0%,
        #eef2f7 28%,
        #f4f6f9 65%,
        #f7f8fa 100%
    );
    border-top: none;
}

:root[data-theme="dark"] .portal-courses {
    background: linear-gradient(
        180deg,
        #141c26 0%,
        #131a22 40%,
        var(--bg-white) 100%
    );
}

.portal-courses-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: stretch;
}

.portal-courses-layout--solo {
    grid-template-columns: 1fr;
    max-width: 720px;
}

.portal-courses-side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.portal-courses-spotlight .h2n-course-card--spotlight {
    height: 100%;
    border-radius: 16px;
}

.portal-courses-spotlight .h2n-course-card--spotlight .h2n-course-card-media {
    aspect-ratio: 16 / 10;
}

.portal-courses-spotlight .h2n-course-card--spotlight .h2n-course-card-body {
    padding: 1.25rem 1.35rem 1.4rem;
    gap: 0.55rem;
}

.portal-courses-spotlight .h2n-course-card--spotlight .h2n-course-card-title {
    font-size: clamp(1.25rem, 2vw, 1.55rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.portal-courses-side .h2n-course-card--compact {
    border-radius: 12px;
    flex: 1;
}

.portal-courses-side .h2n-course-card--compact .h2n-course-card-link {
    flex-direction: row;
    align-items: stretch;
}

.portal-courses-side .h2n-course-card--compact .h2n-course-card-media {
    flex: 0 0 42%;
    max-width: 180px;
    aspect-ratio: auto;
    min-height: 100%;
}

.portal-courses-side .h2n-course-card--compact .h2n-course-card-play {
    width: 2.25rem;
    height: 2.25rem;
}

.portal-courses-side .h2n-course-card--compact .h2n-course-card-play svg {
    width: 16px;
    height: 16px;
}

.portal-courses-side .h2n-course-card--compact .h2n-course-card-body {
    padding: 0.85rem 1rem;
    justify-content: flex-start;
    gap: 0.35rem;
}

.portal-courses-side .h2n-course-card--compact .h2n-course-card-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.portal-courses-side .h2n-course-card--compact .h2n-course-card-tagline {
    font-size: 0.84rem;
    line-height: 1.4;
    flex: 0 1 auto;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.portal-courses-side .h2n-course-card--compact .h2n-course-card-meta {
    font-size: 0.82rem;
}

@media (max-width: 900px) {
    .portal-courses-layout {
        grid-template-columns: 1fr;
    }

    .portal-courses-side .h2n-course-card--compact .h2n-course-card-media {
        flex-basis: 36%;
        max-width: 140px;
    }
}

@media (max-width: 560px) {
    .portal-section-head-row {
        flex-wrap: wrap;
        align-items: center;
    }

    .portal-courses-side .h2n-course-card--compact .h2n-course-card-link {
        flex-direction: column;
    }

    .portal-courses-side .h2n-course-card--compact .h2n-course-card-media {
        flex: none;
        max-width: none;
        width: 100%;
        aspect-ratio: 16 / 9;
        min-height: 0;
    }
}

.portal-empty {
    color: var(--text-light);
    font-size: 1rem;
}

/* Override legacy homepage-2026 guides hero heading scale on portal */
.portal-home .guides-hero .section-title.portal-section-title {
    font-size: clamp(1.375rem, 2vw, 1.75rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--text-dark);
    text-align: left;
    margin-bottom: 0.5rem;
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background-clip: unset;
}

.portal-home .guides-hero .section-description.portal-section-description {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-gray);
    max-width: 38rem;
    text-align: left;
}

/* Articles section — smooth blend from software warm cream into mint-white */
.portal-home .guides-hero {
    overflow: visible;
    padding-top: 4.5rem;
    padding-bottom: 3rem;
    background: linear-gradient(
        180deg,
        #faf6f4 0%,
        #f6f8f6 18%,
        #f2faf8 40%,
        #f8fffe 72%,
        #ffffff 100%
    );
}

.portal-home .guides-hero::before {
    background:
        radial-gradient(ellipse 80% 50% at 20% 0%, rgba(15, 118, 110, 0.035) 0%, transparent 70%),
        radial-gradient(ellipse 60% 40% at 80% 10%, rgba(15, 118, 110, 0.025) 0%, transparent 70%);
}

:root[data-theme="dark"] .portal-home .guides-hero {
    background: linear-gradient(
        180deg,
        var(--bg-white) 0%,
        #131b1f 22%,
        #121a1e 55%,
        var(--bg-white) 100%
    ) !important;
}

:root[data-theme="dark"] .portal-home .guides-hero::before {
    opacity: 0.35;
}

.portal-home .guides-carousel-wrapper {
    margin: 1.75rem -3rem 0;
    padding: 0 3rem;
}

.portal-home .guides-carousel-container {
    margin: -8px 0 !important;
    padding: 8px 0;
}

.portal-home .guides-carousel-wrapper .carousel-btn-prev {
    left: 0;
}

.portal-home .guides-carousel-wrapper .carousel-btn-next {
    right: 0;
}

@media (max-width: 1259px) {
    .portal-home .guides-carousel-wrapper {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 0.75rem;
        margin: 1.75rem 0 0;
        padding: 0;
    }

    .portal-home .guides-carousel-container {
        order: 1;
        flex: 1 1 100%;
        width: 100%;
        margin: 0 !important;
        padding: 8px 0 !important;
    }

    .portal-home .guides-carousel-wrapper .carousel-btn {
        position: static;
        transform: none;
    }

    .portal-home .guides-carousel-wrapper .carousel-btn:hover,
    .portal-home .guides-carousel-wrapper .carousel-btn:active {
        transform: none;
    }

    .portal-home .guides-carousel-wrapper .carousel-btn-prev {
        order: 2;
        left: auto;
    }

    .portal-home .guides-carousel-wrapper .carousel-btn-next {
        order: 3;
        right: auto;
    }
}

/* Mobile: current card full width + half of the next visible */
@media (max-width: 768px) {
    .portal-home .guides-carousel-container {
        container-type: inline-size;
    }

    .portal-home .guides-carousel-track .guide-article-card {
        width: calc((100cqw - 1.5rem) / 1.5);
        max-width: none;
    }
}

@supports not (width: 100cqw) {
    @media (max-width: 768px) {
        .portal-home .guides-carousel-track .guide-article-card {
            width: calc((100vw - 2rem - 1.5rem) / 1.5);
        }
    }
}

@media (max-width: 900px) {
    .portal-hero-inner {
        grid-template-columns: 1fr;
    }

    .portal-hero-visual {
        min-height: auto;
    }

    .portal-hero-mosaic {
        min-height: 260px;
    }

    .portal-hero-title {
        max-width: none;
    }
}

@media (max-width: 768px) {
    .portal-hero {
        padding: 3rem 0 2.5rem;
    }

    .portal-software {
        padding: 3rem 0;
    }

    .portal-home .guides-hero {
        padding-top: 3.75rem;
        padding-bottom: 2.25rem;
    }
}

.portal-faq {
    padding: 2rem 0 5rem;
    background: #ffffff;
}

:root[data-theme="dark"] .portal-faq {
    background: var(--bg-white);
}

.portal-faq .portal-section-head {
    margin-bottom: 1.5rem;
}

.portal-faq-item {
    padding: 1.35rem 0;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.portal-faq-item:first-child {
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.portal-faq-item:last-child {
    border-bottom: none;
}

.portal-faq-question {
    margin: 0 0 0.55rem;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.01em;
    color: var(--text-dark);
}

.portal-faq-answer {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.7;
    color: var(--text-gray);
}

@media (max-width: 768px) {
    .portal-faq {
        padding: 1.5rem 0 4rem;
    }
}

/* Dark theme — softer homepage button shadows */
:root[data-theme="dark"] .portal-home .btn-primary {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

:root[data-theme="dark"] .portal-home .btn-primary:hover {
    box-shadow: 0 2px 6px rgba(15, 118, 110, 0.14);
}

:root[data-theme="dark"] .portal-home .portal-hero .portal-hero-btn-primary {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

:root[data-theme="dark"] .portal-home .portal-hero .portal-hero-btn-primary:hover {
    box-shadow: 0 2px 6px rgba(15, 118, 110, 0.14);
}

:root[data-theme="dark"] .portal-home .portal-hero-category-pill {
    color: var(--text-gray);
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color);
}

:root[data-theme="dark"] .portal-home .portal-hero-category-pill:hover {
    color: var(--text-dark);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-strong);
}
