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

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --accent-purple: #e0e0e0;
    --accent-orange: #ffffff;
    --accent-pink: #d0d0d0;
    --card-bg: rgba(20, 20, 20, 0.85);
    --card-border: rgba(200, 200, 200, 0.3);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Performance optimizations */
* {
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    -ms-backface-visibility: hidden;
    backface-visibility: hidden;
}

.card, .navbar-side-right, .controls-panel {
    will-change: transform;
}

#gravitationalGrid {
    position: fixed;
    z-index: 0;
    transition: opacity 0.5s ease;
    /* Width, height, top, and left are set dynamically by JavaScript */
}

/* Navigation Bar - Side Floating Right */
.navbar-side-right {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(200, 200, 200, 0.3);
    border-radius: 30px;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.navbar-side-right .nav-link {
    color: rgba(180, 180, 180, 0.8);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 10px;
    border-radius: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.navbar-side-right .nav-link .icon {
    font-size: 1.5rem;
}

.navbar-side-right .nav-link .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.navbar-side-right .nav-link::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(200, 200, 200, 0.6));
    transition: height 0.3s ease;
    border-radius: 2px;
}

.navbar-side-right .nav-link:hover::after,
.navbar-side-right .nav-link.active::after {
    height: 60%;
}

.navbar-side-right .nav-link:hover {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-5px);
}

.navbar-side-right .nav-link.active {
    color: rgba(255, 255, 255, 1);
    background: rgba(255, 255, 255, 0.15);
}

/* Controls Panel */
.controls-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.controls-toggle {
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(200, 200, 200, 0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(200, 200, 200, 0.9);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.controls-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 5px 20px rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.controls-content {
    position: absolute;
    top: 60px;
    right: 0;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(200, 200, 200, 0.3);
    border-radius: 15px;
    padding: 20px;
    min-width: 280px;
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.controls-panel.active .controls-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.controls-content h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--accent-orange);
    text-align: center;
}

.control-group {
    margin-bottom: 20px;
}

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

.control-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-group .value {
    color: var(--accent-purple);
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

/* Toggle Switch */
.toggle-label {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0 !important;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: rgba(100, 100, 100, 0.3);
    border-radius: 13px;
    transition: background 0.3s ease;
    border: 1px solid rgba(200, 200, 200, 0.2);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: rgba(150, 150, 150, 0.8);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-label input[type="checkbox"]:checked + .toggle-switch {
    background: rgba(200, 200, 200, 0.3);
}

.toggle-label input[type="checkbox"]:checked + .toggle-switch::after {
    transform: translateX(24px);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.toggle-label:hover .toggle-switch::after {
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(200, 200, 200, 0.2);
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: rgba(200, 200, 200, 0.9);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: rgba(200, 200, 200, 0.9);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.control-group input[type="range"]::-moz-range-thumb:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 40px;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero-content {
    padding: 50px;
    border-radius: 20px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    box-shadow: 0 20px 60px rgba(157, 123, 232, 0.2);
}

.profile-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 20px;
    border: 3px solid var(--accent-purple);
    box-shadow: 0 10px 30px rgba(157, 123, 232, 0.3);
}

h1 {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg,
        #ffffff 0%,
        #e8e8e8 25%,
        #ffffff 50%,
        #d0d0d0 75%,
        #c0c0c0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.2));
    line-height: 1.2;
}

.subtitle {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 300;
}

.hero-links {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.link-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(157, 123, 232, 0.1);
    border: 1px solid var(--accent-purple);
    border-radius: 50px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.link-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(157, 123, 232, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.link-button:hover::before {
    width: 300px;
    height: 300px;
}

.link-button:hover {
    border-color: var(--accent-orange);
    box-shadow: 0 5px 20px rgba(157, 123, 232, 0.4);
    transform: translateY(-2px);
}

.link-button svg {
    position: relative;
    z-index: 1;
}

/* Sections */
.section {
    margin: 120px 0;
}

.section-tag {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--accent-pink);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 20px;
    font-weight: 600;
}

/* Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid var(--card-border);
    padding: 40px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    position: relative;
}

.card:last-child {
    margin-bottom: 0;
}

.card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-orange));
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.card:hover::before {
    opacity: 0.15;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 60px rgba(157, 123, 232, 0.3);
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    line-height: 1.3;
}

h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: var(--accent-purple);
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.8;
}

p:last-child {
    margin-bottom: 0;
}

/* Education */
.education-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 15px;
}

.degree {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.education-meta {
    text-align: right;
    flex-shrink: 0;
}

.date {
    color: var(--accent-orange);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.location {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.honors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(157, 123, 232, 0.2);
}

.honor-badge {
    padding: 6px 14px;
    background: rgba(255, 120, 50, 0.15);
    border: 1px solid var(--accent-orange);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--accent-orange);
    font-weight: 500;
}

.courses {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(157, 123, 232, 0.2);
}

.courses-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Experience */
.experience-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
}

.experience-meta {
    text-align: right;
    flex-shrink: 0;
}

.company {
    color: var(--accent-orange);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.experience-list {
    list-style: none;
    margin-top: 15px;
}

.experience-list li {
    padding-left: 25px;
    margin-bottom: 12px;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.7;
}

.experience-list li:last-child {
    margin-bottom: 0;
}

.experience-list li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--accent-purple);
    font-weight: bold;
    font-size: 1.2rem;
}

.experience-list strong {
    color: var(--accent-orange);
    font-weight: 600;
}

/* Projects */
.project-card {
    padding: 0;
    overflow: hidden;
}

.project-media {
    width: 100%;
    margin-bottom: 0;
}

.project-media img {
    width: 100%;
}

.project-media iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
}

.project-media img {
    width: 100%;
    height: auto;
    display: block;
}

.video-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, rgba(157, 123, 232, 0.2), rgba(255, 120, 50, 0.2));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
    border-bottom: 1px solid var(--card-border);
    gap: 10px;
}

