/* ---- App Header ---- */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--kw-space-3) var(--kw-page-padding);
    border-bottom: 1px solid var(--kw-border);
    background: var(--kw-surface-2);
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--kw-text);
}

    .app-logo:hover {
        text-decoration: none;
    }

.app-logo-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.app-logo-text {
    font-size: 15px;
    font-weight: 500;
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

    .app-nav a {
        font-size: 13px;
        color: var(--kw-text-secondary);
        text-decoration: none;
        transition: color 0.15s;
    }

        .app-nav a:hover {
            color: var(--kw-text);
            text-decoration: none;
        }

        .app-nav a.active {
            color: var(--kw-brand);
            font-weight: 500;
        }

.theme-toggle {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0;
    color: var(--kw-text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.theme-toggle:hover {
    color: var(--kw-text);
    background: var(--kw-surface-1);
    border-color: var(--kw-border);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--kw-brand);
    outline-offset: 2px;
}

.theme-toggle-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-toggle-icon--sun {
    display: none;
}

[data-theme="dark"] .theme-toggle-icon--moon {
    display: none;
}

[data-theme="dark"] .theme-toggle-icon--sun {
    display: block;
}

/* ---- App Footer ---- */

.app-footer {
    background-image: var(--kw-footer-gif-right), var(--kw-footer-gif-left);
    background-repeat: no-repeat, repeat-x;
    background-position: top right, right 700px top 0;
    padding: 130px var(--kw-page-padding) var(--kw-space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    flex-shrink: 0;
}

.app-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
}

    .app-footer-links a {
        font-size: 12px;
        color: var(--kw-text-muted);
        text-decoration: none;
    }

        .app-footer-links a:hover {
            color: var(--kw-text-secondary);
        }

.app-footer-copy {
    font-size: 11px;
    color: var(--kw-text-muted);
}

.app-footer-build {
    font-size: 12px;
    color: var(--kw-text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    opacity: 0.7;
}

@media (max-width: 580px) {
    .app-footer {
        flex-direction: column;
        align-items: flex-start;
        padding-top: 16px;
    }

    .app-footer-links {
        flex-direction: column;
        gap: 8px;
    }
}

/* ---- Content area ---- */

.app-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--kw-page-padding);
    max-width: var(--kw-content-default);
    margin: 0 auto;
    width: 100%;
}

.app-body-content {
    flex: 1;
}

.app-body--narrow {
    max-width: var(--kw-content-narrow);
}

.app-body--wide {
    max-width: var(--kw-content-wide);
}


/* ---- Mobile burger ---- */

.burger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--kw-text);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
/* ---- Responsive ---- */

@media (max-width: 768px) {
    .burger-btn {
        display: block;
    }

    .app-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--kw-bg);
        border-bottom: 1px solid var(--kw-border);
        box-shadow: var(--kw-shadow-md);
        padding: 8px 0;
        z-index: 20;
    }

    .app-header-actions {
        gap: 4px;
    }

    .theme-toggle,
    .burger-btn {
        width: 40px;
        height: 40px;
    }

        .app-nav.open {
            display: flex;
        }

        .app-nav a {
            padding: 12px 24px;
            font-size: 15px;
            width: 100%;
        }

    .app-body {
        padding: var(--kw-page-padding-mobile);
    }

    .kb-cta {
        grid-template-columns: 1fr;
    }

    .fish-grid {
        grid-template-columns: 1fr;
    }

    .detail-layout {
        grid-template-columns: 1fr;
    }

    .detail-info-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .atlas-top {
        flex-direction: column;
        align-items: stretch;
    }

    .atlas-search {
        min-width: unset;
    }
}
