/* ============================================================
   Narasimha Reddy Kasarla — Portfolio
   Modern dark theme · vanilla CSS
   ============================================================ */

:root {
    --bg: #0b0d14;
    --bg-soft: #10131d;
    --surface: #141826;
    --surface-2: #1a1f30;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #e8eaf2;
    --text-dim: #9aa1b5;
    --text-faint: #6b7288;
    --accent: #7c6cff;
    --accent-2: #38d9f5;
    --gradient: linear-gradient(120deg, #7c6cff 0%, #38d9f5 100%);
    --shadow-glow: 0 0 40px rgba(124, 108, 255, 0.18);
    --radius: 14px;
    --nav-h: 72px;
    --font-body: "Inter", system-ui, -apple-system, sans-serif;
    --font-display: "Space Grotesk", var(--font-body);
    --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }

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

::selection { background: rgba(124, 108, 255, 0.4); color: #fff; }

.container {
    width: min(1120px, 100% - 3rem);
    margin-inline: auto;
}

.mono { font-family: var(--font-mono); }

.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* ---------- Background decor ---------- */
.bg-decor {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 40%, transparent 100%);
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(110px);
    opacity: 0.35;
    animation: orb-drift 18s ease-in-out infinite alternate;
}

.bg-orb-1 { width: 480px; height: 480px; top: -160px; right: -120px; background: #4c3fd6; }
.bg-orb-2 { width: 380px; height: 380px; bottom: -140px; left: -120px; background: #0f6f85; animation-delay: -6s; }
.bg-orb-3 { width: 260px; height: 260px; top: 45%; left: 60%; background: #35317a; opacity: 0.25; animation-delay: -12s; }

@keyframes orb-drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(-40px, 40px) scale(1.08); }
}

/* ---------- Scroll progress ---------- */
.scroll-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0%;
    background: var(--gradient);
    z-index: 1001;
    border-radius: 0 2px 2px 0;
}

/* ---------- Navbar ---------- */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    transition: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    border-bottom: 1px solid transparent;
}

.navbar.scrolled {
    background: rgba(11, 13, 20, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom-color: var(--border);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.nav-inner {
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    background: var(--gradient);
    box-shadow: var(--shadow-glow);
}

.brand-text {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text);
    font-size: 1.05rem;
}

.brand-dot { color: var(--accent-2); }

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    list-style: none;
}

.nav-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-num {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent-2);
    margin-right: 0.3rem;
}

.nav-link:hover, .nav-link.active { color: var(--text); }

.nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1.1rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.nav-cta:hover {
    background: rgba(124, 108, 255, 0.12);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.85rem 1.7rem;
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 0.98rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.btn-primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 10px 30px rgba(124, 108, 255, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 40px rgba(124, 108, 255, 0.5);
}

.btn-ghost {
    border-color: var(--border-strong);
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
}

.btn-ghost:hover {
    border-color: var(--accent);
    background: rgba(124, 108, 255, 0.1);
    transform: translateY(-2px);
}

.btn-block { width: 100%; }

.btn i { font-size: 0.85em; }

/* ---------- Hero ---------- */
.hero {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    padding: calc(var(--nav-h) + 3rem) 0 4rem;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
    gap: 3.5rem;
}

.hero-eyebrow {
    color: var(--accent-2);
    font-size: 1rem;
    margin-bottom: 1.1rem;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.6rem, 6vw, 4.4rem);
    font-weight: 700;
    line-height: 1.06;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.hero-role {
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 2.6vw, 1.8rem);
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 1.4rem;
    min-height: 1.5em;
}

.typewriter { color: var(--text); }

