/*
Theme Name: Bakas Lighthouse
Theme URI: https://bakas.lv/
Author: Bakas.lv
Author URI: https://bakas.lv/
Description: Кастомная тема для сайта о маяках Латвии. Морская цветовая палитра, крупные фотографии, поддержка мультиязычности (Polylang).
Version: 1.0.0
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: bakas-lighthouse
Tags: custom, blog, one-column, two-columns, right-sidebar, custom-menu, featured-images, translation-ready
*/

:root {
    --color-sea-deep: #0a2540;
    --color-sea-mid: #1e4a78;
    --color-sea-light: #7fb3d5;
    --color-sand: #f5efe1;
    --color-white: #ffffff;
    --color-lantern: #d4381d;
    --color-lantern-glow: #f4a341;
    --color-text: #1a2a3a;
    --color-muted: #6c7a8a;
    --color-border: #e2e8ee;

    --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;

    --shadow-sm: 0 1px 3px rgba(10, 37, 64, 0.08);
    --shadow-md: 0 4px 12px rgba(10, 37, 64, 0.10);
    --shadow-lg: 0 12px 40px rgba(10, 37, 64, 0.16);

    --radius-sm: 4px;
    --radius-md: 10px;
    --radius-lg: 20px;

    --container-width: 1200px;
    --content-width: 780px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-sand);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }

a {
    color: var(--color-sea-mid);
    text-decoration: none;
    transition: color 0.2s ease;
}
a:hover { color: var(--color-lantern); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    color: var(--color-sea-deep);
    line-height: 1.25;
    margin: 0 0 0.7em;
    font-weight: 600;
    letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h3 { font-size: clamp(1.3rem, 2.5vw, 1.7rem); }
h4 { font-size: 1.2rem; }

p { margin: 0 0 1.2em; }

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
}

.container-narrow {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 24px;
}

.screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ==================== HEADER ==================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 37, 64, 0.96);
    backdrop-filter: blur(10px);
    color: var(--color-white);
    box-shadow: var(--shadow-sm);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 24px;
    max-width: var(--container-width);
    margin: 0 auto;
}

.site-branding { display: flex; align-items: center; gap: 14px; }

.site-logo {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: linear-gradient(140deg, var(--color-lantern), var(--color-lantern-glow));
    display: flex; align-items: center; justify-content: center;
    color: white;
    box-shadow: 0 0 20px rgba(212, 56, 29, 0.5);
    flex-shrink: 0;
}
.site-logo svg { width: 26px; height: 26px; }

.site-title {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    color: var(--color-white);
    letter-spacing: 0.01em;
}
.site-title a { color: inherit; }
.site-title a:hover { color: var(--color-lantern-glow); }
.site-tagline {
    font-size: 0.75rem;
    color: var(--color-sea-light);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 2px;
}

.main-navigation ul {
    display: flex;
    gap: 6px;
    list-style: none;
    margin: 0; padding: 0;
}
.main-navigation a {
    color: var(--color-white);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
}
.main-navigation a:hover,
.main-navigation .current-menu-item > a,
.main-navigation .current_page_item > a {
    background: rgba(255,255,255,0.1);
    color: var(--color-lantern-glow);
}

.lang-switcher {
    display: flex;
    gap: 4px;
    align-items: center;
    padding-left: 12px;
    border-left: 1px solid rgba(255,255,255,0.15);
    margin-left: 4px;
}
.lang-switcher a, .lang-switcher span {
    padding: 4px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    color: var(--color-sea-light);
}
.lang-switcher .current-lang, .lang-switcher a:hover {
    background: var(--color-lantern);
    color: white;
}

.menu-toggle {
    display: none;
    background: none; border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 4px 10px;
}

@media (max-width: 900px) {
    .menu-toggle { display: block; }
    .main-navigation {
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: var(--color-sea-deep);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s;
    }
    .main-navigation.is-open { max-height: 500px; }
    .main-navigation ul { flex-direction: column; padding: 12px; }
    .lang-switcher { border: none; margin: 8px 0 0; padding: 0; }
}

/* ==================== HERO ==================== */
.hero {
    position: relative;
    color: white;
    padding: 120px 0 100px;
    text-align: center;
    background:
        linear-gradient(180deg, rgba(10,37,64,0.55) 0%, rgba(10,37,64,0.85) 100%),
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 400"><defs><linearGradient id="g" x1="0" x2="0" y1="0" y2="1"><stop offset="0" stop-color="%231e4a78"/><stop offset="1" stop-color="%230a2540"/></linearGradient></defs><rect fill="url(%23g)" width="1200" height="400"/><path fill="%230a2540" opacity=".4" d="M0,300 Q300,240 600,290 T1200,280 L1200,400 L0,400 Z"/><path fill="%230a2540" opacity=".6" d="M0,340 Q300,290 600,330 T1200,320 L1200,400 L0,400 Z"/></svg>');
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 0; right: 0;
    height: 60px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 60" preserveAspectRatio="none"><path fill="%23f5efe1" d="M0,60 L0,20 Q300,60 600,30 T1200,20 L1200,60 Z"/></svg>') no-repeat center/cover;
}

