/*home.css*/

/* =========================================================
   HOME / LANDING PAGE
   ========================================================= */

.home-landing {
    width: 100%;
}


/* =========================================================
   ATOMIC MODEL HERO
   ========================================================= */

.atomic-history-copy {
    max-width: 560px;
}


.home-eyebrow {
    color: var(--color-accent);

    font-size: 13px;
    font-weight: 800;

    letter-spacing: 2px;

    margin-bottom: 14px;
}


.atomic-history-copy h1 {
    margin: 0 0 22px;

    font-size: clamp(38px, 5vw, 68px);
    line-height: 1.02;

    color: #fff;
}


.atomic-model-meta {
    display: flex;
    align-items: center;
    gap: 9px;

    margin-bottom: 10px;

    color: var(--color-text-muted);
    font-size: 15px;
}


.atomic-history-copy h2 {
    margin: 0 0 12px;

    color: var(--color-accent);

    font-size: 28px;
}


#atomicModelDescription {
    margin: 0;

    max-width: 520px;

    color: var(--color-text-muted);

    font-size: 17px;
    line-height: 1.65;
}



/* =========================================================
   MODEL DISPLAY
   ========================================================= */


.atomic-model-stage:hover {
    transform: translateY(-3px);

    border-color: rgba(238, 172, 96, 0.8);

    box-shadow:
        0 30px 70px rgba(0, 0, 0, 0.5),
        0 0 35px rgba(238, 172, 96, 0.08);
}


#atomicHistoryCanvas {
    display: block;

    width: 100%;
    height: 500px;

    background: transparent;
}


.atomic-click-hint {
    position: absolute;

    left: 50%;
    bottom: 22px;

    transform: translateX(-50%);

    color: rgba(255, 255, 255, 0.74);

    font-size: 13px;

    pointer-events: none;
}

.atomic-click-hint {
    width: min(calc(100% - 28px), 480px);

    text-align: center;

    line-height: 1.45;

    white-space: normal;

    overflow-wrap: break-word;
}

/* =========================================================
   MODEL PROGRESS
   ========================================================= */

.atomic-model-progress {
    display: flex;

    gap: 8px;

    margin: 28px 0 20px;
}


.atomic-progress-dot {
    width: 10px;
    height: 10px;

    border-radius: 999px;

    background: rgba(255, 255, 255, 0.18);

    transition:
        width 0.2s ease,
        background 0.2s ease;
}


.atomic-progress-dot.is-active {
    width: 30px;

    background: var(--color-accent);
}


.home-secondary-btn {
    border: 1px solid rgba(238, 172, 96, 0.55);
    border-radius: 10px;

    padding: 9px 14px;

    background: rgba(238, 172, 96, 0.08);

    color: var(--color-text);

    cursor: pointer;
}


.home-secondary-btn:hover {
    background: rgba(238, 172, 96, 0.18);
}


/* =========================================================
   SCROLL PROMPT
   ========================================================= */

.home-scroll-prompt {
    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 6px;

    margin: -30px auto 70px;

    color: var(--color-text-muted);

    font-size: 13px;

    text-decoration: none;
}


.home-scroll-prompt span {
    color: var(--color-accent);

    font-size: 24px;

    animation: homeArrowBounce 1.6s ease-in-out infinite;
}


@keyframes homeArrowBounce {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(6px);
    }
}

/* =========================================================
   LANDING PAGE - FLOATING ATOM / MATTER SCALE VIEWER
   ========================================================= */

.atomic-model-stage {
    position: relative;
    display: block;

    width: 100%;
    height: 420px;

    margin-top: 52px;
    padding: 0;

    border: 0;
    border-radius: 0;

    background: transparent;
    box-shadow: none;

    overflow: visible;

    cursor: pointer;

    /*
     * IMPORTANT:
     * The stage itself no longer floats.
     */
    animation: none;
    transform: none;
}


.atomic-model-stage:hover {
    transform: none;

    border-color: transparent;
    box-shadow: none;
}


#atomicHistoryCanvas {
    display: block;

    width: 100%;
    height: 100%;

    border: 0;
    border-radius: 0;

    background: transparent;

    filter:
        drop-shadow(
            0 20px 22px
            rgba(0, 0, 0, 0.28)
        );
}


/*
 * Only the ATOM-SCALE canvas moves.
 *
 * The surrounding stage, badge and buttons stay still.
 */

.atomic-model-stage.is-matter-mode[data-matter-scale="0"]
#atomicHistoryCanvas {
    animation:
        atomicCanvasFloat
        4.5s
        ease-in-out
        infinite;
}


@keyframes atomicCanvasFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

/* =========================================================
   ERNEST RUTHERFORD - GOLD FOIL EXPERIMENT
   ========================================================= */

.rutherford-foil-viewer {
    background:
        radial-gradient(
            circle at 55% 50%,
            rgba(238, 172, 96, 0.08),
            transparent 48%
        ),
        rgba(3, 5, 8, 0.82);
}


