/* ────────────────────────────────
   Anish Karki — Minimal Portfolio
   ──────────────────────────────── */

:root {
    --bg: #111113;
    --bg-card: #19191d;
    --text: #e8e8ec;
    --text-secondary: #9a9aa8;
    --text-muted: #5a5a6e;
    --border: #2a2a32;
    --accent: #7c8aff;
    --serif: 'Instrument Serif', Georgia, serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* subtle grain overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9990;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

/* ── Loader ── */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}
.loader.done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.loader-inner {
    text-align: center;
    animation: loaderFadeUp 0.8s ease both;
}
@keyframes loaderFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.loader-name {
    font-family: var(--serif);
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 400;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.6rem;
}
.loader-tagline {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 2rem;
    animation: loaderFadeUp 0.8s ease 0.3s both;
}
.loader-line {
    width: 160px;
    height: 1px;
    background: var(--border);
    border-radius: 1px;
    overflow: hidden;
    margin: 0 auto;
}
.loader-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), #a78bfa);
    animation: loaderFill 1.4s ease 0.4s forwards;
    box-shadow: 0 0 8px rgba(124, 138, 255, 0.4);
}
@keyframes loaderFill {
    to { width: 100%; }
}

/* ── Nav ── */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 3rem;
    max-width: 1100px;
    margin: 0 auto;
}

.logo {
    font-family: var(--sans);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
    transition: color 0.3s;
}
.logo:hover {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    position: relative;
    transition: color 0.3s;
}
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s ease;
}
.nav-links a:hover {
    color: var(--text);
}
.nav-links a:hover::after {
    width: 100%;
}

/* ── Main ── */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 3rem 6rem;
}

/* ── Hero ── */
.hero {
    padding: 8rem 0 6rem;
}

.hero-inner {
    display: flex;
    align-items: center;
    gap: 4rem;
}

.hero-text {
    flex: 1;
}

.hero-photo {
    flex-shrink: 0;
    width: 280px;
    height: 340px;
}

.hero-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    transition: transform 0.5s;
    border: 2px solid var(--border);
}

.hero-photo img:hover {
    transform: scale(1.02);
    border-color: var(--accent);
}

.hero-label {
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.hero h1 {
    font-family: var(--serif);
    font-size: clamp(2.8rem, 6vw, 4.5rem);
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
}

.hero h1 em {
    font-style: italic;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding-right: 0.05em;
}

.hero-sub {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 500px;
    line-height: 1.7;
}

/* ── Divider ── */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
}

/* ── Sections ── */
.section-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 3rem;
    padding-top: 5rem;
}

.section-num {
    font-size: 0.75rem;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.section-header h2 {
    font-family: var(--serif);
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: -0.02em;
}

/* ── About ── */
.about-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 4rem;
    padding-bottom: 5rem;
}

.about-text p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 1.2rem;
}

.about-details {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 0.3rem;
}

.detail {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border);
    transition: border-color 0.3s;
}
.detail:hover {
    border-left-color: var(--accent);
}

.detail-label {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.detail span:last-child {
    font-size: 0.95rem;
    color: var(--text);
}

/* ── Work ── */
.work {
    padding-bottom: 5rem;
}

.work-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.work-card {
    padding: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.work-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(124, 138, 255, 0.06);
}

.work-card h3 {
    font-family: var(--sans);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    letter-spacing: -0.01em;
}

.work-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
    line-height: 1.6;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tags span {
    font-size: 0.72rem;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.tags span:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(124, 138, 255, 0.08);
}

/* ── Contact ── */
.contact {
    padding-bottom: 5rem;
}

.contact-content p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.email-link {
    display: inline-block;
    font-family: var(--serif);
    font-size: 1.8rem;
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.2rem;
    transition: border-color 0.3s, letter-spacing 0.3s;
    letter-spacing: -0.02em;
}

.email-link:hover {
    border-color: var(--accent);
    letter-spacing: 0.02em;
}

.social-links {
    display: flex;
    gap: 2rem;
    margin-top: 2.5rem;
}

.social-links a {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s, transform 0.3s;
}

.social-links a:hover {
    color: var(--accent);
    transform: translateY(-2px);
}

/* ── Footer ── */
footer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 3rem;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Fade-in animation ── */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Responsive ── */
@media (max-width: 800px) {
    nav { padding: 1.5rem; }
    main { padding: 0 1.5rem 4rem; }
    .hero { padding: 5rem 0 4rem; }
    .hero-inner {
        flex-direction: column;
        gap: 2.5rem;
    }
    .hero-photo {
        width: 200px;
        height: 240px;
    }
    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .work-grid {
        grid-template-columns: 1fr;
    }
    .email-link { font-size: 1.3rem; }
    footer { padding: 1.5rem; flex-direction: column; gap: 0.3rem; }
}

@media (max-width: 500px) {
    nav { padding: 1.2rem; }
    .nav-links { gap: 1.5rem; }
    main { padding: 0 1.2rem 3rem; }
    .hero { padding: 3rem 0 3rem; }
    .hero h1 { font-size: 2.2rem; }
    .section-header { padding-top: 3rem; }
    footer { padding: 1.2rem; }
}
