/* ==========================================================================
   Reusable components: button, section title, social links, contacts,
   form, form feedback, modal, breadcrumbs, accordion, page report
   ========================================================================== */

/* ---------- Button ----------
   <a class="btn btn--primary btn--large" href="…">…</a>
   Types: primary · secondary · additional · rounded · link
   Sizes: small (default, no class) · medium · large — medium/large grow from 768px */

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    height: 48px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius-md);
    font-size: var(--fs-base);
    font-weight: var(--fw-medium);
    text-align: center;
    text-decoration: none;
    transition: all var(--transition-base);
}

.btn--primary {
    color: var(--color-white);
    background-color: var(--color-black);
}

.btn--secondary {
    color: var(--color-black);
    background-color: var(--color-white);
    border: 1px solid var(--color-black);
}

.btn--additional {
    color: var(--color-white);
    background-color: rgb(255 255 255 / 20%);
    border: 1px solid var(--color-white);
}

.btn--rounded {
    justify-content: flex-start;
    gap: var(--spacing-sm);
    color: var(--color-white);
    background-color: var(--color-additional-blue-dark);
    border: 1px solid rgb(234 246 255 / 40%); /* --color-blue-light @ 40% */
    border-radius: var(--border-radius-lg);
}

/* Trailing arrow of the rounded button. A background (not <img>) so it can
   switch to the blue file on hover together with the text. */
.btn--rounded .btn__arrow {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-left: auto;
    background: url("../icons/arrow-down-white.svg") no-repeat center / contain;
}

.btn--primary:disabled {
    background-color: var(--color-gray-disabled);
}

.btn--secondary:disabled,
.btn--additional:disabled,
.btn--rounded:disabled {
    color: var(--color-gray-disabled);
    border-color: var(--color-gray-disabled);
}

@media (hover: hover) and (pointer: fine) {
    .btn--primary:hover {
        background-color: var(--color-primary-800);
    }

    .btn--secondary:hover,
    .btn--additional:hover,
    .btn--rounded:hover {
        color: var(--color-primary-800);
        border-color: var(--color-primary-800);
        background-color: var(--color-gray-light);
    }

    .btn--rounded:hover .btn__arrow {
        background-image: url("../icons/arrow-down-blue.svg");
    }
}

@media (min-width: 768px) {
    .btn--medium {
        height: 56px;
        padding: var(--spacing-md) var(--spacing-lg);
        font-size: var(--fs-md);
    }

    .btn--large {
        height: 64px;
        padding: var(--spacing-md) var(--spacing-lg);
        font-size: var(--fs-md);
        font-weight: var(--fw-semi-bold);
    }
}

/* Link-looking button: underlined text without a box
   ("Змінити пошту", "Надіслати ще раз") */
.btn--link {
    height: 32px;
    padding: var(--spacing-xs) var(--spacing-md);
    color: var(--color-black);
    background-color: var(--color-white);
    text-decoration: underline;
}

.btn--link:disabled {
    color: var(--color-gray-disabled);
}

@media (hover: hover) and (pointer: fine) {
    .btn--link:hover {
        color: var(--color-primary-800);
        text-decoration: none;
    }
}

/* ---------- Section title ----------
   <div class="section-title">
       <h2 class="section-title__heading">…</h2>
       <p class="section-title__lead">…</p>     optional accent line
       <p class="section-title__text">…</p>     optional paragraph
   </div>
   Modifiers: --flush (no bottom margin) · --light (white text) */

.section-title {
    margin-bottom: var(--spacing-lg);
}

.section-title__heading {
    font-size: var(--fs-header-md);
    font-weight: var(--fw-semi-bold);
    line-height: var(--lh-base);
    color: var(--color-black);
}

.section-title__lead {
    margin-top: var(--spacing-sm);
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
    line-height: var(--lh-base);
    color: var(--color-primary-600);
}

.section-title__text {
    margin-top: var(--spacing-lg);
    font-size: var(--fs-base);
    line-height: var(--lh-large);
    color: var(--color-gray);
}

