/*
 * Public site styles.
 *
 * Color tokens and the layout rhythm come from docs/design-conventions.md,
 * which extracts them from the reference site (infowellmanpower.com) — the
 * palette and shapes are matched, not invented.
 *
 * Self-hosted only: no CDN, no webfont service (docs/dependency-policy.md).
 * Lato and Orbitron are named first in the stacks below so they take effect
 * as soon as the .woff2 files land in /assets/fonts and an @font-face block
 * is added here; until then the system UI font is used rather than linking
 * fonts.googleapis.com, which the CSP would block anyway.
 *
 * The navigation, the header/footer content and the footer's legal line are
 * admin-managed data (Phases 15-17); this file styles whatever the Menus and
 * Appearance screens produce, and knows nothing about what is in it.
 */

:root {
    --color-accent: #FFC107;
    --color-accent-secondary: #0089F7;
    --color-overlay-dark: #090B14;
    --color-bg: #FFFFFF;
    --color-text: #000000;
    --color-text-muted: #626262;
    --color-border: #D9D9D9;
    --color-surface: #F5F5F5;
    --color-header-bg: #000000;
    --color-header-text: #FFFFFF;
    --color-footer-bg: #000000;
    --color-footer-text: #FFFFFF;

    --radius-button: 15px;
    --space: 1rem;
    --container: 72rem;
    --header-height: 90px;

    /*
     * The keyboard focus indicator. Two values, because one ring cannot serve
     * both surfaces: the royal ring is for content on white/#F8FAFC (5.17:1
     * and 4.94:1), the light ring for the dark header, footer and the page
     * bodies' navy gradient panels (17.85:1 on #0F172A, 5.17:1 on #2563EB).
     * Every pairing clears the 3:1 that WCAG asks of a non-text indicator.
     *
     * Not customizable in Appearance, unlike the header/footer colors: an
     * administrator picking a background must not be able to pick a focus
     * ring that vanishes into it.
     */
    --focus-ring: #2563EB;
    --focus-ring-light: #FFFFFF;
    --focus-ring-width: 2px;
    --focus-ring-offset: 2px;
}

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

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

a {
    color: var(--color-accent-secondary);
}

/*
 * Keyboard focus.
 *
 * Before this rule the whole site signalled focus the same way it signalled
 * hover — a colour change, or a heavier font weight — which is focus conveyed
 * by colour alone (docs/security.md is silent here, but Apple's HIG and WCAG
 * 2.4.7 are not: "convey information with more than color alone"). It also
 * failed outright in two places that this design makes common: a .iw-btn is
 * an <a> with a #2563EB fill, so recolouring its label hid the indicator
 * inside the button, and a link on a navy gradient band had no visible state
 * at all.
 *
 * `:focus-visible`, not `:focus`, so a mouse click does not draw a ring the
 * person did not ask for. The `:focus` reset below is deliberate and narrow:
 * it removes the UA's default outline ONLY where we are about to draw our
 * own, never unconditionally.
 *
 * This lives in the stylesheet rather than in page content because `outline`
 * is outside what App\Content\HtmlSanitizer admits — a page body physically
 * cannot express its own focus indicator, so it must inherit one.
 */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
    border-radius: 4px;
}

/*
 * Dark chrome and dark content panels take the light ring instead.
 *
 * The two content selectors are deliberately narrow. `.iw-band` cannot be
 * used: it is a light #F8FAFC surface on the home page and the dark gradient
 * panel on /aboutopfa, so keying off it would put a white ring on a white
 * band. `.iw-cta-band` (home) and `.iw-band-actions` (/aboutopfa) each wrap
 * the only link inside their dark panel and appear nowhere else. `.iw-banner`
 * is the photographic hero of the home page v2 preview (/home-v2), which is
 * dark from edge to edge.
 */
.site-header a:focus-visible,
.site-header button:focus-visible,
.site-header [tabindex]:focus-visible,
.site-footer a:focus-visible,
.site-footer button:focus-visible,
.page-body .iw-cta-band a:focus-visible,
.page-body .iw-band-actions a:focus-visible,
.page-body .iw-banner a:focus-visible {
    outline-color: var(--focus-ring-light);
}

/* Header — logo left, nav right, dark background, full width. */

.site-header {
    background: var(--color-header-bg);
    border-bottom: 1px solid #333;
}

.site-header-inner {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space);
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-height);
}

.site-brand {
    font-family: "Orbitron", "Lato", system-ui, sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-header-text);
    text-decoration: none;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    margin-right: auto;
}

.site-logo {
    display: block;
    max-height: 56px;
    width: auto;
}

