/* ── Site-wide shared styles ───────────────────────────────────────────────── */
/* Matching organicchemistrydata.org branding                                 */

/* Using system font stack — no external font download needed */

:root {
    --ocd-red: #ba0000;
    --ocd-red-dark: #8a0000;
    --ocd-blue: #3a6486;
    --ocd-blue-light: #81bedb;
    --ocd-sidebar-width: 300px;
    --ocd-navbar-height: 116px;
    --ocd-navbar-height-shrunk: 66px;
    --ocd-content-max-width: 1200px;
    --ocd-content-padding-x: 1.5rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a {
    color: var(--ocd-red);
}
a:hover {
    color: var(--ocd-red-dark);
}

/* ── Global content containment (prevent edge-to-edge) ─────────────────────── */
main.flex-fill {
    padding-left: var(--ocd-content-padding-x);
    padding-right: var(--ocd-content-padding-x);
}
main.flex-fill > .container,
main.flex-fill > .container-fluid {
    max-width: var(--ocd-content-max-width);
    margin-left: auto;
    margin-right: auto;
}
/* Full-width pages: sidebars and homepage hex grid */
main.flex-fill:has(#wrapper),
main.flex-fill:has(#reusch-wrapper),
main.flex-fill:has(.hex-container) {
    padding-left: 0;
    padding-right: 0;
}

/* ── Unified sidebar styles ────────────────────────────────────────────────── */
.ocd-sidebar-wrapper {
    display: flex;
    min-height: calc(100vh - var(--ocd-navbar-height));
}
.ocd-sidebar {
    width: var(--ocd-sidebar-width);
    min-width: var(--ocd-sidebar-width);
    max-height: calc(100vh - var(--ocd-navbar-height));
    overflow-y: auto;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    position: sticky;
    top: var(--ocd-navbar-height);
    padding: 0.5rem 0;
    flex-shrink: 0;
    font-size: 0.85rem;
    transition: top 0.3s ease, max-height 0.3s ease;
}
.ocd-sidebar .sidebar-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ocd-red);
    padding: 0.75rem 1rem 0.25rem;
}
.ocd-sidebar .nav-link,
.ocd-sidebar .page-link {
    display: block;
    padding: 0.3rem 1rem;
    font-size: 0.85rem;
    color: #333;
    text-decoration: none;
    border-left: 3px solid transparent;
}
.ocd-sidebar .nav-link:hover,
.ocd-sidebar .page-link:hover {
    background: #e9ecef;
}
.ocd-sidebar .nav-link.active,
.ocd-sidebar .nav-link.page-active,
.ocd-sidebar .page-link.active {
    background: #e2e6ea;
    border-left-color: var(--ocd-red);
    font-weight: 600;
}
.ocd-sidebar .sub-link {
    padding-left: 2rem;
    font-size: 0.82rem;
}
.ocd-sidebar .chapter-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ocd-red);
    padding: 0.75rem 1rem 0.25rem;
    cursor: pointer;
    user-select: none;
}
.ocd-sidebar .chapter-title:hover { background: #e9ecef; }
.ocd-sidebar .chapter-title::before {
    content: '\25B6';
    font-size: 0.6rem;
    margin-right: 0.3rem;
    display: inline-block;
    transition: transform 0.2s;
}
.ocd-sidebar .chapter-title.open::before { transform: rotate(90deg); }
.ocd-sidebar .chapter-pages { display: none; }
.ocd-sidebar .chapter-pages.open { display: block; }

/* Sidebar content area */
.ocd-content-area {
    flex: 1;
    min-width: 0;
    max-width: var(--ocd-content-max-width);
}
.ocd-content-area .content-body {
    padding: 1rem var(--ocd-content-padding-x);
}
.ocd-content-area .content-body img {
    max-width: 100%;
    height: auto;
}

/* Breadcrumbs (shared) */
.ocd-breadcrumb {
    padding: 0.5rem var(--ocd-content-padding-x);
    background: #f0f0f0;
    font-size: 0.8rem;
    border-bottom: 1px solid #dee2e6;
}
.ocd-breadcrumb a { color: #555; text-decoration: none; }
.ocd-breadcrumb a:hover { color: var(--ocd-red); }

/* Prev/Next (shared) */
.ocd-prev-next {
    display: flex;
    justify-content: space-between;
    padding: 1rem var(--ocd-content-padding-x);
    border-top: 1px solid #dee2e6;
    margin-top: 2rem;
    font-size: 0.85rem;
}
.ocd-prev-next a { text-decoration: none; color: var(--ocd-red); }
.ocd-prev-next a:hover { text-decoration: underline; }

/* Sidebar collapse button (shared mobile) */
.ocd-sidebar-toggle {
    display: none;
    position: fixed;
    top: calc(var(--ocd-navbar-height) + 4px);
    left: 4px;
    z-index: 1050;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.3rem 0.5rem;
    font-size: 1.1rem;
    cursor: pointer;
}
/* Narrower sidebar at medium widths (e.g., 200% zoom on 1920px) */
@media (max-width: 1199.98px) and (min-width: 992px) {
    .ocd-sidebar {
        width: 240px;
        min-width: 240px;
        font-size: 0.82rem;
    }
}
/* Sidebar becomes overlay on small screens */
@media (max-width: 991.98px) {
    .ocd-sidebar {
        position: fixed;
        top: var(--ocd-navbar-height);
        left: 0;
        z-index: 1040;
        width: 85%;
        max-width: var(--ocd-sidebar-width);
        height: calc(100vh - var(--ocd-navbar-height));
        transition: margin-left 0.3s;
        box-shadow: 4px 0 12px rgba(0,0,0,0.15);
    }
    .ocd-sidebar.active {
        margin-left: calc(-1 * var(--ocd-sidebar-width));
        box-shadow: none;
    }
    .ocd-sidebar-toggle { display: block; }
}

/* ── Unified content section headings (replaces green bars etc.) ───────────── */
.ocd-section-heading {
    background: var(--ocd-red);
    color: #fff;
    text-align: center;
    padding: 0.75rem 1rem;
    margin: 1.5rem 0 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 2px;
}

/* ── Navbar ────────────────────────────────────────────────────────────────── */

.ocd-navbar {
    background: linear-gradient(to right, #6b1520, var(--ocd-red), #c4384a);
    padding-top: 0;
    padding-bottom: 0;
    transition: all 0.3s ease;
}

.ocd-navbar .container-fluid {
    align-items: flex-end;
    transition: all 0.3s ease;
}

.ocd-navbar .navbar-brand {
    padding: 0.5rem 0;
    transition: padding 0.3s ease;
}

.ocd-navbar .navbar-brand img {
    height: 100px;
    width: auto;
    transition: height 0.3s ease;
}

.ocd-navbar .navbar-collapse {
    align-items: flex-end;
}

/* Shrunk state on scroll */
.ocd-navbar.shrunk .navbar-brand {
    padding: 0.25rem 0;
}

.ocd-navbar.shrunk .navbar-brand img {
    height: 50px;
}

.ocd-navbar .nav-link {
    font-family: Verdana, sans-serif;
    font-size: 1.1rem;
    text-transform: uppercase;
    padding: 0.75rem 0.9rem;
    color: #fff;
    transition: padding 0.3s ease;
}

.ocd-navbar.shrunk .nav-link {
    padding: 0.5rem 0.9rem;
}

.ocd-navbar .nav-link:hover,
.ocd-navbar .nav-link:focus {
    color: #fff;
    text-decoration: underline;
}

.ocd-navbar .dropdown-menu {
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 0;
}

/* Resources mega-dropdown */
.ocd-resources-dropdown {
    min-width: 400px;
}
@media (max-width: 768px) {
    .ocd-resources-dropdown {
        min-width: auto;
    }
}

.ocd-resources-dropdown .dropdown-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ocd-red);
    padding-top: 0.75rem;
}

/* Active collection highlight in navbar */
.ocd-navbar .nav-link.active {
    color: #fff;
    border-bottom: 2px solid #fff;
}

/* Collections dropdown — bold active item */
.ocd-navbar .dropdown-item.fw-bold {
    color: var(--ocd-red);
}

/* ── Admin bar (only shown on admin pages) ─────────────────────────────────── */

.ocd-admin-bar {
    background-color: #333;
    font-size: 0.78rem;
    padding: 0.3rem 1rem;
}

.ocd-admin-bar a {
    color: #ccc;
    text-decoration: none;
    margin-right: 1rem;
}

.ocd-admin-bar a:hover {
    color: #fff;
}

.ocd-admin-bar .admin-user {
    color: #bbb;
    margin-right: 1rem;
}

/* ── Sidebar (for hansreich, reusch) ───────────────────────────────────────── */

.ocd-sidebar {
    width: var(--ocd-sidebar-width);
    min-height: calc(100vh - 58px);
    overflow-y: auto;
    border-right: 1px solid #dee2e6;
    background: #f8f9fa;
    position: sticky;
    top: 58px;
    flex-shrink: 0;
}

.ocd-sidebar .nav-link {
    padding: 0.35rem 1rem;
    font-size: 0.85rem;
    color: #333;
    border-left: 3px solid transparent;
}

.ocd-sidebar .nav-link:hover {
    background-color: #e9ecef;
    color: #333;
}

.ocd-sidebar .nav-link.active {
    background-color: #e2e6ea;
    border-left-color: var(--ocd-red);
    font-weight: 600;
}

.ocd-sidebar-toggle {
    display: none;
}

@media (max-width: 991.98px) {
    .ocd-sidebar {
        position: fixed;
        top: 58px;
        left: -100%;
        z-index: 1040;
        width: 85%;
        max-width: 320px;
        height: calc(100vh - 58px);
        transition: left 0.3s ease;
        box-shadow: none;
    }
    .ocd-sidebar.show {
        left: 0;
        box-shadow: 4px 0 12px rgba(0,0,0,0.15);
    }
    .ocd-sidebar-toggle {
        display: inline-flex;
    }
    .ocd-sidebar-overlay {
        display: none;
        position: fixed;
        top: 58px;
        left: 0;
        width: 100%;
        height: calc(100vh - 58px);
        background: rgba(0,0,0,0.3);
        z-index: 1039;
    }
    .ocd-sidebar-overlay.show {
        display: block;
    }
}

/* ── Content area ──────────────────────────────────────────────────────────── */

.ocd-content {
    flex: 1;
    min-width: 0;
    padding: 1.5rem;
}

.ocd-content img {
    max-width: 100%;
    height: auto;
}

/* ── Breadcrumbs ───────────────────────────────────────────────────────────── */

.ocd-breadcrumb {
    font-size: 0.85rem;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}

.ocd-breadcrumb a {
    color: #666;
    text-decoration: none;
}

.ocd-breadcrumb a:hover {
    color: var(--ocd-red);
}

/* ── Footer — Social bar (top) ─────────────────────────────────────────────── */

.ocd-footer-social {
    background-color: var(--ocd-blue);
    color: #fff;
    padding: 0.6rem 0;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.ocd-footer-social .social-title {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-right: 0.75rem;
    white-space: nowrap;
}

.ocd-footer-social .social-icons {
    list-style: none;
    margin: 0;
    padding: 0;
    display: inline-flex;
    gap: 0.15rem;
    align-items: center;
}

.ocd-footer-social .social-icons a {
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    padding: 4px 6px;
    text-decoration: none;
    transition: color 0.15s;
    vertical-align: middle;
}

.ocd-footer-social .social-icons a:hover {
    color: var(--ocd-red);
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}

/* ── Footer — Bottom (logos + info) ────────────────────────────────────────── */

.ocd-footer-bottom {
    background-color: #fff;
    padding: 0.75rem 0 0.5rem;
    font-size: 0.9rem;
    color: #555;
}

.ocd-footer-bottom a {
    color: #555;
    text-decoration: none;
}

.ocd-footer-bottom a:hover {
    color: var(--ocd-red);
}

.ocd-footer-logos img {
    display: inline-block;
    max-height: 120px;
    width: auto;
    height: auto;
    margin: 0.4rem 1.25rem;
}

@media (max-width: 768px) {
    .ocd-footer-logos img {
        max-width: 110px;
        max-height: 90px;
        margin: 0.3rem 0.5rem;
    }
}

/* ── Hexagon tile grid (home page) ─────────────────────────────────────────── */

.hex-container {
    background: rgb(58, 100, 134);
    padding: 0.5rem 0.5rem 1.5rem;
    margin: 0;
}

.hex-col {
    padding-top: 1.5%;
}

/* ── Honeycomb hex grid ──────────────────────────────────── */

.hex-grid {
    background: #3a6186 url('/img/orgn-bkg.webp') center center;
    background-size: cover;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 2.5rem 0 3rem;
    overflow: hidden;
}

.hex-row {
    display: flex;
    justify-content: center;
    margin-top: -18px;
}
.hex-row:first-child { margin-top: 0; }

.hex-cell {
    width: 170px;
    height: 196px;
    margin: 0 10px;
    flex-shrink: 0;
    text-decoration: none;
    color: var(--ocd-red);
}
.hex-cell:hover { text-decoration: none; }

.hex-shape {
    width: 100%;
    height: 100%;
    background: white;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.hex-cell:hover .hex-shape { background-color: #0E2D46; }

.hex-inner {
    text-align: center;
    padding: 0 16px;
    width: 100%;
}

.hex-title {
    font-family: 'Trebuchet MS', sans-serif;
    font-weight: bold;
    font-size: 1.2rem;
    line-height: 1.2;
    color: var(--ocd-red);
    margin: 0;
}

.hex-desc {
    display: none;
    font-size: 0.8rem;
    line-height: 1.3;
    color: white;
    margin: 0;
    max-height: 85px;
    overflow: hidden;
}

.hex-cell:hover .hex-title { display: none; }
.hex-cell:hover .hex-desc  { display: block; }

/* ── Tablet ──────────────────────────────────────────────── */
@media screen and (max-width: 899.98px) and (min-width: 600px) {
    .hex-cell { width: 140px; height: 162px; margin: 0 8px; }
    .hex-row  { margin-top: -14px; }
    .hex-row:first-child { margin-top: 0; }
    .hex-title { font-size: 1rem; }
    .hex-desc  { font-size: 0.72rem; }
}

/* ── Mobile: stacked rectangles ──────────────────────────── */
@media screen and (max-width: 599.98px) {
    .hex-grid { background: var(--ocd-red-dark); padding: 1rem 0; }
    .hex-row {
        flex-direction: column;
        align-items: center;
        margin-top: 0;
    }
    .hex-cell {
        width: 90%;
        height: auto;
        margin: 4px 0;
    }
    .hex-shape {
        width: 100%;
        height: 56px;
        clip-path: none;
        border-radius: 4px;
    }
    .hex-title { font-size: 1rem; }
}

/* ── Utilities ─────────────────────────────────────────────────────────────── */

.ocd-external-link .fa-up-right-from-square {
    font-size: 0.75em;
    opacity: 0.6;
}
.ocd-external-link:hover .fa-up-right-from-square {
    opacity: 1;
}

img[loading="lazy"] {
    background-color: transparent;
}

/* ── Search results ────────────────────────────────────────────────────────── */

.ocd-search-result { border-bottom: 1px solid #dee2e6; padding: 0.75rem 0; }
.ocd-search-result:last-child { border-bottom: none; }
.ocd-search-result .search-title { font-size: 1.1rem; }
.ocd-search-result .search-section { font-size: 0.78rem; color: #6c757d; }
.ocd-search-result .search-snippet { font-size: 0.88rem; color: #444; margin-top: 0.25rem; }
.ocd-search-result .search-snippet mark { background: #fff3cd; padding: 0 2px; }

/* Go-to-top button */
#toTopButton {
    display: none;
    position: fixed;
    bottom: 12px;
    right: 12px;
    z-index: 1000;
    background-color: rgba(128,128,128,0.5);
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-size: 1.2rem;
    line-height: 1;
}

#toTopButton:hover {
    background-color: #555;
}

/* ── Blockquote with headshot (hansreich landing) ─────────────────────────── */

.blockquote-custom {
    position: relative;
}

.blockquote-custom p {
    font-family: 'Didot', serif;
    font-size: 1.25em;
    font-style: italic;
    line-height: 2rem;
    text-indent: 50px;
}

.blockquote-custom p:first-of-type::before {
    font-family: Georgia, serif;
    font-style: italic;
    content: '\201C';
    color: #81bedb;
    font-size: 4.5em;
    font-weight: 700;
    opacity: .6;
    top: 0.3em;
    left: -0.4em;
    text-shadow: none;
    position: absolute;
}

.blockquote-custom-img {
    border: 3px solid #9CC1D3;
    border-radius: 50%;
    display: block;
    width: 150px;
    height: 150px;
    object-fit: cover;
}

/* ── Accessibility — Focus indicators (WCAG 2.4.7) ─────────────────────────── */

a:focus-visible, button:focus-visible, select:focus-visible,
input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid #81bedb;
    outline-offset: 2px;
}

.ocd-navbar a:focus-visible, .ocd-navbar button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

#toTopButton:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Print */
@media print {
    .ocd-navbar, .ocd-admin-bar, .ocd-sidebar, .ocd-sidebar-toggle,
    .ocd-footer-social, .ocd-footer-bottom, #toTopButton { display: none !important; }
    .ocd-content { padding: 0; }
}