#rutherfordGoldFoilCanvas {
    display: block;

    width: 100%;
    height: 100%;
}


/* =========================================================
   RESULT COUNTERS
   ========================================================= */

.rutherford-result-grid {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 7px;

    grid-column: 1 / -1;
}


.rutherford-result {
    min-width: 0;

    padding: 10px 6px;

    border:
        1px solid
        rgba(255, 255, 255, 0.09);

    border-radius: 10px;

    background:
        rgba(255, 255, 255, 0.035);

    text-align: center;
}


.rutherford-result strong {
    display: block;

    margin-bottom: 4px;

    color:
        var(--color-accent);

    font-size: 20px;
}


.rutherford-result span {
    display: block;

    color:
        rgba(255, 255, 255, 0.54);

    font-size: 10px;
    line-height: 1.25;
}


@media (max-width: 580px) {

    .rutherford-result-grid {
        grid-template-columns:
            1fr;
    }

}

/* =========================================================
   LANDING PAGE - PERIODIC TABLE INTRO PUZZLE
   ========================================================= */

.periodic-puzzle-section {
    margin-top: 90px;
    padding: 60px 20px 90px;
}


.periodic-puzzle-heading {
    max-width: 760px;
    margin: 0 auto 36px;
    text-align: center;
}


.periodic-puzzle-heading h2 {
    margin: 8px 0 14px;

    color: #ffffff;

    font-size: clamp(2.2rem, 4vw, 3.8rem);
    line-height: 1;
}


.periodic-puzzle-heading p {
    margin: 0;

    color: var(--color-text-muted);

    font-size: 1rem;
    line-height: 1.65;
}


.periodic-puzzle-heading strong {
    color: var(--color-accent);
}


/* ---------------------------------------------------------
   Main layout
   --------------------------------------------------------- */

.periodic-puzzle-layout {
    display: grid;

    grid-template-columns:
        minmax(210px, 270px)
        minmax(0, 1fr);

    gap: 28px;

    max-width: 1180px;
    margin: 0 auto;

    align-items: start;
}


/* ---------------------------------------------------------
   Piece tray
   --------------------------------------------------------- */

.periodic-puzzle-piece-panel,
.periodic-puzzle-table-panel {
    border:
        1px solid
        rgba(238, 172, 96, 0.22);

    border-radius: 20px;

    background:
        linear-gradient(
            145deg,
            rgba(50, 37, 28, 0.72),
            rgba(15, 12, 10, 0.82)
        );
}


.periodic-puzzle-piece-panel {
    padding: 18px;
}


.periodic-puzzle-panel-title {
    color: #ffffff;

    font-size: 1.05rem;
    font-weight: 800;
}


.periodic-puzzle-small-text {
    margin: 7px 0 17px;

    color: rgba(255, 255, 255, 0.55);

    font-size: 0.78rem;
    line-height: 1.5;
}


.periodic-puzzle-pieces {
    display: flex;
    flex-direction: column;

    gap: 10px;
}


/* Individual draggable group */

.periodic-puzzle-piece {
    width: 100%;

    padding: 12px 13px;

    text-align: left;

    border:
        1px solid
        rgba(255, 170, 80, 0.28);

    border-radius: 12px;

    background:
        rgba(255, 145, 45, 0.07);

    color: #ffffff;

    cursor: grab;

    transition:
        transform 0.15s ease,
        border-color 0.15s ease,
        background 0.15s ease;
}


.periodic-puzzle-piece:hover {
    transform: translateY(-2px);

    border-color:
        rgba(255, 177, 95, 0.75);

    background:
        rgba(255, 145, 45, 0.13);
}


.periodic-puzzle-piece:active {
    cursor: grabbing;
}


.periodic-puzzle-piece.is-selected {
    border-color: var(--color-accent);

    background:
        rgba(238, 172, 96, 0.18);

    box-shadow:
        0 0 0 2px
        rgba(238, 172, 96, 0.10);
}


.periodic-puzzle-piece strong {
    display: block;

    margin-bottom: 6px;

    color: #ffc27d;

    font-size: 0.9rem;
}


.periodic-puzzle-piece span {
    color: rgba(255, 255, 255, 0.64);

    font-size: 0.78rem;
    line-height: 1.4;
}


/* ---------------------------------------------------------
   Table
   --------------------------------------------------------- */

.periodic-puzzle-table-panel {
    min-width: 0;

    padding: 22px;
}


.periodic-puzzle-table-scroll {
    overflow-x: auto;

    padding:
        30px
        6px
        12px;
}


.periodic-puzzle-board {
    --puzzle-cell: 43px;
    --puzzle-gap: 4px;

    display: grid;

    grid-template-columns:
        repeat(
            18,
            var(--puzzle-cell)
        );

    grid-template-rows:
        repeat(
            4,
            var(--puzzle-cell)
        );

    gap: var(--puzzle-gap);

    width: max-content;

    margin: 0 auto;

    position: relative;
}


/* ---------------------------------------------------------
   Empty target zones
   --------------------------------------------------------- */

