:root {
    --color-accent: #FFCEE4;
    --color-primary: #B25A66;
    --color-secondary: #7F1F3A;
    --color-tertiary: #D01257;
    --color-grey: #f6f6f6;
    --max-width: 1200px;
    --spacing: 2rem;
}

* {
    box-sizing: border-box;
}

/* GLOBAL TAG STYLES */
body {
    font-family: "Kode Mono", monospace;
    letter-spacing: 0.07em;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-weight: normal;
}

nav,
main,
footer {
    padding: var(--spacing);
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

a {
    color: black;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--color-tertiary);
}

ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

nav ul {
    display: flex;
    gap: 2rem;
    align-items: center;
    justify-content: flex-end;
}

nav li {
    margin: 0;
}

.active,
.selected {
    color: var(--color-primary);
}

main {
    flex: 1;
    font-size: 1.1rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: normal;
}

header {
    margin-bottom: 2rem;
}

h2 {
    font-weight: 800;
    margin-bottom: 0.5rem;
}

h3 {
    font-weight: 700;
    margin-bottom: 0.75rem;
}

h4 {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

p {
    line-height: 1.9;
    margin-bottom: 1.4rem;
}

code {
    font-size: 1.1rem;
    font-weight: 500;
    background: #f3f3f3;
}

pre {
    background: var(--color-grey);
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 12px 14px;
    margin: 0.5rem 0 0.75rem;
    overflow-x: auto;
}

pre code {
    background: none;
    padding: 0;
    font-size: 1rem;
}

section {
    padding-top: 1.75rem;
    border-top: 1px solid #e5e5e5;
    margin-top: 1.75rem;
}

.allocator-selection {
    display: flex;
    justify-content: flex-start;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.toggle {
    font-family: inherit;
    background: var(--color-grey);
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    border: none;
    letter-spacing: 0.07em;
    cursor: pointer;
    border-radius: 0.5rem;
}

#allocator {
    display: none;
}

#allocator.view {
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    position: relative;
    border: 2px solid black;
    border-radius: 2px;
}

.block {
    position: absolute;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.block.header {
    background: #84cc16;
}

.block.used {
    background: var(--color-secondary);
    color: var(--color-accent);
    border-left: 1.5px solid var(--color-primary);
    border-right: 1.5px solid var(--color-primary);
}

.block.free {
    background: #e0e0e0;
    border-left: 1.5px solid var(--color-primary);
    border-right: 1.5px solid var(--color-primary);
}

.block:first-child {
    border-left: none;
}

.block:last-child {
    border-right: none;
}

#legend {
    display: none;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

#legend.view {
    display: flex;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.legend-swatch {
    position: relative;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 0.125rem;
    flex-shrink: 0;
}

.block.legend-swatch {
    border: none;
}

#note {
    display: none;
}

#note.view, #error.view {
    display: block;
    align-self: center;
    justify-self: center;
    padding-top: 2rem;
    font-size: 0.7rem;
}

#error {
    display: none;
}

#error.view {
    color: var(--color-secondary);
    font-weight: 700;
    font-size: 0.8rem;
}

.metrics ul {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.9rem;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1rem;
}

.controls select,
.controls input[type="number"] {
    padding: 0.25rem 0.5rem;
    background: #fff;
    border: 1px solid black;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
}

.controls select:focus,
.controls input[type="number"]:focus {
    outline: none;
    border-color: var(--color-primary);
}

.controls select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.controls button {
    padding: 4px 10px;
    background: var(--color-primary);
    border: 1px solid var(--color-secondary);
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
    font-size: inherit;
    font-family: inherit;
}

.controls button:hover {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
}

.controls button:active {
    background: var(--color-tertiary);
    border-color: var(--color-tertiary);
}

.method {
    padding-bottom: 1.25rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid #f0f0f0;
}

.method ul {
    display: block;
}

.method li {
    line-height: 1.5;
}

.method:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

#design,
#api,
#usage,
#dependencies,
#future {
    padding-top: 1.5rem;
    border-top: 1px solid #e5e5e5;
    margin-top: 1.5rem;
}

.docs-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-inline-start: 2rem;
    list-style-type: disc;
}

footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

footer ul {
    gap: 2rem;
    align-items: center;
    justify-content: flex-end;
}

footer li {
    margin: 0;
}

#copyright {
    font-size: clamp(0.8rem, 2vw, 1rem);
    padding: 1rem 0;
}

/* navigation dropdown */
.dropdown {
    position: relative;
}

.dropdown-trigger {
    background: none;
    border: none;
    font-family: inherit;
    letter-spacing: 0.08em;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s ease;
}

.dropdown-trigger:hover,
.dropdown-trigger.active {
    color: var(--color-tertiary);
}

.dropdown-trigger span {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 1.25rem;
}

.dropdown.open .dropdown-trigger span {
    transform: rotate(180deg);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    min-width: 160px;
    z-index: 100;
    padding: 0.25rem 0;
    font-size: 1rem;
}

.dropdown-menu li {
    width: 100%;
}

.dropdown-menu a {
    display: block;
    padding: 0.5rem 0.5rem;
    white-space: nowrap;
    transition: color 0.2s ease, background 0.2s ease;
}

.dropdown-menu a:hover {
    color: var(--color-tertiary);
    background: var(--color-accent);
}

.dropdown-menu {
    display: none;
}

.dropdown-menu.open {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: right;
}