/* Written with love by Enguerrand Quilliard (Tricotou) */
/* See more at tricotools.com */

:root {
    --bg: #04050f;
    --glass: rgba(10, 14, 30, 0.72);
    --glass-border: rgba(120, 200, 255, 0.18);
    --text: #eaf4ff;
    --muted: #9fb4d4;
    --accent: #5ee7ff;
    --accent-2: #a78bfa;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    overflow: hidden;
}

body.fallback-mode {
    overflow: auto;
}

#renderCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
    touch-action: none;
}

body.fallback-mode #renderCanvas,
body.fallback-mode #hint {
    display: none;
}

/* ---------------------------------------------------------------- Corners */
.corner {
    position: fixed;
    top: 18px;
    z-index: 5;
    font-size: 15px;
    letter-spacing: 0.04em;
    color: var(--muted);
    text-decoration: none;
    pointer-events: none;
    user-select: none;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

#brand {
    left: 22px;
    font-weight: 700;
    color: var(--text);
    pointer-events: auto;
}

#brand span {
    color: var(--accent);
}

#hint {
    right: 22px;
    font-weight: 500;
    transition: opacity 1s ease;
}

#hint.faded {
    opacity: 0;
}

.corner.bottom {
    top: auto;
    bottom: 14px;
    left: 22px;
    font-size: 12px;
    opacity: 0.55;
}

.note {
    color: var(--muted) !important;
    font-size: 13px;
    font-style: italic;
}

/* ---------------------------------------------------------------- Loading */
#loading {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: radial-gradient(ellipse at center, #0a0f24 0%, #04050f 70%);
    transition: opacity 0.9s ease;
}

#loading.hidden {
    opacity: 0;
    pointer-events: none;
}

#loading .orb {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 2px solid rgba(94, 231, 255, 0.25);
    border-top-color: var(--accent);
    animation: spin 1.1s linear infinite;
    box-shadow: 0 0 30px rgba(94, 231, 255, 0.25);
}

#loading .title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

#loading-hint {
    color: var(--muted);
    font-size: 14px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------------------------------------------------------------- Panels (glass) */
#backdrop {
    position: fixed;
    inset: 0;
    z-index: 9;
    background: rgba(2, 4, 12, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

#backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

.panel {
    position: fixed;
    z-index: 10;
    left: 50%;
    top: 50%;
    width: min(680px, calc(100% - 32px));
    max-height: calc(100% - 32px);
    overflow-y: auto;
    transform: translate(-50%, -50%) scale(0.96);
    opacity: 0;
    pointer-events: none;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 26px 28px 28px;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.03) inset, 0 0 60px rgba(94, 231, 255, 0.06);
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
    -webkit-overflow-scrolling: touch;
}

.panel.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

/* Project with a video : a big "toast", the video is the hero */
.panel.wide {
    width: min(1100px, calc(100% - 32px));
}

.panel.wide .media {
    max-height: calc(100vh - 260px);
    object-fit: contain;
    background: #000;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.panel-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    background: linear-gradient(90deg, #fff, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.close {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.close:hover,
.close:focus-visible {
    background: rgba(94, 231, 255, 0.18);
    transform: rotate(90deg);
    outline: none;
}

.panel-body p {
    margin: 0 0 12px;
    line-height: 1.55;
    color: var(--text);
}

.panel-body .subtitle {
    color: var(--muted);
    margin-bottom: 4px;
}

.panel-body .tagline {
    color: var(--accent);
    font-weight: 600;
}

.media {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 18px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 40px rgba(94, 231, 255, 0.1);
}

.media.round {
    width: 150px;
    aspect-ratio: 1;
    border-radius: 50%;
    margin: 0 auto 18px;
    box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.6), 0 0 40px rgba(167, 139, 250, 0.35);
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

/* ---------------------------------------------------------------- Buttons */
.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid var(--accent);
    background: rgba(94, 231, 255, 0.08);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover,
.btn:focus-visible {
    background: rgba(94, 231, 255, 0.22);
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(94, 231, 255, 0.25);
    outline: none;
}

.btn.kind-forum,
.btn.kind-linkedin {
    border-color: var(--accent-2);
    background: rgba(167, 139, 250, 0.1);
}

.btn.kind-forum:hover,
.btn.kind-linkedin:hover {
    background: rgba(167, 139, 250, 0.25);
    box-shadow: 0 6px 24px rgba(167, 139, 250, 0.25);
}

.btn.success {
    border-color: #6ee7b7;
    background: rgba(110, 231, 183, 0.18);
    cursor: default;
}

/* ---------------------------------------------------------------- Contact form */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.field label {
    font-size: 13px;
    color: var(--muted);
    letter-spacing: 0.03em;
}

.field input,
.field textarea {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field textarea {
    min-height: 140px;
    resize: vertical;
}

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(94, 231, 255, 0.15);
}

.field input:disabled,
.field textarea:disabled {
    background: rgba(110, 231, 183, 0.12);
    border-color: rgba(110, 231, 183, 0.4);
}

.captcha-help {
    font-size: 13px;
    color: var(--muted);
    /* belongs to the input below : clear of the code above, snug against the input */
    margin: 8px 0 -2px;
    line-height: 1.4;
}

#captchaCode {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: 0.35em;
    font-size: 20px;
    text-align: center;
    color: var(--accent);
    background: rgba(94, 231, 255, 0.06);
}

