/*
 * Plettac Vision — Altrad Plettac Mefran identity (spec 05 §2, plan D11).
 * Colours from the APM site (framway "apm" theme); fonts self-hosted (no call to Google).
 */

@font-face { font-family: 'Exo 2'; font-weight: 800; font-display: swap; src: url("../fonts/exo-2-latin-800-normal-SVlDOIO.woff2") format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Exo 2'; font-weight: 800; font-display: swap; src: url("../fonts/exo-2-latin-ext-800-normal-spw8dwv.woff2") format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Open Sans'; font-weight: 400; font-display: swap; src: url("../fonts/open-sans-latin-400-normal-wXCs6kL.woff2") format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Open Sans'; font-weight: 400; font-display: swap; src: url("../fonts/open-sans-latin-ext-400-normal-EXcO85a.woff2") format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Open Sans'; font-weight: 600; font-display: swap; src: url("../fonts/open-sans-latin-600-normal-wHwATTd.woff2") format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Open Sans'; font-weight: 600; font-display: swap; src: url("../fonts/open-sans-latin-ext-600-normal-geoI5A6.woff2") format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
    --red: #E30413;          /* primary: 4.9:1 on white */
    --red-dark: #b8030f;
    --grey-strong: #4B4B4A;  /* body text, secondary text: 8.7:1 */
    --grey-stronger: #424041;/* headings */
    --grey: #a5a3a3;         /* decoration only: 2.5:1, never text */
    --grey-light: #D5D7D7;   /* borders */
    --grey-lighter: #e6e6e6; /* backgrounds */
    --white: #ffffff;
    --green: #2e7d32;
    --font-body: 'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Exo 2', var(--font-body);
    --radius: 4px;
    --width: 1140px;
}

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

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

body {
    margin: 0;
    background: var(--white);
    color: var(--grey-strong);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 800;
    text-transform: uppercase;
    color: var(--grey-stronger);
    line-height: 1.2;
    margin: 0 0 .75em;
}
h1 { font-size: clamp(1.6rem, 4vw, 2.25rem); }
h2 { font-size: clamp(1.2rem, 3vw, 1.5rem); }
h3 { font-size: 1.125rem; }

a { color: var(--red); }
a:hover { color: var(--red-dark); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

img, video { max-width: 100%; height: auto; }

code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .95em; }

.container { width: 100%; max-width: var(--width); margin: 0 auto; padding-inline: 16px; }

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

.skip-link {
    position: absolute; left: 16px; top: -100px; z-index: 100;
    background: var(--red); color: var(--white); padding: .5rem 1rem; border-radius: var(--radius);
}
.skip-link:focus { top: 16px; color: var(--white); }

/* Header -------------------------------------------------------------------------------- */

.site-header, .admin-header {
    border-top: 6px solid var(--red);
    border-bottom: 1px solid var(--grey-light);
    background: var(--white);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 96px; flex-wrap: wrap; }
.logo { display: inline-flex; padding: 12px 0; }
.logo img { width: 180px; height: auto; display: block; }

.main-menu { display: flex; gap: .25rem; }
.main-menu a, .admin-header nav a {
    color: var(--grey-stronger);
    text-decoration: none;
    font-weight: 600;
    padding: .75rem .9rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    border-bottom: 3px solid transparent;
}
.main-menu a:hover { color: var(--red); }
.main-menu a[aria-current="page"] { color: var(--red); border-bottom-color: var(--red); }

.menu-toggle { display: none; }

.header-login {
    display: inline-flex; align-items: center; min-height: 44px; padding: .4rem .8rem;
    font-size: .875rem; color: var(--grey-strong); text-decoration: none;
    border: 1px solid var(--grey-light); border-radius: var(--radius);
}
.header-login:hover { color: var(--red); border-color: var(--red); }

@media (max-width: 767px) {
    .logo img { width: 140px; }
    .header-inner { min-height: 72px; }
    .menu-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 44px; height: 44px; border: 1px solid var(--grey-light); border-radius: var(--radius);
        background: var(--white); cursor: pointer;
    }
    .menu-toggle-bar, .menu-toggle-bar::before, .menu-toggle-bar::after {
        display: block; width: 20px; height: 2px; background: var(--grey-stronger); position: relative; content: '';
    }
    .menu-toggle-bar::before { position: absolute; top: -6px; }
    .menu-toggle-bar::after { position: absolute; top: 6px; }
    /* Logo, then the login link and the burger on the right, then the menu below */
    .header-login { order: 2; margin-left: auto; }
    .menu-toggle { order: 3; }
    .main-menu { order: 4; }
    .main-menu { display: none; flex-direction: column; width: 100%; padding-bottom: .75rem; }
    .main-menu.is-open { display: flex; }
    .main-menu a { border-bottom: 0; border-left: 3px solid transparent; }
    .main-menu a[aria-current="page"] { border-left-color: var(--red); }
}

/* Main and footer ----------------------------------------------------------------------- */

main { flex: 1; padding-top: 2rem; padding-bottom: 3rem; }

