/**
 * Radio Station Theme - Main Layout Styles
 * Mobile-first responsive design
 * 
 * @package Radio_Station_Theme
 */

/* ==========================================================================
   CSS Reset & Base Styles
   ========================================================================== */

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;       /* clip — doesn't create scroll container, preserves position:sticky */
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif);
    font-size: var(--font-size-base, 16px);
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
    overflow-x: clip;       /* clip horizontal overflow WITHOUT creating a scroll container (preserves sticky) */
}

/* Barba wrapper — clip horizontal overflow without breaking position:sticky */
[data-barba="wrapper"] {
    overflow-x: clip;
    width: 100%;
}

/* ==========================================================================
   Main Container & Content Area
   ========================================================================== */

.site-main {
    min-height: 60vh;
    padding: 20px 0;
    overflow-x: clip;       /* clip without creating scroll container */
}

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
}

.content-area {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    max-width: 100%;
    min-width: 0;
}

.content-full-width {
    grid-column: 1 / -1;
}

/* ==========================================================================
   Sidebar Layout
   ========================================================================== */

@media (min-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr 300px;
    }

    .content-area {
        grid-column: 1;
    }

    .sidebar {
        grid-column: 2;
    }

    /* Full width content (no sidebar) */
    .main-container:has(.content-full-width) {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Posts Grid
   ========================================================================== */

.posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (min-width: 600px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==========================================================================
   Post/Page Content
   ========================================================================== */

article {
    margin-bottom: 40px;
}

/* --- Sticky post highlight (blog index) --- */

.posts-grid article.sticky {
    position: relative;
    border: 2px solid var(--color-primary, #667eea);
    border-radius: 10px;
    padding: 12px;
}

.posts-grid article.sticky::before {
    content: 'Istaknuto';
    position: absolute;
    top: -1px;
    left: 16px;
    z-index: 5;
    background: var(--color-primary, #667eea);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 10px;
    border-radius: 0 0 4px 4px;
    line-height: 1.5;
}

/* --- Post card overlay style (archive/blog/search) --- */

.posts-grid .post-card-link {
    display: block;
    text-decoration: none;
    color: #fff;
    border-radius: 10px;
    overflow: hidden;
}

.posts-grid .post-thumbnail {
    position: relative;
    height: 280px;
    margin-bottom: 0;
    border-radius: 10px;
    overflow: hidden;
}

.posts-grid .post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.posts-grid .post-card-link:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-thumbnail-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
    z-index: 1;
    pointer-events: none;
}

.post-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 20px;
}

.post-card-cat {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffd700;
    background: rgba(0,0,0,0.3);
    padding: 2px 8px;
    border-radius: 3px;
    margin-bottom: 8px;
}

.posts-grid .post-card-content .entry-title {
    color: #fff;
    font-size: 18px;
    line-height: 1.35;
    margin: 0 0 8px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.posts-grid .post-card-content .entry-meta {
    color: rgba(255,255,255,0.8);
    font-size: 12px;
    gap: 6px;
}

.posts-grid .post-card-content .meta-sep {
    color: rgba(255,255,255,0.4);
}

@media (min-width: 1200px) {
    .posts-grid .post-thumbnail {
        height: 300px;
    }
}

@media (max-width: 600px) {
    .main-container {
        padding: 0 10px;
    }

    .content-area {
        padding: 15px;
    }

    .posts-grid .post-thumbnail {
        height: 240px;
    }
}

.post-thumbnail {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
}

.post-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

.entry-header {
    margin-bottom: 20px;
}

.entry-title {
    margin: 0 0 15px;
    font-size: 32px;
    line-height: 1.3;
    color: #1a1a1a;
    font-family: var(--font-heading, inherit);
}

.entry-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.entry-title a:hover {
    color: #667eea;
}

.entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 14px;
    color: #666;
}

.entry-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.entry-content {
    line-height: 1.8;
    font-size: 18px;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Contain all block/plugin elements within content width */
.entry-content > * {
    max-width: 100%;
    box-sizing: border-box;
}

.entry-content p {
    margin: 0 0 20px;
}

.entry-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* ==========================================================================
   WordPress Block Alignment (alignfull / alignwide)
   Theme provides align-wide support — these rules keep blocks contained.
   ========================================================================== */

.entry-content > .alignwide {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.entry-content > .alignfull {
    max-width: 100%;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* Override WP core 100vw alignment — our layout is already full-width inside the content area */
.content-full-width .entry-content > .alignfull {
    width: calc(100% + 60px);    /* break out of the 30px padding */
    max-width: calc(100% + 60px);
    margin-left: -30px;
    margin-right: -30px;
}

@media (min-width: 783px) {
    .content-full-width .entry-content > .alignfull {
        width: calc(100% + 80px);  /* break out of the 40px desktop padding */
        max-width: calc(100% + 80px);
        margin-left: -40px;
        margin-right: -40px;
    }
}

.entry-content > .alignleft {
    float: left;
    margin-right: 2em;
    margin-bottom: 1em;
    max-width: 50%;
}

.entry-content > .alignright {
    float: right;
    margin-left: 2em;
    margin-bottom: 1em;
    max-width: 50%;
}

.entry-content > .aligncenter {
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   Gutenberg block containment
   ========================================================================== */

/* Prevent blocks from exceeding parent width */
.entry-content [class*="wp-block-"],
.entry-content .wp-block-group,
.entry-content .wp-block-columns,
.entry-content .wp-block-cover {
    max-width: 100%;
    box-sizing: border-box;
}

/* Media embeds */
.entry-content iframe,
.entry-content video,
.entry-content embed,
.entry-content object {
    max-width: 100%;
}

.entry-content table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    margin: 30px 0 15px;
    line-height: 1.3;
    color: #1a1a1a;
    font-family: var(--font-heading, inherit);
}

.entry-content h2 {
    font-size: 28px;
}

.entry-content h3 {
    font-size: 24px;
}

.entry-content ul,
.entry-content ol {
    margin: 0 0 20px;
    padding-left: 30px;
}

.entry-content li {
    margin-bottom: 8px;
}

.entry-content a {
    color: #667eea;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: text-decoration-color 0.3s ease;
}

.entry-content a:hover {
    text-decoration-color: #667eea;
}

.entry-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.tags a {
    display: inline-block;
    padding: 5px 12px;
    background: #f0f0f0;
    color: #666;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.tags a:hover {
    background: #667eea;
    color: #fff;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
    display: flex;
    justify-content: center;
    margin: 40px 0;
}

.pagination .nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 8px 16px;
    background: #fff;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.pagination a:hover {
    background: #667eea;
    color: #fff;
}

.pagination .current {
    background: #667eea;
    color: #fff;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.widget {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.widget-title {
    margin: 0 0 20px;
    font-size: 20px;
    color: #1a1a1a;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.widget ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget li {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.widget li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.widget a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.widget a:hover {
    color: #667eea;
}

/* ==========================================================================
   Widget Areas
   ========================================================================== */

.before-content-widgets,
.after-content-widgets {
    margin: 40px 0;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    max-width: 100%;
}

/* ==========================================================================
   Forms
   ========================================================================== */

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="date"],
textarea,
select {
    width: 100%;
    min-height: 44px;
    padding: 12px 15px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    transition: border-color 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

button,
.button,
input[type="submit"],
input[type="button"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    color: #fff;
    background: #667eea;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

button:hover,
.button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

button:active,
.button:active {
    transform: translateY(0);
}

/* ==========================================================================
   Barba.js Transitions
   ========================================================================== */

[data-barba="container"] {
    transition: opacity 0.3s ease;
}

[data-barba="container"].is-leaving {
    opacity: 0;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* Mobile: up to 600px - base styles above */

/* Tablet: 601px to 782px */
@media (min-width: 601px) and (max-width: 782px) {
    .site-main {
        padding: 30px 0;
    }

    .entry-title {
        font-size: 28px;
    }

    .entry-content {
        font-size: 17px;
    }
}

/* Desktop: 783px and up */
@media (min-width: 783px) {
    .site-main {
        padding: 60px 0;
    }

    .content-area {
        padding: 40px;
    }
}

/* Large Desktop: 1200px and up */
@media (min-width: 1200px) {
    .entry-content {
        font-size: 19px;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