.media-icon {
    font-size: 3rem;
}

.media-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.project-content {
    padding: 35px 40px;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 15px;
}

.project-header h3 {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.github-link {
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
    transition: color 0.3s ease, transform 0.3s ease;
}

.github-link:hover {
    color: var(--accent-purple);
    transform: scale(1.1);
}

.github-link svg {
    width: 20px;
    height: 20px;
}

.project-header .date {
    text-align: right;
    flex-shrink: 0;
}

.project-description {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 15px;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.tech-tag {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(157, 123, 232, 0.15);
    border: 1px solid var(--accent-purple);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--accent-purple);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tech-tag:hover {
    background: rgba(157, 123, 232, 0.25);
    box-shadow: 0 3px 10px rgba(157, 123, 232, 0.3);
    transform: translateY(-2px);
}

/* Footer */
.footer {
    text-align: center;
    padding: 60px 0;
    margin-top: 120px;
    border-top: 1px solid var(--card-border);
    color: var(--text-secondary);
}

.footer p {
    margin-bottom: 10px;
}

.footer-note {
    font-size: 0.9rem;
    color: var(--accent-purple);
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }

    .controls-panel {
        top: 10px;
        right: 10px;
    }

    .controls-toggle {
        width: 45px;
        height: 45px;
    }

    .controls-content {
        min-width: 250px;
    }

    h1 {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    h2 {
        font-size: 1.6rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    .hero-content {
        padding: 35px 25px;
    }

    .hero-links {
        flex-direction: column;
        align-items: stretch;
    }

    .link-button {
        justify-content: center;
    }

    .card {
        padding: 30px 25px;
    }

    .section {
        margin: 80px 0;
    }

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

    .education-meta,
    .experience-meta,
    .project-header .date {
        text-align: left;
    }

    .project-content {
        padding: 25px;
    }

    .footer {
        margin-top: 80px;
        padding: 40px 0;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .card {
        padding: 25px 20px;
    }

    .hero-content {
        padding: 30px 20px;
    }

    .section-tag {
        font-size: 0.75rem;
        letter-spacing: 2px;
    }
}

/* Selection color */
::selection {
    background: rgba(200, 200, 200, 0.3);
    color: var(--text-primary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(150, 150, 150, 0.6);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(200, 200, 200, 0.8);
}

/* Astrophotography Page Styles */
.astro-card {
    padding: 0;
    margin-bottom: 30px;
}

.astro-image {
    width: 100%;
    padding: 20px;
}

.astro-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}

.image-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, rgba(100, 100, 100, 0.2), rgba(150, 150, 150, 0.2));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--card-border);
    gap: 10px;
}

.astro-info {
    padding: 30px;
}

.astro-info h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
}

.astro-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(200, 200, 200, 0.05);
    border-radius: 10px;
    border-left: 3px solid rgba(200, 200, 200, 0.5);
}

.detail-item {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.detail-item strong {
    color: var(--text-primary);
    margin-right: 5px;
}

.astro-description {
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Earlier experiences toggle */
.earlier-experiences-toggle {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0;
}

.toggle-earlier-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.7);
    font-family: inherit;
    font-size: 0.85rem;
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.toggle-earlier-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.35);
}

.earlier-experiences-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Mobile responsive for navbar */
@media (max-width: 768px) {
    .navbar-side-right {
        right: 10px;
        padding: 15px 10px;
        gap: 15px;
    }

    .navbar-side-right .nav-link {
        padding: 10px 8px;
    }

    .navbar-side-right .nav-link .icon {
        font-size: 1.3rem;
    }

    .navbar-side-right .nav-link .label {
        font-size: 0.65rem;
    }
}

/* Linked Subpages */
.link-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.link-card {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    padding: 30px;
    text-decoration: none;
    color: inherit;
}

.link-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.link-card-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.link-card-header h3 {
    margin-bottom: 0;
    flex: 1;
}

.link-card-arrow {
    display: inline-block;
    color: var(--text-secondary);
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.link-card:hover .link-card-arrow {
    color: var(--accent-orange);
    transform: translate(3px, -3px);
}

.link-card-description {
    font-size: 0.95rem;
}

.link-card .tech-stack {
    margin-top: auto;
    padding-top: 20px;
}

@media (max-width: 768px) {
    .link-cards {
        grid-template-columns: 1fr;
    }

    .link-card {
        padding: 25px;
    }
}
