/* ============================================================
   ULTRAFASTBLOG THEME - RESPONSIVE STYLES (MOBILE-FIRST)
   Mobile-First Approach: Base styles are mobile, enhanced with breakpoints
   ============================================================ */

/* ============================================================
   SMALL MOBILE DEVICES BASE (320px - 479px) 
   - This is the base mobile experience
   ============================================================ */

/* Typography adjustments for small screens */
@media (max-width: 479px) {
    html {
        font-size: 14px;
        scroll-padding-top: 60px;
    }

    body {
        font-size: 14px;
        line-height: 1.6;
    }

    h1 { 
        font-size: 1.5rem;
        margin: 1rem 0 0.75rem;
        line-height: 1.2;
    }
    h2 { 
        font-size: 1.25rem;
        margin: 0.875rem 0 0.625rem;
    }
    h3 { 
        font-size: 1.1rem;
        margin: 0.75rem 0 0.5rem;
    }
    h4 { 
        font-size: 1rem;
    }
    h5, h6 { 
        font-size: 0.95rem;
    }

    p {
        margin-bottom: 1rem;
    }

    /* Container & Layout */
    .container {
        padding: 0 0.75rem;
        margin: 0 auto;
    }

    /* Header */
    .site-header {
        padding: 0.75rem 0;
        position: relative;
        z-index: 100;
    }

    .site-header-inner {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 0.75rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .site-branding {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .site-logo img {
        max-width: 100px;
        height: auto;
    }

    .site-title {
        font-size: 1.1rem;
        margin: 0;
        font-weight: 700;
    }

    /* Mobile Menu Button */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: 1px solid var(--border-color);
        padding: 0.5rem;
        cursor: pointer;
        border-radius: 4px;
        min-width: 44px;
        min-height: 44px;
    }

    .mobile-menu-toggle:hover {
        background-color: var(--border-color);
    }

    /* Main Navigation - Hidden by default, shown with .is-active */
    .main-menu {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--bg-color);
        z-index: 99;
        padding-top: 70px;
        overflow-y: auto;
    }

    .main-menu.is-active {
        display: flex;
        flex-direction: column;
    }

    .main-menu li {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }

    .main-menu a {
        display: block;
        padding: 1rem 0.75rem;
        color: var(--text-color);
        text-decoration: none;
        border: none;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .main-menu a:hover,
    .main-menu a:focus {
        background-color: var(--border-color);
        color: var(--primary-color);
    }

    .main-menu ul {
        margin-left: 1rem;
    }

    /* Main Content Layout */
    .site-content {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        padding: 1rem 0;
    }

    .main-content {
        flex: 1;
        min-width: 0;
    }

    .sidebar {
        flex: 1;
        order: 2;
        width: 100%;
    }

    /* Blog Grid / Posts */
    .posts-grid,
    .blog-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin: 1.5rem 0;
    }

    .post-card {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        padding: 0;
        background: transparent;
        border: none;
    }

    .post-card-thumbnail {
        width: 100%;
        aspect-ratio: 16 / 9;
        overflow: hidden;
        border-radius: 4px;
    }

    .post-card-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .post-card-header {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .post-card-title {
        font-size: 1.1rem;
        margin: 0;
        line-height: 1.3;
    }

    .post-card-title a {
        color: var(--text-color);
        text-decoration: none;
    }

    .post-card-title a:hover {
        color: var(--primary-color);
    }

    .post-card-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
        font-size: 0.875rem;
        color: var(--muted-color);
    }

    .post-card-excerpt {
        font-size: 0.95rem;
        line-height: 1.6;
        color: var(--text-color);
    }

    /* Single Post */
    .single-post {
        padding: 0;
        background: transparent;
        border: none;
    }

    .post-title {
        font-size: 1.5rem;
        margin: 1rem 0 0.5rem;
        line-height: 1.2;
    }

    .post-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 1.5rem;
        font-size: 0.875rem;
        color: var(--muted-color);
        margin-bottom: 1.5rem;
    }

    .post-thumbnail {
        width: 100%;
        max-height: 300px;
        aspect-ratio: 16 / 9;
        object-fit: cover;
        margin: 1.5rem 0;
        border-radius: 4px;
    }

    .post-content {
        line-height: 1.8;
        word-wrap: break-word;
    }

    .post-content img {
        max-width: 100%;
        height: auto;
        margin: 1rem 0;
        border-radius: 4px;
    }

    .post-content p {
        margin-bottom: 1.25rem;
    }

    .post-content ol,
    .post-content ul {
        margin-bottom: 1.25rem;
        padding-left: 1.5rem;
    }

    .post-content li {
        margin-bottom: 0.5rem;
    }

    .post-content blockquote {
        margin: 1.5rem 0;
        padding: 1rem;
        padding-left: 1rem;
        border-left: 4px solid var(--primary-color);
        background-color: var(--border-color);
        font-style: italic;
    }

    .post-content code {
        background-color: var(--border-color);
        padding: 0.25rem 0.5rem;
        border-radius: 3px;
        font-family: 'Courier New', monospace;
        font-size: 0.9rem;
    }

    .post-content pre {
        background-color: #f5f5f5;
        padding: 1rem;
        border-radius: 4px;
        overflow-x: auto;
        margin: 1rem 0;
    }

    .post-content pre code {
        background: none;
        padding: 0;
    }

    /* Author Box */
    .author-box {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
        margin: 2rem 0;
        background-color: var(--border-color);
        border-radius: 4px;
    }

    .author-box-avatar {
        display: flex;
        justify-content: center;
    }

    .author-box-avatar img {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        object-fit: cover;
    }

    .author-box-info {
        text-align: center;
    }

    .author-box-name {
        font-size: 1rem;
        font-weight: 700;
        margin: 0;
    }

    .author-box-bio {
        font-size: 0.875rem;
        color: var(--muted-color);
        margin: 0.5rem 0;
    }

    .author-box-social {
        display: flex;
        justify-content: center;
        gap: 1rem;
        flex-wrap: wrap;
    }

    .author-box-social a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background-color: var(--primary-color);
        color: white;
        border-radius: 50%;
        text-decoration: none;
        font-size: 0.9rem;
    }

    .author-box-social a:hover {
        opacity: 0.8;
    }

    /* Related Posts */
    .related-posts {
        margin: 2rem 0;
    }

    .related-posts-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .related-posts-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    /* Sidebar & Widgets */
    .widget {
        background: transparent;
        padding: 0;
        margin-bottom: 2rem;
        border: none;
    }

    .widget-title {
        font-size: 1rem;
        margin: 0 0 1rem;
        padding-bottom: 0.75rem;
        border-bottom: 2px solid var(--primary-color);
        font-weight: 700;
    }

    .widget ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .widget ul li {
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--border-color);
    }

    .widget ul li:last-child {
        border-bottom: none;
    }

    .widget ul a {
        color: var(--text-color);
        text-decoration: none;
    }

    .widget ul a:hover {
        color: var(--primary-color);
    }

    /* Forms */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="url"],
    input[type="number"],
    input[type="search"],
    input[type="tel"],
    textarea,
    select {
        width: 100%;
        min-height: 44px;
        padding: 0.75rem;
        font-size: 16px;
        border: 1px solid var(--border-color);
        border-radius: 4px;
        font-family: inherit;
        margin-bottom: 1rem;
    }

    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="password"]:focus,
    input[type="url"]:focus,
    input[type="number"]:focus,
    input[type="search"]:focus,
    input[type="tel"]:focus,
    textarea:focus,
    select:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }

    button,
    input[type="submit"],
    input[type="button"],
    .btn {
        width: 100%;
        min-height: 44px;
        padding: 0.75rem 1.5rem;
        background-color: var(--primary-color);
        color: white;
        border: none;
        border-radius: 4px;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        transition: background-color 0.2s;
    }

    button:hover,
    input[type="submit"]:hover,
    input[type="button"]:hover,
    .btn:hover {
        background-color: #1d4ed8;
    }

    button:active,
    input[type="submit"]:active,
    input[type="button"]:active,
    .btn:active {
        transform: scale(0.98);
    }

    /* Comments */
    .comments-area {
        margin: 2rem 0;
    }

    .comments-title {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .comment-list {
        list-style: none;
        padding: 0;
        margin: 0 0 1.5rem;
    }

    .comment {
        display: flex;
        gap: 1rem;
        margin-bottom: 1.5rem;
        padding: 1rem;
        background-color: var(--border-color);
        border-radius: 4px;
    }

    .comment-author img {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        object-fit: cover;
    }

    .comment-body {
        flex: 1;
    }

    .comment-meta {
        font-size: 0.875rem;
        color: var(--muted-color);
        margin-bottom: 0.5rem;
    }

    .comment-text {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .comment-reply-link {
        font-size: 0.875rem;
        color: var(--primary-color);
        text-decoration: none;
        margin-top: 0.5rem;
        display: inline-block;
    }

    .comment-children {
        list-style: none;
        padding: 0;
        margin: 1rem 0 1rem 1rem;
    }

    .comment-form {
        background-color: var(--border-color);
        padding: 1.5rem;
        border-radius: 4px;
        margin-top: 1.5rem;
    }

    .comment-form-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    .form-submit {
        margin-top: 1rem;
    }

    /* Pagination */
    .pagination {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 0.25rem;
        flex-wrap: wrap;
        margin: 2rem 0;
        padding: 1rem 0;
    }

    .pagination a,
    .pagination .page-number,
    .pagination .dots {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem 0.75rem;
        border: 1px solid var(--border-color);
        border-radius: 4px;
        color: var(--text-color);
        text-decoration: none;
        font-size: 0.95rem;
    }

    .pagination a:hover {
        background-color: var(--primary-color);
        color: white;
        border-color: var(--primary-color);
    }

    .pagination .page-number.current {
        background-color: var(--primary-color);
        color: white;
        border-color: var(--primary-color);
    }

    /* Breadcrumb */
    .breadcrumb {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        font-size: 0.875rem;
        color: var(--muted-color);
        margin: 1rem 0;
        padding: 0;
    }

    .breadcrumb a {
        color: var(--primary-color);
        text-decoration: none;
    }

    .breadcrumb a:hover {
        text-decoration: underline;
    }

    /* Footer */
    .site-footer {
        margin-top: 3rem;
        padding: 2rem 0 1rem;
        background-color: #f9f9f9;
        border-top: 1px solid var(--border-color);
    }

    .footer-widgets {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2rem;
        margin-bottom: 2rem;
    }

    .footer-bottom {
        text-align: center;
        font-size: 0.875rem;
        color: var(--muted-color);
        padding-top: 1rem;
        border-top: 1px solid var(--border-color);
    }

    /* Utilities */
    .text-center { text-align: center; }
    .text-left { text-align: left; }
    .text-right { text-align: right; }

    .mt-1 { margin-top: 0.5rem; }
    .mt-2 { margin-top: 1rem; }
    .mt-3 { margin-top: 1.5rem; }
    .mt-4 { margin-top: 2rem; }

    .mb-1 { margin-bottom: 0.5rem; }
    .mb-2 { margin-bottom: 1rem; }
    .mb-3 { margin-bottom: 1.5rem; }
    .mb-4 { margin-bottom: 2rem; }

    .p-1 { padding: 0.5rem; }
    .p-2 { padding: 1rem; }
    .p-3 { padding: 1.5rem; }

    .hidden { display: none !important; }
    .visible { display: block !important; }
}

/* ============================================================
   TABLET DEVICES (480px - 767px)
   ============================================================ */

@media (min-width: 480px) and (max-width: 767px) {
    html {
        font-size: 15px;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    .container {
        padding: 0 1rem;
    }

    .site-header {
        padding: 1rem 0;
    }

    .site-logo img {
        max-width: 120px;
    }

    .site-title {
        font-size: 1.35rem;
    }

    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .post-card {
        flex-direction: column;
    }

    .post-title {
        font-size: 1.5rem;
    }

    .footer-widgets {
        grid-template-columns: repeat(2, 1fr);
    }

    button,
    input[type="submit"],
    .btn {
        width: auto;
        display: inline-block;
    }
}

/* ============================================================
   MEDIUM TABLETS & SMALL DESKTOPS (768px - 1023px)
   ============================================================ */

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }

    .container {
        padding: 0 1.5rem;
    }

    .site-header {
        padding: 1.25rem 0;
    }

    .site-header-inner {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 1.5rem;
        gap: 2rem;
    }

    .site-logo img {
        max-width: 140px;
    }

    .site-title {
        font-size: 1.5rem;
    }

    .mobile-menu-toggle {
        display: none !important;
    }

    .main-menu {
        display: flex !important;
        position: static;
        flex-direction: row;
        gap: 2rem;
        background: none;
        padding: 0;
        z-index: auto;
    }

    .main-menu li {
        width: auto;
        border: none;
    }

    .main-menu a {
        padding: 0;
        min-height: auto;
        border-bottom: 2px solid transparent;
    }

    .main-menu a:hover {
        background: none;
        border-bottom-color: var(--primary-color);
    }

    .main-menu ul {
        display: none;
        position: absolute;
        flex-direction: column;
        margin: 0;
    }

    .main-menu li:hover > ul {
        display: flex;
    }

    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1.5rem;
    }

    .site-content {
        flex-direction: row;
        gap: 2rem;
    }

    .sidebar {
        flex: 0 0 300px;
        order: auto;
        width: auto;
    }

    .footer-widgets {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }

    button,
    input[type="submit"],
    .btn {
        width: auto;
        display: inline-block;
    }

    .comment {
        flex-direction: row;
    }
}

/* ============================================================
   LARGE DESKTOPS (1024px+)
   ============================================================ */

@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }

    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 2rem;
    }

    .footer-widgets {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
    * {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 12pt;
    }

    a,
    a:visited {
        text-decoration: underline;
        color: #000;
    }

    a[href]:after {
        content: " (" attr(href) ")";
    }

    img {
        max-width: 100% !important;
    }

    .no-print,
    .mobile-menu-toggle,
    .mobile-menu,
    .comments-area,
    .sidebar,
    .pagination,
    .author-box {
        display: none !important;
    }

    .post-title {
        font-size: 18pt;
        margin-bottom: 0.5in;
    }

    .post-content {
        line-height: 1.8;
    }

    .post-meta {
        margin-bottom: 0.5in;
        font-size: 10pt;
    }

    .site-footer {
        margin-top: 0.5in;
        padding-top: 0.5in;
        border-top: 1px solid #000;
    }
}
