/**
 * filae-connect.css — layout + the few pieces filae.css does not cover, for the Filae Connect
 * (IdentityServer) auth pages ONLY: login, register. Load it AFTER filae.css.
 *
 * Everything reusable stays in filae.css (fl-btn, fl-field, fl-check, fl-radio, fl-icon-btn,
 * fl-heading, fl-text, fl-link, fl-icon-mask). This file only adds `fc-` classes: the split
 * hero/form layout, the card, the password criteria list, the social buttons, the "ou" divider.
 *
 * Responsive via a container query on `.fc-auth`, so it behaves the same full page (Razor)
 * and inside a resized frame (Storybook).
 *
 * NOT built or published by CI (page-specific): it is copied by hand into the Filae Connect repo.
 *   this file      -> IdentityServer/wwwroot/css/filae-connect.css
 *   assets/*       -> IdentityServer/wwwroot/img/connect/   (page images only)
 * The Razor views are adapted from pages/*.html. The story in Filae.WebClient/src/stories/FilaeConnect
 * renders the same files, so edit here first, then re-copy.
 *
 * Icons are NOT in this file nor copied: they are the design system's own, published next to filae.css
 * (design/<version>/icons/rounded/*.svg). Use `<span class="fl-icon-mask" style="--fl-icon-url:url(<design>/icons/rounded/<name>.svg)">`.
 *
 * Google Sans (weight 500) is only used by the Google sign-in button, as Google's branding guidelines require.
 * It comes from Google Fonts: browsers get the small woff2 subsets. An @import must stay the first rule.
 */
@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@500&display=swap');

/* ───────────────────────── Page layout ───────────────────────── */

.fc-auth {
    container-type: inline-size;
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    min-height: var(--fc-auth-min-height, 100vh);
    background: var(--clr-background-paper);
    color: var(--clr-text-primary);
    font-family: var(--font-family-default);
}
/* Spec: links are underlined at rest (fl-link only underlines on hover) */
.fc-auth .fl-link { text-decoration: underline; }
/* the account scripts toggle `hidden` (it came from Bootstrap, which the other pages still load) */
.fc-auth .hidden { display: none !important; }

/* Simple pages (password flows, e-mail change): no hero, same logo + card, centred */
.fc-auth--simple .fc-main { flex: 1 1 100%; }
/* the card fits its widest element (title or text), up to the screen width; it wraps when the screen is narrower */
.fc-auth--simple .fc-card { width: fit-content; max-width: 100%; }
/* confirmation card (.fc-done, once shown) keeps the standard card width */
.fc-auth--simple .fc-card:has(.fc-done:not(.hidden)) { width: 100%; max-width: 520px; }

/* Left panel: photo + indigo scrim + title, tree illustration, quote */
.fc-hero {
    position: relative;
    flex: 5 1 440px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-6) var(--space-7);
    overflow: hidden;
    background: var(--clr-filae-light-indigo);
    color: var(--clr-common-white, #fff);
}
.fc-hero__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fc-hero__scrim { position: absolute; inset: 0; background: var(--clr-filae-light-indigo); opacity: 0.8; }
.fc-hero__intro { position: relative; display: flex; flex-direction: column; gap: var(--space-2); max-width: 460px; }
.fc-hero__title {
    margin: 0;
    font-size: var(--font-size-h1-mobile);
    line-height: 3.25rem;
    font-weight: var(--font-weight-bold);
    color: inherit;
}
.fc-hero__subtitle { margin: 0; max-width: 436px; font-size: 1.375rem; line-height: 2rem; }
.fc-hero__illu {
    position: relative;
    align-self: center;
    width: calc(100% + var(--space-6) * 2);
    max-width: none;
    height: auto;
    margin: 0 calc(var(--space-6) * -1);
    filter: drop-shadow(0 0 4px rgba(43, 37, 80, 0.7));
}
.fc-quote { margin: 0; }
.fc-quote--hero { position: relative; max-width: 460px; }
.fc-quote__text { margin: 0; font-size: 2rem; line-height: 2.5rem; font-style: italic; }
.fc-quote__author { margin-top: var(--space-1); font-size: var(--font-size-body2); line-height: var(--font-line-height-body2); }