/*
 * Main navigation.
 *
 * A node with no destination renders as a <span> rather than an <a> — that is
 * how a section whose own page is not published in this language keeps its
 * sub-items without offering a link that 404s (App\Services\MenuService).
 *
 * The sub-menu is shown on hover AND on keyboard focus inside the item, so it
 * is reachable without a pointer. No JavaScript: nothing here needs it, and
 * the CSP has no 'unsafe-inline' for an inline handler anyway.
 */

.site-nav {
    position: absolute;
    top: var(--header-height);
    left: 0;
    width: 100%;
    background: var(--color-header-bg);
    border-bottom: 1px solid #333;
    display: none;
    z-index: 15;
}

.site-nav.is-open {
    display: block;
}

.site-nav-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav-list > li {
    border-bottom: 1px solid #333;
}

.site-nav-list a,
.site-nav-list span {
    display: block;
    padding: 1rem var(--space);
    color: var(--color-header-text);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    transition: color 0.2s ease;
}

.site-nav-list a:hover,
.site-nav-list a:focus-visible {
    font-weight: 900;
}

.site-nav-lang,
.site-nav-cta {
    padding: 1.5rem var(--space);
    display: flex;
    justify-content: center;
    border-bottom: 1px solid #333;
}

.site-nav-cta .site-cta-link {
    color: var(--color-header-text);
}

.site-nav-list .submenu {
    position: static;
    display: block;
    border: none;
    padding-left: var(--space);
}

.site-header-aside {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.site-header-contact {
    display: flex;
    gap: 0.75rem;
    margin: 0;
    font-size: 0.875rem;
}

.site-header-contact a {
    color: #AAA;
    text-decoration: none;
}

.site-cta {
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
}

.site-cta-link {
    color: var(--color-header-text);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.site-cta-link:hover,
.site-cta-link:focus-visible {
    color: var(--color-accent);
}

.site-nav-toggle {
    display: block;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 20;
}

.hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-header-text);
    position: relative;
    transition: background 0.2s ease;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background: var(--color-header-text);
    left: 0;
    transition: all 0.2s ease;
}

.hamburger::before { top: -8px; }
.hamburger::after { bottom: -8px; }

.site-nav-toggle[aria-expanded="true"] .hamburger {
    background: transparent;
}

.site-nav-toggle[aria-expanded="true"] .hamburger::before {
    top: 0;
    transform: rotate(45deg);
}

.site-nav-toggle[aria-expanded="true"] .hamburger::after {
    bottom: 0;
    transform: rotate(-45deg);
}

