/* SkillMark website: the one global stylesheet.
   Order: fonts, tokens, reset, typography and container, MudBlazor overrides, utilities, motion. */

/* ---------- Fonts (self-hosted, SIL Open Font License) ---------- */
@font-face {
    font-family: 'Sora';
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url('../fonts/sora-latin-wght.woff2') format('woff2');
}

@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 100 1000;
    font-display: swap;
    src: url('../fonts/dm-sans-latin-wght.woff2') format('woff2');
}

/* ---------- Tokens ---------- */
:root {
    /* Colours aliased to the MudTheme (BrandColors.cs is the source, fallbacks must match it) */
    --sm-navy: var(--mud-palette-primary, #0F2044);
    --sm-orange: var(--mud-palette-secondary, #F26522);
    --sm-orange-text: var(--mud-palette-tertiary, #B84A12);
    --sm-bg-alt: var(--mud-palette-background-gray, #F4F6FB);
    --sm-border: var(--mud-palette-lines-default, #E3E8F2);
    --sm-text: var(--mud-palette-text-secondary, #4A5568);

    /* Colours only used by the site CSS */
    --sm-navy-deep: #0A1733;
    --sm-navy-line: #22345E;
    --sm-on-navy: #C9D3E8;
    --sm-nav-idle: #DCE3F2;
    --sm-footer-link: #AEBBD6;
    --sm-muted: #5B6F9A;
    --sm-pill-border: #3A4F7E;
    --sm-border-2: #D5DCEA;
    --sm-dashed: #AEB9D0;
    --sm-peach: #FFF1E8;
    --sm-peach-text: #8A3300;

    /* Fluid type, 390px to 1440px viewport */
    --sm-font-head: 'Sora', system-ui, sans-serif;
    --sm-font-body: 'DM Sans', system-ui, sans-serif;
    --sm-fs-h1-home: clamp(2.125rem, 1.614rem + 2.095vw, 3.5rem);
    --sm-fs-h1: clamp(2rem, 1.536rem + 1.905vw, 3.25rem);
    --sm-fs-h2: clamp(1.75rem, 1.471rem + 1.143vw, 2.5rem);
    --sm-fs-h2-sm: clamp(1.625rem, 1.439rem + 0.762vw, 2.125rem);
    --sm-fs-h3: clamp(1.125rem, 1.079rem + 0.19vw, 1.25rem);
    --sm-fs-lead: clamp(1.0625rem, 1.016rem + 0.19vw, 1.1875rem);
    --sm-fs-body: clamp(0.9375rem, 0.914rem + 0.095vw, 1rem);
    --sm-fs-eyebrow: clamp(0.75rem, 0.727rem + 0.095vw, 0.8125rem);
    --sm-fs-stat: clamp(2.75rem, 2.564rem + 0.762vw, 3.25rem);

    /* Space, radius, shadow */
    --sm-container: 1200px;
    --sm-gutter: clamp(1.25rem, 0.971rem + 1.143vw, 2rem);
    --sm-section-y: clamp(3rem, 1.886rem + 4.571vw, 6rem);
    --sm-gap: 24px;
    --sm-split-gap: clamp(2rem, 1.443rem + 2.286vw, 3.5rem);
    --sm-r-pill: 999px;
    --sm-r-hero: 20px;
    --sm-r-card: clamp(0.875rem, 0.829rem + 0.19vw, 1rem);
    --sm-r-tile: 14px;
    --sm-r-row: 12px;
    --sm-r-btn: 10px;
    --sm-shadow-hero: 0 24px 60px rgb(0 0 0 / 0.28);

    /* Motion */
    --sm-dur-fast: 150ms;
    --sm-dur: 300ms;
    --sm-dur-slow: 600ms;
    --sm-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--sm-font-body);
    font-size: var(--sm-fs-body);
    line-height: 1.6;
    color: var(--sm-navy);
    background: #FFFFFF;
}

img, svg {
    display: block;
    max-width: 100%;
}

/* ---------- Typography and container ---------- */
h1, h2, h3 {
    font-family: var(--sm-font-head);
    margin: 0;
}

p {
    margin: 0;
}

a {
    color: inherit;
}

.sm-container {
    max-width: var(--sm-container);
    margin-inline: auto;
    padding-inline: var(--sm-gutter);
}

.sm-skip-link {
    position: absolute;
    left: 8px;
    top: -60px;
    z-index: 100;
    padding: 12px 18px;
    border-radius: var(--sm-r-btn);
    background: var(--sm-orange);
    color: var(--sm-navy);
    font-weight: 700;
    text-decoration: none;
}

.sm-skip-link:focus {
    top: 8px;
}

/* "html" raises specificity above MudBlazor's a:focus-visible / button:focus { outline: none } */
html :focus-visible {
    outline: 3px solid var(--sm-navy);
    outline-offset: 2px;
}

.sm-on-navy :focus-visible,
.sm-on-navy:focus-visible {
    outline-color: var(--sm-orange);
}

/* ---------- MudBlazor overrides ---------- */
.mud-button-root.mud-button {
    min-height: 44px;
    border-radius: var(--sm-r-btn);
    box-shadow: none;
}

.mud-button-root.mud-button.sm-btn {
    min-height: 52px;
    padding-inline: 28px;
    font-size: 1rem;
}

.mud-button-root.mud-button.sm-btn-lg {
    min-height: 56px;
    padding-inline: 34px;
    font-size: 1.0625rem;
}

/* Outline button on navy backgrounds */
.mud-button-root.mud-button.sm-btn-outline-light {
    color: #FFFFFF;
    border: 1.5px solid var(--sm-muted);
}

/* The peach "Illustrative sample" and group tags */
.mud-chip.sm-chip {
    height: auto;
    margin: 0;
    padding: 6px 12px;
    border-radius: var(--sm-r-pill);
    background: var(--sm-peach);
    color: var(--sm-peach-text);
    font-family: var(--sm-font-body);
    font-size: 12px;
    font-weight: 700;
}

.mud-chip.sm-chip .mud-chip-content {
    padding: 0;
}

/* ---------- Utilities ---------- */
.sm-section {
    padding-block: var(--sm-section-y);
}

.sm-section--alt {
    background: var(--sm-bg-alt);
}

.sm-section--navy {
    background: var(--sm-navy);
    color: #FFFFFF;
}

.sm-eyebrow {
    font-size: var(--sm-fs-eyebrow);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sm-orange-text);
}

.sm-section--navy .sm-eyebrow {
    color: var(--sm-orange);
}

/* Section intro: eyebrow, h2 and an optional lead paragraph */
.sm-intro {
    max-width: 680px;
}

.sm-intro h2 {
    margin-top: 14px;
    font-size: var(--sm-fs-h2);
    font-weight: 700;
    line-height: 1.15;
}

.sm-intro--small h2 {
    margin-top: 0;
    font-size: var(--sm-fs-h2-sm);
}

.sm-eyebrow + h2 {
    margin-top: 14px;
}

.sm-lead {
    margin-top: 18px;
    font-size: var(--sm-fs-lead);
    line-height: 1.6;
    color: var(--sm-text);
}

.sm-section--navy .sm-lead {
    color: var(--sm-on-navy);
}

/* Two columns that wrap to one on narrow screens */
.sm-split {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sm-split-gap);
}

.sm-split > * {
    flex: 1 1 440px;
    min-width: 0;
}

/* Card grid: as many columns as fit, set --sm-grid-min on the grid */
.sm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(var(--sm-grid-min, 300px), 100%), 1fr));
    gap: var(--sm-gap);
    margin-top: clamp(32px, 1.629rem + 1.524vw, 48px);
}

