@font-face {
    font-family: "Cyberform";
    src: url("/fonts/CyberformDemo.otf") format("opentype");
    font-display: swap;
}

:root {
    --green: #D4FF00;
    --green-dark: #607400;
    --background: #0D0D0D;
    --grey: #4B4949;
    --grey-light: #999999;
    --grey-input: #777777;
    --white: #DEDEDE;
    --border: #333333;
    --cyber-spacing: 0.08em;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--background);
    color: var(--white);

    font-family: "Space Mono", monospace;

    min-height: 100vh;
    overflow-x: hidden;
}

.background-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background-size: clamp(220px, 33.333vw, 320px)
                     clamp(220px, 33.333vw, 320px);
    background-image:
        linear-gradient(to right, #ffffff0d 1px, transparent 1px),
        linear-gradient(to bottom, #ffffff0d 1px, transparent 1px);
}

.background-numbers {
    position: fixed;
    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;

    overflow: hidden;

    z-index: 0;
    pointer-events: none;
    user-select: none;
}

.background-numbers span {
    font-family: "Cyberform", sans-serif;
    font-size: min(40vw, 30vh);
    line-height: 1;
    letter-spacing: var(--cyber-spacing);
    color: #0f0f0f;
    flex-shrink: 0;
}

header {
    position: relative;
    z-index: 2;

    padding: 76px;
}

.menu-icon {
    width: 66px;
    height: 66px;

    background: none;
    border: 3px solid var(--border);
    cursor: pointer;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 9px;
}

.menu-icon span {
    width: 35px;
    height: 5px;

    background-color: var(--grey-light);
}

.menu-icon:hover,
.menu-icon:focus-visible {
    border-color: var(--green);
    outline: none;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;

    z-index: 10;

    background-color: rgba(13, 13, 13, 0.45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);

    opacity: 0;
    pointer-events: none;

    transition: opacity 0.35s ease;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(315px, 85vw);
    height: 100%;
    z-index: 11;
    background-color: #1c1c1c;
    padding: 62px 0 40px;
    clip-path: polygon(
        0 0,
        calc(100% - 12px) 0,
        100% 12px,
        100% calc(100% - 12px),
        calc(100% - 12px) 100%,
        0 100%
    );

    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.35s ease, visibility 0s linear 0.35s;
}

.sidebar-title {
    font-family: "Cyberform", sans-serif;
    font-size: 21px;
    line-height: 1;
    text-align: center;

    letter-spacing: var(--cyber-spacing);
    text-indent: var(--cyber-spacing);

    color: var(--green);

    margin-bottom: 12px;
}

.sidebar-links {
    list-style: none;
}

.sidebar-links a {
    display: flex;
    align-items: center;
    gap: 8px;

    height: 60px;
    padding-left: 28px;

    color: var(--white);
    text-decoration: none;

    font-size: 20px;
}

.sidebar-links a::before {
    content: "";

    width: 18px;
    height: 18px;
    flex-shrink: 0;

    background-color: #93ad00;

    clip-path: polygon(0 0, 100% 50%, 0 100%, 28% 50%);

    transition: background-color 0.2s ease;
}

.sidebar-links a[aria-current="page"] {
    font-weight: bold;
}

.sidebar-links a[aria-current="page"]::before,
.sidebar-links a:hover::before,
.sidebar-links a:focus-visible::before {
    background-color: var(--green);
}

.sidebar-links a:focus-visible {
    outline: none;
    color: var(--green);
}

body.menu-open {
    overflow: hidden;
}

body.menu-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
}

body.menu-open .sidebar {
    transform: translateX(0);
    visibility: visible;

    transition: transform 0.35s ease, visibility 0s;
}

@media (prefers-reduced-motion: reduce) {

    .sidebar,
    .sidebar-overlay {
        transition: none;
    }

}

.calculator {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 76px 80px;
}


.calculator-top {
    width: 100%;
    max-width: 396px;
}