/* Right column: logo, card, quote (mobile only) */
.fc-main {
    flex: 6 1 480px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-6) var(--space-4);
}
.fc-logo { display: block; height: 3rem; width: auto; }
.fc-card {
    width: 100%;
    max-width: 520px;
    padding: clamp(24px, 5cqw, 40px) var(--space-3);
    border-radius: var(--shape-border-radius-xl);
    background: var(--clr-background-paper);
    box-shadow: 0 2px 8px rgba(43, 37, 80, 0.08), 0 8px 24px rgba(43, 37, 80, 0.06);
}
.fc-mobile-quote { display: none; margin: 0; text-align: center; }
.fc-mobile-quote .fc-quote__text { font-size: 1.25rem; line-height: 1.75rem; color: var(--clr-filae-wistful-grey); }
.fc-mobile-quote .fc-quote__author { color: var(--clr-filae-wistful-grey); }
.fc-mobile-quote p { margin: 0 0 var(--space-3); }

@container (max-width: 919px) {
    .fc-hero { min-height: 0; gap: var(--space-2); padding: 20px var(--space-3); }
    .fc-hero__title { font-size: 1.625rem; line-height: 2rem; }
    .fc-hero__subtitle, .fc-quote--hero, .fc-hero__illu { display: none; }
    .fc-main { padding: 28px var(--space-2) var(--space-5); }
    .fc-card { margin-top: var(--space-1); }
    .fc-mobile-quote { display: block; }
}

/* very narrow screens: win back width so the brand buttons (fixed wording, no wrapping) still fit */
@container (max-width: 359px) {
    .fc-card { padding-left: var(--space-2); padding-right: var(--space-2); }
}
/* below ~320px even the narrowed card is too tight for the longest titles: let them wrap on two lines (fixed 44px logo, 2 x 20px text) */
@container (max-width: 319px) {
    .fc-auth .fc-brand-btn { white-space: normal; }
    .fc-auth .fc-brand-btn span { text-align: center; }
}

/* ───────────────────────── Form ───────────────────────── */

/* Spec: the form's controls (eye button, unchecked radio / checkbox) use the interaction indigo, not the neutral grey */
.fc-form { --clr-action-active: var(--clr-primary-main); display: flex; flex-direction: column; gap: var(--space-3); }
.fc-form__head { display: flex; flex-direction: column; gap: var(--space-1); }
.fc-title { color: var(--clr-filae-indigo); }
.fc-highlight {
    padding: 0 var(--space-0-5);
    border-radius: var(--shape-border-radius-sm);
    background: var(--clr-filae-tag-yellow);
    font-weight: var(--font-weight-bold);
    color: var(--clr-text-primary);
}
.fc-fields { display: flex; flex-direction: column; gap: 20px; }
.fc-fields--tight { gap: var(--space-2); }
.fc-names { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; }
.fc-names > .fl-field { min-width: 0; }
.fc-civility { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-0-5) var(--space-3); }
.fc-civility + .fc-error { margin-top: var(--space-0-5); }
.fc-error:empty { display: none; }
.fc-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-1); }
.fc-actions { display: flex; flex-direction: column; gap: var(--space-1); }
.fc-error { margin: 0; font-size: var(--font-size-body4); line-height: var(--font-line-height-body4); color: var(--clr-error-main); }
.fc-checks { display: flex; flex-direction: column; }
.fc-checks .fl-check { font-size: var(--font-size-body3); }
.fc-checks .fl-check__error { padding-left: 1.75rem; }
.fc-captcha { display: flex; justify-content: center; }

/* Password criteria. The register script flips `--valid` and the icon class on each item. */
.fc-criteria-intro { margin: 0 0 var(--space-1); }
.fc-criteria {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-0-5) var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}
.fc-criteria__item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-body2);
    line-height: var(--font-line-height-body2);
    color: var(--clr-text-secondary);
}
.fc-criteria__item--valid { color: var(--clr-success-main); }

