/* Умный поиск (тема hero smart) */
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.hero-smart-search {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: stretch;
    max-width: 720px;
    margin: 0 auto;
}
.hero-smart-input-wrap {
    flex: 1 1 280px;
    position: relative;
    min-width: 0;
}
.hero-smart-input-wrap input[type="search"] {
    width: 100%;
    box-sizing: border-box;
    min-height: 48px;
    padding: 12px 16px;
    border: 2px solid rgba(255,255,255,0.35);
    border-radius: 8px;
    background: rgba(255,255,255,0.95);
    font-size: 16px;
    color: #1a1a1a;
}
.hero-smart-input-wrap input[type="search"]::placeholder {
    color: transparent;
}
/* Печатная машинка в поле (как на /events/) */
.hero-smart-typing-overlay {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: flex-start;
    padding: 14px 16px 12px;
    pointer-events: none;
    color: #4a4a4a;
    font-size: 16px;
    line-height: 1.35;
    text-align: left;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.hero-smart-typing-overlay.is-hidden {
    opacity: 0;
    visibility: hidden;
}
.hero-smart-typing-overlay .hero-typing-text {
    word-break: break-word;
}
.hero-smart-typing-overlay .hero-typing-caret {
    display: inline-block;
    margin-left: 1px;
    flex-shrink: 0;
    opacity: 1;
    animation: heroSmartBlinkCaret 1s steps(2, start) infinite;
}
@keyframes heroSmartBlinkCaret {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .hero-smart-typing-overlay .hero-typing-caret {
        animation: none;
        opacity: 0.6;
    }
}
/* Плавный «сдвиг страницы вниз»: анимация высоты через grid 0fr→1fr (без max-height) */
.hero-smart-results {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 1.05s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.85s ease;
    opacity: 0;
    background: #fafafa;
    border-bottom: 1px solid transparent;
    pointer-events: none;
    scroll-margin-top: 88px;
}
.hero-smart-results.is-open {
    grid-template-rows: 1fr;
    opacity: 1;
    border-bottom-color: #eee;
    pointer-events: auto;
}
.hero-smart-results-anim {
    min-height: 0;
    overflow: hidden;
}
.hero-smart-results-inner {
    padding: 28px 0 36px;
}
@media (prefers-reduced-motion: reduce) {
    .hero-smart-results {
        transition-duration: 0.01ms;
    }
}
.hero-smart-results h3 {
    font-size: 18px;
    margin: 0 0 14px;
    color: #1a1a1a;
}
@media (max-width: 767px) {
    .hero-smart-results h3 {
        text-align: center;
    }
    .hero-smart-useful .hero-smart-grid-articles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
.hero-smart-grid-articles {
    display: grid;
    gap: 16px;
    margin-bottom: 28px;
}
@media (min-width: 768px) {
    .hero-smart-grid-articles { grid-template-columns: repeat(3, 1fr); }
}
.hero-smart-card-outer {
    position: relative;
}
.hero-smart-card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    pointer-events: auto;
}
/* Кнопка «Читать позже» поверх превью обложки (иконка без подписи) */
.hero-smart-card-actions--on-cover {
    top: 18px;
    left: 86px;
    right: auto;
}
@media (max-width: 480px) {
    .hero-smart-card-actions--on-cover {
        left: auto;
        right: 18px;
        top: 18px;
    }
}
.hero-smart-card-actions .save-btn {
    padding: 8px;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    background: #ff4d00;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.hero-smart-card-actions .save-btn i {
    font-size: 14px;
    flex-shrink: 0;
}
.hero-smart-card-actions .save-btn:hover {
    background: #e03e00;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 77, 0, 0.45);
}
.hero-smart-card-actions .save-btn.saved {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    box-shadow: 0 2px 8px rgba(46, 204, 113, 0.45);
}
.hero-smart-card-actions .save-btn.saved:hover {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    box-shadow: 0 6px 16px rgba(46, 204, 113, 0.45);
}
.hero-smart-card.hero-smart-card--has-save {
    padding-right: 128px;
}
@media (max-width: 480px) {
    .hero-smart-card.hero-smart-card--has-save {
        padding-right: 48px;
    }
}
.hero-smart-card {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hero-smart-card--with-thumb {
    display: flex;
    flex-direction: row;
    gap: 14px;
    align-items: flex-start;
    padding: 12px;
}
.hero-smart-card-cover {
    flex-shrink: 0;
    width: 112px;
    height: 165px;
    border-radius: 8px;
    background: #e8e8e8;
}
.hero-smart-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}
.hero-smart-card--with-thumb .hero-smart-card-body {
    flex: 1;
    min-width: 0;
}
@media (max-width: 480px) {
    .hero-smart-card--with-thumb {
        flex-direction: column;
    }
    .hero-smart-card-cover {
        width: 100%;
        height: 165px;
    }
}
.hero-smart-results-footer {
    margin-top: 32px;
    padding-top: 8px;
    text-align: center;
}
.hero-smart-catalog-cta {
    margin: 0 0 16px;
    font-size: 15px;
    color: #444;
    line-height: 1.5;
}
.hero-smart-results-footer .section-footer {
    margin-top: 0;
}
.hero-smart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
.hero-smart-card-title { font-weight: 600; margin-bottom: 8px; font-size: 15px; }
.hero-smart-card-snippet { font-size: 13px; color: #555; line-height: 1.45; }
.hero-smart-useful { margin-bottom: 28px; }
.hero-smart-useful .hero-smart-grid-articles {
    margin-bottom: 0;
}
.hero-smart-grid-vendors {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, 1fr);
    margin-bottom: 28px;
}
@media (min-width: 640px) {
    .hero-smart-grid-vendors { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
    .hero-smart-grid-vendors { grid-template-columns: repeat(6, 1fr); }
}
.hero-smart-catalog-more {
    margin: -6px 0 28px;
    text-align: center;
}
.hero-smart-catalog-more-link {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-accent, #c2185b);
    text-decoration: underline;
}
.hero-smart-catalog-more-link:hover {
    opacity: 0.88;
}
.hero-smart-vendor {
    text-align: center;
    text-decoration: none;
    color: inherit;
}
.hero-smart-vendor img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 8px;
    display: block;
}
.hero-smart-vendor-name { font-size: 13px; font-weight: 600; }
.hero-smart-vendor-meta { font-size: 11px; color: #666; }
/* Псевдо-masonry как на vendor.php: CSS Grid + span по пропорциям изображения */
.hero-smart-photos {
    --masonry-row: 10px;
    --masonry-gap: 12px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-rows: var(--masonry-row);
    gap: var(--masonry-gap);
    width: 100%;
}
.hero-smart-photo-item {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
}
.hero-smart-photo-caption {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.35;
    color: #555;
    text-align: center;
    word-break: break-word;
    min-height: 0;
}
.hero-smart-photos a.hero-smart-photo-link {
    display: block;
    overflow: hidden;
    line-height: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hero-smart-photos a.hero-smart-photo-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}
.hero-smart-photos a.hero-smart-photo-link:focus-visible {
    outline: 2px solid #c9a87c;
    outline-offset: 2px;
}
.hero-smart-photos img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    vertical-align: middle;
}
@media (max-width: 900px) {
    .hero-smart-photos {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        --masonry-gap: 10px;
    }
}
@media (max-width: 520px) {
    .hero-smart-photos {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        --masonry-gap: 8px;
    }
}
.hero-smart-empty {
    text-align: center;
    color: #666;
    padding: 20px;
}

.hero-search-theme-switch {
    text-align: center;
    margin: 18px 0 0;
    font-size: 14px;
}
.hero-content--smart .hero-search-theme-link {
    background: none;
    border: none;
    padding: 4px 8px;
    color: rgba(255, 255, 255, 0.95);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    font: inherit;
}
.hero-content--smart .hero-search-theme-link:hover {
    color: #fff;
}
.hero-content--classic .hero-search-theme-link {
    background: none;
    border: none;
    padding: 4px 8px;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    font: inherit;
}
.hero-content--classic .hero-search-theme-link:hover {
    color: #fff;
}

/* Модалка входа (умный поиск — «Читать позже» без авторизации) */
.login-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.login-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255,255,255,0.95);
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    color: #333;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.login-modal-close:hover {
    background: #fff;
}
.login-modal-content {
    position: relative;
    width: 100%;
    max-width: 400px;
}
.login-modal-overlay .auth-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    overflow: hidden;
    width: 100%;
}
.login-modal-overlay .auth-header {
    background: #000;
    color: white;
    padding: 40px 30px;
    text-align: center;
}
.login-modal-overlay .auth-logo .logo-text {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 5px;
}
.login-modal-overlay .auth-logo .tagline {
    font-family: var(--font-secondary);
    font-style: italic;
    font-size: 14px;
    color: rgba(255,255,255,0.9);
}
.login-modal-overlay .auth-form {
    padding: 40px 30px;
}
.login-modal-overlay .form-group {
    margin-bottom: 25px;
    position: relative;
}
.login-modal-overlay .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--color-black);
    font-size: 14px;
}
.login-modal-overlay .form-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--color-gray-medium);
    border-radius: 8px;
    font-size: 16px;
    transition: var(--transition);
    background: #fafafa;
    box-sizing: border-box;
}
.login-modal-overlay .form-input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 77, 0, 0.1);
}
.login-modal-overlay .password-toggle {
    position: absolute;
    right: 15px;
    top: calc(50% + 12px);
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-gray-dark);
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    z-index: 10;
}
.login-modal-overlay .form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    font-size: 14px;
}
.login-modal-overlay .remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
}
.login-modal-overlay .forgot-password {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
}
.login-modal-overlay .btn-login {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--color-accent) 0%, #e03e00 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.login-modal-overlay .btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 77, 0, 0.3);
}
.login-modal-overlay .auth-divider {
    text-align: center;
    margin: 30px 0;
    position: relative;
    color: var(--color-gray-dark);
    font-size: 14px;
}
.login-modal-overlay .auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--color-gray-medium);
}
.login-modal-overlay .auth-divider span {
    background: white;
    padding: 0 20px;
    position: relative;
}
.login-modal-overlay .auth-footer {
    text-align: center;
    padding: 20px 30px 30px;
    background: #fafafa;
}
.login-modal-overlay .auth-footer .auth-link {
    color: var(--color-accent);
    font-weight: 600;
}
.login-modal-overlay .alert-error {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}