/* Conversion helpers shared by every page: floating WhatsApp button,
   hero call-to-action buttons, compact home cards and the 合作流程 steps. */

/* Floating WhatsApp button (every page) */
.wa-float {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 0 22px 0 18px;
    border-radius: 999px;
    background-color: #0E7A62;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.wa-float i {
    font-size: 1.75rem;
    line-height: 1;
}

.wa-float:hover,
.wa-float:focus-visible {
    background-color: #0B6652;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.26);
}

.wa-float:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 6px #0E7A62;
}

/* back-to-top (created by enhanced.js) moves up to sit above it */
body .back-to-top {
    bottom: 96px;
    right: 27px;
}

@media (max-width: 768px) {
    .wa-float {
        right: 16px;
        bottom: 16px;
        width: 56px;
        padding: 0;
        justify-content: center;
    }

    .wa-float__label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    body .back-to-top {
        right: 19px;
        bottom: 84px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wa-float,
    .wa-float:hover {
        transition: none;
        transform: none;
    }
}

/* Hero: who we serve + two call-to-action buttons */
.hero-audience {
    display: inline-block;
    margin-bottom: 18px;
    padding: 6px 16px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 999px;
    background-color: rgba(0, 0, 0, 0.25);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.04em;
}

@media (max-width: 560px) {
    .hero-audience {
        padding: 8px 18px;
        border-radius: 18px;
        line-height: 1.6;
    }

    .hero-audience span {
        display: block;
    }

    .hero-audience .hero-audience__sep {
        display: none;
    }
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-top: 8px;
}

.hero-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
}

.hero-actions .btn-whatsapp {
    background-color: #0E7A62;
    color: #fff;
}

.hero-actions .btn-whatsapp:hover {
    background-color: #0B6652;
    color: #fff;
}

.btn-outline-light {
    background-color: transparent;
    color: #fff;
    border: 2px solid #fff;
}

.btn-outline-light:hover {
    background-color: #fff;
    color: #1f2d27;
}

/* Home 熱門活動: compact cards (details live on the activity pages) */
.home-picks .program-content {
    padding: 24px 26px 26px;
}

.home-picks .program-content p {
    margin-bottom: 14px;
}

.home-picks .program-audience {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    color: #4a5a52;
    font-size: 0.95rem;
}

.home-picks .program-audience i {
    color: var(--primary-color);
}

/* The hover shade (.program-card::before) and the photo share one height,
   so the shade always covers exactly the photo. */
.program-card {
    --card-img-h: 250px;
}

.program-card img,
.program-card::before {
    height: var(--card-img-h);
}

.home-picks .program-card {
    --card-img-h: 220px;
}

/* 合作流程 steps */
.flow {
    padding: 80px 0;
    background-color: #f6faf8;
}

.flow__lede {
    max-width: 640px;
    margin: -10px auto 40px;
    text-align: center;
    color: #4a5a52;
}

.flow__list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.flow-step {
    position: relative;
    padding: 28px 24px 26px;
    border: 1px solid rgba(52, 181, 116, 0.18);
    border-radius: 16px;
    background-color: #fff;
    counter-increment: step;
}

.flow-step::before {
    content: counter(step, decimal-leading-zero);
    position: absolute;
    top: 20px;
    right: 22px;
    color: rgba(52, 181, 116, 0.35);
    font-size: 1.6rem;
    font-weight: 700;
}

.flow-step__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin-bottom: 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, #34B574, #3691C8);
    color: #fff;
    font-size: 1.3rem;
}

.flow-step h3 {
    margin-bottom: 8px;
    font-size: 1.25rem;
    color: #1f2d27;
}

.flow-step p {
    margin: 0;
    color: #4a5a52;
    line-height: 1.7;
}


@media (max-width: 991px) {
    .flow__list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .flow {
        padding: 60px 0;
    }

    .flow__list {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Languages (js/i18n.js): the page stays hidden until it is translated */
html.i18n-pending body {
    visibility: hidden;
}

html[lang="zh-Hans"] {
    --font-family: 'Noto Sans SC', 'Noto Sans TC', 'Microsoft YaHei', sans-serif;
}

/* the contact page lists the English address under the Chinese one */
html[lang="en"] .contact-details .address-text br,
html[lang="en"] .contact-details .address-text small {
    display: none;
}

header .container > #main-nav {
    margin-left: auto;
}

.lang-switch {
    position: relative;
    margin-left: 18px;
}

.lang-switch__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid rgba(52, 181, 116, 0.45);
    border-radius: 999px;
    background-color: #fff;
    color: #1f2d27;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.lang-switch__toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 1.6;
}

.lang-switch__toggle:hover,
.lang-switch__toggle[aria-expanded="true"] {
    background-color: #f0f8f4;
    border-color: var(--primary-color);
}