#captchaCode::first-letter {
    color: var(--muted);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.status {
    font-size: 14px;
    color: var(--muted);
    min-height: 1.2em;
}

.status.error {
    color: #ff8da1;
}

/* ---------------------------------------------------------------- Fallback (no WebGL / no JS) */
/* #about : static copy for crawlers and screen readers, hidden while JS runs */
.js #about {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.fallback-mode #about {
    display: none;
}

html:not(.js) body {
    overflow: auto;
}

html:not(.js) #renderCanvas,
html:not(.js) #loading,
html:not(.js) #hint {
    display: none;
}

#fallback,
#about {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

.fb-me {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 40px;
}

.fb-me img {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
    box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.6);
}

.fb-me h1,
#fallback h2,
#about h1,
#about h2 {
    margin: 0 0 8px;
}

.fb-list {
    list-style: none;
    padding: 0;
    margin: 0 0 40px;
    display: grid;
    gap: 22px;
}

.fb-list li {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 18px;
    padding: 16px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
}

.fb-list img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
}

.fb-list h3 {
    margin: 0 0 6px;
}

#about a {
    color: var(--accent);
}

/* ---------------------------------------------------------------- Contact page */
body.page-contact {
    overflow: auto;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.space-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: #04050f url("/imgs/space/background.jpg") center / cover no-repeat;
    overflow: hidden;
}

.space-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 40%, rgba(4, 5, 15, 0.35) 0%, rgba(4, 5, 15, 0.85) 75%);
}

.nebula-deco {
    position: absolute;
    right: -15vw;
    top: -10vh;
    width: 70vmax;
    opacity: 0.45;
    mix-blend-mode: screen;
    animation: drift 60s ease-in-out infinite alternate;
}

@keyframes drift {
    to {
        transform: translate(-4vw, 4vh) rotate(6deg);
    }
}

.card {
    position: relative;
    z-index: 1;
    width: min(620px, calc(100% - 32px));
    margin: 90px auto 60px;
    padding: 30px 32px 28px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(94, 231, 255, 0.06);
}

.card .panel-title {
    font-size: 30px;
}

.card .lead {
    color: var(--muted);
    margin: 0 0 22px;
    line-height: 1.55;
}

.back-link {
    display: inline-block;
    margin-top: 26px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

.back-link:hover {
    text-decoration: underline;
}

.status.ok {
    color: #6ee7b7;
}

/* ---------------------------------------------------------------- Phones */
@media (max-width: 640px) {
    .corner {
        font-size: 13px;
        top: 12px;
    }

    #brand {
        left: 14px;
    }

    #hint {
        right: 14px;
    }

    .corner.bottom {
        left: 14px;
        bottom: 10px;
    }

    .card {
        margin: 70px auto 30px;
        padding: 22px 18px 24px;
    }

    .panel {
        left: 0;
        top: auto;
        bottom: 0;
        width: 100%;
        max-height: 92dvh;
        border-radius: 18px 18px 0 0;
        padding: 20px 18px 28px;
        transform: translate(0, 24px);
    }

    .panel.visible {
        transform: translate(0, 0);
    }

    .panel-title {
        font-size: 20px;
    }

    .fb-me {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .fb-list li {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .panel,
    #backdrop,
    #loading {
        transition: none;
    }
}
