/* ============================================================
   NIPUN SAINI — immersive redesign
   Near-black canvas, acid-lime accent, kinetic typography.
   ============================================================ */

:root {
    --bg: #060608;
    --surface: #0d0d11;
    --text: #f4f4f2;
    --muted: #8a8a93;
    --line: rgba(244, 244, 242, 0.1);
    --accent: #c8ff00;
    --font-display: "Space Grotesk", sans-serif;
    --font-body: "Archivo", sans-serif;
    --font-mono: "JetBrains Mono", monospace;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

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

.mono { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }

a { color: inherit; text-decoration: none; }
a, button, [data-hover] { cursor: pointer; }

/* Film grain */
body::after {
    content: "";
    position: fixed;
    inset: -50%;
    width: 200%;
    height: 200%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='128' height='128' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: grain 8s steps(10) infinite;
}
@keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-3%, 2%); }
    40% { transform: translate(2%, -3%); }
    60% { transform: translate(-2%, -2%); }
    80% { transform: translate(3%, 3%); }
}

/* Particle canvas */
#field {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

main { position: relative; z-index: 1; }

/* ---------- Cursor ---------- */
.cursor-dot, .cursor-ring {
    position: fixed;
    top: 0; left: 0;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
}
.cursor-dot {
    width: 6px; height: 6px;
    background: var(--accent);
}
.cursor-ring {
    width: 36px; height: 36px;
    border: 1px solid rgba(200, 255, 0, 0.5);
    transition: width 0.3s var(--ease), height 0.3s var(--ease), background 0.3s;
}
.cursor-ring.is-hover {
    width: 64px; height: 64px;
    background: rgba(200, 255, 0, 0.08);
}
@media (hover: none), (pointer: coarse) {
    .cursor-dot, .cursor-ring { display: none; }
}

/* ---------- Progress bar ---------- */
.progress-bar {
    position: fixed;
    top: 0; left: 0;
    height: 2px;
    width: 0;
    background: var(--accent);
    z-index: 1001;
}

/* ---------- Nav ---------- */
.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.4rem clamp(1.25rem, 4vw, 3rem);
    background: linear-gradient(to bottom, rgba(6, 6, 8, 0.85), rgba(6, 6, 8, 0));
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    mask-image: linear-gradient(to bottom, #000 60%, transparent);
    -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent);
}
.nav-brand {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
}
.blink { animation: blink 1.2s steps(2) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

.nav-links { display: flex; gap: 2rem; }
.nav-link {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    position: relative;
}
.nav-link::after {
    content: "";
    position: absolute;
    left: 0; bottom: -4px;
    width: 100%; height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s var(--ease);
}
.nav-link:hover::after, .nav-link.active::after {
    transform: scaleX(1);
    transform-origin: left;
}

.nav-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 100px;
    padding: 0.5rem 1rem;
    transition: border-color 0.3s;
}
.nav-status:hover { border-color: #fff; }
.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(200, 255, 0, 0.5); }
    50% { box-shadow: 0 0 0 6px rgba(200, 255, 0, 0); }
}

/* ---------- Hero ---------- */
.hero {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 6rem clamp(1.25rem, 4vw, 3rem) 4rem;
    position: relative;
}
.hero-eyebrow {
    color: var(--accent);
    margin-bottom: 1.5rem;
}
.hero-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(4rem, 16vw, 15rem);
    line-height: 0.9;
    letter-spacing: -0.03em;
    text-transform: uppercase;
}
.hero-name .line { display: block; }
.hero-name .outline {
    color: transparent;
    -webkit-text-stroke: 2px var(--text);
}
.hero-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin-top: 3rem;
}
.hero-tag {
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    color: var(--muted);
    max-width: 34rem;
}
.hero-cta { display: flex; align-items: center; gap: 1.5rem; }

.btn-magnetic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #060608;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 1.1rem 2.2rem;
    border-radius: 100px;
    transition: transform 0.2s ease-out, box-shadow 0.3s;
    will-change: transform;
}
.btn-magnetic:hover { box-shadow: 0 0 40px rgba(200, 255, 0, 0.35); }

.btn-ghost {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 1px solid var(--line);
    padding-bottom: 4px;
    transition: border-color 0.3s, color 0.3s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.hero-scroll {
    position: absolute;
    bottom: 2rem;
    right: clamp(1.25rem, 4vw, 3rem);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--muted);
}
.scroll-line {
    display: block;
    width: 1px;
    height: 48px;
    background: var(--line);
    position: relative;
    overflow: hidden;
}
.scroll-line::after {
    content: "";
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--accent);
    animation: scrollHint 1.8s var(--ease) infinite;
}
@keyframes scrollHint {
    0% { top: -100%; }
    60%, 100% { top: 100%; }
}

