/*
 * Registration pages. Allnet colours from www.allnet-italia.it; form inputs
 * follow the Allnet Academy form. Wifidom colours are provisional (TBD-12).
 * No inline styles anywhere: the CSP allows stylesheets and fonts from 'self' only.
 */

/* Poppins, self-hosted (SIL Open Font License, see /assets/fonts/OFL.txt) */
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/poppins-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/poppins-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('/assets/fonts/poppins-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/fonts/poppins-latin-700-normal.woff2') format('woff2'); }

:root {
    --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-size: clamp(14px, 0.875rem + ((1vw - 3.2px) * 0.172), 16px);
    --base: #ffffff;
    --neutral: #f4f4f4;
    --field-background: #f9f9f9;
    --field-border: #cccccc;
    --muted: #5b6073;
    --error: #b00020;
    --error-background: #fff5f5;
    --notice: #fff4ce;
    --radius: 8px;
    --container: 68rem;
}

.brand-allnet {
    --primary: #0063AF;
    --primary-dark: #004f8c;
    --contrast: #1a1f3b;
    --focus-ring: rgba(13, 110, 253, 0.2);
    --footer-background: var(--contrast);
    --intro-image: url('/assets/img/bg_allnet.webp');
}

.brand-wifidom {
    --primary: #00857c;
    --primary-dark: #006a63;
    --contrast: #10302d;
    --focus-ring: rgba(0, 133, 124, 0.2);
    --footer-background: #1a1f3b; /* same as the Allnet --contrast */
    --intro-image: url('/assets/img/bg_wifidom.png');
}

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

/* Sticky footer: on short pages the footer still closes the viewport */
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: var(--font-size);
    line-height: 1.55;
    color: var(--contrast);
    background: var(--neutral);
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1.25rem;
}

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus {
    left: 1rem;
    top: 1rem;
    z-index: 10;
    padding: .5rem 1rem;
    background: var(--base);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
}

/* Header */
.site-header {
    background: var(--base);
    border-bottom: 1px solid #e3e5ea;
}
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4.5rem;
}
.brand-logo img { display: block; width: 150px; height: auto; }
.brand-wifidom .brand-logo img { width: 110px; }
.brand-logo--text { font-weight: 700; font-size: 1.25rem; color: var(--contrast); text-decoration: none; }
.site-title { margin: 0; font-weight: 500; color: var(--muted); font-size: .9rem; }
.site-title:has(+ .lang-switch) { margin-left: auto; }
.lang-switch { display: flex; align-items: center; gap: .4rem; font-size: .9rem; font-weight: 500; }
.lang-switch a { color: var(--muted); text-decoration: none; padding: .25rem; }
.lang-switch a:hover, .lang-switch a:focus-visible { color: var(--contrast); text-decoration: underline; }
.lang-switch [aria-current] { color: var(--contrast); font-weight: 700; padding: .25rem; }
.lang-switch__sep { color: #c4c8d0; }
@media (max-width: 30rem) { .site-title { display: none; } }

/* "Become a partner" intro */
.intro {
    /* --contrast stays as fallback while the image loads */
    background: var(--contrast) var(--intro-image) right center / cover no-repeat;
    color: var(--base);
    padding: 2rem 0 5rem;
}
.intro__title {
    margin: 0 0 .5rem;
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.25rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.intro__text { margin: 0; max-width: 52rem; opacity: .92; }

/* Form card, pulled up over the intro band */
main {
    max-width: var(--container);
    margin: 2rem auto 0;
    padding: 1.75rem 1.75rem 2rem;
    background: var(--base);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(26, 31, 59, .08);
    position: relative;
    width: 100%;
}
.intro + main { margin-top: -3.5rem; }
.card-title { margin: 0 0 .25rem; font-size: 1.25rem; font-weight: 600; }
h1 { margin-top: 0; font-size: 1.5rem; font-weight: 600; }

/* 12-column grid: fields share rows on wide screens, stack on phones */
.grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: .25rem 1rem;
}
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

fieldset {
    border: 0;
    border-top: 1px solid #e3e5ea;
    margin: 0;
    padding: 1rem 0 .25rem;
    min-width: 0;
}
legend {
    padding: 0 .5rem 0 0;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    font-size: .8rem;
    letter-spacing: .06em;
}

/* Fields (as in the Allnet Academy form) */
.field { margin-bottom: .75rem; min-width: 0; }
.field label {
    display: block;
    margin-bottom: .3rem;
    font-weight: 500;
    font-size: .9rem;
}
.req { color: var(--error); }
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field select,
.field textarea {
    width: 100%;
    padding: .6rem .8rem;
    font: inherit;
    font-size: var(--font-size);
    color: var(--contrast);
    border: 1px solid var(--field-border);
    border-radius: var(--radius);
    background: var(--field-background);
    transition: border-color .3s ease, box-shadow .3s ease;
}
.field textarea { resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--focus-ring);
    outline: none;
}
.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
    border-color: var(--error);
    box-shadow: 0 0 0 2px rgba(176, 0, 32, .2);
    background: var(--error-background);
}

