/*
 * Infopolitie 2026 — Board Rules page
 * Modern redesign: sticky TOC sidebar + numbered rule cards
 */

/* =========================================================
   PAGE LAYOUT
   Two-column: narrow sticky TOC on right, rules on left.
   Collapses to single column on mobile.
   ========================================================= */

.boardrules-page {
    display: flex;
    align-items: flex-start;
    gap: 28px;
    padding: 20px 0 40px;
}

/* ---- Main content column ---- */
.boardrules-main {
    flex: 1;
    min-width: 0;
}

/* ---- Sticky TOC sidebar ---- */
.boardrules-toc {
    flex-shrink: 0;
    width: 230px;
    position: sticky;
    top: 16px;
    align-self: flex-start;
}

.boardrules-toc__inner {
    background: var(--ip-surface);
    border: 1px solid var(--ip-border);
    border-radius: var(--ip-radius);
    box-shadow: var(--ip-shadow);
    overflow: hidden;
}

.boardrules-toc__heading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    background: linear-gradient(90deg, var(--ip-blue-dark), var(--ip-blue));
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.boardrules-toc__list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
}

.boardrules-toc__list li {
    margin: 0;
    border-bottom: 1px solid var(--ip-border);
}

.boardrules-toc__list li:last-child {
    border-bottom: none;
}

.boardrules-toc__list a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--ip-text) !important;
    text-decoration: none;
    transition: background .12s, color .12s;
}

.boardrules-toc__list a::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ip-blue);
    flex-shrink: 0;
    opacity: .5;
    transition: opacity .12s;
}

.boardrules-toc__list a:hover {
    background: var(--ip-blue-faint) !important;
    color: var(--ip-blue) !important;
}

.boardrules-toc__list a:hover::before {
    opacity: 1;
}

/* ---- Intro text ---- */
.boardrules-intro {
    font-size: 14px;
    color: var(--ip-text-muted);
    line-height: 1.7;
    margin-bottom: 28px;
    padding: 14px 16px;
    background: var(--ip-surface);
    border: 1px solid var(--ip-border);
    border-left: 4px solid var(--ip-blue);
    border-radius: var(--ip-radius-sm);
}

/* ---- Category sections ---- */
.boardrules-category {
    margin-bottom: 32px;
}

.boardrules-category__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    padding: 0 0 10px;
    border-bottom: 2px solid var(--ip-border);
    scroll-margin-top: 20px;
}

.boardrules-category__number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--ip-blue);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
}

.boardrules-category__title {
    font-family: 'Roboto', sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: var(--ip-blue-dark);
    margin: 0;
    border: none !important;
    text-transform: none !important;
}

/* ---- Rule cards ---- */
.boardrules-rule-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.boardrules-rule-item {
    background: var(--ip-surface);
    border: 1px solid var(--ip-border);
    border-radius: var(--ip-radius-sm);
    padding: 14px 16px 14px 52px;
    position: relative;
    transition: border-color .15s, box-shadow .15s;
    font-size: 14px;
    line-height: 1.65;
    color: var(--ip-text);
    counter-increment: rule-counter;
}

.boardrules-rule-item:hover {
    border-color: var(--ip-blue-light);
    box-shadow: 0 2px 8px rgba(0,102,153,.08);
}

