/* =====================================================

Agile AI University

Module      : Student & Executive Portal
Stylesheet  : Credential Experience

File        : credentials.css
Version     : 2.3.0
Status      : ACTIVE

Governance  : Portal Governance v3.0

Purpose
-----------------------------------------------------
Provides the governed visual presentation for the
Credential Portfolio experience.

Responsibilities
-----------------------------------------------------
✓ Credential Portfolio page layout
✓ Credential card presentation
✓ Credential identifier presentation
✓ Credential validity presentation
✓ Credential metadata presentation
✓ Credential action styling
✓ Loading state styling
✓ Empty state styling
✓ Error state styling
✓ Retry action styling
✓ Light and dark theme compatibility
✓ Responsive portfolio rendering

Non-Responsibilities
-----------------------------------------------------
✗ Credential Detail Overlay styling
✗ Credential Asset Preview styling
✗ Certificate preview styling
✗ Badge preview styling
✗ Credential business logic
✗ Entitlement decisions
✗ Credential filtering
✗ Credential retrieval
✗ Credential identifier resolution
✗ Credential validity resolution
✗ JavaScript behaviour

Architectural Position
-----------------------------------------------------
My Credentials
    ↓
Credential Portfolio
    ↓
Credential Card
    ↓
Credential Identifier
    ↓
Credential Validity
    ↓
Open Credential Workspace

Governance
-----------------------------------------------------
• Portfolio cards remain compact and scalable.

• A single credential must not stretch across the
  full page width.

• Multiple credentials must render as a responsive
  professional portfolio grid.

• Credential ID is supporting metadata and must
  remain visually subordinate to programme identity.

• Credential validity is essential credential
  metadata and must use the same labelled hierarchy
  as the Credential ID.

• The validity label remains visually muted.

• The validity value may use a semantic positive
  accent when the credential is active or lifetime.

• Credential metadata values are supplied by the
  governed credential renderer.

• The Credential Workspace remains the detailed
  credential experience.

• This stylesheet must not style or duplicate the
  Credential Detail Overlay.

• Shared portal design tokens and global styles
  remain authoritative where available.

Dependencies
-----------------------------------------------------
• my-credentials.html
• credential-renderer.js
• site.css
• overlay.css
• credential-detail-overlay.css
• credential-asset-preview.css

Change History
-----------------------------------------------------
v2.3.0

• Added governed Validity label presentation
• Added validity metadata block
• Added validity label and semantic value hierarchy
• Added dark-theme validity compatibility
• Added responsive validity presentation
• Retained legacy validity class compatibility
• Preserved Credential ID presentation
• Preserved compact professional card architecture
• Preserved loading, empty and error states

v2.2.0

• Added governed Credential ID presentation
• Added Credential ID label and value hierarchy
• Added long-identifier wrapping protection
• Added light and dark theme compatibility
• Adjusted card height for identifier metadata
• Added dark-theme portfolio card fallbacks
• Preserved compact professional card architecture
• Preserved portfolio responsiveness
• Preserved loading, empty and error states

v2.1.0

• Consolidated duplicate credential layout rules
• Added compact professional portfolio cards
• Prevented single-card full-width expansion
• Removed nested double-card visual treatment
• Added governed page navigation styling
• Added professional portfolio heading styling
• Added loading indicator styling
• Added accessible focus states
• Added retry action styling
• Improved empty and error states
• Improved responsive behaviour
• Preserved legacy shared credential utility classes

v2.0.0

• Added Credential Portfolio card experience
• Added responsive portfolio grid

v1.0.0

• Initial governed implementation
• Added credential card styling
• Added credential action styling
• Added empty and error states
• Added responsive layout support

===================================================== */


/* =====================================================
   PAGE
===================================================== */

.credentials-page {

    width:
        min(
            calc(100% - 48px),
            1200px
        );

    margin:
        0 auto;

    padding:
        28px 0 56px;

    min-height:
        auto;

}


/* =====================================================
   PAGE NAVIGATION
===================================================== */

.credentials-page-navigation {

    margin-bottom:
        28px;

}

