/*
 * Localized Casebook/gear-impulse component library.
 * Class names and structure kept identical to Casebook so components are
 * drop-in compatible with that system — see DESIGN_SYSTEM.md for the
 * Fluent-in-Figma -> local-name mapping this was localized from.
 * Tokens come from ../design-system/tokens.css.
 */

/* ===================== Icons ===================== */
.ui-icon {
    display: inline-block;
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    pointer-events: none;
    vertical-align: middle;
}

.hero-logo-mark {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: -1;
    -webkit-filter: drop-shadow(20px 20px 40px rgba(0, 0, 0, 0.10)) drop-shadow(-20px -20px 60px rgba(255, 255, 255, 0.30)) drop-shadow(-15px -10px 43px rgba(255, 255, 255, 0.39));
    filter: drop-shadow(20px 20px 40px rgba(0, 0, 0, 0.10)) drop-shadow(-20px -20px 60px rgba(255, 255, 255, 0.30)) drop-shadow(-15px -10px 43px rgba(255, 255, 255, 0.39));
}
.hero-logo-mark__fill {
    display: block;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(0deg, rgba(255, 255, 255, 0.20) 0%, rgba(255, 255, 255, 0.20) 100%),
        linear-gradient(0deg, rgba(10, 109, 173, 0.30) 0%, rgba(10, 109, 173, 0.30) 100%),
        linear-gradient(115deg, #EBECEE -23.83%, #E4E5E9 34.69%, #D5D7DF 83.98%);
    background-blend-mode: normal, color, normal;
}

/* ===================== Buttons ===================== */
.button-large,
.button-medium,
.button-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-4);
    border: none;
    cursor: pointer;
    font-family: var(--main-font);
    font-weight: var(--font-weight-bold);
    border-radius: var(--radius-3);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
}
.button-large:active,
.button-medium:active,
.button-icon:active { transform: scale(.97); }
.button-large:disabled,
.button-medium:disabled,
.button-icon:disabled { transform: none; }
.button-large { padding: 0 var(--space-24); height: 48px; font-size: 16px; line-height: 22px; }
.button-medium { padding: 0 var(--space-16); height: 36px; font-size: 14px; line-height: 22px; }
.button-icon { padding: 0; height: 36px; width: 36px; min-width: 36px; }

.button-blue { background: var(--color-blue-80); color: var(--color-grey-white); }
.button-blue:active { background: var(--color-blue-40); }
.button-blue.active { background: var(--color-blue-60); }
.button-blue:disabled { background: var(--color-grey-94); color: var(--color-grey-74); pointer-events: none; }

