/*
 * The sign-in page and the signed-in page, drawn like the HISD3 UI kit's sign-in page
 * (@hisd3/ui-kit HISD3LoginPage, variant "sheet", primary preset "brandBlue", light mode), so
 * Argus looks like every HISD3 application that sends people here.
 *
 * Served from this origin only: the Content-Security-Policy forbids inline styles, style
 * attributes, and fonts and images from anywhere else. What the kit sets inline (the
 * illustration's line widths, the button's size) is a class here.
 */

/* Archivo, the kit's typeface, self-hosted (SIL Open Font License: ../fonts/OFL-archivo.txt). */
@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/archivo-latin-400-normal.woff2") format("woff2");
}
@font-face {
    font-family: "Archivo";
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/archivo-latin-400-italic.woff2") format("woff2");
}
@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/archivo-latin-500-normal.woff2") format("woff2");
}
@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/archivo-latin-600-normal.woff2") format("woff2");
}
@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/archivo-latin-700-normal.woff2") format("woff2");
}
@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url("../fonts/archivo-latin-800-normal.woff2") format("woff2");
}

/* The kit's light palette, with the "brandBlue" primary (#1B6FE0, the HISD3 logo's cloud) as the
   kit applies it: darkened to #1A6BD7 so it reads at 4.5:1 on the page and under white text. */