/* Bordered white card on light sections */
.sm-card {
    background: #FFFFFF;
    border: 1px solid var(--sm-border);
    border-radius: var(--sm-r-card);
    padding: clamp(22px, 1.236rem + 0.571vw, 28px);
}

.sm-card h3 {
    font-size: var(--sm-fs-h3);
    font-weight: 600;
}

.sm-card p {
    margin-top: 8px;
    color: var(--sm-text);
}

/* Navy rounded tile holding an orange line icon */
.sm-icon-tile {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: var(--sm-r-tile);
    background: var(--sm-navy);
    color: var(--sm-orange);
}

.sm-icon-tile .mud-icon-root {
    width: 26px;
    height: 26px;
}

/* Peach (or grey) highlight box at the bottom of sample cards */
.sm-callout {
    margin-top: 22px;
    padding: 12px 14px;
    border-radius: var(--sm-r-row);
    background: var(--sm-peach);
    color: var(--sm-navy);
    font-size: 14px;
    line-height: 1.5;
}

.sm-callout--grey {
    background: var(--sm-bg-alt);
}

/* Button row, full width buttons on phones */
.sm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 32px;
}

@media (max-width: 599.98px) {
    .sm-actions > * {
        width: 100%;
    }
}

.sm-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ---------- Motion ----------
   Rules: content is fully visible without any of this; everything sits inside
   prefers-reduced-motion: no-preference; only transform and opacity are animated;
   browsers without scroll-driven animations (currently Firefox) simply show static content. */
