/* ---------------------------- Fonts -------------------------------*/
@import url('https://fonts.googleapis.com/css2?family=Boogaloo&family=Google+Sans:ital,opsz,wght@0,17..18,400..700;1,17..18,400..700&display=swap');



/* =====================================================
   RESET
===================================================== */

html {
    box-sizing: border-box;
}

*,
*:before,
*:after {
    box-sizing: inherit;
    text-decoration: none;
}

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
ul,
figure {
    margin: 0;
    padding: 0;
}

img {
    width: 100%;
}


/* =====================================================
   COLORS
===================================================== */

:root {
    --blickishhh: #444444;
    --bluishhh: #134287;
    --backgroundishhh: #EEEEEE;

    --light_background: #F6F6F6;
    --light_border: #D6D6D6;
    --gray_text: #707070;
}


/* =====================================================
   GENERAL
===================================================== */

body {
    background-color: white;
    color: black;

    font-family:
        "Google Sans",
        sans-serif;
}

.container {
    max-width: 64rem;
    width: 100%;

    margin: auto;

    padding:
        0 2rem;
}

#main {
    transition:
        transform 0.5s;
}

h1,
h2 {
    font-family:
        "Boogaloo",
        sans-serif;

    font-weight: 400;
}

h1 {
    font-size: 5rem;
    line-height: 1;
}

h2 {
    font-size: 3rem;
    line-height: 1.1;
}

h3 {
    font-size: 1.6rem;
}

p {
    font-size: 1.2rem;
    line-height: 1.65;
}

a {
    font-size: 1.35rem;
}


/* =====================================================
   NAVIGATION BAR
===================================================== */

#navbar {
    background-color: white;

    box-shadow:
        0px 0px 3px 0px var(--blickishhh);

    font-family: calibri;

    position: fixed;

    top: 0;

    width: 100%;

    display: block;

    transition:
        top 0.3s,
        margin-left 0.5s,
        width 0.5s;

    z-index: 10;
}

#navbar .navdiv {
    background-color: white;

    max-width: 60rem;
    width: 100%;

    margin: auto;

    display: flex;
}

#navbar .navdiv .logo_img {
    margin-top: 5px;

    width: 27px;
    height: 27px;

    margin-right: 3px;
}

#navbar .navdiv .logo a {
    font-size: 2rem;
    font-weight: 600;

    color: black;

    margin-right: 20px;
}

#navbar .navdiv ul {
    display: flex;

    list-style: none;

    margin-top: 10px;
    margin-left: auto;
}

#navbar .navdiv ul li a {
    color: black;

    font-size: 1.3rem;
    font-weight: bold;

    margin-right: 2.5rem;

    transition: 0.2s;
}

#navbar .navdiv ul li a:hover {
    font-size: 1.4rem;

    text-decoration: underline;
}


/* =====================================================
   MENU BUTTON
===================================================== */

.menu_btn {
    display: inline-block;

    cursor: pointer;

    margin-top: 5px;
}

.bar1,
.bar2,
.bar3 {
    width: 33px;
    height: 4.5px;

    background-color: #0c0c0c;

    margin: 4px 0;

    transition: 0.4s;
}

.menu_btn:hover .bar1,
.menu_btn:hover .bar2,
.menu_btn:hover .bar3 {
    background-color: #871b1b;

    width: 33px;
    height: 6px;

    margin-top: 3px;
    margin-bottom: 3px;
}

.change .bar1 {
    transform:
        translate(0, 9px) rotate(-45deg);
}

.change .bar2 {
    opacity: 0;
}

.change .bar3 {
    transform:
        translate(0, -9px) rotate(45deg);
}


/* =====================================================
   SIDEBAR
===================================================== */

.sidebar {
    height: 100%;

    width: 0;

    position: fixed;

    z-index: 20;

    top: 0;
    left: 0;

    background-color:
        var(--blickishhh);

    overflow-x: hidden;

    transition: 0.5s;

    padding-top: 60px;
}

.sidebar a {
    padding:
        8px 8px 8px 32px;

    font-size: 1.5rem;

    color: #818181;

    display: block;

    transition: 0.3s;
}

.sidebar a:hover {
    color: #f1f1f1;

    font-size: 1.8rem;
}

.sidebar .closebtn {
    position: absolute;

    top: 0;
    right: 25px;

    font-size: 4rem;

    margin-left: 50px;
}

.sidebar .closebtn:hover {
    font-size: 4.3rem;

    color: #f1f1f1;
}




