
/* ==========================================================
   1. GLOBAL SETTINGS
   ========================================================== */

:root
{
    font-family: Arial, Helvetica, sans-serif;
    color: #222222;
    background: #f7fafc;
}

*
{
    box-sizing: border-box;
}

body
{
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
}

a
{
    color: #126c9c;
}


/* ==========================================================
   2. HEADER / TOP BAR
   ========================================================== */

.topbar
{
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 80px;
    padding: 8px max(24px, calc((100vw - 1100px) / 2));
    background: #00643B;
}


/* ==========================================================
   3. HOME ICON AND WEBSITE TITLE
   ========================================================== */

.home-brand
{
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    gap: 10px;
    text-decoration: none;
    white-space: nowrap;
    color: #FFFFFF;
    font-size: 20px;
    font-weight: 700;
}

.home-icon
{
    font-size: 30px;
    line-height: 1;
}

.home-brand:hover,
.home-brand:focus-visible
{
    text-decoration: underline;
}


/* ==========================================================
   4. MAIN NAVIGATION MENU
   ========================================================== */

.mainnav
{
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    flex-wrap: wrap;
    gap: 4px;
}

.mainnav a
{
    padding: 14px 16px;
    border-radius: 6px;
    background: transparent;
    color: #FFFFFF;
    font-weight: 600;
    text-decoration: none;
}

.mainnav a:hover,
.mainnav a:focus-visible
{
    background: #c0e1f1;
    color: #00643B;
}


/* ==========================================================
   5. MAIN PAGE CONTAINER
   ========================================================== */

.container
{
    flex: 1;
    width: min(1100px, 100%);
    margin: 0 auto;
    padding: 36px 24px 60px;
}


/* ==========================================================
   6. HEADINGS
   ========================================================== */

h1
{
    margin-top: 0;
    color: #00643B;
    font-size: 32px;
}

h2
{
    color: #00643B;
}


/* ==========================================================
   7. CONTENT CARDS
   ========================================================== */

.cards
{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-top: 32px;
}

.card
{
    padding: 24px;
    border: 1px solid #d3e2ec;
    border-radius: 10px;
    background: #FFFFFF;
    text-decoration: none;
    box-shadow: 0 2px 6px #11223344;
}

.card h2
{
    margin: 0 0 24px;
    color: #00643B;
    font-size: 22px;
}

.card span
{
    font-size: 14px;
}


/* ==========================================================
   8. FOLDER / DOCUMENT TREE
   ========================================================== */

.folder-tree
{
    padding-left: 25px;
    line-height: 2;
}

.folder-tree li
{
    padding-left: 4px;
}

.folder-tree strong {
    color: #00643B;
}


/* ==========================================================
   9. MARKDOWN DOCUMENT CONTENT
   ========================================================== */

.document
{
    max-width: 850px;
    color: #222222;
    font-size: 17px;
    line-height: 1.75;
}

.document h2
{
    padding-bottom: 8px;
    border-bottom: 3px solid #d7e7ed;
    color: #00643B;
}


/* ==========================================================
   COLLAPSIBLE DOCUMENT SECTIONS
   ========================================================== */

.document-section
{
    margin: 0 0 30px;
}

