/* =========================================
   1. GLOBAL VARIABLES & RESET
   ========================================= */
   :root {
    --text-main: #1a1a1a;
    --text-muted: #555555;
    --bg-color: #ffffff;
    --accent: #007aff;
    --border-color: #efefef;
    --card-bg: #ffffff;
    --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-serif: "Charter", "Georgia", serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-ui);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
    animation: fadeIn 0.8s ease-in-out;
}

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

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

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

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

/* =========================================
   2. UTILITIES & BUTTONS
   ========================================= */
.container-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Standard Text Button (used for Blogs/About links on Index) */
.button {
    background-color: #6f6f6f;
    border: none;
    color: #ffffff;
    padding: 8px 16px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
    font-family: var(--font-ui);
}

.button:hover {
    background-color: #333;
}

/* Unified Icon Button Style (Back, Home, Dark Mode) */
.icon-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    text-decoration: none; /* For <a> tags using this class */
}

.icon-btn:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
    color: var(--text-main); /* Prevents accent color override on hover */
}

/* Navigation Container for sub-pages */
.top-nav {
    padding: 20px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Dark Mode Overrides */
body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
    --text-main: #e0e0e0;
    --text-muted: #aaaaaa;
    --card-bg: #1e1e1e;
    --border-color: #333;
}

body.dark-mode .button {
    background-color: #e0e0e0;
    color: #121212;
}

body.dark-mode .blog-card, 
body.dark-mode th {
    background-color: #1e1e1e;
    border-color: #333;
}

/* Icon Buttons in Dark Mode */
body.dark-mode .icon-btn {
    border-color: #333;
    color: #e0e0e0;
}
body.dark-mode .icon-btn:hover {
    background-color: #333;
}

/* =========================================
   3. HOME PAGE (Index) STYLES
   ========================================= */
.home-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap; 
}

.profile-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    gap: 30px;
}

.profile-text h2 {
    font-size: 2.5rem;
    margin: 0 0 10px 0;
    font-weight: 700;
}

.profile-text p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin: 0 0 20px 0;
}

.social-icons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.social-icons a {
    margin: 0;
    display: flex;
}

/* Monochrome Icons */
.social-icons img {
    filter: grayscale(100%);
    opacity: 0.7;
    transition: all 0.3s ease;
}

.social-icons img:hover {
    filter: grayscale(0%);
    opacity: 1;
    transform: translateY(-2px);
}

.blink {
    animation: blinker 1.5s linear infinite;
    color: red;
    font-weight: bold;
}

@keyframes blinker {
    50% { opacity: 0; }
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
    margin-top: 20px;
}

.dropbtn {
    background-color: var(--accent);
    color: white;
    padding: 10px 15px;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--card-bg);
    min-width: 250px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 4px;
    padding: 5px 0;
}

.dropdown-content a {
    padding: 12px 16px;
    display: block;
    font-size: 14px;
}

.show { display: block; }

/* =========================================
   4. ABOUT PAGE (Timeline) STYLES
   ========================================= */
.timeline-body {
    padding: 0;
    overflow-x: hidden;
}

.timeline-content-wrapper {
    padding: 40px 5%;
}

.timeline-btn-container {
    position: fixed;
    top: 110px;
    right: 5%;
    z-index: 1000;
}

#reverseBtn {
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
    transition: all 0.3s ease;
}

#reverseBtn:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

.timeline-wrapper {
    max-width: 1000px;
    margin: 40px auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

.timeline-wrapper::after {
    content: '';
    position: absolute;
    width: 2px;
    background-color: var(--border-color);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -1px;
    z-index: 0;
}

.timeline-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 80px;
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.timeline-item.show {
    opacity: 1;
    transform: translateY(0);
}

.content-block, .learning-block {
    width: 44%;
    padding: 10px 0;
}

.timeline-item.left { flex-direction: row; }
.timeline-item.right { flex-direction: row-reverse; }
.timeline-item.left .content-block { text-align: right; }
.timeline-item.left .learning-block { text-align: left; }
.timeline-item.right .content-block { text-align: left; }
.timeline-item.right .learning-block { text-align: right; }

.timeline-dot {
    position: absolute;
    left: 50%;
    transform: translateX(-50%) scale(0);
    width: 16px;
    height: 16px;
    background: #fff;
    border: 3px solid var(--accent);
    border-radius: 50%;
    top: 20px;
    transition: transform 0.4s ease 0.3s;
}

.timeline-item.show .timeline-dot {
    transform: translateX(-50%) scale(1);
}

.date-label {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.timeline-item h2 {
    font-size: 1.5rem;
    margin: 10px 0;
    color: var(--text-main);
}

.learning-block h3 {
    font-size: 0.85rem;
    color: #ff9500;
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.learning-content {
    font-style: italic;
    color: var(--text-muted);
    font-size: 1rem;
    border-left: 3px solid #ff9500;
    padding-left: 15px;
}

.timeline-item.left .learning-content {
    border-left: none;
    border-right: 3px solid #ff9500;
    padding-left: 0;
    padding-right: 15px;
}

.rank-container {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    justify-content: flex-start;
    margin-top: 10px;
}
.timeline-item.left .rank-container { justify-content: flex-end; }

.rank-table {
    border-collapse: collapse;
    font-size: 0.9rem;
}
.rank-table th, .rank-table td {
    border: 1px solid var(--text-main);
    padding: 4px 10px;
    text-align: center;
}
.rank-table th { background-color: var(--border-color); }

/* =========================================
   5. BLOGS (Archive) STYLES
   ========================================= */
.archive-header {
    text-align: center;
    margin-bottom: 60px;
    padding-top: 20px;
}

.archive-header h1 {
    font-weight: 400;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-muted);
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 40px;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px 60px 20px;
}

.blog-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    padding: 40px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--card-bg);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.blog-card:hover {
    border-color: var(--text-main);
    transform: translateY(-4px);
}

.card-index {
    font-size: 0.7rem;
    font-family: monospace;
    color: var(--text-muted);
    margin-bottom: 40px;
}

.blog-card h2 {
    font-size: 1.4rem;
    font-weight: 500;
    margin: 0 0 12px 0;
    letter-spacing: -0.01em;
}

.blog-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0;
}

