/* ============================================================
   FX.CSS — motion / atmosphere layer
   Loaded after site.css. Everything here is additive: delete the
   file and the site still works. Grain, cursor ring, page curtain,
   boot sequence, hero canvas, scroll-velocity coupling, clip-wipe
   reveals, tilt, scramble type, side rail, footer wordmark.
   Gated on .js + pointer:fine + prefers-reduced-motion.
   ============================================================ */

:root {
    --fx-curtain: 420ms;
    --ease-expo:  cubic-bezier(0.16, 1, 0.3, 1);
    --ease-power: cubic-bezier(0.7, 0, 0.2, 1);
}

/* ============================================================ GRAIN
   Fixed film grain over the page. Multiply on light, screen on dark,
   so it reads as texture and never as haze. */
.grain {
    position: fixed; inset: 0; z-index: 5;
    pointer-events: none;
    opacity: var(--grain, 0.2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22220%22 height=%22220%22%3E%3Cfilter id=%22n%22%3E%3CfeTurbulence type=%22fractalNoise%22 baseFrequency=%220.85%22 numOctaves=%223%22 stitchTiles=%22stitch%22/%3E%3CfeColorMatrix type=%22saturate%22 values=%220%22/%3E%3C/filter%3E%3Crect width=%22220%22 height=%22220%22 filter=%22url(%23n)%22 opacity=%220.55%22/%3E%3C/svg%3E");
    mix-blend-mode: multiply;
    animation: grainShift 0.7s steps(1) infinite;
}
:root[data-theme="dark"] .grain { mix-blend-mode: screen; }
/* Background-position rather than transform: the layer stays viewport-sized,
   so no oversized compositing surface sits over the whole document. */
@keyframes grainShift {
    0%   { background-position: 0 0; }
    16%  { background-position: -30px 10px; }
    33%  { background-position: 20px -40px; }
    50%  { background-position: -15px 25px; }
    66%  { background-position: 35px 15px; }
    83%  { background-position: -25px -20px; }
    100% { background-position: 0 0; }
}

/* ============================================================ CURSOR
   Native cursor stays for usability; this is a lagging brutalist
   square plus an exact-position pip, reacting to what is under it. */
.cursor {
    position: fixed; top: 0; left: 0; z-index: 1000;
    width: 34px; height: 34px; margin: -17px 0 0 -17px;
    border: 1.5px solid var(--line-bold);
    pointer-events: none; opacity: 0;
    transform: translate3d(var(--cx, -200px), var(--cy, -200px), 0) scale(var(--cs, 1));
    transition: opacity 260ms var(--ease-out), border-color 200ms var(--ease-out),
                background 200ms var(--ease-out), width 220ms var(--ease-expo),
                height 220ms var(--ease-expo), margin 220ms var(--ease-expo);
    display: grid; place-items: center;
}
.cursor.is-on { opacity: 1; }
.cursor .cur-label {
    font-family: var(--font-mono); font-size: 0.6rem; font-weight: 700;
    letter-spacing: 0.12em; text-transform: uppercase; color: #fff;
    opacity: 0; transform: scale(0.8); white-space: nowrap;
    transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-expo);
}
.cursor[data-state="link"] { border-color: var(--accent); background: var(--accent-soft); --cs: 1.35; }
.cursor[data-state="label"] {
    width: 88px; height: 88px; margin: -44px 0 0 -44px;
    border-color: var(--accent); background: var(--accent);
}
.cursor[data-state="label"] .cur-label { opacity: 1; transform: scale(1); }
.cursor[data-state="text"] {
    width: 3px; height: 28px; margin: -14px 0 0 -1.5px;
    background: var(--accent); border-color: var(--accent);
}
.cursor.is-down { --cs: 0.7; }

.cursor-dot {
    position: fixed; top: 0; left: 0; z-index: 1001;
    width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px;
    background: var(--accent); pointer-events: none; opacity: 0;
    transform: translate3d(var(--dx, -200px), var(--dy, -200px), 0);
    transition: opacity 260ms var(--ease-out);
}
.cursor-dot.is-on { opacity: 1; }

/* ============================================================ PAGE CURTAIN
   Four columns wipe on internal navigation and lift on arrival. The
   head script owns the covered state and its own failsafe timer. */
