/**
 * YAML Cards Extension CSS
 *
 * Styles for the yaml-card custom fence extension.
 * This file should be included in your mkdocs.yml extra_css section.
 */

/* Grid container for cards */
.yaml-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 1rem 0;
}

/* Responsive: stack cards on smaller screens */
@media screen and (max-width: 76.1875em) {
    .yaml-card-grid {
        grid-template-columns: 1fr;
    }
}

/* Base card styling */
.yaml-card {
    position: relative;
    border: var(--card-border, 1px solid #ccc);
    box-sizing: border-box;
    transition: border-color 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    height: 100%;
}

/* Stretched link for clickable cards */
.card-stretched-link {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
}

/* Chromatic aberration effect - left pseudo-element */
.yaml-card::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 0px;
    right: -2px;
    bottom: -1px;
    border: 1px solid var(--color-shift-l, cyan);
    opacity: 0;
    pointer-events: none;
    mix-blend-mode: multiply;
    transition: opacity 0.05s ease-in-out, left 0.1s ease-in-out, right 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
}

/* Chromatic aberration effect - right pseudo-element */
.yaml-card::after {
    content: "";
    position: absolute;
    top: -1px;
    left: -2px;
    right: 0px;
    bottom: -1px;
    border: 1px solid var(--color-shift-r, magenta);
    opacity: 0;
    pointer-events: none;
    mix-blend-mode: multiply;
    transition: opacity 0.05s ease-in-out, left 0.1s ease-in-out, right 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
}

/* Dark mode blend mode adjustment */
[data-md-color-scheme="slate"] .yaml-card::before,
[data-md-color-scheme="slate"] .yaml-card::after {
    mix-blend-mode: screen;
}

/* Hover state */
.yaml-card:hover {
    box-shadow: inset 1px 0 0 0 var(--color-shift-c, yellow),
                inset -1px 0 0 0 var(--color-shift-c, yellow);
    border-color: var(--color-shift-c, yellow);
}

.yaml-card:hover::before {
    left: 2px;
    right: -4px;
    opacity: 100;
    box-shadow: inset 1px 0 0 0 var(--color-shift-l, cyan),
                inset -1px 0 0 0 var(--color-shift-l, cyan);
}

.yaml-card:hover::after {
    left: -4px;
    right: 2px;
    opacity: 100;
    box-shadow: inset 1px 0 0 0 var(--color-shift-r, magenta),
                inset -1px 0 0 0 var(--color-shift-r, magenta);
}

/* Card header section */
.card-header {
    padding: 0.5em 1em;
    padding-top: 0;
    display: flex;
    flex-direction: column;
}

.card-title {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1.5em 0;
    border-bottom: var(--card-border);
    transition: border-bottom-color 0.1s ease-in-out;
}

/* Chromatic aberration effect for card-title border - left pseudo-element */
.card-title::before {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0px;
    right: -2px;
    height: 0;
    border-bottom: 1px solid var(--color-shift-l, cyan);
    opacity: 0;
    pointer-events: none;
    mix-blend-mode: multiply;
    transition: opacity 0.05s ease-in-out, left 0.1s ease-in-out, right 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
}

/* Chromatic aberration effect for card-title border - right pseudo-element */
.card-title::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: -2px;
    right: 0px;
    height: 0;
    border-bottom: 1px solid var(--color-shift-r, magenta);
    opacity: 0;
    pointer-events: none;
    mix-blend-mode: multiply;
    transition: opacity 0.05s ease-in-out, left 0.1s ease-in-out, right 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
}

/* Dark mode blend mode adjustment */
[data-md-color-scheme="slate"] .card-title::before,
[data-md-color-scheme="slate"] .card-title::after {
    mix-blend-mode: screen;
}

/* Activate on card hover */
.yaml-card:hover .card-title {
    border-bottom-color: var(--color-shift-c, yellow);
}

.yaml-card:hover .card-title::before {
    left: 2px;
    right: -4px;
    opacity: 100;
    box-shadow: inset 0 -1px 0 0 var(--color-shift-l, cyan);
}

.yaml-card:hover .card-title::after {
    left: -4px;
    right: 2px;
    opacity: 100;
    box-shadow: inset 0 -1px 0 0 var(--color-shift-r, magenta);
}

/* Wrapper for dual-mode icons to prevent flex gap changes */
.card-title-icon-wrapper {
    position: relative;
    flex-shrink: 0;
    display: inline-block;
    width: 24px;
    height: 24px;
}

.card-title-icon-wrapper .card-title-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.card-title-icon {
    flex-shrink: 0;
    margin: 0;
    width: 24px;
}

/* Light mode: show light icon, hide dark icon */
[data-md-color-scheme="default"] .card-title-icon-light {
    display: block;
}

[data-md-color-scheme="default"] .card-title-icon-dark {
    display: none;
}

/* Dark mode: hide light icon, show dark icon */
[data-md-color-scheme="slate"] .card-title-icon-light {
    display: none;
}

[data-md-color-scheme="slate"] .card-title-icon-dark {
    display: block;
}

.card-title-text {
    font-weight: bold;
    font-size: 12pt;
    line-height: normal;
}

/* Card body section */
.card-body {
    flex: 1;
    padding: 1em;
    display: flex;
    flex-direction: column;
}

.card-body > p:first-child {
    margin-top: 0;
}

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

/* Card footer section */
.card-footer {
    margin-top: auto;
    padding: 1em;
    display: flex;
    flex-direction: column;
}

.card-footer > p {
    margin: 0;
}

/* Footer links need higher z-index to be clickable over stretched link */
.card-footer a {
    position: relative;
    z-index: 2;
}

/* Horizontal alignment */
.align-h-left {
    text-align: left;
}

.align-h-center {
    text-align: center;
}

.align-h-right {
    text-align: right;
}

/* Vertical alignment */
.align-v-top {
    justify-content: flex-start;
}

.align-v-middle {
    justify-content: center;
}

.align-v-bottom {
    justify-content: flex-end;
}

/* Error message styling */
.yaml-card-error {
    background-color: #ff000020;
    border: 1px solid #ff0000;
    padding: 1rem;
    border-radius: 4px;
    color: #ff0000;
    font-family: monospace;
}
