/* CWI portal branding for Authelia, injected by nginx (see /etc/nginx/sites-available/authelia).
   Typeface and accents follow cwi.nl: warm light page, slate teal and CWI red as accents.
   Authelia runs its light theme, so these are light-only to match its form controls. */

@font-face {
    font-family: "Ubuntu";
    src: url("/cwi-branding/ubuntu.woff2") format("woff2");
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --cwi-red: #ce0538;
    --cwi-red-dark: #a8042d;
    --cwi-teal: #5c8590;
    --cwi-teal-deep: #3a5960;
    --cwi-slate: #4c717b;              /* filled slate boxes */
    --cwi-on-slate: #ffffff;
    --cwi-on-slate-muted: rgba(255, 255, 255, 0.82);
    --cwi-on-slate-faint: rgba(255, 255, 255, 0.62);
    --cwi-side: #fbf4e1;          /* left column: soft warm yellow */
    --cwi-side-soft: #fdf9ee;     /* lighter tint for cards on the yellow */
    --cwi-side-border: #ece0bf;
    --cwi-page: #f4f3ef;          /* right side: warm near-white */
    --cwi-card: #ffffff;
    --cwi-text: #242424;
    --cwi-muted: #5f6b70;
    --cwi-faint: #8a9298;
    --cwi-border: #e5e2d8;
    --cwi-font: "Ubuntu", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html.cwi-branded body,
html.cwi-branded #root,
html.cwi-branded #root input,
html.cwi-branded #root button,
html.cwi-branded #root h5,
html.cwi-branded #root label,
html.cwi-branded #root p {
    font-family: var(--cwi-font) !important;
}

/* ---------- Page grid: brand column left, sign-in right ---------- */

html.cwi-branded body {
    margin: 0;
    min-height: 100vh;
    background: var(--cwi-page) !important;
    display: grid;
    grid-template-columns: minmax(360px, 42%) 1fr;
    grid-template-rows: 1fr auto;
}

#cwi-header,
#cwi-notice {
    grid-column: 1;
    color: var(--cwi-text);
    background: var(--cwi-side);
    box-sizing: border-box;
    padding-inline: clamp(2rem, 4.5vw, 4rem);
    border-right: 1px solid var(--cwi-side-border);
}
#cwi-header {
    grid-row: 1;
    display: flex;
    flex-direction: column;
    padding-top: 2.75rem;
}
#cwi-notice {
    grid-row: 2;
    padding-bottom: 2.25rem;
}

#root {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-width: 0;
}

/* ---------- Brand column ---------- */

#cwi-header p,
#cwi-notice p,
#cwi-header h1 {
    margin: 0;
}

.cwi-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.cwi-brand img {
    display: block;
    height: 40px;
    width: auto;
}
.cwi-brand-sub {
    font-size: 0.82rem;
    line-height: 1.3;
    color: var(--cwi-muted);
    max-width: 9rem;
}

.cwi-welcome {
    margin: auto 0;
    padding: 2.5rem 0;
    max-width: 29rem;
    width: 100%;
}
/* ---------- Session info: light card ---------- */

.cwi-session {
    box-sizing: border-box;
    margin-top: 1.5rem;
    padding: 1.2rem 1.3rem;
    width: 100%;
    max-width: 27rem;
    border-radius: 10px;
    background: var(--cwi-slate);
}
.cwi-session-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.75rem !important;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--cwi-on-slate);
}
.cwi-session dl {
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.4rem 1rem;
    font-size: 0.8rem;
    line-height: 1.45;
}
.cwi-session dt {
    color: var(--cwi-on-slate-faint);
    white-space: nowrap;
}
.cwi-session dd {
    margin: 0;
    color: var(--cwi-on-slate);
    word-break: break-word;
}

/* ---------- Access notice: light card with teal accent ---------- */

