/* Card Component Styles */

/* ========================================================================
   CSS Custom Properties
   ======================================================================== */
:root {
    /* Card colors */
    --card-bg: #ffffff;
    --card-color: #333333;
    --card-border-color: #e0e0e0;
    --card-hover-bg: #f8f9fa;
    --card-hover-border-color: #006366;

    /* Number badge */
    --card-number-bg: #006366;
    --card-number-color: #ffffff;
    --card-number-size: 36px;

    /* Heading */
    --card-heading-color: #1a1a1a;
    --card-heading-size: 1.125rem;

    /* Icon */
    --card-icon-color: #006366;
    --card-icon-size: 48px;

    /* Layout */
    --card-padding: 1.5rem;
    --card-gap: 1.25rem;
    --card-border-radius: 8px;

    /* Shadows */
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.12);

    /* Animation */
    --card-transition: all 0.3s ease;

    /* Accessibility */
    --card-focus-color: #0066cc;

    /* Banner */
    --card-banner-bg: #003366;
    --card-banner-color: #ffffff;

    /* Footer */
    --card-footer-bg: #003366;
    --card-footer-color: #ffd700;
}

/* ========================================================================
   Theme: HCCC Primary (Teal)
   ======================================================================== */
.card-component--hccc-primary {
    --card-number-bg: #006366;
    --card-number-color: #ffffff;
    --card-border-color: #b2dfdb;
    --card-hover-border-color: #006366;
    --card-heading-color: #004d40;
    --card-icon-color: #006366;
}

/* ========================================================================
   Theme: HCCC Secondary (Blue)
   ======================================================================== */
.card-component--hccc-secondary {
    --card-number-bg: #003366;
    --card-number-color: #ffffff;
    --card-border-color: #b3cce6;
    --card-hover-border-color: #003366;
    --card-heading-color: #002244;
    --card-icon-color: #003366;
}

/* ========================================================================
   Theme: HCCC Accent (Teal cards with yellow accent)
   ======================================================================== */
.card-component--hccc-accent {
    --card-bg: #006366;
    --card-color: #ffffff;
    --card-border-color: #00393D;
    --card-hover-bg: #00393D;
    --card-hover-border-color: #ffd700;
    --card-number-bg: #ffd700;
    --card-number-color: #1a1a1a;
    --card-heading-color: #ffffff;
    --card-icon-color: #ffd700;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* ========================================================================
   Theme: AISGC — Matches the HCCC Responsible AI Guiding Principles flyer
   ======================================================================== */
.card-component--aisgc {
    --card-bg: #ffffff;
    --card-color: #333333;
    --card-border-color: transparent;
    --card-hover-bg: #f5f7f7;
    --card-hover-border-color: #008278;
    --card-heading-color: #008278;
    --card-heading-size: 1rem;
    --card-icon-color: #008278;
    --card-number-bg: #008278;
    --card-number-color: #ffffff;
    --card-padding: 1.25rem 2rem;
    --card-gap: 0;
    --card-shadow: none;
    --card-shadow-hover: none;
    --card-banner-bg: #001e85;
    --card-banner-color: #ffffff;
    --card-footer-bg: #001e85;
    --card-footer-color: #ffd700;
}

/* ========================================================================
   Component Container
   ======================================================================== */
.card-component {
    margin: 0;
}

/* Section Heading */
.card-component__header {
    margin-bottom: 1.5rem;
}

.card-component__header .section__header {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 0.5rem 0;
}

/* ========================================================================
   Banner Header
   ======================================================================== */
.card-component__banner {
    background-color: var(--card-banner-bg);
    color: var(--card-banner-color);
    padding: 2.5rem 2rem;
    position: relative;
    overflow: hidden;
}

/* Banner background illustration (positioned right) */
.card-component__banner-bg {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: auto;
    max-width: 50%;
    object-fit: contain;
    object-position: right center;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

/* Banner logo (positioned top-right) */
.card-component__banner-logo {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    height: 70px;
    width: auto;
    z-index: 1;
}

.card-component__banner-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--card-banner-color);
    margin: 0;
    line-height: 1.15;
    position: relative;
    z-index: 1;
    max-width: 65%;
}

@media (min-width: 768px) {
    .card-component__banner {
        padding: 3rem 2.5rem;
    }

    .card-component__banner-title {
        font-size: 2.5rem;
    }

    .card-component__banner-logo {
        height: 80px;
    }

    .card-component__banner-bg {
        max-width: 45%;
        opacity: 0.12;
    }
}