.button-red { background: #E43434; color: var(--color-grey-white); }
.button-red:active { background: #942222; }
.button-red:disabled { background: var(--color-grey-94); color: var(--color-grey-74); pointer-events: none; }

.button-dark { background: var(--color-grey-20); color: var(--color-grey-white); }
.button-dark:active { background: #000; }
.button-dark:disabled { background: var(--color-grey-94); color: var(--color-grey-74); pointer-events: none; }

.button__icon-box { width: 24px; height: 24px; border-radius: 4px; background: var(--color-grey-96); flex-shrink: 0; }
.button__chevron { width: 12px; height: 7px; flex-shrink: 0; color: var(--color-grey-52); }

.button-white {
    background: var(--color-white-transparent-85);
    color: var(--color-text-black);
    border: 1px solid var(--color-grey-82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.button-white:active { background: var(--color-grey-80-transparent-85); }
.button-white:disabled { background: var(--color-white-transparent-85); color: var(--color-grey-74); pointer-events: none; }
.button-white.active { background: #EBEBEB; border-color: #BDBDBD; }
.button-white.button-icon { border: none; }
.button-white.button-icon.active { background: #EBEBEB; }

@media (min-width: 1024px) {
    .button-blue:hover { background: var(--color-blue-70); }
    .button-red:hover { background: #C22C2C; }
    .button-dark:hover { background: #000; }
    .button-white:hover { background: var(--color-grey-90-transparent-85); }
}

/* ===================== Tabs (pill-style) ===================== */
.tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.tab {
    display: inline-flex;
    align-items: center;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 999px;
    padding: 11px 18px;
    font-family: var(--main-font);
    font-weight: var(--font-weight-bold);
    font-size: 16px;
    line-height: 22px;
    color: var(--color-grey-20);
    transition: background .12s ease, color .12s ease, transform .1s ease;
}
.tab:hover { background: var(--color-grey-94); }
.tab:active { transform: scale(.96); }
.tab.is-active { background: var(--color-grey-20); color: var(--color-grey-white); }
.tab.is-active:hover { background: var(--color-grey-20); }
.tab:disabled { color: var(--color-grey-74); cursor: default; pointer-events: none; }

.tab--filter {
    cursor: default;
    padding: 6px 10px;
    background: var(--color-blue-tint-bg);
    color: var(--color-grey-20);
    font-weight: var(--font-weight-regular);
    font-size: 14px;
    line-height: 20px;
}
.tab--filter:hover { background: var(--color-blue-tint-bg); }
.tab--filter.is-active { background: var(--color-grey-20); color: var(--color-grey-white); }
.tab--filter.is-active:hover { background: var(--color-grey-20); }

/* ===================== Back link ===================== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-12) var(--space-24);
    border-radius: var(--radius-3);
    background: #fff;
    color: var(--color-text-black);
    font-family: var(--main-font);
    font-weight: var(--font-weight-bold);
    font-size: 16px;
    line-height: 22px;
    transition: background .12s ease;
}
.back-link:hover { background: var(--color-grey-96); }
.back-link:active { transform: scale(.97); }
.back-link__chevron { width: 24px; height: 24px; flex-shrink: 0; transition: transform .15s ease; }
.back-link:hover .back-link__chevron { transform: translateX(-3px); }

/* ===================== Search bar ===================== */
.search-bar { display: flex; align-items: stretch; flex: 1; min-width: 0; position: relative; }
.search-bar__input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 32px 0 var(--space-12);
    border: 1px solid var(--color-grey-82);
    border-right: none;
    border-radius: var(--radius-3) 0 0 var(--radius-3);
    font-family: var(--main-font);
    font-size: 16px;
    color: var(--color-text-black);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.search-bar__input::placeholder { color: var(--color-grey-52); }
.search-bar__input:hover { border-color: var(--color-grey-70); }
.search-bar__input:focus { outline: none; border-color: var(--color-blue-80); box-shadow: 0 0 0 3px rgba(10,109,174,.12); }
.search-bar__clear {
    display: none;
    position: absolute;
    right: 48px;
    top: 8px;
    transform: translateY(-50%);
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--color-grey-52);
    cursor: pointer;
}
.search-bar__clear.is-visible { display: inline-flex; }
.search-bar__clear:hover { color: var(--color-grey-20); }
.search-bar__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: none;
    border-radius: 0 var(--radius-3) var(--radius-3) 0;
    background: var(--color-grey-20);
    color: #fff;
    cursor: pointer;
    transition: background .12s ease, transform .1s ease;
}
.search-bar__button:hover { background: #000; }
.search-bar__button:active { transform: scale(.93); }
.search-bar__button svg { width: 20px; height: 20px; }

/* ===================== Blog post card ===================== */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--color-card-border);
    border-left: 1px solid var(--color-card-border);
}
.blog-post-card {
    background: #fff;
    border-right: 1px solid var(--color-card-border);
    border-bottom: 1px solid var(--color-card-border);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 0;
    min-width: 0;
    transition: background .18s ease, transform .1s ease;
}
.blog-post-card:hover { z-index: 1; background: var(--color-grey-96); }
.blog-post-card:active { transform: scale(.98); }
.blog-post-card:hover .blog-post-card__title { color: var(--color-blue-80); }
.blog-post-card__title { transition: color .15s ease; }
.blog-post-card__media { aspect-ratio: 2 / 1; min-width: 0; padding: var(--space-8); border-bottom: 1px solid var(--color-card-border); }
.blog-post-card__media-inner {
    height: 100%;
    min-width: 0;
    border: 1px solid var(--color-card-border);
    background: var(--color-grey-94);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-grey-52);
    font: var(--text-small-desktop);
    text-align: center;
}
.blog-post-card__body { flex: 1; padding: var(--space-24); display: flex; flex-direction: column; gap: var(--space-12); }
.blog-post-card__meta { display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: var(--space-12); }
.blog-post-card__tags { display: flex; flex-wrap: nowrap; flex: 0 1 auto; min-width: 0; gap: 10px; }
.blog-post-card__date { font: var(--text-medium-desktop); color: var(--color-grey-40); flex-shrink: 0; white-space: nowrap; }
.blog-post-card__title { font: var(--text-h5-desktop); color: var(--color-grey-20); }

.blog-post-card--wide { grid-column: span 2; flex-direction: row; }
.blog-post-card--wide .blog-post-card__media { flex: 1; height: auto; border-bottom: none; }
.blog-post-card--wide .blog-post-card__body { flex: 1; justify-content: space-between; gap: var(--space-16); border-right: 1px solid var(--color-card-border); }
.blog-post-card--wide .blog-post-card__title { font: var(--text-h4-desktop); }
.blog-post-card--wide .blog-post-card__desc { font: var(--text-large-desktop); color: var(--color-grey-46); }
.blog-post-card--wide .blog-post-card__arrow { align-self: flex-end; width: 24px; height: 24px; color: var(--color-grey-20); transition: transform .18s ease, color .15s ease; }
.blog-post-card--wide:hover .blog-post-card__arrow { transform: translate(3px, -3px); color: var(--color-blue-80); }

/* ===================== Fields ===================== */
.form-group { display: flex; flex-direction: column; gap: var(--space-8); margin-bottom: var(--space-16); }
.form-hint { font-size: 12px; color: var(--text-color-light); }
.form-error { font-size: 13px; color: var(--error-color); }

.search-field {
    padding-right: var(--space-32);
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px 20px;
}

input[type=checkbox] {
    border-radius: 2px;
    width: 1em; height: 1em;
    vertical-align: top;
    background-color: #fff;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px 16px;
    border: 1px solid var(--color-text-black);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    flex-shrink: 0;
    cursor: pointer;
    margin: var(--space-4) 0;
    transition: background-color .12s ease, border-color .12s ease, transform .1s ease;
}
input[type=checkbox]:hover { border-color: var(--color-grey-52); }
input[type=checkbox]:active { transform: scale(.9); }
input[type=checkbox]:checked {
    background-color: var(--color-blue-80);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M2 8l4 4 8-8' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3e%3c/svg%3e");
    border: none;
}

/* ===================== Badges / chips / labels ===================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-4);
    font-size: 12px;
    font-weight: var(--font-weight-regular);
    line-height: 16px;
    padding: 2px var(--space-8);
    border-radius: 999px;
    background: var(--badge-bg, var(--color-neutral-bg));
    color: var(--badge-color, var(--color-neutral-text));
    white-space: nowrap;
    text-decoration: none;
    mix-blend-mode: multiply;
}
.badge-sm { font-size: 12px; padding: 2px var(--space-8); }
.badge-md { font-size: 14px; padding: var(--space-4) var(--space-8); }
.badge-lg { font-size: 16px; line-height: 22px; padding: 6px 10px; }

.badge-green { --badge-bg: var(--color-success-bg); --badge-color: var(--color-success-text); }
.badge-blue { --badge-bg: var(--color-info-bg); --badge-color: var(--color-info-text); }
.badge-gray { --badge-bg: var(--color-neutral-bg); --badge-color: var(--color-neutral-text); }
.badge-red { --badge-bg: var(--color-danger-bg); --badge-color: var(--color-danger-text); }
.badge-orange { --badge-bg: var(--color-warning-bg); --badge-color: var(--color-warning-text); }
.badge-yellow { --badge-bg: var(--color-attention-bg); --badge-color: var(--color-attention-text); }
.badge-purple { --badge-bg: var(--color-special-bg); --badge-color: var(--color-special-text); }
.badge-white { --badge-bg: var(--color-white-bg); --badge-color: var(--color-white-text); }

.badge-outline { border: 1px solid var(--badge-color); padding: 1px 7px; }
.badge-group { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }

.badge-tag { --badge-bg: #fff; --badge-color: var(--color-blue-80); mix-blend-mode: normal; }
.badge-tag--muted { --badge-bg: var(--color-grey-96); }
.badge-tag--tint {
    --badge-bg: var(--color-blue-tint-bg);
    --badge-color: var(--color-grey-20);
    font-weight: var(--font-weight-regular);
    font-size: 14px;
    line-height: 20px;
    padding: 6px 10px;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    mix-blend-mode: multiply;
}
.status--draft { background: #f1f3f5; color: #495057; }
.status--in-progress { background: #fff3cd; color: #856404; }
.status--done { background: #d1e7dd; color: #0a5239; }
.status--passed { background: #d4edda; color: #155724; }
.status--failed { background: #f8d7da; color: #721c24; }
.status--stopped { background: #e2e3e5; color: #383d41; }

/* ===================== Modal ===================== */
.modal-overlay {
    position: fixed; inset: 0;
    background-color: rgba(0,0,0,.5);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
}
.modal-overlay[hidden] { display: none; }
.modal-content {
    background: var(--surface-color);
    display: flex; flex-direction: column; gap: var(--space-20);
    padding: 2rem; border-radius: 8px;
    width: 100%; max-width: 500px;
    position: relative;
}

.auth-card {
    background: #fff;
    padding: var(--space-40);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-24);
    border: 1px solid var(--border-color);
}

/* ===================== Contact form fields ===================== */
.contact-form {
    background: var(--color-grey-94);
    border: 1px solid var(--color-card-border);
    padding: var(--space-40);
}
.contact-form__body { display: flex; flex-direction: column; gap: var(--space-24); }
.contact-form__row { display: flex; gap: var(--space-20); }
.contact-form__field { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-8); }
.contact-form__field label { font: var(--text-large-desktop); color: var(--color-grey-20); }
.contact-form__input,
.contact-form__textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--color-grey-82);
    border-radius: var(--radius-3);
    padding: var(--space-12);
    font: var(--text-large-desktop);
    color: var(--color-grey-20);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.contact-form__input { height: 48px; }
.contact-form__textarea { height: 128px; resize: vertical; }
.contact-form__input::placeholder,
.contact-form__textarea::placeholder { color: var(--color-grey-52); }
.contact-form__input:hover,
.contact-form__textarea:hover { border-color: var(--color-grey-70); }
.contact-form__input:focus,
.contact-form__textarea:focus { outline: none; border-color: var(--color-blue-80); box-shadow: 0 0 0 3px rgba(10,109,174,.12); }
.contact-form__consent { display: flex; align-items: center; gap: var(--space-8); }
.contact-form__consent label { font: var(--text-medium-desktop); color: var(--color-grey-20); }
.contact-form__consent label a { color: var(--color-blue-80); text-decoration: underline; }
.contact-form__consent label a:hover { color: var(--color-blue-100, var(--color-blue-80)); }
.contact-form__submit { width: 100%; }
.contact-form__error { display: block; font: var(--text-medium-desktop); color: var(--color-danger-text); }
.contact-form__error[hidden] { display: none; }
.contact-form__field.is-invalid .contact-form__input,
.contact-form__field.is-invalid .contact-form__textarea { border-color: var(--color-danger-text); }
.contact-form__consent.is-invalid label { color: var(--color-danger-text); }
.contact-form__body[hidden] { display: none; }
.contact-form__trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-form__submit-error { display: block; margin-top: var(--space-8); font: var(--text-medium-desktop); color: var(--color-danger-text); }
.contact-form__submit-error[hidden] { display: none; }
.contact-form__success {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    padding: var(--space-20);
    border-radius: var(--radius-3);
    background: var(--color-success-bg);
}
.contact-form__success[hidden] { display: none; }
.contact-form__success-title { font: var(--text-large-desktop); font-weight: 700; color: var(--color-success-text); }
.contact-form__success-message { font: var(--text-medium-desktop); color: var(--color-success-text); }

/* ===================== Contact modal ===================== */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: var(--space-24); }
.modal.is-open { display: flex; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(33, 33, 33, .5); }
.modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 640px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: var(--color-grey-94);
    border: 1px solid var(--color-card-border);
    box-shadow: var(--shadow-5);
    padding: var(--space-40);
}
.modal__close {
    all: unset;
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-grey-52);
    cursor: pointer;
    border-radius: var(--radius-3);
    transition: background .12s ease, color .12s ease;
}
.modal__close:hover { background: var(--color-grey-90); color: var(--color-grey-20); }
.modal__eyebrow { font: var(--text-large-desktop); color: var(--color-blue-80); }
.modal__title { font: var(--text-h2-desktop); color: var(--color-grey-20); margin-top: var(--space-16); }
.modal__subtitle { font: var(--text-medium-desktop); color: var(--color-grey-40); margin-top: var(--space-8); }

