/*
 * Watchtower Help Club — replacement site stylesheet
 *
 * Install as /wthc.css (or another path of your choice), then link it
 * from the <head> of each page:
 *
 * <link rel="stylesheet" href="/wthc.css">
 *
 * This stylesheet replaces the missing external collector.css dependency.
 * It deliberately styles the existing HTML structure; it does not require
 * changes to the page's content or navigation markup.
 */

/* ---------- Base / page frame ---------- */

:root {
    --wthc-page-width: 1180px;
    --wthc-sidebar-width: 290px;
    --wthc-gap: 30px;
    --wthc-ink: #292929;
    --wthc-muted: #666;
    --wthc-blue: #244f70;
    --wthc-blue-dark: #183b56;
    --wthc-blue-light: #eaf1f6;
    --wthc-border: #d5dce1;
    --wthc-page: #f2f3f4;
    --wthc-white: #fff;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 72px;
}

body.publications {
    margin: 0;
    color: var(--wthc-ink);
    background: var(--wthc-page);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.58;
}

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

a {
    color: #245b83;
    text-decoration: none;
}

a:hover,
a:focus {
    color: #123d5d;
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

.wrapper {
    width: min(var(--wthc-page-width), calc(100% - 36px));
    margin-inline: auto;
}

.wrapperShadow {
    background: var(--wthc-white);
}

/* ---------- Site header ---------- */

#regionHeader {
    position: relative;
    z-index: 30;
    background: #fff;
    border-bottom: 1px solid var(--wthc-border);
}

#siteHeader {
    min-height: 104px;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 22px;
}

#siteHeader > a {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
}

#siteHeader > a img {
    display: block;
    width: auto;
    max-width: 100px;
    max-height: 82px;
    object-fit: contain;
}

#siteHeader .srText {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.siteNameContainer {
    min-width: 0;
}

#siteName {
    margin: 0;
    color: #244f70;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(25px, 3vw, 36px);
    font-weight: 600;
    line-height: 1.15;
}

.siteFeaturesContainer {
    margin-left: auto;
}

/* ---------- Primary navigation ---------- */

#regionPrimaryNav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--wthc-blue);
    box-shadow: 0 2px 5px rgb(0 0 0 / 18%);
}

#regionPrimaryNav .wrapper,
#regionPrimaryNav .wrapperShadow,
#primaryNavRegion {
    background: transparent;
}

.primaryNav {
    position: relative;
}

.primaryNavMenu {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 0;
    min-height: 48px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.primaryNavItem {
    position: relative;
    display: flex;
    align-items: stretch;
    margin: 0;
    padding: 0;
}

.primaryNavItem > .iconLink {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 11px 17px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .035em;
    text-decoration: none;
    white-space: nowrap;
}

.primaryNavItem > .iconLink:hover,
.primaryNavItem > .iconLink:focus,
.primaryNavItem > .iconLink[aria-expanded="true"] {
    color: #fff;
    background: var(--wthc-blue-dark);
    text-decoration: none;
}

.iconLink-icon {
    display: inline-block;
}

.iconLink-text {
    display: inline-block;
}

/* Dropdown lists: supports the nested UL structure used by the page. */
.primaryNavItem > ul,
.primaryNavItem > .secondaryNav,
.primaryNavItem > .dropdown,
.primaryNavItem > .navSubmenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1100;
    min-width: 230px;
    max-width: min(340px, 90vw);
    padding: 6px 0;
    margin: 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--wthc-border);
    box-shadow: 0 5px 14px rgb(0 0 0 / 18%);
}

.primaryNavItem:hover > ul,
.primaryNavItem:focus-within > ul,
.primaryNavItem > .jsDropdownNavButton[aria-expanded="true"] + ul,
.primaryNavItem > .jsDropdownNavButton[aria-expanded="true"] ~ ul,
.primaryNavItem:hover > .secondaryNav,
.primaryNavItem:focus-within > .secondaryNav,
.primaryNavItem:hover > .dropdown,
.primaryNavItem:focus-within > .dropdown,
.primaryNavItem:hover > .navSubmenu,
.primaryNavItem:focus-within > .navSubmenu {
    display: block;
}

.primaryNavItem > ul li {
    display: block;
    margin: 0;
    padding: 0;
}

.primaryNavItem > ul a {
    display: block;
    padding: 9px 15px;
    color: #263746;
    font-size: 14px;
    line-height: 1.35;
    white-space: normal;
}

.primaryNavItem > ul a:hover,
.primaryNavItem > ul a:focus {
    color: #153d5b;
    background: var(--wthc-blue-light);
    text-decoration: none;
}

/* ---------- Main publication layout ---------- */

.pubTitleBar {
    min-height: 10px;
    background: #fff;
}

#content.grid-layout--pub-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--wthc-sidebar-width);
    gap: var(--wthc-gap);
    align-items: start;
    width: min(var(--wthc-page-width), calc(100% - 36px));
    margin: 24px auto 48px;
    padding: 28px;
    background: #fff;
    box-shadow: 0 1px 5px rgb(0 0 0 / 8%);
}

.main-wrapper {
    min-width: 0;
}

#article {
    min-width: 0;
    max-width: 100%;
}

#article > header {
    margin: 0 0 24px;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--wthc-border);
}

