/*
Theme Name: Republica Custom
Version: 5.0
*/

/* =========================================
   1. NULSTILLING & BASIS
   ========================================= */
* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #000;
    width: 100%;
    overflow-x: hidden;
    font-family: sans-serif;
}

body.is-archive,
body.page,
body.single-republica_case {
    background: #fff;
}

body.menu-open {
    overflow: hidden;
}

/* Gør H1, H2, H3 og H4 globale i Republica-stilen */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    color: #000;
}

/* =========================================
   2. FORSIDE GRID CONTAINER
   ========================================= */
.republica-frontpage-grid {
    display: flex;
    flex-direction: column;
    width: 100vw;
    max-width: 100%;
}

.grid-module {
    display: grid;
    width: 100%;
    gap: 0;
}

.grid-cell {
    position: relative;
    width: 100%;
    height: 100%;
}

.grid-cell img,
.grid-cell video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cell-link {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

/* 3. Grid Areas */
.cell-1 { grid-area: c1; }
.cell-2 { grid-area: c2; }
.cell-3 { grid-area: c3; }

/* =========================================
   4. FORSIDE MODUL DEFINITIONER
   ========================================= */
.modul_1 { aspect-ratio: 8 / 5; grid-template-columns: 1fr 1fr; grid-template-areas: "c1 c2"; }
.modul_2 { aspect-ratio: 6 / 5; grid-template-columns: 1fr 2fr; grid-template-rows: 1fr 1fr; grid-template-areas: "c1 c3" "c2 c3"; }
.modul_3 { aspect-ratio: 6 / 5; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; grid-template-areas: "c1 c2" "c1 c3"; }
.modul_4 { aspect-ratio: 12 / 5; grid-template-columns: 1fr 2fr; grid-template-areas: "c1 c2"; }
.modul_5 { aspect-ratio: 12 / 5; grid-template-columns: 2fr 1fr; grid-template-areas: "c1 c2"; }
.modul_6 { aspect-ratio: 8 / 5; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; grid-template-areas: "c1 c2" "c1 c3"; }
.modul_7 { aspect-ratio: 8 / 5; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; grid-template-areas: "c1 c3" "c2 c3"; }


/* =========================================
   5. MENU & ANIMATION
   ========================================= */
#republica-menu-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 70px;
    height: 70px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 9999;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.5s cubic-bezier(0.8, 0, 0.2, 1);
}

#republica-menu-toggle .line-v,
#republica-menu-toggle .line-h,
#republica-menu-toggle .line-shaft {
    transition: all 0.5s cubic-bezier(0.8, 0, 0.2, 1);
}

#republica-menu-toggle .line-v {
    position: absolute;
    width: 3px;
    height: 70px;
    background-color: #000;
}

#republica-menu-toggle .line-h {
    position: absolute;
    width: 70px;
    height: 3px;
    background-color: #000;
}

body.home #republica-menu-toggle .line-v,
body.home #republica-menu-toggle .line-h {
    background-color: #fff;
}

body.menu-open #republica-menu-toggle {
    transform: rotate(90deg);
}

body.menu-open #republica-menu-toggle .line-v,
body.menu-open #republica-menu-toggle .line-h {
    background-color: #000 !important;
}

#republica-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #fff;
    z-index: 9998;
    display: flex;
    align-items: center;
    padding-left: 10vw;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

body.menu-open #republica-menu-overlay {
    opacity: 1;
    pointer-events: all;
}

.republica-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.republica-nav-list li {
    margin-bottom: 25px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

body.menu-open .republica-nav-list li {
    transform: translateY(0);
    opacity: 1;
}

body.menu-open .republica-nav-list li:nth-child(1) { transition-delay: 0.1s; }
body.menu-open .republica-nav-list li:nth-child(2) { transition-delay: 0.2s; }
body.menu-open .republica-nav-list li:nth-child(3) { transition-delay: 0.3s; }
body.menu-open .republica-nav-list li:nth-child(4) { transition-delay: 0.4s; }
body.menu-open .republica-nav-list li:nth-child(5) { transition-delay: 0.5s; }
body.menu-open .republica-nav-list li:nth-child(6) { transition-delay: 0.6s; }
body.menu-open .republica-nav-list li:nth-child(7) { transition-delay: 0.7s; }
body.menu-open .republica-nav-list li:nth-child(8) { transition-delay: 0.8s; }
body.menu-open .republica-nav-list li:nth-child(9) { transition-delay: 0.9s; }
body.menu-open .republica-nav-list li:nth-child(10) { transition-delay: 1.0s; }

.republica-nav-list a {
    font-family: 'Inter', sans-serif;
    font-size: 4em;
    font-weight: 900;
    color: #000;
    text-decoration: none;
    text-transform: uppercase;
    line-height: 1.1;
    transition: color 0.2s ease;
}

.republica-nav-list a:hover {
    color: #999;
}


/* =========================================
   6. CASE ARKIV (Oversigt)
   ========================================= */
.archive-main {
    padding: 120px 20px 60px;
    background: #fff;
    min-height: 100vh;
}

.republica-case-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
}