/* ---------- Marquee ---------- */
.marquee {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    overflow: hidden;
    padding: 1.4rem 0;
    white-space: nowrap;
}
.marquee-track {
    display: inline-flex;
    animation: marquee 28s linear infinite;
}
.marquee-track span {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 2.4vw, 1.8rem);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}
@keyframes marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ---------- Sections ---------- */
section { padding: clamp(5rem, 12vh, 9rem) clamp(1.25rem, 4vw, 3rem); }

.section-label { color: var(--accent); display: block; margin-bottom: 1.25rem; }

.section-head h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2.4rem, 6vw, 5rem);
    line-height: 1.02;
    letter-spacing: -0.02em;
}

/* ---------- Work list ---------- */
.work-list {
    margin-top: 4rem;
    border-top: 1px solid var(--line);
}
.work-row {
    display: grid;
    grid-template-columns: 3.5rem 1fr auto 2rem;
    align-items: baseline;
    gap: 1.5rem;
    padding: 1.8rem 0.5rem;
    border-bottom: 1px solid var(--line);
    position: relative;
    transition: padding 0.4s var(--ease);
}
.work-row::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(200, 255, 0, 0.04);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.4s var(--ease);
    pointer-events: none;
}
.work-row:hover::before { transform: scaleY(1); transform-origin: top; }
.work-row:hover { padding-left: 1.25rem; }

.work-num { color: var(--muted); }
.work-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.6rem, 4.5vw, 3.4rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    transition: color 0.3s;
}
.work-row:hover .work-title { color: var(--accent); }
.work-meta {
    color: var(--muted);
    font-size: 0.9rem;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
}
.work-meta .award {
    font-style: normal;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
}
.work-arrow {
    font-size: 1.4rem;
    color: var(--muted);
    transform: translateX(-8px) rotate(45deg);
    opacity: 0;
    transition: transform 0.35s var(--ease), opacity 0.35s, color 0.3s;
}
.work-row:hover .work-arrow {
    transform: translateX(0) rotate(0deg);
    opacity: 1;
    color: var(--accent);
}

/* Floating preview card */
.work-preview {
    position: fixed;
    top: 0; left: 0;
    width: 300px;
    height: 190px;
    border-radius: 10px;
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.85);
    transition: opacity 0.25s var(--ease);
    overflow: hidden;
    will-change: transform;
}
.work-preview.is-active { opacity: 1; }
.work-preview-inner {
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.3rem;
    padding: 1.25rem;
    background: var(--wp-bg, linear-gradient(135deg, #1b2a4a, #0d0d11));
}
.wp-label { color: rgba(255, 255, 255, 0.95); font-weight: 500; }
.wp-sub { font-size: 0.8rem; color: rgba(255, 255, 255, 0.6); }
@media (hover: none), (pointer: coarse) {
    .work-preview { display: none; }
}

/* ---------- About ---------- */
.about-statement {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.5rem, 3.4vw, 2.8rem);
    line-height: 1.35;
    letter-spacing: -0.01em;
    max-width: 62rem;
}
.about-statement .w {
    opacity: 0.12;
    transition: opacity 0.5s ease;
}
.about-statement .w.on { opacity: 1; }

.stats.stats-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    margin-top: 5rem;
}
.stat {
    background: var(--bg);
    box-shadow: 0 0 0 1px var(--line);
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: background 0.3s;
}
.stat:hover { background: var(--surface); }
.stat-num {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.6rem, 6vw, 4.5rem);
    line-height: 1;
    color: var(--accent);
}
.stat-label { color: var(--muted); }

.skills {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2.5rem 3rem;
    margin-top: 5rem;
}
.skill-group h3 { color: var(--accent); margin-bottom: 0.6rem; font-weight: 500; }
.skill-group p { color: var(--muted); font-size: 0.95rem; }

.exp { margin-top: 5rem; border-top: 1px solid var(--line); }
.exp-row {
    display: grid;
    grid-template-columns: 10rem 1fr;
    gap: 2rem;
    padding: 2rem 0.5rem;
    border-bottom: 1px solid var(--line);
    transition: background 0.3s;
}
.exp-row:hover { background: rgba(255, 255, 255, 0.02); }
.exp-date { color: var(--muted); padding-top: 0.35rem; }
.exp-row h3 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.15rem;
    margin-bottom: 0.4rem;
}
.exp-row p { color: var(--muted); font-size: 0.95rem; }

/* ---------- Contact ---------- */
.contact { text-align: left; }
.contact-big {
    display: block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(4rem, 15vw, 14rem);
    line-height: 0.92;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    margin: 1rem 0 2rem;
}
.contact-line { display: block; }
.contact-big .outline {
    color: transparent;
    -webkit-text-stroke: 2px var(--text);
    transition: color 0.4s var(--ease);
}
.contact-big:hover .outline { color: var(--accent); -webkit-text-stroke-color: var(--accent); }
.contact-arrow {
    display: inline-block;
    margin-left: 0.15em;
    transition: transform 0.4s var(--ease);
}
.contact-big:hover .contact-arrow { transform: translateX(0.15em) rotate(-45deg); }
.contact-sub { color: var(--muted); margin-bottom: 2.5rem; }
.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}
.contact-links a {
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    padding-bottom: 4px;
    transition: color 0.3s, border-color 0.3s;
}
.contact-links a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Footer ---------- */
.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    padding: 2rem clamp(1.25rem, 4vw, 3rem);
    border-top: 1px solid var(--line);
    color: var(--muted);
    position: relative;
    z-index: 1;
}

