/**
 * Magna AI — public header & footer (clean dark house standard).
 *
 * ══════════════════════════════════════════════════════════════════════════════
 * ★ STANDALONE BY DESIGN. This sheet declares its own `:root` tokens and has NO
 *   dependency on `admin/css/gold-series.css` or `assets/css/aisg-gold-series.css`.
 *   The ADMIN sheet must never load on a public page — that is a recorded fault
 *   (the Gold Series chrome leaking onto a visitor-facing page). The enqueue in
 *   `public/class-public.php` passes `[]` as the dependency list on purpose.
 *
 * ★ CLEAN DARK, NOT GOLD SERIES. No bronze gradient, no "GOLD SERIES" badge, no
 *   sidebar. Gold Series is the ADMIN identity; a public page carries the site's
 *   own clean header — `#0f172a`, 60px, brand | nav | actions on one row.
 *
 * ★ WHY IT WAS MISSING MATTERS (R4-B, 2026-09-30). The enqueue is wrapped in
 *   `file_exists()`, so while this file did not exist the stylesheet was simply
 *   never loaded — no error, no log line, an unstyled site. Third instance of the
 *   "guarded enqueue whose guard is the thing that is wrong" family.
 *
 * Breakpoints: 1024 (tablet) · 768 (mobile) · 480 (small phone).
 * @package AISG
 */

/* ── Tokens. Local to this sheet; no inheritance from the admin palette. ── */
:root {
    --aisg-hf-bg:          #0f172a;
    --aisg-hf-bg-alt:      #0b1220;
    --aisg-hf-border:      rgba(255, 255, 255, 0.10);
    --aisg-hf-text:        #ffffff;
    --aisg-hf-text-dim:    rgba(255, 255, 255, 0.75);
    --aisg-hf-text-faint:  rgba(255, 255, 255, 0.45);
    --aisg-hf-text-ghost:  rgba(255, 255, 255, 0.35);
    --aisg-hf-accent:      #CD853F;
    --aisg-hf-accent-dark: #b8732e;
    --aisg-hf-bar-h:       60px;
    --aisg-hf-radius:      8px;
    --aisg-hf-max:         1200px;
    --aisg-hf-gutter:      24px;
}

/* ── Reset the box model for our own shell only. ── */
.aisg-plugin-page *,
.aisg-plugin-page *::before,
.aisg-plugin-page *::after { box-sizing: border-box; }

.aisg-plugin-page { margin: 0; }

/* ══════════════════════════════════════════════════════════════════
 * LEVEL 1 — HEADER
 * ══════════════════════════════════════════════════════════════════ */
.aisg-site-header {
    background: var(--aisg-hf-bg);
    border-bottom: 1px solid var(--aisg-hf-border);
    position: relative;
    z-index: 100;
}