:root {
    color-scheme: light;
    --primary: #1a6bd7;
    --primary-hover: #408be3;
    --primary-active: #0c4db0;
    --primary-bg: #edf3fc;
    --primary-border: #a3c4ef;
    --page: #f6f5f2;
    --surface: #ffffff;
    --text: #171717;
    --text-secondary: #4a4a4a;
    --text-tertiary: #6e6e6e;
    --border: #d9d5ce;
    --field-border: #8c8a85;
    --error: #b42318;
    --error-bg: #fbeae7;
    --success: #2e7d32;
    --success-bg: #eaf3ea;
    --font: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    line-height: 1.15;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    color: var(--text);
    background: var(--page);
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

h1,
h2 {
    font-family: var(--font);
    font-weight: 800;
    letter-spacing: -0.01em;
}

button,
input {
    font-family: inherit;
    font-size: 100%;
    line-height: 1.15;
    margin: 0;
}

img {
    border-style: none;
    vertical-align: middle;
}

[hidden] {
    display: none !important;
}

/* ---------- The page and the sheet ---------- */

.page {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    background: var(--page);
}

/* The panel and the form side by side, filling the window edge to edge. */
.sheet {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 560px;
    background: var(--surface);
    overflow: hidden;
}

/* ---------- The brand panel ---------- */

.panel {
    position: relative;
    flex: 0 0 55%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 15% 9% 0;
    overflow: hidden;
    color: #fff;
    background: var(--primary);
    /* A deep-to-primary gradient; a browser without color-mix keeps the flat primary. */
    background: linear-gradient(165deg, color-mix(in srgb, var(--primary) 72%, #000) 0%, var(--primary) 70%);
    user-select: none;
}

.panel h2 {
    position: relative;
    z-index: 2;
    max-width: 12em;
    margin: 0;
    font-size: clamp(26px, 3.1vw, 44px);
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: #fff;
}

/* A short rule above the headline. */
.panel h2::before {
    content: "";
    display: block;
    width: 56px;
    height: 4px;
    margin-bottom: 26px;
    background: #fff;
    opacity: 0.9;
}

.panel p {
    position: relative;
    z-index: 2;
    margin: 16px 0 0;
    font-size: 15px;
    opacity: 0.82;
}

/* The fixed HISD3 watermark: the organisation's mark, never the hospital's logo. */
.watermark {
    position: absolute;
    top: 30px;
    left: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.28;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #fff;
}

.watermark img {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

/* Logo and name inside the panel, shown only on a phone, where the panel is the hero. */
.panel-brand {
    display: none;
}

/* The panel's art, built from the brand: clouds, the HISD3 mark and two record tiles. */
.art {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.art .cloud,
.art .mark,
.art .tile {
    position: absolute;
}

.art .cloud {
    background: #fff;
    border-radius: 999px;
    opacity: 0.85;
}

.art .cloud::before,
.art .cloud::after {
    content: "";
    position: absolute;
    bottom: 40%;
    background: #fff;
    border-radius: 50%;
    aspect-ratio: 1;
}

.art .cloud::before {
    left: 18%;
    width: 46%;
}

.art .cloud::after {
    left: 46%;
    width: 34%;
}

.art .cloud-1 { left: -8%; bottom: 36%; width: 28%; height: 7%; opacity: 0.42; }
.art .cloud-2 { right: -10%; bottom: 44%; width: 26%; height: 7%; opacity: 0.32; }
.art .cloud-3 { left: 10%; bottom: 4%; width: 32%; height: 8%; }
.art .cloud-4 { right: -6%; bottom: 2%; width: 36%; height: 9%; opacity: 0.7; }

.art .mark {
    right: 9%;
    bottom: 9%;
    width: 31%;
    aspect-ratio: 1;
}

.art .mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.96;
    filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.18));
}

.art .tile {
    display: grid;
    gap: 7px;
    padding: 12px 14px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.art .tile-a { left: 10%; bottom: 21%; width: 30%; }
.art .tile-b { right: 4%; bottom: 40%; width: 22%; }

/* The tile is white, so its lines are a light tint of the primary. */
.art .tile i {
    display: block;
    height: 7px;
    background: #e8e6e1;
    background: color-mix(in srgb, var(--primary) 18%, #fff);
}

.art .tile i:first-child {
    width: 46%;
    height: 9px;
    background: var(--primary);
}

/* The kit sets these inline, so they win over the first line's 46%. */
.art .tile i.w85 { width: 85%; }
.art .tile i.w70 { width: 70%; }
.art .tile i.w60 { width: 60%; }

.art .tile b {
    position: absolute;
    top: 10px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    color: #fff;
    background: var(--success);
}

/* ---------- The form ---------- */

/* The sheet is the frame: the form stands on its surface, its 420px block centred in the column. */
.card {
    position: relative;
    z-index: 2;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0;
    padding: 56px max(8%, calc((45% - 420px) / 2)) 48px;
    background: transparent;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
}

.brand img {
    display: block;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    object-fit: contain;
}

/* The name (a bare span, so the page reads <span>Hospital name</span>) and the tagline. */
.brand-text > span {
    display: block;
}

.brand .brand-text > span:first-child {
    font-size: 18px;
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text);
}

.brand .brand-text > .tagline {
    margin-top: 4px;
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.card h1 {
    margin: 0 0 12px;
    font-size: 38px;
    line-height: 1.1;
    letter-spacing: -0.015em;
    color: var(--text);
}

.subtitle {
    max-width: 440px;
    margin: 0 0 32px;
    font-size: 15px;
    color: var(--text-secondary);
}

.message {
    margin: 0 0 16px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--success);
    background: var(--success-bg);
    border-left: 3px solid var(--success);
}

.message.error {
    color: var(--error);
    background: var(--error-bg);
    border-left-color: var(--error);
}

.field {
    display: block;
    max-width: 420px;
    margin-bottom: 16px;
}

.field-label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.field-control {
    position: relative;
    display: flex;
    align-items: center;
}

.field input {
    width: 100%;
    height: 48px;
    padding: 0 44px 0 16px;
    font: inherit;
    font-size: 15px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--field-border);
    border-radius: 0;
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.field input::placeholder {
    color: var(--text-tertiary);
}

.field input:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

/* Show/hide password: the kit's eye icons. Shown by login.js; without script it stays hidden. */
.reveal {
    position: absolute;
    right: 12px;
    display: flex;
    padding: 6px;
    border: 0;
    background: none;
    font-size: 16px;
    color: var(--text-tertiary);
    cursor: pointer;
}

.reveal:hover {
    color: var(--text);
}

.reveal:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.reveal svg {
    display: block;
    width: 1em;
    height: 1em;
}

.reveal .icon-hide,
.reveal[aria-pressed="true"] .icon-show {
    display: none;
}

.reveal[aria-pressed="true"] .icon-hide {
    display: block;
}

/* The kit's primary button, large, compact and square, on its own line. */
.submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    align-self: flex-start;
    height: 50px;
    min-width: 180px;
    padding: 0 36px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border: 1px solid transparent;
    border-radius: 0;
    box-shadow: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
}

.submit:hover {
    background: var(--primary-hover);
}

.submit:active {
    background: var(--primary-active);
}

.submit:focus-visible {
    outline: 3px solid var(--primary-border);
    outline-offset: 1px;
}

.help {
    margin: 48px 0 0;
    font-size: 13px;
    color: var(--text-tertiary);
}

/* The signed-in page. */
.signed-in {
    max-width: 440px;
    margin: 0 0 32px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.signed-in strong {
    font-weight: 700;
    color: var(--text);
}

.card form {
    display: flex;
    flex-direction: column;
}

/* The modules someone who signed in here directly can open: one bordered list, a row each,
   the name in the primary, an arrow on the right. */
.apps {
    display: flex;
    flex-direction: column;
    max-width: 440px;
    margin: 0 0 28px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.app {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 64px;
    padding: 12px 16px;
    color: var(--text);
    text-decoration: none;
    border-top: 1px solid var(--border);
    transition: background 0.15s ease;
}

.app:first-child {
    border-top: 0;
}

.app:hover {
    background: var(--primary-bg);
}

.app:focus-visible {
    position: relative;
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.app-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.app-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.app-description {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.app-arrow {
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    transition: transform 0.15s ease, color 0.15s ease;
}

.app:hover .app-arrow {
    color: var(--primary);
    transform: translateX(2px);
}

/* Signing out beside the module list: the kit's default button, never red. */
.submit.secondary {
    height: 44px;
    min-width: 0;
    padding: 0 20px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    background: var(--surface);
    border-color: var(--field-border);
}

.submit.secondary:hover {
    color: var(--primary);
    background: var(--surface);
    border-color: var(--primary);
}

.submit.secondary:active {
    color: var(--primary-active);
    background: var(--surface);
    border-color: var(--primary-active);
}

/* ---------- Tablet: no panel; the sheet is the form's bordered frame on the page ground ---------- */

@media (max-width: 1024px) {
    .page {
        padding: 32px 24px;
        background: linear-gradient(180deg, var(--primary-bg) 0%, var(--page) 46%);
    }

    .sheet {
        width: min(440px, 100%);
        height: auto;
        min-height: 0;
        border: 1px solid var(--border);
    }

    .panel {
        display: none;
    }

    .card {
        width: min(440px, 100%);
        padding: 40px 44px 34px;
    }

    .brand {
        gap: 12px;
        margin-bottom: 28px;
    }

    .brand img {
        width: 54px;
        height: 54px;
    }

    .brand .brand-text > span:first-child {
        font-size: 25px;
        letter-spacing: 0.03em;
    }

    .card h1 {
        margin-bottom: 6px;
        font-size: 26px;
        line-height: 1.15;
        letter-spacing: -0.01em;
    }

    .subtitle,
    .signed-in {
        max-width: none;
        margin-bottom: 22px;
        font-size: 14px;
    }

    .help {
        margin-top: 20px;
        text-align: center;
        font-size: 14px;
        color: var(--text-secondary);
    }
}

/* ---------- Phone: the panel becomes the hero, the form the white sheet rising over it ---------- */

@media (max-width: 560px) {
    .page {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding: 0;
        background: var(--primary);
    }

    .sheet {
        display: contents;
    }

    .panel {
        display: flex;
        flex: 0 0 auto;
        justify-content: flex-end;
        min-height: 32vh;
        padding: 30px 22px 46px;
    }

    .panel h2::before {
        display: none;
    }

    .panel h2 {
        max-width: none;
        font-size: 27px;
    }

    .panel p {
        margin-top: 10px;
        font-size: 14px;
    }

    .art,
    .watermark,
    .brand {
        display: none;
    }

    .panel-brand {
        position: relative;
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 26px;
    }

    .panel-brand img {
        flex: 0 0 auto;
        width: 38px;
        height: 38px;
        padding: 4px;
        object-fit: contain;
        background: #fff;
        border-radius: 10px;
    }

    .panel-brand .brand-text > span:first-child {
        font-size: 17px;
        font-weight: 700;
        line-height: 1.1;
        color: #fff;
    }

    .panel-brand .brand-text > .tagline {
        margin-top: 2px;
        font-size: 9px;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        opacity: 0.75;
    }

    .card {
        flex: 1 0 auto;
        width: 100%;
        margin: -28px 0 0;
        padding: 30px 22px 34px;
        background: var(--surface);
        border-radius: 20px 20px 0 0;
    }

    .card h1 {
        font-size: 22px;
    }

    .field {
        margin-bottom: 14px;
    }

    .field input {
        height: 46px;
        /* 16px keeps iOS Safari from zooming in on focus */
        font-size: 16px;
    }
}

/* The module list fills the narrower card on a tablet and a phone. */
@media (max-width: 1024px) {
    .apps {
        max-width: none;
        margin-bottom: 22px;
    }
}

@media (max-width: 560px) {
    .app {
        min-height: 60px;
    }

    .submit.secondary {
        align-self: stretch;
    }
}
