/*
 * Unified Feedback Monitor navigation styling.
 *
 * Canonical copy lives in shared/nav.css; bin/sync-shared.sh copies it into
 * every site's css/ directory. Edit the shared copy, never a per-site copy.
 *
 * Load this AFTER each site's own stylesheet. The CMS sites set
 * `a { color: red !important }`, so the nav rules below need !important to
 * win - that override is deliberate, not cargo cult.
 */

:root {
    /* Bootstrap's default stack. The shared chrome pins it explicitly so the
       nav and footer render identically on all four sites - otherwise they
       inherit each site's body font (the CMS sites set TitilliumText-Regular),
       which changes text widths and shifts every item. */
    --fm-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
}

.fm-nav,
.fm-nav .navbar-brand,
.fm-nav .nav-link,
.fm-nav .dropdown-item,
.fm-nav .fm-nav-brand span,
.fm-footer,
.fm-footer .fm-license,
.fm-footer .fm-license a {
    font-family: var(--fm-font) !important;
}

.fm-nav {
    padding: 0.35rem 0 !important;
    background-color: #fff !important;
    border-bottom: 3px solid #cb9662;
}

.fm-nav .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Brand */
.fm-nav .fm-nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #222 !important;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
}

.fm-nav .fm-nav-brand img {
    width: 44px;
    height: 44px;
}

.fm-nav .fm-nav-brand:hover {
    color: #cb9662 !important;
}

/* Items */
.fm-nav .nav-link {
    color: #222 !important;
    padding: 0.4rem 0.75rem !important;
    text-decoration: none;
    transition: color 0.15s ease;
}

.fm-nav .nav-link:hover,
.fm-nav .nav-link:focus {
    color: #cb9662 !important;
}

.fm-nav .nav-link.active {
    /* Colour only. Bolding the active item makes it wider, which shifts every
       item before it and means the nav sits differently on each site. */
    color: #cb9662 !important;
}

/* Log in / admin / log out sit slightly apart from the site links */
.fm-nav .nav-link.fm-nav-admin {
    font-style: italic;
    opacity: 0.75;
}

/* Dropdown */
.fm-nav .dropdown-menu {
    border-color: rgba(203, 150, 98, 0.4);
}

.fm-nav .dropdown-item {
    color: #222 !important;
}

.fm-nav .dropdown-item:hover,
.fm-nav .dropdown-item:focus {
    color: #cb9662 !important;
    background-color: rgba(203, 150, 98, 0.12);
}

.fm-nav .navbar-toggler {
    border-color: rgba(203, 150, 98, 0.5);
}

@media (max-width: 991.98px) {
    .fm-nav .navbar-collapse {
        background-color: #fff;
        padding-bottom: 0.5rem;
    }

    .fm-nav .navbar-nav {
        align-items: flex-start !important;
    }
}


/* ------------------------------------------------------------------ *
 * Footer
 *
 * The main site styled the bare `footer` element with a fixed
 * height: 35px, which clipped the Creative Commons icons. These rules
 * are class-based so they win on specificity without editing that file.
 * ------------------------------------------------------------------ */

.fm-footer {
    width: 100%;
    height: auto !important;
    margin-top: auto;
    padding: 0.75rem 1rem;
    background: #fff;
    border-top: 3px solid #cb9662;
    color: #000;
}

.fm-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 1.5rem;
    max-width: 1140px;
    margin: 0 auto;
}

