/*
 * kg-cards.css
 * ─────────────────────────────────────────────────────────────────────────────
 * Required Koenig (Ghost editor) card CSS classes.
 * Ghost's theme validator (gscan) requires these classes to be present in the
 * theme's CSS files so that editor cards render correctly in posts and pages.
 * ─────────────────────────────────────────────────────────────────────────────
 */

/* ── Image width modifiers ── */
.kg-width-wide {
    position: relative;
    width: 85vw;
    min-width: 100%;
    margin: auto calc(50% - 50vw);
    transform: translateX(calc(50vw - 50%));
}

.kg-width-full {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

/* ── Alignment helpers ── */
.kg-align-left {
    text-align: left;
}

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

/* ── Gallery card ── */
.kg-gallery-container {
    display: flex;
    flex-direction: column;
    max-width: 1040px;
    width: 100%;
}

.kg-gallery-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 4px;
    margin-bottom: 4px;
}

.kg-gallery-image {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.kg-gallery-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Bookmark card ── */
.kg-bookmark-card {
    width: 100%;
    margin: 0 0 1.5em;
}

.kg-bookmark-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-height: 148px;
    border: 1px solid var(--border-color, rgba(0,0,0,.15));
    border-radius: 4px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.kg-bookmark-container:hover {
    opacity: 0.85;
}

.kg-bookmark-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 20px;
}

.kg-bookmark-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 6px;
    color: var(--text-color, inherit);
}

.kg-bookmark-description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 0.875rem;
    line-height: 1.5;
    opacity: 0.75;
    margin-bottom: 12px;
}

.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    opacity: 0.6;
    flex-wrap: wrap;
}

.kg-bookmark-icon {
    width: 20px;
    height: 20px;
    object-fit: cover;
    flex-shrink: 0;
}

.kg-bookmark-author {
    font-weight: 500;
}

.kg-bookmark-publisher {
    opacity: 0.75;
}

.kg-bookmark-thumbnail {
    position: relative;
    min-width: 33%;
    max-width: 33%;
    flex-shrink: 0;
}

.kg-bookmark-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 600px) {
    .kg-bookmark-container {
        flex-direction: column;
    }
    .kg-bookmark-thumbnail {
        min-width: 100%;
        max-width: 100%;
        min-height: 160px;
    }
}

/* ── Callout card ── */
.kg-callout-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 28px;
    border-radius: 4px;
    margin: 0 0 1.5em;
}

