/*
 Theme Name:   NeTammelat
 Theme URI:    https://netammelat.fi/
 Description:  Private theme for Ne Tammelat travel blog.
 Author:       Ne Tammelat
 Author URI:   https://netammelat.fi/
 Version:      1.0.0
 License:      Private - All Rights Reserved
 Text Domain:  netammelat
 Requires PHP: 8.0
 Requires at least: 6.2
*/

/* === Global: smooth scrolling === */
html {
    scroll-behavior: smooth;
}

/* === Post meta row: keep date/category together, hide orphan separator on wrap === */
.post-meta-row {
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.post-meta-row > * {
    white-space: nowrap;
    flex-shrink: 0;
}
.post-meta-row > .wp-block-post-terms {
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 480px) {
    .post-meta-row {
        flex-wrap: wrap !important;
        white-space: normal;
    }
    .post-meta-row > * {
        white-space: normal;
    }
    .post-meta-row > p {
        display: none;
    }
    .post-meta-row > .wp-block-post-date::after {
        content: " / ";
    }
}

/* === Post content: tighter spacing between blocks === */
.wp-block-post-content.is-layout-constrained > *:not(:first-child) {
    margin-block-start: 0.75em;
}

/* === Elementor text blocks: reduce internal padding === */
.elementor-widget-text-editor p {
    margin-top: 1px !important;
    margin-bottom: 0.5em !important;
    padding: 0 !important;
}

/* === Screen reader only (visually hidden, accessible) === */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    width: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    word-wrap: normal !important;
}

/* === SVG watermark background === */
body {
    position: relative;
}

/* Ensure main wrapper does not create a stacking context that hides the watermark */
main.wp-block-group {
    position: relative;
    margin: 0;
    padding: 0;
    gap: 0;
    z-index: auto;
}

/* White-to-transparent fade at top of content (covers watermark near header) */
main.wp-block-group::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 150px;
    background: linear-gradient(to bottom, #ffffff 0%, transparent 100%);
    pointer-events: none;
    z-index: -1;
}

/* Remove WP block gap before filmstrip */
main.wp-block-group > .wp-block-shortcode:first-child {
    margin-top: 0;
}

body::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 100vw;
    background: url('https://media.netammelat.fi/NT-logo.svg') center/contain no-repeat;
    opacity: 0.025;
    pointer-events: none;
    z-index: -1;
}

/* === Selection highlight === */
::selection {
    color: #fff;
    background-color: #2a88bf;
}

/* === Global link styles: shadow on hover === */
a {
    text-decoration: none;
    transition: color 0.2s, text-shadow 0.2s;
}

a:hover {
    text-decoration: none;
    text-shadow: 0 0 8px rgba(14, 39, 37, 0.4);
}

/* === Post list spacing === */
article.post {
    margin-bottom: 2em;
    padding-bottom: 2em;
    border-bottom: 1px solid #eee;
}

article.post:last-child {
    border-bottom: none;
}

/* === Card-style post blocks (hero + grid) === */
.hero-post,
.grid-post {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: box-shadow 0.25s, transform 0.25s;
    height: 100%;
}

.hero-post:hover,
.grid-post:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
}

/* Card inner padding (text area) */
.hero-post .wp-block-column:last-child,
.grid-post > :not(.wp-block-post-featured-image) {
    padding: 0.8em 1em;
}

/* Rounded featured images inside cards */
.hero-post .wp-block-post-featured-image img,
.grid-post .wp-block-post-featured-image img {
    border-radius: 10px 10px 0 0;
}

/* === Post navigation arrows === */
.post-navigation .nav-previous::before {
    content: "\00ab\0020";
}

.post-navigation .nav-next::after {
    content: "\0020\00bb";
}

/* === Sidebar widget title accent === */
.sidebar .wp-block-heading {
    padding-bottom: 0.4em;
    margin-bottom: 0.8em;
    border-bottom: 2px solid var(--wp--preset--color--primary);
}

/* === Sidebar consistent widget spacing === */
.sidebar > * {
    margin-bottom: 1.5em;
}

.sidebar > *:last-child {
    margin-bottom: 0;
}

/* Fix WP core aligncenter using display:table which prevents centering */
.sidebar .wp-block-image.aligncenter {
    display: block;
    text-align: center;
}

/* Normalize sidebar lists (recent posts, comments, tag cloud) */
.sidebar .wp-block-latest-posts,
.sidebar .wp-block-latest-comments,
.sidebar .wp-block-tag-cloud,
.sidebar .wp-block-archives-list,
.sidebar .wp-block-categories-list {
    padding-left: 0;
    margin-top: 0;
    margin-bottom: 0;
}

