/* ============================================
   CSS Custom Properties (Variables)
   ============================================ */
:root {
    /* Colors - Light Mode */
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-surface: #f0f0f0;
    --bg-hover: #e8e8e8;

    --text-primary: #1a1a2e;
    --text-secondary: #4a4a5a;
    --text-muted: #7a7a8a;

    --accent: #0d9488;
    --accent-light: #14b8a6;
    --accent-dim: rgba(13, 148, 136, 0.1);
    --accent-glow: rgba(13, 148, 136, 0.25);

    /* Grid pattern - more visible */
    --grid-color: rgba(0, 0, 0, 0.08);
    --grid-dot-color: rgba(0, 0, 0, 0.15);
    --grid-size: 40px;

    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing - DOUBLED content width */
    --sidebar-width: 200px;
    --content-max-width: 1000px;
    --section-gap: 80px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-surface) var(--bg-primary);
}

body {
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom scrollbar for webkit */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-surface);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-hover);
}

/* ============================================
   Cursor Glow Effect
   ============================================ */
.cursor-glow {
    position: fixed;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(
        circle,
        var(--accent-glow) 0%,
        rgba(13, 148, 136, 0.08) 40%,
        transparent 70%
    );
    transform: translate(-50%, -50%);
    z-index: 1;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    will-change: transform, opacity, left, top;
}

body:hover .cursor-glow {
    opacity: 1;
}

