/* Extracted from index.php <style> block */

@font-face {
    font-family: "Suisse Intl Mono";
    src: url("/font/SuisseIntlMono-Regular-WebS.eot");
    src: url("/font/SuisseIntlMono-Regular-WebS.eot?#iefix") format("embedded-opentype"),
         url("/font/SuisseIntlMono-Regular-WebS.woff2") format("woff2"),
         url("/font/SuisseIntlMono-Regular-WebS.woff") format("woff"),
         url("/font/SuisseIntlMono-Regular-WebS.ttf") format("truetype"),
         url("/font/SuisseIntlMono-Regular-WebS.svg#SuisseIntlMono-Regular") format("svg");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Global reset and layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html {
  scrollbar-width: thin;
  scrollbar-color: #DCD9DC black;
}

body {
    background-image: url("/img/Dot_square.svg");
    background-size: 20px 20px;
    background-repeat: repeat;
    background-color: #DCD9DC;
    font-family: "Suisse Intl Mono", monospace;
    min-height: 100vh;
}

a { color: black; }

.header {
    color: white;
    text-align: left;
    padding-left: 0px;
    height: 75px;
    margin-bottom: 10px;
    background-color: black;
}

/* Make the header sticky on desktop (logo is already fixed). We apply this only
   for screens wider than 768px so mobile layout (where the header is in-flow)
   remains unchanged. The header stays under the fixed logo (logo z-index:1001). */
@media (min-width: 769px) {
    .header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1000; /* keep below .logo img (1001) */
    }

    /* Push the main container down so content is not hidden behind the fixed header */
    .container-custom {
        margin-top: 90px; /* header height (70px) + 20px spacing */
    }
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.header p { font-size: 0.9rem; opacity: 0.9; }

.logo img {
    height: 75px;
    position: fixed;
    background-color: white;
    outline: 1px solid black;
    outline-offset: -1px; /* Snaps the invisible mask slightly inward */
    z-index: 1001;
    left: 7px;
}

/* ============ LOGO & RESPONSIVE STATES ============ */

/* Wenn die Sidebar geöffnet ist (.open), zeigen wir das VX-Logo und sperren weitere Hover-Effekte */
.logo-wrapper.open .logo img {
    content: url('/img/Logo_VX_01_rgb.svg');
    background-color: #DCD9DC;
    pointer-events: none; /* Verhindert ein Flackern beim erneuten Überfliegen */
}

/* Standard-Hover auf das Logo: Nur aktiv, wenn die Sidebar GESCHLOSSEN ist */
@media (hover: hover) {
    .logo-wrapper:not(.open) .logo:hover img {
        content: url('/img/Logo_VX_01_rgb.svg');
        background-color: #DCD9DC;
    }
}

/* ============ INFO SIDEBAR ============ */
.logo-wrapper {
    position: relative;
    padding: 0 10px 0 0;
}

.info-sidebar {
    position: fixed;
    top: 0;
    left: -400px; /* Standardmässig versteckt */
    width: 270px;
    max-width: 85vw;
    height: 100%;
    background-color: black;
    padding: 125px 20px 20px 20px;
    overflow-y: auto;
    z-index: 1000;
    transition: left 0.4s ease;
    scrollbar-color: black transparent;
    color: #DCD9DC;
}

.info-sidebar p { font-size: .85rem; line-height: 1.4; margin-bottom: 15px; }
.info-sidebar a { color: #DCD9DC; }

/* Die Sidebar öffnet sich AUSSCHLIESSLICH über die Klasse .open */
.info-sidebar.open { left: 0 !important; }

.container-custom {
    max-width: 1200px;
    margin: 120px auto;
    padding: 0 10px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 20px;
}

.pagination-nav {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 30px;
    margin-bottom: 30px;
}

.pagination-link {
    display: inline-block;
    background: white;
    color: black;
    text-decoration: none;
    border: solid 1px black;
    box-shadow: 4px 4px 0px black;
    padding: 8px 14px;
    font-size: 0.85rem;
}

.pagination-link:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px black;
}

.pagination-link:only-child {
    margin-left: auto;
}

.post-card {
    overflow: hidden;
    border: solid 1px black;
    box-shadow: 4px 4px 0px black;
    padding: 5px;
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: zoom-in;
    background-color: white;
}

.modal-media-caption-container {
    position: relative; /* anchors modal-caption-scrollbar */
    box-shadow: 5px 5px 0px black;
    display: flex;
    height: 100%;
    width: 100%;
}

.media-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    flex-shrink: 0;
    touch-action: pan-y;
    aspect-ratio: 3 / 4;
}

.media-item {
    width: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    position: absolute;
    bottom: 0;
    left: 0; 
}

.media-item.active {
    display: flex;
    position: absolute;
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 3 / 4;
}

.media-item video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    aspect-ratio: 3 / 4;
}

.carousel-controls {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 10;
    display: none;
}

