/*
Theme Name: Święta Warmia
Theme URI: https://swietawarmia.online
Author: TBnet.pl
Author URI: https://www.tbnet.pl
Description: Szablon WordPress dla projektu Święta Warmia Online – interaktywna mapa szlaków turystycznych i kulturowych Świętej Warmii.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.3
Text Domain: swietawarmia
*/

html,
body {
    height: 100%;
    font-size: 16px;
}

body {
    position: relative;
    margin: 0;
    font-family: "EB Garamond", serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    color: #441a05;
    background-color: #e8e1ce;
    background-image: url("img/body-bg-500x500px.jpg");
    background-position: top left;
}

/* wrapper */
#wrapper {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

@media screen and (min-width: 1200px) {

    #wrapper::before,
    #wrapper::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 390px;
        pointer-events: none;
        background-image: url("img/body-left-shadow-last.png");
        background-repeat: repeat-y;
        z-index: 0;
    }

    #wrapper::before {
        left: 0;
        background-position: top left;
    }

    #wrapper::after {
        right: 0;
        background-position: top right;
        transform: rotate(180deg);
    }
}


/* header & footer */
#header,
#footer {
    position: relative;
    z-index: 10;
    height: 55px;
    background-color: #e8e1ce;
    background-image: url("img/header-bg_500x160px.jpg");
    background-repeat: repeat-x;
    background-position: top left;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
    display: flex;
}

#header::before,
#footer::before,
#footer::after,
#header::after {
    content: "";
    position: absolute;
    top: 0;
    width: 139px;
    height: 55px;
    pointer-events: none;
    background-image: url("img/header-left-shadow-mobile.png");
    background-repeat: repeat-y;
    background-size: contain;
}

#footer,
#footer::before,
#footer::after {
    height: 140px;
}

#header::before,
#footer::before {
    left: 0;
    background-position: left top;
}

#header::after,
#footer::after {
    right: 0;
    background-position: right top;
    transform: rotate(180deg);
}

#header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    text-transform: uppercase;
    position: relative;
    z-index: 2;
}
#header h1 a {
    color: #441a05;
    text-decoration: none;
}   

#footer {
    position: relative;
    box-shadow: 0 -6px 12px rgba(0, 0, 0, 0.25);
}

#footer>div {
    position: relative;
    z-index: 10;
    font-size: 1rem;
    margin-top: 20px;
}

#footer a {
    color: #441a05;
    text-decoration: none;
}

#footer a:hover {
    text-decoration: underline;
}

@media screen and (min-width: 768px) {

    #header,
    #footer {
        height: 160px;
    }

    #header::before,
    #footer::before,
    #footer::after,
    #header::after {
        width: 400px;
        height: 160px;
        background-image: url("img/header-left-shadow.png");
    }

    #header h1 {
        font-size: 3.625rem;
    }
}

@media screen and (min-width: 992px) {
    #footer>div {
        font-size: 1.375rem;
        margin-top: 30px;
    }
}

/* main */
#main {
    position: relative;
    flex: 1;
    z-index: 10;
}
#main article a {
    color: #441a05;
    text-decoration: underline;
}
#main article a:hover {
    text-decoration: none;
}

/* home - project info */
#project-info .container {
    position: relative;
    z-index: 10;
    font-size: 1rem;
    max-width: 900px;
}

#project-info em {
    font-weight: 700;
}

@media screen and (min-width: 768px) {
    #project-info .container {
        font-size: 1.5rem;
    }
}

@media (max-width: 600px) {
    #project-info img:first-child {
        width: 73px;
        height: auto;
    }

    #project-info img:last-child {
        width: 59px;
        height: auto;
    }
}

/* map */
#map-container {
    position: relative;
}
#map {
    width: 100%;
    height: auto;
    background-color: #e9e9e9;
}
.leaflet-left {
    left: 22px;
}
.leaflet-top {
    top: 22px
}

.map-floating-popup {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 99999;
    display: none;
    pointer-events: auto;
    max-width: min(90vw, 420px);
    min-width: 220px;
}

.map-floating-popup.open {
    display: block;
}

.map-floating-popup__box {
    position: relative;
    background: #f5efe2;
    border: 1px solid #40230f;
    border-radius: 1rem;
    padding: 0.875rem 1rem;
    color: #40230f;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.map-floating-popup__close {
    position: absolute;
    right: 10px;
    top: 8px;
    border: 0;
    background: transparent;
    color: #40230f;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.map-floating-popup__content {
    margin-right: 26px;
}
.map-floating-popup__content a {
    color: #40230f;
    text-decoration: none;
}

