/* portal.css — portal.proginsight.com
   All layout unique to the portal lives here.
   Shared chrome (sidebar, customize popup, scrollbars, markdown typography)
   comes from styles.css / sidebar.css / customdialog.css / markdown.css — reused verbatim. */

/* ═══════════════════════════════════════════════════════════════
   1. APP SHELL OVERRIDES
   The portal shell has no page overlays — content fills main-content
   directly. #portal-welcome-root / #portal-resources-root each take
   the full height and scroll independently.
   ═══════════════════════════════════════════════════════════════ */

.portal-root {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
}

.portal-root--hidden {
    display: none !important;
}

/* Full scrollable world inside each root */
.portal-world {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.portal-main {
    flex: 1;
    padding: 40px 48px 64px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.portal-main--detail {
    max-width: 900px;
}

.portal-footer-wrap {
    margin-top: auto;
}

/* ═══════════════════════════════════════════════════════════════
   2. HERO
   ═══════════════════════════════════════════════════════════════ */

.mkt-hero {
    padding: 72px 48px 56px;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-primary);
}

.mkt-hero-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.mkt-hero-text {
    flex: 1;
}

.mkt-hero-eyebrow {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.mkt-hero-headline {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--text-primary);
    margin: 0 0 16px;
}

.mkt-hero-sub {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 24px;
    max-width: 480px;
}

.mkt-hero-badge {
    display: inline-block;
    padding: 0.3em 0.9em;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--badge-accent, var(--accent-color)) 12%, transparent);
    color: var(--badge-accent, var(--accent-color));
    border: 1px solid color-mix(in srgb, var(--badge-accent, var(--accent-color)) 30%, transparent);
}

.mkt-hero-icon {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    opacity: 0.18;
}

.mkt-hero-icon svg {
    width: 100%;
    height: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   3. FILTER PILLS
   ═══════════════════════════════════════════════════════════════ */

.mkt-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
}

.mkt-pill {
    padding: 0.35em 1em;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--surface-secondary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.mkt-pill:hover {
    border-color: var(--accent-color);
    color: var(--text-primary);
}

.mkt-pill--active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   4. CARD GRID
   ═══════════════════════════════════════════════════════════════ */

.mkt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.mkt-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--surface-secondary);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.mkt-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

/* Thumbnail */
.mkt-card-media {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--surface-tertiary);
}

.mkt-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mkt-card-thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-muted);
}

.mkt-card-thumb--placeholder svg {
    width: 40px;
    height: 40px;
    opacity: 0.4;
}

/* Card body */
.mkt-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.mkt-card-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.mkt-card-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.mkt-card-tagline {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
    flex: 1;
}

.mkt-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    gap: 8px;
}

.mkt-card-author {
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.mkt-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════════
   5. SHARED: TAGS & PRICE
   ═══════════════════════════════════════════════════════════════ */

.mkt-tag {
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.15em 0.5em;
    border-radius: 4px;
    background: var(--surface-tertiary);
    color: var(--text-muted);
}

.mkt-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    flex-shrink: 0;
}

.mkt-price--free {
    color: var(--accent-color);
}

/* ═══════════════════════════════════════════════════════════════
   6. DETAIL VIEW
   ═══════════════════════════════════════════════════════════════ */

.mkt-detail {
    padding: 0; /* portal-main already pads */
}

.mkt-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    padding: 0 0 24px;
    transition: color 0.15s;
}

.mkt-back-btn:hover {
    color: var(--accent-color);
}

/* Header */
.mkt-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 36px;
}

.mkt-detail-meta {
    flex: 1;
}