.case-card {
    display: block;
    position: relative;
    text-decoration: none;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f5f5f5;
}

.case-image-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.case-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.case-image-fallback {
    width: 100%;
    height: 100%;
    background: #ddd;
}

.case-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
}

.case-title {
    position: absolute;
    bottom: 15px;
    left: 15px;
    right: 15px;
    color: #fff;
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 900;
    text-transform: uppercase;
    line-height: 1.2;
    z-index: 2;
}

.case-card:hover .case-image {
    transform: scale(1.05);
}


/* =========================================
   7. MOBIL OPTIMERING (Generel)
   ========================================= */
@media (max-width: 1024px) {
    .republica-case-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-module { display: flex; flex-direction: column; aspect-ratio: auto; }
    .grid-cell { width: 100%; aspect-ratio: 1 / 1; }
    
    #republica-menu-toggle { top: 20px; left: 20px; width: 50px; height: 50px; }
    #republica-menu-toggle .line-v { height: 50px; width: 3px; }
    #republica-menu-toggle .line-h { width: 50px; height: 3px; }
    
    #republica-menu-overlay { 
        align-items: flex-start; 
        padding-top: 100px; 
        padding-left: 20px; 
    }
    
    .republica-nav-list a { 
        font-size: 32px; 
        line-height: 1em; 
    }

    .archive-main { padding: 90px 15px 40px; }
    .republica-case-grid { grid-template-columns: 1fr; gap: 15px; }
    .case-card { aspect-ratio: 16 / 9; }
}


/* =========================================
   8. SINGLE CASE / PAGE VISNING
   ========================================= */
.single-case-main {
    background: #fff;
    min-height: 100vh;
    padding: 120px 20px 80px;
    font-family: 'Inter', sans-serif;
}

.single-case-container {
    width: 100%;
    margin: 0 auto;
}

.case-header {
    margin-bottom: 40px;
    text-align: left;
    width: 100%;
    max-width: 950px;
    margin-left: auto;
    margin-right: auto;
}

/* Kombineret styling for standard-titel og manuelle H1 overskrifter overalt */
h1, .case-main-title {
    font-size: 3.5rem;
    font-weight: 900;
    text-transform: uppercase;
    margin: 0 0 15px 0;
    line-height: 1.1;
    letter-spacing: -1px;
}

.case-client-bar {
    display: inline-block;
    background: #000;
    color: #fff;
    padding: 6px 10px 6px 10px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.case-top-media {
    margin: 0 auto 50px auto;
    width: 100%;
    max-width: 950px;
}

.case-top-image {
    width: 100%;
    height: auto;
    display: block;
}

.responsive-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    background: #000;
    width: 100%;
    display: block;
    margin: 40px 0;
}

.case-top-media .responsive-embed {
    margin: 0;
}

.responsive-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.case-body-content {
    width: 100%;
    max-width: 950px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #111;
}

/* H2 styling (Desktop) */
.case-body-content h2 {
    font-weight: 900;
    text-transform: uppercase;
    margin-top: 60px;
    margin-bottom: 10px;
}

/* H3 styling (Desktop) */
.case-body-content h3 {
    font-weight: 900;
    text-transform: uppercase;
    margin-top: 20px;
    margin-bottom: 0px;
}

/* H4 styling - Opdateret */
.case-body-content h4 {
    font-weight: 900;
    text-transform: uppercase;
    margin-top: 40px;
    margin-bottom: 5px;
}

/* Fjerner den usynlige default margin fra toppen af brødteksten */
.case-body-content p {
    margin-top: 0; 
    margin-bottom: 25px;
}

.case-body-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 40px 0;
}

@media (max-width: 768px) {
    h1, .case-main-title {
        font-size: 2.2rem;
    }
    
    .case-body-content h2 {
        font-weight: 900;
        text-transform: uppercase;
        margin-top: 60px;
        margin-bottom: 20px;
        line-height: 1.2em;
    }

    .case-body-content h3 {
        font-weight: 900;
        text-transform: uppercase;
        margin-top: 40px;
        margin-bottom: 10px;
        line-height: 1.2em;
    }
}


/* =========================================
   9. KONTAKT SIDE (Person Grid)
   ========================================= */
.republica-contact-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin: 60px 0;
    width: 100%;
}

.contact-profile-img {
    width: 100%;
    aspect-ratio: 1 / 1 !important; 
    object-fit: cover;
    margin: 0 0 20px 0 !important;
    display: block;
}