.sidebar .wp-block-latest-posts li,
.sidebar .wp-block-categories-list li {
    padding: 0.4em 0;
}

.sidebar .wp-block-archives-list {
    list-style-position: inside;
    padding-left: 0;
}

.sidebar .wp-block-archives-list li {
    padding: 0.4em 0;
}

.sidebar .wp-block-tag-cloud {
    line-height: 1.2;
    gap: 0;
    text-align: left;
}

.sidebar .wp-block-tag-cloud a {
    margin: 1px 2px;
    display: inline;
    white-space: nowrap;
    padding-left: 0 !important;
    margin-left: 0;
}

/* === Sidebar card style === */
.sidebar {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 12px;
    padding: 1.2em;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.04);
}

/* === Header glass effect === */
.site-header {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.9) !important;
    position: relative;
    z-index: 1000;
    border-bottom: none !important;
    box-shadow: none !important;
}

.site-header-inner {
    align-items: flex-start !important;
}

.site-header-inner .primary-navigation {
    height: 111px;
    display: flex;
    align-items: center;
    padding-bottom: 0;
}

.site-header-inner .primary-navigation > ul {
    align-items: center;
}

.site-header-inner .primary-navigation a {
    line-height: 1;
    padding-top: 0;
    padding-bottom: 0;
}

/* === Primary navigation (classic menu) === */
.primary-navigation {
    display: flex;
    align-items: center;
    font-family: var(--wp--preset--font-family--heading);
}

.primary-navigation > ul {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.2em;
}

.primary-navigation li {
    position: relative;
}

.primary-navigation a {
    display: block;
    padding: 0.4em 0.8em;
    text-decoration: none;
    color: #0E2725;
    font-size: 1.05rem;
    transition: color 0.2s, text-shadow 0.2s;
}

.primary-navigation a:hover {
    color: var(--wp--preset--color--primary);
    text-shadow: 0 0 10px rgba(14, 39, 37, 0.35);
}

.primary-navigation .current-menu-item > a,
.primary-navigation .current-menu-ancestor > a {
    color: var(--wp--preset--color--primary);
    font-weight: 600;
}

/* Submenu dropdown */
.primary-navigation .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    list-style: none;
    margin: 0;
    padding: 0.4em 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 10000;
    flex-direction: column;
    align-items: stretch;
}

/* Invisible bridge to keep hover active between parent and dropdown */
.primary-navigation .menu-item-has-children > .sub-menu::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    width: 100%;
    height: 12px;
}

/* Nested submenus: open to the right */
.primary-navigation .sub-menu .sub-menu {
    top: 0;
    left: 100%;
    margin-left: 2px;
}

/* Bridge for nested submenus (left side) */
.primary-navigation .sub-menu .menu-item-has-children > .sub-menu::before {
    top: 0;
    left: -12px;
    width: 12px;
    height: 100%;
}

.primary-navigation li:hover > .sub-menu {
    display: flex;
}

/* Indicate items with children */
.primary-navigation .menu-item-has-children > a::after {
    content: " ▸";
    font-size: 0.7em;
    opacity: 0.5;
}

/* Top-level items: down arrow instead */
.primary-navigation > ul > .menu-item-has-children > a::after {
    content: " ▾";
}

.primary-navigation .sub-menu a {
    padding: 0.4em 1em;
    font-size: 0.9rem;
    display: block;
    width: 100%;
    text-align: left;
}

/* === Tagged posts title links === */
.tagged-post-title {
    color: var(--wp--preset--color--foreground);
}

.tagged-post-title:hover {
    color: var(--wp--preset--color--primary);
}

/* === Filmstrip slideshow === */
.filmstrip {
    --filmstrip-height: 200px;
    --filmstrip-speed: 40s;
    position: relative;
    overflow: hidden;
    background: linear-gradient(to bottom, #ffffff 0%, transparent calc(100% - 3em));
    margin-top: 0;
    margin-bottom: -1.5em;
    margin-left: calc(-50vw + 50%);
    margin-right: 0;
    width: 100vw;
    padding: 1.2em 0 3em 0;
    border-top: none;
    border-bottom: none;
}

.filmstrip-track {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    width: max-content;
    animation: filmstrip-scroll var(--filmstrip-speed) linear infinite;
}

.filmstrip-track img {
    height: var(--filmstrip-height);
    width: auto;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.6);
    transition: box-shadow 0.3s, transform 0.3s;
}

.filmstrip-track a:hover img {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3), 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
    z-index: 1;
    position: relative;
}