@keyframes sm-reveal {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
}

@keyframes sm-fill {
    from {
        transform: scaleX(0);
    }
}

@keyframes sm-reveal-picture {
    from {
        opacity: 0;
        transform: translateY(64px) scale(0.92);
    }
}

@keyframes sm-fade-in {
    from {
        opacity: 0;
    }
}

@keyframes sm-stack-hold {
    to {
        transform: translateY(min(100%, 100vh));
    }
}

/* The layer fades out completely in the first 80% of the scroll, and shrinks over all of it */
@keyframes sm-stack-recede {
    80% {
        opacity: 0;
    }

    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

@media (prefers-reduced-motion: no-preference) {
    /* Cross-document page transitions: the header stays, the page cross-fades */
    @view-transition {
        navigation: auto;
    }

    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation-duration: var(--sm-dur);
        animation-timing-function: var(--sm-ease);
    }

    /* Hover and focus feedback */
    .mud-button-root.mud-button {
        transition: transform var(--sm-dur-fast) var(--sm-ease);
    }

    .mud-button-root.mud-button:hover,
    .mud-button-root.mud-button:focus-visible {
        transform: translateY(-1px);
    }

    .sm-lift {
        transition: transform var(--sm-dur) var(--sm-ease);
    }

    .sm-lift:hover,
    .sm-lift:focus-within {
        transform: translateY(-4px);
    }

    /* Hero text on arrival: the two headline parts fade in slightly apart, the lead paragraph quicker */
    .sm-fade-first,
    .sm-fade-second,
    .sm-fade-lead {
        animation: sm-fade-in 1800ms ease both;
    }

    .sm-fade-first {
        animation-duration: 2200ms;
    }

    .sm-fade-second {
        animation-delay: 500ms;
    }

    .sm-fade-lead {
        animation-duration: 1100ms;
    }

    /* Scroll-driven reveals and bar fills */
    @supports (animation-timeline: view()) {
        .sm-reveal {
            animation: sm-reveal linear both;
            animation-timeline: view();
            animation-range: entry 0% cover 20%;
        }

        /* Pictures: a slower, more visible reveal, complete by the time they reach mid-screen */
        .sm-reveal-picture {
            animation: sm-reveal-picture ease-out both;
            animation-timeline: view();
            animation-range: entry 0% cover 45%;
        }

        .mud-progress-linear-bars {
            transform-origin: left center;
            animation: sm-fill linear both;
            animation-timeline: view();
            animation-range: entry 10% cover 35%;
        }

        /* Stacked sections: while .sm-stack-under leaves the screen it is held in place (its bottom
           edge, or its top edge when shorter than the screen), its layer shrinks and darkens, and the
           .sm-stack-over sheet that follows it in the page slides up over it */
        .sm-stack-under {
            background: var(--sm-navy-deep);
            view-timeline: --sm-stack block;
            animation: sm-stack-hold linear both;
            animation-timeline: --sm-stack;
            animation-range: exit 0% exit 100%;
        }

        .sm-stack-layer {
            background: #FFFFFF;
            transform-origin: 50% 100%;
            animation: sm-stack-recede linear both;
            animation-timeline: --sm-stack;
            animation-range: exit 0% exit 100%;
        }

        .sm-stack-over {
            position: relative;
            z-index: 1;
            overflow: clip;
            border-radius: var(--sm-r-hero) var(--sm-r-hero) 0 0;
            background: #FFFFFF;
            box-shadow: 0 -16px 40px rgb(10 23 51 / 0.35);
        }

        /* The footer also covers the held layer, for when the sheet is shorter than the screen */
        main:has(.sm-stack-over) ~ * {
            position: relative;
            z-index: 1;
        }
    }
}
