/* ===========================
   Rikhil Nellimarla — Portfolio
   =========================== */

/* --- Custom Properties --- */
:root {
    --bg: #0c0c0f;
    --bg-card: #141419;
    --bg-card-hover: #1c1c24;
    --border: #1e1e2a;
    --border-hover: #2e2e40;
    --text: #e2e2e6;
    --text-secondary: #73738a;
    --text-muted: #44445a;
    --accent: #5d8fec;
    --accent-hover: #7daaf5;
    --accent-glow: rgba(93, 143, 236, 0.1);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --max-width: 880px;
    --section-gap: 4.5rem;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 15px;
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

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

img {
    max-width: 100%;
    display: block;
}

/* --- Layout --- */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

section {
    padding: var(--section-gap) 0;
}

/* --- Navigation --- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(12, 12, 15, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.nav-logo {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    letter-spacing: -0.02em;
}

.nav-logo:hover {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
    position: relative;
    padding-bottom: 2px;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s;
}

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

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
}

/* --- Hero --- */
.hero {
    padding-top: 8rem;
    padding-bottom: 3rem;
}

.hero h1 {
    font-family: var(--font-mono);
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.hero .tagline {
    font-family: var(--font-mono);
    font-size: clamp(0.9rem, 2vw, 1.05rem);
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.hero .tagline .prefix {
    color: var(--accent);
    margin-right: 0.3rem;
}

.hero .about-brief {
    max-width: 560px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.hero-links {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}

.hero-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    padding: 0.4rem 0;
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.hero-links a:hover {
    color: var(--text);
    border-bottom-color: var(--accent);
}

.hero-links a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* --- Section Titles --- */
.section-title {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.section-title .prefix {
    color: var(--accent);
    margin-right: 0.5rem;
    user-select: none;
}

/* --- Experience --- */
.experience-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.experience-item {
    padding: 1.25rem 0 1.25rem 1.5rem;
    border-left: 2px solid var(--border);
    transition: border-color 0.3s;
    position: relative;
}

.experience-item:hover {
    border-left-color: var(--accent);
}

.experience-item:last-child {
    padding-bottom: 0;
}

.experience-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.experience-header h3 {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
}

.experience-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.experience-role {
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.experience-location {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.experience-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

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

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    transition: border-color 0.3s, transform 0.2s;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    color: inherit;
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.project-card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-sans);
}

.project-card-header svg {
    color: var(--text-muted);
    flex-shrink: 0;
    margin-top: 2px;
    transition: color 0.2s;
}

.project-card:hover .project-card-header svg {
    color: var(--accent);
}

.project-card .badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
    background: var(--accent-glow);
    color: var(--accent);
    margin-bottom: 0.75rem;
    width: fit-content;
}

.project-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
    margin-bottom: 1rem;
}

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

.project-tags span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* Other projects list */
.other-projects-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-transform: lowercase;
}

.other-projects {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.other-projects li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-left: 1rem;
    position: relative;
}

.other-projects li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

.other-projects li strong {
    color: var(--text);
    font-weight: 500;
}

.other-projects li .tech {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- Skills --- */
.skills-group {
    margin-bottom: 1.5rem;
}

.skills-group:last-child {
    margin-bottom: 0;
}

.skills-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: lowercase;
}

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

.skills-tags span {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.65rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    transition: border-color 0.2s, color 0.2s;
}

.skills-tags span:hover {
    border-color: var(--accent);
    color: var(--text);
}

/* --- Achievements --- */
.achievements-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.achievements-list li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-left: 1.25rem;
    position: relative;
    line-height: 1.6;
}

.achievements-list li::before {
    content: '·';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
    font-size: 1.2rem;
    line-height: 1.4;
}

.achievements-list li strong {
    color: var(--text);
    font-weight: 500;
}

/* --- Blog Teaser --- */
.latest-posts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.post-card {
    display: block;
    padding: 1.25rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.3s, transform 0.2s;
}

.post-card:hover {
    border-color: var(--accent);
    transform: translateX(4px);
    color: inherit;
}

.post-card time {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.post-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.3rem 0;
    color: var(--text);
}

.post-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.blog-link {
    margin-top: 1.5rem;
}

.blog-link a {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.blog-link a:hover {
    color: var(--accent);
}

/* --- Footer --- */
.footer {
    padding: 3rem 0;
    border-top: 1px solid var(--border);
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-text {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 1.25rem;
}

.footer-links a {
    color: var(--text-muted);
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-links a svg {
    width: 18px;
    height: 18px;
}

/* --- Animations --- */
.animate-in {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

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

/* stagger children */
.animate-in:nth-child(2) {
    transition-delay: 0.05s;
}

.animate-in:nth-child(3) {
    transition-delay: 0.1s;
}

.animate-in:nth-child(4) {
    transition-delay: 0.15s;
}

.animate-in:nth-child(5) {
    transition-delay: 0.2s;
}

.animate-in:nth-child(6) {
    transition-delay: 0.25s;
}

/* --- Blog Page Styles --- */
.blog-header {
    padding-top: 8rem;
    padding-bottom: 2rem;
}

.blog-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.blog-list-item {
    display: flex;
    gap: 1.5rem;
    align-items: baseline;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: padding-left 0.2s;
}

.blog-list-item:first-child {
    border-top: 1px solid var(--border);
}

.blog-list-item:hover {
    padding-left: 0.5rem;
    color: inherit;
}

.blog-list-item time {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 90px;
}

.blog-list-item .list-item-content h3 {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.2rem;
}

.blog-list-item:hover h3 {
    color: var(--accent);
}

.blog-list-item .list-item-content p {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Post rendered content */
.post-meta {
    margin-bottom: 3rem;
}

.post-meta h1 {
    font-family: var(--font-mono);
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.post-meta time {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-meta .back-link {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: inline-block;
}

.post-meta .back-link:hover {
    color: var(--accent);
}

.post-content {
    max-width: 700px;
}

.post-content h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
}

.post-content h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
}

.post-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.5rem;
}

.post-content p {
    margin-bottom: 1.25rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.post-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

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

.post-content code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    color: var(--accent);
}

.post-content pre {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.post-content pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    color: var(--text);
}

.post-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.post-content ul,
.post-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
    color: var(--text-secondary);
}

.post-content li {
    margin-bottom: 0.4rem;
    line-height: 1.7;
}

.post-content img {
    border-radius: 8px;
    margin: 1.5rem 0;
}

.post-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

/* empty blog state */
.blog-empty {
    padding: 3rem 0;
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    :root {
        --section-gap: 5rem;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: rgba(12, 12, 15, 0.95);
        backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 1.5rem;
        gap: 1rem;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }

    .hero {
        padding-top: 7rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .experience-header {
        flex-direction: column;
        gap: 0.15rem;
    }

    .blog-list-item {
        flex-direction: column;
        gap: 0.25rem;
    }

    .footer .container {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    section {
        padding: 4rem 0;
    }
}