.periodic-puzzle-slot {
    position: relative;

    display: flex;

    align-items: center;
    justify-content: center;

    min-width: 0;
    min-height: 0;

    border:
        1px dashed
        rgba(255, 255, 255, 0.22);

    border-radius: 8px;

    background:
        rgba(255, 255, 255, 0.025);

    transition:
        border-color 0.15s ease,
        background 0.15s ease,
        transform 0.15s ease;
}


.periodic-puzzle-slot::before {
    content: attr(data-target-label);

    position: absolute;

    top: -23px;
    left: 50%;

    transform: translateX(-50%);

    color:
        rgba(255, 190, 120, 0.72);

    font-size: 0.68rem;
    font-weight: 800;

    white-space: nowrap;
}


.periodic-puzzle-slot-hint {
    writing-mode: vertical-rl;

    color:
        rgba(255, 255, 255, 0.20);

    font-size: 0.58rem;

    text-transform: uppercase;

    letter-spacing: 0.08em;

    pointer-events: none;
}


.puzzle-slot-main
.periodic-puzzle-slot-hint {
    writing-mode: horizontal-tb;
}


.periodic-puzzle-slot.is-over {
    border-color: var(--color-accent);

    background:
        rgba(238, 172, 96, 0.12);
}


.periodic-puzzle-slot.is-wrong {
    border-color:
        rgba(230, 90, 75, 0.9);

    background:
        rgba(230, 90, 75, 0.10);

    animation:
        periodicPuzzleWrong
        0.28s ease;
}


@keyframes periodicPuzzleWrong {

    0%,
    100% {
        transform: translateX(0);
    }

    35% {
        transform: translateX(-5px);
    }

    70% {
        transform: translateX(5px);
    }

}


/* Correct zones */

.periodic-puzzle-slot.is-correct {
    border-style: solid;

    border-color:
        rgba(145, 210, 125, 0.52);

    background:
        rgba(100, 180, 90, 0.06);
}


/* ---------------------------------------------------------
   Correct periodic positions
   --------------------------------------------------------- */

.puzzle-slot-g1 {
    grid-column: 1;

    grid-row:
        1 / span 4;
}


.puzzle-slot-g2 {
    grid-column: 2;

    grid-row:
        2 / span 3;
}


.puzzle-slot-main {
    grid-column:
        13 / span 4;

    grid-row:
        2 / span 2;
}


.puzzle-slot-g17 {
    grid-column: 17;

    grid-row:
        2 / span 2;
}


.puzzle-slot-g18 {
    grid-column: 18;

    grid-row:
        1 / span 3;
}


/* ---------------------------------------------------------
   Transition metals hint
   --------------------------------------------------------- */

.periodic-puzzle-transition-note {
    grid-column:
        3 / span 10;

    grid-row: 4;

    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    border:
        1px dashed
        rgba(255, 255, 255, 0.08);

    border-radius: 8px;

    color:
        rgba(255, 255, 255, 0.28);

    font-size: 0.58rem;

    pointer-events: none;
}


.periodic-puzzle-transition-note strong {
    color:
        rgba(255, 190, 120, 0.40);

    font-size: 0.63rem;
}


/* ---------------------------------------------------------
   Elements after a group is correctly placed
   --------------------------------------------------------- */

.periodic-puzzle-filled-grid {
    display: grid;

    grid-template-columns:
        repeat(
            var(--puzzle-columns),
            1fr
        );

    gap: var(--puzzle-gap);

    width: 100%;
    height: 100%;
}


.periodic-puzzle-element {
    position: relative;

    display: flex;

    align-items: center;
    justify-content: center;

    border:
        1px solid
        rgba(255, 188, 110, 0.30);

    border-radius: 7px;

    background:
        linear-gradient(
            145deg,
            rgba(238, 150, 70, 0.18),
            rgba(90, 55, 30, 0.12)
        );

    color: #ffffff;
}


.periodic-puzzle-element-number {
    position: absolute;

    top: 3px;
    left: 4px;

    color:
        rgba(255, 255, 255, 0.45);

    font-size: 0.47rem;
}


.periodic-puzzle-element-symbol {
    font-size: 0.82rem;
    font-weight: 800;
}


/* ---------------------------------------------------------
   Bottom information
   --------------------------------------------------------- */

.periodic-puzzle-footer {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-top: 24px;

    padding-top: 18px;

    border-top:
        1px solid
        rgba(255, 255, 255, 0.08);
}


#periodicPuzzleProgress {
    color: #ffffff;

    font-size: 0.9rem;
}


.periodic-puzzle-status {
    margin: 5px 0 0;

    max-width: 540px;

    color:
        rgba(255, 255, 255, 0.58);

    font-size: 0.78rem;
    line-height: 1.45;
}


.periodic-puzzle-actions {
    display: flex;

    gap: 9px;

    flex-wrap: wrap;

    justify-content: flex-end;
}


