/*
Theme Name: Aeroистория
Theme URI: http://aeroistoriya.ru
Author: Твое имя
Author URI: http://aeroistoriya.ru
Description: Винтажная тема для сайта об истории авиации с самолетиками и пропеллером
Version: 1.0
License: GPL v2 or later
Text Domain: aeroistoriya
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Raleway', 'Lora', Georgia, serif;
    background: linear-gradient(145deg, #b5d1e6 0%, #5a8eb0 50%, #1e4a6e 100%);
    background-attachment: fixed;
    color: #1e2b32;
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

/* Облака */
.cloud {
    position: fixed;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 1000px;
    filter: blur(30px);
    z-index: 0;
    pointer-events: none;
}
.cloud1 { width: 500px; height: 150px; top: 5%; left: 0; }
.cloud2 { width: 700px; height: 200px; bottom: 10%; right: 0; }
.cloud3 { width: 400px; height: 120px; top: 40%; right: 20%; }
.cloud4 { width: 300px; height: 100px; top: 70%; left: 15%; }

/* Винтажная текстура */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="1" stitchTiles="stitch"/></filter><rect width="200" height="200" filter="url(%23noise)" opacity="0.03"/></svg>');
    pointer-events: none;
    z-index: 2;
}

/* Шапка */
.header {
    position: relative;
    z-index: 30;
    background: linear-gradient(135deg, #1e3a47 0%, #0f2a35 100%);
    border-bottom: 6px solid #7f6b4c;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

/* Логотип */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    position: relative;
    width: 42px;
    height: 42px;
    background: rgba(127,107,76,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #7f6b4c;
}

.logo-icon .plane {
    font-size: 1.8rem;
    transform: rotate(-15deg) scaleX(-1);
    color: #c7b199;
    line-height: 1;
}

.logo-icon .wings span {
    position: absolute;
    width: 8px;
    height: 2px;
    background: #7f6b4c;
}
.logo-icon .wings span:nth-child(1) { top: 10px; right: 5px; transform: rotate(25deg); }
.logo-icon .wings span:nth-child(2) { bottom: 10px; right: 5px; transform: rotate(-25deg); }

.logo-text .site-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #c7b199;
    text-shadow: 1px 1px 0 #0f2a35;
}
.logo-text .site-name a { color: #c7b199; text-decoration: none; }
.logo-text .site-tagline {
    font-size: 0.7rem;
    color: #aab9c2;
    text-transform: uppercase;
    border-left: 2px solid #7f6b4c;
    padding-left: 6px;
    margin-top: 2px;
}

/* ========== МЕНЮ ========== */
.desktop-menu {
    display: flex;
    list-style: none;
    gap: 2px;
}

.desktop-menu > li {
    position: relative;
}

.desktop-menu > li > a {
    color: #d0dee5;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    font-family: 'Montserrat Alternates', sans-serif;
    font-size: 0.95rem;
    position: relative;
}

/* Самолетик внутри пункта */
.desktop-menu > li > a .menu-plane {
    font-size: 1rem;
    opacity: 0.3;
    transform: rotate(-15deg);
    transition: all 0.3s;
}

/* Самолетик слева при наведении */
.desktop-menu > li > a::before {
    content: "✈";
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    color: #7f6b4c;
    font-size: 1rem;
    opacity: 0;
    transition: all 0.3s;
}

.desktop-menu > li > a:hover {
    border-bottom-color: #7f6b4c;
    background: #2f4d5c;
    color: #fff;
    padding-left: 30px;
}

.desktop-menu > li > a:hover::before {
    left: 8px;
    opacity: 1;
    color: #c7b199;
}

.desktop-menu > li > a:hover .menu-plane {
    opacity: 1;
    transform: rotate(-15deg) translateX(3px);
    color: #7f6b4c;
}

/* ========== ВЫПАДАЮЩЕЕ ПОДМЕНЮ ========== */
.menu-item-has-children > a::after {
    content: "▼";
    font-size: 0.6rem;
    margin-left: 6px;
    opacity: 0.7;
    display: inline-block;
    transition: transform 0.3s;
}

.menu-item-has-children:hover > a::after {
    transform: rotate(180deg);
}

/* Подменю - скрыто по умолчанию */
.menu-item-has-children .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #1e3a47;
    border: 2px solid #7f6b4c;
    border-top: none;
    list-style: none;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* Показываем подменю при наведении */
.menu-item-has-children:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Стили для пунктов подменю */
.sub-menu a {
    color: #d0dee5 !important;
    text-decoration: none;
    display: block;
    padding: 8px 20px !important;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    white-space: nowrap;
    transition: all 0.3s;
}

.sub-menu a:hover {
    background: #2f4d5c !important;
    border-left-color: #7f6b4c;
    padding-left: 25px !important;
}

/* ========== ГАМБУРГЕР ========== */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}
.hamburger span {
    width: 28px;
    height: 3px;
    background: #c7b199;
    margin: 3px 0;
    transition: 0.3s;
}
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(8px, 8px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(8px, -8px); }

/* Мобильное меню */
.mobile-menu {
    display: none;
    width: 100%;
    background: #1e3a47;
    padding: 20px;
    border-top: 1px solid #3a5562;
}
.mobile-menu.active { display: block; }
.mobile-menu a {
    color: #d0dee5;
    text-decoration: none;
    display: block;
    padding: 10px 15px;
    border-left: 3px solid transparent;
}
.mobile-menu a:hover {
    border-left-color: #7f6b4c;
    background: #2f4d5c;
}

/* ========== ОСНОВНОЙ КОНТЕНТ ========== */
.main-content {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 40px;
    position: relative;
    z-index: 10;
}

.content-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3.2rem;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5), 4px 4px 0 #1e3a47;
    margin-bottom: 30px;
    position: relative;
}
.content-header h1::before {
    content: "✈";
    font-size: 3rem;
    color: rgba(255,255,255,0.3);
    position: absolute;
    top: -20px;
    left: -40px;
    transform: rotate(-15deg);
}