.zoom-trigger {
    all: unset;
    position: absolute;
    right: var(--space-12);
    bottom: var(--space-12);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--color-card-border);
    color: var(--color-grey-20);
    cursor: pointer;
    transition: background .12s ease, transform .1s ease;
}
.zoom-trigger:hover { background: var(--color-grey-96); }
.zoom-trigger:active { transform: scale(.93); }
:has(> .zoom-trigger) { cursor: pointer; }
:has(> .zoom-trigger):hover .zoom-trigger { background: var(--color-grey-96); }

.image-lightbox__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    max-width: calc(100vw - 96px);
    max-height: calc(100vh - 48px);
}
.image-lightbox .modal__close {
    top: -16px;
    right: -16px;
    background: #fff;
    color: var(--color-grey-20);
    border-radius: 50%;
    box-shadow: var(--shadow-3);
}
.image-lightbox .modal__close:hover { background: var(--color-grey-96); }
.image-lightbox__content { display: flex; touch-action: none; }
.image-lightbox__content .media-placeholder { display: flex; background: none; font: var(--text-large-desktop); }
.image-lightbox__content .media-placeholder img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(1100px, calc(100vw - 96px));
    max-height: calc(100vh - 96px);
    object-fit: contain;
    touch-action: none;
    transform-origin: center center;
}

