/*
Theme Name: SkyGrammar Pro
Theme URI: https://www.skygrammar.com
Author: SkyGrammar
Author URI: https://www.skygrammar.com
Description: A clean, sky-inspired WordPress theme designed specifically for teaching English grammar to beginners and intermediate learners.
Version: 1.1
Requires at least: 5.8
Tested up to: 6.6
Requires PHP: 7.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: skygrammar-pro
Tags: education, blog, two-columns, right-sidebar, custom-logo, custom-menu, editor-style, featured-images
*/

/* Base Reset & Typography */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Open Sans', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.8;
    font-size: 16px;
    color: #1a1a1a;
    background: #E3F2FD;
}

a {
    color: #007BFF;
    text-decoration: none;
}

a:hover,
a:focus {
    text-decoration: underline;
}

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

figure {
    margin: 0;
}

/* Layout */
.site {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    background: #ffffff;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0.6rem 1.1rem;
    gap: 0.75rem;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.site-title {
    margin: 0;
    font-family: 'Merriweather', 'Georgia', 'Times New Roman', serif;
    font-size: 1.25rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.site-title a {
    color: #007BFF;
}

.site-description {
    margin: 0.1rem 0 0;
    font-size: 0.85rem;
    color: #555;
}

.site-logo {
    max-height: 40px;
    width: auto;
}

/* Navigation */
.main-navigation {
    font-size: 0.95rem;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.main-navigation a {
    display: block;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
    color: #004a99;
    background: transparent;
}

.main-navigation a:hover,
.main-navigation a:focus,
.main-navigation .current-menu-item > a {
    background: #E3F2FD;
    text-decoration: none;
}

/* Mobile menu toggle */
.menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.08);
    background: #ffffff;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.menu-toggle span.menu-toggle-icon {
    display: inline-block;
    width: 16px;
    height: 12px;
    position: relative;
}

.menu-toggle span.menu-toggle-icon::before,
.menu-toggle span.menu-toggle-icon::after,
.menu-toggle span.menu-toggle-icon span {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: 999px;
    background: #004a99;
}

.menu-toggle span.menu-toggle-icon span {
    top: 5px;
}

.menu-toggle span.menu-toggle-icon::before {
    top: 0;
}

.menu-toggle span.menu-toggle-icon::after {
    bottom: 0;
}

/* Content layout */
.site-content {
    max-width: 1120px;
    margin: 1.35rem auto 2.5rem;
    padding: 0 1.25rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.content-area {
    width: 100%;
}

.widget-area {
    width: 100%;
}

/* Hero */
.sg-hero {
    background: linear-gradient(135deg, #E3F2FD, #ffffff);
    border-radius: 1.5rem;
    padding: 2rem 1.5rem;
    box-shadow: 0 14px 35px rgba(0, 123, 255, 0.08);
    position: relative;
    overflow: hidden;
}

.sg-hero::before {
    content: '';
    position: absolute;
    inset: -40%;
    background:
        radial-gradient(circle at 0% 0%, rgba(0, 123, 255, 0.04) 0, transparent 55%),
        radial-gradient(circle at 100% 0%, rgba(40, 167, 69, 0.05) 0, transparent 55%);
    opacity: 0.9;
    pointer-events: none;
}

.sg-hero-inner {
    position: relative;
    max-width: 640px;
}

.sg-hero h1 {
    font-family: 'Merriweather', 'Georgia', 'Times New Roman', serif;
    font-size: 1.9rem;
    margin: 0 0 0.75rem;
    color: #064084;
}

.sg-hero p {
    margin: 0 0 1.1rem;
    font-size: 1rem;
    color: #234668;
}

.sg-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.3rem;
    font-size: 0.9rem;
    color: #436286;
}

.sg-hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
}

/* Buttons */
.sg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
    white-space: nowrap;
}

.sg-btn-primary {
    background: #007BFF;
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(0, 123, 255, 0.25);
}

.sg-btn-primary:hover,
.sg-btn-primary:focus {
    background: #0066d4;
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(0, 123, 255, 0.35);
    text-decoration: none;
}

.sg-btn-secondary {
    background: #ffffff;
    color: #007BFF;
    border: 1px solid rgba(0, 123, 255, 0.25);
}

.sg-btn-secondary:hover,
.sg-btn-secondary:focus {
    background: #E3F2FD;
    text-decoration: none;
}

/* Section headers */
.sg-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.sg-section-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f305b;
}

.sg-section-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: #506580;
}

/* Lessons grid + archive cards */
.sg-lessons-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.sg-lesson-card,
.sg-archive-card {
    background: #ffffff;
    border-radius: 1rem;
    padding: 0.85rem 0.9rem;
    box-shadow: 0 10px 24px rgba(15, 76, 129, 0.08);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
}

