.otm-home-exam-section {
    --exam-ink: #173354;
    --exam-muted: #4c6381;
    --exam-line: #dce6f0;
    padding-block: 32px 18px;
}

.otm-home-exam-heading {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-bottom: 18px;
}

.otm-home-exam-heading h2 {
    margin: 0;
    color: var(--exam-ink);
    font-size: clamp(22px, 2.3vw, 29px);
    font-weight: 750;
    line-height: 1.25;
}

.otm-home-exam-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.otm-home-exam-filters button {
    min-height: 38px;
    padding: 6px 12px;
    border: 1px solid #cddaea;
    border-radius: 5px;
    background: #fff;
    color: #27486a;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.otm-home-exam-filters button:hover {
    border-color: #79a9d3;
    background: #ecf5fd;
}

.otm-home-exam-filters button[aria-pressed="true"] {
    border-color: #1668a7;
    background: #1668a7;
    color: #fff;
}

.otm-home-exam-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
}

.otm-home-exam-grid > .alert {
    grid-column: 1 / -1;
}

.otm-home-exam-section [hidden] {
    display: none;
}

.otm-home-exam-section article.otm-home-exam-card {
    --exam-accent: #175984;
    --exam-tint: #e8f4fc;
    --exam-accent-border: #9bd0ec;
    display: grid;
    grid-template-rows: auto 1fr;
    min-width: 0;
    border: 1px solid var(--exam-line);
    border-radius: 9px;
    background: #fff;
    color: var(--exam-ink);
    box-shadow: 0 3px 10px rgba(21, 53, 86, .05);
    overflow-wrap: anywhere;
}

.otm-home-exam-section .otm-home-exam-card[hidden] { display: none; }

.otm-home-exam-section article.otm-home-exam-card[data-accent="1"] {
    --exam-accent: #0d6255;
    --exam-tint: #e8f6f1;
    --exam-accent-border: #9ed8c7;
}

.otm-home-exam-section article.otm-home-exam-card[data-accent="2"] {
    --exam-accent: #573a88;
    --exam-tint: #f2edfb;
    --exam-accent-border: #c7b5ec;
}

.otm-home-exam-card__head {
    padding: 16px 19px;
    border-top: 3px solid var(--exam-accent-border);
    border-radius: 8px 8px 0 0;
    background: linear-gradient(130deg, var(--exam-tint), #f8fafc);
}

.otm-home-exam-card__category {
    display: inline-block;
    max-width: 100%;
    margin-bottom: 9px;
    padding: 4px 8px;
    border-radius: 4px;
    background: #fff;
    color: var(--exam-accent);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.otm-home-exam-card__head h3 {
    margin: 0;
    color: var(--exam-ink);
    font-size: clamp(17px, 1.5vw, 20px);
    font-weight: 750;
    line-height: 1.3;
}

.otm-home-exam-card__head p {
    margin: 5px 0 0;
    color: var(--exam-muted);
    font-size: 14px;
}

.otm-home-exam-card__content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 15px 19px;
}

.otm-home-exam-card__facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

.otm-home-exam-card__facts div {
    padding: 7px 10px;
    border-radius: 5px;
    background: #f3f7fb;
}

.otm-home-exam-card__facts dt {
    color: var(--exam-muted);
    font-size: 12px;
    font-weight: 500;
}

.otm-home-exam-card__facts dd {
    margin: 1px 0 0;
    color: var(--exam-ink);
    font-size: 15px;
    font-weight: 700;
}

.otm-home-exam-section a.otm-home-exam-card__author {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 8px;
    margin-top: auto;
    color: #365776;
    font-size: 13px;
    font-weight: 600;
}

.otm-home-exam-card__author img {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border: 1px solid var(--exam-line);
    border-radius: 5px;
    background: #f3f7fb;
    object-fit: cover;
}

.otm-home-exam-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    flex-wrap: wrap;
    padding-top: 13px;
    border-top: 1px solid var(--exam-line);
}

.otm-home-exam-card__footer form { margin: 0; }

.otm-home-exam-card__price {
    font-size: 18px;
    font-weight: 750;
    color: var(--exam-ink);
}

.otm-home-exam-card__price.is-free { color: #126148; font-size: 14px; }

.otm-home-exam-section .otm-home-exam-card__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    max-width: 100%;
    padding: 6px 14px;
    border: 1px solid #1668a7;
    border-radius: 5px;
    background: #1668a7;
    color: #fff;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.otm-home-exam-section .otm-home-exam-card__action:hover {
    border-color: #0e4d81;
    background: #0e4d81;
    color: #fff;
    text-decoration: none;
}

@media (max-width: 960px) {
    .otm-home-exam-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .otm-home-exam-section { padding-block: 24px 12px; }
    .otm-home-exam-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .otm-home-exam-section .otm-home-exam-card__action { min-height: 44px; }
}

@supports (grid-template-rows: subgrid) {
    .otm-home-exam-section article.otm-home-exam-card {
        grid-row: span 2;
        grid-template-rows: subgrid;
        row-gap: 0;
    }
}

/* A shallow shadow distinguishes the cards before any interaction. */
.otm-home-exam-section article.otm-home-exam-card,
.otm-home-categories .otm-home-categories__card {
    position: relative;
    box-shadow: 0 3px 0 rgba(21, 53, 86, .09), 0 7px 15px rgba(21, 53, 86, .09);
}

@media (prefers-reduced-motion: no-preference) {
    .otm-home-exam-section article.otm-home-exam-card,
    .otm-home-categories .otm-home-categories__card {
        transition: transform 180ms ease, box-shadow 180ms ease;
    }

    .otm-home-exam-section article.otm-home-exam-card:is(:active, .is-touch-pressed),
    .otm-home-categories .otm-home-categories__card:is(:active, .is-touch-pressed) {
        transform: translateY(2px) scale(.99);
        box-shadow: 0 2px 7px rgba(21, 53, 86, .12);
    }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    .otm-home-exam-section article.otm-home-exam-card:hover:not(.is-touch-pressed),
    .otm-home-categories .otm-home-categories__card:hover:not(.is-touch-pressed) {
        z-index: 1;
        transform: perspective(850px) translateY(-5px) rotateX(var(--card-x, 1deg)) rotateY(var(--card-y, 0deg));
        box-shadow: 0 5px 0 rgba(21, 53, 86, .08), 0 14px 23px rgba(21, 53, 86, .15);
    }
}
