:root {
    --bg: #0b0b0b;
    --fg: #f2f2f2;
    --muted: #9a9a9a;
    --accent: #00e5cc;
    /* ← single accent colour */
    --border: rgba(255, 255, 255, 0.18);
    --radius: 14px;
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    font-family: var(--ui);
}

.brand,
.hero,
.boot,
.typewriter,
.portfolio h1 {
    font-family: var(--mono);
}

body {
    background:
        radial-gradient(1200px 800px at 70% 20%,
            #121212 0%,
            #0b0b0b 45%,
            #070707 70%,
            #050505 100%);
    color: var(--fg);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    /* no scroll */
}

/* Layout */
.frame {
    height: 100vh;
    padding: clamp(16px, 3vw, 32px);
    padding-bottom: calc(clamp(16px, 3vw, 32px) + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 2vh, 18px);
}

/* ---------------- BOOT PRELOADER ---------------- */
.boot {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(1000px 700px at 60% 25%, #101010 0%, #0a0a0a 55%, #060606 100%);
    display: grid;
    place-items: center;
    padding: 24px;
}

.boot-inner {
    width: min(720px, 92vw);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    padding: 22px 22px 18px;
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65);
}

.boot-title {
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
    margin-bottom: 14px;
}

.boot-lines {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.78);
    max-height: 220px;
    overflow: hidden;
}

/* [ OK ] tag accent colour */
.boot-line .ok {
    color: var(--accent);
}

.boot-line {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 260ms ease, transform 260ms ease;
}

.boot-line.show {
    opacity: 1;
    transform: translateY(0);
}

.boot-bar {
    height: 10px;
    border-radius: 999px;
    margin-top: 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

/* Progress bar uses accent colour */
.boot-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: var(--accent);
    opacity: 0.7;
    transition: width 180ms ease;
}

.boot-meta {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255, 255, 255, 0.65);
    font-size: 12px;
    letter-spacing: 0.04em;
}

.boot-cursor {
    opacity: 1;
    animation: bootBlink 1s steps(1, end) infinite;
}

@keyframes bootBlink {
    50% {
        opacity: 0;
    }
}

.boot.hide {
    opacity: 0;
    pointer-events: none;
    transition: opacity 360ms ease;
}

/* Reduced motion (boot) */
@media (prefers-reduced-motion: reduce) {
    .boot-line {
        transition: none;
    }

    .boot-bar-fill {
        transition: none;
    }

    .boot-cursor {
        animation: none;
    }

    .boot.hide {
        transition: none;
    }
}

/* ---------------- TOP / BRAND ---------------- */
.top {
    font-size: 18px;
    font-weight: 600;
    text-transform: lowercase;
}

