/* =====================================================================
   Consulate General of the Republic of Vanuatu — Melbourne
   Colours come from the national flag. Rules:
   - Red is reserved for emergency information, so it keeps its meaning.
   - Flag green (#009543) is only 3.9:1 against white text; anything
     carrying text uses the darker --vu-green-text (passes WCAG AA 4.5:1).
   - Yellow only sits on black (very high contrast), never on white.
   ===================================================================== */

:root {
    --vu-red: #D21034;
    --vu-green: #009543;
    --vu-green-text: #00703A;
    --vu-black: #000000;
    --vu-yellow: #FDCE12;
    --ink: #1F2421;
    --muted: #55605A;
    --paper: #FFFFFF;
    --paper-alt: #F1F4F2;

    /* Width of the Consul's photo. Change these two numbers to resize it.
       1rem = 16px, so 11rem = 176px and 16rem = 256px. */
    --about-photo-width: 11rem;
    --home-photo-width: 16rem;
    --rule: #D5DCD8;

    --font-body: "Libre Franklin", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    --font-head: "Source Serif 4", Georgia, "Times New Roman", serif;
}

body {
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
}

h1, h2, h3 {
    font-family: var(--font-head);
    font-weight: 700;
    line-height: 1.2;
    color: var(--ink);
}

a { color: var(--vu-green-text); text-underline-offset: 0.15em; }
a:hover { color: var(--vu-black); }

/* Visible keyboard focus everywhere (yellow ring with black edge works on any background). */
:focus-visible {
    outline: 3px solid var(--vu-yellow);
    outline-offset: 2px;
    box-shadow: 0 0 0 5px var(--vu-black);
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3rem;
    z-index: 1000;
    padding: 0.5rem 1rem;
    background: var(--vu-yellow);
    color: var(--vu-black);
    font-weight: 600;
}
.skip-link:focus { top: 1rem; }

main:focus { outline: none; }

/* ---------- Emergency strip ---------- */
.emergency-strip {
    background: var(--vu-red);
    color: #fff;
    font-size: 0.9rem;
    padding: 0.45rem 0;
}
.emergency-strip .container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 1.5rem;
}
.emergency-strip a { color: #fff; text-decoration: none; }
.emergency-strip a:hover { text-decoration: underline; }
.emergency-label { font-weight: 600; }

/* ---------- Header ---------- */
.site-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    text-decoration: none;
    color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand-arms { width: 60px; height: 60px; object-fit: contain; }

/* Fallback when no coat-of-arms image is uploaded: the flag's chevron. */
.brand-mark {
    flex: none;
    width: 52px;
    height: 36px;
    background:
        linear-gradient(var(--vu-red) 0 50%, var(--vu-green) 50% 100%);
    position: relative;
}
.brand-mark::before,
.brand-mark::after {
    content: "";
    position: absolute;
    inset: 0;
    clip-path: polygon(0 0, 55% 50%, 0 100%);
}
.brand-mark::before { background: var(--vu-yellow); transform: scaleX(1.12); transform-origin: left; }
.brand-mark::after { background: var(--vu-black); }

.brand-text { display: flex; flex-direction: column; }
.brand-name {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.2rem;
    line-height: 1.2;
}
.brand-motto { font-size: 0.85rem; color: var(--muted); font-style: italic; }

.lang-switch { display: flex; gap: 0.25rem; }
.lang-switch a {
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--rule);
    color: var(--ink);
    text-decoration: none;
    font-size: 0.9rem;
}
.lang-switch a:hover { border-color: var(--ink); }
.lang-switch a.active {
    background: var(--vu-black);
    border-color: var(--vu-black);
    color: var(--vu-yellow);
    font-weight: 600;
}

/* ---------- Navbar ---------- */
.site-nav { background: var(--vu-black); padding: 0; }
.site-nav .navbar-toggler {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
    margin: 0.5rem 0;
}
.site-nav .nav-link {
    color: #fff;
    padding: 0.85rem 0.9rem;
    border-bottom: 3px solid transparent;
}
.site-nav .nav-link:hover,
.site-nav .nav-link:focus-visible { color: var(--vu-yellow); }
.site-nav .nav-link.active {
    color: var(--vu-yellow);
    border-bottom-color: var(--vu-yellow);
    font-weight: 600;
}

/* Red / yellow / green: the flag's bands, as a single thin rule. */
.flag-stripe {
    height: 10px;
    background: linear-gradient(
        var(--vu-red) 0 40%,
        var(--vu-yellow) 40% 60%,
        var(--vu-green) 60% 100%
    );
}

