/* ==========================================================================
   NunjaNinja – Haupt-Stylesheet (WCAG 2.2 AA / EN 301 549 / BFSG konform)
   Keine externen Fonts, keine Tracker, volle Tastatur- & Kontrastunterstützung
   ========================================================================== */

:root {
    --bg-deep: #090c14;
    --bg-panel: rgba(13, 18, 30, 0.88);
    --bg-panel-solid: #101624;
    --text-main: #f0f4f8;
    --text-muted: #c2cede;
    --accent-gold: #f3c969;
    --accent-amber: #ff9e44;
    --accent-torii: #ff5e4d;
    --accent-jade: #6bd4b8;
    --border-subtle: rgba(243, 201, 105, 0.3);
    --focus-ring: #ffe066;
    --font-scale: 1;
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: Georgia, "Times New Roman", "Hiragino Mincho ProN", "Yu Mincho", serif;
}

/* Hochkontrast-Modus (über Werkzeugkapsel oder Alt+K zuschaltbar) */
html.high-contrast {
    --bg-deep: #000000;
    --bg-panel: rgba(0, 0, 0, 0.98);
    --bg-panel-solid: #000000;
    --text-main: #ffffff;
    --text-muted: #ffff99;
    --accent-gold: #ffff00;
    --accent-amber: #ffbb00;
    --accent-jade: #00ffcc;
    --border-subtle: #ffff00;
    --focus-ring: #00ffff;
}

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

/* WCAG 2.4.11 (Focus Not Obscured): Schutzabstand oben & unten für fixierte Leisten */
html {
    font-size: calc(16px * var(--font-scale));
    background-color: var(--bg-deep);
    color: var(--text-main);
    scroll-behavior: smooth;
    scroll-padding-top: 5.5rem;
    scroll-padding-bottom: 6.5rem;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans);
    line-height: 1.6;
    background-color: var(--bg-deep);
    color: var(--text-main);
    overflow-x: hidden;
}

/* Screenreader-Hilfsklasse */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip-Link für Tastaturnutzer */
.skip-link {
    position: fixed;
    top: -120px;
    left: 1rem;
    z-index: 2000;
    background: var(--accent-gold);
    color: #000000;
    font-weight: 700;
    padding: 0.7rem 1.15rem;
    min-height: 2.75rem;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #ffffff;
    outline-offset: 2px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.85);
}

/* Globale zweifarbige Fokus-Ringe für maximalen Kontrast auf jedem Grund (WCAG 2.4.7 / 2.4.13) */
:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
    box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.85);
}

#main-content:focus {
    outline: none;
}

/* Darstellung von Tastaturkürzeln (<kbd>) */
kbd {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.84em;
    font-weight: 700;
    line-height: 1.3;
    color: var(--accent-gold);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(243, 201, 105, 0.45);
    border-bottom-width: 2px;
    border-radius: 5px;
    white-space: nowrap;
}

html.high-contrast kbd {
    color: #ffff00;
    background: #000000;
    border: 2px solid #ffff00;
}

/* ==========================================================================
   Schwebende Kompass-Kapsel oben rechts (WCAG 2.5.8 Zielgröße >= 36x36px)
   ========================================================================== */

.floating-tools {
    position: fixed;
    top: 0.85rem;
    right: 0.85rem;
    z-index: 1000;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
}

.a11y-group {
    display: flex;
    align-items: center;
    gap: 0.32rem;
}

.tool-btn,
.tool-select {
    appearance: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    min-height: 2.25rem;
    min-width: 2.25rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.tool-select {
    padding-right: 1.6rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--accent-gold) 50%),
                      linear-gradient(135deg, var(--accent-gold) 50%, transparent 50%);
    background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.tool-select option {
    background: #101624;
    color: #ffffff;
}

.tool-btn:hover,
.tool-select:hover {
    background: rgba(243, 201, 105, 0.18);
    border-color: var(--accent-gold);
}

.tool-btn[aria-pressed="true"] {
    background: var(--accent-gold);
    color: #090c14;
    border-color: var(--accent-gold);
}

.tool-home {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

/* ==========================================================================
   Startseite: Das Berg-Panorama & die eigenständigen Licht-Hotspots
   ========================================================================== */

.page-home {
    background: radial-gradient(circle at 50% 35%, #1a1f36 0%, #090c14 80%);
}

.valley-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0;
}

.panorama-frame {
    position: relative;
    width: 100%;
    max-width: 1920px;
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 3.3rem);
    margin: 0 auto;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.8);
}

.panorama-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    user-select: none;
}

.hotspot {
    position: absolute;
    left: var(--x);
    top: var(--y);
    transform: translate(-50%, -50%);
    width: 5.5rem;
    height: 5.5rem;
    border-radius: 50%;
    text-decoration: none;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    cursor: pointer;
}

.hotspot:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 4px;
    background: rgba(0, 0, 0, 0.45);
}