/* ------------------------------------------------
   RESPONSIVE NAV LINKS INSIDE SIDEBAR
------------------------------------------------ */

#sidebar_nav_links {
    margin-bottom: 1.5rem;
}

/* The navbar UL becomes a vertical list when moved
   into the sidebar */
#sidebar_nav_links #navbar_links {
    display: block;
    list-style: none;
    margin: 0;
    padding: 0 0 1.5rem 0;

    border-bottom: 1px solid #666;
}

#sidebar_nav_links #navbar_links li {
    display: block;
}

#sidebar_nav_links #navbar_links li a {
    display: block;
    padding: 10px 32px;

    color: #d0d0d0;
    font-size: 1.5rem;
    font-weight: bold;

    margin: 0;
}

#sidebar_nav_links #navbar_links li a:hover {
    color: white;
    font-size: 1.7rem;
    text-decoration: underline;
}


/* Keep disabled Play appearance inside sidebar too */
#sidebar_nav_links #nav_play_button.nav_play_disabled {
    color: #777;
    cursor: not-allowed;
}

#sidebar_nav_links #nav_play_button.nav_play_disabled:hover {
    color: #777;
    font-size: 1.5rem;
    text-decoration: none;
}






@media screen and (max-height: 450px) {
    .sidenav {
        padding-top: 15px;
    }

    .sidenav a {
        font-size: 18px;
    }
}











/* =====================================================
   SIDEBAR RESTORE
===================================================== */

body.restoring_sidebar .sidebar,
body.restoring_sidebar #navbar,
body.restoring_sidebar #main,
body.restoring_sidebar .bar1,
body.restoring_sidebar .bar2,
body.restoring_sidebar .bar3 {
    transition:
        none !important;
}





















/* =====================================================
   PAGE INTRO
===================================================== */

.page_intro {
    max-width: 52rem;

    padding-top: 10rem;
    padding-bottom: 7rem;
}

.eyebrow {
    margin-bottom: 0.8rem;

    color:
        var(--bluishhh);

    font-size: 0.85rem;
    font-weight: 700;

    letter-spacing: 0.15rem;
}

.page_intro h1 {
    margin-bottom: 2rem;
}

.intro_text {
    max-width: 44rem;

    color:
        var(--blickishhh);

    font-size: 1.45rem;
    line-height: 1.55;
}


/* =====================================================
   MAIN SECTIONS
===================================================== */

.guide_section {
    padding:
        6rem 0;

    border-top:
        2px solid black;
}

.section_title {
    display: grid;

    grid-template-columns:
        4rem 1fr;

    gap: 1.5rem;

    margin-bottom: 4rem;
}

.section_title>span {
    padding-top: 0.4rem;

    color: #AAAAAA;

    font-size: 1.5rem;
    font-weight: bold;
}

.section_title h2 {
    max-width: 48rem;
}


/* =====================================================
   CONTENT
   No surrounding boxes anymore
===================================================== */

.guide_block {
    max-width: 48rem;

    margin-left: 5.5rem;
    margin-bottom: 5rem;

    padding: 0;
}

.guide_block h3 {
    margin-bottom: 1.5rem;
}

.guide_block>p {
    margin-bottom: 1.4rem;
}

.guide_block>p:last-child {
    margin-bottom: 0;
}

.block_number {
    margin-bottom:
        0.7rem !important;

    color:
        var(--bluishhh);

    font-size:
        0.8rem !important;

    font-weight: bold;

    letter-spacing: 0.1rem;
}

.lead {
    font-size:
        1.4rem !important;

    font-weight: 600;
}


/* =====================================================
   EXAMPLE QUESTIONS
===================================================== */

.example_questions {
    margin:
        2.5rem 0;

    padding:
        0.2rem 0 0.2rem 1.6rem;

    border-left:
        4px solid var(--bluishhh);
}

.example_questions p {
    margin-bottom: 0.8rem;

    font-size: 1.15rem;
    font-weight: 600;
}

.example_questions p:last-child {
    margin-bottom: 0;
}


/* =====================================================
   IMPORTANT STATEMENT
===================================================== */

.highlight_box {
    margin-top: 2.5rem;

    padding:
        1.4rem 0 1.4rem 1.5rem;

    background-color: transparent;

    border-left:
        4px solid var(--bluishhh);
}

.highlight_box p {
    margin-bottom: 0.4rem;

    color:
        var(--gray_text);

    font-size: 1.05rem;
}