@media (min-width: 1024px) {
    .card-component__banner {
        padding: 3.5rem 3rem;
    }

    .card-component__banner-title {
        font-size: 3rem;
        max-width: 60%;
    }

    .card-component__banner-logo {
        height: 90px;
        right: 3rem;
    }

    .card-component__banner-bg {
        max-width: 40%;
    }
}

/* ========================================================================
   Intro Section
   ======================================================================== */
.card-component__intro {
    padding: 1.5rem 2rem;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: #333333;
    background-color: #ffffff;
}

.card-component__intro p {
    margin: 0 0 1rem 0;
}

.card-component__intro p:last-child {
    margin-bottom: 0;
}

/* ========================================================================
   Footer Section
   ======================================================================== */
.card-component__footer {
    background-color: var(--card-footer-bg);
    color: var(--card-footer-color);
    padding: 1rem 2rem;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.5;
}

.card-component__footer p {
    margin: 0;
}

/* ========================================================================
   Grid Layout
   ======================================================================== */
.card-grid {
    display: grid;
    gap: var(--card-gap);
    grid-template-columns: 1fr;
    align-items: start;
}

/* Tablet (768px+) */
@media (min-width: 768px) {
    .card-grid--grid-2,
    .card-grid--grid-3,
    .card-grid--grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .card-grid--grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .card-grid--grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================================================
   List Layout — Single column with icon on left
   ======================================================================== */
.card-grid--list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.card-grid--list .card-item {
    flex-direction: row;
    align-items: flex-start;
    gap: 1.25rem;
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: 1px solid var(--card-border-color);
    border-radius: 0;
    box-shadow: none;
}

.card-grid--list .card-item:last-child {
    border-bottom: none;
}

/* List layout title styling */
.card-grid--list .card-item__title {
    text-transform: uppercase;
    font-weight: 700;
    font-size: var(--card-heading-size);
    letter-spacing: 0.02em;
}

/* ========================================================================
   Card Item
   ======================================================================== */
.card-item {
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg);
    color: var(--card-color);
    border: 1px solid var(--card-border-color);
    padding: var(--card-padding);
    transition: var(--card-transition);
    position: relative;
    box-sizing: border-box;
}

/* Linked card styles */
a.card-item {
    text-decoration: none;
    color: var(--card-color);
    cursor: pointer;
}

a.card-item:hover {
    background-color: var(--card-hover-bg);
    border-color: var(--card-hover-border-color);
    transform: translateY(-2px);
}

/* List layout: no hover transform */
.card-grid--list a.card-item:hover {
    transform: none;
}

/* ========================================================================
   Card Item Body (wrapper for header + description)
   ======================================================================== */
.card-item__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

/* ========================================================================
   Card Item Icon
   ======================================================================== */
.card-item__icon {
    width: var(--card-icon-size);
    height: var(--card-icon-size);
    min-width: var(--card-icon-size);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--card-icon-color);
    font-size: 1.5rem;
    line-height: 1;
}

/* SVG icons inside the icon container */
.card-item__icon svg {
    width: 100%;
    height: 100%;
    fill: var(--card-icon-color);
    display: block;
}

/* FontAwesome icons sizing */
.card-item__icon i {
    font-size: 1.75rem;
    color: var(--card-icon-color);
}

/* Grid layouts: icon above body */
.card-grid:not(.card-grid--list) .card-item__icon {
    margin-bottom: 0.75rem;
}

/* ========================================================================
   Shape Modifiers
   ======================================================================== */
.card-component--shape-rounded .card-item {
    border-radius: var(--card-border-radius);
}

.card-component--shape-square .card-item {
    border-radius: 0;
}

.card-component--shape-soft .card-item {
    border-radius: 16px;
}

.card-component--shape-pill .card-item {
    border-radius: 24px;
}

/* List layout overrides shape to square */
.card-grid--list .card-item {
    border-radius: 0;
}

/* ========================================================================
   Shadow Modifiers
   ======================================================================== */
.card-component--shadow-none .card-item {
    box-shadow: none;
}

.card-component--shadow-none a.card-item:hover {
    box-shadow: none;
}

.card-component--shadow-subtle .card-item {
    box-shadow: var(--card-shadow);
}