@media (min-width: 768px) {
    .section-title {
        margin-bottom: var(--spacing-xl);
    }

    .section-title__heading {
        font-size: var(--fs-header-xxl);
    }

    .section-title__lead {
        font-size: var(--fs-xxl);
    }

    .section-title__text {
        font-size: var(--fs-md);
    }
}

.section-title--flush {
    margin-bottom: 0;
}

.section-title--light .section-title__heading,
.section-title--light .section-title__lead,
.section-title--light .section-title__text {
    color: var(--color-white);
}

/* ---------- Social links ----------
   <ul class="social"><li><a class="social__link" …><img …></a></li>…</ul>
   Icons come in two files per network: *-white.svg and *-black.svg */

.social {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.social__link {
    transition: all var(--transition-base);
}

/* Sits on the text baseline, like the inline icons of the original */
.social__link img {
    vertical-align: baseline;
}

@media (hover: hover) and (pointer: fine) {
    .social__link:hover {
        opacity: 0.6;
    }
}

@media (min-width: 768px) {
    .social {
        gap: var(--spacing-md);
    }
}

/* ---------- Contacts (phone, email) ---------- */

.contacts {
    display: flex;
    flex-direction: column;
    row-gap: var(--spacing-md);
    font-size: var(--fs-base);
    line-height: var(--lh-large);
}

.contacts a {
    color: inherit;
    text-decoration: none;
}

@media (hover: hover) and (pointer: fine) {
    .contacts a:hover {
        text-decoration: underline;
    }
}

/* ---------- Form ---------- */

.form {
    display: grid;
    row-gap: var(--spacing-lg);
}

/* Text field with a floating label:
   <label class="field">
       <span class="field__label">Email</span>
       <input class="field__input" type="email" placeholder=" ">
   </label>
   The label sits inside the empty field and moves up on focus or once there
   is a value (placeholder=" " is needed for :placeholder-shown). */

.field {
    position: relative;
    display: grid;
    height: 56px;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--color-gray-stroke);
    border-radius: var(--border-radius-sm);
    background-color: var(--color-white);
    transition: all 0.3s ease;
}

.field__label {
    font-size: var(--fs-base);
    line-height: var(--lh-base);
    transform: translateY(50%);
    transition: all 0.3s ease;
}

.field__input {
    width: 100%;
    font-size: var(--fs-base);
    color: var(--color-black);
    background-color: var(--color-white);
}

/* The field border shows focus instead of the default outline */
.field__input:focus {
    outline: none;
}

.field:has(.field__input:not(:placeholder-shown)) .field__label,
.field:focus-within .field__label {
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    color: var(--color-black);
    transform: translateY(0);
}

.field:focus-within {
    border-color: var(--color-primary-800);
}

.field:focus-within .field__label {
    color: var(--color-primary-800);
}

/* Dropdown. Native <select> styled like the closed state of the original
   custom select; the opened list is the browser's own. */
.select {
    width: 100%;
    height: 56px;
    padding: 0 44px 0 var(--spacing-md);
    border: 1px solid var(--color-gray-stroke);
    border-radius: var(--border-radius-sm);
    font-size: var(--fs-base);
    color: var(--color-black);
    background: var(--color-white) url("../icons/chevron-down.svg") no-repeat
        right var(--spacing-md) center / 20px;
    cursor: pointer;
    appearance: none;
    transition: border-color 0.3s ease;
}

.select:focus {
    outline: none;
    border-color: var(--color-primary-800);
}

/* Consent line under the forms */
.policy {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    column-gap: var(--spacing-sm);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    line-height: var(--lh-large);
    text-align: center;
    color: var(--color-black);
}

.policy--light {
    color: var(--color-white);
}

.policy a {
    color: inherit;
    text-decoration: underline;
}

@media (hover: hover) and (pointer: fine) {
    .policy a:hover {
        text-decoration: none;
    }
}

