/**
 * Theme Name: Frontera42 Stories
 * Template: twentytwentyfive
 * Version: 1.0.0
 * Author:
 * License: GPL v2 or later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: frontera42-stories
 */

:root {
    --bg-primary: #faf9f6;
    --bg-secondary: #fffefc;
    --text-main: #3c3836;
    --text-muted: #a89f91;
    --accent: #d5c4a1;
    --border: #eee8da;
    --font-heading: 'Inter', system-ui, sans-serif;
    --text-soft: #78706a;
    --text-paragraph: #4a4a4a;
    --card-bg: #ffffff;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.04);
    --card-shadow-hover: 0 16px 48px rgba(0,0,0,0.06);
    --lb-bg: #1e1e1e;
    --lb-text: #e8e4df;
    --lb-meta: #a89f91;
    --lb-border: rgba(255,255,255,0.06);
    --blockquote-bg: #f5f3ee;
}

[data-theme="dark"] {
    --bg-primary: #141414;
    --bg-secondary: #1c1c1c;
    --text-main: #e8e4df;
    --text-muted: #666;
    --accent: #b8a77d;
    --border: #2a2a2a;
    --text-soft: #888;
    --text-paragraph: #c8c4bf;
    --card-bg: #1e1e1e;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.2);
    --card-shadow-hover: 0 16px 48px rgba(0,0,0,0.3);
    --lb-bg: #111;
    --lb-text: #e8e4df;
    --lb-meta: #888;
    --lb-border: rgba(255,255,255,0.04);
    --blockquote-bg: #1a1816;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-family: var(--font-heading);
    line-height: 1.6;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s ease, color 0.3s ease;
}

body {
    margin: 0;
    padding: 0;
    color: var(--text-main);
    background: var(--bg-primary);
    font-size: 16px;
    line-height: 1.8;
    transition: background 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 1rem 0;
    color: var(--text-main);
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.8rem, 8vw, 5rem); line-height: 0.95; margin-bottom: 1.5rem; }
h2 { font-size: clamp(2rem, 6vw, 3.5rem); letter-spacing: -0.03em; line-height: 1.1; }
h3 { font-size: 1.8rem; margin-bottom: 0.8rem; }

p {
    margin: 0 0 1.5rem 0;
    color: var(--text-paragraph);
    line-height: 1.9;
}

a {
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover { color: var(--accent); }

/* HEADER ============== */
.site-header {
    padding: clamp(4rem, 8vw, 6rem) 0 clamp(2rem, 5vw, 3rem);
    text-align: center;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

.header-top .top-left .site-title-link {
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    line-height: 0.97;
    letter-spacing: -0.04em;
    color: var(--text-soft);
    display: inline-block;
    transition: transform 0.3s ease, color 0.3s ease;
}

.header-top .top-left .site-title-link:hover {
    transform: scale(1.03);
    color: var(--accent);
}

.top-right { display: none; }

/* THEME TOGGLE ============== */
.theme-toggle-btn {
    position: fixed;
    top: 1.2rem;
    right: 1.2rem;
    z-index: 9999;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-soft);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.theme-toggle-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: rotate(15deg);
}

.theme-toggle-btn svg {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-theme="dark"] .theme-toggle-btn .sun-icon {
    opacity: 1;
    transform: scale(1);
}

[data-theme="dark"] .theme-toggle-btn .moon-icon {
    opacity: 0;
    transform: scale(0.5);
}

.theme-toggle-btn .sun-icon {
    opacity: 0;
    transform: scale(0.5);
}

.theme-toggle-btn .moon-icon {
    opacity: 1;
    transform: scale(1);
}

.menu-toggle,
#masthead .menu-icon,
.tenfoot-menu,
#masthead button {
    display: none !important;
}

/* HOME PAGE ============== */
.site-main.home {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(3rem, 6vw, 5rem) clamp(2rem, 4vw, 4rem);
}

.home-tagline {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.6;
    margin-bottom: clamp(4rem, 8vw, 6rem);
}

.grid-stories {
    display: grid;
    gap: clamp(2.5rem, 4vw, 4rem);
    max-width: 100ch;
    margin: 0 auto;
}

.grid-stories .story-card {
    background: var(--bg-secondary);
    padding: clamp(2rem, 4vw, 3.5rem);
    border-radius: 32px;
    transition: all 0.4s cubic-bezier(0.4,0,0.2,1);
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(0,0,0,0.03);
}

.grid-stories .story-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 48px rgba(0,0,0,0.06);
}

.grid-stories .story-card .sys-label {
    text-align: left;
    margin-bottom: 0.8rem;
}

.grid-stories .story-card header a {
    font-size: clamp(1.5rem, 3.5vw, 2.2rem);
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
    display: block;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    transition: color 0.3s ease;
}

.grid-stories .story-card:hover header a {
    color: var(--accent);
}