.read-link {
    margin-top: auto;
    padding-top: 30px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

/* =========================================
   6. ARTICLE (Story) STYLES
   ========================================= */
.article-nav {
    padding: 40px 20px;
    display: flex;
    justify-content: space-between;
    max-width: 1000px;
    margin: 0 auto;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    align-items: center;
}

.article-container {
    max-width: 680px;
    margin: 60px auto 150px auto;
    padding: 0 25px;
}

.article-header {
    margin-bottom: 60px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 40px;
}

.article-header h1 {
    font-size: 2.8rem;
    font-weight: 600;
    line-height: 1.1;
    margin-bottom: 20px;
    letter-spacing: -0.04em;
    font-family: var(--font-ui);
}

.article-meta-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.audio-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    transition: all 0.2s;
    background: transparent;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--text-main);
}

.audio-controls:hover {
    border-color: var(--text-main);
    background-color: var(--border-color);
}

.audio-controls svg {
    width: 12px;
    height: 12px;
}

.article-content p {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    margin-bottom: 2rem;
    color: var(--text-main);
}

.article-content p:first-of-type::first-letter {
    float: left;
    font-size: 4.5rem;
    line-height: 1;
    padding-right: 12px;
    font-weight: 600;
    font-family: var(--font-ui);
}

.divider {
    text-align: center;
    margin: 60px 0;
    color: var(--text-muted);
    letter-spacing: 1em;
    font-family: var(--font-serif);
}

.article-footer {
    margin-top: 100px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.back-btn {
    font-size: 0.9rem;
    font-weight: 600;
}

/* =========================================
   7. MEDIA QUERIES (MOBILE)
   ========================================= */
@media screen and (max-width: 900px) {
    body {
        font-size: 16px;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.2rem; }

    .container-wrapper {
        padding: 20px;
    }

    .home-header {
        justify-content: center;
        margin-bottom: 30px;
        gap: 8px;
    }

    .home-header .button {
        font-size: 0.8rem;
        padding: 6px 10px;
        flex-grow: 1;
        max-width: 100px;
    }

    .profile-section {
        flex-direction: column-reverse;
        text-align: center;
        gap: 20px;
    }

    .profile-section img {
        width: 120px;
        height: 120px;
    }
    
    .profile-text h2 {
        font-size: 1.8rem;
    }

    .social-icons {
        display: flex;
        justify-content: center;
        gap: 15px;
    }
    
    .social-icons img {
        width: 32px !important;
        height: 32px !important;
        object-fit: contain;
        max-width: none;
    }

    .timeline-wrapper::after { left: 20px; }
    .timeline-item { flex-direction: column !important; align-items: flex-start; margin-bottom: 40px; }
    .content-block, .learning-block { width: 100% !important; padding-left: 50px; text-align: left !important; }
    .learning-content { border-right: none !important; border-left: 3px solid #ff9500 !important; padding-left: 15px; }
    .timeline-dot { left: 20px; }
    .timeline-btn-container { position: static; margin: 20px 0; text-align: center; }
    .rank-container { flex-direction: column; width: 100%; }
    .rank-table { width: 100%; display: block; overflow-x: auto; }

    .blog-grid {
        grid-template-columns: 1fr;
        padding: 0 10px 40px 10px;
        gap: 20px;
    }
    
    .blog-card {
        padding: 25px;
    }

    .article-header h1 { font-size: 1.8rem; }
    .article-content p:first-of-type::first-letter { font-size: 3rem; }
}