/* AnchorCard + CardGrid. Specs: component-specs/{anchor-card,card-grid}.md */

/* ---------- CardGrid ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns, 3), minmax(0, 1fr));
    gap: 16px;
}

@media (width <= 800px) {
    .card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (width <= 540px) {
    .card-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- AnchorCard ---------- */
.anchor-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--surface-raised);
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    transition:
        background-color 0.15s ease,
        box-shadow 0.15s ease;
}

/* Dark (default): hover lifts the raised card one more step toward light. */
.anchor-card:hover {
    background: var(--stone-850);
}

/* Light: white cards float on the soft shadow + faintest stroke. */
[data-theme='light'] .anchor-card {
    box-shadow: var(--shadow-sm);
    border-color: #00000008;
}

[data-theme='light'] .anchor-card:hover {
    background: var(--surface-raised);
    box-shadow: var(--shadow-md);
}

.anchor-card-external-mark {
    position: absolute;
    top: 16px;
    right: 16px;
    color: var(--text-quaternary);
    transition: color 0.15s ease;
}

.anchor-card:hover .anchor-card-external-mark {
    color: var(--text-secondary);
}

.anchor-card-cover {
    display: block;
    width: 100%;
    height: auto;
    border-bottom: var(--border-hairline) solid var(--border-default);
}

.anchor-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 20px;
}

.anchor-card-icon {
    color: var(--color-accent);
    margin-bottom: 2.5rem;
}

.anchor-card-body .anchor-card-title {
    font: var(--font-weight-medium) var(--text-regular-size) / var(--text-regular-line-height) var(--font-family-sans);
    letter-spacing: normal;
    color: var(--text-primary);
    margin: 0;
    text-wrap: balance;
}

.anchor-card-body .anchor-card-description {
    margin: 8px 0 0;
    font-size: var(--text-small-size);
    line-height: var(--text-small-line-height);
    color: var(--text-tertiary);
    min-height: calc(var(--text-small-line-height) * 3 * 1em);
    text-wrap: pretty;
}

/* Illustration stage — inset rounded panel above the body; the engine scene's
 * first rect carries the panel tone and dissolves into the card on hover
 * (in step with the card's own fade). Light drops the panel entirely. */
.anchor-card-mark-stage {
    position: relative;
    overflow: hidden;
    padding: 20px 20px 0;

    --gd-field-pad: 8px;
    --gd-field-bg: var(--stone-875);
    --gd-field-dot: transparent;
}

.anchor-card-mark-stage svg > rect:first-child {
    fill: var(--card-scene-panel, var(--stone-875));
    transition: fill 0.15s ease;
}

.anchor-card:hover .anchor-card-mark-stage {
    --card-scene-panel: transparent;
}

.anchor-card:hover .anchor-card-mark-stage svg > rect:first-child {
    transition-duration: 0s;
}

.anchor-card-mark-stage figure {
    margin: 0;
}

[data-theme='light'] .anchor-card-mark-stage {
    --gd-field-bg: var(--stone-150);
    --card-scene-panel: transparent;
    --card-tint-bg: var(--teal-200);
}