/* ---------- Hero: the one bold element ---------- */
.hero {
    position: relative;
    overflow: hidden;
    padding: 4.5rem 0 4rem;
    border-bottom: 1px solid var(--rule);
}

/* The flag's black chevron with its yellow edge, pointing into the title. */
.hero-chevron {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(30vw, 420px);
    background: var(--vu-yellow);
    clip-path: polygon(0 0, 62% 0, 100% 50%, 62% 100%, 0 100%);
}
.hero-chevron::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--vu-black);
    clip-path: polygon(0 0, 55% 0, 91% 50%, 55% 100%, 0 100%);
}

.hero-body {
    position: relative;
    max-width: 44rem;
    /* Start the text just past the chevron's tip, whatever the screen width.
       (100vw - 100%) / 2 = how far the container's content already sits from
       the left edge, so we only add the difference. */
    margin-left: max(0px, calc(min(30vw, 420px) + 2rem - (100vw - 100%) / 2));
}
.hero-title {
    font-size: clamp(2rem, 4.2vw, 3.1rem);
    margin-bottom: 1rem;
}
.hero-lead { font-size: 1.2rem; color: var(--muted); max-width: 36rem; }
.hero-welcome { margin-top: 1.5rem; max-width: 38rem; }
.hero-sign { margin-top: 1.5rem; color: var(--muted); }
.hero-sign-name {
    display: block;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--ink);
}

/* On narrow screens the chevron becomes a band on the left edge. */
@media (max-width: 767.98px) {
    .hero { padding: 2.5rem 0 2.5rem; }
    .hero-chevron { width: 14px; clip-path: none; }
    .hero-chevron::after { clip-path: none; right: 5px; }
    .hero-body { margin-left: 0.75rem; }
}

/* ---------- Sections ---------- */
.section { padding: 3.5rem 0; }
.section-alt { background: var(--paper-alt); }
.page-title { font-size: clamp(1.9rem, 3.5vw, 2.6rem); margin-bottom: 0.75rem; }
.section-title { font-size: 1.5rem; margin-bottom: 1.1rem; }
.lead-text { max-width: 40rem; color: var(--muted); }
.prose { max-width: 40rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.4rem; }

.btn-vu {
    background: var(--vu-green-text);
    color: #fff;
    border-radius: 0;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
}
.btn-vu:hover { background: var(--vu-black); color: var(--vu-yellow); }

/* ---------- Services ---------- */
.service-list { list-style: none; padding: 0; margin: 0; }
.service-item {
    display: flex;
    gap: 1rem;
    padding: 1.1rem 0;
    border-top: 1px solid var(--rule);
}
.service-item:last-child { border-bottom: 1px solid var(--rule); }
.service-icon { font-size: 1.5rem; color: var(--vu-green-text); line-height: 1.3; }
.service-name { font-size: 1.15rem; margin-bottom: 0.3rem; }
.service-item p { margin-bottom: 0.4rem; }
.service-handled { font-size: 0.9rem; color: var(--muted); }

/* ---------- Urgent panel (red = emergency only) ---------- */
.urgent-panel {
    border-left: 6px solid var(--vu-red);
    background: #fff;
    padding: 1.4rem 1.5rem;
    box-shadow: 0 0 0 1px var(--rule);
}
.urgent-title { font-size: 1.3rem; }
.urgent-title .bi { color: var(--vu-red); }
.urgent-item { padding: 0.8rem 0; border-bottom: 1px solid var(--rule); }
.urgent-item:last-of-type { margin-bottom: 1rem; }
.urgent-name { font-family: var(--font-body); font-size: 1rem; font-weight: 600; margin-bottom: 0.15rem; }
.urgent-phone {
    display: inline-block;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--vu-black);
    text-decoration: none;
}
.urgent-item p { font-size: 0.92rem; color: var(--muted); margin: 0.2rem 0 0; }

/* ---------- Contact block ---------- */
.contact-block p { margin-bottom: 0.6rem; }
.contact-label { display: block; font-size: 0.85rem; color: var(--muted); }
.contact-note { color: var(--muted); }

/* ---------- Links page ---------- */
.link-group { margin-top: 2.5rem; }
.link-group-emergency { border-left: 6px solid var(--vu-red); padding-left: 1.25rem; }
.link-list { list-style: none; padding: 0; margin: 0; max-width: 52rem; }
.link-item { padding: 1rem 0; border-top: 1px solid var(--rule); }
.link-name { font-family: var(--font-body); font-size: 1.05rem; font-weight: 600; margin-bottom: 0.25rem; }
.link-item p { margin-bottom: 0.3rem; }
.link-actions { display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem; }