.carousel-dot {
    width: 5px;
    height: 5px;
    border-radius: 0%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
}

.carousel-dot.active { background: white; }

.carousel-nav {
    position: absolute;
    top: 45%;
    z-index: 11;
    color: white;
    width: 40px;
    height: 40px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.3s;
    background-color: black;
    box-shadow: 3px 3px 0px black;
    border: solid 1px black;
}

.carousel-nav img{ opacity: 1; }

/* Standardzustand: Nav und Controls sind unsichtbar */
.carousel-nav {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* DESKTOP: Einblenden bei Hover */
@media (hover: hover) {
    .media-container:hover .carousel-nav {
        opacity: 1;
        visibility: visible;
    }
}

.carousel-nav.prev { left: 10px; }
.carousel-nav.next { right: 10px; }

.carousel-nav:hover {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0px black;
}

.media-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: white;
    color: black;
    padding-top: 5px;
    padding-bottom: 3px;
    padding-left: 7px;
    padding-right: 7px;
    font-size: 0.8rem;
    z-index: 9;
    border: 1px solid black;
    box-shadow: 2px 2px 0px black;
    text-box: auto;
}
.media-badge img {
    height: 20px;
    width: 20px;
    margin-right: 3px;
    vertical-align: middle;
}

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 0%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    font-size: 24px;
    z-index: 8;
}

.post-content {
    padding: 5px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.85);
}

.post-caption {
    font-size: 0.8rem;
    color: #000;
    line-height: 1.4;
    margin-bottom: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex-grow: 1;
    display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 3; /* Number of lines to show */
      overflow: hidden;
}

/* Remove ugly mobile tap highlight */
.post-caption {
  -webkit-tap-highlight-color: transparent; /* iOS/Safari tap highlight */
}

/* Remove default outline for pointer/touch interactions but preserve keyboard focus */
.post-caption:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* Explicit, accessible focus style for keyboard users */
.post-caption:focus-visible {
  outline: 0px solid white;
  outline-offset: 2px;
  box-shadow: none;
}

.caption-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #007bff;
    padding: 0;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
}

.post-card.expanded .post-caption {
    /* Expanded caption override (used on mobile) */
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    overflow: visible;
    max-height: none;
}

.post-card.expanded { height: auto; }

.post-date {
    font-size: 0.6rem;
    color: #000;
    margin-top: auto;
    margin-bottom: 0;
}

.no-posts {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.no-posts p { font-size: 1.1rem; margin-bottom: 10px; }

/* Full-size modal styles */
.modal-fullscreen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("/img/Dot_square.svg");
    background-size: 20px 20px;
    background-repeat: repeat;
    background-color: #DCD9DC;
    padding: 50px;
    z-index: 1000;
}

.modal-fullscreen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.modal-content-wrapper {
    display: flex;
    width: fit-content;
    height: 100%;
    max-height: 1200px;
    align-items: center;
    justify-content: center;
    padding: 30px;
  }

.modal-media-side {
    /* Width is set inline by sizeModalMediaSide() in vx.js, computed from
       the rendered height x 3/4. Safari doesn't reliably propagate a
       width derived from aspect-ratio up into an ancestor's shrink-to-fit
       width calculation (modal-media-caption-container/modal-content-wrapper
       both end up wrong), so the ratio is resolved in JS to a plain pixel
       value instead - every ancestor then just sums definite widths. */
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 90vh;
    height: 100%;
    border: solid 1px black;
}

.modal-media-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 95vw;
    max-height: 95vh;
    overflow: hidden;
}

.modal-media-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: black;
}

.modal-media-item.active { display: flex; }

