/* ==========================================================
   OVERRIDE BASE.CSS LAYOUT CONSTRAINTS
========================================================== */

.tiles-container,
.container {
    width: 100% !important;
    max-width: none !important;

    padding: 0 !important;
    margin: 0 !important;

    box-sizing: border-box !important;

    display: block !important;
}


/* ==========================================================
   STUDENT WELLBEING PAGE
========================================================== */

.student-wellbeing-page {
    width: 100%;

    margin: 0;
    padding: 0;

    background: #ffffff;

    color: #14223a;

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    overflow-x: hidden;
}


/* ==========================================================
   INNER CONTAINER
========================================================== */

.student-wellbeing-inner {
    width: min(1180px, calc(100% - 40px));

    margin: 0 auto;

    padding: 0 0 42px;

    box-sizing: border-box;
}


/* ==========================================================
   HEADER
========================================================== */

.wellbeing-header {
    width: 100%;

    margin: 0 auto 38px;
    padding: 0;

    text-align: center;
}


/* Exact title styling requested */
.wellbeing-header h1 {
    font-size: 30px;
    color: #2e7d32;
    margin: 0;
    /* 0 top/bottom, 10px left/right */
    padding: 0 30px;
    font-weight: 800;
    text-align: center;
    font-family:
        "Playfair Display",
        "Georgia",
        "Times New Roman",
        serif;
    letter-spacing: 0.3px;
    line-height: 1.25;
}


/* ==========================================================
   EMOTION CARD CONTAINER

   Flex is used rather than Grid so incomplete rows are
   automatically centred.

   Example:
   Row 1: 6 cards
   Row 2: 4 cards centred
========================================================== */

.emotion-grid {
    display: flex;

    flex-wrap: wrap;

    justify-content: center;

    align-items: stretch;

    gap: 18px;

    width: 100%;

    margin: 0 auto;

    box-sizing: border-box;
}


/* ==========================================================
   EMOTION CARDS
========================================================== */

.emotion-card {
    --card-bg: #efedff;
    --arrow-bg: #d9d4ff;
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    flex-direction: column;
    align-items: center;

    /*
     * 180px is the preferred card width.
     * Cards can grow slightly where appropriate.
     */

    flex:
        1 1
        180px;
    width: 180px;
    max-width: 190px;
    min-width: 170px;
    min-height: 270px;
    margin: 0;
    padding:
        26px 16px
        18px;

    border: 2px solid transparent;
    border-radius: 17px;
    background: var(--card-bg);
    color: #15223a;
    font: inherit;
    text-align: center;
    cursor: pointer;
    overflow: hidden;
    box-sizing: border-box;
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        border-color 180ms ease;
}


/* ==========================================================
   CARD COLOURS
========================================================== */

.emotion-purple {
    --card-bg: #efedff;
    --arrow-bg: #d9d5ff;
}


.emotion-pink {
    --card-bg: #ffe9e5;
    --arrow-bg: #ffcfc4;
}


.emotion-orange {
    --card-bg: #fff0df;
    --arrow-bg: #ffd4a1;
}


.emotion-blue {
    --card-bg: #e2f0ff;
    --arrow-bg: #bcdcff;
}


.emotion-grey {
    --card-bg: #edf1f5;
    --arrow-bg: #d0dce7;
}


.emotion-yellow {
    --card-bg: #fff3da;
    --arrow-bg: #ffe09e;
}


/* ==========================================================
   CARD HOVER

   Only the CARD moves vertically.

   The arrow circle itself does NOT move.
========================================================== */

@media (hover: hover) and (pointer: fine) {
    .emotion-card:hover {
        transform: translateY(-5px);

        box-shadow:
            0 14px 28px
            rgba(30, 47, 70, 0.11);
    }
}


/* ==========================================================
   KEYBOARD FOCUS
========================================================== */

.emotion-card:focus-visible {
    outline: none;

    border-color: #4d678d;

    box-shadow:
        0 0 0 4px
        rgba(77, 103, 141, 0.18);
}


/* ==========================================================
   EMOJI

   Kept at the existing size as requested.
========================================================== */

.emotion-emoji {
    display: block;

    margin-bottom: 16px;

    font-size: 3.5rem;

    line-height: 1;
}


/* ==========================================================
   EMOTION TITLE

   Increased from the previous size.
========================================================== */