/* ---------- Form feedback ----------
   Replaces a form (and its consent line) after sending. Its markup is
   commented out in the pages until the forms are connected to the backend.
   Modifiers: --light (white text on dark cards) · --large (roomier, from 992px) */

.form-feedback {
    display: grid;
    grid-auto-rows: max-content;
    justify-items: start;
    align-content: end;
    row-gap: var(--spacing-lg);
}

.form-feedback--light {
    color: var(--color-white);
}

.form-feedback__header,
.form-feedback__list {
    display: flex;
    flex-direction: column;
    row-gap: var(--spacing-sm);
}

.form-feedback__title {
    font-size: var(--fs-header-xs);
    font-weight: var(--fw-semi-bold);
    line-height: var(--lh-base);
}

.form-feedback__header p,
.form-feedback__list li {
    line-height: var(--lh-large);
}

.form-feedback__email {
    overflow: hidden;
    width: 100%;
    max-width: 266px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* "Надіслати ще раз" sits flush and takes the text colour */
.form-feedback .btn--link {
    padding: 0;
    color: inherit;
    background-color: transparent;
}

@media (min-width: 992px) {
    .form-feedback--large {
        row-gap: var(--spacing-xl);
    }
}

@media (min-width: 1200px) {
    .form-feedback--large .form-feedback__title {
        font-size: var(--fs-header-sm);
    }
}

/* ---------- Modal ----------
   <dialog class="modal" id="…">
       <div class="modal__box"> .modal__header + .modal__body </div>
   </dialog>
   Any [data-modal-open="id"] opens it; [data-modal-close], Esc or a click on
   the dim background closes it (main.js). Full screen on phones, a 480px card
   from 768px. */

.modal {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
}

.modal[open] {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: modal-fade-in 0.3s ease;
}

.modal::backdrop {
    background-color: rgb(31 31 31 / 25%); /* --color-black @ 25% */
}

.modal__box {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding-bottom: var(--spacing-lg);
    background-color: var(--color-white);
}

.modal__header {
    position: relative;
    z-index: var(--ui-index-2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg) var(--spacing-md);
    box-shadow: var(--shadow-soft);
}

.modal__title {
    font-size: var(--fs-header-xs);
    font-weight: var(--fw-semi-bold);
}

.modal__close {
    display: flex;
    justify-content: center;
    align-items: center;
    align-self: flex-start;
    width: 32px;
    height: 32px;
}

.modal__body {
    flex: 1 1 auto;
    overflow: hidden auto;
    padding: var(--spacing-lg) var(--spacing-md) 0;
}

@media (min-width: 768px) {
    .modal__box {
        max-width: 480px;
        height: auto;
        max-height: 100%;
        padding: 40px 34px;
        border-radius: var(--border-radius-lg);
        box-shadow: 0 0 40px rgb(234 238 241 / 70%); /* --color-gray-shadow @ 70% */
    }

    .modal__header {
        padding: 0;
        box-shadow: none;
    }

    .modal__body {
        margin-top: var(--spacing-lg);
        padding: 0;
    }
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ---------- Breadcrumbs ----------
   <ol class="breadcrumbs">
       <li class="breadcrumbs__item"><a class="breadcrumbs__home" …><img …home.svg></a></li>
       <li class="breadcrumbs__item"><img class="breadcrumbs__arrow" …><a class="breadcrumbs__link" …>…</a></li>
       <li class="breadcrumbs__item"><img class="breadcrumbs__arrow" …><span class="breadcrumbs__current">…</span></li>
   </ol>
   The first arrow is chevron-right-gray-secondary.svg, the next ones
   chevron-right-gray-disabled.svg. */

.breadcrumbs {
    margin-bottom: var(--spacing-md);
    line-height: var(--lh-large);
}

.breadcrumbs__item {
    display: inline;
    margin-right: var(--spacing-sm);
}

.breadcrumbs__item:last-child {
    margin-right: 0;
}

/* On the text baseline and 4px lower, like the inline icons of the original */
.breadcrumbs img {
    margin-bottom: calc(-1 * var(--spacing-xs));
    vertical-align: baseline;
}

.breadcrumbs__arrow {
    margin-right: var(--spacing-sm);
}

.breadcrumbs__home,
.breadcrumbs__link {
    text-decoration: none;
    transition: all var(--transition-base);
}

.breadcrumbs__home {
    color: var(--color-gray-disabled);
}

.breadcrumbs__link,
.breadcrumbs__current {
    font-size: var(--fs-xxs);
    font-weight: var(--fw-medium);
}

.breadcrumbs__link {
    color: var(--color-gray);
}

.breadcrumbs__current {
    color: var(--color-black);
}

@media (hover: hover) and (pointer: fine) {
    .breadcrumbs__home:hover,
    .breadcrumbs__link:hover {
        color: var(--color-black);
        text-decoration: underline;
    }
}

@media (min-width: 992px) {
    .breadcrumbs {
        margin-bottom: var(--spacing-lg);
    }
}

/* ---------- Accordion ----------
   <div class="accordion-list">
       <div class="accordion" data-accordion>
           <h3 class="accordion__heading">
               <button class="accordion__toggle" type="button" aria-expanded="false">
                   Question <span class="accordion__icon"><img …accordion-arrow.svg></span>
               </button>
           </h3>
           <div class="accordion__panel">
               <div class="accordion__inner"><div class="accordion__content">Answer</div></div>
           </div>
       </div>
   </div>
   main.js toggles `.is-open`; the panel slides open (grid-rows transition). */

.accordion-list {
    border-top: 1px solid var(--color-gray-stroke);
}

.accordion {
    border-bottom: 1px solid var(--color-gray-stroke);
}

.accordion__toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: var(--spacing-md) 0;
    font-size: var(--fs-header-xs);
    font-weight: var(--fw-semi-bold);
    line-height: var(--lh-base);
    text-align: left;
}

.accordion__icon {
    display: flex;
    align-items: flex-start;
    padding: 0 var(--spacing-md);
}

/* The original swaps a down arrow for an up arrow */
.accordion.is-open .accordion__icon img {
    transform: rotate(180deg);
}

.accordion__panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.2s ease;
}