.modal-media-item img { height: 100%; background: #000; }

.modal-media-item video { max-height: 100%; background: #000; }

.modal-caption-side {
    /* Plain width instead of flex: 0 0 400px - Safari's ancestor
       shrink-to-fit width calculation doesn't reliably pick up a size
       that comes from flex-basis either, same underlying issue as
       modal-media-side's aspect-ratio above. */
    display: flex;
    flex-direction: column;
    background-color: white;
    height: 100%;
    border-top: solid 1px black;
    border-right: solid 1px black;
    border-bottom: solid 1px black;
    width: 400px;
    /* Clips the native scrollbar of modal-caption-scroll, which is
       deliberately made wider than this box - see below. */
    overflow: hidden;
}

/* Only the caption text scrolls - modal-date sits outside this as a fixed
   status bar (see below) so it's always visible regardless of caption
   length, instead of only appearing once scrolled to the end. */
.modal-caption-scroll {
    flex: 1;
    min-height: 0; /* let a flex child actually shrink and scroll instead of growing to fit content */
    overflow-y: auto;
    /* The native scrollbar is replaced by modal-caption-scrollbar below,
       driven from the real scroll position in JS. Rather than rely on any
       scrollbar-hiding property - Safari ignored ::-webkit-scrollbar here
       because the inherited non-auto scrollbar-color from html puts it on
       the standard rendering path - this box is made 20px wider than
       its parent via the negative margin, so the native
       scrollbar renders outside the parent's box and is physically
       clipped by its overflow: hidden. That works in every browser
       regardless of scrollbar styling support.
       padding-right = 24px (visual gap, clears the custom scrollbar)
                     + 20px (the negative margin), so text lands in the
       same place it did before. */
    margin-right: -20px;
    padding: 10px 44px 0 10px;
    /* Belt and braces for browsers that do honor these - harmless where
       the clipping above already does the job. */
    scrollbar-width: none;
    scrollbar-color: transparent transparent;
}

.modal-caption-scroll::-webkit-scrollbar {
    display: none;
}

.modal-caption-scroll::after {
    content: '';
    display: block;
    height: 10px;
}

.modal-caption-scrollbar {
    position: absolute;
    top: 12px;
    right: 5px;
    bottom: 40px;
    width: 10px;
    display: none;
    background: white;
}

.modal-caption-scrollbar.visible {
    display: block;
}

.modal-caption-scrollbar-thumb {
    position: absolute;
    left: 1px;
    width: 7px;
    background: white;
    box-shadow: 2px 2px 0px black;
    border: solid 1px black;
}

.modal-caption {
    font-size: 0.9rem;
    color: #000;
    line-height: 1.6;
    margin-bottom: 20px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Status bar: always visible at the bottom of the caption panel,
   outside the scrolling text area above (modal-caption-scroll). */
.modal-date {
    flex: 0 0 auto;
    font-size: 0.85rem;
    padding: 10px 10px 10px 10px;
    text-align: right;
    margin-bottom: 0px;
    background-color: white;
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: black;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    z-index: 1001;
    border: solid 1px black;
    box-shadow: 4px 4px 0px black;
}

.modal-close-btn:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px black;
}

.modal-carousel-nav-wrapper {
    cursor: pointer;
    display: flex;
    align-items: center;
    height: 100%;
    z-index: 999;
}

.modal-carousel-nav {
    background: black;
    width: 60px;
    height: 60px;
    z-index: 999;
    box-shadow: 4px 4px 0px black;
    border: solid 1px black;
}

.modal-carousel-nav:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px black;
}

.modal-carousel-nav.prev { margin-right: 27px; }
.modal-carousel-nav.next { margin-left: 27px; }


.modal-carousel-controls {
    position: absolute;
    display: flex;
    gap: 5px;
    z-index: 999;
    visibility: hidden;
    background-color: #DCD9DC;
    padding: 5px;
    bottom: 40px;
}

.modal-carousel-dot {
    width: 10px;
    height: 10px;
    background-color: white;
    cursor: pointer;
    border: solid 1px black;
    box-shadow: 1px 1px 0px black;
}

.modal-carousel-dot.active { 
    outline: solid 2px black;
    outline-offset: -5px;
}

@media (max-width: 768px) {
    html { scroll-snap-type: y mandatory; }

    /* Relaxed while a caption is open so custom scrollTo (centering/collapse)
       and free reading aren't fought by forced snap correction. */
    html.vx-caption-expanded { scroll-snap-type: y proximity; }

    .header { scroll-snap-align: start; scroll-margin-top: 10px; }

    .post-card { scroll-snap-align: start; scroll-margin-top: 10px; }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 15px;
        margin-bottom: 20px;
    }

    .header{
        height: auto;
        margin-bottom: 10px;
    }

    .header h1 { font-size: 1.8rem; }

    .logo img {
        left: 5px;
    }


    /* MOBILE: info panel expands in-flow from the logo, pushing the cards down */
    .info-sidebar {
        position: static;
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 0;
        border-right: none;
        border-bottom: none;
        padding: 0px 18px 0px 18px;
        overflow: hidden;
        transition: max-height 0.4s ease, padding 0.4s ease;
    }

    .info-sidebar.open {
        max-height: 1000px;
        padding: 18px 18px 0px 18px;
    }

    .container-custom {
        margin: 0px;
    }

    .media-container {
        height: 100%;
        aspect-ratio: 3 / 4;
        flex-shrink: inherit;
    }

    .post-card { height: auto; }

    .carousel-nav {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .carousel-controls { 
        display: flex; 
        background: rgba(0,0,0,0.35); 
        padding: 4px 8px; 
    }

    .logo img { position: relative; }

    .modal-content-wrapper {
        flex-direction: column;
        gap: 15px;
    }

    .modal-caption-side {
        flex: 0 0 auto;
        max-height: 30vh;
        width: 100%;
        max-width: 100%;
        overflow: auto;
    }

    .modal-media-side {
        flex: 1;
        max-height: 60vh;
    }

    .modal-media-container {
        max-width: 100%;
        max-height: 60vh;
    }

    /* Show caption toggle on small screens */
    .caption-toggle { display: inline-block; margin-bottom: 8px; }
}