@media (max-width: 1023px) {
    .modal { padding: var(--space-16); }
    .image-lightbox__dialog { max-width: calc(100vw - 40px); max-height: calc(100vh - 32px); }
    .image-lightbox__content .media-placeholder img { max-width: calc(100vw - 40px); max-height: calc(100vh - 64px); }
}
.modal .contact-form { background: none; border: none; padding: var(--space-24) 0 0; }
body.modal-open { overflow: hidden; }

@media (max-width: 767px) {
    .modal__eyebrow { font: var(--text-large-mobile); }
    .modal__title { font: var(--text-h2-mobile); }
    .modal__subtitle { font: var(--text-medium-mobile); }
    .modal .contact-form__field label { font: var(--text-large-mobile); }
    .modal .contact-form__input,
    .modal .contact-form__textarea { font: var(--text-large-mobile); }
    .modal .contact-form__consent label { font: var(--text-medium-mobile); }
    .modal .contact-form__error { font: var(--text-medium-mobile); }
    .modal .contact-form__submit-error { font: var(--text-medium-mobile); }
    .modal .contact-form__success-title { font: var(--text-large-mobile); }
    .modal .contact-form__success-message { font: var(--text-medium-mobile); }
}

@media (max-width: 620px) {
    .modal__dialog { padding: var(--space-16); }
    .modal .contact-form__body { gap: var(--space-16); }
    .modal .contact-form { padding-top: var(--space-16); }
}

@media (max-width: 480px) {
    .modal .contact-form__row { flex-direction: column; gap: var(--space-16); }
}