/* Numbered badge (absolute left) */
.boardrules-rule-item::before {
    content: counter(rule-counter);
    position: absolute;
    left: 14px;
    top: 14px;
    width: 24px;
    height: 24px;
    background: var(--ip-blue-faint);
    color: var(--ip-blue);
    border: 1px solid var(--ip-blue-light);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Reset counter for each category list */
.boardrules-rule-list {
    counter-reset: rule-counter;
}

/* Highlighted rule — triggered by :target (anchor navigation) */
.boardrules-rule-item:target {
    border-color: var(--ip-orange) !important;
    background: #fff8f0 !important;
    box-shadow: 0 0 0 3px rgba(236,100,0,.15), 0 3px 12px rgba(236,100,0,.12) !important;
    animation: ip-rule-ping 1.2s ease-out;
}

.boardrules-rule-item:target::before {
    background: var(--ip-orange);
    border-color: var(--ip-orange-dark);
    color: #fff;
}

[data-theme="dark"] .boardrules-rule-item:target {
    background: #2a1500 !important;
    border-color: var(--ip-orange) !important;
    box-shadow: 0 0 0 3px rgba(236,100,0,.2), 0 3px 12px rgba(0,0,0,.4) !important;
}

@keyframes ip-rule-ping {
    0%   { box-shadow: 0 0 0 0 rgba(236,100,0,.45); }
    60%  { box-shadow: 0 0 0 10px rgba(236,100,0,0); }
    100% { box-shadow: 0 0 0 3px rgba(236,100,0,.15), 0 3px 12px rgba(236,100,0,.12); }
}

/* Anchor link inside rule */
.rule-anchor {
    font-size: 11px;
    color: var(--ip-text-light) !important;
    margin-left: 6px;
    opacity: 0;
    transition: opacity .15s;
    text-decoration: none !important;
    vertical-align: middle;
}

.boardrules-rule-item:hover .rule-anchor {
    opacity: 1;
}

/* Sub-lists inside rule text */
.boardrules-rule-item ul,
.boardrules-rule-item ol {
    margin: 8px 0 0 20px;
    font-size: 0.95em;
}

/* ---- Highlight ---- */
.highlight {
    font-weight: 700;
    background: #fff3cd;
    color: #7c4d00;
    padding: 1px 5px;
    border-radius: 3px;
}

[data-theme="dark"] .highlight {
    background: #3d2d00;
    color: #ffd97e;
}

/* =========================================================
   DARK MODE
   ========================================================= */

[data-theme="dark"] .boardrules-toc__inner {
    background: var(--ip-surface-2);
    border-color: var(--ip-border);
}

[data-theme="dark"] .boardrules-toc__list a {
    color: var(--ip-text) !important;
}

[data-theme="dark"] .boardrules-toc__list a:hover {
    background: var(--ip-blue-faint) !important;
    color: var(--ip-blue-light) !important;
}

[data-theme="dark"] .boardrules-intro {
    background: var(--ip-surface-2);
    border-color: var(--ip-border);
    border-left-color: var(--ip-blue);
    color: var(--ip-text-muted);
}

[data-theme="dark"] .boardrules-category__title {
    color: var(--ip-blue-light);
}

[data-theme="dark"] .boardrules-category__header {
    border-bottom-color: var(--ip-border);
}

[data-theme="dark"] .boardrules-rule-item {
    background: var(--ip-surface-2);
    border-color: var(--ip-border);
    color: var(--ip-text);
}

[data-theme="dark"] .boardrules-rule-item:hover {
    border-color: var(--ip-blue);
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

[data-theme="dark"] .boardrules-rule-item::before {
    background: var(--ip-blue-faint);
    border-color: var(--ip-blue-dark);
    color: var(--ip-blue-light);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 768px) {
    .boardrules-page {
        flex-direction: column-reverse; /* TOC above rules on mobile */
        gap: 16px;
    }

    .boardrules-toc {
        width: 100%;
        position: static;
    }

    .boardrules-toc__list {
        display: flex;
        flex-wrap: wrap;
        gap: 0;
        padding: 8px;
    }

    .boardrules-toc__list li {
        border: none;
        flex: 0 0 50%;
    }

    .boardrules-toc__list a {
        padding: 6px 10px;
        font-size: 12px;
    }

    .boardrules-rule-item {
        padding-left: 44px;
    }
}

@media (max-width: 480px) {
    .boardrules-toc__list li {
        flex: 0 0 100%;
    }

    .boardrules-category__number {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }

    .boardrules-category__title {
        font-size: 15px;
    }
}
