/*
  SwitchRevolution - Complete Blog & Admin CMS
  Mobile-Friendly, Fully Responsive Design
*/

:root {
    --color-primary: #1C2B3E;
    /* Deep Navy */
    --color-accent: #00AEEF;
    /* Bright Cyan */
    --color-light: #F8F9FA;
    /* Very Light Gray (MGFX bg) */
    --color-white: #FFFFFF;
    --color-dark: #1C2B3E;
    --color-muted: #666666;
    --font-family: 'Montserrat', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font-family);
    color: var(--color-muted);
    background: var(--color-light);
    line-height: 1.6;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #E5E5E5;
    z-index: 1000;
    padding: 0;
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
}

.logo {
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.05em;
    color: var(--color-primary);
    text-decoration: none;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--color-accent);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Hero Section */
.hero {
    min-height: 90vh;
    min-height: 90svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: var(--color-light);
    /* Off-white background */
    color: var(--color-primary);
    padding-top: 80px;
    padding: 80px 1.5rem 3rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0) 50%, rgba(0, 174, 239, 0.05) 100%);
    pointer-events: none;
}

.hero-content {
    max-width: 900px;
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    line-height: 1.1;
    color: var(--color-primary);
}

.hero h1 span.accent {
    color: var(--color-accent);
}