.sg-lesson-thumbnail,
.sg-archive-thumbnail {
    border-radius: 0.8rem;
    overflow: hidden;
    background: #E3F2FD;
}

.sg-lesson-meta,
.sg-archive-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    font-size: 0.8rem;
    color: #7c8ca3;
    margin-bottom: 0.3rem;
}

.sg-lesson-meta span,
.sg-archive-meta span {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: rgba(0, 123, 255, 0.03);
}

.sg-lesson-title,
.sg-archive-title {
    margin: 0.1rem 0 0.25rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0b315f;
}

.sg-lesson-excerpt,
.sg-archive-excerpt {
    margin: 0 0 0.45rem;
    font-size: 0.95rem;
    color: #374763;
}

/* Generic post & page styles */
h1, h2, h3, h4 {
    font-family: 'Merriweather', 'Georgia', 'Times New Roman', serif;
    color: #083563;
}

.entry-title {
    font-size: 1.6rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.entry-meta {
    font-size: 0.85rem;
    color: #7b8aa0;
    margin-bottom: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.entry-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.entry-content {
    font-size: 1rem;
    color: #1f2a3a;
}

.entry-content p {
    margin: 0 0 1rem;
}

.entry-content ul,
.entry-content ol {
    padding-left: 1.3rem;
    margin-bottom: 1rem;
}

.entry-content li {
    margin-bottom: 0.35rem;
}

/* Grammar-focused components */
.sg-grammar-box {
    border-radius: 0.9rem;
    padding: 0.9rem 1rem;
    margin: 1.15rem 0;
    border-left: 4px solid transparent;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 76, 129, 0.06);
}

.sg-grammar-box strong:first-child {
    display: inline-block;
    margin-bottom: 0.35rem;
}

.sg-example {
    border-left-color: #007BFF;
}

.sg-example::before {
    content: "Example";
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    margin-right: 0.45rem;
    background: rgba(0, 123, 255, 0.09);
    color: #0052a3;
}

.sg-correct {
    border-left-color: #28A745;
    background: #f3fbf6;
}

.sg-correct::before {
    content: "Correct";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.4rem;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 999px;
    background: #28A745;
    color: #ffffff;
    font-size: 0.75rem;
}

.sg-incorrect {
    border-left-color: #DC3545;
    background: #fff6f7;
}

.sg-incorrect::before {
    content: "✗";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.4rem;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 999px;
    background: #DC3545;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.8rem;
}

.sg-tip {
    border-left-color: #28A745;
    background: #f4fbf6;
}

.sg-tip::before {
    content: "Tip";
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    margin-right: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(40, 167, 69, 0.12);
    color: #16652f;
}

.sg-exercise {
    border-left-color: #007BFF;
    background: #f5f9ff;
}

.sg-exercise::before {
    content: "Exercise";
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    margin-right: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(0, 123, 255, 0.12);
    color: #004a99;
}

.sg-try {
    border-left-color: #FFB300;
    background: #fff9e8;
}

.sg-try::before {
    content: "Try it yourself";
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    margin-right: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: #ffe6a3;
    color: #8a5a00;
}

/* Author & related */
.sg-author-box {
    margin-top: 2rem;
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 76, 129, 0.05);
    display: grid;
    gap: 0.6rem;
    grid-template-columns: auto 1fr;
}

.sg-author-avatar {
    border-radius: 999px;
    overflow: hidden;
    width: 56px;
    height: 56px;
}

.sg-author-bio {
    font-size: 0.95rem;
    color: #4b5c79;
}

.sg-author-name {
    font-weight: 700;
    color: #083563;
    margin-bottom: 0.2rem;
}

.sg-related-lessons {
    margin-top: 2rem;
}

.sg-related-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.sg-related-item {
    background: #ffffff;
    border-radius: 0.9rem;
    padding: 0.7rem 0.85rem;
    box-shadow: 0 6px 16px rgba(15, 76, 129, 0.05);
    font-size: 0.95rem;
}

/* Navigation */
.post-navigation {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px dashed rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.post-navigation a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.95rem;
}

/* Widgets / Sidebar */
.widget-area {
    padding: 0;
}

.widget {
    margin-bottom: 1.25rem;
    background: #ffffff;
    border-radius: 1rem;
    padding: 0.9rem 1rem 1rem;
    box-shadow: 0 10px 26px rgba(15, 76, 129, 0.06);
}

.widget-title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    color: #0c305a;
}

.widget ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget li {
    margin-bottom: 0.45rem;
    font-size: 0.95rem;
}