.site-language-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.language-switcher ul {
    display: flex;
    gap: 0.5rem;
    margin: 0;
    margin-right: 10px;
    padding: 0.25rem;
    list-style: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.language-switcher a {
    display: block;
    padding: 0.25rem 1rem;
    color: var(--color-header-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    border-radius: 15px;
    transition: all 0.2s ease;
}

.language-switcher a[aria-current="true"] {
    background: var(--color-bg);
    color: var(--color-text);
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.language-switcher a:hover,
.language-switcher a:focus-visible {
     font-weight: bolder;
}

/* Content */

.site-main {
    flex: 1 0 auto;
    /*
     * 100vw counts the scrollbar gutter, so a .full-bleed child below is a few
     * pixels wider than the space actually available and would give the whole
     * page a horizontal scrollbar. `clip` trims that overhang WITHOUT making
     * this a scroll container the way `hidden` would — which matters because a
     * scroll container here would break `position: sticky` for anything inside
     * it. Browsers without `clip` fall back to `visible`: the old behaviour,
     * not a broken one.
     */
    overflow-x: clip;
}

/*
 * The reading column. <main> itself no longer carries .container (so a
 * full-width hero can use the whole viewport if a page ever needs one), which
 * left everything inside it — the title, every paragraph, every image not
 * explicitly marked "full" — flush against the browser edge with no side
 * gutter. This restores that gutter and centers the column at the same width
 * the header and footer already use, so the page reads as one design rather
 * than three independently-aligned pieces.
 */
.page {
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--space);
}

/*
 * The opt-out from that column, for the "full-width hero" the comment above
 * anticipates: a band that has to reach both edges of the viewport.
 *
 * `50%` resolves against .page's own content box, so `calc(50% - 50vw)`
 * cancels the centering AND the padding-inline exactly, at every viewport
 * width, with no hardcoded copy of --space/--container to keep in sync. It
 * needs no `position`, so it stays in normal flow and pushes nothing over
 * anything else.
 *
 * Deliberately three classes deep. Page content may carry `class` and its own
 * <style> block (App\Content\HtmlSanitizer), and those rules are force-scoped
 * to `.page-body`, which caps them at two classes — so a content rule setting
 * `margin` on the same element cannot accidentally cancel this one. Content
 * CANNOT express this itself: the sanitizer's length parser has no calc().
 */
.page .page-body .full-bleed {
    max-width: none;
    margin-inline: calc(50% - 50vw);
}

.page h1 {
    margin: 0 0 1.5rem;
    font-size: 2rem;
    line-height: 1.25;
}

/*
 * Rich content.
 *
 * The page editor (Jodit) submits plain HTML, sanitized once at save time by
 * App\Content\HtmlSanitizer against a short, fixed tag/attribute allowlist —
 * a selector here that matches nothing in that list is a selector for markup
 * this site cannot produce.
 *
 * Alignment/sizing arrive as a `style` attribute (text-align, float, width,
 * height, max-width, margin* only — HtmlSanitizer's CSS.AllowedProperties),
 * not as a class: Jodit has no notion of this project's own class names, so
 * this section styles the plain tags an administrator's formatting produces
 * rather than a bespoke block-alignment system.
 */

.page-featured {
    margin: 0 0 1.5rem;
}

.page-featured img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
}

/*
 * A long unbroken string — an administrator pasting a bare URL is the usual
 * source — otherwise widens the whole page on a phone rather than wrapping.
 *
 * This has to be here rather than in the page's own <style> block: HTMLPurifier
 * models none of `overflow-wrap`, `word-break` or `word-wrap`, and
 * App\Content\HtmlSanitizer does not hand-define them, so content CSS cannot
 * express it at all. `break-word` rather than `anywhere` so ordinary prose is
 * unaffected and only a word with nowhere else to break is split.
 */
.page-body {
    overflow-wrap: break-word;
}

.page-body > * {
    max-width: 44rem;
}

.page-body p {
    margin: 0 0 1.25rem;
}

/* The opening paragraph reads as the page's lead-in rather than blending
   into the rest of the body copy — a common weight/size step used for the
   introductory sentence of a marketing page. */
.page-body > p:first-child {
    font-size: 1.125rem;
    line-height: 1.65;
    color: #333333;
}

.page-body h2,
.page-body h3,
.page-body h4 {
    margin: 2.5rem 0 0.75rem;
    line-height: 1.3;
    clear: both;
}

.page-body h2 {
    font-size: 1.625rem;
    padding-bottom: 0.5rem;
    display: inline-block;
}

.page-body h3 {
    font-size: 1.1875rem;
}

.page-body h4 {
    font-size: 1rem;
}

.page-body ul,
.page-body ol {
    margin: 0 0 1.25rem;
    padding-left: 1.5rem;
}

.page-body li {
    margin-bottom: 0.375rem;
}

.page-body blockquote {
    margin: 0 0 1.25rem;
    padding-left: 1.25rem;
    color: var(--color-text-muted);
}

.page-body blockquote p:last-child {
    margin-bottom: 0;
}

.page-body a {
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.page-body a:hover,
.page-body a:focus-visible {
    color: var(--color-accent-secondary);
}

.page-body hr {
    width: 4rem;
    max-width: 4rem;
    height: 3px;
    margin: 2.5rem 0;
    border: 0;
}

/* A plain <img> — an administrator's `style="float:left"` etc. (allowed by
   HtmlSanitizer) is what actually positions it; this is only the default
   appearance and the clearfix a float needs. */
.page-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 0 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.page-body figcaption {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.page-body::after {
    content: "";
    display: table;
    clear: both;
}

/* Below this width a floated image no longer has room to sit beside text. */
@media (max-width: 40rem) {
    .page-body img {
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/*
 * The fallback size for an embed that carries no `.iw-*` sizing class.
 *
 * An embed inserted from the editor's Embed button gets src/title/loading/
 * sandbox and nothing else (buildIframe(), public/assets/js/content-editor-v2.js),
 * and HtmlSanitizer's allowlist drops the width/height attributes off any
 * embed code pasted into Source view. So unless the page's own CSS block
 * defines a class for it — `.iw-embed`, `.iw-map` and `.iw-fb` exist only in
 * the seeded page CSS — the frame arrives with no width and no height at all,
 * and an iframe with neither falls back to the CSS default size for a replaced
 * element: 300x150, regardless of how wide its container is. `max-width: 100%`
 * cannot correct that, because 300px is already under the limit.
 *
 * 16/9 because video is the common case; a map or a Facebook plugin wants its
 * own shape and says so through the class it is given, or through an inline
 * `aspect-ratio` (an allowed property), both of which outrank this rule.
 */
.page-body iframe {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0 0 1.5rem;
    border: 0;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/*
 * The tab strip buildTabs() (public/assets/js/sitev2.js) builds inside page
 * content — the two declarations its own page CSS cannot carry.
 *
 * `cursor` is one of the properties App\Content\HtmlSanitizer silently drops
 * (see database/seeds/pages/interior.css), and a `<button>` does not inherit
 * the page's font family from the UA stylesheet, while `font-family: inherit`
 * inside a content <style> block is not something HTMLPurifier's font-family
 * validator accepts. Everything else about these buttons — the tray, the
 * selected gradient, the sizing — is page CSS, in the "Tabs" section of
 * database/seeds/pages/interior.css. The focus ring
 * needs nothing here: the `button:focus-visible` rule at the top of this file
 * already covers them.
 */
.page-body .iw-tab-btn {
    font-family: inherit;
    cursor: pointer;
}

/* A wide table scrolls horizontally in place rather than widening the page —
   there is no wrapper element to scroll instead, since Jodit emits a plain
   <table> with nothing around it. */
.page-body table {
    display: block;
    max-width: 100%;
    margin: 0 0 1.5rem;
    overflow-x: auto;
    border-collapse: collapse;
}

.page-body th,
.page-body td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: top;
    border: 1px solid var(--color-border);
}

.page-body th {
    background: var(--color-surface);
    font-weight: 700;
}

/*
 * The admin preview banner. Never shown on a public request — SiteView only
 * receives a notice from PageAdminController::preview.
 */
.site-notice {
    margin: 0;
    padding: 0.625rem 1rem;
    text-align: center;
    background: var(--color-accent);
    font-size: 0.9375rem;
}

/* Footer — navigation repeated, contact details, and legal line. */

.site-footer {
    padding: 3rem 0;
    background: var(--color-footer-bg);
    color: var(--color-footer-text);
    font-size: 0.9375rem;
}

.site-footer p {
    margin: 0 0 0.5rem;
}

.site-footer-inner {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 3rem;
    align-items: flex-start;
}

.site-footer-column {
    flex: 0 1 auto;
}

@media (max-width: 40rem) {
    .site-footer-inner {
        flex-direction: column;
        text-align: start;
        gap: 2rem;
    }
}

.site-footer-nav {
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-social {
    margin: 0 auto;
    padding: 0;
    list-style: none;
    display: flex;
    justify-content: center;
    gap: var(--space);
    flex-wrap: wrap;
}

.site-footer-social {
    margin-top: var(--space);
}

.site-footer-nav a,
.site-social a {
    color: var(--color-footer-text);
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    transition: color 0.2s ease;
}

.site-footer-nav a:hover,
.site-footer-nav a:focus-visible,
.site-social a:hover,
.site-social a:focus-visible {
    font-weight: 900;
}

.site-footer-nav .submenu {
    margin: 0.25rem 0 0.5rem 1rem;
    padding: 0;
    list-style: none;
}

.site-footer-contact {
    text-align: left;
}

.site-footer-company {
    font-weight: 700;
    color: var(--color-footer-text);
    margin-bottom: 0.5rem;
}

.site-footer-contact p {
    margin: 0 0 0.25rem;
}

.site-footer-contact a {
    color: var(--color-footer-text);
    text-decoration: none;
}

.site-footer-copyright {
    padding-top: 1.5rem;
    margin-top: 3rem;
    border-top: 1px solid var(--color-footer-text);
    font-size: 0.875rem;
    text-align: center;
}

/* Buttons — "stroke button": 1px border, 15px radius, tracked label. */

.button {
    display: inline-block;
    padding: 0.625rem 1.5rem;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: transparent;
    border: 1px solid var(--color-text);
    border-radius: var(--radius-button);
}

.button-primary {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

/* 40rem fits a phone-vs-everything-else split everywhere else in this file,
   but the horizontal nav needs more room than that: five menu items plus the
   logo and language switcher only sit on one line cleanly from ~64rem up,
   so the toggle/dropdown nav (already correct for phones) is kept through
   the tablet range too rather than switching to a row that wraps. */
@media (min-width: 64rem) {
    .site-nav-toggle {
        display: none;
    }

    .site-nav {
        position: static;
        display: flex;
        align-items: center;
        background: transparent;
        border-bottom: none;
        width: auto;
        z-index: auto;
    }

    .site-nav-list {
        flex-direction: row;
        gap: var(--space);
    }

    .site-nav-list > li {
        border-bottom: none;
    }

    .site-nav-list a,
    .site-nav-list span {
        padding: 0;
        color: var(--color-header-text);
    }

    .site-nav-lang {
        display: none;
    }

    .site-header-lang {
        display: block;
    }
}

@media (max-width: 64rem) {
    .site-header-lang {
        display: none;
    }

    .site-nav-lang {
        display: flex;
        justify-content: center;
    }
}

@media (max-width: 40rem) {
    :root {
        --header-height: 64px;
    }

    .site-logo {
        max-height: 40px;
    }

    .page h1 {
        font-size: 1.5rem;
    }
}
