/*
 * SGDS Official Government Banner (masthead) - local assets
 * Replicated from @govtechsg/sgds-web-component v3.27.0 compiled styles
 * (https://v2.designsystem.tech.gov.sg/components/official-government-banner).
 * Scoped under .sgds-masthead so it cannot clash with the existing DXD/MOM styles.
 */

.sgds-masthead {
    font-family: var(--masthead-font-family, Inter, system-ui, "Segoe UI", Arial, sans-serif);
    font-size: var(--masthead-mobile-font-size, .875rem);
    line-height: 1.25rem;
    color: #1a1a1a;
}

@media screen and (min-width: 1024px) {
    .sgds-masthead {
        font-size: .875rem;
    }
}

    .sgds-masthead * {
        box-sizing: border-box;
    }

/* Collapsed bar */
.sgds-masthead .masthead-banner,
.sgds-masthead .masthead-panel {
    background-color: #f7f7f7;
}

/* Container: 4px (0.25rem) vertical rhythm; 1.25rem side padding <=1023px, 2rem >=1024px.
   Set --masthead-max-width: 1200px on a parent to align with the iOSH .container. */
.sgds-masthead .masthead-container {
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: var(--masthead-max-width, 1440px);
    padding: .25rem var(--masthead-mobile-padding-x, 1.25rem);
}

    .sgds-masthead .masthead-container.masthead-fluid {
        max-width: none;
    }

@media screen and (min-width: 1024px) {
    .sgds-masthead .masthead-container {
        padding: .25rem var(--masthead-padding-x, 2rem);
    }
}

.sgds-masthead .masthead-layout {
    display: flex;
    gap: .25rem;
}

.sgds-masthead .sg-crest {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

    .sgds-masthead .sg-crest path {
        fill: #db0000;
    }

.sgds-masthead .masthead-text-layout {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0 .75rem;
}

/* "How to identify" toggle.
   Note: timeout-dialog.css applies an unscoped global `button { border/radius/box-shadow/padding/... }`
   reset, so fully neutralise it here. */
.sgds-masthead .masthead-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    text-shadow: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font: inherit;
    line-height: inherit;
    color: #0269d0;
    cursor: pointer;
}

    .sgds-masthead .masthead-btn:hover {
        color: #0151a0;
        text-decoration: none;
        background: none;
        box-shadow: none;
    }

    .sgds-masthead .masthead-btn:focus {
        outline: none;
        box-shadow: none;
    }

    .sgds-masthead .masthead-btn::-moz-focus-inner {
        border: 0;
        padding: 0;
    }

    .sgds-masthead .masthead-btn:focus-visible {
        outline: 4px solid #60aaf4;
    }

.sgds-masthead .masthead-identify-icon {
    display: block;
    align-self: center;
    width: 20px;
    height: 20px;
    transform: rotate(180deg);
    transition: transform .3s ease-in-out 0s;
    -webkit-user-select: none;
    user-select: none;
}

    .sgds-masthead .masthead-identify-icon.show {
        transform: rotate(0deg);
    }

/* Expandable panel: grid-rows collapse animation (official behaviour) */
.sgds-masthead .masthead-content {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
    transition: grid-template-rows .3s cubic-bezier(.25,0,.25,1),
                opacity .3s cubic-bezier(.25,0,.25,1),
                padding .3s cubic-bezier(.25,0,.25,1);
}

    .sgds-masthead .masthead-content.show {
        grid-template-rows: 1fr;
        opacity: 1;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .sgds-masthead .masthead-content > .masthead-grid {
        min-height: 0;
    }

/* Fallback for engines without animatable grid-template-rows (govbanner.js toggles
   inline display:none on the content element); keep panel usable without grid. */
.sgds-masthead .masthead-content.masthead-no-grid {
    display: block;
    opacity: 1;
    overflow: visible;
    transition: none;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.sgds-masthead .masthead-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media screen and (min-width: 768px) {
    .sgds-masthead .masthead-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
    }
}

/* Columns */
.sgds-masthead .masthead-wrapper {
    display: flex;
    gap: .5rem;
}

.sgds-masthead .masthead-icon {
    margin-top: -.1em;
}

    .sgds-masthead .masthead-icon svg,
    .sgds-masthead .masthead-icon-inline {
        width: 20px;
        height: 20px;
        vertical-align: middle;
    }

    .sgds-masthead .masthead-icon path,
    .sgds-masthead .masthead-icon-inline path {
        fill: #1a1a1a;
    }

.sgds-masthead .masthead-body {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

    .sgds-masthead .masthead-body .title {
        font-weight: 600;
    }

    .sgds-masthead .masthead-body p {
        margin: 0;
        color: #525252;
    }

.sgds-masthead a.trusted-link {
    color: #0269d0;
    text-decoration: underline;
    width: -moz-fit-content;
    width: fit-content;
}

    .sgds-masthead a.trusted-link:hover {
        color: #0151a0;
    }

/* main.css has a global `a:focus { background-color:#E2F1FE }`; SGDS uses a focus ring instead. */
    .sgds-masthead a.trusted-link:focus {
        background-color: transparent;
    }

    .sgds-masthead a.trusted-link:focus-visible {
        outline: 4px solid #60aaf4;
    }

@media print {
    .sgds-masthead {
        display: none !important;
    }
}
