/* ============================================
   XMZF Studio — reset & tokens
   ============================================ */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #07080a;
    --bg-soft: #0c0e12;
    --ink: #e8ecf1;
    --ink-dim: #8a9099;
    --ink-faint: #4a505a;
    --accent: #d6ff3f;
    --accent-soft: #9bb832;
    --ok: #6fcf97;
    --line: rgba(255, 255, 255, 0.06);
    --term-bg: #050608;
    --term-ink: #d8e0c8;
    --term-dim: #5b6354;
    --term-accent: #b6e84a;
    --term-warn: #e8b339;
    --term-err: #e8584a;
    --ease: cubic-bezier(0.7, 0, 0.2, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
    width: 100%;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
html { overflow-y: auto; }
body { overflow-x: hidden; position: relative; }

body { position: relative; }

::selection { background: var(--accent); color: #000; }

a { color: inherit; text-decoration: none; }

/* ============================================
   Veil — covers everything until ready
   ============================================ */
.veil {
    position: fixed;
    inset: 0;
    background: #050608;
    z-index: 1000;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.6s var(--ease);
}
.veil.is-hidden { opacity: 0; }

/* ============================================
   Terminal — full screen boot
   ============================================ */
.terminal {
    position: fixed;
    inset: 0;
    background: var(--term-bg);
    z-index: 100;
    overflow: hidden;
    will-change: transform, opacity;
}

/* subtle CRT scanline + vignette */
.terminal::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0) 0px,
            rgba(0, 0, 0, 0) 2px,
            rgba(0, 0, 0, 0.18) 3px,
            rgba(0, 0, 0, 0) 4px
        );
    pointer-events: none;
    z-index: 2;
    mix-blend-mode: multiply;
}
.terminal::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.6) 100%);
    pointer-events: none;
    z-index: 3;
}

.terminal__inner {
    position: absolute;
    inset: 0;
    padding: 6vh 8vw 6vh 8vw;
    font-family: var(--font-mono);
    font-size: clamp(11px, 1.05vw, 14px);
    line-height: 1.65;
    color: var(--term-ink);
    overflow: hidden;
    z-index: 1;
    transform-origin: center center;
    will-change: transform, opacity;
}

.terminal__output {
    white-space: pre-wrap;
    word-break: break-word;
}

.terminal__prompt {
    margin-top: 0.4em;
    color: var(--term-accent);
    font-weight: 500;
}