h1 {
    font-family: "Cyberform", sans-serif;
    color: var(--green);

    font-size: 36px;
    line-height: 1;
    text-align: center;
    white-space: nowrap;

    letter-spacing: var(--cyber-spacing);
    text-indent: var(--cyber-spacing); 
    margin: 0 -50px 28px;
}

.formula-input {
    width: 100%;
    height: 46px;

    background-color: transparent;
    border: 3px solid var(--grey-input);

    padding: 0 12px;

    color: var(--white);

    font-family: "Space Mono", monospace;
    font-size: 20px;
    font-weight: bold;

    outline: none;
    border-radius: 0;
}

.formula-input::placeholder {
    color: var(--grey);
}

.formula-input:focus {
    border-color: var(--green);
}


.result-section {
    width: 100%;
    max-width: 396px;

    margin-top: 68px;
}

h2 {
    font-family: "Cyberform", sans-serif;
    color: var(--green);

    font-size: 22px;
    line-height: 1;
    text-align: center;

    letter-spacing: var(--cyber-spacing);
    text-indent: var(--cyber-spacing);

    margin-bottom: 20px;
}

.mass-result {
    width: 100%;
    height: 46px;

    border: 3px solid var(--green-dark);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 12px;

    color: var(--green);

    font-size: 20px;
    font-weight: bold;
}

.unit {
    color: var(--grey-light);
}


.table-section {
    width: 100%;
    max-width: 820px;

    margin-top: 26px;

    overflow-x: auto;
}

table {
    width: 100%;

    border-collapse: collapse;

    text-align: center;
}

th, td {
    border: 2px solid var(--border);
}

th {
    font-family: "Cyberform", sans-serif;
    font-size: 10px;
    line-height: 1.2;
    font-weight: normal;

    letter-spacing: 0.04em;

    text-align: left;
    white-space: nowrap;

    color: var(--white);

    padding: 12px 10px;
}

th:first-child {
    width: 12%;
}

th:first-child,
th:nth-child(3) {
    color: var(--green);
}

.th-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.th-unit {
    color: var(--grey-light);
}

td {
    color: var(--white);

    font-size: 11px;
    line-height: 1.5;

    padding: 10px;
}

@media screen and (min-width: 1200px) {

    .calculator {
        padding-top: 40px;
    }

    .calculator-top,
    .result-section {
        max-width: 480px;
    }

    h1 {
        font-size: 44px;
        margin: 0 -70px 32px;
    }

    .formula-input {
        height: 56px;
        font-size: 24px;
    }

    .result-section {
        margin-top: 80px;
    }

    h2 {
        font-size: 26px;
        margin-bottom: 24px;
    }

    .mass-result {
        height: 56px;
        font-size: 24px;
    }

    .table-section {
        max-width: 960px;
        margin-top: 32px;
    }

    th {
        font-size: 12px;
        padding: 15px 12px;
    }

    td {
        font-size: 13px;
        padding: 12px;
    }

}

@media screen and (max-width: 700px) {

    header {
        padding: 40px;
    }

    .calculator {
        padding: 30px 40px 70px;
    }

}

@media screen and (max-width: 600px) {

    .background-numbers span {
        font-size: min(62vw, 30vh);
    }

    header {
        padding: 25px;
    }

    .menu-icon {
        width: 48px;
        height: 48px;

        border-width: 2px;
        gap: 6px;
    }

    .menu-icon span {
        width: 25px;
        height: 4px;
    }

    .calculator {
        padding: 45px 6% 60px;
    }

    h1 {
        font-size: clamp(20px, 6.2vw, 30px);
        margin: 0 0 24px;
    }

    .formula-input {
        height: 44px;
        font-size: 18px;
    }

    .result-section {
        margin-top: 48px;
    }

    h2 {
        font-size: 19px;
        margin-bottom: 16px;
    }

    .mass-result {
        height: 44px;
        font-size: 17px;
    }

    .table-section {
        margin-top: 22px;
    }

    table {
        min-width: 600px;
    }

}

@media screen and (max-width: 380px) {

    h2 {
        font-size: 17px;
    }

    .mass-result {
        font-size: 16px;
    }

}