:root {
    font-family: 'Jost', sans-serif;
}

button,
select {
    font-family: 'Jost', sans-serif;

    padding: 0.5rem;
    border: 2px solid black;
    border-radius: 10px;

    background: white;

    cursor: pointer;
    appearance: none;

    display: flex;
}

select {
    padding-right: 1.5rem;
    width: 100%;
}

div:has(> select) {
    position: relative;
}

div:has(> select) svg {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.75rem;
}

label {
    cursor: pointer;
}

button svg {
    height: 1rem;
    min-width: 1rem;
    width: fit-content;
}

body {
    margin: 0;
    padding: 20px;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    box-sizing: border-box;

    background-image: linear-gradient(to right, rgba(128, 128, 128, 0.2) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(128, 128, 128, 0.2) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0;
}

#main {
    height: 75%;
    margin-bottom: 1rem;

    position: relative;
    display: flex;
    justify-content: flex-end;
}

#mainExpand {
    height: 100%;
    width: 80%;
    box-sizing: border-box;

    position: absolute;
    z-index: 10;
    left: 0%;

    transition: all 0.3s ease;
}

#mainExpand:has(#resize-checkbox:checked) {
    height: calc(100vh - 2rem);
    width: 100%;
}

#mainExpand > svg {
    background: white;
    display: block;
    width: 100%;
    height: calc(100% - 8px);
    border: black solid 4px;
    border-radius: 15px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

#resize {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: inline-block;
    padding: 0.5rem;
    border-radius: 15px;
    border: 1px solid #ccc;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

#resize-checkbox:checked + #resize {
    background-color: #e0e0e0;
    border-color: #a0a0a0;
}

#sidebar {
    width: calc(20% - 0.5rem);
    overflow: scroll;
}

#sidebar div {
    width: 100%;
    height: calc(25% - 8px);
    margin-bottom: 0.5rem;
    border: solid 4px black;
    background: white;
    border-radius: 15px;
    box-sizing: border-box;

    display: flex;
    flex-direction: column;
    align-items: center;
}

#sidebar svg {
    flex: 1;
    width: 100%;
}

#sidebar p {
    margin: 0;
    margin-bottom: 0.5rem;
}

.line {
    stroke-width: 5;
    stroke-linecap: round;
    transition: opacity 0.2s ease;
}

.label {
    font-family: 'Jost', sans-serif;
    font-size: 10px;
    transition: opacity 0.2s ease;
}

.value.label {
    fill: blue;
}

.abstraction.label {
    fill: green;
}

.value.line {
    stroke: blue;
}

.abstraction.line {
    stroke: green;
}

.application.line {
    stroke: red;
}

.missing.line {
    stroke: black;
}

/* Default state - everything visible */
.group .label,
.group .line,
.text {
    transition: opacity 0.2s ease;
    opacity: 1;
}

/* When any node is hovered/selected, reduce opacity of all nodes */
.group:has(.hover.selected) .label,
.group:has(.hover.selected) .line {
    opacity: 0.25;
}

/* Keep the hovered/selected node and its children at full opacity */
.group:has(> .hover.selected) .label,
.group:has(> .hover.selected) .line {
    opacity: 1;
}

#lambdaTerm {
    margin-top: 0;
    text-align: center;
}

#lambdaTerm:has(.selected) .text {
    opacity: 0.25;
}

#lambdaTerm:has(.selected) .text.value {
    color: blue;
}

#lambdaTerm:has(.selected) .text.abstraction {
    color: green;
}

#lambdaTerm:has(.selected) .text.application {
    color: red;
}

.textGroup.selected .text {
    opacity: 1 !important;
}

#index {
    min-width: 4rem;
    text-align: center;
}

.buttonList {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;

    padding-bottom: 1rem;
}
