/* Modern CSS Reset and Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;;
}

/* CSS Variables for Light Mode (default) */
:root {
    --bg-color: #f8f9fa;
    --text-color: #333;
    --text-secondary: #555;
    --text-tertiary: #666;
    --heading-color: #2c3e50;
    --heading-secondary: #34495e;
    --nav-bg: #ffffff;
    --nav-shadow: rgba(0, 0, 0, 0.1);
    --nav-hover-bg: #e9ecef;
    --nav-hover-color: #007bff;
    --card-bg: #ffffff;
    --card-shadow: rgba(0, 0, 0, 0.08);
    --card-shadow-hover: rgba(0, 0, 0, 0.15);
    --border-color: #e9ecef;
    --activity-card-bg: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    --favorite-item-bg: #ffffff;
    --favorite-image-bg: #f8f9fa;
    --footer-bg: #2c3e50;
    --footer-text: #ffffff;
    --link-color: #007bff;
}

/* CSS Variables for Dark Mode */
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #888;
    --heading-color: #ffffff;
    --heading-secondary: #e0e0e0;
    --nav-bg: #2d2d2d;
    --nav-shadow: rgba(0, 0, 0, 0.3);
    --nav-hover-bg: #3d3d3d;
    --nav-hover-color: #4a9eff;
    --card-bg: #2d2d2d;
    --card-shadow: rgba(0, 0, 0, 0.3);
    --card-shadow-hover: rgba(0, 0, 0, 0.5);
    --border-color: #404040;
    --activity-card-bg: linear-gradient(135deg, #2d2d2d 0%, #3d3d3d 100%);
    --favorite-item-bg: #2d2d2d;
    --favorite-image-bg: #1a1a1a;
    --footer-bg: #2d2d2d;
    --footer-text: #ffffff;
    --link-color: #4a9eff;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navigation Styles */
.rowtop {
    position: relative;
}

.navtop {
    background-color: var(--nav-bg);
    box-shadow: 0 2px 10px var(--nav-shadow);
    padding: 0.75rem 0;
    position: fixed;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    z-index: 9999;
}

.navtop-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    gap: 1rem;
    position: relative;
}

/* Dark Mode Toggle */
.theme-toggle {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    width: 60px;
    height: 30px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    padding: 2px;
}

.theme-toggle:hover {
    border-color: var(--link-color);
}

.theme-toggle-slider {
    background: var(--text-color);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    position: absolute;
    transition: transform 0.3s ease, background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

[data-theme="dark"] .theme-toggle-slider {
    transform: translateX(30px);
}

.theme-toggle-slider::before {
    content: '☀️';
    position: absolute;
}

[data-theme="dark"] .theme-toggle-slider::before {
    content: '🌙';
}

.navis {
    flex: 1;
    display: flex;
    justify-content: center;
}

.navis ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 0 auto;
}

.navis li {
    display: inline-block;
}

.navis a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.navis a:hover {
    background-color: var(--nav-hover-bg);
    color: var(--nav-hover-color);
}

.navis a.active {
    font-weight: 600;
    text-decoration: underline;
}

.theme-toggle {
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Main Content Layout */
.container {
    display: flex;
    align-items: center;
    min-height: 60vh;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    gap: 3rem;
}

.index {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.rectangleimage {
    max-width: 400px;
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--heading-color);
    margin-bottom: 1rem;
    line-height: 1.2;
    transition: color 0.3s ease;
}

h2 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--heading-secondary);
    margin-bottom: 1.5rem;
    transition: color 0.3s ease;
}

h3 {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--heading-secondary);
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.7;
    transition: color 0.3s ease;
}

/* Content Sections */
.topbox {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--card-shadow);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.topbox h1 {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 0;
}

.bottombox, .bottombox2 {
    background-color: var(--card-bg);
    padding: 2rem;
    margin: 2rem auto;
    max-width: 1200px;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--card-shadow);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.section2 {
    background-color: var(--card-bg);
    padding: 2rem;
    margin: 2rem auto;
    max-width: 1200px;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--card-shadow);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Courses Section Styling */
.courses-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
}

.course-column {
    display: flex;
    flex-direction: column;
}

.column-title {
    color: var(--heading-color);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    transition: color 0.3s ease, border-color 0.3s ease;
}

.courses-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.course-item {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    border: 1px solid var(--border-color);
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.course-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px var(--card-shadow-hover);
}

.course-item h4 {
    color: var(--heading-color);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
    text-decoration: none;
}

.course-item:hover h4 {
    color: var(--link-color);
}

.course-code {
    color: var(--link-color);
    font-weight: 600;
    font-size: 1rem;
    margin: 0;
    transition: color 0.3s ease;
}

.course-institution {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin: 0;
    transition: color 0.3s ease;
}

/* Contact Info Styling */
#contactinfo {
    padding-top: 0;
    margin-bottom: 1rem;
}

.contact-icons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.contact-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    color: var(--text-color);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 2px 8px var(--card-shadow);
}

.contact-icon:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px var(--card-shadow-hover);
    border-color: var(--link-color);
}