.curtain {
    position: fixed; inset: 0; z-index: 900;
    display: grid; grid-template-columns: repeat(4, 1fr);
    pointer-events: none;
}
.curtain i {
    display: block; background: var(--text);
    transform: scaleY(0);
    transition: transform var(--fx-curtain) var(--ease-power);
}
.curtain i:nth-child(1) { transition-delay: 0ms; }
.curtain i:nth-child(2) { transition-delay: 45ms; }
.curtain i:nth-child(3) { transition-delay: 90ms; }
.curtain i:nth-child(4) { transition-delay: 135ms; }
:root.px .curtain i { transform: scaleY(1); }
:root.px .curtain   { pointer-events: auto; }
:root.px-in  .curtain i { transform-origin: top; }
:root.px-out .curtain i { transform-origin: bottom; }

.curtain-mark {
    position: fixed; inset: 0; z-index: 901; display: grid; place-items: center;
    pointer-events: none; opacity: 0; transition: opacity 200ms var(--ease-out);
    font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
    letter-spacing: -0.03em; font-size: clamp(2rem, 8vw, 5rem); color: var(--bg);
}
.curtain-mark b { color: var(--accent); }
:root.px-out .curtain-mark { opacity: 1; }

/* ============================================================ BOOT
   First page of the session only. Hard-capped by JS. */
.boot {
    position: fixed; inset: 0; z-index: 950;
    background: var(--bg); display: grid; place-items: center;
    transition: opacity 320ms var(--ease-out), visibility 320ms;
}
.boot[hidden] { display: none; }
.boot-inner { width: min(560px, 78vw); }
.boot-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.boot-name {
    font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
    font-size: clamp(1.1rem, 3.4vw, 1.9rem); letter-spacing: -0.02em;
}
.boot-name b { color: var(--accent); }
.boot-num {
    font-family: var(--font-mono); font-weight: 700; font-variant-numeric: tabular-nums;
    font-size: clamp(1.1rem, 3.4vw, 1.9rem); color: var(--accent-text);
}
.boot-bar { height: 3px; background: var(--line); margin-top: 0.9rem; overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 100%; background: var(--accent); transform: scaleX(var(--bp, 0)); transform-origin: left; }
.boot-tags {
    display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; margin-top: 0.9rem;
    font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--text-dim);
}
.boot.is-done { opacity: 0; visibility: hidden; }

/* ============================================================ HERO CANVAS */
.fx-canvas {
    position: absolute; inset: 0; width: 100%; height: 100%;
    z-index: 0; pointer-events: none; opacity: 0;
    transition: opacity 900ms var(--ease-out);
    /* Weighted to the open top-right of the hero and faded off the column the
       copy sits in — at light-mode density the ticks would otherwise read as
       dust over the paragraph. */
    -webkit-mask-image: radial-gradient(115% 95% at 80% 22%, #000 0%, rgba(0,0,0,0.7) 38%, transparent 74%);
    mask-image: radial-gradient(115% 95% at 80% 22%, #000 0%, rgba(0,0,0,0.7) 38%, transparent 74%);
}
.fx-canvas.is-on { opacity: 1; }

/* ============================================================ SCROLL VELOCITY
   --sv is signed, normalised scroll velocity, written each frame. */
.marquee { transform: skewY(calc(var(--sv, 0) * 0.18deg)); }
.marquee-track { transform: skewX(calc(var(--sv, 0) * -1deg)); }

/* ============================================================ CLIP-WIPE REVEALS
   Screenshots uncover with a hard edge, not a fade — closer to the
   grid language than opacity alone. */
.js .work-thumb img {
    clip-path: inset(0 100% 0 0); transform: scale(1.05);
    transition: clip-path 900ms var(--ease-expo), transform 900ms var(--ease-expo);
}
.js .is-in .work-thumb img, .js .visible .work-thumb img { clip-path: inset(0 0 0 0); transform: scale(1); }
@media (hover: hover) and (pointer: fine) {
    .js .work-card:hover .work-thumb img { transform: scale(1.05); }
}

/* Accent rule drawing in under each section heading. */
.section-head { position: relative; }
.section-head::after {
    content: ""; position: absolute; left: 0; bottom: calc(-1 * clamp(1rem, 0.75rem + 1vw, 1.75rem));
    width: 84px; height: 3px; background: var(--accent);
    transform: scaleX(0); transform-origin: left;
    transition: transform 700ms var(--ease-expo) 180ms;
}
.js .section-head.visible::after { transform: scaleX(1); }

/* ============================================================ TILT + EDGE TRACE */
[data-tilt] {
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform 500ms var(--ease-expo);
}
[data-tilt].is-hot { transition: transform 90ms linear; }
.card[data-spotlight]::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    border: 1.5px solid var(--accent);
    clip-path: inset(0 0 100% 0);
    transition: clip-path 380ms var(--ease-expo);
}
@media (hover: hover) and (pointer: fine) {
    .card[data-spotlight]:hover::after { clip-path: inset(0 0 0 0); }
}

/* ============================================================ SCRAMBLE TYPE */
.scrambling { color: var(--accent-text); }

/* ============================================================ NAV SWEEP */
.nav-links a { position: relative; }
.nav-links a::after {
    content: ""; position: absolute; left: 0.55rem; right: 0.55rem; bottom: 0.32rem; height: 1.5px;
    background: var(--accent); transform: scaleX(0); transform-origin: right;
    transition: transform 340ms var(--ease-expo);
}
@media (hover: hover) and (pointer: fine) {
    .nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }
}
.nav-links a[aria-current="page"]::after { display: none; }

