/* =========================================================
   KINETIC DIPLOMACY WIKI
   Dark theme with burgundy and rose accents
   ========================================================= */

/* 1. Theme variables */

:root {
    --hippie-pink: #a6446d;
    --wine-berry: #531d4c;
    --tawny-port: #6c2857;
    --camelot: #7c2c5c;

    --twilight: #e6d0db;
    --bouquet: #bc839e;
    --viola: #cd96ae;
    --turkish-rose: #b06b8c;
    --lily: #c49cb4;

    --background: #181619;
    --surface: #211e23;
    --surface-raised: #29242b;
    --surface-hover: #342a34;

    --border: #403641;
    --border-accent: #68445e;

    --text: #e8e4e8;
    --text-muted: #b8adb8;
    --text-heading: #f4edf3;

    --link: #d99ab9;
    --link-hover: #efbdd5;
    --accent: #b95e88;

    --navbar-height: 64px;
    --content-width: 1600px;
}


/* 2. Global styles */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.7;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

h1,
h2,
h3 {
    color: var(--text-heading);
}

button {
    font: inherit;
}


/* 3. Top navigation */

.site-header {
    position: relative;
    z-index: 10;
    background: linear-gradient(
        110deg,
        var(--wine-berry),
        var(--tawny-port) 60%,
        var(--hippie-pink)
    );
    border-bottom: 1px solid #854566;
}

.navbar {
    width: 100%;
}

.navdiv {
    display: flex;
    align-items: center;
    gap: 32px;

    max-width: var(--content-width);
    min-height: var(--navbar-height);
    margin: 0 auto;
    padding: 0 24px;
}

.brand {
    flex-shrink: 0;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.brand:hover {
    color: var(--twilight);
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: stretch;
    align-self: stretch;
    gap: 24px;

    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-links li {
    display: flex;
    align-items: stretch;
    margin: 0;
    padding: 0;
}

.nav-links a {
    display: flex;
    align-items: center;

    padding: 0 2px;
    border-bottom: 3px solid transparent;

    color: #f5eaf1;
    font-size: 0.95rem;
    font-weight: 600;
}

.nav-links a:hover {
    color: #fff;
    border-bottom-color: var(--bouquet);
    text-decoration: none;
}

.nav-links a.selected {
    color: #fff;
    border-bottom-color: #f0b5d0;
}

.user-name {
    margin-left: auto;
    color: #f5eaf1;
    font-size: 0.9rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}


/* 4. Main wiki layout */

.wiki-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: start;
    gap: 28px;

    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 32px 24px;
}


/* 5. Main article */

.wiki-content {
    min-width: 0;
    padding: 0 0 40px;
    overflow-wrap: anywhere;
}

.wiki-content h1 {
    margin: 0 0 22px;
    padding-bottom: 12px;

    border-bottom: 1px solid var(--border-accent);

    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
    font-weight: 400;
    line-height: 1.35;
}

.wiki-content h2 {
    margin: 32px 0 12px;
    padding-bottom: 6px;

    border-bottom: 1px solid var(--border);

    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.45rem;
    font-weight: 400;
    line-height: 1.4;
}

.wiki-content h3 {
    margin: 24px 0 8px;
    font-size: 1.1rem;
    font-weight: 600;
}

.wiki-content p {
    margin: 12px 0;
}

.wiki-content ul,
.wiki-content ol {
    padding-left: 28px;
}

.wiki-content li {
    margin: 5px 0;
}

.wiki-content strong {
    color: var(--text-heading);
}

.wiki-intro {
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.8;
}


/* 6. Left and right sidebars */

.wiki-sidebar {
    min-width: 0;
    font-size: 0.9rem;
}

.sidebar-section {
    margin-bottom: 24px;
    padding: 16px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.sidebar-section h2 {
    margin: 0 0 12px;
    padding-bottom: 8px;

    border-bottom: 1px solid var(--border);

    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
}

.sidebar-section ul {
    margin: 0;
    padding-left: 18px;
}

.sidebar-section li {
    display: list-item;
    margin: 8px 0;
    line-height: 1.5;
}

.sidebar-section p {
    margin: 8px 0;
    overflow-wrap: anywhere;
}

.sidebar-section a {
    overflow-wrap: anywhere;
}


/* 7. Interactive elements */

button {
    padding: 9px 14px;

    color: var(--text-heading);
    background: var(--tawny-port);

    border: 1px solid var(--border-accent);
    border-radius: 5px;

    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

button:hover {
    background: var(--camelot);
    border-color: var(--bouquet);
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--viola);
    outline-offset: 3px;
}

.sobtn {
    width: 135px;
}


/* 8. Dashboard components */

.flex-container {
    display: none;
    flex-wrap: wrap;
    align-content: stretch;
    gap: 20px;

    min-height: 200px;
    height: auto;
}

.flex-container > div {
    flex: 1 1 300px;
    min-width: 0;
    margin: 0;
    padding: 24px;

    color: var(--text);
    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 8px;

    text-align: center;
    overflow-wrap: anywhere;
}


/* 9. Loading bar */

.ldBar {
    position: relative;
}

.ldBar.label-center > .ldBar-label {
    position: absolute;
    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);
    color: var(--text-heading);
    text-shadow: 0 0 3px var(--background);
}

.ldBar-label::after {
    content: "%";
    display: inline;
}

.ldBar.no-percent .ldBar-label::after {
    content: "";
}


/* 10. Modal */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;

    width: 100%;
    height: 100%;
    padding: 24px;
    overflow: auto;

    background: rgb(0 0 0 / 80%);
}

.modal-content {
    width: 100%;
    max-width: 600px;
    margin: 5vh auto;
    padding: 24px;

    color: var(--text);
    background: var(--surface-raised);

    border: 1px solid var(--border);
    border-radius: 8px;
}


/* 11. Tables and code blocks */

.wiki-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: var(--surface);
}

.wiki-content th,
.wiki-content td {
    padding: 10px 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.wiki-content th {
    background: var(--surface-raised);
    color: var(--text-heading);
}

code,
pre {
    font-family: Consolas, "Courier New", monospace;
}

code {
    padding: 2px 5px;
    color: var(--twilight);
    background: var(--surface-raised);
    border-radius: 3px;
}

pre {
    max-width: 100%;
    padding: 16px;
    overflow-x: auto;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
}


/* 12. Medium screens */

@media (max-width: 1100px) {
    .wiki-layout {
        grid-template-columns: 190px minmax(0, 1fr);
        gap: 24px;
    }

    .wiki-sidebar-right {
        grid-column: 2;
    }
}


/* 13. Mobile screens */

@media (max-width: 700px) {
    .navdiv {
        flex-wrap: wrap;
        gap: 8px 20px;
        padding: 12px 16px;
    }

    .brand {
        font-size: 1.1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        gap: 0 16px;
        min-height: 40px;
    }

    .nav-links a {
        min-height: 40px;
        font-size: 0.9rem;
    }

    .user-name {
        margin-left: 0;
        padding: 4px 0;
    }

    .wiki-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
        padding: 20px 16px;
    }

    .wiki-content {
        grid-row: 1;
    }

    .wiki-sidebar-left,
    .wiki-sidebar-right {
        grid-column: 1;
    }

    .wiki-content h1 {
        font-size: 1.7rem;
    }

    .wiki-content h2 {
        font-size: 1.3rem;
    }

    .sidebar-section {
        margin-bottom: 16px;
    }
}


/* 14. Reduced motion accessibility */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}