/* Сторінка «Інструкція» (core/templates/core/about.html).
   Переписано на токени теми; імена класів збережені — на них спирається
   script_about.js (.instruction-nav-link, .instruction-section, .fade-in,
   .scroll-to-top). */

.content-wrapper {
    padding: 8px 0 40px;
}

/* --------------------------------------------------------------- герой -- */

.hero-section {
    padding: 40px 0 34px;
    background-image: var(--sp-cutline);
    background-repeat: repeat-x;
    background-position: left bottom;
    background-size: 31px 1px;
    margin-bottom: 32px;
}
.hero-title {
    font-family: var(--sp-font-head);
    font-size: 36px;
    line-height: 1.2;
    color: var(--sp-heading);
    margin: 0 0 12px;
}
.hero-description {
    max-width: 720px;
    margin: 0;
    color: var(--sp-body);
    font-size: var(--sp-fs-body);
    line-height: 1.7;
}

/* ----------------------------------------------------------- розкладка -- */

.instruction-layout {
    display: grid;
    grid-template-columns: 270px 1fr;
    gap: 32px;
    align-items: start;
}

.instruction-nav {
    position: sticky;
    top: calc(var(--sp-header-h) + 16px);
    max-height: calc(100vh - var(--sp-header-h) - 40px);
    overflow-y: auto;
    background-color: #fff;
    border: 1px solid var(--sp-line-soft);
    border-radius: var(--sp-radius);
    padding: 18px;
}
.instruction-nav-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.instruction-nav-link {
    display: block;
    padding: 8px 12px;
    border-radius: var(--sp-radius-sm);
    color: var(--sp-heading);
    font-size: var(--sp-fs-sm);
    font-weight: 600;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: background var(--sp-transition), color var(--sp-transition), border-color var(--sp-transition);
}
.instruction-nav-link:hover {
    background: var(--sp-bg-mute);
}
.instruction-nav-link.active {
    border-left-color: var(--sp-accent);
    color: var(--sp-accent);
    background: var(--sp-accent-soft);
}
.instruction-nav-link--sub {
    padding-left: 26px;
    font-weight: 500;
    font-size: var(--sp-fs-xs);
    color: var(--sp-body);
}

/* --------------------------------------------------------------- розділ - */

.instruction-section {
    background-color: #fff;
    border-radius: var(--sp-radius);
    box-shadow: var(--sp-shadow-sm);
    padding: 30px 34px;
    margin-bottom: 20px;
    scroll-margin-top: calc(var(--sp-header-h) + 20px);
}
.instruction-section p {
    color: var(--sp-body);
    font-size: var(--sp-fs-body);
    line-height: var(--sp-lh-normal);
    margin: 0 0 16px;
}
.story-section {
    margin: 0 0 8px;
}
.instruction-section p:last-child {
    margin-bottom: 0;
}

.section-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 22px;
    padding-bottom: 16px;
    background-image: var(--sp-cutline);
    background-repeat: repeat-x;
    background-position: left bottom;
    background-size: 31px 1px;
}
.section-title {
    font-family: var(--sp-font-head);
    font-size: var(--sp-fs-2xl);
    line-height: var(--sp-lh-tight);
    color: var(--sp-heading);
    margin: 0;
}
.section-number {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: var(--sp-radius-sm);
    background: var(--sp-primary);
    color: #fff;
    font-size: var(--sp-fs-lg);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.subsection-title,
.step-title {
    font-family: var(--sp-font-head);
    font-size: var(--sp-fs-lg);
    line-height: var(--sp-lh-tight);
    color: var(--sp-heading);
    margin: 32px 0 14px;
    scroll-margin-top: calc(var(--sp-header-h) + 20px);
}
.instruction-section > .subsection-title:first-of-type {
    margin-top: 0;
}

.highlight-text {
    color: var(--sp-heading);
    font-weight: 700;
}

.instruction-list,
.story-list,
.instruction-section ol,
.instruction-section ul {
    margin: 0 0 18px;
    padding-left: 26px;      /* інакше маркери вилазять ліворуч від тексту */
    color: var(--sp-body);
    font-size: var(--sp-fs-body);
    line-height: var(--sp-lh-normal);
}
.instruction-list li,
.story-list li,
.instruction-section li {
    margin-bottom: 10px;
    padding-left: 4px;
}
.instruction-list li:last-child,
.story-list li:last-child,
.instruction-section li:last-child {
    margin-bottom: 0;
}
.instruction-list li::marker,
.story-list li::marker,
.instruction-section li::marker {
    color: var(--sp-accent);
    font-weight: 700;
}
/* вкладені списки */
.instruction-section li > ul,
.instruction-section li > ol {
    margin: 10px 0 0;
    padding-left: 22px;
}

/* ---------------------------------------------------- допоміжні блоки --- */

.info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 20px 0;
    padding: 15px 18px;
    border-radius: var(--sp-radius-sm);
    border: 1px solid var(--sp-line-soft);
    border-left: 3px solid var(--sp-accent);
    background: var(--sp-bg-soft);
    color: var(--sp-heading);
    font-size: var(--sp-fs-sm);
    line-height: var(--sp-lh-normal);
}
.info-icon {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    border-radius: 50%;
    background: var(--sp-accent);
    color: #fff;
    font-size: var(--sp-fs-2xs);
    font-weight: 700;
    font-style: normal;
    line-height: 20px;
    text-align: center;
}