.credentials-back-link {

    display:
        inline-flex;

    align-items:
        center;

    gap:
        8px;

    color:
        #111827;

    font-size:
        15px;

    font-weight:
        700;

    line-height:
        1.4;

    text-decoration:
        none;

    transition:
        color 0.2s ease;

}

.credentials-back-link:hover {

    color:
        #111827;

    text-decoration:
        underline;

}

.credentials-back-link:focus-visible {

    outline:
        3px solid #93c5fd;

    outline-offset:
        4px;

    border-radius:
        4px;

}


/* =====================================================
   PAGE HEADER
===================================================== */

.page-header {

    max-width:
        820px;

    margin-bottom:
        36px;

}

.page-eyebrow {

    margin:
        0 0 12px;

    color:
        #64748b;

    font-size:
        13px;

    font-weight:
        800;

    letter-spacing:
        0.08em;

    line-height:
        1.4;

    text-transform:
        uppercase;

}

.page-header h1 {

    margin:
        0 0 14px;

    color:
        #0f172a;

    font-size:
        clamp(
            34px,
            4vw,
            48px
        );

    font-weight:
        800;

    line-height:
        1.1;

}

.page-description,
.page-header p {

    max-width:
        760px;

    margin:
        0;

    color:
        #475569;

    font-size:
        17px;

    line-height:
        1.7;

}


/* =====================================================
   PORTFOLIO SECTION
===================================================== */

.credential-portfolio-section {

    margin-top:
        8px;

}

.credential-portfolio-heading {

    margin-bottom:
        22px;

}

.credential-portfolio-heading h2 {

    margin:
        0 0 8px;

    color:
        #0f172a;

    font-size:
        28px;

    font-weight:
        800;

    line-height:
        1.25;

}

.credential-portfolio-heading p {

    margin:
        0;

    color:
        #64748b;

    font-size:
        16px;

    line-height:
        1.6;

}


/* =====================================================
   GRID
===================================================== */

.credential-grid {

    display:
        grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(
                340px,
                420px
            )
        );

    justify-content:
        start;

    align-items:
        stretch;

    gap:
        24px;

    margin-top:
        24px;

    margin-bottom:
        24px;

}

.credentials-grid {

    display:
        grid;

    gap:
        20px;

    max-width:
        1000px;

}


/* =====================================================
   CREDENTIAL CARD WRAPPER

   The renderer creates:

   .credential-card
       ↓
   .credential-portfolio-card

   The outer wrapper must remain visually neutral to avoid
   a duplicated card border and duplicated padding.
===================================================== */

.credential-card {

    min-width:
        0;

    padding:
        0;

    overflow:
        visible;

    background:
        transparent;

    border:
        none;

    border-radius:
        16px;

    box-shadow:
        none;

}

.credential-card:hover {

    box-shadow:
        none;

}


/* =====================================================
   PROFESSIONAL PORTFOLIO CARD
===================================================== */

.credential-portfolio-card {

    display:
        flex;

    flex-direction:
        column;

    align-items:
        center;

    width:
        100%;

    min-height:
        470px;

    padding:
        36px 28px 28px;

    overflow:
        hidden;

    background:
        #ffffff;

    border:
        1px solid #d8dee6;

    border-radius:
        16px;

    box-shadow:
        0 10px 28px rgba(
            15,
            23,
            42,
            0.06
        );

    color:
        #0f172a;

    text-align:
        center;

    cursor:
        pointer;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;

}

.credential-portfolio-card:hover {

    transform:
        translateY(-3px);

    border-color:
        #cbd5e1;

    box-shadow:
        0 16px 36px rgba(
            15,
            23,
            42,
            0.08
        );

}

.credential-portfolio-card:focus-within {

    border-color:
        #93c5fd;

    box-shadow:
        0 0 0 4px rgba(
            147,
            197,
            253,
            0.30
        );

}


/* =====================================================
   EMBLEM
===================================================== */

.credential-portfolio-emblem {

    width:
        90px;

    height:
        90px;

    flex:
        0 0 auto;

    margin-bottom:
        22px;

    object-fit:
        contain;

}


/* =====================================================
   PROGRAMME CODE
===================================================== */

