/* ═══════════════════════════════════════════════════════════════════════════
   MrEnricc — UI v2 layer
   Shared tokens, motion primitives, header/footer, dock, cursor, transitions.
   Loaded after main.css on every page.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --brand: #1E60F1;
    --brand-2: #3a86ff;
    --brand-deep: #0e2e75;
    --pink: #ff006e;
    --ink: #0f172a;

    --bg: #f5f5f5;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --text: #111111;
    --text-2: #333333;
    --muted: #5b6474;
    --line: rgba(15, 23, 42, 0.1);
    --line-strong: rgba(15, 23, 42, 0.18);

    --grad-brand: linear-gradient(135deg, #1E60F1 0%, #3a86ff 55%, #ff006e 130%);
    --grad-line: linear-gradient(90deg, #1E60F1, #3a86ff 50%, #ff006e);

    --radius-sm: 10px;
    --radius: 18px;
    --radius-lg: 28px;

    --shadow-sm: 0 2px 10px rgba(2, 8, 23, 0.06);
    --shadow: 0 18px 45px rgba(2, 8, 23, 0.08);
    --shadow-lg: 0 30px 80px rgba(2, 8, 23, 0.16);

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-io: cubic-bezier(0.76, 0, 0.24, 1);
}

body.dark-mode {
    --bg: #121212;
    --surface: #1a1a1a;
    --surface-2: #161616;
    --text: #f0f0f0;
    --text-2: #d4d4d4;
    --muted: #a3a3a3;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.55);
}

/* overflow-x: hidden on html/body turns body into a scroll container and
   silently breaks every position: sticky on the site — clip doesn't. */
html,
body {
    overflow-x: clip;
}

body {
    overflow-y: visible;
}

/* Theme set in <head> by motion-boot.js — avoids a white flash in dark mode */
html.theme-dark,
html.theme-dark body {
    background-color: #121212;
}

::selection {
    background: rgba(30, 96, 241, 0.22);
}

/* ── Accessibility: visible keyboard focus everywhere ─────────────────────── */
:focus-visible {
    outline: 2px solid var(--brand-2);
    outline-offset: 3px;
    border-radius: 6px;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -100px;
    z-index: 100001;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    background: var(--ink);
    color: #fff !important;
    border: none;
    font-weight: 600;
}

.skip-link:focus {
    top: 1rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Motion primitives
   ═══════════════════════════════════════════════════════════════════════════ */

/* Hidden-before-reveal states only exist while the motion layer is on */
.m-on [data-m]:not(.m-in),
.m-on [data-m-hero]:not(.m-in) {
    opacity: 0;
}

.m-on [data-m-split]:not(.m-split-ready) {
    opacity: 0;
}

.m-w {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    padding-bottom: 0.1em;
    margin-bottom: -0.1em;
}

.m-w__i {
    display: inline-block;
    transform-origin: 0 100%;
    will-change: transform;
}

/* Scroll-scrubbed highlight words */
.m-hl {
    transition: opacity 0.12s linear;
}

/* Spotlight that follows the pointer inside a card */
.m-spot {
    position: relative;
    isolation: isolate;
}

.m-spot::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(58, 134, 255, 0.12), transparent 45%);
    transition: opacity 0.35s ease;
    z-index: 1;
}

.m-spot:hover::after {
    opacity: 1;
}

/* Reading progress */
.m-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 1500;
    background: var(--grad-line);
    transform-origin: 0 50%;
    transform: scaleX(0);
    pointer-events: none;
}

/* Cursor follower */
.m-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    z-index: 100000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.m-cursor.is-visible { opacity: 1; }
.m-cursor.is-hidden { opacity: 0; }

.m-cursor::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    left: -5px;
    top: -5px;
    border-radius: 50%;
    background: var(--brand);
    transition: transform 0.35s var(--ease-out), background-color 0.25s ease, opacity 0.25s ease;
}

.m-cursor.is-link::before {
    transform: scale(4);
    background: rgba(58, 134, 255, 0.16);
}

.m-cursor.has-label::before {
    transform: scale(8.4);
    background: var(--brand);
}

.m-cursor__label {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%) scale(0.4);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.35s var(--ease-out);
}

