/* Shared by the inner pages (clients.php, client.php): base look, header, back button,
   brand-style client logos and the MAF logo transition screen. The portal (index.php) keeps its own styles. */

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

body {
    margin: 0;
    color: #FFFFFF;
    font-family: 'Inter', system-ui, sans-serif;
    background-color: #0B1230;
    background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 28px 28px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; }
svg { display: block; flex: none; }

a:focus-visible, input:focus-visible {
    outline: 3px solid #FFFFFF;
    outline-offset: 3px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.page {
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 40px 56px;
}

.main { display: flex; flex-direction: column; gap: 24px; }

/* Header: same brand block as the portal, and it links back there. */
.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 24px; }
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; }
.brand__logo { display: block; width: auto; height: 60px; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.5)); }

.brand__fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 60px;
    color: #22272B;
    font-family: 'Sora', system-ui, sans-serif;
    font-size: 17px;
    font-weight: 700;
    background: #E2D8C8;
    border: 3px solid #22272B;
    border-radius: 50%;
}

.brand__name { display: block; font-family: 'Sora', system-ui, sans-serif; font-size: 20px; font-weight: 700; letter-spacing: 0.22em; }
.brand__tagline { display: block; margin-top: 4px; color: #A9B5DA; font-size: 13px; }

/* Back button: easy to spot, since it is the way to another system or list. */
.back {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    align-self: flex-start;
    min-height: 44px;
    padding: 0 18px 0 14px;
    color: #E0E6FA;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.back svg { transform: rotate(180deg); transition: transform 0.2s ease; }
.back:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.35); }
.back:hover svg { transform: rotate(180deg) translateX(3px); }

/* Client logo: flat, two colours, like a printed brand mark. Background --logo-bg, mark --logo-fg. */
.client__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    color: var(--logo-fg, #FFFFFF);
    background: var(--logo-bg, #3D4A5C);
    border-radius: 16px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10); /* hairline, so dark brand colours stay visible on the dark page */
}

/* No logo on file: initials in an outlined badge, so it reads as "logo not supplied yet". */
.client__logo--none {
    color: #C9D2EC;
    font-family: 'Sora', system-ui, sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.22);
}

.client__mark { display: block; }

.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; color: #8E9BC4; font-size: 13px; }

/* Arriving from the MAF logo screen: the page fades in instead of appearing at once. */
@media (prefers-reduced-motion: no-preference) {
    .page { animation: page-in 0.45s ease-out both; }
    @keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
}

/* MAF logo screen between pages (assets/transition.js), the same one the portal shows. */
.leave {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background-color: #0B1230;
    background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 28px 28px;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.leave.is-on { opacity: 1; }

.leave__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.4s ease 0.15s, transform 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2) 0.15s;
}

.leave.is-on .leave__brand { opacity: 1; transform: scale(1); }

.leave__brand img {
    display: block;
    width: min(260px, 62vw);
    height: auto;
    filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.45));
}

.leave__name {
    margin-top: -28px; /* the logo file has transparent space under the oval */
    font-family: 'Sora', system-ui, sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.22em;
}

.leave__status { margin-top: 14px; color: #A9B5DA; font-size: 14px; text-align: center; }

/* Client variant: the client's own logo in the centre, a glow in its colour, MAF in small at the bottom. */
.leave--client {
    background-image:
        radial-gradient(circle at 50% 44%, color-mix(in srgb, var(--logo) 32%, transparent), transparent 50%),
        radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: auto, 28px 28px;
}

.leave--client .leave__brand { transform: none; } /* the logo position is measured, so this block must not scale */

.leave__spot { width: 140px; height: 140px; }

.leave__client {
    margin-top: 24px;
    font-family: 'Sora', system-ui, sans-serif;
    font-size: 26px;
    font-weight: 700;
    text-align: center;
}

.leave--client .leave__status { margin-top: 8px; }

/* The flying logo: the tile's logo badge, drawn at its final size (140px) and animated from the tile. */
.leave__flyer {
    position: fixed;
    z-index: 101;
    width: 140px;
    height: 140px;
    margin: 0;
    border-radius: 35px;
    transform-origin: 0 0;
    scale: 1;
    animation: none;
    box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.75);
    pointer-events: none;
}

.leave__flyer svg { width: 105px; height: 105px; }
.leave__flyer.client__logo--none { font-size: 44px; border-width: 2px; }

.leave__foot {
    position: absolute;
    bottom: 32px;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #A9B5DA;
    font-family: 'Sora', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.22em;
}

.leave__foot img { width: auto; height: 28px; }

@media (prefers-reduced-motion: no-preference) {
    .leave.is-on .leave__brand img { animation: brand-breathe 2.4s ease-in-out 0.7s infinite; }
    @keyframes brand-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
}

@media (prefers-reduced-motion: reduce) {
    .leave__brand { transform: none; transition: opacity 0.25s ease; }
}

@media (max-width: 640px) {
    .page { gap: 24px; padding: 24px 16px 40px; }
}

/* Header right side: sample label and, when signed in, the sign-out button. */
.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.signout { margin: 0; }

.signout button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 14px;
    color: #E0E6FA;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.signout button:hover { background: rgba(255, 255, 255, 0.10); border-color: rgba(255, 255, 255, 0.35); }
.signout button:focus-visible { outline: 3px solid #FFFFFF; outline-offset: 3px; }

/* Right after signing in: the client's logo screen covers the profile, then fades away (no script needed). */
.arrive {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #0B1230;
    background-image:
        radial-gradient(circle at 50% 44%, color-mix(in srgb, var(--logo) 32%, transparent), transparent 50%),
        radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: auto, 28px 28px;
    pointer-events: none;
    animation: arrive-out 0.5s ease 0.9s forwards;
}

.arrive__logo { width: 140px; height: 140px; border-radius: 35px; box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.75); }
.arrive__logo.client__logo--none { font-size: 44px; border-width: 2px; }

@keyframes arrive-out { to { opacity: 0; visibility: hidden; } }

@media (prefers-reduced-motion: reduce) {
    .arrive { animation-duration: 0.2s; animation-delay: 0.4s; }
}
