/* ==========================================================================
   Responsive Matrix - Alg0rithm
   Covers: index, docs, lap, entrnet, 404
   Strategy: width + height + orientation + input modality
   ========================================================================== */

/* ------------------------------
   1) Core Safety Layer
   ------------------------------ */
html {
    width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

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

img,
svg,
video,
canvas,
iframe {
    max-width: 100%;
    height: auto;
}

pre,
code {
    max-width: 100%;
    overflow-x: auto;
}

/* iOS safe area support */
body {
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}

/* ------------------------------
   2) Shared Interactive Elements
   ------------------------------ */
.custom-burger {
    border: none !important;
    box-shadow: none !important;
    background: transparent;
}

.custom-burger i {
    color: #333;
    font-size: 1.5rem;
}

.dark-mode-toggle {
    z-index: 3000;
}

/* Touch optimization */
@media (hover: none) and (pointer: coarse) {
    .dark-mode-toggle,
    .btn,
    .bin-main,
    .contact-btn,
    .back,
    .navbar-toggler {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ------------------------------
   3) Desktop and Large Tablets
   ------------------------------ */
@media (min-width: 1200px) and (min-height: 800px) {
    #headerContent {
        display: flex !important;
        flex-basis: auto;
    }

    .custom-nav-list {
        gap: 1.25rem !important;
    }

    .contenr-main {
        margin-top: 140px !important;
    }

    .detales-main {
        width: min(620px, 90vw) !important;
    }

    .detales-about {
        width: min(680px, 90vw) !important;
        height: auto !important;
    }

    .footer-content {
        max-width: 1200px;
    }
}

@media (min-width: 992px) and (max-width: 1199.98px) and (min-height: 700px) {
    #headerContent {
        display: flex !important;
        flex-basis: auto;
    }

    .logo {
        font-size: 1.9rem !important;
    }

    .detales-main {
        width: min(560px, 88vw) !important;
    }

    .detales-about {
        width: min(620px, 88vw) !important;
        height: auto !important;
    }

    textarea {
        width: 100% !important;
    }
}

/* ------------------------------
   4) Generic Tablet Range
   ------------------------------ */
@media (min-width: 768px) and (max-width: 991.98px) {
    #headerContent.show {
        display: block !important;
        width: 100%;
        flex-basis: 100% !important;
        order: 3;
    }

    #header {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 10px 14px !important;
        gap: 12px !important;
    }

    #header .logo {
        order: 1;
        margin: 0 !important;
        font-size: 1.7rem !important;
        line-height: 1.2;
        text-align: left !important;
    }

    #header .navbar-toggler {
        order: 2;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin-left: auto !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    #headerContent:not(.show) {
        display: none !important;
    }

    #headerContent.show {
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border, rgba(0, 0, 0, 0.1));
    }

    #headerContent nav {
        width: 100%;
        margin-top: 0 !important;
    }

    #headerContent .custom-nav-list {
        width: 100%;
        align-items: flex-start !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .custom-nav-list {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px !important;
        padding: 0;
    }

    .contenr-main,
    .contenr-about {
        margin-left: 24px !important;
        margin-right: 24px !important;
    }

    .detales-main,
    .detales-about,
    .status {
        width: 100% !important;
        max-width: 100%;
    }

    .detales-about {
        height: auto !important;
    }

    .titel-about {
        margin-left: 0 !important;
    }

    textarea {
        width: 100% !important;
    }

    section {
        min-height: 100vh !important;
    }
}

/* ------------------------------
   5) Docs Page - Matrix
   ------------------------------ */
@media (max-width: 1199.98px) {
    pre,
    p {
        width: 100% !important;
        max-width: 100%;
    }
}

@media (max-width: 991.98px) {
    .d-flex {
        flex-direction: column !important;
    }

    .sidebar,
    .sidebar.p-3 {
        width: 100% !important;
        position: relative !important;
        top: auto !important;
        height: auto !important;
        max-height: 42vh;
        overflow-y: auto;
        border-right: 0 !important;
        border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.1));
    }

    #app {
        width: 100% !important;
        height: auto !important;
        min-height: 58vh;
        padding: 18px 14px !important;
    }
}

@media (max-width: 768px) and (min-height: 900px) {
    .sidebar,
    .sidebar.p-3 {
        max-height: 35vh;
    }

    #app {
        min-height: 65vh;
    }
}

@media (max-width: 768px) and (max-height: 780px) {
    .sidebar,
    .sidebar.p-3 {
        max-height: 45vh;
    }

    #app {
        min-height: 55vh;
    }
}

@media (max-width: 600px) {
    #app {
        padding: 14px 12px !important;
    }

    .accordion-button {
        font-size: 0.95rem !important;
    }

    .sidebar a {
        font-size: 0.94rem;
    }
}

