/* ------------------------- */
/* General page styling */
/* ------------------------- */

* {
    box-sizing: border-box;
}


html {
    scroll-behavior: smooth;
}


body {
    margin: 0;

    font-family: Arial, Helvetica, sans-serif;

    background-color: #0b0f14;

    color: #f2f2f2;

    line-height: 1.6;
}



/* ------------------------- */
/* Navigation */
/* ------------------------- */

.site-header {
    position: sticky;

    top: 0;

    background-color: rgba(11, 15, 20, 0.95);

    border-bottom: 1px solid #202832;

    z-index: 100;
}


.navbar {
    max-width: 1200px;

    margin: auto;

    padding: 18px 25px;

    display: flex;

    justify-content: space-between;

    align-items: center;
}


.logo {
    color: white;

    text-decoration: none;

    font-size: 21px;

    font-weight: 600;
}


.nav-links {
    display: flex;

    gap: 30px;
}


.nav-links a {
    color: #b9c1ca;

    text-decoration: none;

    font-size: 15px;
}


.nav-links a:hover {
    color: white;
}



/* ------------------------- */
/* Introduction */
/* ------------------------- */

.page-intro {
    max-width: 1100px;

    margin: auto;

    padding: 90px 25px 55px 25px;
}


.section-label {
    color: #78a9ff;

    text-transform: uppercase;

    letter-spacing: 2px;

    font-size: 12px;
}


.page-intro h1 {
    margin: 8px 0 15px 0;

    font-size: 52px;
}


.intro-text {
    max-width: 760px;

    font-size: 18px;

    color: #aab3bd;
}



/* ------------------------- */
/* Main simulation layout */
/* ------------------------- */

.simulation-section {
    max-width: 1200px;

    margin: auto;

    padding: 20px 25px 100px 25px;
}


.simulation-container {
    display: grid;

    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);

    gap: 25px;

    align-items: start;
}



/* ------------------------- */
/* Lattice */
/* ------------------------- */

.lattice-panel {
    position: relative;

    background-color: #080b0f;

    border: 1px solid #202832;

    border-radius: 12px;

    padding: 52px 22px 22px 22px;

    min-height: 650px;

    display: flex;

    align-items: center;

    justify-content: center;
}


.simulation-hud {
    position: absolute;

    top: 17px;

    left: 22px;

    right: 22px;

    display: flex;

    justify-content: space-between;

    color: #8d99a6;

    font-size: 14px;

    z-index: 5;

    pointer-events: none;
}


#ising-canvas {
    width: 100%;

    max-width: 640px;

    height: auto;

    display: block;

    border: 1px solid #202832;

    background-color: #111820;

    image-rendering: pixelated;
}



/* ------------------------- */
/* Controls */
/* ------------------------- */

.controls-panel {
    background-color: #111820;

    border: 1px solid #202832;

    border-radius: 12px;

    padding: 28px;
}


.controls-panel h2 {
    margin-top: 0;

    font-size: 19px;
}


.secondary-heading {
    margin-top: 35px !important;
}


.control-group {
    margin-bottom: 26px;
}


.control-group label {
    display: flex;

    justify-content: space-between;

    gap: 20px;

    margin-bottom: 10px;

    color: #d8dee5;

    font-size: 14px;
}


.control-group label span {
    color: #78a9ff;
}


.control-group input {
    width: 100%;
}


input[type="range"] {
    accent-color: #78a9ff;

    cursor: pointer;
}


.control-group select {
    width: 100%;

    padding: 10px 12px;

    background-color: #0b1016;

    border: 1px solid #34404d;

    border-radius: 6px;

    color: #e6edf3;

    font-size: 14px;

    cursor: pointer;
}


.control-group select:focus {
    outline: none;

    border-color: #78a9ff;
}


.control-group label .label-with-info {
    color: #d8dee5;
}


/* ------------------------- */
/* Information tooltips */
/* ------------------------- */

.label-with-info {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    color: inherit;
}


.info-tooltip {
    position: relative;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    color: #78a9ff;

    font-size: 14px;
    cursor: help;
    outline: none;
}