.periodic-puzzle-continue {
    border: 1px solid var(--color-accent);
    border-radius: 10px;

    padding: 10px 14px;

    background: var(--color-accent);

    color: #221309;

    font-weight: 800;

    cursor: pointer;
}


.periodic-puzzle-continue:hover {
    filter: brightness(1.08);
}


/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 900px) {

    .periodic-puzzle-layout {
        grid-template-columns: 1fr;
    }


    .periodic-puzzle-pieces {
        display: grid;

        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

}


@media (max-width: 560px) {

    .periodic-puzzle-section {
        padding-left: 10px;
        padding-right: 10px;
    }


    .periodic-puzzle-pieces {
        grid-template-columns: 1fr;
    }


    .periodic-puzzle-table-panel {
        padding: 14px;
    }


    .periodic-puzzle-footer {
        align-items: flex-start;
        flex-direction: column;
    }


    .periodic-puzzle-actions {
        justify-content: flex-start;
    }

}



/* =========================================================
   J. J. THOMSON - CATHODE RAY EXPERIMENT
   ========================================================= */

.thomson-crt-section {
    margin: 38px 0 80px;

    padding: 28px;

    border:
        1px solid
        rgba(238, 172, 96, 0.22);

    border-radius: 24px;

    background:
        linear-gradient(
            145deg,
            rgba(50, 34, 24, 0.58),
            rgba(12, 10, 9, 0.82)
        );
}


/* =========================================================
   HEADING
   ========================================================= */

.thomson-crt-heading {
    max-width: 720px;

    margin-bottom: 26px;
}


.thomson-crt-heading h2 {
    margin: 4px 0 12px;

    color: #ffffff;

    font-size:
        clamp(
            2rem,
            4vw,
            3.3rem
        );

    line-height: 1.05;
}


.thomson-crt-heading p {
    margin: 0;

    color:
        rgba(
            255,
            255,
            255,
            0.68
        );

    line-height: 1.65;
}


/* =========================================================
   EXPERIMENT LAYOUT
   ========================================================= */

.thomson-crt-layout {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        310px;

    gap: 22px;

    align-items: start;
}


/* =========================================================
   VIEWER
   ========================================================= */

.thomson-crt-viewer {
    position: relative;

    min-width: 0;

    height: 480px;

    overflow: hidden;

    border:
        1px solid
        rgba(160, 200, 255, 0.18);

    border-radius: 20px;

    background:
        radial-gradient(
            circle at 50% 45%,
            rgba(80, 135, 190, 0.10),
            transparent 55%
        ),
        rgba(3, 5, 8, 0.82);
}


#thomsonCrtCanvas {
    display: block;

    width: 100%;
    height: 100%;
}


/* =========================================================
   DRAGGABLE MAGNET
   ========================================================= */

.thomson-crt-magnet {
    position: absolute;

    top: 88%;
    left: 54%;

    transform:
        translate(
            -50%,
            -50%
        );

    display: grid;

    grid-template-columns:
        1fr
        1fr;

    width: 82px;
    height: 58px;

    overflow: hidden;

    border:
        2px solid
        rgba(255, 255, 255, 0.65);

    border-radius: 10px;

    box-shadow:
        0 10px 22px
        rgba(0, 0, 0, 0.45);

    cursor: ew-resize;

    touch-action: none;

    user-select: none;

    z-index: 5;
}


.thomson-crt-magnet:hover {
    transform:
        translate(-50%, -50%);

    box-shadow:
        0 12px 28px
        rgba(0, 0, 0, 0.55),
        0 0 14px
        rgba(255, 255, 255, 0.10);
}


.thomson-crt-magnet:focus-visible {
    outline:
        3px solid
        rgba(238, 172, 96, 0.85);

    outline-offset: 4px;
}


.thomson-crt-magnet-pole {
    display: flex;

    align-items: center;
    justify-content: center;

    color: #ffffff;

    font-size: 20px;
    font-weight: 900;
}


.thomson-crt-magnet-pole.is-north {
    background:
        linear-gradient(
            145deg,
            #d96b5c,
            #85352d
        );
}


.thomson-crt-magnet-pole.is-south {
    background:
        linear-gradient(
            145deg,
            #5579a7,
            #263e61
        );
}


.thomson-crt-drag-hint {
    position: absolute;

    left: 50%;
    bottom: 9px;

    transform:
        translateX(-50%);

    width: max-content;
    max-width: 80%;

    text-align: center;

    color:
        rgba(
            255,
            255,
            255,
            0.48
        );

    font-size: 11px;

    pointer-events: none;
}


/* =========================================================
   CONTROLS
   ========================================================= */

.thomson-crt-controls {
    display: flex;

    flex-direction: column;

    gap: 14px;

    padding: 18px;

    border:
        1px solid
        rgba(238, 172, 96, 0.18);

    border-radius: 18px;

    background:
        rgba(
            10,
            8,
            7,
            0.58
        );
}


.thomson-crt-control label {
    display: block;

    margin-bottom: 6px;

    color:
        rgba(
            255,
            255,
            255,
            0.68
        );

    font-size: 12px;
    font-weight: 700;
}


