@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');

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

:root {
    --bg-color: #f5f5f5;
    --text-color: #1a1a1a;
    --accent-color: #0052cc;
    --border-color: #e0e0e0;
    --hover-bg: #e8e8e8;
    --card-bg: #ffffff;
    
    /* Font size variables - control both Latin and Devanagari */
    --nav-font-size: 1.7rem ;
    --title-font-size: 1.8rem;
    --content-font-size: 1rem;
}

[data-theme="dark"] {
    --bg-color: #0f0f0f;
    --text-color: #e0e0e0;
    --accent-color: #ff9500;
    --border-color: #2a2a2a;
    --hover-bg: #1a1a1a;
    --card-bg: #1a1a1a;
}

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.7;
    color: var(--text-color);
    background: var(--bg-color);
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem 1.5rem;
    font-size: 17px;
    transition: background 0.5s ease, color 0.5s ease;
}

/* Sky Header - Full Width */
header {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    margin-bottom: 3rem;
    padding: 0;
    height: 225px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    
    transition: border-color 0.5s ease;
}

/* Background image layer that animates */
header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    
    /* Light mode with daytime sky image */
    background-image: url('/images/PlaeBDot.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    /* Rise animation */
    animation: backgroundRise 1.5s ease-out;
    transition: opacity 0.8s ease;
}

/* Optional: Add a subtle dark overlay for better text readability */
header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.3) 100%);
    z-index: 0;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.8s ease;
}

[data-theme="dark"] header::before {
    opacity: 0;
}