@media (max-width: 430px) {
    #app {
        padding: 12px 10px !important;
    }

    .sidebar,
    .sidebar.p-3 {
        max-height: 47vh;
    }
}

@media (max-width: 390px) {
    .sidebar a {
        font-size: 0.9rem;
    }

    .accordion-button {
        font-size: 0.9rem !important;
    }
}

@media (max-height: 700px) and (max-width: 1024px) {
    .sidebar,
    .sidebar.p-3 {
        max-height: 50vh;
    }
}

/* ------------------------------
   6) Home Page - Matrix
   ------------------------------ */
@media (max-width: 767.98px) {
    section {
        min-height: auto !important;
    }

    .detales-main,
    .detales-about {
        width: 100% !important;
        max-width: 100%;
    }

    .detales-about {
        height: auto !important;
    }

    .status {
        width: 100% !important;
        max-width: 100%;
    }

    textarea {
        width: 100% !important;
    }
}

@media (max-width: 912px) and (min-height: 1000px) {
    .contenr-main {
        margin: 120px 20px 48px !important;
    }

    .contenr-about {
        margin: 100px 20px 48px !important;
    }

    .contact {
        padding: 56px 18px !important;
    }
}

@media (max-width: 853px) and (max-height: 430px) and (orientation: landscape) {
    .dark-mode-toggle {
        bottom: 10px;
        right: 10px;
        top: auto !important;
    }

    .contenr-main {
        margin-top: 74px !important;
    }

    .titel-main {
        font-size: 1.45rem !important;
    }

    .detales-main {
        font-size: 0.98rem !important;
    }
}

@media (max-width: 820px) {
    .logo {
        font-size: 1.7rem !important;
    }

    .titel-main,
    .titel-about {
        font-size: 1.6rem !important;
    }

    .detales-main,
    .detales-about {
        font-size: 1.05rem !important;
    }

    .dark-mode-toggle {
        top: auto;
        bottom: 14px;
        right: 14px;
    }
}

@media (max-width: 768px) and (min-height: 900px) {
    .contenr-main {
        margin: 96px 14px 42px !important;
    }

    .contenr-about {
        margin: 72px 14px 40px !important;
    }

    .contact {
        padding: 44px 14px !important;
    }
}

@media (max-width: 768px) and (max-height: 740px) {
    header {
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }

    .logo {
        font-size: 1.5rem !important;
    }

    .contenr-main {
        margin-top: 68px !important;
    }
}

@media (max-width: 600px) {
    .contenr-main {
        margin: 90px 14px 48px !important;
    }

    .contenr-about {
        margin-top: 70px !important;
    }

    .contact {
        padding: 40px 14px !important;
    }

    .footer {
        padding: 30px 14px 18px !important;
    }

    .footer-content {
        gap: 18px !important;
    }

    .footer-bottom p {
        font-size: 0.82rem !important;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.5rem !important;
    }

    .titel-main,
    .titel-about,
    .titel-contact {
        font-size: 1.42rem !important;
    }

    .detales-main,
    .detales-about {
        font-size: 0.98rem !important;
    }
}

@media (max-width: 430px) {
    .contact {
        padding: 36px 12px !important;
    }

    #contact-form {
        padding: 18px 14px !important;
    }

    .status {
        font-size: 0.82rem !important;
    }
}

@media (max-width: 414px) and (min-height: 850px) {
    .contenr-main {
        margin-top: 96px !important;
    }

    .dark-mode-toggle {
        bottom: 16px;
    }
}

@media (max-width: 412px) and (max-height: 915px) {
    .titel-main {
        font-size: 1.35rem !important;
    }
}

@media (max-width: 393px) and (min-height: 780px) {
    .logo {
        font-size: 1.42rem !important;
    }

    .detales-main {
        line-height: 1.55;
    }
}

