:root {
    --light-gray: rgba(0, 0, 0, 0.3);
    --medium-gray: rgba(0, 0, 0, 0.6);
    --dark-gray: rgba(0, 0, 0, 0.8);

    --primary-color: #007bff;
    --secondary-color: #6c757d;

    --nav-height: 48px;
    --nav-bg: #1e1e2e;
    --nav-text: #ccc;
    --nav-text-active: #fff;
    --nav-hover-bg: rgba(255, 255, 255, 0.08);
    --nav-active-bg: rgba(255, 255, 255, 0.14);
    --nav-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

body {
    margin: 0;
    padding: 0;
    color: var(--dark-gray);
    font-family: 'Roboto', sans-serif;
}

input,
select,
button,
textarea {
    font-family: inherit;
    font-size: inherit;
    color: var(--dark-gray);
    border: 1px solid var(--light-gray);
    padding: 0.2em 0.2em 0.2em 0.2em;
}

input:focus,
select:focus,
button:focus,
label:focus,
textarea:focus {
    outline-width: 1px;
    outline-color: var(--light-gray);
    outline-style: solid;
}

label {
    color: var(--medium-gray);
}

fieldset {
    padding-top: 0.1em;
    padding-right: 0.1em;
    padding-bottom: 0.1em;
    padding-left: 0.1em;
    margin: 0;
    border: none;
}

fieldset.border {
    border: 1px solid var(--light-gray);
    border-radius: 1px;
    padding: 0.5em 0.75em 0.75em 0.75em;
}

legend {
    margin: 0;
    padding: 0;
    color: var(--medium-gray);
    font-size: 0.85em;
    font-weight: lighter;
}


h1,
h2,
h3,
h4,
h5,
h6 {
    appearance: none;
    margin: 0;
    padding: 0;
}

/* ===== Tab ===== */
.tab-legend {
    width: 100%;
    border-bottom: 1px solid var(--light-gray);
}

button.tab {
    background: none;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    color: var(--medium-gray);
    padding: 0.3em;
    transition: color 0.15s, background 0.15s;
}

button.tab:hover {
    font-weight: bold;
}

button.tab--active {
    color: var(--primary-color);
    font-weight: bold;
    border-bottom: 2px solid var(--primary-color);
}

/* ===== Markdown Editor ===== */
.markdown-editor-border {
    border: 1px solid var(--light-gray);
    overflow: hidden;
}

/* ===== Mobile Font Scaling ===== */

@media (max-width: 980px) {}

/* ===== Page Layout ===== */

.page-container {
    padding: calc(var(--nav-height) + 0px) 0px 0px;
}

/* ===== Shared Nav Backdrop ===== */

.nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
}

/* ===== Desktop Nav ===== */

.desktop-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--nav-bg);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 16px;
    box-shadow: var(--nav-shadow);
}

.desktop-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    height: 100%;
    align-items: center;
}

.desktop-nav__item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.desktop-nav__dropdown-container {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.desktop-nav__link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    height: 100%;
    color: var(--nav-text);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}

.desktop-nav__link:hover {
    color: var(--nav-text-active);
    background: var(--nav-hover-bg);
}

.desktop-nav__link--active {
    color: var(--nav-text-active);
    background: var(--nav-active-bg);
}

.desktop-nav__chevron {
    font-size: 8px;
    opacity: 0.6;
}

.desktop-nav__submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 160px;
    background: var(--nav-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    list-style: none;
    margin: 0;
    padding: 4px 0;
    z-index: 1001;
    box-shadow: var(--nav-shadow);
}

.desktop-nav__submenu-link {
    display: block;
    padding: 8px 16px;
    color: var(--nav-text);
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}

.desktop-nav__submenu-link:hover {
    color: var(--nav-text-active);
    background: var(--nav-hover-bg);
}

.desktop-nav__submenu-link--active {
    color: var(--nav-text-active);
    background: var(--nav-active-bg);
}

/* ===== Mobile Nav ===== */

.mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--nav-bg);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 16px;
    box-shadow: var(--nav-shadow);
}

.mobile-nav__hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 6px;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-nav__hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--nav-text);
    border-radius: 1px;
}

.mobile-nav__overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

.mobile-nav__drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background: var(--nav-bg);
    z-index: 1002;
    transform: translateX(calc(-100% - 2px));
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    overflow-y: auto;
    box-shadow: none;
}

.mobile-nav__drawer--open {
    transform: translateX(0);
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.5);
}

.mobile-nav__close {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    padding: 0 16px;
    height: var(--nav-height);
    background: none;
    border: none;
    color: var(--nav-text);
    font-size: 18px;
    cursor: pointer;
    box-sizing: border-box;
}

.mobile-nav__close:hover {
    color: var(--nav-text-active);
}

.mobile-nav__list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.mobile-nav__link,
.mobile-nav__section-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 20px;
    color: var(--nav-text);
    text-decoration: none;
    font-size: 14px;
    font-family: inherit;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    box-sizing: border-box;
    transition: color 0.15s, background 0.15s;
}

.mobile-nav__link:hover,
.mobile-nav__section-btn:hover {
    color: var(--nav-text-active);
    background: var(--nav-hover-bg);
}

.mobile-nav__link--active,
.mobile-nav__section-btn--active {
    color: var(--nav-text-active);
    background: var(--nav-active-bg);
}

.mobile-nav__children {
    list-style: none;
    margin: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.2);
}

.mobile-nav__child-link {
    display: block;
    padding: 10px 20px 10px 36px;
    color: #aaa;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.15s, background 0.15s;
}

.mobile-nav__child-link:hover {
    color: var(--nav-text-active);
    background: var(--nav-hover-bg);
}

.mobile-nav__child-link--active {
    color: var(--nav-text-active);
    background: var(--nav-active-bg);
}

/* ===== Dialog ===== */

dialog {
    padding: 0;
    border: none;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.dialog__content {
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    overflow-y: auto;
}

.dialog--mobile {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0 0;
    border-radius: 12px 12px 0 0;
}

.dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.dialog__title {
    margin: 0;
    font-size: 16px;
}

.dialog__close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    line-height: 1;
    color: #555;
}

.dialog__close:hover {
    color: #000;
}