.fm-socials {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.fm-socials li {
    margin: 0;
}

.fm-socials a {
    display: block;
    opacity: 0.85;
    transition: opacity 0.15s ease;
}

.fm-socials a:hover {
    opacity: 1;
}

.fm-socials img {
    display: block;
    width: 28px !important;
    height: 28px !important;
}

.fm-license {
    margin: 0 !important;
    padding: 0;
    display: block !important;
    font-size: 0.85rem;
    line-height: 1.5 !important;
    text-align: center;
    color: #000 !important;
}

.fm-license a {
    color: #cb9662 !important;
    text-decoration: none;
}

.fm-license a:hover {
    text-decoration: underline;
}

.fm-cc-icons {
    /* keep the four badges together so they never split across lines */
    white-space: nowrap;
}

.fm-cc-icons img {
    display: inline-block;
    height: 20px !important;
    width: auto !important;
    margin-left: 3px;
    vertical-align: text-bottom;
}

@media (max-width: 576px) {
    /* the main site pushed the footer down by 100vh on small screens */
    .fm-footer {
        margin-top: auto !important;
        padding: 0.45rem 0.6rem;
    }

    .fm-footer-inner {
        flex-direction: column;
        gap: 0.3rem;
    }

    .fm-socials {
        gap: 0.85rem;
    }

    .fm-socials img {
        width: 22px !important;
        height: 22px !important;
    }

    /* Drop the sentence and keep the licence itself, so this stays one line
       instead of wrapping to two. */
    .fm-license-long {
        display: none;
    }

    .fm-license {
        font-size: 0.7rem;
        line-height: 1.3 !important;
    }

    .fm-cc-icons img {
        height: 15px !important;
        margin-left: 2px;
    }
}

@media (max-width: 360px) {
    .fm-cc-icons {
        display: none;
    }
}


/* ------------------------------------------------------------------ *
 * Scroll cue
 *
 * The CMS mastheads are height: 100vh, so on load they fill the screen
 * and give no sign that articles sit below. This nudges the reader down.
 * ------------------------------------------------------------------ */

.fm-scroll-cue {
    /* The masthead is height:100vh and sits *below* the navbar, so its bottom
       edge falls off-screen. Anchor to the viewport instead; the cue hides
       itself as soon as scrolling starts, so it never covers content. */
    position: fixed;
    left: 50%;
    bottom: clamp(1rem, 4vh, 2.5rem);
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    color: #fff !important;
    text-decoration: none !important;
    opacity: 0.85;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 3;
}

.fm-scroll-cue:hover,
.fm-scroll-cue:focus {
    opacity: 1;
    color: #fff !important;
}

.fm-scroll-cue .fm-scroll-chevron {
    width: clamp(24px, 4.5vw, 34px);
    height: clamp(24px, 4.5vw, 34px);
    border-right: 3px solid currentColor;
    border-bottom: 3px solid currentColor;
    transform: rotate(45deg);
    /* the mastheads range from a dark sky to a bright sunset, so the
       chevron needs its own contrast rather than relying on the photo */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
    animation: fm-scroll-bob 1.8s ease-in-out infinite;
}

/* Hidden once the reader has started scrolling (added by the inline script) */
.fm-scroll-cue.is-hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(0.75rem);
    pointer-events: none;
}

@keyframes fm-scroll-bob {
    0%, 100% { transform: rotate(45deg) translate(0, 0); }
    50%      { transform: rotate(45deg) translate(4px, 4px); }
}

@media (prefers-reduced-motion: reduce) {
    .fm-scroll-cue .fm-scroll-chevron {
        animation: none;
    }

    .fm-scroll-cue {
        transition: none;
    }
}

/* Very short viewports: the masthead is already tiny, keep the cue out of the way */
@media (max-height: 420px) {
    .fm-scroll-cue {
        display: none;
    }
}


/* ------------------------------------------------------------------ *
 * Content card
 *
 * The main site's pages sit directly on full-bleed photographs, which
 * left body copy essentially unreadable. This lifts content onto a
 * translucent panel while keeping the photo visible behind it.
 * ------------------------------------------------------------------ */

.fm-card {
    max-width: 720px;
    margin: clamp(1.5rem, 5vh, 3.5rem) auto;
    padding: clamp(1.25rem, 3vw, 2.25rem);
    background: rgba(18, 18, 18, 0.66);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(203, 150, 98, 0.35);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    color: #f2efe6 !important;
}

.fm-card p,
.fm-card li {
    margin: 0 0 1.1rem;
    color: #f2efe6 !important;
    font-size: clamp(0.95rem, 1.6vw, 1.05rem);
    line-height: 1.65;
    text-align: left;
}

.fm-card p:last-child {
    margin-bottom: 0;
}

.fm-card h1,
.fm-card h2,
.fm-card h3 {
    margin-top: 0;
    margin-bottom: 1.25rem;
    color: #cb9662 !important;
}

.fm-card a {
    color: #e2ac74 !important;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.fm-card a:hover,
.fm-card a:focus {
    color: #f2c99f !important;
}

/* Forms sitting on the card */
.fm-card .form-control {
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(203, 150, 98, 0.45);
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.fm-card .form-control:focus {
    border-color: #cb9662;
    box-shadow: 0 0 0 0.2rem rgba(203, 150, 98, 0.25);
}

.fm-card .btn {
    background-color: #cb9662;
    border-color: #cb9662;
    color: #1a1a1a;
    font-weight: 600;
}

.fm-card .btn:hover,
.fm-card .btn:focus {
    background-color: #b9834f;
    border-color: #b9834f;
    color: #1a1a1a;
}

@media (max-width: 576px) {
    .fm-card {
        margin-left: 1rem;
        margin-right: 1rem;
    }
}


/* ------------------------------------------------------------------ *
 * Article media
 *
 * Posts carry embeds authored at fixed pixel sizes. These stop them
 * overflowing; includes/responsive-media.php restores each one's own
 * aspect ratio from its width/height attributes.
 * ------------------------------------------------------------------ */

#fm-content img,
#fm-content iframe,
#fm-content video,
#fm-content embed,
#fm-content object {
    max-width: 100%;
}

#fm-content img {
    height: auto;
}

#fm-content iframe {
    border: 0;
}
