/*
 * Home page (Stitch "Homepage"). Loaded only where the "storm-home" class
 * appears (front end and block editor).
 *
 * Texts, links, images, backgrounds, section spacing and content width, gaps,
 * borders and radius are block settings. This file only draws what core blocks
 * have no setting for: the step dots and line, the toolkit panel (grid,
 * separators, hover), the learning box separator, the contribution steps, the text measure of intros and the small text sizes
 * between the font-size presets. Low-specificity selectors (:where) so a
 * spacing or colour set on a block wins.
 */

/* Sections */

:where(.storm-home-section) :where(h2) {
    margin-block: 0 0.5em;
}

:where(.storm-home-intro),
:root .storm-home-section > .storm-home-intro {
    max-width: 40rem;
    margin-block: 0 2.5rem;
}

:where(.storm-home-section.has-text-align-center, .storm-home-centred) :where(.storm-home-intro) {
    margin-inline: auto;
    text-align: center;
}

/* Small uppercase label above a heading ("01 Discover", "Latest discussion").
   A plain class, so Blocksy's text styles don't override it on the front end.
   Size and weight set on the block (Styles → Typography) win. */
.storm-eyebrow {
    margin-block: 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Stand-alone links ("Start with the basics →", hero shortcuts): storm-ui.css. */

/* 01 · Hero */

:where(.storm-home-shortcuts) {
    font-size: 0.9rem;
}

:where(.storm-home-shortcuts) a {
    margin-inline: 0.35em;
}

/* 02 · Where are you today? — four steps on a line, one accent colour per dot */

.storm-steps {
    --storm-step-dot: var(--theme-palette-color-3);

    position: relative;
}

.storm-steps > :nth-child(2) {
    --storm-step-dot: var(--theme-palette-color-1);
}

.storm-steps > :nth-child(3) {
    --storm-step-dot: var(--storm-accent-teal, #00b7a5);
}

.storm-steps > :nth-child(4) {
    --storm-step-dot: var(--storm-accent-coral, #ec5152);
}

/* Continuous line through the dots */
.storm-steps::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--theme-palette-color-6);
}

.storm-step {
    position: relative;
    padding-top: 2rem;
}

.storm-step::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--storm-step-dot);
}

/* Hover or keyboard focus on a step: its dot gets a ring and sends out one
   ripple (the ripple only without prefers-reduced-motion) */
.storm-step::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    box-sizing: border-box;
    width: 11px;
    height: 11px;
    border: 1px solid var(--storm-step-dot);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

.storm-step:is(:hover, :focus-within)::before {
    box-shadow:
        0 0 0 3px var(--theme-palette-color-8),
        0 0 0 4px var(--storm-step-dot);
}

@media (prefers-reduced-motion: no-preference) {
    .storm-step::before {
        transition: box-shadow 0.25s ease;
    }

    .storm-step:is(:hover, :focus-within)::after {
        animation: storm-step-ripple 0.9s ease-out;
    }
}