.cwi-notice-box {
    box-sizing: border-box;
    width: 100%;
    max-width: 27rem;
    padding: 1.2rem 1.3rem;
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--cwi-on-slate-muted);
    background: var(--cwi-slate);
    border-radius: 10px;
}
.cwi-notice-box p + p {
    margin-top: 0.55rem !important;
}
.cwi-notice-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.2rem !important;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--cwi-on-slate);
}
.cwi-notice-title svg {
    color: var(--cwi-on-slate);
}
.cwi-ack {
    font-weight: 600;
    color: var(--cwi-on-slate);
}

.cwi-copy {
    margin-top: 1.5rem !important;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.72rem;
    color: var(--cwi-faint);
}
.cwi-copy a {
    color: var(--cwi-teal-deep);
    text-decoration: underline;
    text-decoration-color: var(--cwi-side-border);
    text-underline-offset: 2px;
}
.cwi-copy a:hover {
    color: var(--cwi-red);
    text-decoration-color: var(--cwi-red);
}

/* ---------- Sign-in side ---------- */

/* Authelia's layout fills 90vh; fill the column instead and centre the card */
html.cwi-branded #root .min-h-\[90vh\] {
    min-height: calc(100vh - 4rem) !important;
    padding: 1rem 0 3rem;
}

/* Authelia's logo is shown in the brand column instead */
#root div:has(> img[alt="Logo"]) {
    display: none !important;
}

/* Hide the language selector (the whole top bar that holds it) */
#root header:has(#language-button),
#root #language-button {
    display: none !important;
}

/* The centred login column as a soft card with a thin red top edge */
#root .min-h-\[90vh\] > div > div {
    background: var(--cwi-card);
    color: var(--cwi-text);
    border: 1px solid var(--cwi-border);
    border-top: 3px solid var(--cwi-red);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(31, 41, 55, 0.04), 0 10px 28px rgba(31, 41, 55, 0.06);
    padding: 2.5rem 2.25rem 2rem;
    text-align: left;
}

#root h5 {
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    color: var(--cwi-text);
}
#first-factor-stage h5::after {
    content: "Use your CWI account to continue.";
    display: block;
    margin-top: 0.3rem;
    font-size: 0.88rem;
    font-weight: 400;
    color: var(--cwi-muted);
}

#sign-in-button {
    background: var(--cwi-red) !important;
    color: #fff !important;
    height: 2.65rem;
    border-radius: 6px;
    font-weight: 500;
    letter-spacing: 0.03em;
}
#sign-in-button:hover {
    background: var(--cwi-red-dark) !important;
}

/* Remove the vendor link; the footer row holds nothing else here */
#root a[href*="authelia.com"] {
    display: none !important;
}

/* ---------- Phones and narrow windows: header, form, notice stacked ---------- */

@media (max-width: 900px) {
    html.cwi-branded body {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
    }
    #cwi-header,
    #cwi-notice,
    #root {
        grid-column: 1;
    }
    #cwi-header,
    #cwi-notice {
        border-right: 0;
    }
    #cwi-header {
        grid-row: 1;
        padding: 1.5rem 16px 1.5rem;
        border-bottom: 1px solid var(--cwi-side-border);
    }
    #root {
        grid-row: 2;
        background: var(--cwi-page);
    }
    #cwi-notice {
        grid-row: 3;
        padding: 1.25rem 16px 1.75rem;
    }
    .cwi-brand img {
        height: 34px;
    }
    .cwi-welcome {
        margin: 0;
        padding: 1.5rem 0 0;
        max-width: none;
    }
    .cwi-session,
    .cwi-notice-box {
        max-width: none;
    }
    .cwi-copy {
        align-items: center;
        text-align: center;
    }
    html.cwi-branded #root .min-h-\[90vh\] {
        min-height: 0 !important;
        padding: 0.5rem 0 1.5rem;
    }
    #root .min-h-\[90vh\] > div {
        padding-inline: 16px;
    }
    #root .min-h-\[90vh\] > div > div {
        padding: 1.75rem 1.4rem 1.5rem;
    }
}