.highlight_box strong {
    display: block;

    font-size: 1.25rem;
    line-height: 1.5;
}


/* =====================================================
   SIMPLE GRIDS
===================================================== */

.simple_grid {
    display: grid;

    gap: 0;

    margin:
        2.5rem 0;
}

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

.three_columns {
    grid-template-columns:
        repeat(3,
            minmax(0, 1fr));
}


/*
    Instead of cards, columns are divided
    by simple vertical lines.
*/

.simple_grid>div {
    padding:
        0.4rem 1.5rem;

    border-left:
        1px solid var(--light_border);
}

.simple_grid>div:first-child {
    padding-left: 0;

    border-left: none;
}

.simple_grid strong {
    display: block;

    margin-bottom: 0.8rem;

    font-size: 1.1rem;
}

.simple_grid p {
    margin-bottom: 0.8rem;

    color:
        var(--blickishhh);

    font-size: 1rem;
}

.simple_grid p:last-child {
    margin-bottom: 0;
}


/* =====================================================
   EXAMPLE NOTE
===================================================== */

.example_note {
    margin-top: 2.5rem;

    padding-left: 1.5rem;

    border-left:
        3px solid var(--light_border);
}

.example_note strong {
    display: block;

    margin-bottom: 0.5rem;

    color:
        var(--bluishhh);
}

.example_note p {
    margin: 0;

    color:
        var(--blickishhh);

    font-size: 1.05rem;
}


/* =====================================================
   IMAGE AREAS
===================================================== */

.image_area {
    max-width: 48rem;

    margin:
        3rem 0 5rem 5.5rem;
}

.image_placeholder {
    width: 100%;

    overflow: hidden;

    background-color: transparent;

    border: none;

    border-radius: 0.4rem;
}

.image_placeholder strong {
    margin-bottom: 0.8rem;

    color:
        var(--blickishhh);

    font-size: 0.8rem;
    letter-spacing: 0.15rem;
}



.image_placeholder p {
    max-width: 31rem;

    color:
        var(--gray_text);

    font-size: 1rem;
}

.image_area figcaption {
    margin-top: 0.7rem;

    color:
        var(--gray_text);

    font-size: 0.9rem;
    line-height: 1.5;
}


/* =====================================================
   ACTUAL GUIDE IMAGE
===================================================== */

.guide_image {
    display: block;

    width: 100%;

    height: auto;

}


/* =====================================================
   GAME QUESTION EXAMPLE
===================================================== */

.game_question_example {
    margin:
        2.5rem 0;

    padding:
        1.8rem 0;

    text-align: center;

    border-top:
        1px solid var(--light_border);

    border-bottom:
        1px solid var(--light_border);
}

.game_question_example strong {
    display: block;

    margin-bottom: 0.5rem;

    font-size: 1.5rem;
}

.game_question_example span {
    color:
        var(--gray_text);

    font-size: 0.9rem;
}


/* =====================================================
   MULTIPLIER GRID
===================================================== */

.multiplier_grid>div {
    font-weight: 600;

    text-align: center;
}


/* =====================================================
   NORMAL LIST
===================================================== */

.normal_list {
    margin:
        1.5rem 0 2rem 0;

    padding-left: 1.5rem;
}

.normal_list li {
    margin-bottom: 0.6rem;

    font-size: 1.1rem;
    line-height: 1.5;
}


/* =====================================================
   PROGRESS KEY
===================================================== */

.progress_key {
    display: flex;

    flex-wrap: wrap;

    gap:
        1.3rem 2rem;

    margin:
        2rem 0;
}

.progress_key>div {
    display: flex;

    align-items: center;

    gap: 0.7rem;
}

.progress_key p {
    margin: 0;

    font-size: 1rem;
}

.demo_dot {
    display: inline-block;

    flex-shrink: 0;

    width: 18px;
    height: 18px;

    border-radius: 50%;
}

.demo_dot.gray {
    background-color:
        #AAAAAA;
}

.demo_dot.red {
    background-color:
        hsl(0,
            75%,
            45%);
}

.demo_dot.orange {
    background-color:
        hsl(50,
            75%,
            45%);
}

.demo_dot.green {
    background-color:
        hsl(120,
            75%,
            35%);
}


/* =====================================================
   RANGE EXAMPLE
===================================================== */

.range_example {
    display: grid;

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

    margin:
        2.5rem 0;

    border-top:
        1px solid var(--light_border);

    border-bottom:
        1px solid var(--light_border);
}