.credential-portfolio-code {

    max-width:
        100%;

    margin-bottom:
        10px;

    color:
        #1e3a5f;

    font-size:
        34px;

    font-weight:
        800;

    line-height:
        1;

    letter-spacing:
        -0.02em;

    overflow-wrap:
        anywhere;

}


/* =====================================================
   PROGRAMME TITLE
===================================================== */

.credential-portfolio-title {

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    max-width:
        100%;

    min-height:
        58px;

    margin-bottom:
        14px;

    color:
        #0f172a;

    font-size:
        20px;

    font-weight:
        700;

    line-height:
        1.4;

    overflow-wrap:
        anywhere;

}


/* =====================================================
   CREDENTIAL IDENTIFIER

   Credential ID is professional supporting metadata.

   It remains visually subordinate to the programme code
   and programme title, while providing a reliable reference
   without requiring the learner to open the workspace.
===================================================== */

.credential-portfolio-id {

    display:
        flex;

    flex-direction:
        column;

    align-items:
        center;

    gap:
        4px;

    width:
        100%;

    min-width:
        0;

    margin:
        0 0 18px;

}

.credential-portfolio-id-label {

    color:
        #64748b;

    font-size:
        11px;

    font-weight:
        800;

    line-height:
        1.35;

    letter-spacing:
        0.08em;

    text-transform:
        uppercase;

}

.credential-portfolio-id-value {

    max-width:
        100%;

    color:
        #475569;

    font-size:
        14px;

    font-weight:
        600;

    line-height:
        1.4;

    letter-spacing:
        0.01em;

    overflow-wrap:
        anywhere;

    word-break:
        normal;

}


/* =====================================================
   CREDENTIAL VALIDITY

   Validity uses the same professional metadata hierarchy
   as Credential ID.

   The label remains muted.

   The value retains a semantic positive accent.
===================================================== */

.credential-portfolio-validity-block {

    display:
        flex;

    flex-direction:
        column;

    align-items:
        center;

    gap:
        4px;

    width:
        100%;

    min-width:
        0;

    margin:
        0 0 24px;

}

.credential-portfolio-validity-label {

    color:
        #64748b;

    font-size:
        11px;

    font-weight:
        800;

    line-height:
        1.35;

    letter-spacing:
        0.08em;

    text-transform:
        uppercase;

}

.credential-portfolio-validity-value {

    max-width:
        100%;

    color:
        #0f766e;

    font-size:
        14px;

    font-weight:
        800;

    line-height:
        1.4;

    overflow-wrap:
        anywhere;

}


/* =====================================================
   LEGACY VALIDITY COMPATIBILITY

   Retained temporarily for any credential region still
   using the earlier single-element validity markup.
===================================================== */

.credential-portfolio-validity {

    margin-bottom:
        24px;

    color:
        #0f766e;

    font-size:
        14px;

    font-weight:
        800;

    line-height:
        1.4;

    overflow-wrap:
        anywhere;

}


/* =====================================================
   PORTFOLIO ACTION
===================================================== */

.credential-portfolio-action {

    width:
        100%;

    margin-top:
        auto;

    padding:
        12px 16px;

    border:
        none;

    border-radius:
        10px;

    background:
        #111827;

    color:
        #ffffff;

    font-size:
        15px;

    font-weight:
        700;

    line-height:
        1.4;

    cursor:
        pointer;

    transition:
        background 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;

}

.credential-portfolio-action:hover {

    background:
        #111827;

    transform:
        translateY(-1px);

    box-shadow:
        0 8px 20px rgba(
            15,
            23,
            42,
            0.18
        );

}

.credential-portfolio-action:active {

    transform:
        translateY(0);

}

.credential-portfolio-action:focus-visible {

    outline:
        3px solid #93c5fd;

    outline-offset:
        3px;

}

.credential-portfolio-action:disabled,
.credential-portfolio-action[aria-disabled="true"] {

    opacity:
        0.55;

    cursor:
        not-allowed;

    transform:
        none;

    box-shadow:
        none;

}


/* =====================================================
   LEGACY CREDENTIAL UTILITIES

   Retained for compatibility with other credential
   experiences that may still use these classes.
===================================================== */

