/**
 * orbit-gallery.css — Certificates & Achievements
 * Monochrome cosmic system, matched to main.css + grav.css.
 * The figure holds the centre; credentials orbit around it.
 */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    border: none;
    outline: none;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

:root {
    --bg-color: #030407;
    --surface: #080d14;
    --card-bg: rgba(18, 22, 28, 0.62);
    --card-border: rgba(255, 255, 255, 0.10);
    --border-md: rgba(255, 255, 255, 0.20);
    --border-hi: rgba(255, 255, 255, 0.32);
    --text-color: #f1f5f9;
    --text-secondary: #b6bec8;
    --text-muted: #7c848f;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
    font-size: 62.5%;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

*::selection {
    background: #ffffff;
    color: var(--bg-color);
}

/* ========================================================
   HEADER — identical treatment to the home page
   ======================================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.8rem 7%;
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: all 0.4s var(--ease);
}

.header.sticky {
    background: rgba(4, 6, 9, 0.82);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--card-border);
    padding: 1.2rem 7%;
}

.logo {
    font-size: 2.2rem;
    color: var(--text-color);
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
}

.logo-dot {
    color: #ffffff;
}

.navbar {
    display: flex;
    gap: 2.5rem;
    align-items: center;
}

.navbar a {
    font-size: 1.45rem;
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    transition: color 0.3s ease;
}

.navbar a:hover,
.navbar a.active {
    color: #ffffff;
}

.navbar a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: #ffffff;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.navbar a:hover::after,
.navbar a.active::after {
    width: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

#menu-icon {
    font-size: 3rem;
    color: var(--text-color);
    display: none;
    cursor: pointer;
}

/* ========================================================
   PAGE INTRO
   ======================================================== */
.orbit-page {
    position: relative;
    padding: 13rem 7% 6rem;
    background:
        radial-gradient(ellipse 70% 55% at 50% 42%, #121620 0%, #0a0d13 40%, #05070a 70%, transparent 100%),
        var(--bg-color);
}

.orbit-intro {
    text-align: center;
    max-width: 70rem;
    margin: 0 auto 3.5rem;
    position: relative;
    z-index: 5;
}

.orbit-label {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1.6rem;
}

.orbit-label::before {
    content: '—';
    margin-right: 0.6em;
    opacity: 0.4;
}

.orbit-title {
    font-size: clamp(3.6rem, 6vw, 5.6rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.08;
    color: #ffffff;
}

.orbit-title span {
    color: #5c6169;
}

.orbit-subtitle {
    font-size: 1.6rem;
    color: var(--text-secondary);
    margin-top: 1.4rem;
    line-height: 1.7;
}

.orbit-stats {
    display: flex;
    justify-content: center;
    gap: 4.5rem;
    flex-wrap: wrap;
    margin-top: 2.8rem;
}

.orbit-stat-num {
    display: block;
    font-size: 3.2rem;
    font-weight: 200;
    color: #ffffff;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.orbit-stat-label {
    display: block;
    font-size: 1.1rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 0.7rem;
}

/* ========================================================
   FILTER BAR
   ======================================================== */
.orbit-filters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    position: relative;
    z-index: 5;
}

.orbit-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 2rem;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 3rem;
    font-size: 1.35rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.orbit-filter:hover {
    border-color: var(--border-hi);
    color: #ffffff;
}

.orbit-filter.active {
    background: #ffffff;
    border-color: #ffffff;
    color: #04060a;
}

.orbit-filter i {
    font-size: 1.6rem;
}

.orbit-hint {
    text-align: center;
    font-size: 1.2rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 1rem;
    position: relative;
    z-index: 5;
}

/* ========================================================
   THE ORBIT STAGE
   ======================================================== */
.orbit-stage {
    position: relative;
    width: 100%;
    height: min(1020px, 88vw);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* --- Centre: the figure and its halo (same layering as the hero) --- */
.orbit-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 460px;
    height: 660px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
}

.orbit-corona {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 560px;
    height: 560px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(255, 255, 255, 0.10) 0%,
        rgba(255, 255, 255, 0.055) 30%,
        rgba(255, 255, 255, 0.02) 52%,
        rgba(255, 255, 255, 0.006) 70%,
        transparent 84%);
    filter: blur(44px);
    z-index: 1;
}

.orbit-corona::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 65%;
    height: 65%;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(255, 255, 255, 0.16) 0%,
        rgba(255, 255, 255, 0.07) 40%,
        rgba(255, 255, 255, 0.015) 68%,
        transparent 82%);
    filter: blur(30px);
}