.tooltip-text {
    position: absolute;

    left: 50%;

    bottom: calc(100% + 12px);

    transform: translateX(-50%);

    width: 270px;

    padding: 12px 14px;

    background-color: #18212b;

    border: 1px solid #2b3744;

    border-radius: 8px;

    color: #c3ccd6;

    font-size: 12px;

    font-weight: normal;

    line-height: 1.5;

    text-align: left;

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.15s ease,
        transform 0.15s ease;

    z-index: 30;
}


.info-tooltip:hover .tooltip-text,
.info-tooltip:focus .tooltip-text {
    opacity: 1;

    visibility: visible;

    transform:
        translateX(-50%)
        translateY(-3px);
}









/* ------------------------- */
/* Temperature presets */
/* ------------------------- */

.temperature-presets {
    display: grid;

    grid-template-columns: repeat(3, 1fr);

    gap: 8px;

    margin-top: -12px;

    margin-bottom: 28px;
}


.preset-button {
    padding: 10px 6px;

    background-color: #0b1016;

    border: 1px solid #34404d;

    border-radius: 6px;

    color: #d8dee5;

    display: flex;

    flex-direction: column;

    align-items: center;

    gap: 2px;
}


.preset-button span {
    font-size: 12px;
}


.preset-button small {
    color: #78a9ff;

    font-size: 10px;
}


.preset-button:hover {
    border-color: #78a9ff;

    background-color: #111b27;
}

/* ------------------------- */
/* Live measurements */
/* ------------------------- */

.measurement-grid {
    display: grid;

    grid-template-columns: repeat(2, 1fr);

    gap: 12px;

    margin-top: 18px;
}


.measurement-card {
    background-color: #0b1016;

    border: 1px solid #202832;

    border-radius: 8px;

    padding: 15px;

    min-height: 82px;

    display: flex;

    flex-direction: column;

    justify-content: space-between;
}


.measurement-label {
    color: #7f8b98;

    font-size: 12px;
}


.measurement-card strong {
    color: #f0f4f8;

    font-size: 20px;

    font-weight: 500;
}



/* ------------------------- */
/* Buttons */
/* ------------------------- */

.button-row {
    display: flex;

    flex-wrap: wrap;

    gap: 10px;

    margin-top: 35px;
}


button {
    padding: 11px 18px;

    border-radius: 6px;

    cursor: pointer;

    font-size: 14px;
}


.primary-button {
    background-color: #78a9ff;

    border: 1px solid #78a9ff;

    color: #09101a;
}


.primary-button:hover {
    background-color: #9bbfff;
}


.secondary-button {
    background-color: transparent;

    border: 1px solid #384655;

    color: white;
}


.secondary-button:hover {
    border-color: #78a9ff;
}


button:disabled {
    opacity: 0.45;

    cursor: not-allowed;
}



/* ------------------------- */
/* Simulation status */
/* ------------------------- */

.simulation-status {
    margin-top: 25px;

    display: flex;

    align-items: center;

    gap: 8px;

    color: #aab3bd;

    font-size: 13px;
}


.status-dot {
    width: 8px;

    height: 8px;

    border-radius: 50%;

    background-color: #78a9ff;
}



/* ------------------------- */
/* Theory / content sections */
/* ------------------------- */

.content-section {
    max-width: 1100px;

    margin: auto;

    padding: 90px 25px;

    border-top: 1px solid #202832;
}


.content-section h2 {
    margin-top: 5px;

    font-size: 34px;
}


.content-section > p {
    max-width: 820px;

    color: #aab3bd;

    font-size: 17px;
}


.equation {
    max-width: 500px;

    margin: 24px 0;

    padding: 18px;

    background-color: #080b0f;

    border: 1px solid #202832;

    border-radius: 8px;

    text-align: center;

    font-size: 20px;
}


.small-equation {
    margin-top: 18px;

    padding: 13px;

    background-color: #080b0f;

    border-radius: 6px;

    text-align: center;

    font-size: 17px;
}


.information-grid {
    display: grid;

    grid-template-columns: repeat(2, 1fr);

    gap: 20px;

    margin-top: 45px;
}


.information-card {
    background-color: #111820;

    border: 1px solid #202832;

    border-radius: 10px;

    padding: 28px;
}