#article h1 {
    margin: 0;
    color: #263f52;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(27px, 3vw, 36px);
    font-weight: 600;
    line-height: 1.2;
}

#article h2 {
    margin: 1.8em 0 .65em;
    color: #294e69;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 25px;
    line-height: 1.25;
}

#article h3 {
    margin: 1.5em 0 .5em;
    color: #355b75;
    font-size: 20px;
    line-height: 1.3;
}

#article h4,
#article h5,
#article h6 {
    color: #3b566a;
}

#article p {
    margin: 0 0 1.15em;
}

#article ul,
#article ol {
    padding-left: 1.6em;
    margin: 0 0 1.2em;
}

#article li {
    margin-bottom: .35em;
}

#article blockquote {
    margin: 1.5em 0;
    padding: 12px 20px;
    color: #4c5962;
    background: #f4f7f9;
    border-left: 4px solid #8ba8bc;
}

#article hr {
    height: 1px;
    margin: 2em 0;
    border: 0;
    background: var(--wthc-border);
}

/* ---------- Embedded media and images ---------- */

#article iframe,
#article video,
#article embed,
#article object {
    max-width: 100%;
}

#article iframe {
    display: block;
    margin: 18px auto 24px;
    border: 0;
}

#article img {
    max-width: 100%;
    height: auto;
}

#article table {
    max-width: 100%;
    border-collapse: collapse;
}

#article th,
#article td {
    padding: 8px 10px;
    border: 1px solid var(--wthc-border);
    vertical-align: top;
}

/* ---------- Right sidebar ---------- */

#sidebar.grid-layout--secondary {
    display: block;
    min-width: 0;
    width: 100%;
    align-self: start;
    padding: 0;
    margin: 0;
    color: #333;
    font-size: 14px;
}

.sidebar-pubCover {
    margin: 0 0 20px;
    padding: 12px;
    text-align: center;
    background: #f7f8f9;
    border: 1px solid var(--wthc-border);
}

.sidebar-pubCover img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 190px;
    margin: 0 auto;
    object-fit: contain;
}

.sidebar-wrapper {
    padding: 0;
}

#sidebarTOC {
    padding: 16px;
    background: #f7f8f9;
    border: 1px solid var(--wthc-border);
}

#sidebarTOC h2,
#sidebarTOC h3,
#sidebarTOC h4,
#sidebarTOC .TOCTitle {
    margin: 0 0 12px;
    color: #294e69;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    line-height: 1.3;
}

#sidebar ul {
    padding-left: 20px;
    margin: 0 0 16px;
}

#sidebar li {
    margin: 0 0 8px;
    line-height: 1.4;
}

#sidebar a {
    overflow-wrap: anywhere;
}

#sidebar .pubSectionTitle {
    display: inline-block;
    font-weight: 600;
}

#sidebar .articleNavLinks {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--wthc-border);
}

#sidebar .TOCTitle {
    margin-bottom: 10px;
}

/* ---------- General utility / accessibility ---------- */

.cms-clearfix::after {
    display: table;
    clear: both;
    content: "";
}

:focus-visible {
    outline: 3px solid #e3a72f;
    outline-offset: 2px;
}

::selection {
    color: #172b3a;
    background: #d8e8f3;
}

/* ---------- Responsive layout ---------- */

@media (max-width: 850px) {
    :root {
        --wthc-gap: 22px;
    }

    #content.grid-layout--pub-sidebar {
        grid-template-columns: minmax(0, 1fr) 245px;
        padding: 22px;
    }

    .primaryNavItem > .iconLink {
        padding-inline: 12px;
    }
}

@media (max-width: 680px) {
    .wrapper {
        width: 100%;
    }

    #siteHeader {
        min-height: 82px;
        gap: 12px;
        padding: 10px 14px;
    }

    #siteHeader > a img {
        max-width: 72px;
        max-height: 62px;
    }

    #siteName {
        font-size: 25px;
    }

    #regionPrimaryNav {
        position: sticky;
        top: 0;
    }

    .primaryNavMenu {
        min-height: 44px;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }

    .primaryNavItem {
        flex: 0 0 auto;
    }

    .primaryNavItem > .iconLink {
        min-height: 44px;
        padding: 10px 12px;
        font-size: 12px;
    }

    /* On narrow screens, keep dropdowns usable without forcing page width. */
    .primaryNavItem > ul,
    .primaryNavItem > .secondaryNav,
    .primaryNavItem > .dropdown,
    .primaryNavItem > .navSubmenu {
        position: fixed;
        top: auto;
        left: 8px;
        max-width: calc(100vw - 16px);
        max-height: 70vh;
        overflow-y: auto;
    }

    #content.grid-layout--pub-sidebar {
        display: flex;
        flex-direction: column;
        gap: 28px;
        width: 100%;
        margin: 0 auto;
        padding: 20px 16px 32px;
        box-shadow: none;
    }

    .main-wrapper,
    #sidebar.grid-layout--secondary {
        width: 100%;
    }

    #sidebar.grid-layout--secondary {
        padding-top: 22px;
        border-top: 2px solid var(--wthc-border);
    }

    #article h1 {
        font-size: 29px;
    }

    #article h2 {
        font-size: 23px;
    }

    #article iframe {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