/* ============================================================ STAT UNDERSCORES */
.hero-meta .stat { position: relative; overflow: hidden; }
.hero-meta .stat::after {
    content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
    background: var(--accent); transform: scaleX(0); transform-origin: left;
    transition: transform 800ms var(--ease-expo);
}
.js .hero-meta.visible .stat::after { transform: scaleX(1); }
.js .hero-meta.visible .stat:nth-child(2)::after { transition-delay: 90ms; }
.js .hero-meta.visible .stat:nth-child(3)::after { transition-delay: 180ms; }
.js .hero-meta.visible .stat:nth-child(4)::after { transition-delay: 270ms; }

/* ============================================================ SIDE RAIL
   Fixed section read-out. Wide screens only, decorative. */
.rail {
    position: fixed; left: calc(var(--gutter) * 0.4); top: 50%; transform: translateY(-50%);
    z-index: 90; display: none; gap: 0.5rem; flex-direction: column; align-items: center;
    pointer-events: none;
}
.rail i { display: block; width: 1.5px; height: 24px; background: var(--line-bold); opacity: 0.45;
    transition: opacity 300ms, background 300ms, height 300ms var(--ease-expo); }
.rail i.is-at { opacity: 1; background: var(--accent); height: 40px; }
@media (min-width: 1280px) { .rail { display: flex; } }

/* ============================================================ FOOTER WORDMARK */
.footer-mark {
    font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
    font-size: clamp(1.1rem, 3vw, 1.6rem); line-height: 1; letter-spacing: 0.02em;
    color: var(--text-dim); opacity: 0.5;
    margin-top: 2.5rem; user-select: none; white-space: nowrap;
    transform: translate3d(var(--fm, 0px), 0, 0);
}
.footer-mark b { color: var(--accent); opacity: 1; }
.footer { overflow: hidden; }

/* ============================================================ REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
    .grain { animation: none !important; opacity: 0.16; }
    .cursor, .cursor-dot, .fx-canvas, .curtain, .curtain-mark { display: none !important; }
    .marquee, .marquee-track { transform: none !important; }
    .js .work-thumb img { clip-path: none !important; transform: none !important; }
    .section-head::after, .hero-meta .stat::after { transform: scaleX(1) !important; transition: none !important; }
    [data-tilt] { transform: none !important; }
    .footer-mark { transform: none !important; }
}
@media (hover: none), (pointer: coarse) {
    .cursor, .cursor-dot { display: none !important; }
}

/* ============================================================ MOBILE NAV
   At 720px the bar carried logo + language + theme + a full CTA + burger,
   which collided on a 390px screen. The CTA already exists inside the
   drawer, so the bar keeps only what has to be reachable in one tap. */
.nav-drawer-cta { display: none; }

