/* =======================================================
   Layout — Header, navigation, footer
   ======================================================= */

.layout-page-content {
    height: 100%;
    display: grid;
    grid-template-rows: 72px 1fr 56px;
    position: relative;
}

/* ------ HEADER ------ */
.header {
    width: 100%;
    height: 100%;
    padding: 0 clamp(1rem, 4vw, 3rem);
    background: rgba(15, 15, 30, 0.65);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
    flex-direction: row;
    align-items: center;
    position: relative;
    z-index: 100;
    animation: slideDown 0.7s var(--ease-out) both;
}

.header::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    opacity: 0.4;
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.left-header, .right-header,
.left-footer, .right-footer { width: 30%; }

.center-header, .center-footer { width: 40%; }

.left-header, .right-header, .left-footer,
.right-footer, .center-header, .center-footer {
    height: 100%;
    align-items: center;
}

/* --- Logo area --- */
.left-header {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
}

.left-header a {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: color 0.3s var(--ease-out);
    position: relative;
    height: 100%;
}

.left-header a[aria-label] {
    height: 60%;
    aspect-ratio: 192 / 144;
    flex-shrink: 0;
}

.left-header svg {
    height: 100%;
    width: auto;
    fill: var(--fg-color-first);
    transition: transform 0.5s var(--ease-bounce), filter 0.3s var(--ease-out);
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.4));
}

.left-header a:hover svg {
    transform: rotate(-8deg) scale(1.1);
    filter: drop-shadow(0 0 16px rgba(139, 92, 246, 0.8));
}

.left-header a:last-of-type {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    background-size: 200% 200%;
    animation: gradientShift 6s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* --- Navigation menu --- */
.center-header div.menu {
    height: 100%;
    width: 100%;
    justify-content: center;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 2rem);
}

.center-header div.menu a {
    padding: 8px 18px;
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 500;
    color: var(--fg-color-second);
    position: relative;
    border-radius: 10px;
    transition: color 0.35s var(--ease-out);
    overflow: hidden;
    isolation: isolate;
}

.center-header div.menu a::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--gradient-subtle);
    opacity: 0;
    transition: opacity 0.35s var(--ease-out);
    z-index: -1;
    border-radius: inherit;
}

.center-header div.menu a::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 2px;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width 0.4s var(--ease-out), left 0.4s var(--ease-out);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--accent-glow);
}

.center-header div.menu a:hover {
    color: var(--fg-color-first);
}
.center-header div.menu a:hover::before { opacity: 1; }
.center-header div.menu a:hover::after  { width: 60%; left: 20%; }

.center-header div.menu a.active {
    color: var(--fg-color-first);
}

.center-header div.menu a.active::before { opacity: 1; }
.center-header div.menu a.active::after  {
    width: 60%;
    left: 20%;
    box-shadow: 0 0 14px var(--accent-glow);
}

/* --- Mobile menu toggle (hidden on desktop) --- */
.menu-toggle {
    display: none;
    width: 44px; height: 44px;
    background: transparent;
    border: 1px solid var(--border-medium);
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    transition: all 0.3s var(--ease-out);
    margin-left: auto;
}

.menu-toggle:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-glow);
}

.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--fg-color-first);
    border-radius: 2px;
    transition: all 0.35s var(--ease-out);
}

.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ------ IFRAME PAGE ------ */
section {
    position: relative;
    overflow: hidden;
}

.page-iframe {
    height: 100%;
    width: 100%;
    border: 0;
    background: transparent;
    animation: fadeIn 0.7s var(--ease-out) 0.2s both;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* ------ FOOTER ------ */
.footer {
    width: 100%;
    height: 100%;
    padding: 0 clamp(1rem, 4vw, 3rem);
    background: rgba(15, 15, 30, 0.65);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--border-subtle);
    flex-direction: row;
    align-items: center;
    position: relative;
    z-index: 10;
    animation: slideUp 0.7s var(--ease-out) 0.3s both;
}

.footer::before {
    content: "";
    position: absolute;
    left: 0; right: 0; top: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    opacity: 0.4;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.right-footer p {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--fg-color-muted);
    letter-spacing: 0.05em;
}

.right-footer p::before {
    content: "● ";
    color: var(--accent-color);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

/* ------ RESPONSIVE ------ */
@media screen and (max-width: 930px) {
    .layout-page-content {
        grid-template-rows: 64px 1fr 56px;
    }

    .left-footer, .center-footer { display: none; }
    .right-footer               { width: 100%; }

    .left-header  { width: auto; flex: 1; }
    .right-header { display: none; }

    .menu-toggle  { display: flex; }

    /* Menu becomes an overlay panel */
    .center-header {
        position: fixed;
        top: 64px;
        right: 0;
        width: min(320px, 85vw);
        height: calc(100vh - 64px);
        background: rgba(10, 10, 20, 0.92);
        backdrop-filter: blur(30px) saturate(180%);
        -webkit-backdrop-filter: blur(30px) saturate(180%);
        border-left: 1px solid var(--border-medium);
        padding: 2rem 1.5rem;
        transform: translateX(100%);
        transition: transform 0.45s var(--ease-out);
        z-index: 99;
    }

    .center-header.open { transform: translateX(0); }

    .center-header div.menu {
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        gap: 0.5rem;
    }

    .center-header div.menu a {
        padding: 14px 18px;
        text-align: left;
        font-size: 1.05rem;
        border: 1px solid transparent;
    }

    .center-header div.menu a.active {
        border-color: var(--border-medium);
        background: var(--gradient-subtle);
    }

    .center-header div.menu a::after { display: none; }
}