.lang-switch__toggle:focus-visible,
.lang-switch__menu a:focus-visible {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

.lang-switch__menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1100;
    min-width: 150px;
    margin: 0;
    padding: 6px;
    list-style: none;
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.lang-switch__menu[hidden] {
    display: none;
}

.lang-switch__menu a {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: #1f2d27;
    font: inherit;
    font-size: 0.95rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.lang-switch__menu a:hover {
    background-color: #f0f8f4;
}

.lang-switch__menu a[aria-current="true"] {
    color: var(--primary-color);
    font-weight: 700;
}

/* English: the WeGrow logo already spells the name */
html[lang="en"] .logo-text {
    display: none;
}

/* Phones: languages move into the menu panel (row built by js/i18n.js) */
.lang-row {
    display: none;
}

@media (max-width: 768px) {
    .lang-switch {
        display: none;
    }

    #main-nav .main-menu > li.lang-row {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 20px;
        padding: 0 15px;
    }

    /* beats the menu's own #main-nav .main-menu > li > a link styles */
    #main-nav .main-menu > li.lang-row > a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 1 1 0;
        min-width: 92px;
        min-height: 44px;
        padding: 0 10px;
        border: 1px solid rgba(52, 181, 116, 0.45);
        border-radius: 999px;
        background-color: #fff;
        color: #1f2d27;
        font: inherit;
        font-size: 0.95rem;
        text-decoration: none;
        cursor: pointer;
    }

    #main-nav .main-menu > li.lang-row > a[aria-current="true"] {
        border-color: var(--primary-color);
        background-color: var(--primary-color);
        color: #fff;
        font-weight: 700;
    }

    #main-nav .main-menu > li.lang-row > a:focus-visible {
        outline: 3px solid var(--secondary-color);
        outline-offset: 2px;
    }

    #main-nav .main-menu > li.lang-row > a::after {
        display: none;
    }
}

/* the hero subtitle's two phrases need a space between them in English */
html[lang="en"] .hero-phrase:first-child {
    margin-right: 0.3em;
}

/* English hero title on phones: one word per line, no separators */
@media (max-width: 560px) {
    html[lang="en"] .hero-slide--tech .hero-word {
        display: block;
    }

    html[lang="en"] .hero-slide--tech .hero-sep {
        display: none;
    }
}

/* filter/tab buttons use the page font (browsers default buttons to a system font) */
.tab-btn,
.filter-btn {
    font-family: inherit;
}

/* Feature and certification cards: rows of four or two, never 3 + 1.
   Phones (under 600px) get one column. */
@media (max-width: 599px) {
    .feature-grid,
    .certification-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 600px) {
    .feature-grid,
    .certification-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .feature-grid,
    .certification-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Five feature cards: 3 + 2 on wide screens, 2 + 2 + 1 on tablets, with
   the short row centred. Each card spans two tracks. */
@media (min-width: 600px) {
    .feature-grid--5 {
        grid-template-columns: repeat(4, 1fr);
    }

    .feature-grid--5 > * {
        grid-column: span 2;
    }

    .feature-grid--5 > :last-child {
        grid-column: 2 / span 2;
    }
}

@media (min-width: 1200px) {
    .feature-grid--5 {
        grid-template-columns: repeat(6, 1fr);
    }

    .feature-grid--5 > :nth-child(4) {
        grid-column: 2 / span 2;
    }

    .feature-grid--5 > :last-child {
        grid-column: span 2;
    }
}

/* Animated page-header scenes on the activity pages (js/scenes.js): the
   canvas sits behind the header text. Water and mountain draw their own
   lower edge, so they drop the zigzag. */
.page-header--scene {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.scene-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.page-header--water,
.page-header--mountain {
    padding-bottom: 130px;
}

.page-header--water::after,
.page-header--mountain::after {
    display: none;
}

.page-header--water {
    background: linear-gradient(180deg, #2b9ad3 0%, #1670aa 100%);
}

.page-header--mountain {
    background: linear-gradient(180deg, #2b7cb8 0%, #3f98b0 50%, #5fb3a4 100%);
}

/* Links to a section (page.html#section) land at once instead of gliding
   down from the top, just below the sticky header (which is static on
   phones). In-page links scroll smoothly through js/main.js. */
html {
    scroll-padding-top: 100px;
}

@media (max-width: 768px) {
    html {
        scroll-padding-top: 16px;
    }
}

/* The card a link pointed to glows green for a moment, so visitors can
   see which one they came for. */
.program-card:target {
    animation: target-glow 2.4s ease-out 0.2s backwards;
}

@keyframes target-glow {
    0%,
    45% {
        box-shadow: 0 0 0 4px rgba(52, 181, 116, 0.6), 0 15px 30px rgba(0, 0, 0, 0.15);
    }
}

@media (prefers-reduced-motion: reduce) {
    .program-card:target {
        animation: none;
        box-shadow: 0 0 0 3px rgba(52, 181, 116, 0.6);
    }
}