/* ---------- Scroll reveals ---------- */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .work-row {
        grid-template-columns: 2.5rem 1fr;
        grid-template-rows: auto auto;
        row-gap: 0.4rem;
    }
    .work-meta {
        grid-column: 2;
        align-items: flex-start;
        text-align: left;
    }
    .work-arrow { display: none; }
    .stats { grid-template-columns: 1fr; }
    .exp-row { grid-template-columns: 1fr; gap: 0.5rem; }
    .hero-scroll { display: none; }
}

/* ============================================================
   Case study pages
   ============================================================ */

.case-head {
    padding: 10rem clamp(1.25rem, 4vw, 3rem) 0;
}
.case-eyebrow { color: var(--accent); margin-bottom: 1.5rem; display: block; }
.case-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.8rem, 10vw, 8.5rem);
    line-height: 0.94;
    letter-spacing: -0.03em;
    text-transform: uppercase;
}
.case-sub {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.1rem, 2.4vw, 1.6rem);
    color: var(--muted);
    margin-top: 1.25rem;
}
.case-desc {
    max-width: 46rem;
    color: var(--muted);
    font-size: 1.05rem;
    margin-top: 2rem;
}
.case-actions { display: flex; align-items: center; gap: 1.5rem; margin-top: 2.5rem; }

.case-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1px;
    margin-top: 4rem;
}
.case-meta > div {
    background: var(--bg);
    box-shadow: 0 0 0 1px var(--line);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.meta-k { color: var(--muted); }
.meta-v { font-family: var(--font-display); font-weight: 500; font-size: 1.05rem; }

/* Challenge / solution duo */
.duo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1px;
}
.duo-card { background: var(--bg); box-shadow: 0 0 0 1px var(--line); padding: 2.75rem; transition: background 0.3s; }
.duo-card:hover { background: var(--surface); }
.duo-card h3 { margin-bottom: 1rem; color: var(--accent); font-weight: 500; }
.duo-card p { color: var(--muted); }

/* Feature rows */
.case-features { border-top: 1px solid var(--line); }
.cf-row {
    display: grid;
    grid-template-columns: 4rem 1fr;
    gap: 1.5rem;
    padding: 3rem 0.5rem;
    border-bottom: 1px solid var(--line);
    position: relative;
}
.cf-row::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(200, 255, 0, 0.03);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.4s var(--ease);
    pointer-events: none;
}
.cf-row:hover::before { transform: scaleY(1); transform-origin: top; }
.cf-num { color: var(--muted); padding-top: 0.4rem; }
.cf-row h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.3rem, 2.6vw, 1.9rem);
    letter-spacing: -0.01em;
    margin-bottom: 0.75rem;
}
.cf-row p { color: var(--muted); max-width: 52rem; }
.cf-row p code, .cf-row p strong { color: var(--text); font-weight: 400; font-style: normal; }
.cf-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin-top: 1.25rem;
    list-style: none;
}
.cf-tags li {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
}
.cf-tags li::before { content: "+ "; color: var(--muted); }

/* Learnings */
.lessons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1px;
}
.lesson { background: var(--bg); box-shadow: 0 0 0 1px var(--line); padding: 2.25rem; transition: background 0.3s; }
.lesson:hover { background: var(--surface); }
.lesson .mono { color: var(--accent); display: block; margin-bottom: 1rem; }
.lesson h4 {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.15rem;
    margin-bottom: 0.6rem;
}
.lesson p { color: var(--muted); font-size: 0.95rem; }

/* Next project */
.next-project {
    display: block;
    padding: clamp(5rem, 12vh, 9rem) clamp(1.25rem, 4vw, 3rem);
    border-top: 1px solid var(--line);
}
.next-label { color: var(--muted); display: block; margin-bottom: 1rem; }
.next-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.6rem, 9vw, 7.5rem);
    line-height: 0.95;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: transparent;
    -webkit-text-stroke: 2px var(--text);
    transition: color 0.4s var(--ease);
}
.next-project:hover .next-title { color: var(--accent); -webkit-text-stroke-color: var(--accent); }
.next-arrow { display: inline-block; margin-left: 0.2em; transition: transform 0.4s var(--ease); }
.next-project:hover .next-arrow { transform: translateX(0.2em); }

@media (max-width: 768px) {
    .cf-row { grid-template-columns: 1fr; gap: 0.5rem; }
    .duo-card { padding: 1.75rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    body::after { animation: none; }
    .marquee-track { animation: none; }
    .scroll-line::after, .status-dot, .blink { animation: none; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .about-statement .w { opacity: 1; }
    #field { display: none; }
    .cursor-dot, .cursor-ring { display: none; }
}