.post {
    background: rgba(250, 248, 242, 0.95);
    padding: 40px;
    margin-bottom: 50px;
    border: 1px solid #c5bcae;
    position: relative;
    box-shadow: 0 15px 40px rgba(0,0,0,0.25);
}
.post::after {
    content: "✈";
    position: absolute;
    top: -15px;
    right: 30px;
    width: 40px;
    height: 40px;
    background: #7f6b4c;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid #fff;
}

.post-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.4rem;
    color: #1e3a47;
    margin-bottom: 20px;
}

.post-meta {
    display: flex;
    gap: 20px;
    color: #5f6c75;
    font-size: 0.9rem;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #d0c9bc;
}

.post-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #1e2b32;
}

.post-content p {
    margin-bottom: 20px;
}

.post-content h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    margin: 40px 0 20px;
    color: #1e3a47;
    padding-left: 15px;
    border-left: 5px solid #7f6b4c;
}

.post-content h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin: 30px 0 15px;
    color: #2f4d5c;
}

blockquote {
    margin: 30px 0;
    padding: 20px 40px;
    background: #e7e3d9;
    border-left: 6px solid #7f6b4c;
    box-shadow: 0 5px 0 #7f6b4c;
}

.read-more {
    display: inline-block;
    margin-top: 20px;
    padding: 15px 35px;
    border: 3px solid #7f6b4c;
    color: #1e3a47;
    text-decoration: none;
    font-weight: 600;
    transition: 0.3s;
    border-radius: 30px 5px 30px 5px;
    position: relative;
}
.read-more::before,
.read-more::after {
    content: "✈";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    opacity: 0;
    transition: 0.3s;
}
.read-more::before { left: -20px; }
.read-more::after { right: -20px; transform: translateY(-50%) scaleX(-1); }
.read-more:hover {
    background: #7f6b4c;
    color: #fff;
    padding: 15px 45px;
}
.read-more:hover::before { left: 5px; opacity: 1; }
.read-more:hover::after { right: 5px; opacity: 1; }

.footer {
    text-align: center;
    padding: 40px 0;
    margin-top: 60px;
    border-top: 2px solid #7f6b4c;
    color: #fff;
    position: relative;
}
.footer::before {
    content: "✈ ✈ ✈";
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30,74,94,0.5);
    padding: 5px 30px;
    border-radius: 30px;
}

/* ========== ИЗОБРАЖЕНИЯ ========== */
.post-content img,
.wp-block-image img,
.entry-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
}

.wp-block-image {
    max-width: 100%;
    margin: 30px auto !important;
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 900px) {
    .desktop-menu { display: none; }
    .hamburger { display: flex; }
    .header-container { padding: 10px 20px; }
    .content-header h1 { font-size: 2.5rem; }
    .post { padding: 25px; }
}

/* ===== АДАПТАЦИЯ ДЛЯ ТЕЛЕФОНОВ ===== */

