* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.6;
    color: #222;
    background: #f7f5f0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------- Меню ---------- */
.site-header {
    background: #2b2b2b;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

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

.site-logo {
    font-size: 1.3rem;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
    padding: 14px 0;
}

.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}

.site-nav a {
    display: block;
    padding: 14px 16px;
    color: #d9d9d9;
    text-decoration: none;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
}

.site-nav a:hover,
.site-nav a:focus {
    background: #444;
    color: #fff;
}

/* ---------- Основной контент ---------- */
main {
    flex: 1;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

.content-card {
    background: #fff;
    margin: 30px auto;
    max-width: 1000px;
    padding: 30px 40px;
    border: 1px solid #e0dcd3;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.content-card img {
    float: left;
    max-width: 320px;
    width: 40%;
    height: auto;
    margin: 0 20px 15px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.content-card p {
    text-align: justify;
    margin: 0 0 1em;
}

.content-card h2 {
    font-size: 1.4rem;
    border-bottom: 2px solid #d8d2c6;
    padding-bottom: 6px;
    margin-top: 1.5em;
    clear: both;
}

.content-card ul {
    padding-left: 22px;
}

.content-card a {
    color: #8a5a2b;
    text-decoration: none;
}

.content-card a:hover {
    text-decoration: underline;
}

.content-card::after {
    content: "";
    display: table;
    clear: both;
}

/* ---------- Раздел перед блоком ---------- */
.info-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #e0dcd3;
    clear: both;
}

.info-section h1 {
    font-size: 1.9rem;
    margin: 0 0 18px;
    color: #2b2b2b;
}

.info-section h2 {
    font-size: 1.35rem;
    margin: 25px 0 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #d8d2c6;
}

.info-section__image {
    float: right;
    max-width: 280px;
    width: 38%;
    height: auto;
    margin: 0 0 15px 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.info-section dl {
    display: grid;
    grid-template-columns: minmax(90px, max-content) 1fr;
    align-items: baseline;
    gap: 8px 10px;
    margin: 0 0 16px;
}

.info-section dt {
    font-weight: bold;
    color: #4a4a4a;
}

.info-section dt::after {
    content: ":";
}

.info-section dd {
    margin: 0;
    color: #333;
}

.info-section::after {
    content: "";
    display: table;
    clear: both;
}

/* ---------- Футер ---------- */
.site-footer {
    background: #2b2b2b;
    color: #bdbdbd;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.9rem;
}

.site-footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px;
}

.site-footer a {
    color: #e0b98a;
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* ---------- Адаптив ---------- */
@media (max-width: 600px) {
    .content-card {
        padding: 20px;
    }

    .content-card img,
    .info-section__image {
        float: none;
        display: block;
        width: 100%;
        max-width: 100%;
        margin: 0 0 15px;
    }

    .site-nav ul {
        justify-content: flex-start;
    }
}


/* Карточка персонажа без внешней сетки */
.character {
    display: inline-block;
    vertical-align: top;
    width: 130px;
    margin: 0 12px 20px 0;
    text-align: center;
    font-family: Arial, Helvetica, sans-serif;
}

/* Обёртка-ссылка задаёт одинаковую высоту и обрезку */
.character > a {
    display: block;
    width: 130px;
    height: 160px;
    overflow: hidden;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f0ede7;
}

/* Перебиваем глобальный float и размеры .content-card img */
.character img {
    display: block;
    float: none;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    object-fit: cover;
    object-position: center top;
}

.character figcaption {
    margin-top: 8px;
    font-size: 0.9rem;
    line-height: 1.3;
    color: #333;
}

.character figcaption a {
    color: #8a5a2b;
    text-decoration: none;
}

.character figcaption a:hover {
    text-decoration: underline;
}



.info-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-auto-rows: min-content;
    column-gap: 24px;
    align-items: start;
}

.info-section > h1 {
    grid-column: 1 / -1;
}

/* Ссылка — блок на всю левую колонку, на всю высоту правой части */
.info-section > .info-section__image-link {
    grid-column: 1;
    grid-row: 2 / span 100;   /* занять все строки ниже заголовка */
    display: block;
    width: 100%;
    min-width: 0;
}

/* Картинка — 100% ширины ссылки */
.info-section > .info-section__image-link > .info-section__image {
    display: block;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
}

.info-section > dl,
.info-section > b {
    grid-column: 2;
    min-width: 0;
}

@media (max-width: 767px) {
    .info-section {
        display: block;
    }
    .info-section > .info-section__image-link {
        width: 100%;
    }
}






/* Контейнер слайдера — ширина по картинке */
.mySwiper {
    width: fit-content;      /* ширина = ширине картинки */
    max-width: 100%;         /* но не больше родителя */
    margin: 0 auto;          /* центрирование */
    position: relative;      /* для стрелок */
    overflow: hidden;
    border-radius: 8px;      /* по желанию */
}

/* Слайд */
.mySwiper .swiper-slide {
    width: auto;             /* пусть ширину задаёт картинка */
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Ссылка обёртка */
.mySwiper .swiper-slide a {
    display: block;
    line-height: 0;          /* убираем лишний зазор под img */
}

/* Картинка — ключевой момент */
.mySwiper .swiper-slide img {
    display: block;
    width: 100%;             /* по ширине слайда */
    max-width: 100%;
    height: auto;            /* сохраняем пропорции */
    object-fit: contain;     /* не обрезаем */
}

/* Стрелки — поверх и аккуратно */
.mySwiper .swiper-button-prev,
.mySwiper .swiper-button-next {
    color: #fff;
    width: 36px;
    height: 36px;
    margin-top: -18px;       /* компенсируем половину высоты */
    background: rgba(0, 0, 0, 0.35);
    border-radius: 50%;
    transition: background 0.2s;
}

.mySwiper .swiper-button-prev:hover,
.mySwiper .swiper-button-next:hover {
    background: rgba(0, 0, 0, 0.6);
}

.mySwiper .swiper-button-prev::after,
.mySwiper .swiper-button-next::after {
    font-size: 16px;
    font-weight: bold;
}

.mySwiper .swiper-button-prev { left: 8px; }
.mySwiper .swiper-button-next { right: 8px; }


/* Контейнер пагинации */
.category-pagination {
    margin-top: 24px;
}

.category-pagination nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

/* Все элементы: ссылки и «неактивные» span */
.category-pagination nav > a,
.category-pagination nav > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
    color: #cfd3dc;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    transition: background .15s, border-color .15s, color .15s;
    user-select: none;
}

/* Hover только для кликабельных */
.category-pagination nav > a:hover {
    background: rgba(255, 255, 255, .10);
    border-color: rgba(255, 255, 255, .18);
    color: #fff;
}

/* Активная страница (Laravel вешает aria-current="page") */
.category-pagination nav > span[aria-current="page"] {
    background: #e8b34b;          /* ваш акцентный цвет — подставьте свой */
    border-color: #e8b34b;
    color: #1a1a1a;
    font-weight: 600;
}

/* «...» (disabled span) */
.category-pagination nav > span:not([aria-current]) {
    opacity: .5;
    cursor: default;
}

/* Стрелки «Назад/Вперёд» — чуть шире */
.category-pagination nav > a[rel="prev"],
.category-pagination nav > a[rel="next"] {
    padding: 0 14px;
}

/* Мобильная адаптация: скрываем номера, оставляем стрелки */
@media (max-width: 560px) {
    .category-pagination nav > a:not([rel="prev"]):not([rel="next"]),
    .category-pagination nav > span:not([aria-current]) {
        display: none;
    }
    .category-pagination nav > span[aria-current="page"] {
        display: inline-flex;
    }
}

/* Заголовок */
.categories-header {
    margin: 0 0 16px;
}

.categories-header__title {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.2;
}

/* Сетка категорий */
.categories-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.categories-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    line-height: 1.3;
    transition: border-color .15s, background-color .15s;
}