.emotion-title {
    display: block;

    margin-bottom: 9px;

    color: #17243b;

    font-size: 1.2rem;

    font-weight: 800;

    line-height: 1.25;
}


/* ==========================================================
   EMOTION DESCRIPTION

   Increased from the previous size.
========================================================== */

.emotion-description {
    display: block;

    width: 100%;

    max-width: 165px;

    margin: 0 auto;

    color: #526075;

    font-size: 0.98rem;

    line-height: 1.5;

    overflow-wrap: break-word;
    word-wrap: break-word;
}

@media (min-width: 601px) {
    .emotion-description {
        font-weight: 450;
    }
}


/* ==========================================================
   ARROW

   No transform is applied on hover.
========================================================== */

.emotion-arrow {
    display: grid;

    place-items: center;

    width: 38px;

    height: 38px;

    flex:
        0 0
        38px;

    margin-top: auto;

    border-radius: 50%;

    background: var(--arrow-bg);

    color: #344861;

    font-size: 1.2rem;

    font-weight: 600;

    line-height: 1;

    /*
     * Explicitly prevent movement.
     */

    transform: none;

    transition:
        background-color 180ms ease,
        box-shadow 180ms ease;
}


/*
 * Explicitly override any old/base hover rules that may
 * attempt to move the arrow.
 */

.emotion-card:focus .emotion-arrow,
.emotion-card:focus-visible .emotion-arrow {
    transform: none !important;
}


@media (hover: hover) and (pointer: fine) {
    .emotion-card:hover .emotion-arrow {
        transform: none !important;
    }
}


/* ==========================================================
   BOTTOM WELLBEING MESSAGE
========================================================== */

.wellbeing-bottom-message {
    display: flex;

    align-items: center;

    gap: 20px;

    width: 100%;

    max-width: 100%;

    min-width: 0;

    min-height: 100px;

    margin:
        35px auto
        0;

    padding: 22px 28px;

    border-radius: 17px;

    background: #e7f4f2;

    box-sizing: border-box;

    overflow: hidden;
}


/* ==========================================================
   LEAF
========================================================== */

.wellbeing-leaf {
    flex: 0 0 auto;

    font-size: 2.5rem;

    line-height: 1;
}


/* ==========================================================
   BOTTOM MESSAGE TEXT
========================================================== */

.wellbeing-bottom-text {
    display: flex;

    flex:
        1 1
        auto;

    flex-direction: column;

    gap: 4px;

    /*
     * Important when this is a flex child.
     * Allows it to shrink rather than forcing overflow.
     */

    min-width: 0;

    max-width: 100%;
}


.wellbeing-bottom-text strong {
    display: block;

    max-width: 100%;

    color: #263d47;

    font-size: 0.98rem;

    font-weight: 800;

    line-height: 1.4;

    white-space: normal;

    overflow-wrap: anywhere;

    word-break: normal;
}


.wellbeing-bottom-text span {
    display: block;

    max-width: 100%;

    color: #5b7078;

    font-size: 0.85rem;

    line-height: 1.5;

    white-space: normal;

    overflow-wrap: anywhere;

    word-break: normal;
}

/* Increase font weight only on laptop/desktop devices */
@media (min-width: 601px) and (hover: hover) and (pointer: fine) {
    .wellbeing-bottom-text span {
        font-weight: 500;
    }
}


/* ==========================================================
   ENCOURAGEMENT
========================================================== */

.wellbeing-encouragement {
    flex: 0 0 auto;

    color: #527579;

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: 1.15rem;

    font-style: italic;

    white-space: nowrap;
}


/* ==========================================================
   TABLET
========================================================== */

@media (max-width: 850px) {

    .student-wellbeing-inner {
        width:
            min(
                calc(100% - 30px),
                1180px
            );

        padding:
            0 0
            35px;
    }


    .wellbeing-header {
        margin-bottom: 30px;
    }


    .emotion-grid {
        gap: 15px;
    }


    .emotion-card {
        flex:
            1 1
            170px;

        max-width: 200px;
    }


    .wellbeing-bottom-message {
        align-items: flex-start;
    }


    .wellbeing-encouragement {
        display: none;
    }
}


/* ==========================================================
   MOBILE

   EXACTLY TWO CARDS PER ROW
========================================================== */