.type-caret {
    display: inline-block;
    width: 3px;
    height: 1.05em;
    margin-left: 4px;
    vertical-align: text-bottom;
    background: var(--accent-2);
    animation: blink 1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.hero-desc {
    max-width: 54ch;
    color: var(--text-dim);
    font-size: 1.06rem;
    margin-bottom: 2.2rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2.2rem;
}

.hero-socials {
    display: flex;
    gap: 1.1rem;
}

.hero-socials a {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 1.1rem;
    text-decoration: none;
    transition: color 0.25s ease, border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.hero-socials a:hover {
    color: var(--accent-2);
    border-color: var(--accent-2);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(56, 217, 245, 0.18);
}

/* Terminal card */
.hero-visual { display: flex; justify-content: center; }

.terminal-card {
    width: 100%;
    max-width: 460px;
    background: rgba(16, 19, 29, 0.85);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), var(--shadow-glow);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: card-float 7s ease-in-out infinite;
}

@keyframes card-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--border);
}

.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }

.terminal-title {
    margin-left: 0.6rem;
    font-size: 0.78rem;
    color: var(--text-faint);
}

.terminal-body {
    padding: 1.3rem 1.4rem 1.5rem;
    font-size: 0.88rem;
    line-height: 1.9;
}

.t-prompt { color: var(--accent-2); margin-right: 0.5rem; }
.t-out { color: var(--text-dim); padding-left: 1.1rem; }
.t-accent { color: #4dd97c; }

.t-cursor {
    display: inline-block;
    width: 9px;
    height: 1.05em;
    vertical-align: text-bottom;
    background: var(--text);
    animation: blink 1s step-end infinite;
}

/* Scroll hint */
.scroll-hint {
    position: absolute;
    left: 50%;
    bottom: 1.8rem;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-faint);
    text-decoration: none;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    transition: color 0.25s ease;
}

.scroll-hint:hover { color: var(--accent-2); }

.scroll-hint i { animation: bob 1.8s ease-in-out infinite; }

@keyframes bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* ---------- Sections ---------- */
.section { padding: 6.5rem 0; }

.section-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.section-num {
    color: var(--accent-2);
    font-size: 1.1rem;
    font-weight: 500;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3.4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.section-line {
    flex: 1;
    max-width: 340px;
    height: 1px;
    background: linear-gradient(90deg, var(--border-strong), transparent);
}

/* ---------- About ---------- */
.about-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 3.5rem;
    align-items: start;
}

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

.about-text strong { color: var(--text); font-weight: 600; }

.about-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 2.2rem;
}

.stat {
    padding: 1.3rem 1rem;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: transform 0.25s ease, border-color 0.25s ease;
}

.stat:hover { transform: translateY(-4px); border-color: var(--accent); }

.stat-value {
    display: block;
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1.15;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-faint);
}

/* Skills panel */
.skills-panel {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    padding: 1.8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.skill-group-title {
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-2);
    margin-bottom: 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.chip {
    padding: 0.35rem 0.85rem;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-dim);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    cursor: default;
}

.chip:hover {
    color: var(--text);
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* ---------- Projects ---------- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.4rem;
}

.project-card {
    display: flex;
    flex-direction: column;
    padding: 1.7rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-6px);
    border-color: rgba(124, 108, 255, 0.45);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), var(--shadow-glow);
}

.project-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.project-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    font-size: 1.35rem;
    border-radius: 13px;
    color: var(--pi, var(--accent-2));
    background: color-mix(in srgb, var(--pi, var(--accent-2)) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--pi, var(--accent-2)) 30%, transparent);
}

.project-links { display: flex; gap: 0.7rem; }

.project-links a {
    color: var(--text-faint);
    font-size: 1.25rem;
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

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

.project-name {
    font-family: var(--font-display);
    font-size: 1.22rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.project-desc {
    color: var(--text-dim);
    font-size: 0.94rem;
    flex: 1;
    margin-bottom: 1.2rem;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1rem;
    list-style: none;
}

.project-tech li {
    font-size: 0.76rem;
    color: var(--accent-2);
    opacity: 0.85;
}

/* Mini project cards */
.more-projects { margin-top: 3.5rem; }

.more-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 1.3rem;
}

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

.mini-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.05rem 1.2rem;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.mini-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    background: var(--surface);
}

