/* ==========================================================================
   PlanetPVP — phone & tablet layer

   Linked in <head>, so the browser has it before the first paint (loaded
   later, the nav logo flashes at its native 500px for a moment).

   Every selector starts with "html ". The pages carry their own <style>
   blocks inside <body>, which come after this file and would win every tie.
   The extra element gives these rules exactly one notch more specificity:
   enough to beat an equal selector from the page, never enough to beat a
   more specific one. Keep the prefix on any rule added here.

   The desktop look is unchanged above 980px; below that the navigation
   collapses into a menu and every fixed-width block is allowed to stack.

   1. Overflow guards
   2. Navigation
   3. Page frame
   4. Guide & sidebar
   5. Page-specific blocks
   6. Footer & back to top
   ========================================================================== */

/* -------------------------- 1. Overflow guards -------------------------- */
:root {
    -webkit-text-size-adjust: 100%;
}

html body {
    overflow-x: hidden;
}

/* Nothing may push the page wider than the screen. */
html img,
html video,
html iframe,
html canvas {
    max-width: 100%;
}

html iframe {
    width: 100%;
}

/* Below the desktop breakpoint every box measures itself including padding,
   so a "width: 100%" panel with padding can no longer exceed the screen.
   Scoped to small screens on purpose: the desktop layout is built around the
   default content-box sizing and must not shift. */
@media (max-width: 980px) {
    html *,
    html *::before,
    html *::after {
        box-sizing: border-box;
    }

    /* Cards with a desktop min-width would otherwise force a wider page. */
    html .lobby-card-unique,
    html .lobby-card-unique.lobby-card-equal,
    html .start-card,
    html .info-card,
    html .hg-card {
        min-width: 0;
        max-width: 100%;
        width: 100%;
        flex-basis: auto;
    }

    html .lobby-info-cards-unique {
        gap: 1.25rem;
        margin: 1.5rem 0 1rem;
    }

    html .lobby-card-unique {
        padding: 1.2rem 1rem;
        gap: 0.9rem;
    }
}

/* Long IPs, commands and URLs break instead of stretching their box. */
html .command,
html .start-command,
html .apply-note-channel,
html code,
html pre {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* ---------------------------- 2. Navigation ----------------------------- */
html nav#main-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.6rem 1.25rem;
    position: sticky;
    top: 0;
}

html .nav-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    background: none;
}

html .nav-brand:hover {
    background: none;
    transform: none;
    box-shadow: none;
}

html .nav-brand img {
    height: 52px;
    width: auto;
}

html .nav-links {
    display: flex;
    align-items: center;
    flex: 1;
    flex-wrap: wrap;
    gap: 2px;
}

/* Two auto margins split the free space evenly, which centres the link group
   and still parks the Discord button at the right edge. */
html .nav-links > a:first-child {
    margin-left: auto;
}

html .nav-discord {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    background: var(--discord);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
}

html .nav-discord img {
    height: 20px;
}

html .nav-discord:hover {
    background: #4752c4;
}

html .nav-toggle {
    display: none;
    margin-left: auto;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--line-strong);
    color: var(--text-color);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background .2s;
    /* No double-tap-zoom delay, and the tap always lands on the button
       itself rather than on the icon inside it. */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255, 255, 255, .15);
    position: relative;
    z-index: 2;
}

html .nav-toggle > i {
    pointer-events: none;
}

html .nav-toggle:hover {
    background: rgba(255, 255, 255, .12);
    transform: none;
    box-shadow: none;
}

/* Tablet: give the links a little more room before folding them away. */
@media (max-width: 1200px) {
    html nav#main-nav a {
        padding: 0.55rem 0.7rem;
        margin: 0 0.15rem;
        font-size: 0.92rem;
    }

    html .nav-brand img {
        height: 44px;
    }
}

/* Phone & small tablet: collapse into a menu. */
@media (max-width: 980px) {
    html nav#main-nav {
        flex-wrap: wrap;
        padding: 0.5rem 1rem;
    }

    html .nav-toggle {
        display: grid;
        place-items: center;
    }

    html .nav-links {
        display: none;
        order: 3;
        /* flex-basis must win over the desktop "flex: 1", otherwise the menu
           squeezes in beside the logo instead of wrapping onto its own row. */
        flex: 0 0 100%;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 8px 0 4px;
        margin-top: 8px;
        border-top: 1px solid var(--line);
        max-height: calc(100vh - 90px);
        overflow-y: auto;
    }

    html .nav-links.is-open {
        display: flex;
    }

    html nav#main-nav .nav-links a,
    html .nav-links > a:first-child {
        margin: 0;
        padding: 0.8rem 0.9rem;
        font-size: 1rem;
        border-radius: 8px;
        text-align: left;
    }

    html nav#main-nav .nav-links a:hover {
        transform: none;
    }

    html .nav-discord {
        margin-left: 0;
        justify-content: center;
        margin-top: 6px;
    }
}

