:root {
    --primary-teal: #2a9d8f;
    --dark-teal: #264653;
}

.drb-topics-section {
    background: #ffffff;
    color: #374151;
    padding: 0rem 0rem;
}

.drb-topics-section h2 {
    color: var(--primary-teal);
    margin-bottom: 0.5rem;
    text-align: center;
    font-size: 2.8rem;
    font-weight: 800;
}

.drb-topics-section .section-description {
    text-align: center;
    color: #64748b;
    margin-bottom: 4rem;
    font-size: 1.15rem;
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.8;
}

.drb-topics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    max-width: 1700px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .drb-topics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 992px) {
    .drb-topics-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
        padding: 0;
    }
}

.drb-topic-link {
    text-decoration: none;
    color: inherit;
}

.drb-topic-card {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.4s ease;
    cursor: pointer;
    position: relative;
    border: 1px solid rgba(38, 70, 83, 0.12);
    height: auto;
    min-height: 420px;
}

@media (min-width: 768px) {
    .drb-topic-card {
        min-height: 520px;
    }
}

@media (min-width: 992px) {
    .drb-topic-card {
        min-height: 600px;
    }
}

@media (min-width: 1200px) {
    .drb-topic-card {
        min-height: 650px;
    }
}

.drb-topic-card:hover {
    box-shadow: 0 18px 42px rgba(42, 157, 143, 0.22);
    transform: translateY(-6px) scale(1.01);
}

.drb-topic-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: none;
    transform: none;
    transform-style: flat;
}

.drb-topic-card:hover .drb-topic-card-inner {
    transform: none;
}

.drb-topic-card-front,
.drb-topic-card-back {
    position: static;
    width: 100%;
    height: auto;
    backface-visibility: initial;
}

/* Card Design */
.drb-topic-card-front {
    background: #ffffff;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    min-height: 420px;
    width: 100%;
    opacity: 1;
    transition: opacity 0.25s ease;
    will-change: opacity;
}

@media (min-width: 768px) {
    .drb-topic-card-front {
        min-height: 520px;
    }
}

@media (min-width: 992px) {
    .drb-topic-card-front {
        min-height: 600px;
    }
}

@media (min-width: 1200px) {
    .drb-topic-card-front {
        min-height: 650px;
    }
}

.drb-topic-card-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-image: inherit;
    filter: brightness(0.9);
}

.drb-topic-card-front::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 60% at 50% -20%, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0) 60%),
                linear-gradient(to top, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0) 40%);
    pointer-events: none;
}

.drb-topic-card-front .topic-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(38, 70, 83, 0.98) 0%, rgba(38, 70, 83, 0.85) 100%);
    color: #ffffff;
    padding: 1.75rem 1.5rem;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0;
    text-align: center;
    z-index: 2;
    letter-spacing: 0.3px;
}

/* Back Card - Expandable details */
.drb-topic-card-back {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    box-shadow: inset 0 0 0 3px var(--primary-teal);
    padding: 2.25rem;
    min-height: 420px;
    height: auto;

    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    will-change: opacity, transform;
    z-index: 3;
    pointer-events: none;
}

@media (min-width: 768px) {
    .drb-topic-card-back {
        padding: 2.75rem;
        gap: 0.875rem;
        min-height: 520px;
    }
}

@media (min-width: 992px) {
    .drb-topic-card-back {
        padding: 3rem;
        gap: 1rem;
        min-height: 600px;
    }
}