@keyframes storm-step-ripple {
    from {
        opacity: 0.6;
        transform: scale(1);
    }

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

/* Step titles: size only; their colour is a block setting. ":root" makes this
   stronger than Blocksy's ":root h3" heading rule, which the editor loads after
   this file; a size set on the block still wins. */
:root .storm-step h3 {
    margin-block: 0 1rem;
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1.35;
}

/* 04 · Technical Toolkit — five tools in one panel */

.storm-home-toolkit-head .storm-home-intro {
    margin-bottom: 0;
}

.storm-toolkit {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;

    padding: 2rem 0;
    border: 1px solid var(--theme-palette-color-6);
    border-radius: 12px;
    background: var(--theme-palette-color-7);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

/* While the mouse is over the panel: border in the button colour and a faint
   shadow */
.storm-toolkit:hover {
    /* Same colour as the buttons (Customizer → Buttons) */
    border-color: var(--theme-button-background-initial-color, var(--theme-palette-color-1));
    box-shadow: 0 6px 18px -10px color-mix(in srgb, var(--theme-palette-color-1) 18%, transparent);
}

.storm-toolkit > .storm-toolkit__item {
    position: relative;
    margin: 0;
    padding: 0.5rem 1.5rem;
}

.storm-toolkit > .storm-toolkit__item + .storm-toolkit__item {
    border-left: 1px solid var(--theme-palette-color-6);
}

:root .storm-toolkit__item h3 {
    margin-block: 0 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
}

.storm-toolkit__item h3 a {
    text-decoration: none;
}

/* The whole item is clickable through its heading link */
.storm-toolkit__item h3 a::after {
    content: "";
    position: absolute;
    inset: 0;
}

.storm-toolkit__item h3 a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.storm-toolkit__item h3 a:focus-visible {
    outline: none;
}

/* Keyboard focus only: after a mouse click (and when coming back to the page)
   the link is focused too, but :focus-visible doesn't match then. */
.storm-toolkit__item:has(a:focus-visible) {
    outline: 2px solid var(--theme-palette-color-1);
    outline-offset: -2px;
    border-radius: 8px;
}

.storm-toolkit__item p {
    margin: 0;
    font-size: 0.9rem;
}

/* Horizontal line through the icons (Stitch), desktop only. The icons are core
   Icon blocks (icon, colours, border and size set on the block); the line runs
   through each icon's wrapper, starts at the first icon and is clipped at the
   tile edges. */
@media (min-width: 1000px) {
    .storm-toolkit > .storm-toolkit__item {
        overflow: hidden;
    }

    .storm-toolkit__item > .wp-block-icon {
        position: relative;
    }

    .storm-toolkit__item > .wp-block-icon svg {
        position: relative;
        z-index: 1;
    }

    .storm-toolkit__item > .wp-block-icon::before {
        content: "";
        position: absolute;
        top: 50%;
        left: -100vw;
        right: -100vw;
        height: 1px;
        background: var(--theme-palette-color-6);
    }

    .storm-toolkit__item:first-child > .wp-block-icon::before {
        left: 0;
    }
}

/* 05 · Knowledge & Learning — one box, two halves */

.storm-home-learning > .wp-block-column + .wp-block-column {
    border-left: 1px solid var(--theme-palette-color-6);
}

:root .storm-home-learning h2 {
    font-size: 1.35rem;
}


.storm-home-learning .storm-resource-search {
    margin-block: 1.5rem;
}

/* Academy levels: storm-ui.css (shared with Knowledge & Learning). */

/* 06 · Connect & Contribute */

:root .storm-community h3 {
    margin-block: 0 0.5rem;
    font-size: 1.05rem;
    line-height: 1.4;
}

.storm-community :where(.storm-home-meta) {
    margin-block: 0 1rem;
    font-size: 0.85rem;
}

/* Sign in → Submit → Review → Publish */
.storm-contribute__steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 1.75rem 0 0;
    padding: 0;
    list-style: none;
    counter-reset: storm-contribute;
    font-size: 0.8rem;
    text-align: center;
    color: var(--theme-palette-color-5);
}

.storm-contribute__steps li {
    position: relative;
    margin: 0;
    counter-increment: storm-contribute;
}

.storm-contribute__steps li::before {
    content: counter(storm-contribute);
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    margin: 0 auto 0.4rem;
    border: 1px solid var(--theme-palette-color-6);
    border-radius: 50%;
    background: var(--theme-palette-color-8);
}

.storm-contribute__steps li:first-child::before {
    border-color: var(--theme-palette-color-3);
    background: var(--theme-palette-color-3);
    color: var(--theme-palette-color-4);
    font-weight: 600;
}

/* Line between the numbers */
.storm-contribute__steps li + li::after {
    content: "";
    position: absolute;
    top: 0.95rem;
    right: 50%;
    width: 100%;
    height: 1px;
    background: var(--theme-palette-color-6);
}

/* Tablet */
@media (max-width: 999.98px) {
    .storm-toolkit {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 0;
    }

    .storm-toolkit > .storm-toolkit__item {
        padding: 1.5rem;
        border-bottom: 1px solid var(--theme-palette-color-6);
    }

    .storm-toolkit > .storm-toolkit__item + .storm-toolkit__item {
        border-left: 0;
    }

    .storm-toolkit > .storm-toolkit__item:nth-child(odd) {
        border-right: 1px solid var(--theme-palette-color-6);
    }

    .storm-toolkit > .storm-toolkit__item:last-child {
        border-bottom: 0;
    }
}

/* Phone (core Columns stack below 782 px) */
@media (max-width: 781.98px) {
    .storm-steps::before {
        display: none;
    }

    .storm-home-learning > .wp-block-column + .wp-block-column {
        border-left: 0;
        border-top: 1px solid var(--theme-palette-color-6);
    }
}

@media (max-width: 559.98px) {
    .storm-toolkit {
        grid-template-columns: minmax(0, 1fr);
    }

    .storm-toolkit > .storm-toolkit__item:nth-child(odd) {
        border-right: 0;
    }
}