.hero-inner { position: relative; z-index: 2; max-width: 800px; margin: 0 auto; padding: 0 24px; }
.hero h1 {
    color: white;
    font-size: clamp(2.4rem, 6vw, 4rem);
    margin-bottom: 20px;
    text-shadow: 0 2px 20px rgba(0,0,0,0.3);
}
.hero-subtitle {
    font-size: 1.2rem;
    color: var(--color-sea-light);
    max-width: 640px;
    margin: 0 auto 32px;
    line-height: 1.6;
}
.hero-cta {
    display: inline-block;
    padding: 14px 32px;
    background: var(--color-lantern);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(212, 56, 29, 0.4);
}
.hero-cta:hover {
    background: var(--color-lantern-glow);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(212, 56, 29, 0.6);
}

/* ==================== POST GRID (archive/home) ==================== */
.main-content { padding: 60px 0 100px; }

.section-title {
    text-align: center;
    margin-bottom: 48px;
}
.section-title h2 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    margin-bottom: 8px;
}
.section-title p {
    color: var(--color-muted);
    font-size: 1.05rem;
    margin: 0;
}
.section-title .divider {
    width: 60px;
    height: 3px;
    background: var(--color-lantern);
    margin: 20px auto 24px;
    border-radius: 3px;
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
}

.post-card {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    position: relative;
}
.post-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.post-card-image {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: linear-gradient(135deg, var(--color-sea-mid), var(--color-sea-deep));
    position: relative;
}
.post-card-image img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.5s;
}
.post-card:hover .post-card-image img { transform: scale(1.05); }

.post-card-image.no-image::after {
    content: '⚓';
    position: absolute;
    inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.3);
    font-size: 4rem;
}

.post-card-category {
    position: absolute;
    top: 16px; left: 16px;
    padding: 6px 14px;
    background: var(--color-lantern);
    color: white;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: 100px;
    z-index: 2;
}

.post-card-content {
    padding: 24px 26px 28px;
    display: flex; flex-direction: column; flex-grow: 1;
}
.post-card-content h3 {
    font-size: 1.4rem;
    margin: 0 0 14px;
    line-height: 1.3;
}
.post-card-content h3 a { color: var(--color-sea-deep); }
.post-card-content h3 a:hover { color: var(--color-lantern); }

.post-card-excerpt {
    color: var(--color-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    flex-grow: 1;
    margin-bottom: 18px;
}

.post-card-meta {
    display: flex;
    gap: 14px;
    align-items: center;
    font-size: 0.85rem;
    color: var(--color-muted);
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}
.post-card-meta .read-more {
    margin-left: auto;
    color: var(--color-sea-mid);
    font-weight: 600;
    display: inline-flex; align-items: center; gap: 4px;
}
.post-card-meta .read-more::after {
    content: '→';
    transition: transform 0.2s;
}
.post-card:hover .read-more::after { transform: translateX(4px); }

/* ==================== SINGLE POST ==================== */
.single-post-header {
    position: relative;
    color: white;
    padding: 80px 24px 100px;
    text-align: center;
    background: linear-gradient(180deg, var(--color-sea-deep) 0%, var(--color-sea-mid) 100%);
    overflow: hidden;
}
.single-post-header::before {
    content: '';
    position: absolute; inset: 0;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="1" fill="%23fff" opacity=".08"/></svg>');
    background-size: 40px 40px;
    opacity: 0.5;
}
.single-post-header::after {
    content: '';
    position: absolute; bottom: -1px; left: 0; right: 0; height: 60px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 60" preserveAspectRatio="none"><path fill="%23f5efe1" d="M0,60 L0,20 Q300,60 600,30 T1200,20 L1200,60 Z"/></svg>') no-repeat center/cover;
}

.single-post-header-inner { position: relative; z-index: 2; max-width: 900px; margin: 0 auto; }
.single-post-header h1 {
    color: white;
    font-size: clamp(2rem, 5vw, 3.4rem);
    margin-bottom: 20px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.post-category-badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--color-lantern);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 100px;
    margin-bottom: 24px;
}
.post-meta-header {
    color: var(--color-sea-light);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}
.post-meta-header span + span::before { content: ' • '; margin: 0 6px; }

.single-post-body {
    background: white;
    max-width: 900px;
    margin: -40px auto 60px;
    padding: 48px clamp(24px, 5vw, 64px);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 5;
}