.hero p {
    font-size: 1.25rem;
    color: var(--color-muted);
    margin-bottom: 3rem;
    font-weight: 400;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn {
    display: inline-block;
    padding: 0.8rem 1.8rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn.primary {
    background: var(--color-primary);
    color: var(--color-white);
    border: 2px solid var(--color-primary);
}

.btn.primary:hover {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.hero-image-wrapper {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.hero-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

/* Main Content */
main {
    background: var(--color-white);
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

section {
    padding: 5rem 0;
}

section:nth-child(even) {
    background: var(--color-light);
    /* Alternate section backgrounds */
}

section h2 {
    font-size: 2.25rem;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--color-primary);
    font-weight: 700;
}

/* Blog Section */
.blog-section {
    background: var(--color-light);
}

.section-intro {
    text-align: center;
    font-size: 1rem;
    color: var(--color-muted);
    margin: -1.5rem auto 2.5rem;
    max-width: 720px;
}

.tutorials-section {
    background: var(--color-white);
}

.tutorials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.tutorial-card {
    background: var(--color-white);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #EAEAEA;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.tutorial-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.tutorial-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.tutorial-content {
    padding: 1.25rem 1.4rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.tutorial-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tutorial-pill {
    background: #f2f2f2;
    color: var(--color-dark);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
}

.tutorial-title {
    font-size: 1.2rem;
    color: var(--color-dark);
}

.tutorial-summary {
    font-size: 0.95rem;
    color: var(--color-muted);
    line-height: 1.6;
}

.tutorial-link {
    margin-top: 0.3rem;
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}

.tutorial-link:hover {
    color: var(--color-primary);
}

.no-tutorials {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--color-muted);
}

/* Blog Controls */
.blog-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.controls-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    min-width: 0;
}

.controls-bottom {
    display: block;
    min-width: 0;
}

.search-bar {
    flex: 1;
    min-width: 240px;
    display: flex;
    gap: 0.5rem;
    min-width: 0;
}

.search-bar input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 0.4rem;
    font-size: 0.95rem;
    transition: border-color 0.3s;
    min-width: 0;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}

.search-btn {
    padding: 0.75rem 1.2rem;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.search-btn:hover {
    background: #d62828;
}

/* Layout Toggle */
.layout-toggle {
    display: flex;
    gap: 0.3rem;
    border: 1px solid #ddd;
    border-radius: 0.4rem;
    padding: 0.3rem;
    background: white;
}

.layout-btn {
    padding: 0.5rem 0.8rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
    border-radius: 0.3rem;
}

.layout-btn:hover {
    background: #f0f0f0;
}

.layout-btn.active {
    background: var(--color-accent);
    color: white;
}

/* Category Filters */
.category-filters {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
    min-width: 0;
}

.category-btn {
    padding: 0.6rem 1.2rem;
    border: 1.5px solid #ddd;
    background: white;
    color: var(--color-dark);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.category-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.category-btn.active {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    transition: all 0.3s;
    min-width: 0;
}

.blog-card,
.blog-content {
    min-width: 0;
}

.blog-grid.list-view {
    grid-template-columns: 1fr;
}

.blog-grid.list-view .blog-card {
    display: flex;
    flex-direction: row;
}

.blog-grid.list-view .blog-image {
    width: 250px;
    height: auto;
    flex-shrink: 0;
}

.blog-card {
    background: var(--color-white);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #EAEAEA;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.blog-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.blog-image.placeholder {
    background: linear-gradient(135deg, #f0f0f0, #e3e3e3);
    border-bottom: 1px solid #eee;
    background-size: 180% 180%;
    background-position: center;
}

.blog-content {
    padding: 1.35rem;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.blog-date {
    font-size: 0.85rem;
    color: var(--color-muted);
    font-weight: 600;
}

.article-category {
    display: inline-block;
    background: rgba(0, 174, 239, 0.1);
    /* Light Cyan Bg */
    color: var(--color-accent);
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.blog-title {
    font-size: 1.3rem;
    margin: 0.8rem 0;
    color: var(--color-primary);
    font-weight: 600;
}

.blog-excerpt {
    font-size: 0.9rem;
    color: var(--color-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.blog-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    align-items: center;
}

.share-btn {
    border: 1px solid #ddd;
    background: white;
    color: var(--color-dark);
    padding: 0.45rem 0.85rem;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.share-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}


.read-more {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.read-more:hover {
    color: var(--color-primary);
}

.no-articles {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--color-muted);
}

/* Article Modal */
.article-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.modal-content {
    background: white;
    max-width: 800px;
    max-height: 90vh;
    max-height: 90svh;
    overflow-y: auto;
    border-radius: 0.5rem;
    padding: 0 2rem 2rem;
    position: relative;
}

.modal-actions {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: flex-end;
    background: white;
    padding: 1rem 0 0.75rem;
    z-index: 1;
}

.close-modal {
    position: static;
    background: #f2f2f2;
    border: 1px solid #e0e0e0;
    border-radius: 999px;
    padding: 0.4rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--color-muted);
}

.modal-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 0.3rem;
    margin-bottom: 1.5rem;
}

.article-body {
    color: var(--color-dark);
    line-height: 1.8;
    font-size: 1rem;
}

.article-body h2 {
    font-size: 1.8rem;
    margin: 1.5rem 0 1rem 0;
    color: var(--color-primary);
}

.article-body h3 {
    font-size: 1.3rem;
    margin: 1.5rem 0 0.8rem 0;
    color: var(--color-dark);
    font-weight: 600;
}

.article-body p {
    margin-bottom: 1rem;
    text-align: justify;
}

.article-body ul,
.article-body ol {
    margin: 1rem 0 1rem 2rem;
    line-height: 1.8;
}

.article-body li {
    margin-bottom: 0.5rem;
}

.article-body strong {
    font-weight: 600;
    color: var(--color-primary);
}

.article-body em {
    font-style: italic;
    color: var(--color-muted);
}

.article-body img {
    max-width: 100%;
    height: auto;
    margin: 1.5rem 0;
    border-radius: 0.3rem;
}

.article-body iframe,
.article-body video,
.article-body embed {
    max-width: 100%;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border: none;
}

.article-body a {
    color: var(--color-accent);
    text-decoration: underline;
}

.article-body a:hover {
    color: var(--color-primary);
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--color-primary);
}

/* Features Section */
.features-section {
    background: var(--color-white);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.feature-item {
    text-align: center;
    background: var(--color-white);
    border-radius: 6px;
    padding: 1.5rem;
    border: 1px solid #EAEAEA;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    transition: transform 0.3s, box-shadow 0.3s;
}

.feature-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.feature-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.feature-item h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--color-primary);
}

.feature-item p {
    color: var(--color-muted);
    line-height: 1.6;
}

/* Gallery Section */
.gallery {
    background: transparent;
}

.gallery-intro {
    text-align: center;
    font-size: 1.1rem;
    color: var(--color-muted);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.gallery-grid figure {
    margin: 0;
    overflow: hidden;
    border-radius: 0.5rem;
}

.gallery-grid img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.gallery-grid figure:hover img {
    transform: scale(1.05);
}

.gallery-grid figcaption {
    padding: 1rem;
    background: white;
    font-size: 0.95rem;
    color: var(--color-muted);
    text-align: center;
}

.gallery-modal {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 24, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2200;
    padding: 1.5rem;
}

.gallery-modal-content {
    position: relative;
    width: min(1100px, 95vw);
    max-height: 90vh;
    display: grid;
    gap: 1rem;
    justify-items: center;
    color: white;
}

.gallery-modal-image {
    width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 0.5rem;
    background: transparent;
}

.gallery-modal-caption {
    font-size: 1rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.85);
}

.gallery-close {
    position: absolute;
    top: -0.75rem;
    right: -0.75rem;
    background: white;
    border: none;
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    color: #111;
}

/* Story Section */
.story {
    background: white;
}

.story h2 {
    margin-bottom: 2rem;
}

#story-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--color-dark);
}

#story-content p {
    margin-bottom: 1.5rem;
}

/* Footer */
.footer {
    background: var(--color-primary);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
}

/* Admin Styles */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    margin-top: 80px;
}

.admin-container h1 {
    margin-bottom: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero {
        min-height: 70vh;
        padding-top: 80px;
        padding: 80px 1rem 2rem;
    }

    .hero h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .hero p {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    section h2 {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }

    section {
        padding: 2.5rem 0;
    }

    .section-container {
        padding: 0 1rem;
    }

    /* Mobile Navigation */
    .menu-toggle {
        display: block;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(255, 255, 255, 0.98);
        border-bottom: 1px solid #EAEAEA;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s;
    }

    .nav-links.active {
        max-height: 500px;
    }

    .nav-links li {
        border-bottom: 1px solid #EAEAEA;
    }

    .nav-links a {
        display: block;
        padding: 1rem;
        color: var(--color-primary);
    }

    /* Blog Grid */
    .blog-grid {
        grid-template-columns: 1fr;
    }

    .blog-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
    }

    .controls-top {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .layout-toggle {
        align-self: flex-start;
    }

    .category-filters {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.25rem;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .category-btn {
        font-size: 0.55rem;
        padding: 0.4rem 0.6rem;
    }

    .blog-grid.list-view .blog-card {
        flex-direction: row;
        align-items: flex-start;
    }

    .blog-grid.list-view .blog-image {
        width: 110px;
        height: 110px;
        flex-shrink: 0;
    }

    .blog-grid.list-view .blog-content {
        padding: 0.9rem;
    }

    .blog-image {
        height: auto;
    }

    .tutorials-grid {
        grid-template-columns: 1fr;
    }

    .tutorial-image {
        aspect-ratio: 4 / 3;
    }

    /* Feature Grid */
    .feature-grid {
        grid-template-columns: 1fr;
    }

    /* Gallery Grid */
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-grid img {
        height: 200px;
    }

    /* Modal */
    .modal-content {
        padding: 0 1.5rem 1.5rem;
        max-height: 95vh;
    }

    .article-modal {
        padding: 0.5rem;
    }
}

@media (max-width: 420px) {
    .section-container {
        padding: 0 0.8rem;
    }

    .blog-controls {
        padding: 0.85rem;
    }

    .controls-top {
        flex-direction: column;
        align-items: stretch;
    }

    .search-bar {
        flex-direction: column;
    }

    .search-btn {
        width: 100%;
    }

    .layout-toggle {
        width: 100%;
        justify-content: center;
    }

    .category-filters {
        flex-wrap: wrap;
        overflow-x: visible;
        gap: 0.5rem;
    }

    .category-btn {
        font-size: 0.6rem;
        padding: 0.4rem 0.7rem;
    }

    .blog-grid {
        gap: 1.2rem;
    }

    .blog-content {
        padding: 1rem;
    }

    .blog-title {
        font-size: 1.05rem;
    }

    .blog-excerpt {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .navbar-container {
        padding: 0.8rem 1rem;
    }

    .logo {
        font-size: 1rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 0.9rem;
    }

    section h2 {
        font-size: 1.5rem;
    }

    .blog-card {
        border-radius: 0.3rem;
    }

    .blog-title {
        font-size: 1.1rem;
    }

    .blog-grid.list-view .blog-image {
        width: 90px;
        height: 90px;
    }

    .blog-grid.list-view .blog-content {
        padding: 0.75rem;
    }

    .modal-content {
        padding: 0 1rem 1rem;
    }

    .close-modal {
        font-size: 0.85rem;
    }
}

/* Utility Classes */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--color-muted);
}