.card-component--shadow-subtle a.card-item:hover {
    box-shadow: var(--card-shadow-hover);
}

.card-component--shadow-medium .card-item {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.card-component--shadow-medium a.card-item:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.card-component--shadow-strong .card-item {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
}

.card-component--shadow-strong a.card-item:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
}

/* ========================================================================
   Card Header (Number + Title inline)
   ======================================================================== */
.card-item__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

/* ========================================================================
   Numbered Badge
   ======================================================================== */
.card-item__number {
    width: var(--card-number-size);
    height: var(--card-number-size);
    min-width: var(--card-number-size);
    background-color: var(--card-number-bg);
    color: var(--card-number-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
}

/* ========================================================================
   Card Title
   ======================================================================== */
.card-item__title {
    font-size: var(--card-heading-size);
    font-weight: 600;
    color: var(--card-heading-color);
    margin: 0;
    line-height: 1.3;
}

a.card-item .card-item__title {
    color: var(--card-heading-color);
}

a.card-item:hover .card-item__title {
    color: var(--card-hover-border-color);
}

/* ========================================================================
   Card Description
   ======================================================================== */
.card-item__description {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--card-color);
    flex-grow: 1;
    margin: 0;
}

/* ========================================================================
   Link Indicator (external)
   ======================================================================== */
.card-item__link-indicator {
    margin-top: 1rem;
    font-size: 0.75rem;
    opacity: 0.6;
    transition: var(--card-transition);
}

a.card-item:hover .card-item__link-indicator {
    opacity: 1;
}

/* ========================================================================
   Accessibility
   ======================================================================== */

/* Focus indicators */
a.card-item:focus {
    outline: 2px solid var(--card-focus-color);
    outline-offset: 2px;
}

a.card-item:focus:not(:focus-visible) {
    outline: none;
}

a.card-item:focus-visible {
    outline: 2px solid var(--card-focus-color);
    outline-offset: 2px;
}

/* High contrast support */
@media (prefers-contrast: high) {
    .card-item {
        border: 2px solid currentColor;
    }

    .card-item__number {
        border: 2px solid currentColor;
    }

    .card-item__icon svg {
        fill: currentColor;
    }

    .card-item__icon i {
        color: currentColor;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .card-item {
        transition: none;
    }

    a.card-item:hover {
        transform: none;
    }

    .card-item__link-indicator {
        transition: none;
    }
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================================================
   HCCC Accent Theme Overrides
   ======================================================================== */
.card-component--hccc-accent .card-item__description {
    color: rgba(255, 255, 255, 0.9);
}

.card-component--hccc-accent a.card-item:hover .card-item__title {
    color: #ffd700;
}

.card-component--hccc-accent a.card-item:focus {
    outline-color: #ffd700;
}

.card-component--hccc-accent .card-item__link-indicator {
    color: #ffd700;
}

/* ========================================================================
   AISGC Theme Overrides
   ======================================================================== */

/* AISGC component — white background, full-bleed, no borders */
.card-component--aisgc {
    background-color: #ffffff;
    /* Mobile full-bleed: matches CMS container */
    margin: 0 -35px 0 -15px;
}

@media (min-width: 768px) {
    .card-component--aisgc {
        /* Tablet full-bleed */
        margin: 0 -15px;
    }
}

@media (min-width: 1024px) {
    .card-component--aisgc {
        /* Desktop full-bleed: asymmetric to match CMS container */
        margin: 0 -55px 0 -52px;
    }
}

/* AISGC Banner — solid dark navy with angled bottom */
.card-component--aisgc .card-component__banner {
    padding: 2rem 2rem 6rem;
    min-height: 140px;
    background: #001e85;
    border: 0;
    outline: 0;
    box-shadow: none;
    overflow: visible;
}

/* Angled bottom edge — white wedge overlays the bottom-right corner */
.card-component--aisgc .card-component__banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: #ffffff;
    clip-path: polygon(0 100%, 100% 0, 100% 100%);
    z-index: 2;
}

@media (min-width: 768px) {
    .card-component--aisgc .card-component__banner {
        padding: 2.5rem 2.5rem 6rem;
        min-height: 160px;
    }
}

@media (min-width: 1024px) {
    .card-component--aisgc .card-component__banner {
        padding: 3rem 3rem 7rem;
    }
}

/* AISGC list layout item styling — force all borders off */
.card-component--aisgc .card-item {
    border: 0;
    box-shadow: none;
}

.card-component--aisgc .card-grid--list .card-item {
    padding: 1.25rem 2rem;
    background-color: #ffffff;
}

.card-component--aisgc .card-grid--list .card-item:nth-child(odd) {
    background-color: #fafbfb;
}

.card-component--aisgc .card-grid--list .card-item__title {
    color: #008278;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9375rem;
    letter-spacing: 0.03em;
    margin-bottom: 0.125rem;
}

.card-component--aisgc .card-grid--list .card-item__description {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #333333;
}

.card-component--aisgc .card-item__icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
}