@media (min-width: 1200px) {
    .drb-topic-card-back {
        padding: 3.5rem;
        gap: 1.125rem;
        min-height: 650px;
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .drb-topic-card-back {
        padding: 1.5rem;
        gap: 0.875rem;
        justify-content: flex-start;
    }
}

.drb-topic-card:hover .drb-topic-card-back,
.drb-topic-card:focus .drb-topic-card-back,
.drb-topic-card:focus-within .drb-topic-card-back,
.drb-topic-card.expanded .drb-topic-card-back,
.drb-topic-card-back.show-more {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 0s;
}

.drb-topic-card:hover .drb-topic-card-front,
.drb-topic-card:focus .drb-topic-card-front,
.drb-topic-card:focus-within .drb-topic-card-front,
.drb-topic-card.expanded .drb-topic-card-front {
    opacity: 0;
    pointer-events: none;
}

/* Title removed from back card for more space */
.drb-topic-card-back h4 {
    display: none;
}

.drb-topic-card-back p {
    color: #1a1a1a;
    font-size: 1.125rem;
    line-height: 1.7;
    margin: 0;
    text-align: left;
    flex: 1 0 auto;
    overflow: visible;
    display: block;
    font-family: 'Montserrat', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 500;
}

@media (max-width: 768px) {
    .drb-topic-card-back p {
        font-size: 1.05rem;
        line-height: 1.65;
        font-weight: 500;
    }
}

@media (min-width: 992px) {
    .drb-topic-card-back p {
        font-size: 1.15rem;
        line-height: 1.75;
    }
}

.drb-topic-card-back .btn {
    background: var(--primary-teal);
    color: #ffffff;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(42, 157, 143, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0;
    align-self: flex-start;
    flex-shrink: 0;
    flex-grow: 0;
    display: inline-block;
}

.drb-topic-card-back .btn:hover {
    background: var(--dark-teal);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(42, 157, 143, 0.4);
}

/* More/Less toggle removed - full description now shown */

/* show-more class no longer needed */

/* Mobile Adjustments */
@media (max-width: 767px) {
    .drb-topics-section {
        padding: 2rem 0;
    }

    .drb-topics-grid {
        gap: 1.5rem;
        padding: 0 1.5rem;
        max-width: 500px;
        margin: 0 auto;
    }

    /* Mobile card sizing */
    .drb-topic-card {
        max-width: 450px;
        margin: 0 auto;
        width: 100%;
    }

    .drb-topic-card-inner {
        min-height: 320px;
    }

    .drb-topic-card-front {
        min-height: 320px;
        opacity: 1;
        pointer-events: auto;
    }

    /* Front visible by default on mobile; back shown on tap */
    .drb-topic-card-back {
        opacity: 0;
        pointer-events: none;
        transform: translateY(10px);
        min-height: 320px;
    }

    .drb-topics-section h2 {
        font-size: 2.2rem;
        padding: 0 1.5rem;
    }

    .drb-topics-section .section-description {
        font-size: 1.05rem;
        padding: 0 1.5rem;
        margin-bottom: 2rem;
    }
}

/* Medium mobile devices (481px - 600px) - like Pixel 5, Galaxy S20 */
@media (min-width: 481px) and (max-width: 600px) {
    .drb-topics-section {
        padding: 2rem 0;
    }

    .drb-topics-grid {
        gap: 1.5rem;
        padding: 0 1.5rem;
        max-width: 480px;
        margin: 0 auto;
    }

    .drb-topic-card {
        max-width: 420px;
        width: 100%;
        margin: 0 auto;
    }

    .drb-topic-card-inner {
        min-height: 340px;
    }

    .drb-topic-card-front {
        min-height: 340px;
    }

    .drb-topic-card-back {
        min-height: 340px;
        padding: 1.5rem;
        gap: 0.875rem;
    }

    .drb-topic-card-back p {
        font-size: 1rem;
        line-height: 1.65;
    }

    .drb-topic-card-back .btn {
        padding: 0.8rem 1.75rem;
        font-size: 0.9rem;
    }

    .drb-topics-section h2 {
        font-size: 2rem;
        padding: 0 1.5rem;
    }

    .drb-topics-section .section-description {
        font-size: 1.05rem;
        padding: 0 1.5rem;
        margin-bottom: 1.75rem;
    }
}

/* Very small devices (iPhone SE, small Android phones) */
@media (max-width: 480px) {
    .drb-topics-section {
        padding: 1.5rem 0;
    }

    .drb-topics-grid {
        gap: 1.25rem;
        padding: 0 1rem;
        max-width: 400px;
        margin: 0 auto;
    }

    .drb-topic-card {
        max-width: 360px;
        width: 100%;
        margin: 0 auto;
    }

    .drb-topic-card-inner {
        min-height: 300px;
    }

    .drb-topic-card-front {
        min-height: 300px;
    }

    .drb-topic-card-back {
        min-height: 300px;
        padding: 1.25rem;
        gap: 0.75rem;
    }

    .drb-topic-card-back p {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .drb-topic-card-back .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }

    .drb-topics-section h2 {
        font-size: 1.875rem;
        padding: 0 1rem;
    }

    .drb-topics-section .section-description {
        font-size: 1rem;
        padding: 0 1rem;
        margin-bottom: 1.5rem;
    }
}

/* Extra small devices (very narrow phones) */
@media (max-width: 360px) {
    .drb-topics-grid {
        padding: 0 0.75rem;
        max-width: 340px;
    }

    .drb-topic-card {
        max-width: 320px;
    }

    .drb-topic-card-inner {
        min-height: 280px;
    }

    .drb-topic-card-front,
    .drb-topic-card-back {
        min-height: 280px;
    }

    .drb-topic-card-back {
        padding: 1rem;
    }

    .drb-topic-card-back p {
        font-size: 0.9rem;
    }

    .drb-topics-section h2 {
        font-size: 1.625rem;
        padding: 0 0.75rem;
    }

    .drb-topics-section .section-description {
        padding: 0 0.75rem;
    }
}

/* Tablet adjustments - handled by main media queries above */

.topics-more-button {
    grid-column: 1 / -1;
    margin-top: 1.5rem;
    padding: 1.1rem 2.5rem;
    background: var(--primary-teal);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(42, 157, 143, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.topics-more-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(42, 157, 143, 0.4);
    background: var(--dark-teal);
}

.topics-more-button i {
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
}

.topics-more-button:hover i {
    transform: translateX(5px);
}

@media (min-width: 768px) {
    .drb-topic-link:nth-child(n+3) {
        display: block;
    }
    
    .topics-more-button {
        display: none;
    }
}

.topics-note {
    text-align: center;
    color: #64748b;
    font-size: 1rem;
    margin-top: 3rem;
    line-height: 1.6;
}

/* Hide topics-note on mobile to avoid repetition with topics-more-button */
@media (max-width: 767px) {
    .topics-note {
        display: none;
    }
}