.contact-icon img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.view-counter {
    margin-top: 2rem;
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.view-counter p {
    color: var(--text-tertiary);
    font-size: 0.95rem;
    margin: 0;
}

.view-counter #viewCount {
    font-weight: 600;
    color: var(--heading-color);
    font-size: 1.1rem;
}

ol {
    list-style: none;
    counter-reset: item;
}

ol li {
    counter-increment: item;
    margin-bottom: 0.8rem;
    padding-left: 2rem;
    position: relative;
}

ol li:before {
    content: counter(item);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 0;
    top: 0;
    font-size: 0.9rem;
}

ol a {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 500;
}

ol a:hover {
    text-decoration: underline;
}

/* Footer */
#copyright {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#copyright2 {
    color: var(--footer-text);
    font-size: 0.9rem;
}

/* Favorites Section Styling */
.intro-text {
    font-size: 1.2rem;
    color: var(--text-tertiary);
    margin-bottom: 2rem;
    text-align: center;
    font-style: italic;
}

.favorites-section-main {
    padding: 2rem;
    margin: 2rem auto;
    max-width: 1200px;
}

.blog-meta {
    color: var(--text-tertiary);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.blog-link {
    color: var(--link-color);
    font-weight: 600;
    text-decoration: none;
}

.blog-link:hover {
    text-decoration: underline;
}

.blog-posts {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 1.5rem;
}

.blog-post {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--card-shadow);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
}

.blog-post:hover {
    box-shadow: 0 6px 20px var(--card-shadow-hover);
}

.blog-title {
    margin-bottom: 0.5rem;
}