.categories-list__item:hover {
    border-color: #c9c9c9;
    background-color: #f7f7f7;
}

.categories-list__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.categories-list__count {
    flex: 0 0 auto;
    font-size: .85em;
    color: #888;
}

.categories-list__empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 8px 0;
    color: #888;
}

/* Пагинация */
.categories-pagination {
    margin-top: 16px;
}


/* ---------- Страница поиска ---------- */
.search-page__form {
    margin-bottom: 30px;
}

.search-page__input-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    background: #fff;
    border: 1px solid #e0dcd3;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-page__input-wrap:focus-within {
    border-color: #8a5a2b;
    box-shadow: 0 2px 14px rgba(138, 90, 43, 0.18);
}

.search-page__icon {
    padding: 0 12px 0 16px;
    font-size: 1.1rem;
    color: #8a5a2b;
}

.search-page__input {
    flex: 1;
    border: 0;
    outline: 0;
    padding: 14px 10px;
    font-size: 1rem;
    font-family: Arial, Helvetica, sans-serif;
    background: transparent;
    color: #222;
}

.search-page__btn {
    border: 0;
    background: #2b2b2b;
    color: #fff;
    padding: 14px 24px;
    font-size: 0.95rem;
    font-family: Arial, Helvetica, sans-serif;
    cursor: pointer;
    transition: background 0.2s;
}

.search-page__btn:hover {
    background: #8a5a2b;
}

.search-page__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #d8d2c6;
}

.search-page__title {
    margin: 0;
    font-size: 1.5rem;
    color: #2b2b2b;
}

.search-page__query {
    color: #8a5a2b;
    font-weight: normal;
}

.search-page__count {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.9rem;
    color: #666;
}

.search-page__results {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.search-result {
    display: block;
    background: #fff;
    border: 1px solid #e0dcd3;
    border-radius: 6px;
    padding: 16px 20px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-result:hover {
    border-color: #c9b89e;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.search-result__url {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.8rem;
    color: #8a5a2b;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result__snippet {
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
}

.search-result__snippet b {
    color: #8a5a2b;
    background: rgba(232, 179, 75, 0.18);
    padding: 0 2px;
    border-radius: 2px;
}

.search-page__empty,
.search-page__hint {
    text-align: center;
    padding: 50px 20px;
    color: #666;
    font-family: Arial, Helvetica, sans-serif;
}

.search-page__empty-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.search-page__empty-hint {
    font-size: 0.9rem;
    color: #999;
    margin-top: 6px;
}

@media (max-width: 560px) {
    .search-page__btn {
        padding: 14px 16px;
    }
    .search-page__icon {
        padding: 0 8px 0 12px;
    }
}