.example-box {
    margin: 18px 0;
    border: 1px solid var(--sp-line-soft);
    border-radius: var(--sp-radius-sm);
    overflow: hidden;
    background: var(--sp-bg-soft);
}
.example-title {
    padding: 11px 16px;
    background: var(--sp-bg-mute);
    border-bottom: 1px solid var(--sp-line-soft);
    font-size: var(--sp-fs-xs);
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--sp-heading);
}
.example-content {
    padding: 16px;
    font-size: var(--sp-fs-sm);
    line-height: 1.7;
    color: var(--sp-body);
}

/* таблиця діапазонів */
.ranges-table {
    margin: 18px 0;
    border: 1px solid var(--sp-line-soft);
    border-radius: var(--sp-radius-sm);
    overflow: hidden;
}
.table-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--sp-line-soft);
}
.table-row:last-child {
    border-bottom: none;
}
.table-row:first-child {
    background: var(--sp-bg-mute);
    font-weight: 700;
    color: var(--sp-heading);
}
.table-cell {
    padding: 11px 16px;
    font-size: var(--sp-fs-sm);
    color: var(--sp-heading);
}
.table-cell + .table-cell {
    border-left: 1px solid var(--sp-line-soft);
}
.range-label {
    color: var(--sp-muted);
    font-size: var(--sp-fs-xs);
}
.range-info {
    color: var(--sp-body);
    font-size: var(--sp-fs-sm);
}

/* деталі процесу */
.process-details,
.process-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin: 20px 0;
}
.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--sp-line-soft);
    border-radius: var(--sp-radius-sm);
    background: var(--sp-bg-soft);
    font-size: var(--sp-fs-sm);
    line-height: var(--sp-lh-snug);
}
.detail-label {
    color: var(--sp-muted);
    font-size: var(--sp-fs-xs);
}
.detail-value {
    color: var(--sp-heading);
    font-weight: 600;
}

/* статуси */
.status-list {
    display: grid;
    gap: 10px;
    margin: 16px 0;
}
.status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border: 1px solid var(--sp-line-soft);
    border-radius: var(--sp-radius-sm);
    font-size: var(--sp-fs-sm);
    color: var(--sp-heading);
}
.status-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--sp-bg-mute);
    color: var(--sp-body);
    font-size: var(--sp-fs-2xs);
    font-weight: 700;
    white-space: nowrap;
}

/* зображення */
.image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 170px;
    margin: 18px 0;
    border: 1px dashed var(--sp-line);
    border-radius: var(--sp-radius-sm);
    background: var(--sp-bg-soft);
    color: var(--sp-faint);
    font-size: var(--sp-fs-xs);
}
.placeholder-icon {
    font-size: var(--sp-fs-2xl);
}
.story-section {
    margin: 20px 0;
}
.story-photo,
.story-video,
.instruction-section img,
.instruction-section video {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--sp-line-soft);
    border-radius: var(--sp-radius-sm);
    display: block;
}
.story-text {
    margin-top: 10px;
    color: var(--sp-muted);
    font-size: var(--sp-fs-xs);
}

/* нагору */
.scroll-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 900;
    width: 46px;
    height: 46px;
    border: 1px solid var(--sp-line);
    border-radius: 50%;
    background-color: #fff;
    color: var(--sp-heading);
    box-shadow: var(--sp-shadow);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: var(--sp-fs-lg);
    transition: background var(--sp-transition), color var(--sp-transition);
}
.scroll-to-top.visible,
.scroll-to-top.show {
    display: inline-flex;
}
.scroll-to-top:hover {
    background: var(--sp-primary);
    color: #fff;
}

/* поява секцій — анімація, а не приховування:
   контент видно завжди, навіть якщо JS не спрацював */
.fade-in {
    animation: sp-fade-up .5s ease both;
}
@keyframes sp-fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .fade-in { animation: none; }
}

@media (max-width: 991px) {
    .instruction-layout {
        grid-template-columns: 1fr;
    }
    .instruction-nav {
        position: static;
        max-height: none;
    }
}

@media (max-width: 767px) {
    .hero-title { font-size: 27px; }
    .instruction-section { padding: 22px 18px; }
    .section-title { font-size: var(--sp-fs-xl); }
    .table-row { grid-template-columns: 1fr; }
    .table-cell + .table-cell {
        border-left: none;
        border-top: 1px solid var(--sp-line-soft);
    }
    .scroll-to-top { right: 16px; bottom: 16px; }
}

/* анімація процесів — відео замість 28-мегабайтного GIF */
.story-video {
    width: 100%;
    height: auto;
    display: block;
    background-color: var(--sp-bg-mute);
}
@media (prefers-reduced-motion: reduce) {
    .story-video { animation: none; }
}