.grid-stories .story-card .story-excerpt {
    font-size: 1.1rem;
    color: var(--text-soft);
    line-height: 1.9;
    margin: 0.8rem 0 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: justify;
    hyphens: auto;
    overflow-wrap: break-word;
    word-break: break-word;
}

.grid-stories .story-card .story-featured {
    margin: 1rem 0 0.5rem;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 16 / 10;
}

.grid-stories .story-card .story-featured img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 16px;
}

.grid-stories .story-card footer {
    border: none;
    padding: 0;
    margin: 0;
}

.read-more {
    display: inline-block;
    font-size: 1.05rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
    position: relative;
    padding-left: 1.8rem;
}

.read-more::before {
    content: "→";
    position: absolute;
    left: 0;
    font-size: 1.05rem;
    transition: transform 0.3s ease;
}

.story-card:hover .read-more {
    color: var(--accent);
    padding-left: 2.2rem;
}

.story-card:hover .read-more::before {
    transform: translateX(4px);
}

/* SINGLE STORY ============== */
.site-main.single-story {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(3rem, 6vw, 5rem) clamp(2rem, 4vw, 4rem);
}

.site-main.single-story .story-article,
.site-main.single .story-article {
    max-width: 85ch;
    margin: 0 auto;
    background: var(--bg-secondary);
    padding: clamp(2.5rem, 5vw, 5rem) clamp(2rem, 5vw, 5rem);
    border-radius: 32px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.03);
}

.story-article .sys-label {
    font-size: 1.1rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 1.5rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.7;
    text-align: center;
}

.story-article header h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.1;
    letter-spacing: -0.04em;
    margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
    text-align: center;
    color: var(--text-main);
    max-width: 100%;
    word-break: break-word;
}

.story-featured {
    max-width: 100%;
    margin: clamp(2rem, 4vw, 3rem) auto;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0,0,0,0.05);
}

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

.story-article .entry-content {
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    line-height: 2;
    color: var(--text-paragraph);
    max-width: 75ch;
    margin: 0 auto;
}

.story-article .entry-content p {
    margin-bottom: 1.8rem;
    line-height: 2;
    text-align: justify;
    hyphens: auto;
    word-spacing: 0.05em;
    overflow-wrap: break-word;
    word-break: break-word;
}

.story-article .entry-content p:first-of-type {
    margin-top: 0;
}

.story-article .entry-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 500;
}

.story-article .entry-content .wp-block-image {
    margin: clamp(3rem, 6vw, 5rem) auto;
    text-align: center;
}

.story-article .entry-content .wp-block-image img {
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.07);
}

.story-article .entry-content blockquote {
    border-left: 4px solid var(--accent);
    padding: clamp(1.5rem, 3vw, 2.5rem) clamp(2rem, 3vw, 2.5rem);
    margin: clamp(2.5rem, 4vw, 4rem) 0;
    background: var(--blockquote-bg);
    border-radius: 0 16px 16px 0;
    font-style: italic;
    color: var(--text-soft);
    font-size: clamp(1.2rem, 2vw, 1.45rem);
}

.entry-content figure {
    margin: 0;
}

.story-article footer {
    text-align: center;
    margin-top: clamp(4rem, 8vw, 6rem);
    padding-top: clamp(2.5rem, 4vw, 3.5rem);
    border-top: 1px solid var(--border);
}

.story-article footer .read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 40px;
    border: 1px solid var(--border);
}

.story-article footer .read-more::before {
    content: "←";
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    position: static;
}

.story-article footer .read-more:hover {
    color: var(--accent);
    border-color: var(--accent);
    gap: 1rem;
}

.story-article footer .read-more:hover::before {
    transform: translateX(-4px);
}

/* SINGLE (fallback) ============== */
.site-main.single {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(3rem, 6vw, 5rem) clamp(2rem, 4vw, 4rem);
}

.site-main.single .story-article {
    max-width: 85ch;
    margin: 0 auto;
    background: var(--bg-secondary);
    padding: clamp(2.5rem, 5vw, 5rem) clamp(2rem, 5vw, 5rem);
    border-radius: 32px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.03);
}

.site-main.single .entry-content {
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    line-height: 2;
    max-width: 75ch;
    margin: 0 auto;
}

.site-main.single .entry-content p {
    line-height: 2;
    margin-bottom: 1.8rem;
    text-align: justify;
    hyphens: auto;
    word-spacing: 0.05em;
    overflow-wrap: break-word;
    word-break: break-word;
}

.site-main.single .entry-content p:first-of-type {
    margin-top: 0;
}

/* FOOTER ============== */
.site-footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(4rem, 8vw, 6rem) clamp(2rem, 4vw, 4rem) clamp(3rem, 5vw, 4rem);
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-logo {
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -0.04em;
    color: var(--text-soft);
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

.footer-logo:hover {
    transform: scale(1.05);
    color: var(--accent);
}

.footer-bottom {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-social {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.footer-social a:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-3px);
}

/* ARCHIVE ============== */
.site-main.archive {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(3rem, 6vw, 5rem) clamp(2rem, 4vw, 4rem);
}

.archive-header h3 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    line-height: 1;
    letter-spacing: -0.05em;
    margin-bottom: clamp(2rem, 5vw, 4rem);
    color: var(--text-soft);
    text-transform: lowercase;
    opacity: 0.7;
}

