/**
 * Bohillebrand Kacheln – Styles
 * Schwebende Hinweis-Kacheln mit animiertem Gradient-Rand
 *
 * Designed to match the "Clean Airy" theme of bohillebrand.de
 */

/* ================================================================
   ANIMATED GRADIENT – Keyframes
   ================================================================ */
@keyframes bk-gradient-spin {
    0%   { --bk-angle: 0deg; }
    100% { --bk-angle: 360deg; }
}

/* Shimmer sweep – one full revolution via transform */
@keyframes bk-shimmer-sweep {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ================================================================
   BASE KACHEL
   ================================================================ */
.bk-kachel {
    position: relative;
    display: flex;
    flex-direction: column;
    max-width: 480px;
    margin: 0 auto;
    padding: 3px;    /* space for the gradient border */
    border-radius: 20px;
    text-decoration: none;
    color: inherit;
    transition: transform .3s cubic-bezier(.22,1,.36,1),
                box-shadow .3s cubic-bezier(.22,1,.36,1);
}

.bk-kachel:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(37, 99, 235, .12);
}

/* The animated gradient border glow */
.bk-kachel-glow {
    position: absolute;
    inset: 0;
    border-radius: 20px;
    overflow: hidden;          /* clips the rotating shimmer */
    background: conic-gradient(
        from var(--bk-angle, 0deg),
        var(--blue, #2563eb),
        var(--blue-400, #60a5fa),
        var(--blue-100, #dbeafe),
        var(--blue-400, #60a5fa),
        var(--blue, #2563eb)
    );
    opacity: .45;
    animation: bk-gradient-spin 4s linear infinite;
    transition: opacity .4s ease;
    z-index: 0;
}

/* Hover: brighten the base glow */
.bk-kachel:hover .bk-kachel-glow {
    opacity: 1;
}

/* Shimmer: oversized rotating element with a bright spot,
   clipped by the glow's overflow:hidden + border-radius */
.bk-kachel-glow::after {
    content: '';
    position: absolute;
    inset: -50%;               /* 2× larger to cover corners during rotation */
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent 340deg,
        rgba(255, 255, 255, .35) 350deg,
        rgba(255, 255, 255, .5) 355deg,
        rgba(255, 255, 255, .35) 358deg,
        transparent 360deg
    );
    opacity: 0;
    transition: opacity .4s ease;
}

.bk-kachel:hover .bk-kachel-glow::after {
    opacity: 1;
    animation: bk-shimmer-sweep 1.8s cubic-bezier(.4, 0, .2, 1) forwards;
}

/* Register custom property for base gradient spin */
@property --bk-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* Inner content area */
.bk-kachel-inner {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 17px;
    padding: 1.75rem 2rem;
    flex: 1;           /* fill full height of parent */
    transition: background .45s cubic-bezier(.22,1,.36,1);
}

/* Subtle hover background shift – default (blau) variant */
.bk-kachel:hover .bk-kachel-inner {
    background: var(--gray-50, #f8fafc);
}

/* ================================================================
   BADGE
   ================================================================ */
.bk-badge {
    display: inline-block;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: .3rem .7rem;
    border-radius: var(--radius-full, 100px);
    background: var(--blue, #2563eb);
    color: #fff;
    margin-bottom: .75rem;
}

/* ================================================================
   HEAD (Icon + Title)
   ================================================================ */
.bk-kachel-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
}

.bk-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-50, #eff6ff);
    border-radius: 12px;
    color: var(--blue, #2563eb);
}

.bk-titel {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-900, #0f172a);
    margin: 0;
    line-height: 1.3;
}

/* ================================================================
   TEXT & META
   ================================================================ */
.bk-text {
    font-size: .95rem;
    line-height: 1.7;
    color: var(--gray-500, #64748b);
    margin: 0 0 .75rem;
}

.bk-meta {
    font-size: .8rem;
    color: var(--gray-400, #94a3b8);
    margin: 0 0 1rem;
    font-weight: 500;
}

/* ================================================================
   BUTTON
   ================================================================ */
.bk-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .9rem;
    font-weight: 600;
    color: var(--blue, #2563eb);
    padding: .55rem 1.2rem;
    border-radius: var(--radius-full, 100px);
    background: var(--blue-50, #eff6ff);
    transition: background .2s, color .2s, gap .2s;
}

.bk-kachel:hover .bk-btn {
    background: var(--blue, #2563eb);
    color: #fff;
    gap: .6rem;
}

/* ================================================================
   VARIANT: BLAU (default)
   ================================================================ */
/* Already covered by base styles above */

/* ================================================================
   VARIANT: DUNKEL
   ================================================================ */
.bk-kachel--dunkel .bk-kachel-inner {
    background: var(--blue-900, #1e3a5f);
}

.bk-kachel--dunkel .bk-kachel-glow {
    background: conic-gradient(
        from var(--bk-angle, 0deg),
        var(--blue-400, #60a5fa),
        var(--blue-200, #bfdbfe),
        #fff,
        var(--blue-200, #bfdbfe),
        var(--blue-400, #60a5fa)
    );
}

.bk-kachel--dunkel .bk-titel {
    color: #fff;
}

.bk-kachel--dunkel .bk-text {
    color: rgba(255, 255, 255, .7);
}

.bk-kachel--dunkel .bk-meta {
    color: rgba(255, 255, 255, .45);
}

.bk-kachel--dunkel .bk-icon {
    background: rgba(255, 255, 255, .1);
    color: var(--blue-400, #60a5fa);
}

.bk-kachel--dunkel .bk-badge {
    background: var(--blue-400, #60a5fa);
    color: var(--blue-900, #1e3a5f);
}

.bk-kachel--dunkel .bk-btn {
    background: rgba(255, 255, 255, .1);
    color: var(--blue-400, #60a5fa);
}

.bk-kachel--dunkel:hover .bk-btn {
    background: #fff;
    color: var(--blue-900, #1e3a5f);
}

.bk-kachel--dunkel:hover {
    box-shadow: 0 12px 40px rgba(30, 58, 95, .25);
}

.bk-kachel--dunkel:hover .bk-kachel-inner {
    background: #253d5a;
}

/* ================================================================
   VARIANT: GRADIENT
   ================================================================ */
.bk-kachel--gradient .bk-kachel-glow {
    background: conic-gradient(
        from var(--bk-angle, 0deg),
        #fff,
        var(--blue-200, #bfdbfe),
        #fff,
        var(--blue-200, #bfdbfe),
        #fff
    );
}

.bk-kachel--gradient .bk-kachel-inner {
    background: linear-gradient(135deg, var(--blue, #2563eb), var(--blue-500, #3b82f6), var(--blue-400, #60a5fa));
}

.bk-kachel--gradient .bk-titel {
    color: #fff;
}

.bk-kachel--gradient .bk-text {
    color: rgba(255, 255, 255, .85);
}

.bk-kachel--gradient .bk-meta {
    color: rgba(255, 255, 255, .55);
}

.bk-kachel--gradient .bk-icon {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

.bk-kachel--gradient .bk-badge {
    background: #fff;
    color: var(--blue, #2563eb);
}

.bk-kachel--gradient .bk-btn {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

.bk-kachel--gradient:hover .bk-btn {
    background: #fff;
    color: var(--blue, #2563eb);
}

.bk-kachel--gradient:hover {
    box-shadow: 0 12px 40px rgba(37, 99, 235, .2);
}

.bk-kachel--gradient:hover .bk-kachel-inner {
    background: linear-gradient(135deg, #4b8ced, #6ea8f7, #a3c9fd);
}

/* ================================================================
   VARIANT: DEZENT
   ================================================================ */
.bk-kachel--dezent .bk-kachel-glow {
    background: conic-gradient(
        from var(--bk-angle, 0deg),
        var(--gray-200, #e2e8f0),
        var(--gray-100, #f1f5f9),
        var(--gray-300, #cbd5e1),
        var(--gray-100, #f1f5f9),
        var(--gray-200, #e2e8f0)
    );
    animation-duration: 6s;   /* slower for subtle effect */
}

.bk-kachel--dezent .bk-kachel-inner {
    background: var(--gray-50, #f8fafc);
}

.bk-kachel--dezent .bk-icon {
    background: #fff;
    color: var(--gray-500, #64748b);
}

.bk-kachel--dezent .bk-badge {
    background: var(--gray-200, #e2e8f0);
    color: var(--gray-700, #334155);
}

.bk-kachel--dezent .bk-btn {
    background: #fff;
    color: var(--gray-700, #334155);
}

.bk-kachel--dezent:hover .bk-btn {
    background: var(--gray-700, #334155);
    color: #fff;
}

.bk-kachel--dezent:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, .06);
}

.bk-kachel--dezent:hover .bk-kachel-inner {
    background: var(--gray-100, #f1f5f9);
}

/* ================================================================
   GRID LAYOUT
   ================================================================ */
.bk-grid {
    display: grid;
    gap: 1.5rem;
    max-width: var(--max-width, 1320px);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Hide stray whitespace / wpautop remnants that become anonymous grid items */
.bk-grid > :not(.bk-kachel) {
    display: none;
}

.bk-grid .bk-kachel {
    max-width: none;   /* let grid control width */
    width: 100%;       /* fill grid cell completely */
}

.bk-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bk-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bk-grid--compact {
    gap: 1rem;
}

.bk-grid--compact .bk-kachel-inner {
    padding: 1.25rem 1.5rem;
}

/* ================================================================
   SECTION WRAPPER (for use in front-page.php)
   ================================================================ */
.bk-section {
    padding: 2rem 0;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
    .bk-grid--2,
    .bk-grid--3 {
        grid-template-columns: 1fr;
    }

    .bk-kachel {
        max-width: none;
    }

    .bk-kachel-inner {
        padding: 1.5rem;
    }

    .bk-titel {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .bk-kachel-inner {
        padding: 1.25rem;
    }

    .bk-icon {
        width: 38px;
        height: 38px;
    }

    .bk-icon svg {
        width: 20px;
        height: 20px;
    }
}