.mkt-detail-name {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.mkt-detail-byline {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.mkt-detail-version {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2em 0.6em;
    border-radius: 6px;
    background: var(--surface-tertiary);
    color: var(--text-muted);
}

.mkt-detail-author {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.mkt-detail-tagline {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 14px;
}

.mkt-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Action panel */
.mkt-detail-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.mkt-detail-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.mkt-install-btn {
    padding: 0.65em 1.4em;
    border-radius: 10px;
    background: var(--accent-color);
    color: #fff;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s, transform 0.1s;
}

.mkt-install-btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.mkt-auth-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    text-align: right;
}

.mkt-auth-note a {
    color: var(--accent-color);
    text-decoration: none;
}

/* Sections */
.mkt-detail-section {
    margin-bottom: 48px;
}

.mkt-detail-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

/* Capabilities */
.mkt-caps-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mkt-cap-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.mkt-cap-dot {
    font-size: 0.5rem;
    color: var(--accent-color);
    flex-shrink: 0;
    position: relative;
    top: -1px;
}

/* Gallery */
.mkt-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.mkt-gallery-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: zoom-in;
    transition: transform 0.15s;
}

.mkt-gallery-img:hover {
    transform: scale(1.02);
}

/* Readme */
.mkt-readme {
    /* Typography from markdown.css via .markdown-body */
}

/* Comments stub */
.mkt-comments-section {
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px 32px;
}

.mkt-comments-stub {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.mkt-comments-stub-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.mkt-comments-stub-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.mkt-comments-stub-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 16px;
}

.mkt-stub-signin-btn {
    padding: 0.55em 1.4em;
    border-radius: 8px;
    border: 1px solid var(--accent-color);
    background: transparent;
    color: var(--accent-color);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.mkt-stub-signin-btn:hover {
    background: var(--accent-color);
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   7. FOOTER
   ═══════════════════════════════════════════════════════════════ */

.mkt-footer {
    border-top: 1px solid var(--border-color);
    background: var(--surface-primary);
    padding: 32px 48px 28px;
}

.mkt-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto 20px;
    flex-wrap: wrap;
}

.mkt-footer-brand {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

.mkt-footer-tagline {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
}

.mkt-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    justify-content: flex-end;
}

.mkt-footer-link {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.mkt-footer-link:hover {
    color: var(--accent-color);
}

.mkt-footer-link--muted {
    opacity: 0.45;
    pointer-events: none;
}

.mkt-footer-copy {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 1200px;
    margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════
   8. AUTH OVERLAY
   ═══════════════════════════════════════════════════════════════ */

.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;

    /* Hidden state */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.auth-overlay--open {
    opacity: 1;
    pointer-events: auto;
}

.auth-shell {
    background: var(--surface-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.2);

    transform: translateY(12px) scale(0.97);
    transition: transform 0.22s ease;
}

.auth-overlay--open .auth-shell {
    transform: translateY(0) scale(1);
}

.auth-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
}

.auth-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-tertiary);
    font-size: 16px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transition: color 0.15s, background 0.15s;
}

.auth-close:hover {
    color: var(--text-primary);
    background: var(--hover-bg);
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}

.auth-tab--active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.auth-body {
    padding: 24px;
}

.auth-reason {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0 0 16px;
    padding: 10px 14px;
    background: var(--surface-secondary);
    border-radius: 8px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.auth-input {
    padding: 0.6em 0.85em;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--surface-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.auth-input:focus {
    border-color: var(--accent-color);
}

.auth-submit {
    margin-top: 4px;
    padding: 0.65em;
    border-radius: 10px;
    border: none;
    background: var(--accent-color);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s;
}

.auth-submit:hover {
    opacity: 0.88;
}

.auth-forgot {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    text-decoration: none;
}

.auth-forgot:hover {
    color: var(--accent-color);
}

/* Coming soon notice at bottom of auth shell */
.auth-stub-notice {
    padding: 12px 24px 16px;
    background: var(--surface-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-stub-badge {
    padding: 0.15em 0.5em;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--accent-color) 15%, transparent);
    color: var(--accent-color);
    white-space: nowrap;
}

/* Stub response (after submit) */
.auth-stub-response {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 16px 0;
}

.auth-stub-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.auth-stub-msg {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.auth-stub-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 12px;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   9. SHARED STATUS / LOADING
   ═══════════════════════════════════════════════════════════════ */

.mkt-status {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 40px 0;
    text-align: center;
    grid-column: 1 / -1;
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════════
   10. RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
    .mkt-hero {
        padding: 48px 24px 40px;
    }

    .mkt-hero-inner {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 16px;
    }

    .mkt-hero-icon {
        width: 64px;
        height: 64px;
        align-self: flex-end;
    }

    .portal-main {
        padding: 28px 24px 48px;
    }

    .mkt-detail-header {
        flex-direction: column;
        gap: 24px;
    }

    .mkt-detail-actions {
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .mkt-footer {
        padding: 24px 24px 20px;
    }

    .mkt-footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .mkt-footer-links {
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    .mkt-grid {
        grid-template-columns: 1fr;
    }

    .mkt-gallery {
        grid-template-columns: 1fr;
    }

    .mkt-detail-name {
        font-size: 1.4rem;
    }
}


/* ============================================================
   Welcome World — WelcomeSupervisor
   ============================================================ */

#portal-welcome-world {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ── Bubbles ── */

.pw-bubbles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.pw-bubble {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    background: radial-gradient(
        circle,
        transparent 35%,
        color-mix(in srgb, var(--accent-color) 30%, transparent) 65%,
        transparent 100%
    );
    animation: pw-bubble-grow linear forwards;
}

@keyframes pw-bubble-grow {
    0%   { transform: scale(0);    opacity: 0; }
    15%  { opacity: 1; }
    80%  { transform: scale(1);    opacity: 0.7; }
    88%  { transform: scale(1.18); opacity: 0.9; }
    100% { transform: scale(1.5);  opacity: 0; }
}

/* ── Content ── */

.pw-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 32px 48px 60px;
    max-width: 720px;
    width: 100%;
    animation: pw-content-reveal 0.4s ease 0.1s both;
}

@keyframes pw-content-reveal {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0);   }
}

/* Top pill */
.pw-top-pill {
    display: inline-block;
    align-self: flex-start;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--accent-color) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-color) 28%, transparent);
    color: var(--accent-color);
}

/* Heading */
.pw-heading {
    margin: 0;
    font-size: clamp(32px, 5vw, 52px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* Pill row */
.pw-pill-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.pw-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pw-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--surface-primary);
    border: 1px solid var(--border-color);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pw-pill svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.7;
}

.pw-pill:hover {
    background: color-mix(in srgb, var(--accent-color) 10%, var(--surface-primary));
    border-color: color-mix(in srgb, var(--accent-color) 40%, transparent);
    color: var(--accent-color);
}

.pw-pill:hover svg {
    opacity: 1;
}

/* Decorative SVG */
.pw-deco-svg {
    width: 120px;
    height: 80px;
    flex-shrink: 0;
    opacity: 0.8;
}

@media (max-width: 600px) {
    .pw-content  { padding: 40px 24px; }
    .pw-pill-row { flex-direction: column; align-items: flex-start; }
    .pw-deco-svg { display: none; }
}
