/**
 * Theme Name: Astra Child
 * Template:   astra
 * ...other header fields
 */
/* ============================================================
   1. ЗАГАЛЬНІ НАЛАШТУВАННЯ ТА КОНТЕЙНЕРИ
   ============================================================ */
.instructions-page-wrapper {
    background-color: #ffffff;
}

.hero-container {
    max-width: 850px !important;
    margin: 0 auto;
    padding: 0 20px;
}

.instructions-content.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ============================================================
   2. HERO СЕКЦІЯ ТА ПОШУК (APPLE SUPPORT STYLE)
   ============================================================ */
.instructions-hero {
    background-color: #f5f5f7;
    padding: 30px 0;
    border-bottom: 1px solid #d2d2d7;
    text-align: center;
    width: 100%;
}

.instructions-title {
    font-size: 36px;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 12px;
    letter-spacing: -0.8px;
}

.instructions-desc {
    font-size: 18px;
    color: #86868b;
    line-height: 1.47;
    margin-bottom: 30px;
}

.instructions-search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    padding: 4px 4px 4px 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.3s ease;
}

.search-input-wrapper:focus-within {
    border-color: #0071e3;
    box-shadow: 0 0 0 4px rgba(0,113,227,0.1);
}

.search-icon {
    display: flex;
    align-items: center;
    margin-right: 12px;
}

.instructions-search-box .search-field {
    flex: 1;
    border: none !important;
    outline: none !important;
    font-size: 17px !important;
    padding: 12px 0 !important;
    background: transparent;
    color: #1d1d1f;
}

.search-submit-btn {
    background: #f5f5f7;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    color: #1d1d1f;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.search-submit-btn:hover { background: #e8e8ed; }

/* ============================================================
   3. СІТКА ТА КАРТКИ (ІДЕАЛЬНЕ ВИРІВНЮВАННЯ)
   ============================================================ */
.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.instruction-card {
    position: relative;
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid #e5e5e5;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    height: 100%;
}

.instruction-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    border-color: #d2d2d7;
}

.instruction-info {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Зона бейджів - фіксована висота */
.instruction-badges-row {
    height: 28px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
    z-index: 15;
}

.badge {
    background: #f0f2f5;
    color: #5f6368;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 5px;
    letter-spacing: 0.5px;
}
.badge:nth-child(n+2) {
  margin-left: 5px;
}

/* Зона заголовка - фіксована на 2 рядки */
.instruction-title-zone {
    height: 56px;
    margin-bottom: 16px;
    overflow: hidden;
}

.instruction-title-link a {
    font-size: 20px !important;
    line-height: 1.4 !important;
    font-weight: 700;
    color: #1d1d1f;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}

.instruction-card:hover .instruction-title-link a { color: #0071e3; }

/* Зона медіа (16:9) - однаковий розмір для фото та тексту */
.instruction-thumb, 
.instruction-excerpt-box {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
    border: 1px solid rgba(0,0,0,0.03);
}

.instruction-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.instruction-card:hover .instruction-thumb img { transform: scale(1.06); }

/* Текстовий бокс (якщо немає відео) */
.instruction-excerpt-box {
    background: linear-gradient(145deg, #ffffff, #f9fafb);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    border: 1px solid #f0f0f2;
}

.excerpt-content {
    font-size: 15px;
    line-height: 1.55;
    color: #48484a;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Відео Play Кнопка */
.video-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.1);
}

.play-button {
    width: 40px; height: 40px;
    background: #ff0000;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 3px solid #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.play-button svg { width: 25px; height: 25px; fill: #fff; }
.instruction-card:hover .play-button { transform: scale(1.12); }

/* Кнопка внизу */
.read-more-btn {
    margin-top: auto;
    font-size: 15px;
    font-weight: 600;
    color: #0071e3;
    display: flex;
    align-items: center;
}

.read-more-btn span { margin-left: 6px; transition: transform 0.2s; }
.instruction-card:hover .read-more-btn span { transform: translateX(5px); }

/* Розтягнуте посилання на всю картку */
.main-card-link::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10;
}

/* ============================================================
   4. МОБІЛЬНА АДАПТИВНІСТЬ ТА ASTRA FIXES
   ============================================================ */

/* Виправлення для Astra: Категорії та Пошук */
.archive .site-content .ast-container,
.search .site-content .ast-container {
    display: block !important;
    max-width: 100% !important;
    padding: 0 !important;
}

.archive .site-header .ast-container,
.search .site-header .ast-container {
    display: flex !important;
    flex-direction: row !important;
}

.archive #primary, .search #primary { width: 100% !important; margin: 0 !important; }
.archive .widget-area, .search .widget-area { display: none !important; }

@media (max-width: 768px) {
    .instructions-title { font-size: 28px; }
    .instructions-hero { padding: 40px 20px; text-align: left; }
    .instructions-grid { grid-template-columns: 1fr; }
    .search-submit-btn { display: none; }
    .search-input-wrapper { padding-right: 16px; }
}

/* Пагінація */
.instructions-pagination { margin-top: 50px; text-align: center; }
.instructions-pagination .nav-links { display: flex; justify-content: center; gap: 8px; }
.instructions-pagination .page-numbers {
    padding: 12px 18px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    text-decoration: none;
    color: #1d1d1f;
    font-weight: 500;
}
.instructions-pagination .page-numbers.current {
    background: #e60c0c;
    color: #fff;
    border-color: #e60c0c;
}