/* Global Styles - Cognitive Science of Yoga */

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

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Source Sans 3', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: #fafafa;
    overflow-x: hidden;
}

img,
svg {
    max-width: 100%;
}

h1, h2, h3, h4, h5, h6,
.navbar, .nav-links, .footer,
.blog-tag, .paper-tag, .announce-tag,
button, input, select, textarea {
    font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}

/* Night Mode Toggle */
.night-mode-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2a6b5e;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #4a3080;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Hamburger Menu */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 5px 0;
    transition: 0.3s;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Navigation */
.navbar {
    background-color: #2c3e50;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    position: relative;
    padding: 0 1rem;
}

.navbar-logo {
    height: 60px;
    width: auto;
    position: absolute;
    left: 0;
}

.navbar-links {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 2rem;
    row-gap: 0.75rem;
    flex-wrap: wrap;
}

.navbar a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
    font-size: 1rem;
    white-space: nowrap;
}

.navbar a:hover {
    background-color: rgba(255,255,255,0.15);
}

.navbar a.active-link {
    background-color: rgba(255,255,255,0.2);
    border-bottom: 2px solid #7ec8a0;
}

/* Page Headers */
.page-header {
    background: linear-gradient(135deg, #2a6b5e, #61c4db, #7ec8a0);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.page-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 300;
    letter-spacing: 0.05em;
}

.page-header p {
    margin: 0;
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    opacity: 0.9;
}

/* Footer */
.footer {
    background-color: #2c3e50;
    color: white;
    padding: 2rem 0;
    width: 100%;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 2rem);
    text-align: center;
}

.footer-content p {
    margin: 0.3rem 0;
    opacity: 0.8;
    font-size: 0.9rem;
}

.footer-content a {
    color: #7ec8a0;
    text-decoration: none;
}

/* Shared single-post layout (Blog/Announcements/Research generated pages) */
.post-main {
    width: min(92vw, 1120px) !important;
    max-width: none !important;
    margin: 2rem auto !important;
    padding: 0 clamp(1rem, 4vw, 2rem) !important;
}

.post-cover {
    width: min(92vw, 1120px);
    margin: 0 auto 1.5rem;
    padding: 0 clamp(1rem, 4vw, 2rem);
}

.post-cover img {
    display: block;
    width: 100%;
    max-height: 520px;
    object-fit: cover;
    border-radius: 14px;
}

.post-content {
    width: 100%;
    text-align: left;
    line-height: 1.75;
    padding: 0;
}

.post-content > * {
    max-width: 100%;
}

.post-main > .back-btn {
    width: 100%;
    margin-bottom: 1.25rem;
    padding-bottom: 0.7rem;
    border-bottom: 2px solid #7ec8a0;
}

.post-bottom-back {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e6ecef;
}

@media (max-width: 768px) {
    .post-main {
        width: 100% !important;
        margin: 1.5rem auto !important;
        padding: 0 1rem !important;
    }

    .post-cover {
        width: 100%;
        padding: 0 1rem;
    }
}

body.night-mode .post-bottom-back {
    border-top-color: #3a3a3a;
}

body.night-mode .post-main > .back-btn {
    border-bottom-color: #3a7a5a;
}

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

.social-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
}

.social-link {
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-link:hover {
    color: #7ec8a0;
    transform: scale(1.2);
}

.social-icon {
    width: 28px;
    height: 28px;
}

@media (max-width: 1024px) {
    .navbar {
        padding: 0.75rem;
    }

    .navbar-links {
        gap: 1rem;
    }

    .night-mode-toggle {
        top: 0.75rem;
        right: 0.75rem;
    }

    .page-header {
        padding: 2.5rem 1.5rem;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem;
    }

    .navbar-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .navbar-logo {
        position: static;
        height: 45px;
    }

    .menu-toggle {
        display: block;
    }

    .navbar-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #2c3e50;
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        z-index: 20;
    }

    .navbar-links.active {
        max-height: 500px;
    }

    .navbar-links a {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
        text-align: center;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .night-mode-toggle {
        right: 0.5rem;
        top: 0.5rem;
        gap: 0.35rem;
    }

    .switch {
        width: 45px;
        height: 24px;
    }

    .slider:before {
        height: 18px;
        width: 18px;
        left: 3px;
        bottom: 3px;
    }

    input:checked + .slider:before {
        transform: translateX(21px);
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .page-header p {
        font-size: 1rem;
    }

    .social-links {
        gap: 1.5rem;
    }

    .social-icon {
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 480px) {
    .navbar-container {
        padding: 0 0.5rem;
    }

    .switch {
        width: 40px;
        height: 22px;
    }

    .slider:before {
        height: 16px;
        width: 16px;
    }

    input:checked + .slider:before {
        transform: translateX(18px);
    }

    .page-header h1 {
        font-size: 1.6rem;
    }

    .footer {
        padding: 1.5rem 0;
    }
}

/* Preload night mode — applied before body renders to prevent flash */
html.night-mode-preload body {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

html.night-mode-preload .slider,
html.night-mode-preload .slider:before {
    transition: none !important;
}

/* Night Mode */
body.night-mode {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

body.night-mode .navbar {
    background-color: #272727;
}

body.night-mode .navbar-links a {
    color: #e0e0e0;
}

body.night-mode .navbar-links a:hover {
    color: #7ec8a0;
}

body.night-mode .page-header {
    background: linear-gradient(135deg, #213d33, #182244, #214035);
}

body.night-mode .footer {
    background-color: #222;
}

body.night-mode a {
    color: #7ec8a0;
}