.thomson-crt-control select {
    width: 100%;

    padding: 9px 10px;

    border:
        1px solid
        rgba(238, 172, 96, 0.32);

    border-radius: 9px;

    background:
        rgba(
            7,
            7,
            7,
            0.82
        );

    color: #ffffff;
}


.thomson-crt-control input[type="range"] {
    width: 100%;

    accent-color:
        var(--color-accent);
}


.thomson-crt-button,
.thomson-crt-video-button {
    width: 100%;
}


/* =========================================================
   OBSERVATION
   ========================================================= */

.thomson-crt-observation {
    padding: 13px;

    border:
        1px solid
        rgba(120, 220, 180, 0.18);

    border-radius: 12px;

    background:
        rgba(90, 180, 140, 0.06);
}


.thomson-crt-observation strong {
    display: block;

    margin-bottom: 6px;

    color: #aff2cf;

    font-size: 12px;

    text-transform: uppercase;

    letter-spacing: 0.08em;
}


.thomson-crt-observation p {
    margin: 0;

    color:
        rgba(
            255,
            255,
            255,
            0.69
        );

    font-size: 12px;
    line-height: 1.5;
}


/* =========================================================
   CONCLUSION
   ========================================================= */

.thomson-crt-conclusion {
    padding-top: 14px;

    border-top:
        1px solid
        rgba(
            255,
            255,
            255,
            0.08
        );
}


.thomson-crt-conclusion span {
    color:
        var(--color-accent);

    font-size: 10px;
    font-weight: 900;

    letter-spacing: 0.12em;
}


.thomson-crt-conclusion p {
    margin: 6px 0 0;

    color:
        rgba(
            255,
            255,
            255,
            0.64
        );

    font-size: 12px;
    line-height: 1.55;
}


.thomson-crt-visual-note {
    margin:
        12px
        0
        0;

    color:
        rgba(
            255,
            255,
            255,
            0.36
        );

    font-size: 10px;

    text-align: right;
}


/* =========================================================
   VIDEO PANEL
   ========================================================= */

.thomson-crt-video-panel {
    margin-top: 22px;

    padding: 18px;

    border:
        1px solid
        rgba(238, 172, 96, 0.22);

    border-radius: 18px;

    background:
        rgba(
            7,
            6,
            5,
            0.86
        );
}


.thomson-crt-video-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 14px;
}


.thomson-crt-video-header > div {
    display: flex;

    flex-direction: column;

    gap: 3px;
}


.thomson-crt-video-header strong {
    color: #ffffff;
}


.thomson-crt-video-header span {
    color:
        rgba(
            255,
            255,
            255,
            0.52
        );

    font-size: 12px;
}


#closeThomsonCrtVideoBtn {
    width: 38px;
    height: 38px;

    flex: 0 0 38px;

    border:
        1px solid
        rgba(255, 255, 255, 0.15);

    border-radius: 50%;

    background:
        rgba(
            255,
            255,
            255,
            0.06
        );

    color: #ffffff;

    font-size: 24px;

    cursor: pointer;
}


#closeThomsonCrtVideoBtn:hover {
    background:
        rgba(
            255,
            255,
            255,
            0.13
        );
}


.thomson-crt-video-frame {
    overflow: hidden;

    aspect-ratio: 16 / 9;

    border-radius: 14px;

    background: #000000;
}


.thomson-crt-video-frame iframe {
    display: block;

    width: 100%;
    height: 100%;

    border: 0;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 900px) {

    .thomson-crt-layout {
        grid-template-columns:
            1fr;
    }


    .thomson-crt-controls {
        display: grid;

        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }


    .thomson-crt-observation,
    .thomson-crt-conclusion,
    .thomson-crt-video-button {
        grid-column:
            1 / -1;
    }

}


@media (max-width: 580px) {

    .thomson-crt-section {
        padding: 17px;
    }


    .thomson-crt-viewer {
        height: 400px;
    }


    #thomsonCrtCanvas {
        height: 100%;
    }


    .thomson-crt-controls {
        grid-template-columns:
            1fr;
    }


    .thomson-crt-observation,
    .thomson-crt-conclusion,
    .thomson-crt-video-button {
        grid-column: auto;
    }


    .thomson-crt-magnet {
        width: 70px;
        height: 52px;
    }

}

/* =========================================================
   HOME PAGE - TABLET / MOBILE
   ========================================================= */

