/* Learn article page (learn/article.html): the header band, the hero image that overlaps it,
   previous/next lessons and related concepts. The article body itself is styled in learn.css. */
.la-inner {
    max-width: 48rem;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .la-inner {
        padding: 0 1.5rem;
    }
}

/* ---------- Header band ---------- */
/* The band runs deeper when the hero image overlaps its bottom edge. */
.la-hero {
    padding: 6.5rem 0 3.5rem;
    background:
        linear-gradient(rgba(255, 255, 255, 0.01) 1px, transparent 1px) 0 0 / 32px 32px,
        linear-gradient(90deg, rgba(255, 255, 255, 0.01) 1px, transparent 1px) 0 0 / 32px 32px,
        radial-gradient(45% 60% at 85% 30%, rgba(52, 211, 153, 0.1), transparent 70%),
        linear-gradient(180deg, var(--kd-brand) 0%, #354F8A 30%, var(--kd-brand-deep) 100%);
    color: #fff;
}

.la-hero--image {
    padding-bottom: 5.5rem;
}

@media (min-width: 900px) {
    .la-hero {
        padding: 8rem 0 4.5rem;
    }

    .la-hero--image {
        padding-bottom: 7rem;
    }
}

/* The header copy rises in on load, line by line, then the hero image, as on the other page heroes. */
.la-hero .la-inner > *,
.la-figure {
    animation: la-rise 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--i, 0) * 70ms);
}

.la-figure {
    --i: 4;
    animation-name: la-rise-figure;
}

@keyframes la-rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
}

/* The figure is centred with translateX(-50%), so its rise keeps that offset. */
@keyframes la-rise-figure {
    from {
        opacity: 0;
        transform: translate(-50%, 14px);
    }
}

.la-crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.95rem;
    font-weight: 600;
}

.la-crumbs a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: color 0.2s ease;
}

.la-crumbs a:last-child {
    color: var(--kd-mint-soft);
}

.la-crumbs a:hover {
    color: #fff;
}

.la-hero__title {
    margin: 0;
    font-size: clamp(2.1rem, 4.6vw, 3.4rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.03em;
}

.la-hero__intro {
    margin: 1.4rem 0 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: clamp(1.05rem, 1.4vw, 1.2rem);
    line-height: 1.65;
}

.la-hero__meta {
    margin: 1.5rem 0 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

/* ---------- Main column ---------- */
.la-main {
    padding-bottom: 6rem;
    background: #fff;
}

.la-figure {
    position: relative;
    width: min(64rem, calc(100vw - 2rem));
    margin: -3.5rem 0 0 50%;
    overflow: hidden;
    border: 1px solid var(--kd-line);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 24px 60px -30px rgba(15, 27, 77, 0.45);
    transform: translateX(-50%);
}

/* Wide diagrams fill the frame; tall images are capped so they don't push the article down. */
.la-figure img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 34rem;
    object-fit: contain;
}

.la-body {
    padding-top: 3.5rem;
}

/* Wagtail wraps each block in a div, so the first heading's top margin sits one level down. */
.la-body > :first-child,
.la-body > :first-child > :first-child {
    margin-top: 0 !important;
}

/* ---------- Previous and next lesson ---------- */
.la-steps {
    display: grid;
    gap: 1rem;
    margin-top: 4.5rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--kd-line);
}

@media (min-width: 640px) {
    .la-steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.la-step {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.15rem 1.25rem;
    border: 1px solid var(--kd-line);
    border-radius: 0.9rem;
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.25s ease;
}

.la-step--next {
    grid-column: -2;
    text-align: right;
}

.la-step:hover {
    border-color: #C9D4EA;
    box-shadow: 0 14px 32px -20px rgba(42, 64, 115, 0.35);
}

.la-step__label {
    color: var(--kd-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.la-step__title {
    color: var(--kd-ink);
    font-weight: 700;
    line-height: 1.35;
    transition: color 0.2s ease;
}

.la-step:hover .la-step__title {
    color: var(--kd-brand);
}

/* ---------- Related concepts ---------- */
.la-related {
    margin-top: 4.5rem;
}

.la-related__kicker {
    margin: 0 0 0.5rem;
    color: var(--kd-mint-ink);
    font-size: 0.875rem;
    font-weight: 600;
}

.la-related__title {
    margin: 0;
    color: var(--kd-ink);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.la-related__grid {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

@media (min-width: 640px) {
    .la-related__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.la-concept {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    border-radius: 0.9rem;
    background: var(--kd-brand-soft);
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.25s ease;
}

.la-concept:hover {
    background: #E3E9F6;
    transform: translateY(-2px);
}

.la-concept__topic {
    color: var(--kd-mint-ink);
    font-size: 0.8rem;
    font-weight: 600;
}

.la-concept__title {
    margin-top: 0.35rem;
    color: var(--kd-brand-deep);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.3;
}

.la-concept__intro {
    margin-top: 0.5rem;
    color: var(--kd-body);
    font-size: 0.925rem;
    line-height: 1.55;
}

.la-back {
    display: inline-flex;
    gap: 0.4rem;
    margin-top: 3.5rem;
    color: var(--kd-brand);
    font-weight: 600;
    text-decoration: none;
}

.la-back:hover {
    color: var(--kd-brand-darker);
}

.la-step:focus-visible,
.la-concept:focus-visible,
.la-back:focus-visible,
.la-crumbs a:focus-visible {
    outline: 3px solid var(--kd-brand);
    outline-offset: 3px;
    border-radius: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
    .la-hero .la-inner > *,
    .la-figure {
        animation: none;
    }

    .la-concept {
        transition: none;
    }

    .la-concept:hover {
        transform: none;
    }
}
