/* ==========================================================================
   Layout: shell, sections, utility bar, header, navigation, footer.
   One shared horizontal gutter runs through every band on the page so
   nothing sits against the viewport edge on a phone.
   ========================================================================== */

.shell {
    width: 100%;
    max-width: var(--shell);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.shell--narrow { max-width: var(--shell-narrow); }

.section { padding-block: var(--section-y); }

.section--cream  { background: var(--cream); }
.section--paper  { background: var(--paper); }
.section--deep   { background: var(--ink-soft); color: var(--cream); }
.section--slate  { background: var(--slate); color: var(--white); }

.section--deep h2,
.section--deep h3,
.section--slate h2,
.section--slate h3 { color: var(--white); }

.section--deep p,
.section--slate p { color: rgba(255, 253, 248, .86); }

.section--paper,
.section--cream {
    background-image: url("../images/texture/paper-grain.png");
    background-size: 320px;
    background-blend-mode: multiply;
}

.section-head { margin-bottom: clamp(30px, 4vw, 52px); }
.section-head h2 { max-width: 20ch; }
.section-head p  { margin-top: 14px; }

/* ---------------------------------------------------------- utility bar -- */

.utility {
    background: var(--ink);
    color: rgba(255, 253, 248, .82);
    font-size: .86rem;
}

.utility__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 40px;
    padding-block: 7px;
}

.utility__note {
    font-family: var(--font-mono);
    letter-spacing: .06em;
    margin: 0;
    color: rgba(255, 253, 248, .78);
}

.utility__links {
    display: flex;
    align-items: center;
    gap: 22px;
}

.utility a {
    color: var(--gold-bright);
    text-decoration: none;
    font-weight: 600;
}

.utility a:hover { color: var(--white); text-decoration: underline; }

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

.masthead {
    position: sticky;
    top: 0;
    z-index: 90;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
}

.masthead__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    min-height: 104px;
}

.brand {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    margin-right: auto;
}

.brand img {
    height: 76px;
    width: auto;
}

/* Desktop navigation ------------------------------------------------------ */

.primary-nav { display: none; }

@media (min-width: 1100px) {
    .primary-nav { display: block; }

    .primary-nav > ul {
        display: flex;
        align-items: center;
        gap: 26px;
    }

    .primary-nav a {
        display: inline-block;
        padding: 12px 0;
        font-family: var(--font-display);
        font-size: 1.02rem;
        font-weight: 500;
        color: var(--ink);
        text-decoration: none;
        border-bottom: 2px solid transparent;
    }

    .primary-nav a:hover,
    .primary-nav a:focus-visible,
    .primary-nav .is-current > a {
        color: var(--gold-deep);
        border-bottom-color: var(--gold);
    }

    .has-children { position: relative; }

    .has-children > a::after {
        content: "";
        display: inline-block;
        width: 6px; height: 6px;
        margin-left: 8px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: translateY(-2px) rotate(45deg);
    }

    .submenu {
        position: absolute;
        top: 100%;
        left: -18px;
        min-width: 258px;
        padding: 8px 0;
        background: var(--paper);
        border: 1px solid var(--rule);
        box-shadow: var(--shadow-card);
        opacity: 0;
        visibility: hidden;
        transform: translateY(6px);
        transition: opacity .16s ease, transform .16s ease, visibility .16s;
    }

    /* Keeps the pointer inside the trigger while it travels to the panel. */
    .has-children::after {
        content: "";
        position: absolute;
        left: 0; right: 0; top: 100%;
        height: 14px;
    }

    .has-children:hover .submenu,
    .has-children:focus-within .submenu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .submenu a {
        display: block;
        padding: 11px 20px;
        border-bottom: 0;
        font-size: .98rem;
    }

    .submenu a:hover { background: var(--cream); }
}

/* Mobile navigation ------------------------------------------------------- */

.nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--ink);
    color: var(--white);
    border: 0;
    font-family: var(--font-mono);
    font-size: .78rem;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.nav-toggle__bars {
    display: block;
    position: relative;
    width: 20px; height: 2px;
    background: currentColor;
}