@media (max-width: 390px) {
    .logo {
        font-size: 1.45rem !important;
    }

    .titel-main,
    .titel-about,
    .titel-contact {
        font-size: 1.35rem !important;
    }

    .bin-main,
    .contact-btn,
    .back,
    .btn {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 384px) and (max-height: 854px) {
    .contenr-main {
        margin-top: 86px !important;
    }

    .contact {
        padding: 34px 10px !important;
    }
}

@media (max-width: 375px) {
    .detales-main,
    .detales-about {
        font-size: 0.95rem !important;
    }

    .footer {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
}

@media (max-width: 360px) {
    .logo {
        font-size: 1.32rem !important;
    }

    .titel-main,
    .titel-about,
    .titel-contact {
        font-size: 1.25rem !important;
    }

    #contact-form {
        padding: 16px 10px !important;
    }
}

@media (max-width: 344px) {
    .contenr-main,
    .contenr-about {
        margin-left: 10px !important;
        margin-right: 10px !important;
    }

    .detales-main,
    .detales-about {
        font-size: 0.9rem !important;
    }

    .footer-logo {
        font-size: 1.25rem !important;
    }
}

@media (max-width: 320px) {
    .logo {
        font-size: 1.2rem !important;
    }

    .titel-main,
    .titel-about,
    .titel-contact {
        font-size: 1.1rem !important;
    }

    .bin-main a {
        font-size: 0.95rem !important;
        padding: 6px !important;
    }
}

/* ------------------------------
   7) Lap Page - Matrix
   ------------------------------ */
@media (max-width: 1200px) {
    .container {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 900px) {
    .container {
        width: 100%;
        max-width: 100%;
        padding: 0 10px;
        overflow-x: auto;
        justify-content: flex-start;
    }
}

@media (max-width: 900px) and (min-height: 900px) {
    .container {
        height: 420px !important;
    }
}

@media (max-width: 900px) and (max-height: 700px) {
    .container {
        height: 300px !important;
    }
}

@media (max-width: 768px) {
    .container {
        gap: 10px !important;
    }

    .bar-wrapper {
        width: 42px !important;
    }

    .rec {
        width: 38px !important;
    }
}

@media (max-width: 600px) {
    .container {
        gap: 8px !important;
        height: 320px !important;
    }

    .bar-wrapper {
        width: 34px !important;
    }

    .rec {
        width: 30px !important;
    }

    .num {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .container {
        gap: 7px !important;
        height: 280px !important;
    }

    .bar-wrapper {
        width: 30px !important;
    }

    .rec {
        width: 26px !important;
    }
}

@media (max-width: 390px) {
    .container {
        height: 240px !important;
        padding: 0 6px !important;
    }

    .bar-wrapper {
        width: 26px !important;
    }

    .rec {
        width: 22px !important;
    }

    .num {
        font-size: 0.75rem;
    }
}

@media (max-width: 320px) {
    .container {
        height: 220px !important;
        gap: 5px !important;
    }

    .bar-wrapper {
        width: 22px !important;
    }

    .rec {
        width: 18px !important;
    }
}

/* ------------------------------
   8) 404 + entrnet Page - Matrix
   ------------------------------ */
@media (max-width: 1024px) {
    .titel {
        text-align: center;
        padding-inline: 12px;
    }

    h1 {
        text-align: center;
        transform: none !important;
        padding-inline: 16px;
    }

    .back {
        transform: none !important;
        display: block;
        margin: 18px auto 0;
    }
}

@media (max-width: 768px) {
    .titel {
        font-size: 1.2rem;
    }

    h1 {
        font-size: clamp(1.6rem, 7vw, 2rem) !important;
        margin-top: 90px;
    }

    .dark-mode-toggle {
        top: auto;
        bottom: 14px;
        right: 14px;
    }
}

@media (max-width: 600px) and (min-height: 800px) {
    .titel {
        font-size: 1.15rem;
    }

    .btn,
    .back {
        width: min(220px, 92vw);
    }
}

@media (max-width: 600px) and (max-height: 760px) {
    h1 {
        margin-top: 70px !important;
    }

    .dark-mode-toggle {
        bottom: 10px;
        right: 10px;
    }
}

@media (max-width: 430px) {
    .titel {
        font-size: 1.05rem;
    }

    .btn,
    .back {
        width: min(200px, 90vw);
    }
}

@media (max-width: 390px) {
    h1 {
        font-size: 1.45rem !important;
        padding-inline: 10px !important;
    }
}

@media (max-width: 320px) {
    .titel {
        font-size: 0.95rem;
    }

    h1 {
        font-size: 1.25rem !important;
    }
}

/* ------------------------------
   9) iPad Specific Refinements
   ------------------------------ */
/* iPad Mini / Air / Pro portrait */
@media (min-width: 744px) and (max-width: 834px) and (min-height: 1024px) and (orientation: portrait) {
    .logo {
        font-size: 1.8rem !important;
    }

    .detales-main,
    .detales-about {
        font-size: 1.08rem !important;
    }

    .d-flex {
        flex-direction: column !important;
    }

    .sidebar,
    .sidebar.p-3 {
        max-height: 34vh !important;
        width: 100% !important;
    }

    #app {
        min-height: 66vh !important;
    }
}

/* iPad landscape */
@media (min-width: 1024px) and (max-width: 1366px) and (max-height: 1024px) and (orientation: landscape) {
    .sidebar {
        width: 240px !important;
    }

    #app {
        padding-left: 30px !important;
    }

    .detales-main {
        width: min(560px, 55vw) !important;
    }
}

/* ------------------------------
   10) Android / iPhone Buckets
   ------------------------------ */
/* 430 x 932 class */
@media (min-width: 421px) and (max-width: 430px) and (min-height: 900px) {
    .contenr-main {
        margin-top: 100px !important;
    }

    .detales-main {
        font-size: 1rem !important;
    }
}

/* 414 x 896 class */
@media (min-width: 401px) and (max-width: 414px) and (min-height: 860px) and (max-height: 915px) {
    .logo {
        font-size: 1.46rem !important;
    }

    .detales-main,
    .detales-about {
        font-size: 0.97rem !important;
    }
}

/* 393 x 873 class */
@media (min-width: 391px) and (max-width: 393px) and (min-height: 850px) {
    .contenr-main {
        margin-top: 92px !important;
    }
}

/* 390 x 844 class */
@media (min-width: 381px) and (max-width: 390px) and (min-height: 830px) and (max-height: 860px) {
    .logo {
        font-size: 1.4rem !important;
    }

    .bin-main a {
        font-size: 1rem !important;
    }
}

/* 384 x 854 class */
@media (min-width: 376px) and (max-width: 384px) and (min-height: 840px) {
    .contact {
        padding-inline: 10px !important;
    }
}

/* 375 x 812 class */
@media (min-width: 361px) and (max-width: 375px) and (min-height: 800px) and (max-height: 830px) {
    .dark-mode-toggle {
        bottom: 12px;
    }
}

/* 360 x 800 class */
@media (min-width: 351px) and (max-width: 360px) and (min-height: 780px) {
    .footer-title {
        font-size: 0.82rem !important;
    }
}

/* 344 x 882 class */
@media (min-width: 331px) and (max-width: 344px) and (min-height: 860px) {
    .logo {
        font-size: 1.25rem !important;
    }
}

/* 320 x 568 / old small phones */
@media (max-width: 320px) and (max-height: 640px) {
    .contenr-main {
        margin-top: 78px !important;
    }

    .dark-mode-toggle {
        width: 38px;
        height: 38px;
    }
}

/* ------------------------------
   11) Landscape Phone Fixes
   ------------------------------ */
@media (max-width: 932px) and (max-height: 500px) and (orientation: landscape) {
    header {
        position: sticky !important;
        top: 0;
    }

    .dark-mode-toggle {
        top: auto !important;
        bottom: 8px;
        right: 8px;
        width: 36px;
        height: 36px;
    }

    .contenr-main {
        margin-top: 18px !important;
        margin-bottom: 20px !important;
    }

    .contact {
        padding-top: 22px !important;
    }

    .footer {
        padding-top: 20px !important;
    }
}

@media (max-width: 900px) and (max-height: 430px) and (orientation: landscape) {
    .custom-nav-list {
        flex-direction: row !important;
        flex-wrap: wrap;
        justify-content: center;
    }

    .detales-main,
    .detales-about {
        font-size: 0.92rem !important;
    }
}

/* ------------------------------
   12) Height-Only Defensive Layer
   ------------------------------ */
@media (max-height: 720px) {
    .dark-mode-toggle {
        bottom: 10px;
    }
}

@media (min-height: 1000px) {
    .footer {
        margin-top: auto;
    }
}

@media (max-height: 620px) and (max-width: 768px) {
    .titel-main,
    .titel-about {
        margin-bottom: 6px;
    }

    .detales-main,
    .detales-about {
        line-height: 1.45;
    }
}

/* ------------------------------
   13) Optional Print Safety
   ------------------------------ */
@media print {
    .dark-mode-toggle,
    .navbar-toggler {
        display: none !important;
    }

    pre,
    p,
    .detales-main,
    .detales-about {
        width: 100% !important;
    }
}

/* ------------------------------
   14) Accessibility Media Queries
   ------------------------------ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (forced-colors: active) {
    .btn,
    .back,
    .contact-btn,
    .bin-main,
    .dark-mode-toggle {
        forced-color-adjust: auto;
        border: 1px solid ButtonText !important;
    }
}

/* ------------------------------
   15) Docs Sidebar Toggle Guard
   ------------------------------ */
@media (max-width: 991.98px) {
    .docs-layout .docs-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: min(280px, 84vw) !important;
        height: 100dvh !important;
        transform: translateX(-105%) !important;
        z-index: 1300 !important;
    }

    body.docs-sidebar-open .docs-layout .docs-sidebar {
        transform: translateX(0) !important;
    }

    .docs-layout #app {
        width: 100% !important;
        min-height: 100dvh !important;
        padding: 74px 14px 20px !important;
    }
}

/* ------------------------------
   16) Force Full-Height Docs Sidebar
   ------------------------------ */
.docs-layout .docs-sidebar {
    height: 100dvh !important;
    max-height: 100dvh !important;
}

@media (min-width: 992px) {
    .docs-layout .docs-sidebar {
        position: sticky !important;
        top: 0 !important;
        transform: none !important;
    }

    .docs-layout #app {
        min-height: 100dvh !important;
    }
}