/* =========================================================
   HOME
   The rotating head, the project cards that orbit it,
   and the index that lets you jump straight to any of them.
   ========================================================= */

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#canvas-container {
    position: fixed;
    inset: 0;
    z-index: 1;
}

#canvas-container canvas {
    opacity: 0;
    transition: opacity 1.2s ease;
}
#canvas-container canvas.visible { opacity: 1; }

#ui-layer {
    position: fixed;
    inset: 0;
    z-index: 10;
    pointer-events: none;
}

/* ---------------------------------------------------------
   MASTHEAD ADDITIONS
   --------------------------------------------------------- */
.masthead { background: none; }
.masthead::before { display: none; }

#typing-container {
    margin-top: 14px;
    font-size: 0.85rem;
    color: var(--ink-muted);
    line-height: 1.4;
    min-height: 3em;
    max-width: 280px;
    transition: opacity 1s ease;
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: var(--ink);
    margin-left: 2px;
    vertical-align: bottom;
    animation: blink 0.9s steps(2, start) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* ---------------------------------------------------------
   PROJECT CARD
   A real anchor, so it can be opened in a new tab, reached by
   keyboard, and followed by a crawler.
   --------------------------------------------------------- */
.project-window {
    position: absolute;
    display: block;
    width: 300px;
    text-decoration: none;
    color: inherit;
    background: rgba(14, 14, 14, 0.62);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--rule);
    border-radius: 14px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
    padding-bottom: 18px;
    overflow: hidden;
    z-index: 20;

    opacity: 0;
    visibility: hidden;
    transform: translateY(24px) scale(0.96);
    pointer-events: none;
    transition: opacity var(--dur) var(--ease),
                transform var(--dur-slow) var(--ease),
                background var(--dur-fast) ease,
                border-color var(--dur-fast) ease;
}

.project-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.project-window.active:hover,
.project-window.active:focus-visible {
    background: rgba(18, 18, 18, 0.92);
    border-color: var(--rule-strong);
    transform: translateY(-2px) scale(1.015);
}

.pw-content { padding: 10px; }

.pw-img,
.pw-placeholder-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    border-radius: 7px;
    background: var(--bg-sunken);
    transition: transform var(--dur-slow) var(--ease);
}

.pw-frame {
    overflow: hidden;
    border-radius: 7px;
}

/* For artwork that is already a composed frame: fit it whole and fill the
   surround with its own colour, so nothing of the design is cut away. */
.pw-img--contain {
    object-fit: contain;
    background: #071aff;
}

.project-window.active:hover .pw-img { transform: scale(1.04); }

.pw-placeholder-img {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
}

.pw-details { padding: 14px 5px 0; }

.pw-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
    line-height: 1.2;
}

.pw-cat {
    font-size: 0.7rem;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-top: 6px;
}

/* ---------------------------------------------------------
   INDEX
   The dot column, upgraded into a clickable table of contents.
   Names appear on hover so the page stays quiet at rest.
   --------------------------------------------------------- */
.index-nav {
    position: fixed;
    right: var(--gutter);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    z-index: 25;
    pointer-events: auto;
}

.index-item {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 6px 0 6px 20px;
    background: none;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    color: var(--ink-faint);
    transition: color var(--dur-fast) ease;
}

.index-label {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(6px);
    transition: opacity var(--dur-fast) var(--ease),
                transform var(--dur-fast) var(--ease);
}

.index-dot {
    width: 100%;
    max-width: 22px;
    min-width: 22px;
    height: 1px;
    background: currentColor;
    opacity: 0.45;
    transform: scaleX(0.36);
    transform-origin: 100% 50%;
    transition: transform var(--dur) var(--ease),
                opacity var(--dur-fast) ease;
}

.index-item:hover { color: var(--ink-muted); }
.index-item:hover .index-label,
.index-item:focus-visible .index-label { opacity: 1; transform: translateX(0); }
.index-item:hover .index-dot { transform: scaleX(0.7); opacity: 0.8; }

.index-item.active { color: var(--ink); }
.index-item.active .index-dot { transform: scaleX(1); opacity: 1; }
.index-item.active .index-label { opacity: 1; transform: translateX(0); }

/* ---------------------------------------------------------
   SCROLL HINT
   --------------------------------------------------------- */
.scroll-hint {
    position: fixed;
    top: 50%;
    left: 62%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-muted);
    opacity: 0.55;
    transition: opacity var(--dur-slow) ease;
    pointer-events: none;
    z-index: 24;
    white-space: nowrap;
}

.scroll-hint .arrow {
    display: inline-block;
    margin-left: 8px;
    animation: nudge 1.8s infinite ease-in-out;
}

@keyframes nudge {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(4px); }
}

/* ---------------------------------------------------------
   PRELOADER
   --------------------------------------------------------- */
#loader-overlay {
    position: fixed;
    inset: 0;
    background-color: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-out;
}

.loader-content { text-align: center; }

#loader-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

#loader-bar {
    width: 160px;
    height: 1px;
    margin: 18px auto 0;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
}

#loader-bar span {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--ink);
    transition: width 0.4s var(--ease);
}

/* Fallback shown if WebGL is unavailable, so the work is still reachable. */
.no-webgl-notice {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--gutter);
    text-align: center;
}

.no-webgl-notice p {
    color: var(--ink-muted);
    font-size: 0.9rem;
    max-width: 34ch;
    margin: 0;
}

/* ---------------------------------------------------------
   MOBILE
   --------------------------------------------------------- */
@media (max-width: 768px) {
    #typing-container { max-width: none; font-size: 0.8rem; min-height: 2.8em; }

    .scroll-hint {
        top: auto;
        left: 50%;
        bottom: 96px;
        transform: translateX(-50%);
    }

    .masthead .pill {
        position: fixed;
        top: auto;
        bottom: 28px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(10, 10, 10, 0.85);
    }

    /* Cards alternate sides so consecutive projects never
       land in the same place. */
    .project-window {
        width: min(230px, calc(100vw - 40px));
        top: auto !important;
        bottom: 150px;
        left: var(--gutter) !important;
        right: auto;
    }

    .project-window:nth-child(even) {
        left: auto !important;
        right: var(--gutter);
    }

    .pw-img, .pw-placeholder-img { height: 150px; }
    .pw-title { font-size: 0.95rem; }
    .pw-details { padding-top: 12px; }

    .index-nav { display: none; }
}

@media (max-width: 768px) and (max-height: 700px) {
    .project-window { bottom: 130px; }
    .pw-img, .pw-placeholder-img { height: 120px; }
}