.m-cursor.has-label .m-cursor__label {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Floating list preview */
.m-preview {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 210px;
    margin: -105px 0 0 -160px;
    z-index: 1400;
    pointer-events: none;
    will-change: transform;
}

.m-preview__card {
    width: 100%;
    height: 100%;
    opacity: 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: var(--surface);
}

.m-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Page transition curtain */
.m-curtain,
html.m-entering::after {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background:
        radial-gradient(60% 50% at 80% 100%, rgba(255, 0, 110, 0.28), transparent 70%),
        radial-gradient(70% 60% at 10% 0%, rgba(30, 96, 241, 0.55), transparent 70%),
        #0f172a;
}

html.m-entering::after {
    content: '';
}

.m-curtain {
    transform: translateY(100%);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.m-curtain.is-active {
    pointer-events: auto;
}

.m-curtain__brand {
    color: #fff;
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.m-curtain__brand i {
    font-style: normal;
    color: var(--pink);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Header — fixed, hides on scroll down, gliding hover pill
   ═══════════════════════════════════════════════════════════════════════════ */

.site-header-wrap {
    position: fixed;
    transition: transform 0.5s var(--ease-out);
}

.site-header-wrap.is-hidden {
    transform: translateY(-140%);
}

.site-nav-list {
    position: relative;
}

.nav-glider {
    position: absolute;
    top: 0.25rem;
    bottom: 0.25rem;
    left: 0;
    width: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(2, 8, 23, 0.08);
    opacity: 0;
    pointer-events: none;
    z-index: 0;
}

.nav-link {
    position: relative;
    z-index: 1;
}

.m-on .nav-link:hover {
    background: transparent;
    transform: none;
}

.m-on .site-nav .nav-link.is-active:hover {
    background: #0f172a;
}

body.dark-mode .nav-glider {
    background: rgba(255, 255, 255, 0.1);
}

.m-on body.dark-mode .nav-link:hover {
    background: transparent;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Dock — theme + language (replaces the lone dark-mode button)
   ═══════════════════════════════════════════════════════════════════════════ */

.ui-dock {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1300;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.ui-dock button.ui-dock__btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 0.75rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-2);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.ui-dock button.ui-dock__btn:hover {
    background: rgba(15, 23, 42, 0.06);
}

.ui-dock__lang span {
    opacity: 0.4;
    transition: opacity 0.2s ease;
}

.ui-dock__lang span.is-on {
    opacity: 1;
    color: var(--brand);
}

.ui-dock__lang i {
    font-style: normal;
    opacity: 0.25;
    margin: 0 0.2rem;
}

.ui-dock__sep {
    width: 1px;
    height: 20px;
    background: var(--line-strong);
}

body.dark-mode .ui-dock {
    background: rgba(26, 26, 26, 0.82);
}

body.dark-mode .ui-dock button.ui-dock__btn {
    color: #e5e5e5;
    background: transparent;
}

body.dark-mode .ui-dock button.ui-dock__btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .ui-dock__lang span.is-on {
    color: #7aa7ff;
}

/* Legacy floating toggle is now inside the dock */
.dark-mode-toggle { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════════════════════════════════ */

footer.site-footer {
    position: relative;
    overflow: hidden;
    margin-top: 0;
    padding: 6rem 0 0;
    background: #0b1020;
    color: #e5e7eb;
}

footer.site-footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(50% 60% at 85% 10%, rgba(255, 0, 110, 0.12), transparent 70%),
        radial-gradient(60% 70% at 0% 0%, rgba(30, 96, 241, 0.28), transparent 70%);
    pointer-events: none;
}

footer.site-footer .container {
    position: relative;
}

footer.site-footer a {
    border-bottom: none;
    color: inherit;
}

.sf-eyebrow {
    margin: 0 0 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #9aa4b8;
}

.sf-cta__link {
    display: inline-flex;
    align-items: center;
    gap: 1.25rem;
    font-size: clamp(2.8rem, 9vw, 7.5rem);
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1;
    color: #fff !important;
}

.sf-cta__link:hover {
    opacity: 1;
}

.sf-cta__text {
    background: linear-gradient(90deg, #fff 0%, #fff 50%, #7aa7ff 50%, #ff5fa2 100%);
    background-size: 200% 100%;
    background-position: 0 0;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: background-position 0.7s var(--ease-out);
}

.sf-cta__link:hover .sf-cta__text {
    background-position: -100% 0;
}

.sf-cta__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(3rem, 7vw, 5.5rem);
    height: clamp(3rem, 7vw, 5.5rem);
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    flex-shrink: 0;
    transition: transform 0.5s var(--ease-out), background-color 0.3s ease;
}

.sf-cta__arrow svg {
    width: 42%;
    height: 42%;
}

.sf-cta__link:hover .sf-cta__arrow {
    transform: rotate(45deg);
    background: var(--pink);
}

.site-footer--compact .sf-grid {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.sf-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
    margin-top: 5rem;
    padding-top: 2.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sf-label {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #8892a6;
}

.sf-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sf-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.2rem 0;
    font-size: 1rem;
    font-weight: 500;
    color: #e5e7eb;
    transition: color 0.2s ease, transform 0.3s var(--ease-out);
}

.sf-links a:hover {
    color: #fff;
    opacity: 1;
    transform: translateX(4px);
}

.sf-links i {
    width: 1rem;
    opacity: 0.7;
}

.sf-time {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.sf-place {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.9rem;
    color: #9aa4b8;
}

.sf-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #cbd5e1;
}

.sf-status__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
    animation: sf-pulse 2s infinite;
}

@keyframes sf-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
    70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.sf-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 4rem;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sf-bottom .copyright {
    margin: 0;
    font-size: 0.85rem;
    color: #8892a6;
}

footer.site-footer button.sf-top {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: transparent;
    color: #e5e7eb;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

footer.site-footer button.sf-top:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
}

.sf-wordmark {
    margin-top: 1rem;
    font-size: clamp(5rem, 22vw, 21rem);
    font-weight: 800;
    letter-spacing: -0.07em;
    line-height: 0.78;
    text-align: center;
    white-space: nowrap;
    user-select: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0) 85%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transform: translateY(12%);
}

body.dark-mode footer.site-footer {
    background: #0a0a0f;
}

@media (max-width: 768px) {
    footer.site-footer { padding-top: 4rem; }
    .sf-grid { grid-template-columns: 1fr 1fr; margin-top: 3rem; }
    .sf-grid > :last-child { grid-column: 1 / -1; }
    .sf-bottom { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Next project (bottom of every case study)
   ═══════════════════════════════════════════════════════════════════════════ */

.next-project {
    padding: 6rem 0 7rem;
    background: transparent;
}

.np-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.np-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.np-all {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--brand) !important;
    border-bottom: none !important;
}

.np-card {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    min-height: 420px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--ink);
    color: #fff !important;
    border-bottom: none !important;
    box-shadow: var(--shadow-lg);
    transition: transform 0.6s var(--ease-out), box-shadow 0.6s var(--ease-out);
}

.np-card:hover {
    opacity: 1;
    transform: translateY(-6px);
}

.np-media {
    position: relative;
    overflow: hidden;
}

.np-media img {
    position: absolute;
    inset: -8% 0;
    width: 100%;
    height: 116%;
    object-fit: cover;
    transition: filter 0.6s ease;
}

.np-card:hover .np-media img {
    filter: saturate(1.15);
}

.np-body {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    padding: clamp(2rem, 4vw, 3.5rem);
    background:
        radial-gradient(80% 70% at 100% 0%, rgba(255, 0, 110, 0.18), transparent 70%),
        radial-gradient(90% 80% at 0% 100%, rgba(30, 96, 241, 0.4), transparent 70%);
}

.np-index {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.6);
    font-variant-numeric: tabular-nums;
}

.np-title {
    margin: 0.5rem 0 0.75rem;
    font-size: clamp(2.4rem, 5vw, 4.25rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1;
    color: #fff !important;
    -webkit-text-fill-color: #fff;
}

.np-desc {
    margin: 0;
    max-width: 42ch;
    color: rgba(255, 255, 255, 0.75);
    font-size: 1rem;
    line-height: 1.6;
}

.np-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    align-self: flex-start;
    padding: 0.85rem 1.4rem;
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-weight: 700;
    font-size: 0.95rem;
    transition: background-color 0.3s ease, color 0.3s ease, gap 0.4s var(--ease-out);
}

.np-card:hover .np-cta {
    gap: 1.25rem;
    background: var(--brand);
    color: #fff;
}

.np-prev {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.25rem;
}

.np-prev a {
    font-size: 0.9rem;
    color: var(--muted) !important;
    border-bottom: none !important;
}

.np-prev a:hover {
    color: var(--brand) !important;
    opacity: 1;
}

@media (max-width: 820px) {
    .np-card { grid-template-columns: 1fr; min-height: 0; }
    .np-media { height: 240px; }
}

/* Old random mini-cards are replaced */
.next-projects:empty { display: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   Shared buttons
   ═══════════════════════════════════════════════════════════════════════════ */

.v2-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 48px;
    padding: 0 1.4rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
    border-bottom: 1px solid transparent;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.v2-btn:hover { opacity: 1; }

.v2-btn--primary {
    background: var(--brand);
    color: #fff !important;
    box-shadow: 0 12px 30px rgba(30, 96, 241, 0.3);
}

.v2-btn--primary:hover {
    background: #1650d0;
    box-shadow: 0 16px 36px rgba(30, 96, 241, 0.4);
}

.v2-btn--ghost {
    background: transparent;
    color: var(--text) !important;
    border-color: var(--line-strong);
}

.v2-btn--ghost:hover {
    border-color: var(--brand);
    color: var(--brand) !important;
}

.v2-btn svg {
    transition: transform 0.35s var(--ease-out);
}

.v2-btn:hover svg {
    transform: translateX(3px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Reduced motion: final states, no smooth scrolling
   ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