.nav-toggle__bars::before,
.nav-toggle__bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 20px; height: 2px;
    background: currentColor;
}

.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after  { top: 6px; }

@media (min-width: 1100px) {
    .nav-toggle { display: none; }
}

.drawer {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: none;
    background: var(--ink);
    color: var(--white);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.drawer.is-open { display: block; }

.drawer__inner {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 22px var(--gutter) calc(28px + env(safe-area-inset-bottom));
}

.drawer__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--rule-light);
}

.drawer__top img { height: 56px; width: auto; }

.drawer__close {
    padding: 12px 16px;
    background: transparent;
    color: var(--white);
    border: 1px solid var(--rule-light);
    font-family: var(--font-mono);
    font-size: .78rem;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.drawer nav {
    padding-block: 12px;
    /* Balanced against the actions block rather than pushed to the top. */
    margin-block: auto;
}

.drawer nav > ul > li + li { border-top: 1px solid var(--rule-light); }

.drawer nav a {
    display: block;
    padding: 17px 2px;
    font-family: var(--font-display);
    font-size: 1.28rem;
    font-weight: 500;
    /* Base state is fully visible. Hover never reveals a label. */
    color: var(--white);
    opacity: 1;
    visibility: visible;
    text-decoration: none;
}

.drawer .submenu {
    padding: 0 0 12px 16px;
    border-left: 2px solid var(--gold);
    margin-left: 2px;
}

.drawer .submenu a {
    padding: 11px 2px;
    font-size: 1.04rem;
    font-family: var(--font-body);
    color: rgba(255, 253, 248, .88);
}

.drawer__actions {
    display: grid;
    gap: 12px;
    padding-top: 22px;
    border-top: 1px solid var(--rule-light);
}

.drawer__meta {
    margin: 10px 0 0;
    font-family: var(--font-mono);
    font-size: .82rem;
    letter-spacing: .06em;
    color: rgba(255, 253, 248, .7);
}

/* The drawer is dark, so this link cannot inherit the page link colour. */
.drawer__meta a {
    display: inline-block;
    padding: 12px 2px;
    color: var(--gold-bright);
    text-decoration: none;
}

.drawer__meta a:hover,
.drawer__meta a:focus-visible { color: var(--white); text-decoration: underline; }

@media (hover: hover) and (pointer: fine) {
    .drawer nav a:hover { color: var(--gold-bright); }
}

body.nav-open { overflow: hidden; }

/* --------------------------------------------------------------- footer -- */

.site-footer {
    background: var(--ink);
    color: rgba(255, 253, 248, .78);
    padding-top: clamp(48px, 6vw, 76px);
}

.site-footer h4 {
    color: var(--white);
    font-size: 1.02rem;
    letter-spacing: .02em;
    margin-bottom: 16px;
}

.footer__grid {
    display: grid;
    gap: clamp(30px, 4vw, 56px);
    grid-template-columns: 1fr;
    padding-bottom: clamp(36px, 4vw, 56px);
}

@media (min-width: 760px) {
    .footer__grid { grid-template-columns: 1.4fr 1fr 1fr; }
}

.footer__brand img {
    height: 84px;
    width: auto;
}

.footer__brand p {
    margin-top: 18px;
    max-width: 40ch;
    font-size: .98rem;
}

.site-footer nav a,
.site-footer a {
    display: inline-block;
    color: rgba(255, 253, 248, .8);
    text-decoration: none;
    padding: 6px 0;
    font-size: .98rem;
}

.site-footer a:hover { color: var(--gold-bright); text-decoration: underline; }

.footer__bar {
    border-top: 1px solid var(--rule-light);
    padding-block: 22px calc(24px + env(safe-area-inset-bottom));
}

.footer__bar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 26px;
    font-family: var(--font-mono);
    font-size: .78rem;
    letter-spacing: .05em;
    color: rgba(255, 253, 248, .62);
}

.footer__legal {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
}