.terminal__cursor {
    display: inline-block;
    width: 0.6em;
    height: 1.05em;
    vertical-align: text-bottom;
    background: var(--term-accent);
    animation: blink 1s steps(1) infinite;
    box-shadow: 0 0 8px rgba(182, 232, 74, 0.6);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

/* Boot log line styling */
.log-line {
    display: block;
    opacity: 0;
    transform: translateY(2px);
    animation: logIn 0.18s var(--ease-out) forwards;
}
@keyframes logIn {
    to { opacity: 1; transform: translateY(0); }
}

.log-line .ts { color: var(--term-dim); }
.log-line .ok { color: var(--ok); }
.log-line .warn { color: var(--term-warn); }
.log-line .err { color: var(--term-err); }
.log-line .dim { color: var(--term-dim); }
.log-line .accent { color: var(--term-accent); }
.log-line .hi { color: #fff; font-weight: 500; }

/* progress bar */
.log-progress {
    display: inline-block;
    color: var(--term-accent);
    letter-spacing: 1px;
}
.log-progress .bar {
    display: inline-block;
    background: rgba(182, 232, 74, 0.15);
    padding: 0 4px;
    border-radius: 1px;
}

/* terminal exit states */
.terminal.is-fading {
    transition: opacity 0.5s var(--ease);
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   3D scene canvas
   ============================================ */
.scene {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: block;
    opacity: 0;
    transition: opacity 0.8s var(--ease);
    pointer-events: none;
}
.scene.is-visible { opacity: 1; pointer-events: auto; }

/* ============================================
   Hero content
   ============================================ */
.hero {
    position: relative;
    z-index: 20;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4vh 5vw 4vh 5vw;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s var(--ease);
    margin-bottom: 0;
}
.hero.is-visible { opacity: 1; pointer-events: auto; }

.hero__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: auto;
}

.brand {
    display: flex;
    flex-direction: column;
    line-height: 1;
}
.brand__mark {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.18em;
    color: var(--ink);
}
.brand__sub {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.4em;
    color: var(--ink-dim);
    margin-top: 4px;
}

.nav {
    display: flex;
    gap: 32px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.nav a {
    color: var(--ink-dim);
    transition: color 0.3s var(--ease);
    position: relative;
}
.nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.4s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { width: 100%; }

.hero__stage {
    flex: 1;
    position: relative;
    /* The 3D computer sits behind/below via canvas; this is just a layout cell */
}

.hero__footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: auto;
}

.hero__caption { max-width: 50vw; }
.hero__title {
    font-family: var(--font-sans);
    font-weight: 300;
    font-size: clamp(40px, 6.4vw, 96px);
    line-height: 0.96;
    letter-spacing: -0.03em;
    color: var(--ink);
}
.hero__title-line {
    display: block;
    overflow: hidden;
}
.hero__title-line span,
.hero__title-line {
    transform: translateY(110%);
    transition: transform 1s var(--ease-out);
}
.hero.is-revealed .hero__title-line { transform: translateY(0); }
.hero.is-revealed .hero__title-line:nth-child(2) { transition-delay: 0.12s; }

.hero__sub {
    margin-top: 18px;
    font-size: 14px;
    color: var(--ink-dim);
    max-width: 380px;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s var(--ease) 0.5s, transform 0.8s var(--ease) 0.5s;
}
.hero.is-revealed .hero__sub { opacity: 1; transform: translateY(0); }

.hero__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.25em;
    color: var(--ink-faint);
    opacity: 0;
    transition: opacity 0.8s var(--ease) 0.8s;
}
.hero.is-revealed .hero__meta { opacity: 1; }
.hero__dot {
    width: 4px;
    height: 4px;
    background: var(--ink-faint);
    border-radius: 50%;
}

/* When the user scrolls, the fixed hero fades + scales down so panels cover it.
   The canvas (3D scene) is also faded by the .is-scrolling-away hook in app.js. */
.scene.is-scrolling-away {
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
    pointer-events: none;
}

/* ============================================
   vAI portal tooltip — follows cursor on hover
   ============================================ */
.portal-tip {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(10, 12, 16, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(214, 255, 63, 0.35);
    border-radius: 2px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink);
    pointer-events: none;
    opacity: 0;
    transform: translate(18px, -50%) scale(0.96);
    transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
    white-space: nowrap;
}
.portal-tip.is-visible {
    opacity: 1;
    transform: translate(18px, -50%) scale(1);
}
.portal-tip__mark {
    color: var(--accent);
    font-weight: 700;
}
.portal-tip__label { color: var(--ink-dim); }
.portal-tip__arrow {
    color: var(--accent);
    margin-left: 2px;
    font-size: 13px;
}

/* ============================================
   Reduced motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .terminal__cursor { animation: none; }
    .log-line { animation: none; opacity: 1; transform: none; }
    .panel__inner { opacity: 1; transform: none; }
}

/* ============================================
   Scroll panels — Studio / Work / Contact
   ============================================ */
.panel {
    position: relative;
    z-index: 30;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 14vh 6vw;
    background: var(--bg);
    border-top: 1px solid var(--line);
}
.panel--studio { background: var(--bg); }
.panel--work   { background: var(--bg-soft); }
.panel--contact{ background: var(--bg); }

.panel__inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 60px;
    align-items: start;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.panel.is-in .panel__inner { opacity: 1; transform: translateY(0); }

.panel__index {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: sticky;
    top: 14vh;
}
.panel__num {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-faint);
    letter-spacing: 0.2em;
}
.panel__kicker {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

.panel__title {
    font-family: var(--font-sans);
    font-weight: 300;
    font-size: clamp(34px, 5vw, 72px);
    line-height: 1.02;
    letter-spacing: -0.025em;
    color: var(--ink);
    margin-bottom: 28px;
}
.panel__lede {
    font-size: 17px;
    line-height: 1.7;
    color: var(--ink-dim);
    max-width: 560px;
    margin-bottom: 48px;
}

.panel__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 28px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}
.panel__cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.panel__cell-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.25em;
    color: var(--ink-faint);
}
.panel__cell-value {
    font-size: 15px;
    color: var(--ink);
}
.panel__cell-link {
    font-size: 15px;
    color: var(--ink);
    border-bottom: 1px solid var(--ink-faint);
    padding-bottom: 2px;
    transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
    width: fit-content;
}
.panel__cell-link:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* services list */
.services {
    list-style: none;
    margin: 0 0 36px 0;
    padding: 0;
    border-top: 1px solid var(--line);
}
.service {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: 24px;
    align-items: baseline;
    padding: 28px 0;
    border-bottom: 1px solid var(--line);
    transition: padding-left 0.4s var(--ease);
}
.service:hover { padding-left: 12px; }
.service__num {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
    letter-spacing: 0.1em;
}
.service__head { display: flex; flex-direction: column; gap: 6px; }
.service__name {
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 22px;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.service__desc {
    font-size: 14px;
    color: var(--ink-dim);
    line-height: 1.6;
    max-width: 480px;
}
.service__tag {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--ink-faint);
    text-transform: uppercase;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 2px;
    white-space: nowrap;
}
.panel__note {
    font-size: 13px;
    color: var(--ink-faint);
    font-style: italic;
}

/* contact email block */
.contact-email {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    margin-bottom: 48px;
    text-decoration: none;
    transition: padding-left 0.4s var(--ease);
}
.contact-email:hover { padding-left: 12px; }
.contact-email__label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.25em;
    color: var(--ink-faint);
    min-width: 64px;
}
.contact-email__addr {
    font-family: var(--font-sans);
    font-size: clamp(20px, 2.4vw, 30px);
    color: var(--ink);
    letter-spacing: -0.01em;
    flex: 1;
    transition: color 0.3s var(--ease);
}
.contact-email:hover .contact-email__addr { color: var(--accent); }
.contact-email__arrow {
    font-size: 24px;
    color: var(--ink-dim);
    transition: transform 0.4s var(--ease), color 0.3s var(--ease);
}
.contact-email:hover .contact-email__arrow {
    transform: translateX(8px);
    color: var(--accent);
}

/* footer */
.footer {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 40px 6vw;
    background: var(--bg);
    border-top: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.16em;
    color: var(--ink-faint);
    text-transform: uppercase;
}
.footer__dot {
    width: 3px;
    height: 3px;
    background: var(--ink-faint);
    border-radius: 50%;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .terminal__inner { padding: 5vh 6vw; font-size: 11px; }
    .nav { gap: 20px; }
    .hero__footer { flex-direction: column; gap: 24px; align-items: flex-start; }
    .hero__caption { max-width: 100%; }
    .panel { padding: 18vh 6vw; }
    .panel__inner { grid-template-columns: 1fr; gap: 28px; }
    .panel__index { position: static; flex-direction: row; gap: 16px; }
    .service { grid-template-columns: 24px 1fr; }
    .service__tag { grid-column: 2; justify-self: start; margin-top: 8px; }
    .contact-email { flex-wrap: wrap; gap: 12px; }
}