/* When clicking - glow shrinks and fades (energy transfer) */
.cursor-glow.clicking {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
    transition: opacity 0.2s ease-out, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When recovering after click */
.cursor-glow.recovering {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    transition: opacity 0.5s ease-out, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* When hovering over logo - glow fades */
.cursor-glow.logo-hover {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* When hovering over projects/experiences - glow shrinks like clicking */
.cursor-glow.item-hover {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
    transition: opacity 0.3s ease-out, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Background Grid Pattern
   ============================================ */
.grid-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;

    /* Combined dot and line grid pattern */
    background-image:
        /* Dots at intersections */
        radial-gradient(circle, var(--grid-dot-color) 1.5px, transparent 1.5px),
        /* Vertical lines */
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px),
        /* Horizontal lines */
        linear-gradient(0deg, var(--grid-color) 1px, transparent 1px);

    background-size:
        var(--grid-size) var(--grid-size),
        var(--grid-size) var(--grid-size),
        var(--grid-size) var(--grid-size);

    background-position: 0 0, 0 0, 0 0;
}

/* ============================================
   Layout Structure
   ============================================ */
.layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 2;
}

/* ============================================
   Main Content Area
   ============================================ */
.content {
    flex: 1;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 100px 60px;
    padding-right: calc(var(--sidebar-width) + 100px);
}

.section {
    margin-bottom: var(--section-gap);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.section:nth-child(1) { animation-delay: 0.1s; }
.section:nth-child(2) { animation-delay: 0.2s; }
.section:nth-child(3) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 32px;
    text-transform: uppercase;
}

/* ============================================
   Hero / About Section
   ============================================ */
.hero-title {
    font-size: 56px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 32px;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.8;
}

.hero-text {
    font-size: 17px;
    color: var(--text-muted);
    line-height: 1.8;
}

/* ============================================
   Projects Section - NO BORDERS
   ============================================ */
.project-item {
    padding: 32px 0;
    padding-left: 0;
    transition: padding 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    position: relative;
}

.project-item:first-of-type {
    padding-top: 0;
}

.project-item:hover {
    padding-left: 20px;
}

.project-item:hover .project-title {
    color: var(--accent);
}

/* Energy received indicator */
.project-item.energy-received {
    background: linear-gradient(90deg, var(--accent-dim) 0%, transparent 100%);
}

.project-item.energy-received .project-title {
    color: var(--accent);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.project-title {
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
    transition: color var(--transition-fast);
}

.project-date {
    font-size: 15px;
    color: var(--text-muted);
}

.project-description {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.7;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    font-size: 13px;
    padding: 5px 12px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-radius: 4px;
    transition: var(--transition-fast);
}

.project-item:hover .tag {
    background: var(--accent-dim);
    color: var(--accent);
}

/* ============================================
   Experience Section - NO BORDERS
   ============================================ */
.experience-item {
    padding: 32px 0;
    padding-left: 0;
    transition: padding 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.experience-item:first-of-type {
    padding-top: 0;
}

.experience-item:hover {
    padding-left: 20px;
}

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

/* Experience header with logo inline */
.experience-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.experience-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Company logo - inline with title */
.experience-logo {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.experience-title {
    font-size: 22px;
    font-weight: 500;
    color: var(--text-primary);
    transition: color var(--transition-fast);
}

.experience-date {
    font-size: 15px;
    color: var(--text-muted);
}

.experience-company {
    font-size: 15px;
    color: var(--accent);
    margin-bottom: 12px;
}

.experience-description {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ============================================
   Sidebar Navigation
   ============================================ */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    padding: 100px 40px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    background: linear-gradient(90deg, transparent 0%, var(--bg-primary) 20%);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Logo with wave breathing animation */
.logo {
    margin-bottom: 48px;
}

.logo-text {
    display: inline-flex;
    padding: 8px 14px;
    cursor: default;
}

.logo-char {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    display: inline-block;
    transform: scale(1);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Wave breathing animation on hover - one after the other */
.logo-text:hover .logo-char {
    animation: waveBreath 2.4s ease-in-out infinite;
}

/* Stagger creates the wave effect - second char starts when first peaks */
.logo-char:nth-child(1) {
    animation-delay: 0s;
}

.logo-char:nth-child(2) {
    animation-delay: 1.2s;
}

@keyframes waveBreath {
    0% {
        transform: scale(1);
    }
    20% {
        transform: scale(1.18);
    }
    40% {
        transform: scale(1);
    }
    100% {
        transform: scale(1);
    }
}

/* Navigation Links */
.nav-links {
    list-style: none;
    margin-bottom: 32px;
}

.nav-links li {
    margin-bottom: 10px;
}

.nav-link {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
    position: relative;
    display: inline-block;
}

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

.nav-link.active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 2px;
    background: var(--accent);
}

/* Energy received on nav links */
.nav-link.energy-received {
    color: var(--accent);
}

/* Divider */
.nav-divider {
    width: 24px;
    height: 1px;
    background: var(--bg-surface);
    margin-bottom: 24px;
}

/* Contact Label */
.nav-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 16px;
    text-transform: uppercase;
}

/* Social Links */
.social-links {
    list-style: none;
}

.social-links li {
    margin-bottom: 10px;
}

.social-link {
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-fast);
}

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

.social-link.energy-received {
    color: var(--accent);
}

/* ============================================
   Project Article Page Styles
   ============================================ */
.article-page {
    min-height: 100vh;
}

.article-page .content {
    max-width: var(--content-max-width);
    padding: 100px 60px;
    padding-right: calc(var(--sidebar-width) + 100px);
}

.article-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 48px;
    transition: var(--transition-fast);
}

.article-back:hover {
    color: var(--accent);
}

.article-back svg {
    width: 16px;
    height: 16px;
}

.article-header {
    margin-bottom: 48px;
}

.article-label {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 16px;
    display: block;
}

.article-title {
    font-size: 48px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.article-meta {
    display: flex;
    gap: 24px;
    color: var(--text-muted);
    font-size: 15px;
    flex-wrap: wrap;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-content {
    padding-bottom: 80px;
}

.article-content h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 56px 0 24px;
    letter-spacing: -0.01em;
}

.article-content h2:first-child {
    margin-top: 0;
}

.article-content h3 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 40px 0 16px;
}

.article-content p {
    font-size: 18px;
    line-height: 1.9;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.article-content ul,
.article-content ol {
    margin: 24px 0;
    padding-left: 32px;
    color: var(--text-secondary);
}

.article-content li {
    margin-bottom: 12px;
    line-height: 1.8;
    font-size: 18px;
}

.article-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 24px;
    margin: 32px 0;
    font-style: italic;
    color: var(--text-secondary);
}

.article-content code {
    background: var(--bg-surface);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 16px;
}

.article-content pre {
    background: var(--bg-surface);
    padding: 28px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 32px 0;
}

.article-content pre code {
    background: none;
    padding: 0;
    font-size: 15px;
    line-height: 1.6;
}

.article-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 40px 0;
}

.article-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: var(--transition-fast);
}

.article-content a:hover {
    border-bottom-color: var(--accent);
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--bg-surface);
}

.article-footer {
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--bg-surface);
}

.article-nav {
    display: flex;
    justify-content: space-between;
    gap: 24px;
}