.field--checkbox { display: flex; gap: .6rem; align-items: flex-start; flex-wrap: wrap; }
.field--checkbox input { width: 1.1rem; height: 1.1rem; margin-top: .2rem; accent-color: var(--primary); }
.field--checkbox label { flex: 1; display: inline; font-weight: 400; margin: 0; }
.field--checkbox .error { flex-basis: 100%; }

.error { color: var(--error); margin: .25rem 0 0; font-size: .8rem; }
.hint { color: var(--muted); font-size: .85rem; margin: .25rem 0 .75rem; }
.error-summary, .notice {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    margin: 0 0 1rem;
}
.error-summary { border: 1px solid var(--error); background: var(--error-background); color: var(--error); font-weight: 500; }
.notice { background: var(--notice); }

/* Step 2: country and tax id from Step 1 */
.summary-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1.5rem;
    margin: .75rem 0 1rem;
    padding: .75rem 1rem;
    background: var(--neutral);
    border-radius: var(--radius);
    font-size: .9rem;
}
.summary { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: 0; }
.summary dt { font-weight: 600; }
.summary dt::after { content: ':'; }
.summary dd { margin: 0; }

/* Actions */
.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: .5rem;
}
.form-actions--end { justify-content: flex-end; }
.captcha-status { min-height: 1.5em; margin: 0; }

button, .button {
    display: inline-block;
    text-decoration: none;
    font: inherit;
    font-weight: 600;
    color: var(--base);
    background: var(--primary);
    border: 0;
    border-radius: 9999px;
    padding: calc(.667em + 2px) calc(1.8em + 2px);
    cursor: pointer;
    transition: background-color .2s ease;
}
button:hover, .button:hover { background: var(--primary-dark); color: var(--base); }
button:focus-visible, a:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Registration support */
.support {
    max-width: var(--container);
    margin: 1.5rem auto 0;
    padding: 1.25rem 1.75rem;
    background: var(--base);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    width: 100%;
}
.support h2 { margin: 0 0 .4rem; font-size: 1rem; font-weight: 600; }
.support p { margin: .15rem 0; font-size: .9rem; }

/* Footer */
.site-footer {
    margin-top: auto;
    padding: 1.5rem 0;
    background: var(--footer-background);
    color: rgba(255, 255, 255, .8);
    font-size: .8rem;
}
.site-footer p { margin: 0; }
/* Space between the last block (form card, or the support box after it) and the footer.
   Explicit selectors: scripts (e.g. the captcha) may append elements after the footer. */
main, .support { margin-bottom: 5rem; }
main:has(+ .support) { margin-bottom: 0; }

@media (max-width: 48rem) {
    .grid { grid-template-columns: 1fr; }
    [class*="span-"] { grid-column: 1 / -1; }
    main { margin: 1.25rem .75rem 0; padding: 1.25rem; width: auto; }
    .intro + main { margin-top: -3.5rem; }
    .support { margin: 1.5rem .75rem 0; width: auto; }
    main, .support { margin-bottom: 3.5rem; }
    main:has(+ .support) { margin-bottom: 0; }
    .site-title { display: none; }
    .form-actions, .form-actions--end { justify-content: stretch; }
    button, .button { width: 100%; text-align: center; }
}