.credential-badge {

    display:
        inline-block;

    margin-bottom:
        16px;

    padding:
        6px 12px;

    border-radius:
        999px;

    background:
        #eff6ff;

    color:
        #111827;

    font-size:
        12px;

    font-weight:
        700;

    letter-spacing:
        0.5px;

}

.credential-title {

    margin-bottom:
        12px;

    font-size:
        18px;

    font-weight:
        600;

}

.credential-meta {

    margin-bottom:
        8px;

    color:
        #374151;

}

.credential-validity {

    color:
        #0f766e;

    font-weight:
        600;

}

.credential-helper {

    margin-top:
        16px;

    color:
        #475569;

    font-size:
        15px;

    line-height:
        1.7;

}

.credential-experience-note {

    margin:
        12px 0 24px;

    padding:
        12px 16px;

    background:
        #f8fafc;

    border:
        1px solid #e5e7eb;

    border-radius:
        8px;

    color:
        #475569;

    font-size:
        14px;

    line-height:
        1.6;

}


/* =====================================================
   SHARED ACTION UTILITIES

   Retained for legacy credential regions only.
===================================================== */

.credential-actions {

    display:
        flex;

    flex-wrap:
        wrap;

    gap:
        10px;

    margin-top:
        12px;

}

.btn {

    display:
        inline-block;

    padding:
        10px 14px;

    border:
        none;

    border-radius:
        8px;

    font-size:
        15px;

    font-weight:
        600;

    text-align:
        center;

    text-decoration:
        none;

    cursor:
        pointer;

}

.btn.primary {

    background:
        #2563eb;

    color:
        #ffffff;

}

.btn.primary:hover {

    opacity:
        0.95;

}

.btn.secondary {

    background:
        #f3f4f6;

    color:
        #111827;

}

.btn.secondary:hover {

    background:
        #e5e7eb;

}


/* =====================================================
   LOADING STATE
===================================================== */

.loading-state {

    display:
        flex;

    align-items:
        center;

    justify-content:
        center;

    gap:
        12px;

    min-height:
        160px;

    padding:
        40px;

    color:
        #64748b;

    text-align:
        center;

}

.loading-state-indicator {

    width:
        20px;

    height:
        20px;

    flex:
        0 0 auto;

    border:
        3px solid #dbeafe;

    border-top-color:
        #2563eb;

    border-radius:
        50%;

    animation:
        credential-loading-spin 0.8s linear infinite;

}

@keyframes credential-loading-spin {

    to {

        transform:
            rotate(360deg);

    }

}


/* =====================================================
   EMPTY STATE
===================================================== */

.empty-state {

    grid-column:
        1 / -1;

    padding:
        42px 28px;

    border:
        1px dashed #cbd5e1;

    border-radius:
        14px;

    background:
        #f8fafc;

    color:
        #64748b;

    text-align:
        center;

}

.empty-state h3 {

    margin:
        0 0 10px;

    color:
        #334155;

    font-size:
        22px;

}

.empty-state p {

    max-width:
        520px;

    margin:
        0 auto;

    line-height:
        1.6;

}


/* =====================================================
   ERROR STATE
===================================================== */

.error-state {

    grid-column:
        1 / -1;

    padding:
        42px 28px;

    border:
        1px solid #fecaca;

    border-radius:
        14px;

    background:
        #fef2f2;

    color:
        #b91c1c;

    text-align:
        center;

}

.error-state p {

    margin:
        0 0 18px;

    line-height:
        1.6;

}

.credential-retry-action {

    display:
        inline-flex;

    align-items:
        center;

    justify-content:
        center;

    min-width:
        130px;

    padding:
        10px 16px;

    border:
        none;

    border-radius:
        8px;

    background:
        #b91c1c;

    color:
        #ffffff;

    font-size:
        15px;

    font-weight:
        700;

    cursor:
        pointer;

    transition:
        background 0.2s ease;

}

.credential-retry-action:hover {

    background:
        #991b1b;

}

.credential-retry-action:focus-visible {

    outline:
        3px solid #fca5a5;

    outline-offset:
        3px;

}