@media (max-width: 720px) {
    .nav { padding-inline: var(--gutter); gap: 0.75rem; }
    .nav-hire { display: none; }
    .nav-right { gap: 0.5rem; }

    /* The bar is transparent at the top of the page, so an open drawer has to
       make it opaque; otherwise the panel sits over the hero with the headline
       reading straight through the links. */
    .nav[data-menu="open"] { background: var(--bg); }
    .nav[data-menu="open"] .nav-links {
        gap: 0; padding: 0.25rem var(--gutter) 1.4rem;
        border-bottom: 1px solid var(--line-bold);
        box-shadow: 0 26px 40px -28px rgba(16, 15, 13, 0.45);
    }
    .nav[data-menu="open"] .nav-links li { width: 100%; }

    /* Full width rows at display size: a drawer is the one place on a phone
       where the navigation is the whole screen, so it may as well be typeset
       like the page rather than shrunk into a list of small links. */
    .nav[data-menu="open"] .nav-links li:not(.nav-drawer-cta) a {
        display: block; width: 100%;
        font-family: var(--font-display); font-weight: 700;
        font-size: min(var(--step-2), 7vw); text-transform: uppercase; letter-spacing: -0.01em;
        padding: 0.8rem 0; border-bottom: 1px solid var(--line);
        color: var(--text); background: none;
    }
    .nav[data-menu="open"] .nav-links li:not(.nav-drawer-cta) a[aria-current="page"] {
        color: var(--accent-text); background: none;
    }
    .nav[data-menu="open"] .nav-links li:not(.nav-drawer-cta) a::after { display: none; }

    .nav-drawer-cta { display: block; margin-top: 1.2rem; }
    .nav-drawer-cta .btn { width: 100%; justify-content: center; }
}

/* Side-entry reveals push their element past the right edge while they are
   still hidden, which gives narrow screens a horizontal scrollbar. Below the
   breakpoint those columns stack anyway, so they enter vertically instead. */
@media (max-width: 900px) {
    .js .reveal.reveal--left, .js .reveal.reveal--right { transform: translateY(18px); }
    .js .reveal.reveal--left.visible, .js .reveal.reveal--right.visible { transform: none; }
}

/* Punctuation carried inside the preceding word keeps body colour even when
   that word is the accent one, and a display word that cannot fit a narrow
   screen breaks rather than pushing the whole page sideways. */
.word .punct { color: var(--text); }
.hero h1, .page-hero h1,
.hero h1 .word, .page-hero h1 .word,
.hero h1 .word > i, .page-hero h1 .word > i { overflow-wrap: break-word; }
/* Word units are inline-block, so they size to max-content and a break-word
   rule never fires; capping them at the heading width gives it something to
   break against. */
.hero h1 .word, .page-hero h1 .word { max-width: 100%; }
/* Long Greek compounds ("δημιουργήσουμε") outrun a 360px screen at the
   display size, and a mid-word break in a headline looks like a defect. One
   step down on the smallest phones keeps them whole. */
@media (max-width: 420px) {
    .hero h1, .page-hero h1 { font-size: min(var(--step-4), 9vw); }
}

/* ============================================================ MOBILE POLISH */
@media (max-width: 720px) {
    /* iOS zooms the page whenever a focused input is under 16px. The form is
       the conversion point, so it must not jump when someone taps into it. */
    .field input, .field textarea { font-size: 16px; }

    /* Every button is a full width target on a phone rather than a small
       inline one, except where two sit side by side by design. */
    .hero-actions .btn, .cta-band .btn, .form .btn, .sum-card .btn { width: 100%; justify-content: center; }

    /* The desktop rhythm is generous by design; on a 390px screen the same
       gaps read as dead space between sections. */
    .section { padding-block: clamp(2.9rem, 2.2rem + 3vw, 4.25rem); }
    .work-rows .wrow { padding-block: 2rem; }
    .footer { padding-block: 2.5rem; }
}

/* Tap targets: 44px is the floor Apple and Google both publish, and the mono
   type on this site is small enough to land under it without help. */
@media (hover: none), (pointer: coarse) {
    .contact-link, .footer nav a, .lang-switch a { min-height: 44px; display: flex; align-items: center; }
    .footer nav { gap: 0.5rem 1.25rem; }
    .tech span { padding: 0.4rem 0.7rem; }
}