.site-footer { background: var(--grey-stronger); color: var(--white); font-size: .875rem; padding: 1.25rem 0; }
.site-footer a { color: var(--white); }

/* Alerts -------------------------------------------------------------------------------- */

.alert { position: relative; padding: .75rem 2.5rem .75rem 1rem; border-radius: var(--radius); margin-bottom: 1.5rem; border-left: 4px solid; }
.alert-success { background: #edf7ee; border-color: var(--green); color: #1b4d1f; }
.alert-error { background: #fdecee; border-color: var(--red); color: #7a0209; }
.alert-close { position: absolute; top: .4rem; right: .5rem; border: 0; background: none; font-size: 1.4rem; line-height: 1; cursor: pointer; color: inherit; min-width: 32px; min-height: 32px; }

/* Buttons and forms --------------------------------------------------------------------- */

.button, button[type="submit"] {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 44px; padding: .6rem 1.25rem;
    background: var(--red); color: var(--white); border: 0; border-radius: var(--radius);
    font: 600 1rem var(--font-body); text-decoration: none; cursor: pointer;
}
.button:hover, button[type="submit"]:hover { background: var(--red-dark); color: var(--white); }
.button.button-small, button[type="submit"].button-small { min-height: 32px; padding: .25rem .75rem; font-size: .875rem; }
.button.button-secondary { background: var(--grey-lighter); color: var(--grey-stronger); }
.button.button-secondary:hover { background: var(--grey-light); color: var(--grey-stronger); }
button.danger { background: var(--white); color: var(--red); border: 1px solid var(--red); }
button.danger:hover { background: var(--red); color: var(--white); }

form .form-row, form > div { margin-bottom: 1.1rem; }
label { display: block; font-weight: 600; color: var(--grey-stronger); margin-bottom: .3rem; }
label:has(input[type="checkbox"]) { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
    width: 100%; max-width: 560px; min-height: 44px; padding: .55rem .75rem;
    border: 1px solid var(--grey-light); border-radius: var(--radius);
    font: 1rem var(--font-body); color: var(--grey-strong); background: var(--white);
}
textarea { max-width: 720px; }
input:focus, select:focus, textarea:focus { border-color: var(--red); outline: 2px solid rgba(227, 4, 19, .2); }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--red); }
.help-text, form small, form .form-text { display: block; color: var(--grey-strong); font-size: .875rem; margin-top: .25rem; }
form ul { list-style: none; padding: 0; margin: .3rem 0; color: #a3020d; font-size: .9rem; }
.form-note, .form-privacy { font-size: .875rem; }
.form-check { display: grid; grid-template-columns: auto 1fr; gap: .1rem .5rem; align-items: center; }
.form-check label { margin: 0; }
.form-check > :nth-child(n+3) { grid-column: 2; margin-top: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Home ---------------------------------------------------------------------------------- */

.hero { display: grid; grid-template-columns: 1fr; gap: 2rem; align-items: center; }
@media (min-width: 900px) { .hero { grid-template-columns: 1.1fr 1fr; } }
.hero-image img { display: block; margin: 0 auto; }

.download-button {
    display: inline-flex; flex-direction: column; align-items: flex-start;
    background: var(--red); color: var(--white); text-decoration: none;
    padding: 1rem 1.75rem; border-radius: var(--radius); margin-top: .5rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.download-button:hover { background: var(--red-dark); color: var(--white); }
.download-title { font-family: var(--font-heading); font-weight: 800; font-size: 1.35rem; text-transform: uppercase; }
.download-subtitle { font-size: .95rem; }
.release-notes { font-size: .9rem; margin-top: .5rem; }

.cards { display: grid; grid-template-columns: 1fr; gap: 1.25rem; margin-top: 3rem; }
@media (min-width: 768px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
    display: block; padding: 1.5rem; border: 1px solid var(--grey-light); border-top: 4px solid var(--red);
    border-radius: var(--radius); text-decoration: none; color: var(--grey-strong); background: var(--white);
}
.card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, .08); color: var(--grey-strong); }
.card h2 { color: var(--red); font-size: 1.15rem; }
.card p { margin: 0; }

/* Videos -------------------------------------------------------------------------------- */

.video-section { margin-bottom: 2.5rem; }
.video-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 768px) { .video-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .video-grid { grid-template-columns: repeat(3, 1fr); } }
.video-card {
    display: flex; flex-direction: column; gap: .4rem; text-decoration: none; color: var(--grey-strong);
    border: 1px solid var(--grey-light); border-radius: var(--radius); overflow: hidden; background: var(--white);
}
.video-card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, .08); color: var(--grey-strong); }
.video-thumbnail { position: relative; display: block; }
.video-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #1f1f1f; display: block; }
.video-play {
    position: absolute; top: 50%; left: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px;
    border-radius: 50%; background: rgba(227, 4, 19, .9); box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
    transition: transform .15s ease;
}
.video-play::after {
    content: ''; position: absolute; top: 50%; left: 50%; margin: -12px 0 0 -7px;
    border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent var(--white);
}
.video-card:hover .video-play, .video-card:focus-visible .video-play { transform: scale(1.1); }