.widget a {
    color: #0c457f;
}

.search-form {
    display: flex;
    gap: 0.35rem;
}

.search-form label {
    flex: 1;
}

.search-form .search-field {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.08);
    font-size: 0.95rem;
}

.search-form .search-submit {
    border-radius: 999px;
    border: none;
    padding: 0.45rem 0.9rem;
    font-size: 0.9rem;
    background: #007BFF;
    color: #ffffff;
    cursor: pointer;
}

/* Specific widget styling */
.sg-daily-tip {
    font-size: 0.95rem;
    color: #234668;
}

.sg-popular-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.sg-popular-topic {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: #E3F2FD;
    font-size: 0.85rem;
}

/* Footer */
.site-footer {
    margin-top: auto;
    background: #ffffff;
    border-top: 1px solid rgba(0,0,0,0.04);
    padding: 1.25rem 1rem 1.8rem;
    font-size: 0.85rem;
    color: #60708c;
}

.site-footer-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}

/* Archive & search */
.page-header {
    margin-bottom: 1.25rem;
}

.page-title {
    margin: 0 0 0.4rem;
    font-size: 1.4rem;
}

.page-description {
    margin: 0;
    font-size: 0.95rem;
    color: #4b5c79;
}

.sg-archive-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

/* 404 */
.error-404 {
    text-align: center;
    padding: 3rem 1rem;
}

.error-404 h1 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

/* Accessibility */
.screen-reader-text {
    border: 0;
    clip: rect(1px,1px,1px,1px);
    -webkit-clip-path: inset(50%);
    clip-path: inset(50%);
    height: 1px;
    width: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    position: absolute !important;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    background-color: #ffffff;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0,0,0,0.6);
    clip: auto !important;
    -webkit-clip-path: none;
    clip-path: none;
    color: #000000;
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    height: auto;
    left: 0.5rem;
    line-height: normal;
    padding: 1rem 1.5rem;
    text-decoration: none;
    top: 0.5rem;
    width: auto;
    z-index: 100000;
}

/* Responsive */
@media (max-width: 767px) {
    /* Better mobile menu */
    .main-navigation {
        position: absolute;
        inset-inline: 0;
        top: 100%;
        background: #ffffff;
        border-bottom: 1px solid rgba(0,0,0,0.05);
        box-shadow: 0 18px 30px rgba(0,0,0,0.08);
        padding: 0.75rem 1.1rem 1rem;
        display: none;
    }

    .main-navigation.toggled {
        display: block;
    }

    .main-navigation ul {
        flex-direction: column;
        gap: 0.25rem;
    }

    .main-navigation a {
        padding: 0.5rem 0.75rem;
        border-radius: 0.6rem;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .site-header-inner {
        position: relative;
    }
}

@media (min-width: 768px) {
    .menu-toggle {
        display: none;
    }

    .sg-hero {
        padding: 2.7rem 2.4rem;
        display: grid;
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
        align-items: center;
        gap: 1.5rem;
    }

    .sg-hero-inner {
        max-width: none;
    }

    .site-content {
        flex-direction: row;
        align-items: flex-start;
        gap: 1.9rem;
    }

    .content-area {
        width: 68%;
    }

    .widget-area {
        width: 32%;
    }

    .sg-lessons-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sg-lesson-card,
    .sg-archive-card {
        grid-template-columns: 0.9fr 1.4fr;
        align-items: stretch;
    }

    .sg-related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .sg-hero {
        padding: 3rem 2.8rem;
    }

    .sg-hero h1 {
        font-size: 2.4rem;
    }

    .sg-lessons-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}


/* Force Latest Grammar Lessons to show one lesson per row even on desktop */
.sg-lessons-grid {
    grid-template-columns: 1fr !important;
}

/* Pagination styling under Latest Grammar Lessons */
.sg-lessons-pagination {
    margin-top: 1.25rem;
    font-size: 0.95rem;
}

.sg-lessons-pagination ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.sg-lessons-pagination li {
    margin: 0;
}

.sg-lessons-pagination a,
.sg-lessons-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 123, 255, 0.25);
    text-decoration: none;
}

.sg-lessons-pagination .current {
    background: #007BFF;
    color: #ffffff;
    border-color: #007BFF;
}

/* Back-to-top / back-to-start arrow */
.sg-back-to-top {
    position: fixed;
    right: 1rem;
    bottom: 1.1rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    background: #007BFF;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.2rem;
    box-shadow: 0 12px 26px rgba(0, 123, 255, 0.45);
    z-index: 999;
}

.sg-back-to-top:hover,
.sg-back-to-top:focus {
    text-decoration: none;
    background: #005fcc;
}