/* "ou" divider + social sign-in buttons */
.fc-divider {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
    margin-top: var(--space-1);
    font-size: var(--font-size-body2);
    line-height: var(--font-line-height-body2);
    color: var(--clr-filae-wistful-grey);
}
.fc-divider::before,
.fc-divider::after { content: ''; flex: 1; height: 1px; background: var(--clr-divider); }
.fc-social { display: flex; flex-wrap: wrap; gap: var(--space-1-5); }
/* content-sized, so the buttons only share a row when both titles fit (they wrap, then stretch, otherwise) */
.fc-social > * { flex: 1 1 auto; }

/* Google and Apple buttons are brand-governed: do not restyle them with fl-btn. Rules below follow
   https://developers.google.com/identity/branding-guidelines and Apple's Sign in with Apple HIG:
   - Google: light theme (#FFFFFF fill, 1px #747775 inside stroke, #1F1F1F text, Google Sans Medium 14/20), standard
     colour "G" untouched, padding 12px / 10px / 12px, wording "Sign in|up with Google" (never just "Google").
   - Apple: black style on a light page (black fill, white logo + title, no custom colours), wording "Sign in|up with Apple",
     title in the system font, min 140x30, margin >= 1/10 of the height. The logo must be the artwork from Apple Design
     Resources (the svg in the templates is "Logo - SIWA - Left-aligned - White - Large.svg", unmodified).
   Shape is free for both (pill here). Hover/pressed states are not specified by either guideline: kept to a light overlay. */
.fc-brand-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 8.75rem;
    min-height: 2.75rem;
    border: 1px solid transparent;
    border-radius: var(--shape-border-radius-pill);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.fc-brand-btn:focus-visible { outline: 2px solid var(--clr-primary-focus-visible); outline-offset: 2px; }
.fc-brand-btn__logo { flex-shrink: 0; }

.fc-brand-btn--google {
    gap: 10px;
    padding: 0 12px;
    background: #ffffff;
    border-color: #747775;
    color: #1f1f1f;
    font: 500 0.875rem/1.25rem 'Google Sans', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
.fc-brand-btn--google .fc-brand-btn__logo { width: 20px; height: 20px; }
.fc-brand-btn--google:hover { background: color-mix(in srgb, #303030 8%, #ffffff); }
.fc-brand-btn--google:active { background: color-mix(in srgb, #303030 12%, #ffffff); }

.fc-brand-btn--apple {
    gap: 0;
    /* logo + title are centred as one group, like the Google button. The title keeps >= 8% of the button width as right
       margin (Apple HIG) and the left inset offsets it: the logo tile already carries ~10px of padding itself. */
    padding: 0 0 0 1rem;
    border: 0;
    overflow: hidden; /* clips the logo file's square black tile to the pill shape */
    background: #000000;
    color: #ffffff;
    font: 500 0.875rem/1.25rem -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif; /* same 14px as Google's fixed size: Apple lets the title font size/weight be adjusted */
}
/* Logo file: used unmodified, its height matches the button height, no vertical padding added */
.fc-brand-btn--apple .fc-brand-btn__logo { width: auto; height: 2.75rem; }
.fc-brand-btn--apple span { padding-right: 1.6rem; }
/* the logo tile is black: a lighter hover background would show it, so fade the whole button instead */
.fc-brand-btn--apple:hover { opacity: 0.85; }
.fc-brand-btn--apple:active { opacity: 0.7; }

/* Registration done */
.fc-done { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; text-align: center; }
.fc-done__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    background: var(--clr-alert-success-background);
    color: var(--clr-success-main);
}
.fc-done__icon .fl-icon-mask { font-size: 2.5rem; }
.fc-done .fc-actions { width: 100%; margin-top: var(--space-1); gap: var(--space-1-5); }

/* helper rows stay out of the layout until a script / the server fills them */
.fc-auth .fl-field__helper:empty { display: none; }