.range_example>div {
    padding:
        1.4rem 0.5rem;

    text-align: center;
}

.range_example span {
    display: block;

    margin-bottom: 0.3rem;

    color:
        var(--gray_text);

    font-size: 0.85rem;
}

.range_example strong {
    font-size: 1.4rem;
}


/* =====================================================
   MATH LINE
===================================================== */

.math_line {
    display: inline-block;

    margin:
        0.5rem 0 2rem 0;

    padding-bottom: 0.3rem;

    border-bottom:
        2px solid var(--bluishhh);

    font-family:
        "Courier New",
        monospace;

    font-size: 1.15rem;
    font-weight: bold;
}


/* =====================================================
   CODE BOX

   Code remains boxed because the separation is useful.
===================================================== */

.code_box {
    margin:
        2.5rem 0;

    background-color:
        #171717;

    border-radius: 0.3rem;

    overflow: hidden;
}

.code_title {
    padding:
        0.7rem 1rem;

    background-color:
        #292929;

    color:
        #BBBBBB;

    border-bottom:
        1px solid #444444;

    font-size: 0.8rem;
    font-weight: bold;
}

.code_box pre {
    margin: 0;

    padding: 1.5rem;

    overflow-x: auto;
}

.code_box code {
    color:
        #EEEEEE;

    font-family:
        "Courier New",
        monospace;

    font-size: 0.9rem;

    line-height: 1.6;
}


/* =====================================================
   ACCURACY TABLE
===================================================== */

.accuracy_table {
    width: 100%;

    margin-top: 2.5rem;

    border-collapse: collapse;
}

.accuracy_table th,
.accuracy_table td {
    padding:
        1rem 0.8rem;

    border-bottom:
        1px solid var(--light_border);

    text-align: left;

    font-size: 1rem;
}

.accuracy_table th {
    color:
        var(--blickishhh);

    font-weight: bold;

    border-bottom:
        2px solid black;
}

.accuracy_table th:last-child,
.accuracy_table td:last-child {
    text-align: right;

    font-weight: bold;
}


/* =====================================================
   SCORE GRID
===================================================== */

.score_grid {
    border-top:
        1px solid var(--light_border);

    border-bottom:
        1px solid var(--light_border);
}

.score_grid>div {
    padding-top: 1.4rem;
    padding-bottom: 1.4rem;

    text-align: center;
}

.score_grid span {
    display: block;

    margin-bottom: 0.5rem;

    color:
        var(--gray_text);

    font-size: 0.9rem;
}

.score_grid strong {
    margin: 0;

    color:
        var(--bluishhh);

    font-size: 1.4rem;
}


/* =====================================================
   CLOSING SECTION
===================================================== */

.closing_section {
    max-width: 48rem;

    margin-left: 5.5rem;

    padding:
        6rem 0;

    border-top:
        2px solid black;
}

.closing_section h2 {
    margin-bottom: 2rem;
}

.closing_section>p {
    margin-bottom: 1.3rem;
}

.closing_statement {
    margin-top: 2.5rem;

    font-size: 1.4rem;
    font-weight: bold;
}

.start_game_button {
    display: inline-block;

    margin-top: 1.5rem;

    padding:
        1rem 2.5rem;

    background-color: black;

    color: white;

    border:
        2px solid black;

    border-radius: 0.4rem;

    font-weight: bold;

    transition: 0.2s;
}

.start_game_button:hover {
    background-color: white;

    color: black;

    transform:
        translateY(-3px);
}


/* =====================================================
   FOOTER
===================================================== */

.footer_top {
    position: relative;

    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 1.7rem;

    margin-top: 5rem;
}

.social_panel {
    position: absolute;

    left: 50%;

    transform:
        translateX(-50%);

    display: flex;

    gap: 1.7rem;
}

.social_panel a {
    color:
        var(--blickishhh);

    transition: 0.3s;
}

.social_panel a:hover {
    transform:
        translateY(-15px);

    font-size: 2.5rem;

    color:
        rgb(255, 0, 0);
}

.footer_bottom {
    margin-top: 2rem;

    border-top:
        1px solid var(--blickishhh);

    padding-top: 15px;

    text-align: center;
}

.footer_bottom p {
    margin-bottom: 0.8rem;

    color: gray;

    font-size: 1rem;
}


/* ============================================================
   COMPLETE RESPONSIVE SYSTEM
   Keeps desktop sidebar PUSH behavior
============================================================ */