.orbit-core-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 440px;
    height: 440px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: radial-gradient(circle,
        rgba(6, 8, 11, 0.55) 0%,
        rgba(10, 12, 16, 0.35) 58%,
        rgba(255, 255, 255, 0.035) 88%,
        rgba(255, 255, 255, 0.06) 100%);
    box-shadow:
        0 0 60px rgba(255, 255, 255, 0.06),
        inset 0 0 90px rgba(255, 255, 255, 0.045);
    z-index: 2;
}

.orbit-figure {
    position: relative;
    max-width: 400px;
    max-height: 620px;
    object-fit: contain;
    z-index: 3;
    filter:
        drop-shadow(0 24px 50px rgba(0, 0, 0, 0.75))
        drop-shadow(0 0 26px rgba(255, 255, 255, 0.10));
}

.orbit-floor-shadow {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 52px;
    background: radial-gradient(ellipse at center,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.45) 42%,
        rgba(0, 0, 0, 0.12) 66%,
        transparent 80%);
    filter: blur(14px);
    z-index: 2;
}

/* --- Guide rings --- */
.orbit-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 1px dashed rgba(255, 255, 255, 0.06);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
}

/* --- Rotating rings holding the certificates --- */
/* Behind the figure — certificates pass around and behind him.
   .orbit-core is pointer-events:none so clicks still reach the thumbnails. */
.orbit-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    z-index: 3;
    animation: orbitSpin var(--dur, 90s) linear infinite;
    will-change: transform;
}

.orbit-ring[data-dir="ccw"] {
    animation-direction: reverse;
}

@keyframes orbitSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Each item sits on the ring at --a degrees, --r px out */
.orbit-cert {
    position: absolute;
    top: 0;
    left: 0;
    width: 96px;
    height: 72px;
    margin: -36px 0 0 -48px;
    transform: rotate(var(--a)) translate(var(--r)) rotate(calc(-1 * var(--a)));
}

/* Inner element counter-rotates so thumbnails stay upright */
.orbit-cert-inner {
    width: 100%;
    height: 100%;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--card-border);
    background: var(--surface);
    cursor: pointer;
    display: block;
    padding: 0;
    position: relative;
    animation: orbitSpin var(--dur, 90s) linear infinite reverse;
    transition: border-color 0.35s ease, box-shadow 0.35s ease;
    will-change: transform;
}

.orbit-ring[data-dir="ccw"] .orbit-cert-inner {
    animation-direction: normal;
}

.orbit-cert-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0.62;
    transition: opacity 0.35s ease;
}

.orbit-cert-inner:hover {
    border-color: var(--border-hi);
    box-shadow: 0 0 26px rgba(255, 255, 255, 0.18);
}

.orbit-cert-inner:hover img,
.orbit-cert-inner:focus-visible img {
    opacity: 1;
}

.orbit-cert-inner:focus-visible {
    outline: 1px solid #ffffff;
    outline-offset: 3px;
}

/* Item currently open in the popup keeps its slot marked */
.orbit-cert.is-open .orbit-cert-inner {
    border-color: #ffffff;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

/* Pause only while a certificate is open */
.orbit-stage.paused .orbit-ring,
.orbit-stage.paused .orbit-cert-inner {
    animation-play-state: paused;
}

/* ========================================================
   CERTIFICATE POPUP
   ======================================================== */
.cert-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 9999;
    padding: 4rem 3rem;
    align-items: center;
    justify-content: center;
}

.cert-modal.open {
    display: flex;
}

.cert-modal-inner {
    position: relative;
    max-width: 1000px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.8rem;
}

.cert-modal-img {
    max-width: 100%;
    max-height: 72vh;
    object-fit: contain;
    border-radius: 0.8rem;
    border: 1px solid var(--border-md);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.9);
    background: #ffffff;
}