.article-nav a {
    font-size: 15px;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-fast);
}

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

/* Article page responsive */
@media (max-width: 1100px) {
    .article-page .content {
        padding: 80px 50px;
        padding-right: calc(var(--sidebar-width) + 60px);
    }
}

@media (max-width: 700px) {
    .article-page .content {
        padding: 50px 24px;
        padding-right: 24px;
    }

    .article-title {
        font-size: 32px;
    }

    .article-content h2 {
        font-size: 24px;
        margin: 40px 0 18px;
    }

    .article-content p,
    .article-content li {
        font-size: 16px;
    }

    .article-back {
        margin-bottom: 32px;
    }
}

/* ============================================
   Responsive Design
   ============================================ */

/* Large screens */
@media (min-width: 1400px) {
    :root {
        --content-max-width: 1100px;
    }

    .content {
        padding: 120px 80px;
        padding-right: calc(var(--sidebar-width) + 120px);
    }

    .hero-title {
        font-size: 64px;
    }
}

/* Medium screens */
@media (max-width: 1100px) {
    :root {
        --content-max-width: 800px;
        --sidebar-width: 180px;
    }

    .content {
        padding: 80px 50px;
        padding-right: calc(var(--sidebar-width) + 60px);
    }

    .hero-title {
        font-size: 48px;
    }

    .sidebar {
        padding: 80px 30px;
    }
}

/* Tablet screens */
@media (max-width: 900px) {
    :root {
        --sidebar-width: 160px;
        --content-max-width: 100%;
    }

    .content {
        padding: 60px 40px;
        padding-right: calc(var(--sidebar-width) + 50px);
    }

    .hero-title {
        font-size: 40px;
    }

    .project-title {
        font-size: 20px;
    }

    .experience-title {
        font-size: 18px;
    }

    .sidebar {
        padding: 60px 24px;
    }

    .article-modal {
        width: 95%;
    }

    .article-header,
    .article-content {
        padding-left: 32px;
        padding-right: 32px;
    }
}

/* Mobile screens */
@media (max-width: 700px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        padding: 24px 30px;
        order: -1;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid var(--bg-surface);
        background: var(--bg-primary);
    }

    .sidebar-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    .logo {
        margin-bottom: 0;
    }

    .logo-text {
        padding: 6px 10px;
    }

    .logo-char {
        font-size: 22px;
    }

    .nav-links {
        display: flex;
        gap: 20px;
        margin-bottom: 0;
    }

    .nav-links li {
        margin-bottom: 0;
    }

    .nav-link {
        font-size: 14px;
    }

    .nav-link.active::before {
        display: none;
    }

    .nav-divider,
    .nav-label,
    .social-links {
        display: none;
    }

    .content {
        padding: 50px 24px;
        padding-right: 24px;
        max-width: 100%;
    }

    .hero-title {
        font-size: 36px;
        margin-bottom: 24px;
    }

    .hero-subtitle {
        font-size: 17px;
    }

    .section {
        margin-bottom: 80px;
    }

    .section-label {
        margin-bottom: 24px;
    }

    .project-item,
    .experience-item {
        padding: 24px 0;
    }

    .project-header,
    .experience-header {
        flex-direction: column;
        gap: 4px;
    }

    .project-title {
        font-size: 20px;
    }

    .experience-title {
        font-size: 18px;
    }

    .article-modal {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .article-header {
        padding: 28px 24px 20px;
    }

    .article-content {
        padding: 28px 24px;
    }

    .article-title {
        font-size: 26px;
    }

    .article-content p,
    .article-content li {
        font-size: 16px;
    }
}

/* Small mobile screens */
@media (max-width: 480px) {
    .content {
        padding: 40px 20px;
    }

    .hero-title {
        font-size: 30px;
    }

    .nav-links {
        gap: 14px;
    }

    .nav-link {
        font-size: 13px;
    }

    .project-title {
        font-size: 18px;
    }

    .tag {
        font-size: 12px;
        padding: 4px 10px;
    }
}

/* ============================================
   Selection Styles
   ============================================ */
::selection {
    background: var(--accent-dim);
    color: var(--accent);
}

/* ============================================
   Focus Styles (Accessibility)
   ============================================ */
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ============================================
   Smooth Scroll Indicator (optional)
   ============================================ */
.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    background: var(--accent);
    z-index: 1000;
    transition: width 0.1s ease-out;
}