@media (max-width: 980px) {

    /*
     * Prevent the page itself from becoming wider
     * than the phone screen.
     *
     * Individual components such as the periodic-table
     * puzzle can still scroll internally.
     */
    .home-landing {
        width: 100%;
        max-width: 100%;
    }


    /* =====================================================
       ATOMIC MODEL HERO
       ===================================================== */

    .atomic-history-hero {
        width: 100%;
        max-width: 100%;

        padding-left: 24px;
        padding-right: 24px;

        box-sizing: border-box;
    }


    .atomic-hero-main {
        display: grid;

        grid-template-columns: 1fr;

        gap: 24px;
    }


    .atomic-history-copy {
        width: 100%;
        max-width: none;
        min-width: 0;
    }


    .atomic-model-stage {
        width: min(100%, 520px);

        aspect-ratio: 700 / 420;

        height: auto;
        min-height: 0;

        margin:
            10px
            auto
            20px;
    }


    #atomicHistoryCanvas {
        display: block;

        width: 100%;
        height: 100%;

        max-width: 100%;
    }


    /* =====================================================
       ATOMIC HISTORY CARD
       ===================================================== */

    .atomic-model-history-card {
        min-width: 0;
    }


    /* =====================================================
       THOMSON / RUTHERFORD EXPERIMENTS
       ===================================================== */

    .thomson-crt-section {
        width: auto;

        margin:
            36px
            16px
            60px;

        padding: 22px;

        box-sizing: border-box;
    }


    .thomson-crt-layout {
        grid-template-columns: 1fr;

        gap: 18px;
    }


    .thomson-crt-viewer {
        width: 100%;

        height: clamp(
            320px,
            65vw,
            430px
        );
    }


    .thomson-crt-controls {
        display: grid;

        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );

        gap: 12px;
    }


    .thomson-crt-observation,
    .thomson-crt-conclusion,
    .thomson-crt-video-button {
        grid-column: 1 / -1;
    }


    /* =====================================================
       PERIODIC TABLE PUZZLE
       ===================================================== */

    .periodic-puzzle-section {
        margin-top: 60px;

        padding:
            50px
            18px
            70px;
    }


    .periodic-puzzle-layout {
        grid-template-columns: 1fr;

        gap: 18px;
    }


    .periodic-puzzle-table-panel {
        min-width: 0;
    }


    /*
     * The simplified periodic table is intentionally
     * wider than a phone screen.
     *
     * Scroll only this section instead of widening
     * the entire webpage.
     */
    .periodic-puzzle-table-scroll {
        width: 100%;

        overflow-x: auto;
        overflow-y: hidden;

        overscroll-behavior-x: contain;

        -webkit-overflow-scrolling: touch;
    }


    /* =====================================================
       CURRICULUM / CONTENTS
       ===================================================== */

    .chemistry-contents {
        width: 100%;
        max-width: 100%;

        box-sizing: border-box;
    }


    .curriculum-columns {
        grid-template-columns: 1fr;

        gap: 24px;
    }


    .curriculum-year,
    #form4Contents,
    #form5Contents {
        min-width: 0;
        width: 100%;
    }
}


/* =========================================================
   PHONES
   ========================================================= */