/* ---------- Footer ---------- */
.site-footer {
    background: var(--vu-black);
    color: #E6E6E6;
    padding: 3.5rem 0 1.5rem;
    border-top: 6px solid var(--vu-yellow);
}
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--vu-yellow); }
.site-footer .contact-label,
.site-footer .contact-note { color: #BDBDBD; }
.footer-title { color: var(--vu-yellow); font-size: 1.1rem; margin-bottom: 1rem; }
.footer-links { list-style: none; padding: 0; }
.footer-links li { margin-bottom: 0.45rem; }
.footer-bottom {
    margin: 2.5rem 0 0;
    padding-top: 1.25rem;
    border-top: 1px solid #333;
    font-size: 0.85rem;
    color: #BDBDBD;
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Phase 2b: services & FAQ ---------- */
.narrow { max-width: 48rem; }
.back-link { margin-bottom: 0.5rem; font-size: 0.95rem; }
.page-title-icon { color: var(--vu-green-text); margin-right: 0.35rem; }

.service-name a { color: var(--ink); text-decoration-color: var(--rule); }
.service-name a:hover { text-decoration-color: var(--vu-green-text); }

/* "Where to go" — a green edge for this office, black for Canberra. */
.where-panel { background: var(--paper-alt); padding: 1.5rem; border-left: 6px solid var(--vu-black); }
.where-consulate, .where-both { border-left-color: var(--vu-green); }
.where-sub { font-family: var(--font-body); font-size: 1rem; font-weight: 600; margin-top: 1.25rem; }
.where-panel .contact-block { margin-top: 1rem; }

.preview-bar { background: var(--vu-yellow); color: var(--vu-black); padding: 0.6rem 0; font-weight: 600; }

.faq-group { margin-top: 2rem; }
.faq-item { border-top: 1px solid var(--rule); }
.faq-group .faq-item:last-child { border-bottom: 1px solid var(--rule); }
.faq-item summary {
    cursor: pointer;
    padding: 1rem 2rem 1rem 0;
    font-weight: 600;
    list-style: none;
    position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: "+";
    position: absolute;
    right: 0.25rem;
    top: 0.85rem;
    font-size: 1.3rem;
    color: var(--vu-green-text);
}
.faq-item[open] summary::after { content: "\2212"; }
.faq-answer { padding-bottom: 1rem; }

/* ---------- Phase 3: news & events ---------- */
.filter-links { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 1.25rem 0 0.5rem; }
.filter-links a {
    padding: 0.35rem 0.8rem; border: 1px solid var(--rule);
    color: var(--ink); text-decoration: none; font-size: 0.95rem;
}
.filter-links a:hover { border-color: var(--ink); }
.filter-links a.active { background: var(--vu-black); border-color: var(--vu-black); color: var(--vu-yellow); font-weight: 600; }

.news-list, .event-list { list-style: none; padding: 0; margin: 0; }
.news-item { padding: 1.1rem 0; border-top: 1px solid var(--rule); }
.news-item:last-child { border-bottom: 1px solid var(--rule); }
/* Official notices carry a black edge: the flag's black, "this comes from the office". */
.news-item.is-notice { border-left: 4px solid var(--vu-black); padding-left: 1rem; }
.news-meta { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.3rem; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.notice-tag { background: var(--vu-black); color: var(--vu-yellow); padding: 0.1rem 0.5rem; font-weight: 600; font-size: 0.8rem; }
.news-title { font-size: 1.2rem; margin-bottom: 0.3rem; }
.news-title a, .event-title a { color: var(--ink); text-decoration-color: var(--rule); }
.news-title a:hover, .event-title a:hover { text-decoration-color: var(--vu-green-text); }
.news-excerpt { margin: 0; }

.event-item { display: flex; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--rule); }
.event-item:last-child { border-bottom: 1px solid var(--rule); }
.event-date {
    flex: none; width: 3.6rem; text-align: center; align-self: flex-start;
    border-top: 4px solid var(--vu-green); background: var(--paper-alt); padding: 0.35rem 0;
}
.event-day { display: block; font-family: var(--font-head); font-weight: 700; font-size: 1.5rem; line-height: 1.1; }
.event-month { display: block; font-size: 0.8rem; color: var(--muted); }
.event-title { font-size: 1.1rem; margin-bottom: 0.2rem; }
.event-when, .event-where { margin: 0; font-size: 0.95rem; color: var(--muted); }
.past-events .event-date { border-top-color: var(--rule); }
.past-events .event-title a { color: var(--muted); }

.event-facts { background: var(--paper-alt); padding: 1.25rem 1.5rem; border-left: 6px solid var(--vu-green); }
.event-facts dt { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.event-facts dd { margin-bottom: 1rem; font-weight: 500; }
.event-facts dd:last-child { margin-bottom: 0; }

.cover { margin: 1.5rem 0; }
.cover img { width: 100%; height: auto; display: block; }
.article-body { margin-top: 1.5rem; }
.section-news { border-top: 1px solid var(--rule); }

.site-pager { margin-top: 2rem; }
.site-pager .page-link { color: var(--ink); border-radius: 0 !important; }
.site-pager .page-item.active .page-link { background: var(--vu-black); border-color: var(--vu-black); color: var(--vu-yellow); }

/* ---------- Phase 3b: subscribe band ---------- */
.subscribe-band { background: var(--paper-alt); border-top: 1px solid var(--rule); padding: 2.5rem 0; }
.subscribe-title { font-size: 1.35rem; margin-bottom: 0.5rem; }
.subscribe-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.subscribe-email { flex: 1 1 18rem; }
.subscribe-lang { flex: 0 1 10rem; }
.subscribe-form label, .subscribe-topics legend { display: block; font-size: 0.9rem; font-weight: 500; margin-bottom: 0.25rem; }
.subscribe-form input[type="email"], .subscribe-form select {
    width: 100%; padding: 0.55rem 0.7rem; border: 1px solid #8A948F; background: #fff; font: inherit;
}
.subscribe-topics { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 1rem 0; border: 0; padding: 0; }
.subscribe-topics legend { width: 100%; }
.subscribe-topics .topic { display: inline-flex; gap: 0.4rem; align-items: center; font-weight: 400; font-size: 1rem; }
.btn-subscribe {
    background: var(--vu-green-text); color: #fff; border: 0; padding: 0.65rem 1.4rem; font-weight: 600;
}
.btn-subscribe:hover { background: var(--vu-black); color: var(--vu-yellow); }
.subscribe-privacy { font-size: 0.85rem; color: var(--muted); margin: 0.75rem 0 0; max-width: 40rem; }
.subscribe-error { color: var(--vu-red); font-weight: 600; }
.notice-ok { color: var(--vu-green-text); font-weight: 600; }
/* Honeypot: moved off-screen rather than display:none (some bots skip display:none fields). */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.unsubscribe-box { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }

/* ---------- Phase 4: downloads ---------- */
.download-group { margin-top: 2rem; }
.download-list { list-style: none; padding: 0; margin: 0; }
.download-item { display: flex; gap: 1rem; padding: 1.1rem 0; border-top: 1px solid var(--rule); }
.download-group .download-item:last-child { border-bottom: 1px solid var(--rule); }
.download-icon { font-size: 1.8rem; color: var(--vu-red); line-height: 1.2; }
.download-icon.bi-file-earmark-word { color: #2B579A; }
.download-icon.bi-link-45deg { color: var(--muted); }
.download-name { font-family: var(--font-body); font-size: 1.05rem; font-weight: 600; margin-bottom: 0.25rem; }
.download-body p { margin-bottom: 0.4rem; }
.download-meta { font-size: 0.9rem; color: var(--muted); }

/* ---------- Phase 5: contact form ---------- */
.request-form .form-control, .request-form .form-select { border-radius: 0; border-color: #8A948F; }
.request-form .form-check-input:checked { background-color: var(--vu-green-text); border-color: var(--vu-green-text); }
.form-privacy { font-size: 0.9rem; color: var(--muted); margin: 1.25rem 0 1rem; max-width: 40rem; }
/* Errors are listed at the top AND beside each field; each list item links to its field. */
.form-error-summary {
    border-left: 6px solid var(--vu-red); background: #FDF1F3; padding: 1rem 1.25rem; margin-bottom: 1.5rem; font-weight: 600;
}
.form-error-summary ul { margin: 0.5rem 0 0; font-weight: 400; }
.form-error-summary a { color: var(--vu-red); }
.ref-number {
    display: inline-block; font-family: var(--font-head); font-size: 1.8rem; font-weight: 700;
    background: var(--vu-black); color: var(--vu-yellow); padding: 0.3rem 1rem; letter-spacing: 0.02em;
}

/* ---------- Phase 6: About ---------- */
.consul-message { display: grid; grid-template-columns: var(--about-photo-width) minmax(0, 1fr); gap: 2.5rem; align-items: start; margin-top: 1.5rem; }
.consul-message > :only-child { grid-column: 1 / -1; }
.consul-photo { margin: 0; }
.consul-photo img { width: 100%; height: auto; display: block; border-bottom: 6px solid var(--vu-yellow); }
.consul-photo figcaption { margin-top: 0.75rem; color: var(--muted); font-size: 0.95rem; }
@media (max-width: 767.98px) {
    .consul-message { grid-template-columns: 1fr; }
    .consul-photo { max-width: var(--about-photo-width); }
}

/* ---------- Phase 6: 404 ---------- */
.notfound-code { font-family: var(--font-head); font-size: 5rem; font-weight: 700; line-height: 1; color: var(--vu-green-text); margin: 0; }
.notfound-links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: 1.1rem; }
.notfound-urgent { margin-top: 2rem; padding-left: 1rem; border-left: 6px solid var(--vu-red); }

/* =====================================================================
   PRINT
   People print service pages and forms information to bring to the
   office. Print only the content: no menus, buttons, sign-up band or
   emergency strip; black text on white; show where links point.
   ===================================================================== */
@media print {
    @page { margin: 1.5cm; }

    body { font-size: 11pt; color: #000; background: #fff; }

    .emergency-strip, .site-nav, .lang-switch, .flag-stripe, .skip-link,
    .subscribe-band, .hero-chevron, .btn, .btn-vu, .back-link, .filter-links,
    .site-pager, .request-form, .form-error-summary, .preview-bar,
    .site-footer .col-lg-4:last-child { display: none !important; }

    .site-header-inner { padding: 0 0 0.5cm; border-bottom: 2px solid #000; }
    .hero { padding: 0; border: 0; }
    .hero-body { margin-left: 0; }
    .section { padding: 0.6cm 0; }
    .section-alt, .where-panel, .event-facts, .urgent-panel { background: none; }
    .container { max-width: none; }

    a { color: #000; text-decoration: underline; }
    /* After links in the main text, print the address so the paper copy is still useful. */
    .prose a[href^="http"]::after, .contact-block a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; }

    h1, h2, h3 { break-after: avoid; }
    li, .faq-item, .download-item, .event-item, .service-item { break-inside: avoid; }

    /* FAQ answers are hidden when collapsed; on paper, show them all. */
    .faq-item > * { display: block !important; }
    .faq-item summary::after { content: none; }

    /* Keep the office details at the bottom of every printout. */
    .site-footer { background: none; color: #000; border-top: 2px solid #000; padding: 0.4cm 0 0; }
    .site-footer a, .footer-title, .site-footer .contact-label { color: #000; }
    .footer-bottom { display: none; }
}

/* ---------- Consul's photo beside the welcome message (Home hero) ---------- */
.hero-body.has-photo { max-width: 60rem; }  /* wider, to make room for the bigger photo */
.hero-message { display: block; }
.has-photo .hero-message {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--home-photo-width);
    gap: 2rem;
    align-items: start;
    margin-top: 1.5rem;
}
.has-photo .hero-welcome { margin-top: 0; }
.hero-photo { margin: 0; }
.hero-photo img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;      /* same frame whatever shape the uploaded photo is */
    object-fit: cover;
    object-position: center top;  /* keep the face in view when cropping */
    display: block;
    border-bottom: 6px solid var(--vu-yellow);
}

/* Phones: photo first, smaller, then the message and signature. */
@media (max-width: 575.98px) {
    .has-photo .hero-message { grid-template-columns: 1fr; gap: 1rem; }
    .hero-photo { order: -1; max-width: 12rem; }
}

@media print {
    .hero-photo { max-width: 4cm; }
}

/* ---------- Pattern watermark behind the Home hero ----------
   The image was pre-made light (white, with the motifs in faint flag
   green), so text over it keeps full contrast. It's a 1600px JPG (~70 KB),
   not the original dark 1672px file, so the Home page stays fast.
   Only the hero gets it: a pattern behind every page's body text would
   make reading harder. */
.hero {
    background-color: var(--paper);
    background-image: url("../img/hero-pattern-watermark.jpg");
    background-size: cover;
    background-position: center;
}

/* Printers skip backgrounds anyway; this makes sure. */
@media print {
    .hero { background: none; }
}