.document-section summary
{
    position: relative;
    display: list-item;
    margin: 0 0 14px;
    padding: 8px 36px 10px 0;
    border-bottom: 2px solid #A5C9B6;
    color: #00643B;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.document-section summary::-webkit-details-marker
{
    display: none;
}

.document-section summary::after
{
    position: absolute;
    top: 50%;
    right: 6px;
    color: #258A5D;
    font-size: 20px;
    font-weight: 400;
    content: "▾";
    transform: translateY(-50%);
}

.document-section:not([open]) summary::after
{
    content: "▸";
}

.document-section-content
{
    padding: 8px 0 12px;
}

.document-section summary:hover
{
    color: #258A5D;
}

.document-section summary:focus-visible
{
    outline: 2px solid #258A5D;
    outline-offset: 3px;
}

/* ==========================================================
   10. FOOTER
   ========================================================== */

.footer
{
    padding: 23px 24px;
    background: #00643B;
    color: #FFFFFF;
    font-size: 14px;
    text-align: center;
}


/* ==========================================================
   11. RESPONSIVE LAYOUT - TABLETS
   ========================================================== */

@media (max-width: 760px)
{
    .topbar
    {
        flex-wrap: wrap;
    }

    .mainnav
    {
        flex-basis: 100%;
        justify-content: flex-start;
    }

}


/* ==========================================================
   12. RESPONSIVE LAYOUT - MOBILE
   ========================================================== */

@media (max-width: 620px)
{
    .topbar
    {
        align-items: flex-start;
        gap: 12px;
        padding: 12px 16px;
    }

    .mainnav
    {
        justify-content: flex-start;
    }

    .mainnav a
    {
        padding: 9px 10px;
        font-size: 14px;
    }

}

/* ==========================================================
   SECTION PAGE
   ========================================================== */

/* ==========================================================
   SECTION PAGE - HEADING AND GROUPS
   ========================================================== */

.section-page
{
    max-width: 900px;
}

.section-page h1
{
    margin: 0 0 40px;
    color: #00643B;
    font-size: 32px;
    font-weight: 700;
}

.section-groups
{
    display: flex;
    flex-direction: column;
    gap: 36px;
}

.section-group h2
{
    margin: 0 0 12px;
    color: #00643B;
    font-size: 23px;
    font-weight: 600;
}


/* ==========================================================
   SECTION PAGE - INDENTED LINKS
   ========================================================== */

.section-items
{
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-left: 28px;
}

.section-link
{
    color: #258A5D;
    font-size: 16px;
    font-weight: 400;
    text-decoration: none;
}

.section-link:hover,
.section-link:focus-visible
{
    color: #00643B;
    text-decoration: underline;
}


/* ==========================================================
   FOLDER DESCRIPTIONS
   ========================================================== */

.section-description {
    margin: 0 0 20px;
    color: #333333;
    font-size: 16px;
    line-height: 1.6;
}

.section-description p {
    margin: 0 0 10px;
}

.section-description p:last-child {
    margin-bottom: 0;
}


/* ==========================================================
   FOLDER DOCUMENT LISTS
   ========================================================== */

.section-page > .section-items
{
    margin-top: 24px;
}

/* ==========================================================
   NUMBERED DOCUMENT PARAGRAPHS
   ========================================================== */

.numbered-paragraph
{
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    margin: 0 0 20px;
}

.paragraph-ref
{
    color: #258A5D;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}

.paragraph-text
{
    min-width: 0;
    color: #222222;
    font-size: 17px;
    line-height: 1.75;
}

.paragraph-text p:first-child
{
    margin-top: 0;
}

.paragraph-text p:last-child
{
    margin-bottom: 0;
}

./* ==========================================================
   NUMBERED PARAGRAPHS - BULLET LISTS
   ========================================================== */

.paragraph-text ul,
.paragraph-text ol
{
    margin: 10px 0 16px;
    padding-left: 08px;
    list-style-position: outside;
}

.paragraph-text li
{
    padding-left: 38px;
    margin-bottom: 5px;
}


/* ==========================================================
   DOCUMENT TOOLBAR
   ========================================================== */

.document-toolbar
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px;
}

.document-toolbar-actions
{
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.document-back
{
    min-width: 44px;
    font-size: 22px;
    font-weight: 600;
}



/* ==========================================================
   DOCUMENT STATISTICS
   ========================================================== */

.statistics-table
{
    width: 100%;
    max-width: 620px;
    margin: 24px 0 30px;
    border-collapse: collapse;
}

.statistics-table th,
.statistics-table td
{
    padding: 12px 16px;
    border-bottom: 1px solid #D7E7ED;
    font-size: 16px;
}

.statistics-table th
{
    color: #00643B;
    font-weight: 600;
    text-align: left;
}

.statistics-table td
 {
    color: #222222;
    text-align: right;
}

.document-tool
{
    text-decoration: none;
}

/* ==========================================================
   FOLDER PAGE - THREE COLUMN DOCUMENT LIST
   ========================================================== */

.folder-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 30px;
    row-gap: 14px;
    margin-top: 24px;
}

.folder-grid .section-link {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
}


/* ==========================================================
   FOLDER PAGE - RESPONSIVE COLUMNS
   ========================================================== */

@media (max-width: 760px) {

    .folder-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 480px) {

    .folder-grid {
        grid-template-columns: 1fr;
    }

}


/* --------------------------------------------------
   Cross-reference links
-------------------------------------------------- */

.paragraph-reference {
    cursor: pointer;
    color: #258A5D;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}

.paragraph-reference:hover,
.paragraph-reference:focus-visible {
    color: #00643B;
    text-decoration-style: solid;
}

.paragraph-reference:focus-visible {
    outline: 2px solid #00643B;
    outline-offset: 3px;
}


/* --------------------------------------------------
   Cross-reference tooltip
-------------------------------------------------- */

.reference-tooltip
{
    position: fixed;
    z-index: 2000;
    width: min(420px, calc(100vw - 24px));
    max-height: min(350px, calc(100vh - 24px));
    overflow-y: auto;
    padding: 16px;
    border: 1px solid #D6DFD9;
    border-radius: 8px;
    background: #FFFFFF;
    color: #222222;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: normal;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.18);
}

.reference-tooltip[hidden]
{
    display: none;
}

.reference-tooltip strong
{
    display: block;
    margin-bottom: 10px;
    color: #00643B;
    font-size: 1rem;
}

.reference-tooltip-content
{
    color: #222222;
}

.reference-highlight
{
    font-weight: 700;
}

.reference-tooltip
{
    overscroll-behavior: contain;
}


/* --------------------------------------------------
   Cross-reference tooltip Markdown
-------------------------------------------------- */

.reference-tooltip-markdown {
    white-space: normal;
    overflow-wrap: anywhere;
}

.reference-tooltip-markdown p {
    margin: 0 0 10px 0;
}

.reference-tooltip-markdown p:last-child {
    margin-bottom: 0;
}

.reference-tooltip-markdown ul,
.reference-tooltip-markdown ol {
    margin: 8px 0 12px 0;
    padding-left: 24px;
}

.reference-tooltip-markdown li {
    margin-bottom: 5px;
}

.reference-tooltip-markdown li p {
    margin-bottom: 5px;
}

.reference-tooltip-markdown blockquote {
    margin: 10px 0;
    padding-left: 12px;
    border-left: 3px solid #D6DFD9;
}

.reference-tooltip-markdown pre {
    overflow-x: auto;
    padding: 10px;
    border-radius: 4px;
    background: #F4F6F4;
}

.reference-tooltip-markdown code {
    font-size: 0.9em;
}

/* --------------------------------------------------
   Cross-reference validation
-------------------------------------------------- */

.paragraph-reference.reference-current {
    color: #258A5D;
}

.paragraph-reference.reference-historical {
    color: #A87800;
}

.paragraph-reference.reference-missing {
    color: #B42318;
}

.paragraph-reference.reference-unverified {
    color: #666666;
}

.reference-indicator {
    font-weight: 700;
}

/* --------------------------------------------------
   Cross-reference bullet highlighting
-------------------------------------------------- */

.reference-tooltip-content .reference-highlight {
    font-weight: 700;
}

.reference-tooltip-warning {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #D6DFD9;
    color: #A87800;
    font-size: 0.85rem;
}

/* --------------------------------------------------
   Cross-reference ranges
-------------------------------------------------- */

.reference-range-paragraph {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #D6DFD9;
}

.reference-range-paragraph:last-child {
    margin-bottom: 0;
    border-bottom: 0;
}

.reference-range-paragraph > strong {
    display: block;
    margin-bottom: 6px;
    color: #00643B;
}

.reference-tooltip-error {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #D6DFD9;
    color: #B42318;
    font-size: 0.85rem;
    font-weight: 600;
}

.nav-admin {
    position: relative;
    display: inline-block;
}

.nav-admin summary {
    cursor: pointer;
    list-style: none;
}

.nav-admin-links {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: white;
    border: 1px solid #ccc;
    padding: 8px;
    z-index: 100;
    box-shadow: 0 3px 8px #0002;
}

.nav-admin-links a {
    display: block;
    padding: 8px;
    text-decoration: none;
    color: #222;
}

.nav-admin-links a:hover {
    background: #eee;
}


/* ==========================================
   Admin pages — Events and Motions
   ========================================== */

.admin-form {
    max-width: 900px;
    padding: 20px;
    margin: 20px 0 30px;
    background: #f4f5f6;
    border-radius: 8px;
}

.admin-form label {
    display: block;
    margin-top: 14px;
    font-weight: 600;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 9px;
    margin-top: 5px;
    font: inherit;
    border: 1px solid #bbb;
    border-radius: 4px;
}

.admin-form textarea {
    resize: vertical;
}

.admin-form button {
    margin-top: 20px;
    padding: 10px 20px;
    cursor: pointer;
}

/* Existing events table */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0 30px;
}

.admin-table th,
.admin-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.admin-table th {
    background: #f4f5f6;
}

/* Flask messages */

.message {
    padding: 12px 15px;
    margin: 15px 0;
    background: #e8edf2;
    border-radius: 5px;
}

.message-success {
    background: #e1f2e5;
}

.message-error {
    background: #f8e1e1;
}

/* Help text below admin form fields */

.admin-form .form-help {
    margin: 6px 0 14px;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}



/* Motion chapter validation warning */

.motion-warning {
    padding: 18px;
    margin: 20px 0;
    border: 1px solid #d5a04a;
    border-left: 4px solid #c58b2d;
    border-radius: 6px;
    background: #fff9ed;
}

.motion-warning h3
{
    margin-top: 0;
}

.motion-warning-actions
{
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
}

.motion-warning-actions button,
.motion-warning-actions .button-secondary
{
    padding: 10px 16px;
    font: inherit;
    cursor: pointer;
}

.motion-warning-actions .button-secondary
{
    text-decoration: none;
    border: 1px solid #aaa;
    border-radius: 4px;
    color: #333;
    background: #fff;
}


/* ==========================================
   Existing motions table
   ========================================== */

.existing-motions
{
    margin: 35px 0;
}

.motion-event-filter
{
    display: block;
    width: 100%;
    max-width: 360px;
    box-sizing: border-box;
    margin: 8px 0 20px;
    padding: 9px;
    font: inherit;
}

.admin-table-scroll
{
    overflow-x: auto;
    max-width: 100%;
}

.existing-motions .admin-table
{
    min-width: 850px;
}

.existing-motions .admin-table th,
.existing-motions .admin-table td
{
    vertical-align: middle;
    white-space: nowrap;
}

.motion-check
{
    font-size: 0.9rem;
    font-weight: 600;
}

.motion-check.valid
{
    color: #26733d;
}

.motion-check.warning
{
    color: #9b641b;
}


/* ==========================================
   Individual motion view
   ========================================== */

.motion-view {
    max-width: 1000px;
    margin: 0 auto;
}

.motion-navigation {
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #666;
}

.motion-details {
    padding: 15px 20px;
    margin: 20px 0 30px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f5f6f7;
}

.motion-details p {
    margin: 8px 0;
}

.motion-document {
    margin: 25px 0 35px;
    line-height: 1.7;
}

.motion-document h2 {
    margin-top: 25px;
    padding-bottom: 6px;
    border-bottom: 1px solid #ddd;
}

.motion-return {
    margin: 30px 0;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}


/* Collapsible Admin creation forms */

.admin-create {
    margin: 25px 0 35px;
    border: 1px solid #d5dad8;
    border-radius: 8px;
    overflow: visible;
}

.admin-create > summary {
    padding: 15px 20px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    background: #f4f5f6;
    border-radius: 8px;
}

.admin-create[open] > summary {
    border-bottom: 1px solid #d5dad8;
    border-radius: 8px 8px 0 0;
}

.admin-create > .admin-form,
.admin-create > .motion-entry {
    margin: 15px 20px 20px;
}

.admin-create .admin-form {
    max-width: none;
}

.admin-create > summary:hover {
    background: #e9eeeb;
}