.information-card h3 {
    margin-top: 0;
}


.information-card p {
    color: #aab3bd;
}



/* ------------------------- */
/* Analysis */
/* ------------------------- */

.analysis-heading {
    margin-top: 55px;
}


.analysis-heading h3 {
    margin-bottom: 8px;

    font-size: 23px;
}


.analysis-heading p {
    color: #aab3bd;
}


.graph-container {
    height: 420px;

    margin-top: 28px;

    padding: 25px;

    background-color: #111820;

    border: 1px solid #202832;

    border-radius: 10px;
}


#magnetisation-chart,
#energy-chart,
#temperature-chart,
#susceptibility-chart,
#heat-capacity-chart {
    width: 100% !important;

    height: 100% !important;
}

/* ------------------------- */
/* Temperature experiment */
/* ------------------------- */

.experiment-panel {

    margin-top: 25px;

    padding: 22px;

    background-color: #111820;

    border: 1px solid #202832;

    border-radius: 10px;

}


.experiment-controls {

    display: flex;

    align-items: end;

    justify-content: space-between;

    gap: 20px;

    flex-wrap: wrap;

}


.experiment-setting {

    display: flex;

    flex-direction: column;

    gap: 8px;

}


.experiment-setting label {

    color: #aab3bd;

    font-size: 13px;

}


.experiment-setting select {

    min-width: 160px;

    padding: 10px 12px;

    background-color: #0b1016;

    border: 1px solid #34404d;

    border-radius: 6px;

    color: white;

}


.experiment-status {

    margin-top: 15px;

    color: #7f8b98;

    font-size: 13px;

}



/* ------------------------- */
/* Critical temperature */
/* ------------------------- */

.critical-temperature-panel {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 18px;

    margin-top: 22px;
}


.critical-temperature-card {
    padding: 20px;

    background-color: #18212b;

    border: 1px solid #2b3744;

    border-radius: 10px;
}


.critical-temperature-card strong {
    display: block;

    margin-top: 8px;

    font-size: 24px;

    color: #78a9ff;
}


.critical-temperature-card p {
    margin-top: 10px;

    color: #9ba8b5;

    font-size: 13px;

    line-height: 1.5;
}


@media (
    max-width: 700px
) {

    .critical-temperature-panel {
        grid-template-columns:
            1fr;
    }

}






/* ------------------------- */
/* Experiment progress */
/* ------------------------- */

.experiment-status-row {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 10px;
}


#experiment-progress-text {
    color: #78a9ff;

    font-size: 13px;

    font-variant-numeric: tabular-nums;
}


.experiment-progress-track {
    width: 100%;

    height: 7px;

    background-color: #18212b;

    border: 1px solid #2b3744;

    border-radius: 999px;

    overflow: hidden;
}


.experiment-progress-bar {
    width: 0%;

    height: 100%;

    background-color: #78a9ff;

    border-radius: 999px;

    transition: width 0.2s ease;
}






/* ------------------------- */
/* Footer */
/* ------------------------- */

footer {
    border-top: 1px solid #202832;

    padding: 30px;

    text-align: center;

    color: #65717e;

    font-size: 14px;
}



/* ------------------------- */
/* Tablet */
/* ------------------------- */

@media (max-width: 950px) {

    .simulation-container {
        grid-template-columns: 1fr;
    }


    .controls-panel {
        max-width: none;
    }


    .lattice-panel {
        min-height: auto;
    }

}



/* ------------------------- */
/* Mobile */
/* ------------------------- */

@media (max-width: 700px) {

    .navbar {
        flex-direction: column;

        gap: 15px;
    }


    .nav-links {
        flex-wrap: wrap;

        justify-content: center;

        gap: 18px;
    }


    .page-intro h1 {
        font-size: 40px;
    }


    .information-grid {
        grid-template-columns: 1fr;
    }


    .measurement-grid {
        grid-template-columns: 1fr 1fr;
    }


    .button-row {
        flex-direction: column;
    }


    button {
        width: 100%;
    }


    .lattice-panel {
        padding:
            50px
            12px
            12px
            12px;
    }


    .graph-container {
        height: 330px;

        padding: 15px;
    }

}