/* =====================================================
   DARK THEME

   These selectors provide safe compatibility for the
   theme mechanisms currently supported by the portal.
===================================================== */

html[data-theme="dark"]
.credentials-back-link,
body[data-theme="dark"]
.credentials-back-link,
.dark-theme
.credentials-back-link,
.theme-dark
.credentials-back-link {

    color:
        #f8fafc;

}

html[data-theme="dark"]
.page-header h1,
body[data-theme="dark"]
.page-header h1,
.dark-theme
.page-header h1,
.theme-dark
.page-header h1,
html[data-theme="dark"]
.credential-portfolio-heading h2,
body[data-theme="dark"]
.credential-portfolio-heading h2,
.dark-theme
.credential-portfolio-heading h2,
.theme-dark
.credential-portfolio-heading h2 {

    color:
        #f8fafc;

}

html[data-theme="dark"]
.page-eyebrow,
body[data-theme="dark"]
.page-eyebrow,
.dark-theme
.page-eyebrow,
.theme-dark
.page-eyebrow,
html[data-theme="dark"]
.page-description,
body[data-theme="dark"]
.page-description,
.dark-theme
.page-description,
.theme-dark
.page-description,
html[data-theme="dark"]
.page-header p,
body[data-theme="dark"]
.page-header p,
.dark-theme
.page-header p,
.theme-dark
.page-header p,
html[data-theme="dark"]
.credential-portfolio-heading p,
body[data-theme="dark"]
.credential-portfolio-heading p,
.dark-theme
.credential-portfolio-heading p,
.theme-dark
.credential-portfolio-heading p {

    color:
        #94a3b8;

}

html[data-theme="dark"]
.credential-portfolio-card,
body[data-theme="dark"]
.credential-portfolio-card,
.dark-theme
.credential-portfolio-card,
.theme-dark
.credential-portfolio-card {

    background:
        #111827;

    border-color:
        #334155;

    color:
        #f8fafc;

    box-shadow:
        0 10px 28px rgba(
            0,
            0,
            0,
            0.22
        );

}

html[data-theme="dark"]
.credential-portfolio-card:hover,
body[data-theme="dark"]
.credential-portfolio-card:hover,
.dark-theme
.credential-portfolio-card:hover,
.theme-dark
.credential-portfolio-card:hover {

    border-color:
        #475569;

    box-shadow:
        0 16px 36px rgba(
            0,
            0,
            0,
            0.30
        );

}

html[data-theme="dark"]
.credential-portfolio-code,
body[data-theme="dark"]
.credential-portfolio-code,
.dark-theme
.credential-portfolio-code,
.theme-dark
.credential-portfolio-code {

    color:
        #bfdbfe;

}

html[data-theme="dark"]
.credential-portfolio-title,
body[data-theme="dark"]
.credential-portfolio-title,
.dark-theme
.credential-portfolio-title,
.theme-dark
.credential-portfolio-title {

    color:
        #f8fafc;

}

html[data-theme="dark"]
.credential-portfolio-id-label,
body[data-theme="dark"]
.credential-portfolio-id-label,
.dark-theme
.credential-portfolio-id-label,
.theme-dark
.credential-portfolio-id-label,
html[data-theme="dark"]
.credential-portfolio-validity-label,
body[data-theme="dark"]
.credential-portfolio-validity-label,
.dark-theme
.credential-portfolio-validity-label,
.theme-dark
.credential-portfolio-validity-label {

    color:
        #94a3b8;

}

html[data-theme="dark"]
.credential-portfolio-id-value,
body[data-theme="dark"]
.credential-portfolio-id-value,
.dark-theme
.credential-portfolio-id-value,
.theme-dark
.credential-portfolio-id-value {

    color:
        #cbd5e1;

}

html[data-theme="dark"]
.credential-portfolio-validity-value,
body[data-theme="dark"]
.credential-portfolio-validity-value,
.dark-theme
.credential-portfolio-validity-value,
.theme-dark
.credential-portfolio-validity-value,
html[data-theme="dark"]
.credential-portfolio-validity,
body[data-theme="dark"]
.credential-portfolio-validity,
.dark-theme
.credential-portfolio-validity,
.theme-dark
.credential-portfolio-validity {

    color:
        #5eead4;

}