:root {
    --page-padding: clamp(0.9rem, 4vw, 2rem);
}


/* ============================================================
   GLOBAL RESPONSIVE SAFETY
============================================================ */

html {
    width: 100%;
    max-width: 100%;

    overflow-x: hidden;
}

body {
    width: 100%;
    max-width: 100%;

    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

button,
input {
    font: inherit;
}

button {
    touch-action: manipulation;
}


/*
    Prevent grid/flex children from forcing
    their parent wider than the screen.
*/

#main,
.guide_section,
.guide_block,
.image_area,
.simple_grid,
.range_example,
.code_box {
    min-width: 0;
}


/* Long words / values should wrap instead of
   creating horizontal overflow */

p,
h1,
h2,
h3,
a,
li,
td,
th {
    overflow-wrap: break-word;
}


/* ============================================================
   MAIN PAGE CONTAINER
============================================================ */

.container {
    width: 100%;
    max-width: 64rem;

    margin-left: auto;
    margin-right: auto;

    padding-left: var(--page-padding);
    padding-right: var(--page-padding);
}


/*
    IMPORTANT:

    Width is animated as well as transform because
    PUSH mode actually gives the page less horizontal space.

    This prevents the old problem where a 100%-wide
    container was simply translated off-screen.
*/

#main {
    width: 100%;

    transition:
        width 0.5s ease,
        transform 0.5s ease;

    will-change:
        width,
        transform;
}


/* ============================================================
   RESPONSIVE TYPOGRAPHY
============================================================ */

h1 {
    font-size:
        clamp(3rem, 8vw, 5rem);

    line-height: 1;
}

h2 {
    font-size:
        clamp(2.2rem, 6vw, 3rem);

    line-height: 1.1;
}

h3 {
    font-size:
        clamp(1.25rem, 3vw, 1.6rem);
}

p {
    font-size:
        clamp(1rem, 2vw, 1.2rem);

    line-height: 1.65;
}


/* ============================================================
   NAVBAR
============================================================ */

#navbar {
    width: 100%;
    margin-left: 0;

    z-index: 900;

    transition:
        top 0.3s ease,
        margin-left 0.5s ease,
        width 0.5s ease;
}


#navbar .navdiv {
    width: 100%;
    max-width: 60rem;

    min-height: 3.5rem;

    margin-left: auto;
    margin-right: auto;

    padding:
        0.45rem clamp(0.75rem, 3vw, 1.25rem);

    display: flex;

    align-items: center;

    gap: 0.45rem;
}


/* Logo */

#navbar .navdiv .logo_img {
    width: 27px;
    height: 27px;

    margin: 0 3px 0 0;

    display: block;

    flex-shrink: 0;
}


#navbar .navdiv .logo {
    min-width: 0;
}


#navbar .navdiv .logo a {
    display: block;

    margin-right: 1rem;

    font-size:
        clamp(1.35rem, 3vw, 2rem);

    line-height: 1;

    white-space: nowrap;
}


/* Desktop nav links */

#navbar .navdiv ul {
    display: flex;

    align-items: center;

    gap:
        clamp(1rem, 3vw, 2.5rem);

    margin-top: 0;
    margin-left: auto;

    list-style: none;
}


#navbar .navdiv ul li {
    flex-shrink: 0;
}


#navbar .navdiv ul li a {
    margin-right: 0;

    font-size:
        clamp(1rem, 2vw, 1.3rem);

    white-space: nowrap;
}


/*
    Don't enlarge nav text on hover.

    Enlarging the font physically changes its width,
    making neighboring navbar elements move.
*/

#navbar .navdiv ul li a:hover {
    font-size:
        clamp(1rem, 2vw, 1.3rem);

    text-decoration: underline;
}


/* ============================================================
   MENU BUTTON
============================================================ */

.menu_btn {
    width: 44px;
    height: 44px;

    flex:
        0 0 44px;

    margin: 0;
    padding: 6px;

    border: none;

    background: transparent;

    display: flex;

    flex-direction: column;

    justify-content: center;
    align-items: center;

    gap: 4px;

    cursor: pointer;
}


.bar1,
.bar2,
.bar3 {
    width: 30px;
    height: 4px;

    margin: 0;

    background-color: #0c0c0c;

    border-radius: 20px;

    transition:
        transform 0.3s ease,
        opacity 0.3s ease,
        background-color 0.2s ease;
}