@keyframes backgroundRise {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Trigger animation on theme change */
header.theme-changing::after {
    animation: backgroundRise 1s ease-out;
}

[data-theme="dark"] header::after {
    /* Night sky with your image */
    background-image: url('/images/background1.jpeg');
}

[data-theme="dark"] header {
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

/* Header content wrapper - keeps content centered */
header > div {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    position: relative;
    z-index: 1;
    height: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 100%;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    color: white;
}

.tagline {
    color: white;
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.profile-pic {
    width: 200px;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.profile-pic:hover {
    transform: scale(1.05);
}

/* Navigation and Theme Toggle Container */
.nav-theme-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    align-items: center;
    margin: 1.5rem 0 1rem 0;
}

/* Navigation - Improved Responsiveness */
nav {
    grid-column: span 4;
    display: contents;
}

nav ul {
    list-style: none;
    display: contents;
    align-items: center;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: var(--nav-font-size);
    letter-spacing: 0.5px;
    padding: 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    border-radius: 4px;
    height: 50px;
}

nav a:hover {
    border-bottom-color: var(--accent-color);
    background-color: var(--hover-bg);
}

nav a.active {
    border-bottom-color: var(--accent-color);
    background-color: var(--hover-bg);
}

/* Dark Mode Toggle - Engraved Colorless Button */
.theme-toggle {
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    justify-self: center;
    
    /* Engraved effect */
    box-shadow: 
        inset 2px 2px 4px rgba(0, 0, 0, 0.15),
        inset -2px -2px 4px rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .theme-toggle {
    box-shadow: 
        inset 2px 2px 4px rgba(0, 0, 0, 0.5),
        inset -2px -2px 4px rgba(255, 255, 255, 0.1);
}

.theme-toggle:hover {
    transform: scale(0.95);
}

.theme-toggle:active {
    transform: scale(0.9);
}

.theme-icon {
    width: 24px;
    height: 24px;
    position: relative;
}

/* Sun icon - colorless */
.theme-icon.sun {
    background: var(--text-color);
    border-radius: 50%;
    opacity: 0.6;
}

.theme-icon.sun::before,
.theme-icon.sun::after {
    content: '';
    position: absolute;
    background: var(--text-color);
    opacity: 0.6;
}

.theme-icon.sun::before {
    width: 2px;
    height: 30px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.theme-icon.sun::after {
    width: 30px;
    height: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Moon icon - colorless */
.theme-icon.moon {
    background: transparent;
    border-radius: 50%;
    position: relative;
    width: 22px;
    height: 22px;
    box-shadow: 
        inset -4px -2px 0 0 var(--text-color);
    opacity: 0.6;
}

/* Page transitions */
.page {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInSlow {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Page load animations */
.logo,
.tagline,
.profile-pic,
.nav-theme-container,
nav {
    animation: fadeInSlow 1.2s ease-out 0.3s both;
}

#about-page h1,
#about-page .about-text,
#about-page .current-quests,
#about-page .skills-section,
#about-page .contact-section {
    animation: fadeInSlow 1.2s ease-out 0.3s both;
}

#projects-page h2,
#projects-page .project-item,
#projects-page .current-quests {
    animation: fadeInSlow 1.2s ease-out 0.3s both;
}

#blog-page h2,
#blog-page .project-item {
    animation: fadeInSlow 1.2s ease-out 0.3s both;
}

#friends-page h2,
#friends-page p,
#friends-page .project-item {
    animation: fadeInSlow 1.2s ease-out 0.3s both;
}

footer {
    animation: fadeInSlow 1.2s ease-out 0.3s both;
}

/* Typography */
section {
    margin: 2rem 0; /* Reduced from 4rem to 2rem */
}

h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 900;
    line-height: 1.2;
}

h2 {
    font-size: var(--title-font-size);
    margin: 2rem 0 1.5rem;
    font-weight: 700;
}

h3 {
    font-size: 1.3rem;
    margin: 1.5rem 0 0.5rem;
    font-weight: 700;
}

p {
    margin-bottom: 1rem;
}

strong {
    font-weight: 700;
    display: inline;
    font-size: inherit; /* Ensure it inherits from parent, not override */
}

em {
    font-style: italic;
    color: #666;
}

[data-theme="dark"] em {
    color: #999;
}

/* Script Toggle Styles */

/* Content words (Aryan Vyapari, Mumbai) - instant toggle */
.script-toggle-content {
    font-family: 'Noto Sans Devanagari', 'Space Grotesk', sans-serif;
    cursor: pointer;
    font-size: var(--content-font-size);
}

.script-toggle-content.devanagari {
    font-family: 'Noto Sans Devanagari', 'Space Grotesk', sans-serif;
}

/* Page titles (PROJECTS, BLOG, FRIENDS) - fade toggle */
.script-toggle-title {
    font-family: 'Space Grotesk', 'Noto Sans Devanagari', sans-serif;
    cursor: pointer;
    transition: opacity 0.2s ease;
    font-size: var(--title-font-size);
}

.script-toggle-title.devanagari {
    font-family: 'Noto Sans Devanagari', 'Space Grotesk', sans-serif;
}

/* Nav links - automatic toggle */
.script-toggle-nav {
    font-family: 'Space Grotesk', 'Noto Sans Devanagari', sans-serif;
}

.script-toggle-nav.devanagari {
    font-family: 'Noto Sans Devanagari', 'Space Grotesk', sans-serif;
}

/* About section */
.about-text {
    font-size: 1.1rem;
    line-height: 1.8;
}

.about-text p {
    margin-bottom: 0;
}

.about-text a {
    color: var(--accent-color);
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.about-text a:hover {
    opacity: 0.7;
}

.about-text ul {
    list-style: none;
    padding-left: 0;
}

.about-text li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.about-text li::before {
    content: '•';
    position: absolute;
    left: 0;
    font-weight: bold;
    color: var(--accent-color);
}

/* Current Quests */
.current-quests {
    background: var(--hover-bg);
    padding: 2rem;
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    margin: 2rem 0;
    transition: background 0.5s ease;
}

.current-quests h3 {
    margin-top: 0;
    text-transform: uppercase;
    font-size: 1rem;
    letter-spacing: 1px;
}

.current-quests ul {
    list-style: none;
    padding-left: 0;
}

.current-quests li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.current-quests li::before {
    content: '→';
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* Projects */
.projects-grid {
    display: grid;
    gap: 2rem;
    margin: 2rem 0;
}

.project-item {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.5s ease;
}

.project-item:last-child {
    border-bottom: none;
}

.project-item h3 {
    margin-top: 0;
}

.project-item p {
    color: #555;
    line-height: 1.7;
}

[data-theme="dark"] .project-item p {
    color: #aaa;
}

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

/* Contact */
.contact-section {
    background: var(--hover-bg);
    padding: 2rem;
    border-radius: 8px;
    margin: 3rem 0;
    transition: background 0.5s ease;
}

.contact-section h2 {
    margin-top: 0;
    text-transform: uppercase;
    font-size: 1.5rem;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.contact-links a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: color 0.2s ease;
    display: inline-block;
}

.contact-links a:hover {
    color: var(--text-color);
    text-decoration: underline;
}

.friend-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.2s ease;
    display: inline-block;
    margin-top: 0.5rem;
}

.friend-link:hover {
    color: var(--text-color);
    text-decoration: underline;
}

/* Footer */
footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    transition: border-color 0.5s ease;
}

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

footer a:hover {
    opacity: 0.7;
    text-decoration: underline;
}

[data-theme="dark"] footer {
    color: #999;
}

/* Responsive Design - Improved */
@media (max-width: 768px) {
    :root {
        --nav-font-size: 1.4rem;
        --title-font-size: 1.5rem;
        --content-font-size: 1rem;
    }
    
    body {
        padding: 0 1rem 1.5rem 1rem;
        font-size: 16px;
    }
    
    header {
        height: 180px;
    }
    
    /* Ensure background image works in portrait mode */
    header {
        background-size: cover;
        background-position: center center;
    }
    
    header > div {
        padding: 0 1rem;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .header-left {
        gap: 1rem;
        flex-direction: row;
        align-items: center;
    }
    
    .profile-pic {
        width: 150px;
        height: 100%;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    /* Improved nav layout for tablets */
    .nav-theme-container {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0;
        align-items: center;
    }
    
    nav {
        grid-column: span 4;
        display: contents;
    }
    
    nav ul {
        display: contents;
        align-items: center;
    }
    
    nav a {
        padding: 0;
        font-size: 1.2rem;
        height: 46px;
    }
    
    .theme-toggle {
        width: 46px;
        height: 46px;
        justify-self: center;
    }
    
    .theme-icon {
        width: 23px;
        height: 23px;
    }
    
    .theme-icon.sun::before {
        height: 28px;
    }
    
    .theme-icon.sun::after {
        width: 28px;
    }
    
    .theme-icon.moon {
        width: 21px;
        height: 21px;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .about-text {
        font-size: 1rem;
    }
    
    .current-quests,
    .contact-section {
        padding: 1.5rem;
    }
}

@media (max-width: 600px) {
    :root {
        --nav-font-size: 1.3rem;
        --title-font-size: 1.4rem;
        --content-font-size: 0.95rem;
    }
    
    /* Grid layout for nav and theme toggle */
    .nav-theme-container {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0;
        align-items: center;
        margin: 1rem 0 0.5rem 0;
    }
    
    nav {
        grid-column: span 4;
        display: contents;
    }
    
    nav ul {
        display: contents;
        align-items: center;
    }
    
    nav a {
        padding: 0;
        font-size: 1rem;
        height: 44px;
    }
    
    /* Position theme toggle in last grid cell */
    .theme-toggle {
        width: 44px;
        height: 44px;
        justify-self: center;
        position: static;
    }
    
    .theme-icon {
        width: 22px;
        height: 22px;
    }
    
    .theme-icon.sun::before {
        height: 27px;
    }
    
    .theme-icon.sun::after {
        width: 27px;
    }
    
    .theme-icon.moon {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    :root {
        --nav-font-size: 1.1rem;
        --title-font-size: 1.3rem;
        --content-font-size: 0.95rem;
    }
    
    body {
        padding: 0 0.75rem 1rem 0.75rem;
        font-size: 15px;
    }
    
    header {
        height: 160px;
    }
    
    header {
        background-size: cover;
        background-position: center center;
    }
    
    header > div {
        padding: 0 0.75rem;
    }
    
    .header-left {
        gap: 0.75rem;
    }
    
    .nav-theme-container {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0;
        align-items: center;
        margin: 1rem 0 0.5rem 0;
    }
    
    nav {
        grid-column: span 4;
        display: contents;
    }
    
    nav ul {
        display: contents;
        align-items: center;
    }
    
    nav a {
        padding: 0;
        font-size: 0.9rem;
        height: 40px;
    }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
        justify-self: center;
        position: static;
    }
    
    .theme-icon {
        width: 20px;
        height: 20px;
    }
    
    .theme-icon.sun::before {
        height: 25px;
    }
    
    .theme-icon.sun::after {
        width: 25px;
    }
    
    .theme-icon.moon {
        width: 18px;
        height: 18px;
    }
    
    .profile-pic {
        width: 120px;
        height: 100%;
    }
    
    .logo {
        font-size: 1.3rem;
    }
    
    .tagline {
        font-size: 0.9rem;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    :root {
        --nav-font-size: 1.2rem;
    }
    
    .nav-theme-container {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0;
        align-items: center;
    }
    
    nav {
        grid-column: span 4;
        display: contents;
    }
    
    nav ul {
        display: contents;
        align-items: center;
    }
    
    nav a {
        padding: 0;
        font-size: 1.2rem;
        letter-spacing: 0.3px;
        height: 44px;
    }
    
    .theme-toggle {
        width: 44px;
        height: 44px;
        justify-self: center;
        position: static;
    }
    
    .theme-icon {
        width: 22px;
        height: 22px;
    }
    
    .theme-icon.sun::before {
        height: 27px;
    }
    
    .theme-icon.sun::after {
        width: 27px;
    }
    
    .theme-icon.moon {
        width: 20px;
        height: 20px;
    }
}

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