.card-component--aisgc .card-item__icon svg {
    fill: #008278;
}

/* AISGC intro styling */
.card-component--aisgc .card-component__intro {
    padding: 1.75rem 2rem;
    font-size: 0.875rem;
    line-height: 1.7;
    color: #333333;
    background-color: #ffffff;
    border: none;
}

/* AISGC footer styling */
.card-component--aisgc .card-component__footer {
    background-color: #1d2974;
    color: #ffd700;
    padding: 0.875rem 2rem;
    font-size: 0.8125rem;
    font-weight: 600;
}

/* ========================================================================
   Accordion Card
   ======================================================================== */

/* Accordion card keeps equal height with siblings; content overlays below */
.card-item--accordion {
    overflow: visible;
}

.card-item__summary {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    list-style: none;
    position: relative;
    padding-right: 2rem;
}

.card-item__summary::-webkit-details-marker {
    display: none;
}

.card-item__summary::marker {
    display: none;
    content: '';
}

/* List layout: accordion stacks vertically, summary stays horizontal */
.card-grid--list .card-item.card-item--accordion {
    flex-direction: column;
    align-items: stretch;
}

.card-grid--list .card-item__summary {
    flex-direction: row;
    align-items: flex-start;
    gap: 1.25rem;
}

/* Accordion toggle chevron */
.card-item__accordion-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--card-icon-color);
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.card-item--accordion[open] .card-item__accordion-toggle {
    transform: rotate(180deg);
}

/* Accordion expanded content */
.card-item__accordion-content {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--card-border-color);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--card-color);
}

.card-item__accordion-content p {
    margin: 0 0 0.75rem 0;
}

.card-item__accordion-content p:last-child {
    margin-bottom: 0;
}

/* List layout: indent content to align with body text */
.card-grid--list .card-item__accordion-content {
    margin-left: calc(var(--card-icon-size) + 1.25rem);
}

/* Accordion focus styles */
.card-item__summary:focus {
    outline: 2px solid var(--card-focus-color);
    outline-offset: 2px;
}

.card-item__summary:focus:not(:focus-visible) {
    outline: none;
}

.card-item__summary:focus-visible {
    outline: 2px solid var(--card-focus-color);
    outline-offset: 2px;
}

/* Accordion: reduced motion */
@media (prefers-reduced-motion: reduce) {
    .card-item__accordion-toggle {
        transition: none;
    }
}

/* Accordion: high contrast */
@media (prefers-contrast: high) {
    .card-item__accordion-content {
        border-top: 2px solid currentColor;
    }
}

/* Accordion: AISGC theme override (border visible despite transparent theme border) */
.card-component--aisgc .card-item__accordion-content {
    border-top-color: #e0e0e0;
}

/* ========================================================================
   Print Styles
   ======================================================================== */
@media print {
    .card-component {
        margin: 1rem 0;
    }

    .card-grid {
        display: block;
    }

    .card-item {
        border: 1px solid #ccc;
        margin-bottom: 0.5rem;
        padding: 0.75rem;
        page-break-inside: avoid;
        box-shadow: none;
    }

    a.card-item::after {
        content: " (" attr(href) ")";
        font-size: 0.75rem;
        color: #666;
    }

    .card-item__number {
        width: 24px;
        height: 24px;
        min-width: 24px;
        font-size: 0.75rem;
        background: #333;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .card-item__icon svg {
        fill: #333;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .card-item__link-indicator {
        display: none;
    }

    .card-component__banner {
        background: #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .card-component__footer {
        background: #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .card-item__accordion-toggle {
        display: none;
    }

    .card-item--accordion .card-item__accordion-content {
        display: block !important;
    }
}
