/* ─── Sample Landing Page ────────────────────────────────────────────────── */

@font-face {
    font-family: 'ArbelG';
    src: url('../fonts/ui/ArbelG-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: none;
}

a {
    pointer-events: auto;
}

/* Custom cursor – black circle matching the top-right dot (1.25vw diameter) */
#custom-cursor {
    position: fixed;
    width: 1.25vw;
    height: 1.25vw;
    border-radius: 50%;
    background-color: transparent;
    border: 1.5px solid #000;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    top: -100px;   /* hidden until first mousemove */
    left: -100px;
    transition: border-color 0.2s ease;
}

#custom-cursor.snapped {
    transition: border-color 0.2s ease,
                width  0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                height 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                left   0.3s  cubic-bezier(0.25, 0.46, 0.45, 0.94),
                top    0.3s  cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Cursor turns background colour when hovering a card */
body:has(.card:hover) #custom-cursor {
    border-color: #fcfbf7;
}

html {
    background-color: #fcfbf7;
}

body {
    font-family: 'ArbelG', 'Helvetica Neue', Arial, sans-serif;
    background-color: #fcfbf7;
    width: 100vw;
    min-height: 145vw; /* illustration bottom (132.64vw) + 12vw spacing */
    position: relative;
    overflow-x: hidden;
}

/* ─── Entrance animations ────────────────────────────────────────────────── */

/*
 * Sequence:
 *  0.0s – page is white
 *  0.2s – circle fades in at horizontal centre (Y stays fixed)
 *  1.0s – circle begins slow slide to top-right corner
 *  3.8s – logo + sample logotype fade in together
 *
 * Circle final pos: left=93.26vw, size=1.25vw → centre at 93.885vw
 * Centre offset translateX = 50vw − 93.885vw
 */

