@import url('https://fonts.googleapis.com/css2?family=Fragment+Mono&family=Just+Me+Again+Down+Here&display=swap');

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-dark: #000000;
    --txt-light: #F8F4EE;
    --txt-muted: #A0AEC0;
    --border: rgba(255, 255, 255, 0.12);
    --font-main: 'Fragment Mono', monospace;
    --font-hand: 'Just Me Again Down Here', cursive;

    --tilt-x: 0deg;
    --tilt-y: 0deg;
    --hero-ca: 0;
}

html {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

body {
    background: var(--bg-dark);
    color: var(--txt-light);
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.55;
    overflow-x: hidden;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

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

:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 3px;
    border-radius: 4px;
}

/* =========================================
   HEADER
   ========================================= */
.m-header {
    padding: 1.5rem 1.25rem 0.5rem;
    text-align: center;
}

.m-brand {
    font-size: 1rem;
    letter-spacing: 0.4em;
    font-weight: 400;
    opacity: 0.7;
}

/* =========================================
   HERO
   ========================================= */
.m-hero {
    position: relative;
    width: 100%;
    height: 80vh;
    min-height: 480px;
    overflow: hidden;
    background: #000;
    transform-style: preserve-3d;
}

#m-hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    transform: translate3d(var(--tilt-x), var(--tilt-y), 0);
    will-change: transform;
}

.m-hero-title {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-hand);
    font-size: 30vw;
    line-height: 1;
    color: var(--txt-light);
    filter: url(#chromatic-aberration);
    mix-blend-mode: screen;
    pointer-events: none;
    user-select: none;
    text-shadow: 0 0 40px rgba(0, 0, 0, 0.4);
    animation: hero-pulse 6s ease-in-out infinite;
}

@keyframes hero-pulse {
    0%, 100% { opacity: 0.85; }
    50%      { opacity: 1; }
}

.m-hero-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.5rem 1.5rem 2rem;
    text-align: center;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.55) 50%, rgba(0, 0, 0, 0.95) 100%);
    pointer-events: none;
}

.m-scroll-cue {
    font-family: var(--font-hand);
    font-size: 1.4rem;
    color: var(--txt-muted);
    animation: m-bounce 2s infinite;
}

@keyframes m-bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
    60% { transform: translateY(-4px); }
}

.m-tilt-prompt {
    position: absolute;
    left: 50%;
    bottom: 5.5rem;
    transform: translateX(-50%);
    padding: 0.55rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--txt-light);
    font-family: var(--font-main);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 5;
}

.m-tilt-prompt:active {
    transform: translateX(-50%) scale(0.96);
    background: rgba(255, 255, 255, 0.15);
}

/* =========================================
   STACK (horizontal swipe carousel)
   ========================================= */
.m-stack {
    position: relative;
    padding: 2.5rem 0 1rem;
}

.m-section-title {
    font-size: 0.8rem;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--txt-muted);
    margin-bottom: 1.25rem;
    padding-left: 1.25rem;
}

.m-stack-viewport {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 1.25rem;
    padding: 0 1.25rem;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.m-stack-viewport::-webkit-scrollbar {
    display: none;
}

.m-stack-track {
    display: flex;
    list-style: none;
    gap: 1rem;
    padding: 0;
    margin: 0;
}

.m-stack-track:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.4);
}

.m-stack-card {
    flex: 0 0 calc(100vw - 2.5rem); /* viewport - side padding */
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1),
                border-color 0.3s ease,
                box-shadow 0.3s ease,
                background 0.3s ease;
    -webkit-touch-callout: none;
    will-change: transform;
}

.m-stack-card:active {
    transform: scale(0.98);
}

.m-stack-image-wrap {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #111;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.m-stack-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.m-stack-card.is-active .m-stack-img {
    transform: scale(1.02);
}

.m-stack-body {
    padding: 1.25rem 1.5rem 1.5rem;
}

.m-stack-title {
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}

.m-stack-title .ch {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
}

.m-stack-card.is-active .m-stack-title .ch {
    animation: ch-in 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
    animation-delay: calc(var(--i) * 35ms);
}

@keyframes ch-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.m-stack-body p {
    color: var(--txt-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

.m-project-link {
    font-family: var(--font-hand);
    font-size: 1.3rem;
    color: var(--txt-light);
    opacity: 0.85;
}

.m-stack-controls {
    padding: 1.25rem 1.25rem 0.5rem;
    text-align: center;
}

.m-stack-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.m-stack-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: background 0.3s ease, transform 0.3s ease, width 0.3s ease;
}

.m-stack-dot.is-active {
    background: var(--txt-light);
    width: 24px;
    border-radius: 3px;
}

.m-stack-hint {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--txt-muted);
    opacity: 0.6;
}

/* =========================================
   FOOTER
   ========================================= */
.m-footer {
    position: relative;
    padding: 3rem 1.25rem 3rem;
    text-align: center;
    background: #000;
    border-top: 1px solid var(--border);
}

.m-footer-wash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* subtle monochrome wash, no colored hues */
    background:
        radial-gradient(ellipse 60% 40% at 50% 0%, rgba(255, 255, 255, 0.04), transparent 70%),
        radial-gradient(ellipse 40% 30% at 50% 100%, rgba(255, 255, 255, 0.02), transparent 70%);
}

.m-footer-content {
    position: relative;
    z-index: 2;
    max-width: 360px;
    margin: 0 auto;
}

.m-social-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem 1.75rem;
    margin: 0.5rem 0 1.75rem;
    align-items: center;
}

.m-social-links .social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0.7;
}

.m-social-links .social-link svg {
    width: 100%;
    height: 100%;
    display: block;
}

.m-social-links .social-link:active,
.m-social-links .social-link:hover {
    transform: scale(1.15) translateY(-2px);
    opacity: 1;
}

.m-footer-note {
    font-size: 0.7rem;
    letter-spacing: 0.25em;
    color: var(--txt-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

.m-footer-switch a {
    font-size: 0.78rem;
    color: var(--txt-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 1px;
}

.m-footer-switch a:active,
.m-footer-switch a:hover {
    color: var(--txt-light);
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 360px) {
    .m-hero-title { font-size: 36vw; }
    .m-stack-title { font-size: 1.25rem; }
}

@media (max-height: 500px) and (orientation: landscape) {
    .m-hero { height: 100vh; min-height: 0; }
    .m-stack-viewport { max-height: 70vh; }
    .m-stack-card { max-height: 70vh; }
}

/* =========================================
   REDUCED MOTION
   ========================================= */
@media (prefers-reduced-motion: reduce) {
    .m-scroll-cue,
    .m-hero-title { animation: none; }

    .m-stack-card {
        transition: none;
    }

    .m-stack-title .ch {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .m-stack-card.is-active .m-stack-title .ch {
        animation: none;
        opacity: 1;
        transform: none;
    }
}