@media (max-width: 600px) {

    /* =====================================================
       GENERAL
       ===================================================== */

    .home-landing {
        width: 100%;
    }


    .home-eyebrow {
        margin-bottom: 10px;

        font-size: 11px;

        letter-spacing: 1.4px;
    }


    /* =====================================================
       ATOMIC MODEL HERO
       ===================================================== */

    .atomic-history-hero {
        padding-left: 14px;
        padding-right: 14px;
    }


    .atomic-hero-main {
        gap: 18px;
    }


    .atomic-history-copy h1 {
        margin-bottom: 16px;

        font-size:
            clamp(
                2rem,
                10vw,
                3rem
            );

        line-height: 1.06;
    }


    .atomic-model-meta {
        flex-wrap: wrap;

        gap: 6px;

        font-size: 13px;
    }


    .atomic-history-copy h2 {
        margin-bottom: 10px;

        font-size: 23px;

        line-height: 1.2;
    }


    #atomicModelDescription {
        font-size: 15px;

        line-height: 1.55;
    }


    /* =====================================================
       SCIENTIST / HISTORY CARD
       ===================================================== */

    .atomic-model-history-card {
        grid-template-columns: 1fr;

        gap: 16px;
    }


    .atomic-scientist-portrait-wrap {
        width: 100%;
        max-width: none;
    }


    .atomic-scientist-portrait {
        max-width: 150px;
    }

    .rutherford-foil-viewer {
        max-width: 340px;

        margin-left: auto;
        margin-right: auto;
    }


    .thomson-crt-viewer {
        width: 100%;
        max-width: 310px;

        /*
        * Give the mobile experiment more vertical room.
        * Do not use the very wide desktop ratio here.
        */
        aspect-ratio: 16 / 9;

        height: auto;

        margin-left: auto;
        margin-right: auto;
    }

    /* =====================================================
    ATOM MODEL VIEWER - MOBILE
    ===================================================== */

    .atomic-model-stage {
        width: min(100%, 320px);

        /*
        * Original canvas:
        * 700 × 420
        *
        * Preserve that shape instead of forcing
        * the canvas into a tall mobile box.
        */
        aspect-ratio: 700 / 420;

        height: auto;
        min-height: 0;

        margin:
            8px
            auto
            18px;

        overflow: visible;
    }


    #atomicHistoryCanvas {
        display: block;

        width: 100%;
        height: 100%;

        max-width: 100%;
    }


    .atomic-click-hint {
        bottom: 10px;

        width: calc(100% - 28px);

        text-align: center;

        font-size: 11px;

        white-space: normal;
    }


    .atomic-model-progress {
        margin:
            20px
            0
            16px;

        overflow-x: auto;

        padding-bottom: 3px;
    }


    /* =====================================================
       BUTTONS
       Make them easier to tap.
       ===================================================== */

    .home-secondary-btn,
    .periodic-puzzle-continue,
    .thomson-crt-button,
    .thomson-crt-video-button {
        min-height: 44px;
    }


    /* =====================================================
       THOMSON / RUTHERFORD EXPERIMENT
       ===================================================== */

    .thomson-crt-section {
        margin:
            28px
            10px
            50px;

        padding: 14px;

        border-radius: 16px;
    }


    .thomson-crt-heading {
        margin-bottom: 18px;
    }


    .thomson-crt-heading h2 {
        font-size:
            clamp(
                1.8rem,
                8vw,
                2.5rem
            );
    }


    .thomson-crt-heading p {
        font-size: 14px;

        line-height: 1.55;
    }


    /* =====================================================
    SCIENTIST EXPERIMENT VIEWERS - MOBILE
    ===================================================== */

    .thomson-crt-viewer {
        width: 100%;
        height: auto;

        /*
        * Thomson canvas is 960 × 390.
        */
        aspect-ratio: 960 / 390;

        border-radius: 14px;

        overflow: hidden;
    }


    /*
    * Rutherford uses a different canvas size:
    * 960 × 480
    */
    .rutherford-foil-viewer {
        width: 100%;
        height: auto;

        aspect-ratio: 960 / 480;
    }


    #thomsonCrtCanvas,
    #rutherfordGoldFoilCanvas {
        display: block;

        width: 100%;
        height: 100%;
    }


    /*
     * Put experiment controls one per row on phones.
     */
    .thomson-crt-controls {
        display: grid;

        grid-template-columns: 1fr;

        gap: 10px;

        padding: 13px;

        border-radius: 14px;
    }


    .thomson-crt-observation,
    .thomson-crt-conclusion,
    .thomson-crt-video-button {
        grid-column: auto;
    }


    /*
     * 16px is important on phones because iOS browsers
     * may zoom into smaller select/input text.
     */
    .thomson-crt-control select {
        min-height: 44px;

        padding:
            10px
            11px;

        font-size: 16px;
    }


    .thomson-crt-control input[type="range"] {
        min-height: 36px;
    }


    .thomson-crt-button,
    .thomson-crt-video-button {
        width: 100%;

        padding:
            11px
            14px;
    }


    .thomson-crt-magnet {
        width: 36px;
        height: 28px;

        border-width: 1px;
        border-radius: 5px;
    }


    .thomson-crt-magnet-pole {
        font-size: 10px;
    }


    .thomson-crt-drag-hint {
        display: none;
    }


    /* =====================================================
       RUTHERFORD RESULTS
       Keep counters compact instead of three tall cards.
       ===================================================== */

    .rutherford-result-grid {
        grid-template-columns:
            repeat(
                3,
                minmax(0, 1fr)
            );

        gap: 5px;
    }


    .rutherford-result {
        padding:
            9px
            4px;
    }


    .rutherford-result strong {
        font-size: 18px;
    }


    .rutherford-result span {
        font-size: 9px;
    }


    /* =====================================================
   PERIODIC TABLE PUZZLE - MOBILE
   ===================================================== */

.periodic-puzzle-section {
    width: 100%;
    max-width: 100%;

    margin-top: 45px;

    padding:
        42px
        10px
        55px;

    box-sizing: border-box;
}


.periodic-puzzle-heading {
    width: 100%;
    max-width: 100%;

    margin-bottom: 24px;

    padding:
        0
        5px;

    box-sizing: border-box;
}


.periodic-puzzle-heading h2 {
    font-size:
        clamp(
            1.9rem,
            9vw,
            2.8rem
        );

    line-height: 1.05;
}


.periodic-puzzle-heading p {
    font-size: 14px;
    line-height: 1.55;
}


/* Main puzzle wrapper */

.periodic-puzzle-layout {
    display: block;

    width: 100%;
    max-width: 100%;

    box-sizing: border-box;
}


/* =====================================================
   MISSING GROUPS
   ===================================================== */

.periodic-puzzle-piece-panel {
    width: 100%;
    max-width: 100%;

    margin-bottom: 14px;

    padding: 14px;

    box-sizing: border-box;

    overflow: hidden;

    border-radius: 14px;
}


.periodic-puzzle-panel-title {
    font-size: 1rem;
}


.periodic-puzzle-small-text {
    width: 100%;

    white-space: normal;

    overflow-wrap: break-word;

    font-size: 12px;
}


/*
 * Do NOT make this horizontally scroll.
 *
 * Put the available groups in two columns instead.
 */