.cert-modal-info {
    text-align: center;
}

.cert-modal-badge {
    display: inline-block;
    font-size: 1.05rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}

.cert-modal-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #ffffff;
}

.cert-modal-actions {
    display: flex;
    gap: 1.2rem;
    margin-top: 1.4rem;
    flex-wrap: wrap;
    justify-content: center;
}

.cert-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    padding: 1rem 2.2rem;
    border-radius: 0.8rem;
    font-size: 1.35rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid var(--border-md);
    background: transparent;
    color: var(--text-secondary);
    transition: border-color 0.3s ease, color 0.3s ease, background 0.3s ease;
}

.cert-modal-btn:hover {
    border-color: #ffffff;
    color: #ffffff;
}

.cert-modal-btn.primary {
    background: #ffffff;
    border-color: #ffffff;
    color: #04060a;
}

.cert-modal-close {
    position: fixed;
    top: 2.4rem;
    right: 3rem;
    width: 4.6rem;
    height: 4.6rem;
    border-radius: 50%;
    border: 1px solid var(--border-md);
    background: rgba(10, 12, 16, 0.85);
    color: var(--text-secondary);
    font-size: 2.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s ease, color 0.3s ease;
    z-index: 2;
}

.cert-modal-close:hover {
    border-color: #ffffff;
    color: #ffffff;
}

.cert-modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 4.6rem;
    height: 4.6rem;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: rgba(10, 12, 16, 0.85);
    color: var(--text-secondary);
    font-size: 2.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s ease, color 0.3s ease;
    z-index: 2;
}

.cert-modal-nav:hover {
    border-color: #ffffff;
    color: #ffffff;
}

.cert-modal-prev { left: 3rem; }
.cert-modal-next { right: 3rem; }

/* ========================================================
   FOOTER
   ======================================================== */
.orbit-footer {
    padding: 4rem 7%;
    border-top: 1px solid var(--card-border);
    text-align: center;
    background: var(--bg-color);
}

.orbit-footer-logo {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-color);
}

.orbit-footer p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-top: 0.6rem;
}

/* ========================================================
   FALLBACK GRID — narrow screens and reduced motion
   ======================================================== */
.orbit-grid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.4rem;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 4rem;
}

.orbit-grid .orbit-cert-inner {
    width: 100%;
    height: 130px;
    animation: none;
}

/* ========================================================
   RESPONSIVE
   ======================================================== */
@media (max-width: 1200px) {
    html { font-size: 58%; }
    .orbit-core { width: 380px; height: 540px; }
    .orbit-core-ring { width: 360px; height: 360px; }
    .orbit-corona { width: 460px; height: 460px; }
    .orbit-figure { max-width: 320px; max-height: 500px; }
    .orbit-cert { width: 84px; height: 63px; margin: -31px 0 0 -42px; }
}

@media (max-width: 991px) {
    .header { padding: 1.8rem 4%; }
    .orbit-page { padding: 11rem 4% 4rem; }
    .navbar { gap: 1.8rem; }
    .navbar a { font-size: 1.35rem; }
}

/* Mirrors the home page mobile menu (css/main.css) */
@media (max-width: 768px) {
    #menu-icon { display: block; }

    .navbar {
        position: fixed;
        top: 100%;
        left: 0;
        width: 100%;
        padding: 2rem 5%;
        background: var(--bg-color);
        border-top: 1px solid var(--card-border);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
        flex-direction: column;
        gap: 2rem;
        display: none;
    }

    .navbar.active { display: flex; }
}

/* Below this width the orbit stops being readable — show the grid instead */
@media (max-width: 820px) {
    .orbit-stage { display: none; }
    .orbit-grid { display: grid; }
    .orbit-hint { margin-bottom: 2.4rem; }

    .cert-modal { padding: 6rem 1.6rem 2rem; }
    .cert-modal-close { top: 1.2rem; right: 1.2rem; }
    .cert-modal-nav { display: none; }
    .cert-modal-img { max-height: 60vh; }
}

@media (prefers-reduced-motion: reduce) {
    .orbit-ring,
    .orbit-cert-inner {
        animation: none !important;
    }
}