@media (hover: hover) and (pointer: fine) {

    .menu_btn:hover .bar1,
    .menu_btn:hover .bar2,
    .menu_btn:hover .bar3 {
        width: 30px;
        height: 4px;

        margin: 0;

        background-color: #871b1b;
    }

}


.change .bar1 {
    transform:
        translateY(8px) rotate(-45deg);
}


.change .bar2 {
    opacity: 0;
}


.change .bar3 {
    transform:
        translateY(-8px) rotate(45deg);
}


/* ============================================================
   SIDEBAR
============================================================ */

.sidebar {
    width: 0;

    max-width: 88vw;

    height: 100vh;
    height: 100dvh;

    position: fixed;

    top: 0;
    left: 0;

    z-index: 1000;

    padding-top: 60px;

    background-color:
        var(--blickishhh);

    overflow-x: hidden;
    overflow-y: auto;

    transition:
        width 0.5s ease;
}


.sidebar a {
    display: block;

    padding:
        0.65rem 2rem;

    color: #a7a7a7;

    font-size:
        clamp(1.15rem, 4vw, 1.5rem);

    line-height: 1.3;

    white-space: nowrap;

    transition:
        color 0.2s ease,
        background-color 0.2s ease;
}


@media (hover: hover) and (pointer: fine) {

    .sidebar a:hover {
        color: white;

        font-size:
            clamp(1.15rem, 4vw, 1.5rem);

        background:
            rgba(255, 255, 255, 0.05);
    }

}


/* Sidebar close button */

.sidebar .closebtn {
    position: absolute;

    top: 0;
    right: 1rem;

    width: auto;

    margin: 0;

    padding:
        0.15rem 0.5rem;

    color: #d0d0d0;

    font-size: 4rem;

    line-height: 1;
}


.sidebar .closebtn:hover {
    color: white;

    font-size: 4rem;
}


/* ============================================================
   SIDEBAR BACKDROP
============================================================ */

.sidebar_backdrop {
    position: fixed;

    inset: 0;

    z-index: 950;

    background:
        rgba(0, 0, 0, 0.35);

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
}


/*
    Only OVERLAY mode uses the backdrop.

    Desktop PUSH mode deliberately does not.
*/

body.sidebar-overlay-open .sidebar_backdrop {
    opacity: 1;

    visibility: visible;

    pointer-events: auto;
}


/* ============================================================
   NAV LINKS WHEN MOVED INTO SIDEBAR
============================================================ */

#sidebar_nav_links {
    margin-bottom: 1rem;
}


#sidebar_nav_links #navbar_links {
    display: block;

    list-style: none;

    margin: 0;

    padding:
        0 0 1rem 0;

    border-bottom:
        1px solid #666;
}


#sidebar_nav_links #navbar_links li {
    display: block;
}


#sidebar_nav_links #navbar_links li a {
    display: block;

    margin: 0;

    padding:
        0.7rem 2rem;

    color: #d0d0d0;

    font-size:
        clamp(1.15rem, 4vw, 1.5rem);

    font-weight: bold;
}


/* ============================================================
   RESTORING SIDEBAR
============================================================ */

body.restoring_sidebar .sidebar,
body.restoring_sidebar #navbar,
body.restoring_sidebar #main,
body.restoring_sidebar .sidebar_backdrop,
body.restoring_sidebar .bar1,
body.restoring_sidebar .bar2,
body.restoring_sidebar .bar3 {
    transition:
        none !important;
}


/* ============================================================
   PAGE INTRO
============================================================ */

.page_intro {
    width: 100%;
    max-width: 52rem;

    padding-top:
        clamp(7rem, 14vw, 10rem);

    padding-bottom:
        clamp(4rem, 10vw, 7rem);
}


.page_intro h1 {
    margin-bottom:
        clamp(1.2rem, 4vw, 2rem);
}


.intro_text {
    max-width: 44rem;

    font-size:
        clamp(1.1rem, 3vw, 1.45rem);

    line-height: 1.55;
}


/* ============================================================
   GUIDE SECTIONS
============================================================ */

.guide_section {
    padding:
        clamp(4rem, 9vw, 6rem) 0;
}


.section_title {
    display: grid;

    grid-template-columns:
        clamp(2.5rem, 6vw, 4rem) minmax(0, 1fr);

    gap:
        clamp(0.8rem, 3vw, 1.5rem);

    margin-bottom:
        clamp(3rem, 7vw, 4rem);
}


.section_title>span {
    font-size:
        clamp(1.05rem, 3vw, 1.5rem);
}