.post-hero-image {
    margin: -48px clamp(-24px, -5vw, -64px) 48px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.post-hero-image img { width: 100%; height: 100%; object-fit: cover; }

.entry-content {
    font-size: 1.08rem;
    line-height: 1.85;
    color: #2d3e50;
}
.entry-content p { margin-bottom: 1.4em; }
.entry-content p:first-of-type::first-letter {
    font-family: var(--font-serif);
    font-size: 3.4em;
    line-height: 0.9;
    float: left;
    margin: 6px 12px 0 0;
    color: var(--color-lantern);
    font-weight: 600;
}

.entry-content img { border-radius: var(--radius-sm); margin: 1.5em 0; box-shadow: var(--shadow-sm); }

/* Specifications table */
.lighthouse-specs {
    background: linear-gradient(135deg, var(--color-sand), #fff);
    border-radius: var(--radius-md);
    padding: 32px;
    margin: 40px 0;
    border-left: 4px solid var(--color-lantern);
    box-shadow: var(--shadow-sm);
}
.lighthouse-specs h3 {
    display: flex; align-items: center; gap: 10px;
    margin: 0 0 20px;
    font-size: 1.3rem;
    color: var(--color-sea-deep);
}
.lighthouse-specs h3::before { content: '⚓'; color: var(--color-lantern); }
.lighthouse-specs table {
    width: 100%;
    border-collapse: collapse;
}
.lighthouse-specs td {
    padding: 12px 4px;
    border-bottom: 1px dashed var(--color-border);
    font-size: 0.98rem;
}
.lighthouse-specs td:first-child {
    color: var(--color-muted);
    font-weight: 500;
    width: 45%;
}
.lighthouse-specs td:last-child {
    color: var(--color-sea-deep);
    font-weight: 600;
    text-align: right;
}
.lighthouse-specs tr:last-child td { border-bottom: none; }

/* Post navigation */
.post-navigation {
    max-width: 900px;
    margin: 40px auto 60px;
    padding: 0 24px;
}
.post-navigation .nav-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.post-navigation a {
    display: block;
    background: white;
    padding: 20px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    color: var(--color-text);
}
.post-navigation a:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.post-navigation .nav-previous a { text-align: left; }
.post-navigation .nav-next a { text-align: right; }
.post-navigation .meta-nav {
    display: block;
    color: var(--color-muted);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.post-navigation .nav-title {
    color: var(--color-sea-deep);
    font-weight: 600;
    font-family: var(--font-serif);
}

/* Archive/Category header */
.archive-header {
    text-align: center;
    padding: 100px 24px 60px;
    background: linear-gradient(180deg, var(--color-sea-deep), var(--color-sea-mid));
    color: white;
    position: relative;
    overflow: hidden;
}
.archive-header::after {
    content: '';
    position: absolute; bottom: -1px; left: 0; right: 0; height: 60px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 60" preserveAspectRatio="none"><path fill="%23f5efe1" d="M0,60 L0,20 Q300,60 600,30 T1200,20 L1200,60 Z"/></svg>') no-repeat center/cover;
}
.archive-header h1 { color: white; margin-bottom: 12px; }
.archive-header p { color: var(--color-sea-light); max-width: 640px; margin: 0 auto; }

/* Footer */
.site-footer {
    background: var(--color-sea-deep);
    color: rgba(255,255,255,0.85);
    padding: 60px 0 30px;
    margin-top: 40px;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 40px;
}
@media (max-width: 720px) {
    .footer-grid { grid-template-columns: 1fr; gap: 32px; }
}
.site-footer h4 {
    color: white;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.site-footer a {
    color: var(--color-sea-light);
    display: inline-block;
    padding: 4px 0;
}
.site-footer a:hover { color: var(--color-lantern-glow); }
.footer-about p { font-size: 0.95rem; line-height: 1.7; margin: 0; color: rgba(255,255,255,0.7); }
.footer-menu ul, .footer-contact ul { list-style: none; margin: 0; padding: 0; }
.footer-menu li, .footer-contact li { margin-bottom: 6px; font-size: 0.95rem; }

.site-footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.55);
    font-size: 0.88rem;
}

/* Utility */
.text-center { text-align: center; }
.mt-lg { margin-top: 60px; }

/* Responsive tweaks */
@media (max-width: 720px) {
    .hero { padding: 80px 0 70px; }
    .single-post-body { padding: 32px 20px; margin-top: -20px; }
    .post-hero-image { margin: -32px -20px 32px; }
    .post-navigation .nav-links { grid-template-columns: 1fr; }
    .lighthouse-specs { padding: 24px 20px; }
    .entry-content p:first-of-type::first-letter { font-size: 2.6em; }
}