/* 1. Все картинки не вылезают за экран */
img,
.wp-block-image img,
.post-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* 2. Адаптация формы комментариев */
.comment-form input,
.comment-form textarea,
#commentform input,
#commentform textarea,
#comment {
    width: 100%;
    max-width: 100%;
    padding: 10px;
    font-size: 16px;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Поля имя и email в ряд (если есть) */
.comment-form-author,
.comment-form-email {
    display: inline-block;
    width: calc(50% - 10px);
    vertical-align: top;
}

.comment-form-author {
    margin-right: 15px;
}

/* На совсем маленьких экранах — в столбик */
@media (max-width: 480px) {
    .comment-form-author,
    .comment-form-email {
        width: 100%;
        margin-right: 0;
    }
}

/* 3. Защита от горизонтального скролла */
body {
    overflow-x: hidden;
    width: 100%;
}

/* 4. Любые таблицы тоже не вылезают */
table {
    width: 100%;
    display: block;
    overflow-x: auto;
}
/* ===== ФИКС ДЛЯ ТАБЛИЦ — ВОЗВРАЩАЕМ СТАРЫЙ ВИД ===== */
.post-content table,
.entry-content table,
.table-container table {
    display: table !important;
    width: 100% !important;
    background: rgba(255, 255, 255, 0.7) !important;
    border-collapse: collapse !important;
}

.post-content th,
.entry-content th,
.table-container th {
    background: #7f6b4c !important;
    color: white !important;
    padding: 12px !important;
    border: 1px solid #c5bcae !important;
}

.post-content td,
.entry-content td,
.table-container td {
    padding: 12px !important;
    border: 1px solid #c5bcae !important;
}

/* Цвет четных строк */
.post-content tr:nth-child(even) td,
.entry-content tr:nth-child(even) td,
.table-container tr:nth-child(even) td {
    background: rgba(127, 107, 76, 0.05) !important;
}

/* Отключаем display: block у таблиц на телефонах */
@media (max-width: 768px) {
    .post-content table,
    .entry-content table,
    .table-container table {
        display: table !important;
        width: 100% !important;
    }
/* ========= УНИВЕРСАЛЬНЫЙ АДАПТИВНЫЙ ФИКС (усиленный) ========= */

/* Сброс модели подсчёта ширины — для всех элементов сайта */
html {
  box-sizing: border-box;
}
*, *::before, *::after {
  box-sizing: inherit;
}

/* Запрещаем изображениям, видео и вставкам быть шире родителя */
img,
video,
iframe,
embed,
object {
  max-width: 100% !important;
  height: auto !important;
  display: block;
  margin: 0 auto;
}

/* Любые картинки внутри контента статей */
.entry-content img,
.post img,
.article-content img,
.entry img,
.content img,
main img,
article img {
  max-width: 100% !important;
  height: auto !important;
}

/* Обрезка длинных слов (заголовки, текст) */
body,
p,
h1, h2, h3, h4, h5, h6,
a,
li,
div,
td,
th,
caption,
span {
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

/* Дополнительно для ссылок (URL) */
a {
  word-break: break-all;
}

/* Контейнеры — убираем горизонтальный скролл */
.entry-content,
.post-content,
.article-content,
.content-area,
#content,
main,
article {
  overflow-x: hidden !important;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Фикс для всех контейнеров с классом, который содержит "container" или "wrap" */
[class*="container"],
[class*="wrap"],
[class*="inner"] {
  overflow-x: hidden !important;
}

/* Если тема использует фиксированную ширину в пикселях для основного блока */
#primary,
#main,
.site-content,
.content-area {
  max-width: 100% !important;
  width: auto !important;
}

/* Устраняем любые плавающие элементы, которые могут вылезать */
.clearfix::after {
  content: "";
  display: table;
  clear: both;
}
/* Принудительный сброс размеров, если что-то проскочило (не переопределяет инлайн-стили, но помогает для классов) */
img {
    max-width: 100%;
    height: auto;
}
.caption {
    max-width: 100%;
}
.wp-caption {
    max-width: 100%;
}
.wp-caption img {
    width: 100%;
    height: auto;
}
	/* Контейнер подписи – никогда не шире экрана */
.wp-caption {
    max-width: 100% !important;
    width: auto !important;
}
/* Принудительный сброс размеров, если что-то проскочило (не переопределяет инлайн-стили, но помогает для классов) */
img {
    max-width: 100%;
    height: auto;
}
.caption {
    max-width: 100%;
}
.wp-caption {
    max-width: 100%;
}
.wp-caption img {
    width: 100%;
    height: auto;
}