.blog-title a {
    color: var(--heading-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

.blog-excerpt {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-top: 1rem;
    margin-bottom: 0;
    white-space: pre-line;
}

.blog-content {
    color: var(--text-color);
    line-height: 1.8;
}

.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4 {
    color: var(--heading-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.blog-content h1 {
    font-size: 2rem;
}

.blog-content h2 {
    font-size: 1.75rem;
}

.blog-content h3 {
    font-size: 1.5rem;
}

.blog-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.blog-content ul,
.blog-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.blog-content li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.blog-content code {
    background-color: var(--nav-hover-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.blog-content pre {
    background-color: var(--nav-hover-bg);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.blog-content pre code {
    background-color: transparent;
    padding: 0;
}

.blog-content a {
    color: var(--link-color);
    text-decoration: none;
}

.blog-content a:hover {
    text-decoration: underline;
}

.blog-content blockquote {
    border-left: 4px solid var(--link-color);
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 1.5rem;
    color: var(--text-tertiary);
    font-style: italic;
}


/* Favorites Section Styling */
.favorites-section {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    transition: border-color 0.3s ease;
}

.favorites-intro {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-style: italic;
}

.favorites-categories {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    margin-top: 0.5rem;
}

.favorite-category h3 {
    color: var(--heading-color);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    transition: color 0.3s ease, border-color 0.3s ease;
}

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.music-embed-wrapper {
    width: 100%;
    max-width: 100%;
}

/* Music section grid - 2 columns for 2 rows layout */
.music-grid {
    grid-template-columns: repeat(2, 1fr);
}

.favorite-item {
    background: var(--favorite-item-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--card-shadow);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    text-align: center;
}

.favorite-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--card-shadow-hover);
}

.favorite-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--favorite-image-bg);
    transition: background-color 0.3s ease;
}

.favorite-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.favorite-item:hover .favorite-image img {
    transform: scale(1.05);
}

/* Ensure xenoblade2 and smtnocturne images match other favorite images */
.favorite-item:has(img[alt="Xenoblade Chronicles 2"]) .favorite-image img,
.favorite-item:has(img[src*="xenoblade2"]) .favorite-image img,
.favorite-item:has(img[src*="smtnocturne"]) .favorite-image img {
    max-width: 100%;
    max-height: 100%;
}

.favorite-item h4 {
    color: var(--heading-color);
    margin: 1rem 0 1.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

/* Site Header */
.site-header {
    text-align: center;
    padding-top: 5.5rem;
    padding-bottom: 1rem;
    background-color: var(--bg-color);
    transition: background-color 0.3s ease;
}

.site-title {
    color: var(--heading-color);
    transition: color 0.3s ease;
}

/* Counter Wrapper */
.counter-wrapper {
    text-align: center;
    padding: 0.25rem 0;
    max-width: 1200px;
    margin: 0 auto;
    margin-top: -2rem;
}

.counter-wrapper p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

.counter-wrapper #visitCount {
    font-weight: 600;
    color: var(--heading-color);
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        padding: 1rem;
        gap: 2rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .navtop {
        padding: 0.5rem 0;
    }
    
    .navtop-inner {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0 1rem;
    }
    
    .theme-toggle {
        position: static;
        transform: none;
        order: -1;
        align-self: center;
        margin-bottom: 0;
    }
    
    .navis {
        width: 100%;
        padding: 0;
        order: 1;
    }
    
    .navis ul {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        margin: 0;
    }
    
    .navis a {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .site-header {
        padding-top: 4.5rem;
        padding-bottom: 1rem;
    }
    
    .bottombox, .bottombox2, .section2 {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .favorites-section-main {
        padding: 1rem;
        margin: 1rem auto;
    }
    
    .favorites-categories {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .favorites-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .favorite-image {
        height: 150px;
    }
    
    .courses-columns {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .course-item {
        padding: 1.25rem;
    }
    
    .course-item h4 {
        font-size: 1.1rem;
    }
    
    .column-title {
        font-size: 1.3rem;
    }
    
    .favorite-item h4 {
        font-size: 0.9rem;
        margin: 0.8rem 0 1.2rem 0;
    }
    
    .music-grid {
        grid-template-columns: 1fr;
    }
    
    .music-embed-wrapper {
        width: 100%;
    }
    
    .contact-icons {
        gap: 1rem;
    }
    
    .contact-icon {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .navtop {
        padding: 0.4rem 0;
    }
    
    .navtop-inner {
        padding: 0 0.75rem;
        gap: 0.5rem;
    }
    
    .theme-toggle {
        position: static;
        transform: none;
        order: -1;
        width: 50px;
        height: 26px;
        margin-bottom: 0;
    }
    
    .navis {
        padding: 0;
        order: 1;
    }
    
    .navis ul {
        gap: 0.4rem;
        flex-wrap: wrap;
    }
    
    .navis a {
        padding: 0.5rem 0.6rem;
        font-size: 0.85rem;
        min-height: 44px;
        min-width: 60px;
    }
    
    .theme-toggle-slider {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
    
    [data-theme="dark"] .theme-toggle-slider {
        transform: translateX(24px);
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    .site-header {
        padding-top: 4rem;
        padding-bottom: 0.75rem;
    }
    
    .topbox {
        padding: 1.5rem;
    }
    
    .topbox h1 {
        font-size: 1rem;
    }
    
    .bottombox, .bottombox2, .section2 {
        margin: 0.75rem;
        padding: 1.25rem;
    }
    
    .container {
        padding: 0.75rem;
        gap: 1.5rem;
    }
    
    .rectangleimage {
        max-width: 100%;
    }
    
    .favorites-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.75rem;
    }
    
    .favorite-image {
        height: 120px;
    }
    
    .contact-icon {
        width: 70px;
        height: 70px;
    }
    
    .contact-icons {
        gap: 0.75rem;
    }
    
    .music-embed-wrapper iframe {
        height: 152px;
    }
    
    .resume iframe {
        height: 500px;
    }
    
    .courses-columns {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .course-item {
        padding: 1rem;
    }
    
    .course-item h4 {
        font-size: 1rem;
    }
    
    .course-code {
        font-size: 0.9rem;
    }
    
    .column-title {
        font-size: 1.2rem;
    }
}

/* Legacy styles for compatibility */
.circleimage {
    height: 40%;
    position: relative;
    border-radius: 50%;
}

.section1 {
    display: flex;
    padding-top: 5%;
    padding-left: 5%;
    padding-bottom: 6%;
}

.content {
    width: 80%;
    padding-right: 20%;
    position: relative;
}

img {
    max-width: 40%;
    height: auto;
}

.resume {
    padding-left: 5%;
    padding-right: 5%;
    padding-top: 5%;
}

nav {
    background-color: #a19b9b;
    padding-top: 10px;
    padding-bottom: 10px;
    text-indent: 10px;
    color: rgb(0, 0, 0);
    width: 100%;
    margin: 0;
    border-radius: 1px;
    position: relative;
}

nav ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

nav ul li {
    display: inline-block;
    margin-right: 15px;
}

nav ul li a {
    color: #000000;
    font-size: 120%;
    text-decoration: none;
}

footer {
    background-color: #333;
    color: #fff;
    padding: 10px;
    text-align: center;
}

button:hover {
    background-color: #4CAF50;
    color: white;
}

a:hover {
    text-decoration: underline;
}

/* --- FORCE NAV TO STAY ONE ROW (MOBILE + DESKTOP) --- */

/* Your nav list is the UL itself: <ul class="navis"> ... */
ul.navis {
    list-style: none;
    margin: 0;
    padding: 0;
  
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: nowrap;          /* <— keeps one row */
    white-space: nowrap;
  }
  
  /* Keep the toggle pinned to the right on ALL screen sizes */
  .navtop-inner {
    position: relative;
  }
  
  .theme-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
  }
  
  /* Mobile tweaks: reduce spacing/font so everything fits */
  @media (max-width: 768px) {
    .navtop-inner {
      flex-direction: row;      /* <— overrides your column layout */
    }
  
    ul.navis {
      gap: 1rem;
    }
  
    ul.navis a {
      padding: 0.35rem 0.6rem;
      font-size: 0.9rem;
    }
  }
  
  @media (max-width: 480px) {
    ul.navis {
      gap: 0.6rem;
    }
  
    ul.navis a {
      padding: 0.3rem 0.5rem;
      font-size: 0.85rem;
    }
  }

  @media (max-width: 420px) {
    ul.navis {
      flex-wrap: wrap;
      justify-content: center;
    }
  }