@media (max-width: 600px) {

    .student-wellbeing-inner {
        width:
            calc(100% - 24px);

        max-width: 100%;

        padding:
            0 0
            calc(
                28px +
                env(safe-area-inset-bottom)
            );
    }


    /* ------------------------------------------
       Header
    ------------------------------------------ */

    .wellbeing-header {
        margin-bottom: 25px;
    }


    /*
     * Keep requested title appearance on mobile.
     * Slight reduction prevents very narrow phones
     * from creating horizontal overflow.
     */

    .wellbeing-header h1 {
        font-size: 25px;

        line-height: 1.2;

        overflow-wrap: break-word;
    }


    /* ------------------------------------------
       EXACTLY 2 CARDS PER ROW
    ------------------------------------------ */

    .emotion-grid {
        display: grid;

        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );

        gap: 12px;

        width: 100%;
    }


    /* ------------------------------------------
       Cards
    ------------------------------------------ */

    .emotion-card {
        width: 100%;

        max-width: none;

        min-width: 0;

        min-height: 250px;

        padding:
            19px 10px
            14px;

        border-radius: 15px;
    }


    /*
     * Emoji size remains unchanged from your
     * previous mobile styling.
     */

    .emotion-emoji {
        margin-bottom: 12px;

        font-size: 2.8rem;
    }


    /*
     * Text is larger than before.
     */

    .emotion-title {
        margin-bottom: 8px;

        font-size: 1.1rem;

        line-height: 1.25;
    }


    .emotion-description {
        width: 100%;

        max-width: 145px;

        font-size: 1rem;

        line-height: 1.45;
    }


    .emotion-arrow {
        width: 33px;

        height: 33px;

        flex-basis: 33px;

        font-size: 1rem;
    }


    /* ------------------------------------------
       Bottom message

       This layout prevents the message from
       overflowing narrow mobile screens.
    ------------------------------------------ */

    .wellbeing-bottom-message {
        display: grid;

        grid-template-columns:
            auto minmax(0, 1fr);

        align-items: start;

        gap: 12px;

        width: 100%;

        max-width: 100%;

        min-width: 0;

        margin:
            25px 0
            0;

        padding: 18px 16px;

        border-radius: 15px;

        box-sizing: border-box;

        overflow: hidden;
    }


    .wellbeing-leaf {
        font-size: 2rem;
    }


    .wellbeing-bottom-text {
        width: 100%;

        min-width: 0;

        max-width: 100%;
    }


    .wellbeing-bottom-text strong {
        width: 100%;

        max-width: 100%;

        font-size: 0.9rem;

        line-height: 1.4;

        white-space: normal;

        overflow-wrap: anywhere;
    }


    .wellbeing-bottom-text span {
        width: 100%;

        max-width: 100%;

        font-size: 0.8rem;

        line-height: 1.5;

        white-space: normal;

        overflow-wrap: anywhere;
    }


    .wellbeing-encouragement {
        display: none;
    }
}


/* ==========================================================
   VERY SMALL PHONES

   STILL EXACTLY TWO CARDS PER ROW
========================================================== */

@media (max-width: 370px) {

    .student-wellbeing-inner {
        width:
            calc(100% - 16px);
    }


    .wellbeing-header h1 {
        font-size: 22px;
    }


    .emotion-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );

        gap: 8px;
    }


    .emotion-card {
        min-height: 250px;

        padding:
            17px 7px
            12px;
    }


    /*
     * Keep emoji at previous small-phone size.
     */

    .emotion-emoji {
        font-size: 2.55rem;
    }


    /*
     * Still larger than the old text.
     */

    .emotion-title {
        font-size: 1rem;
    }


    .emotion-description {
        max-width: 130px;

        font-size: 0.9rem;

        line-height: 1.4;
    }


    .wellbeing-bottom-message {
        gap: 9px;

        padding: 15px 12px;
    }


    .wellbeing-leaf {
        font-size: 1.7rem;
    }


    .wellbeing-bottom-text strong {
        font-size: 0.84rem;
    }


    .wellbeing-bottom-text span {
        font-size: 0.74rem;
    }
}


/* ==========================================================
   REDUCED MOTION
========================================================== */

@media (prefers-reduced-motion: reduce) {

    .emotion-card,
    .emotion-arrow {
        transition: none;
    }
}