/* ==========================================================================
   Public offering cards
   One card design for every public listing: programmes, certificate
   programmes, short courses and catalogue offerings.
   Markup: resources/views/components/public/offering-card.blade.php

   Colours come from the editorial theme tokens (--ed-*) so the Appearance
   settings still drive the brand; hex fallbacks cover pages without them.
   ========================================================================== */

.pc-grid {
    --pc-min: 300px;
    display: grid;
    /* auto-fit lets two or three cards share the row instead of leaving a gap. */
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--pc-min)), 1fr));
    gap: 24px;
    align-items: stretch;
}

/* A lone card should read as a card, not a banner. */
.pc-grid > .pc-card:only-child {
    max-width: 560px;
}

.pc-card {
    /* Bright brand for decoration (accent bar, tints) ... */
    --pc-brand: var(--ed-ink-bright, #3BA9FA);
    /* ... and the accessible brand blue for text and button fills (5.6:1 / 8.4:1 on white). */
    --pc-brand-strong: #1B6AAE;
    --pc-brand-stronger: #134F85;
    --pc-brand-tint: rgba(59, 169, 250, 0.1);
    --pc-brand-tint: color-mix(in srgb, var(--pc-brand) 11%, white);
    --pc-text: var(--ed-text, #24292F);
    --pc-muted: #5B6470;
    --pc-line: #E3E8EF;
    --pc-positive: #17663F;
    --pc-positive-tint: #E6F4EC;
    --pc-radius: 12px;
    --pc-serif: var(--ed-serif, Georgia, 'Times New Roman', serif);
    --pc-sans: var(--ed-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    --pc-mono: var(--ed-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);

    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    padding: 24px 24px 20px;
    background: #fff;
    border: 1px solid var(--pc-line);
    border-radius: var(--pc-radius);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    font-family: var(--pc-sans);
    color: var(--pc-text);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Brand accent that draws in on hover/focus. */
.pc-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: var(--pc-brand);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

.pc-card:hover,
.pc-card:focus-within {
    border-color: color-mix(in srgb, var(--pc-brand) 35%, var(--pc-line));
    box-shadow: 0 18px 36px -20px rgba(16, 24, 40, 0.28), 0 2px 6px rgba(16, 24, 40, 0.05);
    transform: translateY(-3px);
}

.pc-card:hover::before,
.pc-card:focus-within::before {
    transform: scaleX(1);
}

/* ---- Top row: code/category badge + duration ---- */
.pc-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.pc-card__badge {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    max-width: 60%;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--pc-brand-tint);
    color: var(--pc-brand-stronger);
    font-family: var(--pc-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    line-height: 1.4;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pc-card__duration {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    margin-left: auto;
    color: var(--pc-muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.pc-card__duration .bx {
    font-size: 16px;
    color: var(--pc-brand-strong);
}

/* ---- Body: title, subtitle, clamped summary ---- */
.pc-card__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 auto;
}

.pc-card__title {
    margin: 0;
    font-family: var(--pc-serif);
    font-size: 22px;
    font-weight: 600;
    line-height: 1.25;
    /* Page heading rules (e.g. short-course h2) must not squeeze card titles. */
    letter-spacing: normal;
    text-transform: none;
    color: var(--pc-text);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.pc-card__subtitle {
    color: var(--pc-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.pc-card__summary {
    margin: 4px 0 0;
    color: var(--pc-muted);
    font-size: 14.5px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

/* ---- Key facts ---- */
.pc-card__facts {
    display: grid;
    gap: 8px;
    margin: 20px 0 0;
    padding: 14px 0 0;
    border-top: 1px dashed var(--pc-line);
}

.pc-card__fact {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 13.5px;
}

.pc-card__fact dt {
    color: var(--pc-muted);
    font-weight: 500;
}

.pc-card__fact dd {
    margin: 0;
    color: var(--pc-text);
    font-weight: 600;
    text-align: right;
}

.pc-card__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pc-card__status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pc-muted);
}

.pc-card__status--positive {
    color: var(--pc-positive) !important;
}

.pc-card__status--positive::before {
    background: var(--pc-positive);
    box-shadow: 0 0 0 3px var(--pc-positive-tint);
}

/* ---- Footer actions ---- */
.pc-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--pc-line);
}

.pc-card__link,
.pc-card__link:visited {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--pc-brand-strong);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
}

.pc-card__link .bx {
    font-size: 18px;
    transition: transform 0.2s ease;
}

/* The details link covers the whole card so any click opens it. */
.pc-card__link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: var(--pc-radius);
}

.pc-card:hover .pc-card__link {
    color: var(--pc-brand-stronger);
}

.pc-card:hover .pc-card__link .bx {
    transform: translateX(3px);
}

.pc-card__action,
.pc-card__action:visited {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 18px;
    border-radius: 999px;
    background: var(--pc-brand-strong);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

.pc-card__action:hover {
    background: var(--pc-brand-stronger);
    color: #fff;
}

/* ---- Focus: ring the card for the stretched link, ring the button itself. ---- */
.pc-card__link:focus-visible {
    outline: none;
}

/* Inset, because the card clips overflow for its accent bar. */
.pc-card__link:focus-visible::after {
    outline: 3px solid var(--pc-brand-strong);
    outline-offset: -3px;
}

.pc-card__action:focus-visible {
    outline: 3px solid var(--pc-brand-stronger);
    outline-offset: 3px;
}

@media (max-width: 575.98px) {
    .pc-grid {
        gap: 16px;
    }

    .pc-grid > .pc-card:only-child {
        max-width: none;
    }

    .pc-card {
        padding: 20px 18px 18px;
    }

    .pc-card__title {
        font-size: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pc-card,
    .pc-card::before,
    .pc-card__link .bx,
    .pc-card__action {
        transition: none;
    }

    .pc-card:hover,
    .pc-card:focus-within {
        transform: none;
    }

    .pc-card:hover .pc-card__link .bx {
        transform: none;
    }
}