/* Video modal (spec 05 §4.1) */
.video-modal {
    width: min(960px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
    padding: 0; border: 0; border-radius: var(--radius); background: #111; color: var(--white);
    box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
.video-modal::backdrop { background: rgba(0, 0, 0, .75); }
.video-modal-inner { padding: .75rem 1rem 1rem; }
.video-modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.video-modal-title { margin: 0; font-family: var(--font-heading); font-weight: 800; text-transform: uppercase; font-size: 1.1rem; line-height: 1.3; }
.video-modal-close {
    flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; cursor: pointer;
    background: rgba(255, 255, 255, .12); color: var(--white); font-size: 1.75rem; line-height: 1;
}
.video-modal-close:hover { background: var(--red); }
.video-modal-player { width: 100%; max-height: calc(100vh - 180px); background: #000; margin: 0 auto; }
.video-modal-player video { width: 100%; height: 100%; display: block; }
.video-modal-link { margin: .75rem 0 0; font-size: .875rem; }
.video-modal-link a { color: var(--white); }
.video-title { font-weight: 600; padding: 0 1rem; color: var(--grey-stronger); }
.video-duration { font-size: .875rem; padding: 0 1rem 1rem; }
.video-player { width: 100%; margin: 0 0 1.5rem; background: #000; }
.video-player video { width: 100%; height: 100%; display: block; }
.video-nav { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.breadcrumb { margin: 0 0 1rem; font-size: .9rem; }

/* Legal and errors ---------------------------------------------------------------------- */

.legal { max-width: 760px; }
.legal table { margin: 1rem 0 1.5rem; }
.legal th { white-space: normal; }
.error-page { max-width: 640px; padding: 2rem 0; }
.error-page p:last-child { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }

/* Admin --------------------------------------------------------------------------------- */

.admin-header { padding: 0 16px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.admin-header .logo img { width: 140px; }
.admin-header nav { display: flex; flex-wrap: wrap; align-items: center; }
.admin-user { padding: .75rem .9rem; color: var(--grey-strong); }

.page-title { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: 1.25rem; }
.page-title h1 { margin: 0; }
.totals { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1.5rem; margin-bottom: 1rem; }
.search { display: flex; flex: 1 1 400px; gap: 1rem; align-items: flex-end; }
.search-field { min-width: 0; margin: 0; }
.search-field label { margin-bottom: .25rem; }
.search-query { flex: 1 1 200px; max-width: 360px; }
.search-status { flex: 0 1 160px; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin: 0 0 0 auto; }
.bulk { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; font-size: .9rem; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-valid { background: #edf7ee; color: #1b4d1f; }
.badge-expired { background: #fdecee; color: #7a0209; }
.badge-none, .badge-failed { background: var(--grey-lighter); color: var(--grey-stronger); }
.badge-failed { background: var(--red); color: var(--white); margin-left: .3rem; }

table { width: 100%; border-collapse: collapse; font-size: .925rem; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--grey-light); vertical-align: top; }
th { color: var(--grey-stronger); white-space: nowrap; }
th a { color: inherit; text-decoration: none; }
.secondary { font-size: .85rem; color: var(--grey-strong); }
.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1.25rem; }
.registration-info { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0 0 1.5rem; padding: .75rem 1rem; background: var(--grey-lighter); border-radius: var(--radius); }
.registration-info dt { font-weight: 600; }
.registration-info dd { margin: 0; }
.registration-info .badge-none { background: var(--white); }
.danger-zone { margin-top: 2.5rem; padding: 1.25rem 1.5rem; background: var(--red); color: var(--white); border-radius: var(--radius); }
.danger-zone h2 { color: var(--white); margin-bottom: .5rem; }
.danger-zone p { margin: 0 0 1rem; }
.danger-zone button.danger { border-color: var(--white); }
.danger-zone button.danger:hover { background: var(--grey-lighter); color: var(--red-dark); }
.danger-zone :focus-visible { outline-color: var(--white); }

/* Admin tables become cards on mobile (spec 04 §5.3) */
@media (max-width: 767px) {
    .button.button-small, button[type="submit"].button-small { min-height: 44px; }
    .registration-info { grid-template-columns: 1fr; gap: 0; }
    .registration-info dd { margin-bottom: .5rem; }
    .registration-info dd:last-child { margin-bottom: 0; }
    table.registrations thead, table.failed-emails thead { display: none; }
    table.registrations, table.registrations tbody, table.registrations tr, table.registrations td,
    table.failed-emails, table.failed-emails tbody, table.failed-emails tr, table.failed-emails td { display: block; width: 100%; }
    table.registrations tr, table.failed-emails tr {
        border: 1px solid var(--grey-light); border-radius: var(--radius); margin-bottom: 1rem; padding: .5rem .75rem;
    }
    table.registrations td, table.failed-emails td { border: 0; padding: .25rem 0; }
}