.periodic-puzzle-pieces {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 8px;

    width: 100%;

    overflow: visible;

    padding: 0;
}


.periodic-puzzle-piece {
    width: 100%;
    min-width: 0;

    padding:
        11px
        10px;

    box-sizing: border-box;

    white-space: normal;
}


.periodic-puzzle-piece strong {
    font-size: 0.82rem;

    line-height: 1.25;
}


.periodic-puzzle-piece span {
    font-size: 0.7rem;

    line-height: 1.35;
}


/* =====================================================
   TABLE PANEL
   ===================================================== */

.periodic-puzzle-table-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;

    padding: 10px;

    box-sizing: border-box;

    overflow: hidden;

    border-radius: 14px;
}


/*
 * THIS is the only area that should scroll horizontally.
 */

.periodic-puzzle-table-scroll {
    display: block;

    width: 100%;
    max-width: 100%;

    margin: 0;

    padding:
        30px
        0
        14px;

    box-sizing: border-box;

    overflow-x: auto;
    overflow-y: hidden;

    -webkit-overflow-scrolling: touch;

    overscroll-behavior-x: contain;

    scrollbar-width: thin;
    scrollbar-color:
        rgba(238, 172, 96, 0.75)
        rgba(255, 255, 255, 0.06);
}


/* Chrome / Edge / Safari scrollbar */

.periodic-puzzle-table-scroll::-webkit-scrollbar {
    height: 8px;
}


.periodic-puzzle-table-scroll::-webkit-scrollbar-track {
    background:
        rgba(255, 255, 255, 0.05);

    border-radius: 999px;
}


.periodic-puzzle-table-scroll::-webkit-scrollbar-thumb {
    background:
        rgba(238, 172, 96, 0.75);

    border-radius: 999px;
}


/*
 * Keep the actual periodic table wide.
 *
 * It should scroll INSIDE its panel rather than
 * making the entire webpage wider.
 */

.periodic-puzzle-board {
    --puzzle-cell: 40px;
    --puzzle-gap: 3px;

    width: max-content;

    margin:
        0
        8px;
}


/* =====================================================
   PUZZLE FOOTER
   ===================================================== */

.periodic-puzzle-footer {
    display: flex;

    flex-direction: column;

    align-items: stretch;

    width: 100%;

    gap: 14px;

    margin-top: 17px;

    padding-top: 14px;

    box-sizing: border-box;
}


.periodic-puzzle-footer > div {
    width: 100%;
    min-width: 0;
}


#periodicPuzzleProgress {
    display: block;

    width: 100%;
}


.periodic-puzzle-status {
    width: 100%;
    max-width: 100%;

    white-space: normal;

    overflow-wrap: break-word;
}


/* Buttons */

.periodic-puzzle-actions {
    display: grid;

    grid-template-columns: 1fr;

    width: 100%;
    max-width: 100%;

    gap: 8px;

    box-sizing: border-box;
}


.periodic-puzzle-actions button {
    display: block;

    width: 100%;
    max-width: 100%;

    min-height: 44px;

    padding:
        10px
        12px;

    box-sizing: border-box;

    white-space: normal;

    text-align: center;
}


    /* =====================================================
       SCROLL PROMPT
       ===================================================== */

    .home-scroll-prompt {
        margin:
            20px
            auto
            50px;
    }


    /* =====================================================
       CURRICULUM
       ===================================================== */

    .contents-heading {
        padding:
            0
            14px;
    }


    .contents-heading h2 {
        font-size:
            clamp(
                1.9rem,
                9vw,
                2.8rem
            );

        line-height: 1.08;
    }


    .contents-heading p {
        font-size: 14px;

        line-height: 1.55;
    }


    .curriculum-columns {
        grid-template-columns: 1fr;

        gap: 18px;
    }


    .curriculum-year {
        width: 100%;
        min-width: 0;
    }
}


/* =========================================================
   VERY SMALL PHONES
   ========================================================= */

@media (max-width: 400px) {

    .atomic-history-hero {
        padding-left: 10px;
        padding-right: 10px;
    }


    .atomic-history-copy h1 {
        font-size: 1.95rem;
    }

    .thomson-crt-section {
        margin-left: 6px;
        margin-right: 6px;

        padding: 11px;
    }

    .periodic-puzzle-section {
        padding-left: 6px;
        padding-right: 6px;
    }


    .periodic-puzzle-board {
        --puzzle-cell: 38px;
        --puzzle-gap: 3px;
    }

}


/* =========================================================
   MATTER SCALE VIEWER - CAPTION SPACING
   ========================================================= */

@media (max-width: 980px) {

    .atomic-model-stage.is-matter-mode {

        height: 410px;

        aspect-ratio: auto;

    }

}

@media (max-width: 600px) {

    .atomic-model-stage.is-matter-mode {

        height: 390px;

        aspect-ratio: auto;

    }

    .atomic-click-hint {

        width: calc(100% - 28px);

        bottom: 10px;

        font-size: 11px;

        line-height: 1.45;

    }

}