/* ---------------------------- 3. Page frame ----------------------------- */
@media (max-width: 980px) {
    html header h1 {
        font-size: clamp(1.5rem, 7vw, 2.4rem);
        padding: 0 12px;
        word-break: break-word;
    }

    html main {
        padding: 1.25rem 0;
    }

    html section {
        padding: 1.25rem 1rem;
        margin-bottom: 2rem;
    }

    html h2 {
        font-size: clamp(1.35rem, 5.5vw, 1.9rem);
    }

    html h3 {
        font-size: clamp(1.1rem, 4.5vw, 1.4rem);
    }

    /* Tables scroll inside their own box instead of widening the page. */
    html table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* -------------------------- 4. Guide & sidebar -------------------------- */
@media (max-width: 980px) {
    html .page-layout {
        flex-direction: column;
        gap: 1.25rem;
        padding: 0 1rem;
    }

    /* The area picker turns into a horizontal strip above the content. */
    html .sticky-sidebar {
        position: static;
        width: 100%;
        max-height: none;
        height: auto;
        overflow: visible;
        padding: 1rem;
    }

    html nav.sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        margin-top: 0.8rem;
    }

    html .sidebar-btn {
        /* Grow to fill a row, but a lone chip on the last row stays compact. */
        flex: 1 1 auto;
        max-width: 240px;
        text-align: center;
        padding: 0.55rem 0.75rem;
        font-size: 0.9rem;
    }

    html .sidebar-btn:hover,
    html .sidebar-btn:focus {
        transform: none;
    }

    /* Phones have no hover, so a slot also opens its tooltip when tapped
       (the slots carry tabindex, so a tap gives them focus). */
    html .onevsone-hotbar-click:focus {
        background: rgba(47, 208, 125, .16);
        box-shadow: inset 0 0 0 2px var(--hover-color), 0 0 22px rgba(47, 208, 125, .35);
        outline: none;
        z-index: 3;
    }

    html .onevsone-hotbar-click:focus .onevsone-tooltip {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }

    /* The hotbar tooltips must stay inside the screen. */
    html .onevsone-tooltip {
        min-width: 0;
        width: min(78vw, 300px);
        font-size: 0.82rem;
        padding: 10px 12px;
    }

    /* Keep the outer slots' tooltips from hanging off the edge. */
    html .onevsone-hotbar-click[data-index="0"] .onevsone-tooltip,
    html .onevsone-hotbar-click[data-index="1"] .onevsone-tooltip {
        left: 0;
        transform: translateX(0) translateY(6px);
    }

    html .onevsone-hotbar-click[data-index="0"]:hover .onevsone-tooltip,
    html .onevsone-hotbar-click[data-index="1"]:hover .onevsone-tooltip,
    html .onevsone-hotbar-click[data-index="0"]:focus .onevsone-tooltip,
    html .onevsone-hotbar-click[data-index="1"]:focus .onevsone-tooltip {
        transform: translateX(0) translateY(0);
    }

    html .onevsone-hotbar-click[data-index="7"] .onevsone-tooltip,
    html .onevsone-hotbar-click[data-index="8"] .onevsone-tooltip {
        left: auto;
        right: 0;
        transform: translateX(0) translateY(6px);
    }

    html .onevsone-hotbar-click[data-index="7"]:hover .onevsone-tooltip,
    html .onevsone-hotbar-click[data-index="8"]:hover .onevsone-tooltip,
    html .onevsone-hotbar-click[data-index="7"]:focus .onevsone-tooltip,
    html .onevsone-hotbar-click[data-index="8"]:focus .onevsone-tooltip {
        transform: translateX(0) translateY(0);
    }
}

/* ----------------------- 5. Page-specific blocks ------------------------ */
@media (max-width: 980px) {
    /* Home: shorter hero, and the intro box sits below it (already stacked
       by the page's own 900px rule — this covers the gap up to 980px). */
    html .fullwidth-image {
        height: clamp(220px, 42vh, 380px);
    }

    html .ueber-uns-info-box {
        position: static;
        transform: none;
        min-width: 0;
        max-width: 100%;
        margin: 1.2rem auto 0;
        padding: 1.2rem 1rem;
        left: 0;
        top: 0;
    }

    /* Guide: the start hero has a desktop-only right padding. */
    html .start-hero-right {
        padding-right: 0 !important;
    }

    /* Decorative cut-out character, absolutely placed for wide screens only. */
    html .frei-bild {
        display: none;
    }

    /* Team: cards share the row evenly instead of leaving a ragged edge. */
    html .team-grid {
        justify-content: center;
        gap: 14px;
    }

    html .team-member {
        width: calc(50% - 7px);
        max-width: 220px;
        padding: 16px 12px;
    }

    html .team-member1 {
        width: calc(33.333% - 10px);
        max-width: 140px;
    }

    html .apply-note {
        padding: 1.25rem 1rem;
    }
}

@media (max-width: 560px) {
    html .team-member1 {
        width: calc(50% - 7px);
    }

    /* Roomier tap targets for the two application toggles. */
    html #bewerbung-buttons button,
    html #bewerbung-builder-button-wrapper button {
        width: 100%;
        justify-content: center;
    }

    html .bewerbung-formular > div {
        padding: 16px !important;
    }
}

/* ------------------------ 6. Footer & back to top ------------------------ */
@media (max-width: 980px) {
    html .footer-wrap {
        padding: 0 16px;
    }

    html .site-footer {
        margin-top: 48px;
        padding: 36px 0 24px;
    }
}

@media (max-width: 560px) {
    html .footer-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
        gap: 22px;
    }

    html .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    html .to-top {
        right: 14px;
        bottom: 14px;
        width: 42px;
        height: 42px;
    }
}

/* Touch devices get no hover-only reveals: show the skin on tap/focus too. */
@media (hover: none) {
    html .team-member:focus-within .minecraft-avatar {
        height: 215px;
    }

    html .team-member:focus-within .minecraft-avatar .avatar-img {
        opacity: 0;
    }

    html .team-member:focus-within .minecraft-avatar .hover-skin {
        opacity: 1;
    }
}