.signboard {
    position: absolute;
    bottom: calc(100% + 0.45rem);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    min-width: 12.5rem;
    max-width: 16rem;
    padding: 0.55rem 0.9rem;
    background: var(--bg-panel);
    border: 1px solid var(--accent-gold);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75);
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.signboard strong {
    display: block;
    color: var(--accent-gold);
    font-family: var(--font-serif);
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.signboard small {
    display: block;
    color: var(--text-main);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

.hotspot:hover .signboard,
.hotspot:focus-visible .signboard,
html.high-contrast .signboard {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Effekt 1: Segelschiffe --- */
.fx-starlight {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 216, 255, 0.28) 0%, transparent 68%);
}

.fx-starlight i {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 10px 3px #8ecae6, 0 0 18px 5px rgba(243, 201, 105, 0.6);
    animation: twinkleSail 3.6s infinite ease-in-out;
}

.fx-starlight i:nth-child(1) { top: 28%; left: 26%; animation-delay: 0s; }
.fx-starlight i:nth-child(2) { top: 58%; left: 66%; animation-delay: 1.2s; }
.fx-starlight i:nth-child(3) { top: 40%; left: 52%; animation-delay: 2.4s; }

@keyframes twinkleSail {
    0%, 100% { transform: scale(0.55); opacity: 0.35; }
    50% { transform: scale(1.35); opacity: 1; }
}

/* --- Effekt 2: Rotes Torii & Sternenplatz --- */
.fx-lanterns {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 130, 80, 0.26) 0%, transparent 70%);
}

.fx-lanterns i {
    position: absolute;
    bottom: 18%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffd166;
    box-shadow: 0 0 10px 3px #ff7b00;
    animation: floatLantern 4.4s infinite ease-out;
}

.fx-lanterns i:nth-child(1) { left: 28%; animation-delay: 0s; }
.fx-lanterns i:nth-child(2) { left: 50%; animation-delay: 1.1s; }
.fx-lanterns i:nth-child(3) { left: 68%; animation-delay: 2.2s; }
.fx-lanterns i:nth-child(4) { left: 40%; animation-delay: 3.3s; }

@keyframes floatLantern {
    0% { transform: translateY(0) scale(0.7); opacity: 0; }
    25% { opacity: 0.95; }
    100% { transform: translateY(-48px) translateX(6px) scale(0.3); opacity: 0; }
}

/* --- Effekt 3: Pagode --- */
.fx-incense {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 180, 80, 0.34) 0%, rgba(255, 140, 40, 0.08) 55%, transparent 72%);
    animation: pagodaGlow 4.5s infinite ease-in-out;
}

.fx-incense i {
    position: absolute;
    bottom: 24%;
    left: 44%;
    width: 18px;
    height: 36px;
    border-radius: 50%;
    border-left: 2px solid rgba(255, 238, 200, 0.55);
    filter: blur(1.5px);
    animation: steamRise 5s infinite ease-in-out;
}

.fx-incense i:nth-child(2) {
    left: 56%;
    border-left: none;
    border-right: 2px solid rgba(243, 201, 105, 0.5);
    animation-delay: 2.5s;
}

@keyframes pagodaGlow {
    0%, 100% { transform: scale(0.92); opacity: 0.7; }
    50% { transform: scale(1.12); opacity: 1; }
}

@keyframes steamRise {
    0% { transform: translateY(8px) scaleX(0.8); opacity: 0; }
    40% { opacity: 0.85; }
    100% { transform: translateY(-38px) scaleX(1.35); opacity: 0; }
}

/* Ruhemodus bei Systemwunsch oder Klick auf Pause-Button (WCAG 2.2.2 / 2.3.3) */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto !important;
    }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

html.motion-paused {
    scroll-behavior: auto !important;
}

html.motion-paused *,
html.motion-paused *::before,
html.motion-paused *::after {
    animation-play-state: paused !important;
    transition-duration: 0.001ms !important;
}

/* ==========================================================================
   Unterseiten-Layout & SVG-Bühnen
   ========================================================================== */

.subpage-body {
    position: relative;
    min-height: 100vh;
}

.svg-backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.svg-backdrop svg {
    width: 100%;
    height: 100%;
    display: block;
}

.subpage-main {
    position: relative;
    z-index: 10;
    flex: 1;
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 5rem 1.25rem 3.5rem;
}

.dojo-card {
    background: var(--bg-panel);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 1.75rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
}

.page-header {
    text-align: center;
    margin-bottom: 2.2rem;
}

.page-header h1 {
    font-family: var(--font-serif);
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    color: var(--accent-gold);
    margin: 0 0 0.5rem;
}

.page-header p {
    color: var(--text-muted);
    max-width: 640px;
    margin: 0 auto;
}

/* ==========================================================================
   Zentraler Footer (WCAG 2.5.8 konforme Klickflächen >= 32px Höhe)
   ========================================================================== */

.site-footer {
    position: relative;
    z-index: 30;
    background: rgba(7, 10, 18, 0.94);
    border-top: 1px solid var(--border-subtle);
    padding: 0.65rem 1.25rem;
    font-size: 0.88rem;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.footer-nav a {
    color: var(--text-main);
    text-decoration: none;
    min-height: 2rem;
    min-width: 2rem;
    padding: 0.3rem 0.55rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
}

.footer-nav a:hover {
    color: var(--accent-gold);
    text-decoration: underline;
}

.footer-nav .sep {
    color: var(--text-muted);
}

/* Mobil-Optimierung */
@media (max-width: 768px) {
    .floating-tools {
        top: 0.5rem;
        right: 0.5rem;
        left: 0.5rem;
        justify-content: center;
        border-radius: 14px;
    }

    .page-home .valley-stage {
        padding-top: 4.2rem;
    }

    .panorama-frame {
        aspect-ratio: auto;
        min-height: 72vh;
    }

    .signboard {
        opacity: 0.94;
        min-width: 9rem;
        padding: 0.35rem 0.55rem;
    }

    .signboard small {
        display: none;
    }

    .footer-inner {
        justify-content: center;
        text-align: center;
    }
}