.brand {
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.2px;
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* blinking cursor */
.cursor {
    margin-left: 4px;
    opacity: 1;
    animation: blink 1s steps(1, end) infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.typewriter {
    display: inline-block;
    /* Hidden until JS starts typing — prevents flash of full text on load */
    visibility: hidden;
}

/* Keep brand in one line; allow hero/cta to wrap when needed */
.brand .typewriter {
    white-space: nowrap;
}

.hero .typewriter,
.cta .typewriter {
    white-space: normal;
}

/* accessibility: no motion */
@media (prefers-reduced-motion: reduce) {
    .cursor {
        animation: none;
    }
}

/* ---------------- STAGE + VIEWS (SEAMLESS TRANSITIONS) ---------------- */
.stage {
    position: relative;
    flex: 1;
    min-height: 0;
}

/* views overlap so header/footer never shift during transitions */
.view {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;

    opacity: 1;
    transform: translateY(0);
    transition: opacity 320ms ease, transform 320ms ease;
    pointer-events: auto;
}

.view.is-hidden {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .view {
        transition: none;
    }
}

/* ---------------- HERO ---------------- */
.hero {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 100%;
}

.hero h1 {
    font-size: clamp(40px, 6vw, 92px);
    line-height: 0.95;
    letter-spacing: -0.02em;
    margin: 0;
    max-width: 100%;
}

/* Each name part stays on its own line — prevents mid-type reflow */
.hero h1 .typewriter {
    display: block;
    line-height: 0.95;
}

.hero h2 {
    margin: 0;
    margin-top: clamp(8px, 1.6vw, 14px);
    font-size: clamp(14px, 1.8vw, 22px);
    opacity: 0.75;
    line-height: 1.25;
    max-width: 100%;
}

/* ---------------- PORTFOLIO ---------------- */
.portfolio {
    width: 100%;
}

.portfolio h1 {
    font-size: clamp(36px, 5vw, 64px);
    margin-bottom: 24px;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    background: rgba(255, 255, 255, .02);
}

.card h3 {
    margin: 0 0 8px;
}

.card p {
    margin: 0;
    opacity: 0.75;
    font-size: 14px;
}

/* Single definition for back-btn (duplicate removed) */
.back-btn {
    margin-top: 22px;
    background: none;
    border: none;
    color: var(--fg);
    font-size: 14px;
    cursor: pointer;
    opacity: 0.75;
    padding: 0;
}

.back-btn:hover {
    opacity: 1;
}

/* ---------------- BOTTOM CTAs ---------------- */
.bottom {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;

    /* make hide/show smooth on mobile without layout jumps */
    transition: opacity 220ms ease, transform 220ms ease;
    will-change: opacity, transform;
}

.cta {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(14px, 2vw, 18px) clamp(14px, 2vw, 20px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: clamp(13px, 1.2vw, 15px);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.cta:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

/* Primary CTA (Book a meeting) gets accent treatment */
.cta-primary {
    border-color: rgba(0, 229, 204, 0.35);
}

.cta-primary:hover {
    border-color: var(--accent);
}

/* Accent arrow on primary CTA */
.cta-primary .arrow {
    color: var(--accent);
}

.arrow {
    font-size: 22px;
    transition: transform 0.2s ease, opacity 0.25s ease;
}

.cta:hover .arrow {
    transform: translateX(4px);
}

.badge {
    color: var(--muted);
}

/* Arrow reveal (after typing) */
.arrow-hidden {
    opacity: 0;
    transform: translateX(-4px);
    pointer-events: none;
}

.arrow-visible {
    opacity: 1;
    transform: translateX(0);
}

/* ---------------- PULL TO REFRESH INDICATOR ---------------- */
.pull-indicator {
    position: fixed;
    top: -48px;
    left: 50%;
    transform: translateX(-50%);
    height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.6);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9998;
    transition: top 0.25s ease, opacity 0.25s ease;
    opacity: 0;
    pointer-events: none;
}

.pull-indicator.show {
    top: 16px;
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .pull-indicator {
        transition: none;
    }
}

/* Prevent accidental scroll on mobile pull */
html,
body {
    overscroll-behavior: none;
}

/* ---------------- RESPONSIVE ---------------- */

/* Mobile width */
@media (max-width: 900px) {
    .bottom {
        grid-template-columns: 1fr;
        /* Safe bottom spacing that respects content instead of magic number */
        padding-bottom: env(safe-area-inset-bottom, 0px);
        margin-bottom: 0;
    }

    /* On mobile the frame itself scrolls the footer into view if needed */
    .frame {
        height: 100dvh;
        /* dvh collapses mobile browser chrome correctly */
        overflow-y: auto;
        overflow-x: hidden;
    }

    body {
        overflow: visible;
        /* allow frame to scroll on mobile */
    }

    .portfolio h1 {
        margin-top: 64px;
    }

    /* Hide CTAs on mobile when portfolio is active, without layout snapping */
    body.is-portfolio .bottom {
        opacity: 0;
        transform: translateY(8px);
        pointer-events: none;
        visibility: hidden;
    }
}

/* Short screens (landscape phones, small laptops) */
@media (max-height: 720px) {
    .hero h1 {
        font-size: clamp(34px, 5.2vw, 72px);
    }

    .cta {
        padding: 12px 14px;
    }
}