.mini-card > i:first-child {
    font-size: 1.15rem;
    color: var(--accent-2);
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.mini-card div { flex: 1; min-width: 0; }

.mini-card strong {
    display: block;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
}

.mini-card span {
    display: block;
    color: var(--text-faint);
    font-size: 0.8rem;
    line-height: 1.45;
}

.mini-ext {
    font-size: 0.75rem;
    color: var(--text-faint);
    transition: color 0.2s ease;
}

.mini-card:hover .mini-ext { color: var(--accent-2); }

/* ---------- Certifications ---------- */
.cert-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.4rem;
}

.cert-card {
    display: flex;
    gap: 1.3rem;
    padding: 1.7rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.cert-card:hover { transform: translateY(-4px); border-color: rgba(56, 217, 245, 0.45); }

.cert-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    flex-shrink: 0;
    font-size: 1.4rem;
    border-radius: 13px;
    background: rgba(124, 108, 255, 0.12);
    border: 1px solid rgba(124, 108, 255, 0.3);
    color: var(--accent);
}

.cert-body h3 {
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.cert-provider {
    font-size: 0.78rem;
    color: var(--accent-2);
    margin-bottom: 0.55rem;
}

.cert-body p:last-child {
    color: var(--text-dim);
    font-size: 0.92rem;
}

/* ---------- Contact ---------- */
.section-contact { padding-bottom: 7rem; }

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.05fr;
    gap: 3.5rem;
    align-items: start;
}

.contact-copy h3 {
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 3.4vw, 2.3rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.1rem;
}

.contact-copy > p {
    color: var(--text-dim);
    margin-bottom: 1.8rem;
    max-width: 46ch;
}

.contact-list { list-style: none; display: flex; flex-direction: column; gap: 0.9rem; }

.contact-list li {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    color: var(--text-dim);
    font-size: 0.97rem;
}

.contact-list i {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--accent-2);
    font-size: 0.95rem;
}

.contact-list a {
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.2s ease;
}

.contact-list a:hover { color: var(--accent-2); }

/* Form */
.contact-form {
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.1rem;
}

.form-field { margin-bottom: 1.1rem; }

.form-field label {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 0.45rem;
}

.form-field input,
.form-field textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    resize: vertical;
}

.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--text-faint); }

.form-field input:focus,
.form-field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.18);
}

.form-status {
    margin-top: 0.9rem;
    font-size: 0.85rem;
    text-align: center;
    min-height: 1.3em;
}

.form-status.ok { color: #4dd97c; }
.form-status.err { color: #ff6b7d; }

/* ---------- Footer ---------- */
.footer {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    background: rgba(11, 13, 20, 0.6);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-faint);
}

/* ---------- Reveal animations ---------- */
.reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.7s ease, transform 0.7s ease;
    transition-delay: var(--reveal-delay, 0s);
}

.reveal.revealed { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .hero-grid { grid-template-columns: 1fr; gap: 3rem; }
    .hero-visual { order: 2; }
    .about-grid, .contact-grid { grid-template-columns: 1fr; gap: 2.5rem; }
    .projects-grid, .mini-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
    .nav-menu {
        position: fixed;
        top: var(--nav-h);
        right: 0;
        width: min(320px, 78vw);
        height: calc(100dvh - var(--nav-h));
        flex-direction: column;
        align-items: flex-start;
        gap: 1.6rem;
        padding: 2.2rem 2rem;
        background: rgba(16, 19, 29, 0.97);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-left: 1px solid var(--border);
        transform: translateX(100%);
        transition: transform 0.35s ease;
    }

    .nav-menu.open { transform: translateX(0); }
    .nav-toggle { display: flex; }
    .nav-link { font-size: 1.05rem; }

    .projects-grid, .mini-grid, .cert-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .about-stats { grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
    .stat { padding: 1rem 0.5rem; }
    .stat-value { font-size: 1.6rem; }
    .section { padding: 4.5rem 0; }
    .section-line { max-width: none; }
    .section-title { white-space: normal; }
    .scroll-hint { display: none; }
    .footer-inner { justify-content: center; text-align: center; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .bg-orb, .terminal-card, .scroll-hint i, .type-caret, .t-cursor { animation: none; }
    .reveal { opacity: 1; transform: none; transition: none; }
    * { transition-duration: 0.01ms !important; }
}
