/* ===============================
   FOUNDATIONS
   Shared motion, type, and interaction primitives.
   Loaded first on every page so page-specific CSS can override.
=================================*/

:root {
    /* Critically-damped default: settles smoothly, no overshoot */
    --ease-out-spring: cubic-bezier(0.16, 1, 0.3, 1);
    /* Slight bounce, reserved for momentum-driven interactions */
    --ease-spring-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

    --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --accent: #0071e3;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3 {
    text-wrap: balance;
}

/* width/height attrs only reserve aspect ratio; CSS still decides the size */
img {
    width: auto;
    height: auto;
}

.menu-toggle {
    background: none;
    border: 0;
}

/* Mobile dropdown links: full-width 44px tap targets, no desktop underline */
@media (max-width: 900px) {
    .nav-menu a {
        display: block;
        padding: 12px 14px;
        border-radius: 8px;
    }
    .nav-menu a:hover,
    .nav-menu a:focus-visible {
        background: rgba(255, 255, 255, 0.08);
    }
    .nav-menu a::after {
        display: none;
    }
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -100px;
    z-index: 1000;
    padding: 10px 16px;
    background: #fff;
    color: #111;
    border-radius: 8px;
    text-decoration: none;
}

.skip-link:focus {
    top: 16px;
}

/* ===============================
   CERTIFICATE CARD — thumb + title + issuer line; whole card opens the lightbox
   Used on Recognition and Ebani pages.
=================================*/
.cert-card {
    position: relative;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 14px;
    padding: 14px;
    text-align: left;
    cursor: zoom-in;
    transition: transform 0.35s var(--ease-out-spring);
}

/* Shadow lives on a pseudo-element so only opacity animates */
.cert-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.14);
    opacity: 0;
    transition: opacity 0.35s var(--ease-out-spring);
    pointer-events: none;
}

.cert-thumb {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    cursor: zoom-in;
    aspect-ratio: 4 / 3;
    background: #f7f7f7;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 14px;
}

/* Whole card is clickable: stretch the thumb button's hit area over the card */
.cert-thumb::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 14px;
}

/* Fill the box edge to edge; portrait certificates show their top (logo + title).
   Full certificate is always one click away in the lightbox. */
.cert-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    transition: scale 0.35s var(--ease-out-spring);
}

/* Sideways scans: swap the box's sides (4:3 → 3:4), then rotate upright.
   The extra 1/3 of height is pulled back with -12.5% margins (% = of width). */
.cert-thumb img[data-rotate] {
    width: 75%;
    height: 133.34%;
    margin: -12.5% auto;
    rotate: -90deg;
    object-fit: contain;
}

.cert-card h3 {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: #222;
    margin-bottom: 4px;
}

.cert-card p {
    font-size: 13px;
    line-height: 1.5;
    color: #777;
}

@media (hover: hover) and (pointer: fine) {
    .cert-card:hover {
        transform: scale(1.06);
        z-index: 1;
    }
    .cert-card:hover::after {
        opacity: 1;
    }
    .cert-card:hover .cert-thumb img {
        scale: 1.04;
    }
}

/* ===============================
   LIGHTBOX — any img inside [data-lightbox] opens full screen
   (native <dialog>: Escape, focus trap and focus return built in)
=================================*/
/* Same lift as the Recognition cards: grow, rise above neighbours, shadow in */
[data-lightbox] :not(.cert-thumb) > img:not([data-no-zoom]) {
    position: relative;
    border-radius: 10px;
    cursor: zoom-in;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    transition: scale 0.35s var(--ease-out-spring),
                box-shadow 0.35s var(--ease-out-spring);
}

@media (hover: hover) and (pointer: fine) {
    [data-lightbox] :not(.cert-thumb) > img:not([data-no-zoom]):hover {
        scale: 1.025;
        z-index: 1;
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
    }
}

[data-lightbox] img:not([data-no-zoom]) {
    cursor: zoom-in;
}

.lightbox {
    max-width: none;
    max-height: none;
    width: 100vw;
    height: 100dvh;
    margin: 0;
    padding: 56px 16px 16px;
    border: 0;
    background: transparent;
    place-items: center;
    overscroll-behavior: contain;
}

.lightbox[open] {
    display: grid;
    animation: lightbox-in 0.3s var(--ease-out-spring);
}

.lightbox::backdrop {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(6px);
    animation: lightbox-fade 0.3s var(--ease-out-spring);
}

.lightbox img {
    max-width: min(100%, 1200px);
    max-height: calc(100dvh - 88px);
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: zoom-out;
}

/* Sideways-scanned documents: rotate, and swap which edge is the limit */
.lightbox.is-rotated img {
    rotate: -90deg;
    max-width: calc(100dvh - 88px);
    max-height: calc(100vw - 32px);
}

.lightbox-close {
    position: fixed;
    top: 8px;
    right: 12px;
    width: 44px;
    height: 44px;
    font-size: 36px;
    line-height: 1;
    color: #fff;
    background: none;
    border: 0;
    cursor: pointer;
}

@keyframes lightbox-in {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes lightbox-fade {
    from { opacity: 0; }
}

::selection {
    background: var(--accent);
    color: #fff;
}

a:focus-visible,
button:focus-visible,
video:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

/* Anchor targets (Tech/Sports sections) shouldn't sit flush under the sticky header */
section[id] {
    scroll-margin-top: 90px;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
