/* ============================================
   COMPONENTS — Agence Ping Pong
   ============================================ */

/* ---- BUTTONS (Mac OS 7 — coloré) ---- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: 0.75rem 2rem;
    font-family: var(--font-display);
    font-size: var(--text-small);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 0;
    cursor: pointer;
    transition:
        background-color var(--duration-fast) ease,
        box-shadow var(--duration-fast) ease;
    white-space: nowrap;
    user-select: none;
    image-rendering: auto;
}

.btn:focus-visible {
    outline: 3px solid var(--color-coral);
    outline-offset: 3px;
}

/* Coral beveled button */
.btn--primary {
    background-color: var(--color-coral);
    color: var(--color-white);
    border-top: 3px solid #FF6B76;
    border-left: 3px solid #FF6B76;
    border-right: 3px solid #A8252F;
    border-bottom: 3px solid #A8252F;
    box-shadow: 2px 2px 0 var(--color-navy);
}

.btn--primary:hover {
    background-color: #D42D3A;
    color: var(--color-white);
}

.btn--primary:active {
    border-top: 3px solid #A8252F;
    border-left: 3px solid #A8252F;
    border-right: 3px solid #FF6B76;
    border-bottom: 3px solid #FF6B76;
    box-shadow: none;
}

/* ---- CARDS (Mac OS 7 — fenêtre Finder colorée) ---- */

.card,
.realisations__card {
    display: flex;
    flex-direction: column;
    background-color: var(--color-white);
    overflow: hidden;
    cursor: pointer;
    /* Mac OS 7 window frame */
    border: 2px solid var(--color-navy);
    box-shadow: 3px 3px 0 var(--color-navy);
    transition:
        transform var(--duration-normal) var(--ease-out),
        box-shadow var(--duration-normal) var(--ease-out);
}

.card:hover,
.realisations__card:hover {
    transform: translateY(-4px);
    box-shadow: 5px 5px 0 var(--color-coral);
}

.card__img-wrapper {
    overflow: hidden;
    aspect-ratio: 16 / 10;
    position: relative;
}

/* Card image area — Mac OS 7 inset */
.card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform var(--duration-slow) var(--ease-out);
}

.realisations__card:hover .card__img {
    transform: scale(1.04);
}

.card__body {
    padding: var(--space-sm) var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    flex: 1;
    border-top: 2px solid var(--color-navy);
}

/* Card type badge — Mac OS 7 label */
.card__type {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-white);
    background-color: var(--color-coral);
    display: inline-block;
    padding: 0.15rem 0.5rem;
    align-self: flex-start;
    border-top: 1px solid #FF6B76;
    border-left: 1px solid #FF6B76;
    border-right: 1px solid #A8252F;
    border-bottom: 1px solid #A8252F;
}

.card__title {
    font-family: var(--font-display);
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 800;
    text-transform: uppercase;
    line-height: 1.2;
    color: var(--color-navy);
    transition: color var(--duration-fast) var(--ease-out);
}

.card:hover .card__title,
.realisations__card:hover .card__title {
    color: var(--color-coral);
}

.card__excerpt {
    font-size: var(--text-small);
    color: rgba(27, 42, 74, 0.7);
    line-height: 1.6;
    margin-top: var(--space-xs);
}

.card__footer {
    padding: var(--space-sm) var(--space-md);
    border-top: 2px solid var(--color-navy);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--color-cream);
}

/* ---- SPEECH BUBBLE (Mac OS 7 — dialogue box) ---- */

.speech-bubble {
    position: fixed;
    z-index: 11;
    background-color: var(--color-white);
    border: 2px solid var(--color-navy);
    border-radius: 0;
    padding: 1rem 1.5rem;
    width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: scale(0);
    transform-origin: bottom right;
    transition:
        opacity 0.4s var(--ease-out),
        visibility 0.4s var(--ease-out),
        transform 0.4s var(--ease-bounce);
    box-shadow: 3px 3px 0 var(--color-navy);
}

.speech-bubble--visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -16px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 16px solid var(--color-navy);
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -12px;
    right: 22px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 13px solid var(--color-white);
    z-index: 1;
}

.speech-bubble__close {
    position: absolute;
    top: 2px;
    right: 4px;
    background: none;
    border: none;
    font-size: 0.7rem;
    color: var(--color-navy);
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    opacity: 0.5;
}

.speech-bubble__close:hover {
    opacity: 1;
}

.speech-bubble__text {
    font-family: var(--font-display);
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    font-weight: 700;
    color: var(--color-navy);
    text-align: center;
    line-height: 1.3;
    margin: 0;
}

/* ---- BACK TO TOP (Mac OS 7 — beveled button) ---- */

.back-to-top {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    margin-left: -24px;
    z-index: 90;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-navy);
    color: var(--color-white);
    border-top: 3px solid #3A5080;
    border-left: 3px solid #3A5080;
    border-right: 3px solid #0D1525;
    border-bottom: 3px solid #0D1525;
    border-radius: 0;
    cursor: pointer;
    box-shadow: 2px 2px 0 #000000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition:
        opacity 0.3s var(--ease-out),
        visibility 0.3s var(--ease-out),
        transform 0.3s var(--ease-out),
        background-color var(--duration-fast) ease,
        box-shadow var(--duration-fast) ease;
}

.back-to-top--visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: var(--color-coral);
    border-top-color: #FF6B76;
    border-left-color: #FF6B76;
    border-right-color: #A8252F;
    border-bottom-color: #A8252F;
}

.back-to-top:active {
    border-top-color: #0D1525;
    border-left-color: #0D1525;
    border-right-color: #3A5080;
    border-bottom-color: #3A5080;
    box-shadow: none;
}

.back-to-top:focus-visible {
    outline: 3px solid var(--color-coral);
    outline-offset: 3px;
}