/* Phase 1 (0→20%): fade in while stationary at centre  */
/* Phase 2 (20→100%): slow slide to final corner         */
@keyframes circleSequence {
    0% {
        transform: translateX(calc(50vw - 93.885vw));
        opacity: 0;
        animation-timing-function: ease-out;
    }
    20% {
        transform: translateX(calc(50vw - 93.885vw));
        opacity: 1;
        animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ─── All positions are vw-based (÷ 1440 × 100) ─────────────────────────── */

/* Logo icon: matches playground — left: calc(6.32vw - 17px), top: 3vh, 34×34px */
.logo-icon {
    position: fixed;
    left: calc(6.32vw - 17px);
    top: 3vh;
    width: 34px;
    height: 34px;
    transform-origin: center center;
    opacity: 0;
    animation: fadeIn 0.9s ease-out 3.8s forwards;
}

/* Theme toggle – 24px gap to the left of the nav dot, matches playground spacing */
.theme-toggle {
    position: fixed;
    right: calc(2.64vw + 18px + 24px);
    top: 3vh;
    width: 18px;
    height: 18px;
    color: #000;
    opacity: 0;
    animation: fadeIn 0.9s ease-out 3.8s forwards;
}

/* Dot — matches playground: 18×18px */
.dot {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: block;       /* works for both <div> and <a> */
    text-decoration: none;
    background-color: #000;
}

/* top-right dot: fades in at centre then slides slowly to corner */
.dot-top-right {
    position: fixed;
    right: 2.64vw;
    top: 3vh;
    opacity: 0;
    animation: circleSequence 3.6s ease forwards 0.2s;
    z-index: 100;
    pointer-events: auto;
}

/* "sample" logotype: w=813.18px → 56.47vw, centred horizontally */
/* canvas element – display:block prevents inline-block gap */
.sample-logo {
    display: block;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 15.35vw;
    width: 56.47vw;
    height: 16.60vw;
    opacity: 0;
    animation: fadeIn 0.9s ease-out 3.8s forwards;
}

/* Description text: x=313 y=611 size=551×126 → left=21.74vw top=39.65vw w=38.26vw h=8.75vw */
.description {
    position: absolute;
    left: 21.74vw;
    top: 39.65vw;
    width: 38.26vw;
    height: 8.75vw;
    font-size: 1.39vw;
    color: #000;
    line-height: 1.45;
    white-space: pre;
    overflow: visible;
}

/* "tree option ." label: x=337 y=913 w=120 → left=23.40vw top=60.62vw w=8.33vw */
.tree-label {
    position: absolute;
    left: 21.74vw;
    top: 60.62vw;
    width: 8.33vw;
    font-size: 1.39vw;
    color: #000;
    white-space: nowrap;
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
/* Safe zone: logo-right(8.19vw) → toggle-left(91.25vw) = 83.06vw           */
/* 3 × 20vw + 2 × 3vw = 66vw, centred → left=16.72vw, right=82.72vw        */
.cards-row {
    position: absolute;
    top: 65.97vw;
    left: 16.72vw;
    display: flex;
    gap: 3vw;
    opacity: 0;
}

.card {
    position: relative;
    width: 20vw;
    height: 20vw;
    flex-shrink: 0;
}

.card-img-empty,
.card-img-full {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.3s ease;
}

.card-img-full  { opacity: 0; }

.card:hover .card-img-full  { opacity: 1; }
.card:hover .card-img-empty { opacity: 0; }

/* Label turns background colour when hovering (full card has black background) */
.card:hover .card-label { color: #fcfbf7; }

.card-label {
    position: absolute;
    font-family: 'ArbelG', 'Helvetica Neue', Arial, sans-serif;
    font-size: 1.39vw;
    white-space: nowrap;
}

/* Label positions as % of card dimensions */
/* playground:  136/396 = 34.34%, 261/539 = 48.42% */
.card-playground .card-label { color: #000; left: 50%; top: 48.42%; transform: translateX(-50%); }
/* about:       168/396 = 42.42%, 265/539 = 49.17% */
.card-about .card-label      { color: #000; left: 50%; top: 49.17%; transform: translateX(-50%); }
/* archive:     160/396 = 40.40%, 270/539 = 50.09% */
.card-archive .card-label    { color: #000; left: 50%; top: 50.09%; transform: translateX(-50%); }

/* ─── 3D illustration  (797×465px → 55.35vw × 32.29vw) ─────────────────── */
/* Placed below cards (bottom 93.41vw) with gap, centred horizontally        */
.illustration-3d-wrap {
    position: absolute;
    top: 100.35vw;
    left: 50%;
    transform: translateX(-50%);
    width: 55.35vw;
    height: 32.29vw;
    perspective: 1200px;      /* depth for the 3D effect */
    cursor: grab;
}

.illustration-3d-wrap:active {
    cursor: grabbing;
}

#illustration-3d {
    width: 100%;
    height: 100%;
    display: block;
    transform-style: preserve-3d;
    transform: rotateX(0deg) rotateY(0deg);
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
}


/* ─── Code-reveal: description characters ───────────────────────────────── */
.char {
    opacity: 0;
}

/* Initial chars (visible on load) fade in with logo/sample at 3.8s */
.char.initial {
    animation: fadeIn 0.9s ease-out 3.8s forwards;
}

/* Blinking cursor after the last revealed character */
@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

.char.last-visible::after {
    content: '|';
    font-weight: 300;
    animation: cursorBlink 0.55s step-end infinite;
    margin-left: 0.05em;
}

/* ─── Skip entrance animations (navigating back, not a reload/first visit) ── */
html.no-anim .logo-icon,
html.no-anim .theme-toggle,
html.no-anim .sample-logo {
    animation: none !important;
    opacity: 1;
}

html.no-anim .dot-top-right {
    animation: none !important;
    opacity: 1;
    transform: translateX(0);
}

html.no-anim .char.initial {
    animation: none !important;
    opacity: 1;
}

/* ─── Negative theme ─────────────────────────────────────────────────────── */
body.negative {
    background-color: #050505;
}

body.negative .description,
body.negative .tree-label,
body.negative .card-label {
    color: #fcfbf7;
}

body.negative .dot {
    background-color: #fcfbf7;
}

body.negative .theme-toggle {
    color: #fcfbf7;
}

body.negative #custom-cursor {
    border-color: #fcfbf7;
}

/* In negative mode, card hover cursor flips to dark */
body.negative:has(.card:hover) #custom-cursor {
    border-color: #050505;
}

body.negative .card:hover .card-label {
    color: #050505;
}

/* Canvas inverted so black SVG/blocks become white */
body.negative #sample-canvas {
    filter: invert(1);
}

/* ─── Blue / brown theme – bg #423028, elements #B6E6FF ─────────────────── */
body.blue-theme {
    background-color: #423028;
}

body.blue-theme .description,
body.blue-theme .tree-label,
body.blue-theme .card-label {
    color: #B6E6FF;
}

body.blue-theme .dot {
    background-color: #B6E6FF;
}

body.blue-theme .theme-toggle {
    color: #B6E6FF;
}

body.blue-theme #custom-cursor {
    border-color: #B6E6FF;
}

/* Card hover: white card, label in brown (matches background) */
body.blue-theme:has(.card:hover) #custom-cursor {
    border-color: #423028;
}

body.blue-theme .card:hover .card-label {
    color: #423028;
}