html[data-theme="dark"]
.credential-portfolio-action,
body[data-theme="dark"]
.credential-portfolio-action,
.dark-theme
.credential-portfolio-action,
.theme-dark
.credential-portfolio-action {

    background:
        #e2e8f0;

    color:
        #0f172a;

}

html[data-theme="dark"]
.credential-portfolio-action:hover,
body[data-theme="dark"]
.credential-portfolio-action:hover,
.dark-theme
.credential-portfolio-action:hover,
.theme-dark
.credential-portfolio-action:hover {

    background:
        #f8fafc;

}

html[data-theme="dark"]
.loading-state,
body[data-theme="dark"]
.loading-state,
.dark-theme
.loading-state,
.theme-dark
.loading-state {

    color:
        #94a3b8;

}

html[data-theme="dark"]
.empty-state,
body[data-theme="dark"]
.empty-state,
.dark-theme
.empty-state,
.theme-dark
.empty-state {

    background:
        #0f172a;

    border-color:
        #475569;

    color:
        #94a3b8;

}

html[data-theme="dark"]
.empty-state h3,
body[data-theme="dark"]
.empty-state h3,
.dark-theme
.empty-state h3,
.theme-dark
.empty-state h3 {

    color:
        #e2e8f0;

}

html[data-theme="dark"]
.error-state,
body[data-theme="dark"]
.error-state,
.dark-theme
.error-state,
.theme-dark
.error-state {

    background:
        #2a1215;

    border-color:
        #7f1d1d;

    color:
        #fecaca;

}


/* =====================================================
   RESPONSIVE — TABLET
===================================================== */

@media (max-width: 900px) {

    .credentials-page {

        width:
            min(
                calc(100% - 32px),
                1200px
            );

    }

    .credential-grid {

        grid-template-columns:
            repeat(
                auto-fill,
                minmax(
                    280px,
                    1fr
                )
            );

    }

}


/* =====================================================
   RESPONSIVE — MOBILE
===================================================== */

@media (max-width: 768px) {

    .credentials-page {

        width:
            calc(100% - 24px);

        padding:
            20px 0 40px;

    }

    .credentials-page-navigation {

        margin-bottom:
            22px;

    }

    .page-header {

        margin-bottom:
            28px;

    }

    .page-header h1 {

        font-size:
            34px;

    }

    .page-description,
    .page-header p {

        font-size:
            16px;

    }

    .credential-portfolio-heading h2 {

        font-size:
            24px;

    }

    .credential-grid {

        grid-template-columns:
            minmax(
                0,
                1fr
            );

        gap:
            18px;

    }

    .credential-portfolio-card {

        min-height:
            440px;

        padding:
            26px 20px 20px;

    }

    .credential-portfolio-emblem {

        width:
            76px;

        height:
            76px;

        margin-bottom:
            18px;

    }

    .credential-portfolio-code {

        font-size:
            34px;

    }

    .credential-portfolio-title {

        min-height:
            auto;

        font-size:
            19px;

    }

    .credential-portfolio-id {

        margin-bottom:
            16px;

    }

    .credential-portfolio-validity-block {

        margin-bottom:
            20px;

    }

    .credential-portfolio-id-label,
    .credential-portfolio-validity-label {

        font-size:
            10px;

    }

    .credential-portfolio-id-value {

        font-size:
            13px;

    }

    .credential-portfolio-validity-value {

        font-size:
            13px;

    }

    .credential-actions {

        flex-direction:
            column;

    }

    .btn {

        width:
            100%;

    }

}


/* =====================================================
   REDUCED MOTION
===================================================== */

@media (prefers-reduced-motion: reduce) {

    .credential-portfolio-card,
    .credential-portfolio-action,
    .credentials-back-link {

        transition:
            none;

    }

    .credential-portfolio-card:hover,
    .credential-portfolio-action:hover {

        transform:
            none;

    }

    .loading-state-indicator {

        animation:
            none;

    }

}