@keyframes filmstrip-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.filmstrip-track:hover {
    animation-play-state: paused;
}

/* === Footer === */
.site-footer {
    border-radius: 16px 16px 0 0;
}

.site-footer a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.2s, text-shadow 0.2s;
}

.site-footer a:hover {
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.site-footer .wp-block-categories-list {
    list-style: none;
    padding-left: 0;
}

.site-footer .wp-block-categories-list li {
    padding: 0.2em 0;
}

.footer-social-icons .social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    transition: color 0.15s, transform 0.15s;
}

.footer-social-icons .social-icon:hover {
    color: #fff;
    transform: scale(1.15);
}

.popular-categories {
    list-style: none;
    padding-left: 0;
    margin: 0;
    font-size: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3em 0;
}

.popular-categories li {
    padding: 0.25em 0;
    white-space: nowrap;
}

.popular-categories li:not(:last-child)::after {
    content: " \00a0|\00a0 ";
    color: #666;
}

.top-articles {
    list-style: none;
    padding-left: 0;
    margin: 0;
    font-size: 0.9rem;
}

.top-articles li {
    padding: 0.4em 0;
    border-bottom: 1px solid #0E2725;
}

.top-articles li:last-child {
    border-bottom: none;
}

/* === Latest comments: remove default padding === */
.sidebar .wp-block-latest-comments {
    padding-left: 0;
    list-style: none;
}

.sidebar .wp-block-latest-comments li {
    padding: 0.4em 0;
}

/* === Sidebar fixed width === */
.site-columns > .wp-block-group {
    width: 100%;
}

.site-columns .sidebar {
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    flex-shrink: 0;
}

/* === Content area constrain === */
.site-columns .content-area {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
}