.section_title h2 {
    max-width: 48rem;
}


/* ============================================================
   GUIDE CONTENT
============================================================ */

.guide_block,
.image_area,
.closing_section {
    width: auto;

    max-width: 48rem;
}


.guide_block {
    margin-bottom:
        clamp(3.5rem, 8vw, 5rem);
}


.guide_block h3 {
    margin-bottom:
        clamp(1rem, 3vw, 1.5rem);
}


.lead {
    font-size:
        clamp(1.15rem,
            3vw,
            1.4rem) !important;
}


/* ============================================================
   SIMPLE GRIDS
============================================================ */

.simple_grid {
    width: 100%;

    min-width: 0;
}


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


.three_columns {
    grid-template-columns:
        repeat(3,
            minmax(0, 1fr));
}


.simple_grid>div {
    min-width: 0;
}


/* ============================================================
   IMAGES
============================================================ */

.image_area {
    width: auto;

    max-width: 48rem;
}


.image_placeholder {
    max-width: 100%;

    overflow: hidden;
}


.guide_image {
    max-width: 100%;

    height: auto;
}


/* ============================================================
   RANGE EXAMPLE
============================================================ */

.range_example {
    width: 100%;

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


.range_example>div {
    min-width: 0;
}


/* ============================================================
   CODE
============================================================ */

.code_box {
    width: 100%;

    max-width: 100%;
}


.code_box pre {
    width: 100%;

    max-width: 100%;

    overflow-x: auto;

    overscroll-behavior-x: contain;

    -webkit-overflow-scrolling: touch;
}


/*
    Code should not wrap artificially.

    Instead, only the code box itself scrolls horizontally.
*/

.code_box code {
    white-space: pre;
}


/* ============================================================
   ACCURACY TABLE
============================================================ */

.accuracy_table {
    width: 100%;

    table-layout: fixed;
}


.accuracy_table th,
.accuracy_table td {
    overflow-wrap: anywhere;
}


/* ============================================================
   PROGRESS KEY
============================================================ */

.progress_key {
    max-width: 100%;
}


/* ============================================================
   CLOSING SECTION
============================================================ */

.closing_section {
    padding:
        clamp(4rem, 9vw, 6rem) 0;
}


.closing_statement {
    font-size:
        clamp(1.15rem, 3vw, 1.4rem);
}


.start_game_button {
    max-width: 100%;

    text-align: center;
}


/* ============================================================
   FOOTER
============================================================ */

.footer_top {
    position: relative;

    display: grid;

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

    align-items: center;

    gap:
        clamp(1rem, 4vw, 2rem);

    margin-top:
        clamp(3rem, 8vw, 5rem);
}


.footer_top .footer_name:last-child {
    text-align: right;
}


/*
    Remove fragile absolute centering.

    The social panel now owns the middle grid column.
*/

.social_panel {
    position: static;

    left: auto;

    transform: none;

    display: flex;

    justify-content: center;
    align-items: center;

    gap:
        clamp(0.8rem, 4vw, 1.7rem);
}


.social_panel a {
    width: 44px;
    height: 44px;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    color:
        var(--blickishhh);

    font-size: 1.45rem;
}


@media (hover: hover) and (pointer: fine) {

    .social_panel a:hover {
        /*
            Keep the movement, but don't make the icon
            huge enough to shift nearby content.
        */

        transform:
            translateY(-5px);

        font-size: 1.6rem;

        color: red;
    }

}


/* ============================================================
   TIGHT DESKTOP PUSH MODE
============================================================ */

/*
    This class is added by JavaScript while:

    - sidebar is open
    - PUSH mode is active
    - desktop is narrower than 1250px

    It gives long-form content a little extra room.
*/

body.sidebar-tight-push .guide_block,

body.sidebar-tight-push .image_area,

body.sidebar-tight-push .closing_section {
    margin-left: 2.5rem;
}


/*
    3-column informational grids become 2 columns while
    the sidebar is using some of the available width.
*/

body.sidebar-tight-push .three_columns {
    grid-template-columns:
        repeat(2,
            minmax(0, 1fr));
}


/* ============================================================
   ≤ 900px
============================================================ */

@media (max-width: 900px) {

    /*
        Sidebar will already be in overlay mode around here,
        so normal page width is restored.
    */

    .guide_block,
    .image_area,
    .closing_section {
        margin-left: 2.5rem;
    }


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

}


/* ============================================================
   ≤ 800px
============================================================ */

@media (max-width: 800px) {

    .guide_block,
    .image_area,
    .closing_section {
        margin-left: 0;
    }


    /*
        Long paragraphs become much easier to read
        if three-column layouts become a single stack.
    */

    .three_columns {
        grid-template-columns: 1fr;
    }


    .three_columns>div,
    .three_columns>div:first-child {
        padding:
            1.2rem 0;

        border-left: none;

        border-top:
            1px solid var(--light_border);
    }


    .three_columns>div:first-child {
        border-top: none;
    }


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

}


/* ============================================================
   ≤ 650px
   HOME + PLAY MOVE INTO SIDEBAR
============================================================ */

@media (max-width: 650px) {

    /*
        JavaScript physically moves navbar_links.

        This rule is only a fallback during initial loading.
    */

    #navbar .navdiv>#navbar_links {
        display: none;
    }


    .menu_btn {
        margin-left: auto;
    }


    .two_columns {
        grid-template-columns: 1fr;
    }


    .two_columns>div,
    .two_columns>div:first-child {
        padding:
            1.2rem 0;

        border-left: none;

        border-top:
            1px solid var(--light_border);
    }


    .two_columns>div:first-child {
        border-top: none;
    }


    .footer_top {
        grid-template-columns: 1fr;

        text-align: center;
    }


    .footer_top .footer_name:last-child {
        text-align: center;

        order: 3;
    }


    .social_panel {
        order: 2;
    }

}