.accordion.is-open .accordion__panel {
    grid-template-rows: 1fr;
}

.accordion__inner {
    overflow: hidden;
    font-size: var(--fs-base);
    line-height: var(--lh-large);
    color: var(--color-gray);
}

.accordion__content {
    padding-bottom: var(--spacing-lg);
}

@media (min-width: 768px) {
    .accordion__toggle {
        padding: var(--spacing-lg) 0;
    }

    .accordion__icon {
        padding: 0 var(--spacing-md) 0 var(--spacing-xl);
    }

    .accordion__panel {
        padding-right: 80px;
    }

    .accordion__inner {
        font-size: var(--fs-md);
    }
}

/* ---------- Page report ----------
   A centred message with a big title and buttons (the 404 page) */

.page-report {
    margin: var(--spacing-xl) 0;
    text-align: center;
}

.page-report__code {
    margin-bottom: var(--spacing-sm);
    font-size: var(--fs-md);
    font-weight: var(--fw-semi-bold);
    line-height: var(--lh-base);
    color: var(--color-gray);
}

.page-report__title {
    margin-bottom: var(--spacing-md);
    font-size: var(--fs-header-xl);
    font-weight: var(--fw-semi-bold);
    line-height: var(--lh-base);
    color: var(--color-black);
}

.page-report__text {
    margin-bottom: var(--spacing-xl);
    line-height: var(--lh-large);
    color: var(--color-gray);
}

.page-report__actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--spacing-md);
}

@media (min-width: 768px) {
    .page-report {
        margin-top: var(--spacing-xxl);
    }

    .page-report__title {
        font-size: var(--fs-header-xxl);
    }

    .page-report__text {
        font-size: var(--fs-md);
    }

    .page-report__actions {
        flex-direction: row;
        gap: var(--spacing-lg);
    }
}
