/* =============================================================================
   NAV.CSS — the site header and navigation
   -----------------------------------------------------------------------------
   Newspaper masthead logic: white paper, a hairline rule, one red. Every colour
   comes from the tokens in global.css, so retuning the site retunes this too.

   NOTHING HOVERS BLUE. Astra's defaults are overridden on purpose; every
   interactive state here lands on the Druthers red.

   No JavaScript. The mobile panel opens with a checkbox, so it works before any
   script loads and if scripts fail entirely.
   ============================================================================= */

.dr-site-header {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    position: relative;
    z-index: 100;
}

.dr-header-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 14px var(--gutter);
    display: flex;
    align-items: center;
    gap: var(--gutter);
}

/* --- Wordmark ------------------------------------------------------------- */

.dr-header-brand {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    text-decoration: none;
    line-height: 0;
}

.dr-header-brand img {
    display: block;
    width: 190px;
    height: auto;
    max-width: 46vw;   /* never let the wordmark crowd out the menu button */
}

.dr-header-brand-text {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 24px;
    letter-spacing: -.02em;
    color: var(--red);
    line-height: 1.1;
}

/* --- The bar -------------------------------------------------------------- */

.dr-nav {
    display: flex;
    align-items: center;
    gap: var(--gutter);
    margin-left: auto;
}

.dr-nav-list {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.dr-nav-item {
    position: relative;
    margin: 0;
}

.dr-nav-item > a {
    display: block;
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text);
    text-decoration: none;
    border-radius: 3px;
    transition: color .15s ease, background-color .15s ease;
}

/* On-palette hover. Explicitly not the framework's blue. */
.dr-nav-item > a:hover,
.dr-nav-item > a:focus-visible {
    color: var(--red);
    background: var(--redtint);
}

/* A parent with children gets a small caret so the dropdown is discoverable. */
.dr-has-children > a::after {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-left: 7px;
    vertical-align: 2px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    opacity: .55;
}

/* --- Dropdowns ------------------------------------------------------------ */

.dr-subnav {
    list-style: none;
    margin: 0;
    padding: 6px;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 210px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-top: 2px solid var(--red);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .09);

    /* Hidden by default, but kept in the layout and focusable-aware: opacity and
       visibility rather than display:none, so the panel can be reached by
       keyboard via :focus-within and can transition. */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s;
}

.dr-nav-item:hover > .dr-subnav,
.dr-nav-item:focus-within > .dr-subnav {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dr-subnav a {
    display: block;
    padding: 8px 10px;
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--text);
    text-decoration: none;
    border-radius: 3px;
}

.dr-subnav a:hover,
.dr-subnav a:focus-visible {
    color: var(--red);
    background: var(--warm);
}

/* --- Search --------------------------------------------------------------- */

.dr-search {
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--warm);
    overflow: hidden;
}

.dr-search:focus-within {
    border-color: var(--red);
    background: var(--paper);
}

.dr-search input[type="search"] {
    border: 0;
    background: transparent;
    padding: 8px 10px;
    width: 150px;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text);
    outline: none;
}

.dr-search button {
    border: 0;
    background: transparent;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    color: var(--muted);
    cursor: pointer;
}

.dr-search button:hover,
.dr-search button:focus-visible {
    color: var(--red);
}

/* --- The mobile toggle ---------------------------------------------------- */

.dr-nav-toggle-btn {
    display: none;   /* desktop: the bar is the nav, no button needed */
    margin-left: auto;
    padding: 10px 6px;
    cursor: pointer;
}

.dr-nav-toggle-btn span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 4px 0;
    background: var(--ink);
    transition: background .15s ease;
}

.dr-nav-toggle-btn:hover span { background: var(--red); }

/* --- Phones and small tablets --------------------------------------------- */

@media (max-width: 900px) {

    .dr-nav-toggle-btn { display: block; }

    .dr-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px var(--gutter) 18px;
        background: var(--paper);
        border-bottom: 1px solid var(--line);
        box-shadow: 0 10px 24px rgba(0, 0, 0, .08);
    }

    /* The checkbox drives the panel. No script involved. */
    .dr-nav-toggle:checked ~ .dr-nav { display: flex; }

    .dr-nav-list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .dr-nav-item > a {
        padding: 13px 4px;
        border-bottom: 1px solid var(--line);
    }

    .dr-has-children > a::after { display: none; }

    /* Sub-items stay open and indented on mobile. A hover-triggered dropdown is
       meaningless on a touch screen, and a tap-to-expand needs JavaScript for
       something a little indentation solves. */
    .dr-subnav {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        border: 0;
        box-shadow: none;
        padding: 0 0 6px 14px;
        min-width: 0;
        background: transparent;
    }

    .dr-subnav a {
        padding: 9px 4px;
        color: var(--muted);
    }

    .dr-search {
        margin-top: 14px;
    }

    .dr-search input[type="search"] { width: 100%; }
}

/* Respect a reader who has asked for less motion. */
@media (prefers-reduced-motion: reduce) {
    .dr-subnav,
    .dr-nav-item > a,
    .dr-nav-toggle-btn span {
        transition: none;
    }
}