.aisg-header-inner {
    max-width: var(--aisg-hf-max);
    margin: 0 auto;
    height: var(--aisg-hf-bar-h);
    padding: 0 var(--aisg-hf-gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.aisg-header-left  { display: flex; align-items: center; gap: 32px; min-width: 0; }
.aisg-header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.aisg-header-logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

.aisg-header-brand {
    font-size: 18px;
    font-weight: 600;
    color: var(--aisg-hf-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.aisg-header-menu {
    display: flex;
    gap: 24px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.aisg-header-menu-link {
    color: var(--aisg-hf-text-dim);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.aisg-header-menu-link:hover,
.aisg-header-menu-link:focus { color: var(--aisg-hf-text); }

.aisg-header-menu-item-current .aisg-header-menu-link {
    color: var(--aisg-hf-text);
    font-weight: 600;
}

/* ── Header actions. ★ Specificity reset so an accent-coloured anchor rule
      elsewhere cannot swallow the button text (a recorded house fault). ── */
.aisg-plugin-page a.aisg-header-btn,
.aisg-plugin-page .aisg-header-btn {
    display: inline-block;
    padding: 8px 18px;
    background: var(--aisg-hf-accent);
    color: #fff !important;
    border: 1px solid var(--aisg-hf-accent-dark);
    border-radius: var(--aisg-hf-radius);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.aisg-plugin-page a.aisg-header-btn:hover,
.aisg-plugin-page .aisg-header-btn:hover { background: var(--aisg-hf-accent-dark); }

.aisg-plugin-page a.aisg-header-btn-outline,
.aisg-plugin-page .aisg-header-btn-outline {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.25);
    color: #fff !important;
}

.aisg-plugin-page a.aisg-header-btn-outline:hover,
.aisg-plugin-page .aisg-header-btn-outline:hover { background: rgba(255, 255, 255, 0.08); }

.aisg-plugin-page a.aisg-header-link,
.aisg-plugin-page .aisg-header-link {
    color: var(--aisg-hf-text-dim);
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
}

.aisg-plugin-page a.aisg-header-link:hover { color: var(--aisg-hf-text); }

/* ── Hamburger: hidden until the mobile breakpoint. ── */
.aisg-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 36px;
    padding: 0 8px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--aisg-hf-radius);
    cursor: pointer;
}

.aisg-hamburger-line {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--aisg-hf-text);
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.aisg-hamburger-active .aisg-hamburger-line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.aisg-hamburger-active .aisg-hamburger-line:nth-child(2) { opacity: 0; }
.aisg-hamburger-active .aisg-hamburger-line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ══════════════════════════════════════════════════════════════════
 * LEVELS 2-6 — THE PAGE
 * ══════════════════════════════════════════════════════════════════ */
.aisg-site-content {
    min-height: calc(100vh - (var(--aisg-hf-bar-h) * 2));
    background: var(--aisg-hf-bg-alt);
}

.aisg-page-article { margin: 0; }

/* ══════════════════════════════════════════════════════════════════
 * LEVEL 7 — FOOTER
 * ══════════════════════════════════════════════════════════════════ */
.aisg-site-footer {
    background: var(--aisg-hf-bg);
    border-top: 1px solid var(--aisg-hf-border);
}

.aisg-footer-inner {
    max-width: var(--aisg-hf-max);
    margin: 0 auto;
    min-height: var(--aisg-hf-bar-h);
    padding: 0 var(--aisg-hf-gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.aisg-footer-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.aisg-footer-brand    { font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.70); }
.aisg-footer-divider  { color: var(--aisg-hf-text-ghost); font-size: 12px; }
.aisg-footer-location { font-size: 12px; color: var(--aisg-hf-text-faint); }
.aisg-footer-copy     { font-size: 11px; color: var(--aisg-hf-text-ghost); white-space: nowrap; }

.aisg-footer-links { display: flex; align-items: center; gap: 6px; font-size: 12px; flex-wrap: wrap; }
.aisg-footer-links a { color: rgba(255, 255, 255, 0.50); text-decoration: none; }
.aisg-footer-links a:hover { color: var(--aisg-hf-text); }
.aisg-footer-dot { color: var(--aisg-hf-text-ghost); }

/* ══════════════════════════════════════════════════════════════════
 * BREAKPOINT 1 — ≤1024px (tablet): hamburger on, menu becomes a panel
 * ══════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .aisg-hamburger { display: flex; }

    .aisg-header-nav {
        position: absolute;
        top: var(--aisg-hf-bar-h);
        left: 0;
        right: 0;
        background: var(--aisg-hf-bg);
        border-bottom: 1px solid var(--aisg-hf-border);
        display: none;
        z-index: 99;
    }

    .aisg-header-nav.aisg-nav-open { display: block; }

    .aisg-header-menu {
        flex-direction: column;
        gap: 0;
        padding: 8px 0;
    }

    .aisg-header-menu-item { border-top: 1px solid rgba(255, 255, 255, 0.06); }
    .aisg-header-menu-item:first-child { border-top: 0; }

    .aisg-header-menu-link {
        display: block;
        padding: 12px var(--aisg-hf-gutter);
        font-size: 15px;
    }

    .aisg-footer-inner { flex-direction: column; align-items: flex-start; padding: 14px var(--aisg-hf-gutter); gap: 8px; }
    .aisg-footer-links { justify-content: flex-start; }
}

/* ══════════════════════════════════════════════════════════════════
 * BREAKPOINT 2 — ≤768px (mobile)
 * ══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    :root { --aisg-hf-gutter: 16px; }

    .aisg-header-left  { gap: 16px; }
    .aisg-header-brand { font-size: 16px; max-width: 160px; }
    .aisg-header-right { gap: 8px; }

    .aisg-plugin-page a.aisg-header-btn,
    .aisg-plugin-page .aisg-header-btn { padding: 7px 12px; font-size: 13px; }

    .aisg-header-link { display: none; }   /* logout stays reachable from the dashboard */
}

/* ══════════════════════════════════════════════════════════════════
 * BREAKPOINT 3 — ≤480px (small phone)
 * ══════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    :root { --aisg-hf-gutter: 12px; }

    .aisg-header-brand { display: none; }  /* the logo alone identifies the site */
    .aisg-footer-copy  { white-space: normal; }
    .aisg-footer-left  { gap: 6px; }
}

/* Safe-area insets for notched devices (works with viewport-fit=cover). */
.aisg-site-header .aisg-header-inner { padding-left: max(var(--aisg-hf-gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--aisg-hf-gutter), env(safe-area-inset-right, 0px)); }
.aisg-site-footer .aisg-footer-inner { padding-left: max(var(--aisg-hf-gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--aisg-hf-gutter), env(safe-area-inset-right, 0px)); }