.map-floating-popup__content a:hover {
    text-decoration: underline;
}

.map-floating-popup__content h3 {
    font-size: 1.125rem;
    font-weight: 500;
    text-transform: uppercase;
    padding-right: 40px;
}
.map-floating-popup__content p:last-child {
    margin-bottom: .5rem;
}
.map-floating-popup__content img {
    width: 30px;
    height: auto;
}

@media (min-width: 768px) {
    .map-floating-popup__content {
        font-size: 1rem;
    }
    
    .map-floating-popup__close {
        font-size: 2rem;
        line-height: 2rem;
        top: 14px;
        right: 14px;
    }
    
    .map-floating-popup__content h3 {
        font-size: 1.5rem;
    }
}

/* Trail selector bar */
.trail-selector-bar {
    position: relative;
    z-index: 10000;
}
.trail-selector-bar.open {
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    background: #EDE6D3;
}

.trail-dropdown-toggle {
    width: 100%;
    background: #EDE6D3;
    border: 1px solid #441a05;
    border-radius: 16px;
    padding: 0.875rem 1.875rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.25rem;
    font-weight: 500;
    color: #441a05;
    cursor: pointer;
    transition: background 0.2s;
}

.trail-dropdown-toggle:hover {
    background: rgba(220, 208, 185, 0.98);
}

.trail-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.chevron {
    background-color: #441a05;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M7.646 11.354a.5.5 0 0 0 .708 0l6-6a.5.5 0 0 0-.708-.708L8 10.293l-5.646-5.647a.5.5 0 0 0-.708.708z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M7.646 11.354a.5.5 0 0 0 .708 0l6-6a.5.5 0 0 0-.708-.708L8 10.293l-5.646-5.647a.5.5 0 0 0-.708.708z'/%3E%3C/svg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    background-color: #441a05;
    transition: transform 0.25s;
}
.close-icon {
    background-color: #441a05;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath stroke='black' stroke-width='0.7' d='M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath stroke='black' stroke-width='0.7' d='M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    -webkit-mask-size: 140%;
    mask-size: 140%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    transition: transform 0.25s;
}

.trail-dropdown-toggle.open .chevron {
    transform: rotate(180deg);
}

.trail-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.trail-toggle-label .trail-toggle-thumb {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.trail-toggle-label > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dropdown panel */
.trail-dropdown-panel {
    display: none;
    background: #EDE6D3;
    padding-bottom: 1rem;
}

.trail-dropdown-panel.open {
    display: block;
}

/* Category rows */
.trail-category {
    border-bottom: 1px solid #441a05;
    margin: 0 1.875rem;
}

.trail-category:last-child {
    border-bottom: none;
}

.trail-category-toggle {
    width: 100%;
    background: none;
    border: none;
    padding: 0.875rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.125rem;
    font-weight: 500;
    color: #441a05;
    cursor: pointer;
    text-align: left;
}

.trail-category-toggle:hover {
    background: rgba(200, 185, 158, 0.3);
}

/* Trail items */
.trail-items {
    display: none;
}

.trail-items.open {
    display: block;
    margin-bottom: 0.875rem;
}

.trail-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px 9px 20px;
    border: none;
    border-top: 1px solid #441a05;
    background-color: #F7F3EA;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    text-align: left;
    font-size: 1rem;
    font-weight: 400;
    color: #441a05;
    transition: background 0.15s;
}

.trail-item:focus-visible {
    outline: 2px solid #40230f;
    outline-offset: 2px;
}

.trail-item:hover {
    background: rgba(200, 185, 158, 0.4);
}

.trail-item img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

@media (min-width: 768px) {
    .trail-selector-bar {
        position: absolute;
        top: 34px;
        right: 44px;
        width: 360px;
    }
    .trail-dropdown-toggle {
        font-size: 1.5rem
    }
    .chevron,
    .close-icon {
        width: 1.5rem;
        height: 1.5rem;
    }
}

/* Marker color test (szare vs aktywne) */
.leaflet-marker-icon.trail-marker--inactive {
    filter: grayscale(1) brightness(0.65) contrast(0.9);
    opacity: 0.60;
}

.leaflet-marker-icon.trail-marker--active {
    filter: none;
    opacity: 1;
}

/* breadcrumb */
.breadcrumb a {
    color: #441a05;
    text-decoration: none;
}
.breadcrumb a:hover {
    text-decoration: underline;
}