/* === Comment form button === */
.comment-respond .form-submit input {
    background: var(--wp--preset--color--primary);
    color: #fff;
    border: none;
    padding: 0.6em 1.5em;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.comment-respond .form-submit input:hover {
    background: var(--wp--preset--color--secondary);
    box-shadow: 0 4px 16px rgba(94, 134, 241, 0.3);
}

/* === Comment form inputs === */
.comment-respond input[type="text"],
.comment-respond input[type="email"],
.comment-respond input[type="url"],
.comment-respond textarea {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.6em 0.8em;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.comment-respond input:focus,
.comment-respond textarea:focus {
    border-color: var(--wp--preset--color--primary);
    box-shadow: 0 0 0 3px rgba(94, 134, 241, 0.1);
    outline: none;
}

/* === 404 styling === */
.error-404-title {
    font-size: 8rem;
    background: linear-gradient(135deg, #2a88bf, #39c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    font-weight: 800;
    text-align: center;
}

/* === Featured image rounded corners === */
.wp-block-post-featured-image img {
    border-radius: 8px;
}

/* === Search input styling === */
.wp-block-search {
    position: relative;
    z-index: 9999;
}

.wp-block-search__input {
    border-radius: 8px !important;
    border: 1px solid #ddd !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.wp-block-search__input:focus {
    border-color: var(--wp--preset--color--primary) !important;
    box-shadow: 0 0 0 3px rgba(94, 134, 241, 0.1);
    outline: none;
}

/* Search autosuggest dropdown above other elements */
.dgwt-wcas-suggestions-wrapp,
.searchwp-live-search-results,
.search-results-dropdown,
.scry-search-autosuggest-results,
.awesomplete > ul,
[class*="search"] [class*="result"],
[class*="search"] [class*="suggest"] {
    z-index: 10001 !important;
}

/* Scry Search autosuggest dropdown styling */
.scry-search-autosuggest-results {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
    padding: 0.4em 0 !important;
    max-height: 400px;
    overflow-y: auto;
}

.scry-search-autosuggest-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.scry-search-autosuggest-result-item {
    padding: 0.6em 1em !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04) !important;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 0.9rem;
}

.scry-search-autosuggest-result-item:last-child {
    border-bottom: none !important;
}

.scry-search-autosuggest-result-item:hover {
    background: rgba(94, 134, 241, 0.08);
}

.scry-search-autosuggest-results-close-button {
    top: 0.4em !important;
    right: 0.4em !important;
    font-size: 1rem;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.scry-search-autosuggest-results-close-button:hover {
    opacity: 1;
}

/* GTranslate below search/nav dropdowns */
.gtranslate_wrapper,
#gt-widget,
[class*="gtranslate"] {
    z-index: 999 !important;
}

.wp-block-search__button {
    border-radius: 8px !important;
    transition: background 0.2s, box-shadow 0.2s;
}

.wp-block-search__button:hover {
    box-shadow: 0 4px 12px rgba(94, 134, 241, 0.25);
}

/* === Tag cloud rounded pills === */
.wp-block-tag-cloud a {
    border-radius: 20px !important;
    padding: 0.3em 0.8em !important;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s !important;
}

.wp-block-tag-cloud a:hover {
    box-shadow: 0 2px 8px rgba(94, 134, 241, 0.2);
}

/* === Breadcrumb spacing === */
.breadcrumbs-wrapper {
    font-size: 0.85rem;
    color: #888;
}

/* === Responsive sidebar stacking === */
@media (max-width: 768px) {
    /* Filmstrip: smaller on mobile */
    .filmstrip {
        --filmstrip-height: 100px;
        padding: 0.6em 0;
        margin: 0.5em 0;
    }

    .filmstrip-track {
        gap: 6px;
    }

    /* Stack sidebar below content */
    .site-columns .wp-block-group.is-layout-flex:not(.post-meta-row) {
        flex-direction: column !important;
        flex-wrap: wrap !important;
    }

    .site-columns .sidebar {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        flex-basis: auto !important;
    }

    /* Hero post: stack image above text */
    .hero-post .wp-block-columns {
        flex-direction: column !important;
    }

    .hero-post .wp-block-column {
        flex-basis: 100% !important;
        width: 100% !important;
    }

    /* Grid posts: single column */
    .wp-block-post-template.is-layout-grid {
        grid-template-columns: 1fr !important;
    }

    /* Header: stack branding and nav */
    .site-header-inner {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5em;
    }

    /* Reset desktop nav height on mobile */
    .site-header-inner .primary-navigation {
        height: auto;
        align-items: flex-start;
        padding-bottom: 0;
    }

    /* Navigation: wrap on mobile with more spacing */
    .primary-navigation ul {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.2em 0.8em;
    }

    .primary-navigation a {
        padding: 0.4em 0.6em !important;
        line-height: 1.4 !important;
    }

    .primary-navigation {
        margin-top: 0.5em;
    }

    .primary-navigation .sub-menu {
        position: static;
        box-shadow: none;
        border: none;
        padding-left: 1em;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: transparent;
    }

    /* Logo: scale down but keep aspect ratio */
    .site-logo {
        width: auto !important;
        max-width: 100%;
    }

    .site-logo img {
        max-width: 100% !important;
        width: auto !important;
        height: auto !important;
    }

    /* 404 title */
    .error-404-title {
        font-size: 4rem;
    }
}

/* === Sidebar about box === */
.sidebar-about {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5em;
}

.sidebar-about-photo img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

/* === Home page: hero post === */
.hero-post .wp-block-post-featured-image img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

/* === Home page: grid posts === */
.grid-post .wp-block-post-featured-image img {
    width: 100%;
    object-fit: cover;
}

/* === News banner === */
.netammelat-news-banner {
    background-color: #e0e7fa;
    border: 1px solid #9eb2e7;
    border-left: 5px solid #082269;
    border-radius: 8px;
    padding: 1.2em 1.5em;
    margin-bottom: 1.5em;
    color: #082269;
    box-shadow: 0 4px 12px rgba(8, 34, 105, 0.12);
    position: relative;
    overflow: hidden;
    animation: news-pulse 2.5s ease-in-out infinite;
}

.netammelat-news-banner:hover {
    animation: none;
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(8, 34, 105, 0.12);
}

@keyframes news-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(8, 34, 105, 0.12);
    }
    50% {
        transform: scale(1.015);
        box-shadow: 0 6px 24px rgba(8, 34, 105, 0.25), 0 0 16px rgba(158, 178, 231, 0.4);
    }
}

.netammelat-news-banner::before {
    content: '❗👀❗';
    position: absolute;
    top: 0.8em;
    right: 1em;
    font-size: 1.4rem;
    opacity: 0.6;
}

.netammelat-news-banner-title {
    font-size: 1.1rem;
    margin: 0 0 0.4em;
}

.netammelat-news-banner-content {
    font-size: 0.9rem;
    color: #082269;
}

.netammelat-news-banner-content p {
    margin: 0 0 0.4em;
}

.netammelat-news-banner-content p:last-child {
    margin-bottom: 0;
}

.netammelat-news-banner-content a {
    color: #082269;
    text-decoration: underline;
}

.netammelat-news-banner-content a:hover {
    opacity: 0.7;
}

/* === Smash Balloon Instagram Feed: explicit sizing to prevent CLS === */
#sb_instagram .sbi_photo img,
#sbi_images .sbi_photo img,
.sbi_item .sbi_photo img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center;
}