.contact-image-fallback {
    width: 100%;
    aspect-ratio: 1 / 1 !important;
    background: #eee;
    margin-bottom: 20px;
}

.republica-contact-grid h2 {
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    line-height: 1.1em !important;
    margin: 0 0 5px 0;
    color: #000;
}

.republica-contact-grid h4 {
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    margin: 0 0 15px 0;
    color: #000;
}

.republica-contact-grid .contact-info a {
    display: block;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 1.1rem;
    line-height: 1.6 !important;
    color: #111;
    text-decoration: none;
    margin-bottom: 0;
    transition: color 0.3s ease;
}

.republica-contact-grid .contact-info a:hover {
    color: #999;
}

@media (max-width: 768px) {
    .republica-contact-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}


/* =========================================
   10. BACK BUTTON (PIL) ANIMATION
   ========================================= */
#republica-menu-toggle .line-shaft {
    position: absolute;
    width: 0;
    height: 3px;
    background-color: #000;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.8, 0, 0.2, 1);
}

body.home #republica-menu-toggle .line-shaft { background-color: #fff; }
body.menu-open #republica-menu-toggle .line-shaft { background-color: #000 !important; }

/* Stopper menuens 90-graders rotation, så pilen peger lige til venstre */
#republica-menu-toggle.show-arrow {
    transform: rotate(0) !important; 
}

/* Pilens lange krop skyder frem */
#republica-menu-toggle.show-arrow .line-shaft {
    width: 50px;
    opacity: 1;
}

/* Den øverste del af pilhovedet (/) */
#republica-menu-toggle.show-arrow .line-v {
    height: 3px;
    width: 25px;
    transform: translate(-16px, -8px) rotate(-45deg);
}

/* Den nederste del af pilhovedet (\) */
#republica-menu-toggle.show-arrow .line-h {
    height: 3px;
    width: 25px;
    transform: translate(-16px, 8px) rotate(45deg);
}

/* Mobil-tilpasning af pilen */
@media (max-width: 768px) {
    #republica-menu-toggle.show-arrow .line-shaft { width: 35px; }
    #republica-menu-toggle.show-arrow .line-v { width: 18px; transform: translate(-10px, -6px) rotate(-45deg); }
    #republica-menu-toggle.show-arrow .line-h { width: 18px; transform: translate(-10px, 6px) rotate(45deg); }
}


/* =========================================
   11. SMART MEDIE GRID (Byggeklodser)
   ========================================= */
.republica-smart-grid {
    display: grid;
    gap: 20px;
    margin: 40px 0;
    width: 100%;
}

.republica-smart-grid.cols-1 { grid-template-columns: 1fr; }
.republica-smart-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.republica-smart-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* Begræns 1-kolonne formater på desktop, så de ikke bliver gigantiske */
@media (min-width: 769px) {
    /* Højformat/Portræt fylder 1/3 for at matche proportionerne pænt */
    .republica-smart-grid.cols-1.is-portrait-45,
    .republica-smart-grid.cols-1.is-vertical {
        grid-template-columns: 33.333%;
        justify-content: center;
    }
    
    /* Kvadratisk fylder 50% (Svarer i størrelse til hvis der var to kolonner) */
    .republica-smart-grid.cols-1.is-square {
        grid-template-columns: 50%;
        justify-content: center;
    }
}

.republica-smart-grid .smart-col {
    width: 100%;
}

.republica-smart-grid .smart-col img,
.republica-smart-grid .smart-col video,
.republica-smart-grid .smart-col iframe {
    width: 100%;
    display: block;
    border: none;
    object-fit: cover;
    margin: 0 !important; /* Forhindrer WP-luft */
}

/* Formater - rettet height til auto så den respekterer aspect-ratio rigtigt */
.republica-smart-grid.is-vertical .smart-col img,
.republica-smart-grid.is-vertical .smart-col video,
.republica-smart-grid.is-vertical .smart-col iframe {
    aspect-ratio: 9 / 16;
    height: auto;
}

/* Portræt (4:5) - Nyt format! */
.republica-smart-grid.is-portrait-45 .smart-col img,
.republica-smart-grid.is-portrait-45 .smart-col video,
.republica-smart-grid.is-portrait-45 .smart-col iframe {
    aspect-ratio: 4 / 5;
    height: auto;
}

.republica-smart-grid.is-square .smart-col img,
.republica-smart-grid.is-square .smart-col video,
.republica-smart-grid.is-square .smart-col iframe {
    aspect-ratio: 1 / 1;
    height: auto;
}

.republica-smart-grid.is-landscape .smart-col img,
.republica-smart-grid.is-landscape .smart-col video,
.republica-smart-grid.is-landscape .smart-col iframe {
    aspect-ratio: 16 / 9;
    height: auto;
}

@media (max-width: 768px) {
    .republica-smart-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
}