.kg-callout-card-grey   { background: rgba(128,128,128,.12); }
.kg-callout-card-white  { background: #fff; border: 1px solid var(--border-color, rgba(0,0,0,.15)); }
.kg-callout-card-blue   { background: rgba(59,130,246,.12); }
.kg-callout-card-green  { background: rgba(34,197,94,.12); }
.kg-callout-card-yellow { background: rgba(234,179,8,.12); }
.kg-callout-card-red    { background: rgba(239,68,68,.12); }
.kg-callout-card-pink   { background: rgba(236,72,153,.12); }
.kg-callout-card-purple { background: rgba(168,85,247,.12); }
.kg-callout-card-accent { background: var(--ghost-accent-color, rgba(0,0,0,.08)); }

.kg-callout-emoji {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.kg-callout-text {
    flex: 1;
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* ── Toggle card ── */
.kg-toggle-card {
    border: 1px solid var(--border-color, rgba(0,0,0,.15));
    border-radius: 4px;
    margin: 0 0 1.5em;
    overflow: hidden;
}

.kg-toggle-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
}

.kg-toggle-heading-text {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    flex: 1;
}

.kg-toggle-card-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.kg-toggle-card[open] .kg-toggle-card-icon {
    transform: rotate(180deg);
}

.kg-toggle-content {
    padding: 0 20px 16px;
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* ── Audio card ── */
.kg-audio-card {
    border: 1px solid var(--border-color, rgba(0,0,0,.15));
    border-radius: 4px;
    padding: 16px;
    margin: 0 0 1.5em;
    display: flex;
    align-items: center;
    gap: 16px;
}

.kg-audio-thumbnail {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    object-fit: cover;
}

.kg-audio-thumbnail.placeholder {
    background: var(--surface, rgba(0,0,0,.06));
    display: flex;
    align-items: center;
    justify-content: center;
}

.kg-audio-player-container {
    flex: 1;
    min-width: 0;
}

.kg-audio-title {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kg-audio-player {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kg-audio-current-time,
.kg-audio-duration {
    font-size: 0.75rem;
    opacity: 0.6;
    white-space: nowrap;
    flex-shrink: 0;
}

.kg-audio-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    opacity: 0.6;
}

.kg-audio-play-icon,
.kg-audio-pause-icon {
    width: 32px;
    height: 32px;
    cursor: pointer;
    flex-shrink: 0;
}

.kg-audio-mute-icon,
.kg-audio-unmute-icon {
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.kg-audio-seek-slider,
.kg-audio-volume-slider {
    flex: 1;
    min-width: 0;
    height: 4px;
    cursor: pointer;
    accent-color: var(--text-color, currentColor);
}

.kg-audio-playback-rate {
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Button card ── */
.kg-button-card {
    display: flex;
    justify-content: center;
    margin: 0 0 1.5em;
}

.kg-button-card.kg-align-left {
    justify-content: flex-start;
}

.kg-button-card.kg-align-center {
    justify-content: center;
}

.kg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 2px solid var(--text-color, currentColor);
    color: var(--text-color, currentColor);
    background: transparent;
    transition: opacity 0.2s ease;
}

.kg-btn:hover {
    opacity: 0.8;
}

.kg-btn-accent {
    background: var(--ghost-accent-color, #000);
    color: #fff;
    border-color: var(--ghost-accent-color, #000);
}

/* ── Product card ── */
.kg-product-card {
    border: 1px solid var(--border-color, rgba(0,0,0,.15));
    border-radius: 4px;
    padding: 24px;
    margin: 0 0 1.5em;
}

.kg-product-card-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kg-product-card-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 4px;
}

.kg-product-card-title-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.kg-product-card-title {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.3;
}

.kg-product-card-rating {
    display: flex;
    align-items: center;
    gap: 2px;
}

.kg-product-card-rating-star {
    width: 18px;
    height: 18px;
    opacity: 0.3;
}

.kg-product-card-rating-active {
    opacity: 1;
}

.kg-product-card-description {
    font-size: 0.9375rem;
    line-height: 1.6;
    opacity: 0.8;
}

.kg-product-card-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    background: var(--text-color, #000);
    color: var(--background-color, #fff);
    transition: opacity 0.2s ease;
    align-self: flex-start;
}

.kg-product-card-button:hover {
    opacity: 0.8;
}

.kg-product-card-btn-accent {
    background: var(--ghost-accent-color, #000);
    color: #fff;
}

/* ── File card ── */
.kg-file-card {
    border: 1px solid var(--border-color, rgba(0,0,0,.15));
    border-radius: 4px;
    margin: 0 0 1.5em;
}

.kg-file-card-container {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    text-decoration: none;
    color: inherit;
}

.kg-file-card-container:hover {
    opacity: 0.85;
}

.kg-file-card-contents {
    flex: 1;
    min-width: 0;
}

.kg-file-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kg-file-card-caption {
    font-size: 0.8125rem;
    opacity: 0.6;
    margin-top: 2px;
}

.kg-file-card-filename {
    font-size: 0.8125rem;
    opacity: 0.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kg-file-card-filesize {
    font-size: 0.75rem;
    opacity: 0.5;
    flex-shrink: 0;
}

.kg-file-card-medium {
    padding: 20px 24px;
}

.kg-file-card-small {
    padding: 12px 16px;
}

/* ── Blockquote alt ── */
.kg-blockquote-alt {
    border-left: 4px solid var(--ghost-accent-color, var(--text-color, currentColor));
    padding: 4px 0 4px 20px;
    font-style: italic;
    font-size: 1.0625rem;
    line-height: 1.7;
    opacity: 0.9;
    margin: 0 0 1.5em;
}