.archive-header h3::before {
    content: "// ";
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--accent);
}

.navigation {
    display: flex;
    justify-content: center;
    gap: clamp(2rem, 5vw, 4rem);
    margin-top: clamp(4rem, 10vw, 6rem);
    padding-top: clamp(2rem, 4vw, 3rem);
    border-top: 1px solid var(--border);
}

.navigation span {
    font-size: 1.2rem;
    color: var(--text-soft);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.6;
}

.navigation span:hover {
    color: var(--accent);
    opacity: 1;
    transform: translateY(-4px);
}

/* SEARCH ============== */
.search-results-section .section-header h3 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    line-height: 1;
    letter-spacing: -0.05em;
    margin-bottom: clamp(2rem, 5vw, 4rem);
    color: var(--text-soft);
}

.search-results-section p {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: clamp(4rem, 10vw, 6rem);
    color: var(--accent);
    opacity: 0.9;
}

/* WIDGETS ============== */
.widget-sidebar {
    padding: clamp(2rem, 5vw, 3rem) 0;
    max-width: 80ch;
    margin-left: auto;
    margin-right: auto;
    border-left: 1px solid var(--border);
}

.widget-sidebar .widget-title h3 {
    font-size: 1.5rem;
    letter-spacing: -0.03em;
    margin-bottom: clamp(2rem, 5vw, 4rem);
    color: var(--text-soft);
    text-transform: lowercase;
    opacity: 0.7;
}

/* RESPONSIVE ============== */
@media (max-width: 968px) {
    .header-top { flex-direction: column; gap: 1rem; text-align: center; }
}

@media (max-width: 640px) {
    h1 { font-size: clamp(2.2rem, 7vw, 3.5rem); }
    .grid-stories { grid-template-columns: 1fr; gap: 1.5rem; }
    .story-card { padding: 1.5rem; border-radius: 16px; }
}

/* FOCUS & ANIMATIONS ============== */
*:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.story-card {
    animation: fadeUp 0.5s ease forwards;
    opacity: 0;
}

.story-card:nth-child(2) { animation-delay: 0.1s; }
.story-card:nth-child(3) { animation-delay: 0.2s; }
.story-card:nth-child(4) { animation-delay: 0.3s; }
.story-card:nth-child(5) { animation-delay: 0.4s; }

/* LIGHTBOX — MUSEO ============== */
.lb-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.35s ease;
    cursor: zoom-out;
    padding: 2rem;
}

.lb-overlay.lb-active { opacity: 1; }

.lb-card {
    display: flex;
    max-width: 1100px;
    max-height: 85vh;
    width: 100%;
    background: #1e1e1e;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0,0,0,0.5);
    transition: opacity 0.25s ease, transform 0.25s ease;
    cursor: default;
}

.lb-img-col {
    flex: 1 1 60%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    min-height: 300px;
}

.lb-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    max-height: 85vh;
}

.lb-info-col {
    flex: 0 0 320px;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
    border-left: 1px solid rgba(255,255,255,0.06);
    background: #1e1e1e;
}

.lb-info-title {
    font-size: 1.4rem;
    line-height: 1.3;
    letter-spacing: -0.03em;
    color: #e8e4df;
    margin: 0;
}

.lb-info-caption {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-muted);
    margin: 0;
}

.lb-info-meta {
    font-size: 0.8rem;
    color: #666;
    letter-spacing: 0.03em;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.lb-nav {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(0,0,0,0.5);
    padding: 0.6rem 1.2rem;
    border-radius: 40px;
    backdrop-filter: blur(8px);
    z-index: 100000;
}

.lb-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 0.9rem;
    font-family: var(--font-heading);
    padding: 0.3rem 0.6rem;
    transition: color 0.2s ease;
}

.lb-nav-btn:hover { color: #fff; }

.lb-nav-btn span {
    display: none;
}

@media (min-width: 640px) {
    .lb-nav-btn span { display: inline; }
}

.lb-nav-counter {
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
    font-family: var(--font-heading);
    letter-spacing: 0.05em;
}

.lb-close {
    position: fixed;
    top: 1.2rem;
    right: 1.2rem;
    background: rgba(0,0,0,0.3);
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    z-index: 100000;
}

.lb-close:hover {
    background: rgba(0,0,0,0.5);
    color: #fff;
}

@media (max-width: 768px) {
    .lb-card {
        flex-direction: column;
        max-height: 90vh;
        border-radius: 16px;
    }
    .lb-img-col {
        flex: none;
        height: 50vh;
        min-height: 200px;
    }
    .lb-info-col {
        flex: none;
        padding: 1.5rem;
        border-left: none;
        border-top: 1px solid var(--border);
    }
    .lb-overlay { padding: 1rem; }
}
