/* EDUSHARK TRAINING: inline figures and schematic diagrams.

   Loaded after aero.css on the pages that carry a figure. Every colour comes
   from the site's own tokens, so each figure reads in the light theme and in
   the dark theme without a second set of rules. Phase swatches on the week
   track are fixed hexes chosen for contrast with their own ink, so they hold
   in both themes. Motion is ambient and low in amplitude, runs only when the
   visitor has not asked for reduced motion, and nothing waits on it: every
   figure is fully visible before any animation plays. */

.fig {
    --fig-ink: var(--text-color, #333);
    --fig-soft: var(--text-light, #666);
    --fig-brand: var(--primary-color, #1a5f7a);
    --fig-accent: var(--accent-color, #57c5b6);
    --fig-panel: var(--white, #ffffff);
    --fig-line: rgba(26, 95, 122, 0.22);
    --fig-tint: rgba(21, 152, 149, 0.10);
    position: relative;
    margin: 2rem auto 0;
    padding: 1.5rem 1.6rem 1.6rem;
    background: var(--fig-panel);
    border: 1px solid var(--fig-line);
    border-radius: var(--radius-lg, 22px);
    box-shadow: var(--shadow);
    color: var(--fig-ink);
    text-align: left;
    max-width: 1100px;
    container-type: inline-size;
}

@media (prefers-color-scheme: dark) {
    .fig {
        --fig-line: rgba(143, 223, 213, 0.22);
        --fig-tint: rgba(62, 207, 201, 0.12);
    }
}

.fig-cap {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.3rem 0.75rem;
    margin: 0 0 1.3rem;
}

.fig-cap strong {
    font-size: 1.05rem;
    color: var(--fig-ink);
    letter-spacing: -0.01em;
}

.fig-cap span {
    font-size: 0.9rem;
    color: var(--fig-soft);
}

.fig-foot {
    margin: 1.1rem 0 0;
    font-size: 0.84rem;
    color: var(--fig-soft);
    line-height: 1.5;
}

/* ------------------------------------------------------------- flow --- */
/* A pipeline: numbered stages on one rail, each with the weeks that teach it. */

.flow-wrap {
    position: relative;
}

.flow {
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--flow-n, 5), minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.flow-rail {
    position: absolute;
    left: 10%;
    right: 10%;
    top: 27px;
    height: 4px;
    width: 80%;
    pointer-events: none;
    overflow: visible;
}

.flow-rail line {
    stroke: var(--fig-line);
    stroke-width: 2;
}

.flow-rail .flow-dash {
    stroke: var(--fig-accent);
    stroke-width: 2;
    stroke-dasharray: 6 14;
    stroke-linecap: round;
}

.flow-step {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 0.25rem;
}

.flow-glyph {
    position: relative;
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--fig-panel);
    border: 2px solid var(--fig-brand);
    color: var(--fig-brand);
    box-shadow: 0 0 0 6px var(--fig-panel);
    margin-bottom: 0.85rem;
}

.flow-glyph svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.flow-glyph::after {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    right: -7px;
    top: -7px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: var(--fig-brand);
    color: var(--fig-panel);
    font-size: 0.72rem;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.flow-text {
    min-width: 0;
}

.flow-name {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    color: var(--fig-ink);
    margin-bottom: 0.25rem;
}

.flow-note {
    display: block;
    font-size: 0.86rem;
    color: var(--fig-soft);
    line-height: 1.45;
}

.flow-when {
    display: inline-block;
    margin-top: 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--fig-brand);
    background: var(--fig-tint);
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
}

/* Stacked layout: the figure's own width decides, so a flow placed in a narrow
   column on a wide screen stacks the same way it does on a phone. */
@container (max-width: 640px) {
    .flow {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .flow-rail {
        display: none;
    }

    .flow-step {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        gap: 1rem;
        padding: 0.65rem 0;
    }

    .flow-step + .flow-step::before {
        content: "";
        position: absolute;
        left: 27px;
        top: -16px;
        height: 22px;
        border-left: 2px dashed var(--fig-line);
    }

    .flow-glyph {
        margin-bottom: 0;
    }
}

/* ------------------------------------------------------------ track --- */
/* A programme as phases over a twelve-week ribbon. Each phase owns a swatch,
   and the ribbon below colours every week by the phase it belongs to. */

.track-phases {
    display: grid;
    grid-template-columns: repeat(var(--phases, 6), minmax(0, 1fr));
    gap: 0.6rem;
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.track-phase {
    padding: 0.75rem 0.85rem 0.85rem;
    border-radius: 12px;
    border: 1px solid var(--fig-line);
    border-top: 4px solid var(--ph, var(--fig-brand));
    background: var(--fig-panel);
}

.track-phase.is-optional {
    border-style: dashed;
    border-top-style: solid;
}

.track-phase b {
    display: block;
    font-size: 0.95rem;
    color: var(--fig-ink);
    line-height: 1.3;
}

.track-phase .wk {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fig-brand);
    font-weight: 700;
    margin: 0.2rem 0 0.35rem;
}

.track-phase p {
    margin: 0;
    font-size: 0.84rem;
    color: var(--fig-soft);
    line-height: 1.45;
}

.track-phase .tag {
    display: inline-block;
    margin-top: 0.45rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--fig-brand);
    background: var(--fig-tint);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.track-weeks {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.track-weeks li {
    height: 34px;
    border-radius: 7px;
    background: var(--ph);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    font-weight: 700;
}

.track-weeks li.is-optional {
    background: repeating-linear-gradient(135deg, var(--ph) 0 5px, transparent 5px 9px);
    border: 1px solid var(--ph);
    color: var(--fig-ink);
}

.track-weeks li.is-optional span {
    background: var(--fig-panel);
    padding: 0 0.3rem;
    border-radius: 4px;
}

.track-legend {
    margin: 0.5rem 0 0;
    display: flex;
    justify-content: space-between;
    font-size: 0.74rem;
    color: var(--fig-soft);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

@container (max-width: 760px) {
    .track-phases {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .track-weeks li {
        height: 28px;
        font-size: 0.7rem;
        border-radius: 5px;
    }
}

@container (max-width: 420px) {
    .track-phases {
        grid-template-columns: 1fr;
    }

    .track-weeks {
        gap: 2px;
    }
}

/* -------------------------------------------------------------- map --- */
/* Skills to artefacts to roles: three columns joined by arrows. */

.map {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0.75rem;
    align-items: stretch;
}

.map-col {
    border: 1px solid var(--fig-line);
    border-radius: 12px;
    padding: 0.9rem 1rem 1rem;
    background: var(--fig-panel);
}

.map-col.is-mid {
    border-color: var(--fig-brand);
    box-shadow: inset 0 0 0 1px var(--fig-brand);
}

.map-col h4 {
    margin: 0 0 0.65rem;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fig-brand);
}

.map-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.map-col li {
    font-size: 0.9rem;
    color: var(--fig-ink);
    padding: 0.38rem 0.65rem;
    border-radius: 8px;
    background: var(--fig-tint);
    line-height: 1.35;
}

.map-arrow {
    display: grid;
    place-items: center;
    color: var(--fig-brand);
}

.map-arrow svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@container (max-width: 760px) {
    .map {
        grid-template-columns: 1fr;
    }

    .map-arrow svg {
        transform: rotate(90deg);
    }
}

/* ------------------------------------------------------------ tiers --- */
/* Which programme first: three tiers by the background each one assumes. */

.tiers {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tier {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
}

.tier-req {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fig-brand);
    text-align: center;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--fig-line);
    border-radius: 999px;
    background: var(--fig-tint);
    line-height: 1.3;
}

.tier-courses {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 0.7rem;
}

.tier-course {
    display: block;
    text-decoration: none;
    padding: 0.8rem 1rem 0.85rem;
    border-radius: 12px;
    border: 1px solid var(--fig-line);
    border-left: 5px solid var(--tc, var(--fig-brand));
    background: var(--fig-panel);
    color: var(--fig-ink);
    transition: transform 0.25s var(--ease-out, ease), box-shadow 0.25s var(--ease-out, ease);
}

.tier-course:hover,
.tier-course:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.tier-course b {
    display: block;
    font-size: 1rem;
    color: var(--fig-ink);
}

.tier-course span {
    display: block;
    font-size: 0.84rem;
    color: var(--fig-soft);
    margin-top: 0.15rem;
}

.tier-arrow {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 1rem;
}

.tier-arrow svg {
    justify-self: center;
    width: 22px;
    height: 30px;
    fill: none;
    stroke: var(--fig-brand);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@container (max-width: 640px) {
    .tier,
    .tier-arrow {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .tier-req {
        justify-self: start;
    }

    .tier-arrow svg {
        justify-self: start;
        margin-left: 1.5rem;
    }
}

/* ----------------------------------------------------------- motion --- */

@media (prefers-reduced-motion: no-preference) {
    .flow-rail .flow-dash {
        animation: fig-dash 2.2s linear infinite;
    }

    .flow-glyph {
        animation: fig-breathe 7s ease-in-out infinite;
        animation-delay: calc(var(--i, 0) * 0.7s);
    }

    .tier-arrow svg {
        animation: fig-nudge 4s ease-in-out infinite;
    }
}

@keyframes fig-dash {
    to { stroke-dashoffset: -20; }
}

@keyframes fig-breathe {
    0%, 100% { box-shadow: 0 0 0 6px var(--fig-panel), 0 0 0 7px var(--fig-line); }
    50% { box-shadow: 0 0 0 6px var(--fig-panel), 0 0 0 11px var(--fig-tint); }
}

@keyframes fig-nudge {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}