/* ============================================================
   ≤ 560px
============================================================ */

@media (max-width: 560px) {

    .section_title {
        grid-template-columns:
            2.25rem minmax(0, 1fr);

        gap: 0.7rem;
    }


    .guide_section {
        padding:
            3.75rem 0;
    }


    .progress_key {
        flex-direction: column;

        align-items: flex-start;

        gap: 0.9rem;
    }


    .example_questions,
    .highlight_box,
    .example_note {
        padding-left: 1rem;
    }


    .code_box pre {
        padding: 1rem;
    }


    .code_box code {
        font-size: 0.8rem;
    }


    .accuracy_table th,
    .accuracy_table td {
        padding:
            0.75rem 0.45rem;

        font-size: 0.88rem;
    }

}


/* ============================================================
   ≤ 420px
============================================================ */

@media (max-width: 420px) {

    :root {
        --page-padding: 0.85rem;
    }


    #navbar .navdiv {
        padding-left: 0.7rem;
        padding-right: 0.7rem;
    }


    #navbar .navdiv .logo_img {
        width: 24px;
        height: 24px;
    }


    #navbar .navdiv .logo a {
        margin-right: 0.25rem;

        font-size:
            clamp(1.15rem,
                6vw,
                1.45rem);
    }


    .menu_btn {
        width: 42px;
        height: 42px;

        flex-basis: 42px;
    }


    .page_intro {
        padding-top: 6rem;
    }


    /*
        Four value comparison is too cramped as 2 columns
        on the smallest phones.
    */

    .range_example {
        grid-template-columns: 1fr;
    }


    .range_example>div {
        padding:
            0.9rem 0.5rem;

        border-bottom:
            1px solid var(--light_border);
    }


    .range_example>div:last-child {
        border-bottom: none;
    }


    .accuracy_table th,
    .accuracy_table td {
        font-size: 0.82rem;
    }


    .start_game_button {
        width: 100%;
    }

}


/* ============================================================
   VERY NARROW PHONES
============================================================ */

@media (max-width: 340px) {

    #navbar .navdiv {
        gap: 0.2rem;
    }


    #navbar .navdiv .logo a {
        font-size: 1.1rem;
    }


    .bar1,
    .bar2,
    .bar3 {
        width: 27px;
    }


    .section_title {
        grid-template-columns:
            2rem minmax(0, 1fr);
    }


    .section_title>span {
        font-size: 0.95rem;
    }

}


/* ============================================================
   SHORT LANDSCAPE SCREENS
============================================================ */

@media (max-height: 500px) and (orientation: landscape) {

    .sidebar {
        padding-top: 3rem;
    }

}


/* ============================================================
   KEYBOARD ACCESSIBILITY
============================================================ */

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline:
        3px solid var(--bluishhh);

    outline-offset: 2px;
}


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

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

    *,
    *::before,
    *::after {
        transition-duration:
            0.01ms !important;

        animation-duration:
            0.01ms !important;

        animation-iteration-count:
            1 !important;
    }

}