/*
Theme Name: GSM Theme
Theme URI: https://gsmcalculator.com
Author: GSM Calculator
Author URI: https://gsmcalculator.com
Description: A modern, responsive theme for the GSM Calculator blog — clean typography, card-based post layout, and fast performance.
Version: 1.1
Requires at least: 5.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: gsm-theme
*/

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-primary: #1a1a2e;
    --color-secondary: #16213e;
    --color-accent: #0f3460;
    --color-highlight: #e94560;
    --color-text: #333;
    --color-text-light: #666;
    --color-text-muted: #999;
    --color-bg: #f7f8fa;
    --color-white: #fff;
    --color-border: #e2e6ea;
    --color-card-shadow: rgba(0, 0, 0, 0.06);
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-heading: 'Georgia', 'Times New Roman', serif;
    --max-width: 1200px;
    --content-width: 780px;
    --sidebar-width: 340px;
    --gap: 32px;
    --radius: 8px;
    --transition: 0.2s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-primary);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-highlight); }

img { max-width: 100%; height: auto; display: block; }
ul, ol { padding-left: 1.5em; }

/* === LAYOUT === */
.site-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
.site-content { flex: 1; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.content-area {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: var(--gap);
    padding: 48px 0;
}

.content-area.no-sidebar {
    grid-template-columns: 1fr;
    max-width: var(--content-width);
    margin: 0 auto;
}

/* === HEADER === */
.site-header {
    background: var(--color-primary);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    max-width: var(--max-width);
    margin: 0 auto;
    height: 64px;
}

.site-branding a {
    color: var(--color-white);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.site-branding a:hover { color: var(--color-white); opacity: 0.9; }

.site-description {
    display: none;
}

/* === NAVIGATION === */
.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 4px;
    padding: 0;
}

.main-navigation a {
    color: rgba(255, 255, 255, 0.75);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
}

.main-navigation a:hover,
.main-navigation .current-menu-item a,
.main-navigation .current_page_item a {
    color: var(--color-white);
    background: rgba(255, 255, 255, 0.1);
}

/* Sub-menus */
.main-navigation li { position: relative; }

.main-navigation ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 200px;
    padding: 8px 0;
    flex-direction: column;
    z-index: 200;
}

.main-navigation li:hover > ul { display: flex; }

.main-navigation ul ul a {
    color: var(--color-text);
    padding: 8px 20px;
    border-radius: 0;
    font-size: 0.88rem;
}

.main-navigation ul ul a:hover {
    background: var(--color-bg);
    color: var(--color-accent);
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-white);
    cursor: pointer;
    padding: 8px;
    font-size: 1.5rem;
    line-height: 1;
}

/* === HERO / PAGE HEADER === */
.page-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 50%, #0d1b2a 100%);
    color: var(--color-white);
    padding: 56px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 60px,
        rgba(255,255,255,0.01) 60px,
        rgba(255,255,255,0.01) 61px
    );
    pointer-events: none;
}

.page-header h1 {
    font-family: var(--font-heading);
    font-size: 2.6rem;
    font-weight: 700;
    margin-bottom: 12px;
    position: relative;
    letter-spacing: -0.02em;
}

.page-header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.05rem;
    max-width: 560px;
    margin: 0 auto;
    position: relative;
    font-weight: 300;
    letter-spacing: 0.01em;
}

.page-header .post-count {
    display: inline-block;
    margin-top: 20px;
    padding: 6px 18px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-weight: 500;
    position: relative;
}

/* === POST CARDS (Archive/Home) === */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
}

.post-card {
    background: var(--color-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
    border: 1px solid var(--color-border);
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
    border-color: transparent;
}

.post-card-thumb {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-accent) 100%);
    position: relative;
}

.post-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-card:hover .post-card-thumb img {
    transform: scale(1.05);
}

/* Placeholder when no featured image */
.post-card-thumb-placeholder {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 60%, #1a3a5c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.post-card-thumb-placeholder::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 20px,
        rgba(255,255,255,0.015) 20px,
        rgba(255,255,255,0.015) 40px
    );
}

.post-card-thumb-placeholder .placeholder-icon {
    font-size: 2.4rem;
    opacity: 0.25;
    color: #fff;
    position: relative;
    z-index: 1;
}

.post-card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 500;
}

.post-card-meta .meta-sep { color: var(--color-border); }
.post-card-meta a { color: var(--color-accent); font-weight: 600; }
.post-card-meta a:hover { color: var(--color-highlight); }

.post-card-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    line-height: 1.4;
    margin-bottom: 12px;
    font-weight: 700;
}

.post-card-title a { color: var(--color-text); }
.post-card-title a:hover { color: var(--color-accent); }

.post-card-excerpt {
    color: var(--color-text-light);
    font-size: 0.9rem;
    line-height: 1.65;
    margin-bottom: 20px;
    flex: 1;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: gap var(--transition), color var(--transition);
}

.read-more:hover { gap: 10px; color: var(--color-highlight); }

/* Featured / first post full width */
.post-card.post-card-featured {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.post-card-featured .post-card-thumb,
.post-card-featured .post-card-thumb-placeholder {
    aspect-ratio: auto;
    min-height: 280px;
}

.post-card-featured .post-card-title {
    font-size: 1.5rem;
}

.post-card-featured .post-card-excerpt {
    font-size: 0.95rem;
}

.post-card-featured .post-card-body {
    padding: 32px;
    justify-content: center;
}

/* === SINGLE POST === */
.single-post-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: var(--color-white);
    padding: 56px 0 48px;
    text-align: center;
}

.single-post-header .post-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 16px;
}

.single-post-header .post-meta a { color: rgba(255, 255, 255, 0.65); }
.single-post-header .post-meta a:hover { color: var(--color-white); }

.single-post-header h1 {
    font-family: var(--font-heading);
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1.25;
    max-width: 720px;
    margin: 0 auto;
}

.single-featured-image {
    max-width: var(--content-width);
    margin: -32px auto 0;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    position: relative;
    z-index: 1;
}

.single-featured-image img {
    width: 100%;
    display: block;
}

/* === POST CONTENT === */
.entry-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--color-text);
}

.entry-content > * + * { margin-top: 1.5em; }
.entry-content h2 { font-family: var(--font-heading); font-size: 1.6rem; margin-top: 2em; line-height: 1.3; }
.entry-content h3 { font-family: var(--font-heading); font-size: 1.3rem; margin-top: 1.8em; line-height: 1.35; }
.entry-content h4 { font-size: 1.1rem; margin-top: 1.5em; font-weight: 600; }

.entry-content blockquote {
    border-left: 4px solid var(--color-accent);
    padding: 16px 24px;
    margin: 2em 0;
    background: var(--color-bg);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--color-text-light);
}

.entry-content pre {
    background: var(--color-primary);
    color: #e0e0e0;
    padding: 20px 24px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.6;
}

.entry-content code {
    background: var(--color-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.entry-content pre code { background: none; padding: 0; }

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
}

.entry-content th,
.entry-content td {
    border: 1px solid var(--color-border);
    padding: 10px 14px;
    text-align: left;
}

.entry-content th {
    background: var(--color-bg);
    font-weight: 600;
}

.entry-content figure { margin: 2em 0; }
.entry-content figcaption {
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 8px;
}

/* === POST NAVIGATION === */
.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--color-border);
}

.post-navigation a {
    display: block;
    padding: 16px 20px;
    background: var(--color-bg);
    border-radius: var(--radius);
    transition: background var(--transition);
}

.post-navigation a:hover { background: var(--color-border); }

.post-navigation .nav-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.post-navigation .nav-title {
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.95rem;
}

.post-navigation .nav-next { text-align: right; }

/* === SIDEBAR === */
.site-sidebar { position: sticky; top: 88px; align-self: start; }

.widget {
    background: var(--color-white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid var(--color-border);
    margin-bottom: 24px;
}

.widget-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-accent);
}

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

.widget li {
    padding: 6px 0;
    border-bottom: 1px solid var(--color-bg);
    font-size: 0.92rem;
}

.widget li:last-child { border-bottom: none; }

.widget select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.92rem;
}

/* Search widget */
.search-form {
    display: flex;
    gap: 0;
}

.search-field {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 0.92rem;
    outline: none;
    transition: border-color var(--transition);
}

.search-field:focus { border-color: var(--color-accent); }

.search-submit {
    padding: 10px 18px;
    background: var(--color-accent);
    color: var(--color-white);
    border: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    transition: background var(--transition);
}

.search-submit:hover { background: var(--color-primary); }

/* === COMMENTS === */
.comments-area {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--color-border);
}

.comments-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin-bottom: 24px;
}

.comment-list {
    list-style: none;
    padding: 0;
}

.comment-body {
    padding: 20px 0;
    border-bottom: 1px solid var(--color-bg);
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.comment-author img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.comment-author .fn { font-weight: 600; font-size: 0.95rem; }

.comment-metadata {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.comment-content { font-size: 0.95rem; }

.comment-respond { margin-top: 32px; }

.comment-form label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: var(--font-primary);
    margin-bottom: 16px;
    transition: border-color var(--transition);
}

.comment-form input:focus,
.comment-form textarea:focus {
    border-color: var(--color-accent);
    outline: none;
}

.comment-form .submit {
    background: var(--color-accent);
    color: var(--color-white);
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}

.comment-form .submit:hover { background: var(--color-primary); }

/* === PAGINATION === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--color-border);
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
}

.pagination a {
    background: var(--color-white);
    color: var(--color-text);
    box-shadow: 0 1px 4px var(--color-card-shadow);
}

.pagination a:hover {
    background: var(--color-accent);
    color: var(--color-white);
}

.pagination .current {
    background: var(--color-accent);
    color: var(--color-white);
}

/* === FOOTER === */
.site-footer {
    background: var(--color-primary);
    color: rgba(255, 255, 255, 0.7);
    margin-top: auto;
}

.footer-widgets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap);
    padding: 48px 0 32px;
}

.footer-widgets .widget {
    background: none;
    box-shadow: none;
    padding: 0;
}

.footer-widgets .widget-title {
    color: var(--color-white);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.footer-widgets .widget a { color: rgba(255, 255, 255, 0.6); }
.footer-widgets .widget a:hover { color: var(--color-white); }
.footer-widgets .widget li { border-bottom-color: rgba(255, 255, 255, 0.06); }

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
}

.footer-bottom a { color: rgba(255, 255, 255, 0.5); }
.footer-bottom a:hover { color: var(--color-white); }

/* === 404 === */
.error-404 {
    text-align: center;
    padding: 80px 0;
}

.error-404 h1 {
    font-size: 6rem;
    font-weight: 800;
    color: var(--color-border);
    line-height: 1;
}

.error-404 p { font-size: 1.1rem; color: var(--color-text-light); margin: 16px 0 32px; }

/* === POST TAGS === */
.post-tags { margin-top: 32px; }

.tag-list a {
    display: inline-block;
    padding: 4px 14px;
    margin: 4px 4px 4px 0;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 0.82rem;
    color: var(--color-text-light);
    transition: all var(--transition);
}

.tag-list a:hover {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-white);
}

/* === NO RESULTS === */
.no-results {
    text-align: center;
    padding: 64px 0;
}

.no-results h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    margin-bottom: 12px;
}

.no-results p {
    color: var(--color-text-light);
    margin-bottom: 24px;
}

.no-results .search-form {
    max-width: 400px;
    margin: 0 auto;
}

/* === SCREEN READER TEXT (accessibility) === */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal;
}

.screen-reader-text:focus {
    background: var(--color-white);
    clip: auto;
    clip-path: none;
    color: var(--color-text);
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 12px 20px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* === WP ALIGNMENT === */
.alignwide { max-width: calc(var(--content-width) + 120px); margin-left: auto; margin-right: auto; }
.alignfull { max-width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.alignleft { float: left; margin: 0.5em 1.5em 0.5em 0; }
.alignright { float: right; margin: 0.5em 0 0.5em 1.5em; }
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: 0.85rem; color: var(--color-text-muted); text-align: center; margin-top: 8px; }

/* === RESPONSIVE === */
@media (max-width: 968px) {
    .content-area {
        grid-template-columns: 1fr;
    }

    .site-sidebar {
        position: static;
    }

    .footer-widgets {
        grid-template-columns: 1fr 1fr;
    }

    .post-card.post-card-featured {
        grid-template-columns: 1fr;
    }

    .post-card-featured .post-card-thumb,
    .post-card-featured .post-card-thumb-placeholder {
        aspect-ratio: 16 / 9;
        min-height: auto;
    }
}

@media (max-width: 768px) {
    :root { --gap: 20px; }

    .header-inner { padding: 0 16px; }

    .menu-toggle { display: block; }

    .main-navigation {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--color-primary);
        padding: 16px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    }

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

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

    .main-navigation a {
        display: block;
        padding: 12px 16px;
    }

    .main-navigation ul ul {
        position: static;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 0;
    }

    .main-navigation ul ul a { color: rgba(255, 255, 255, 0.7); }

    .page-header { padding: 32px 0; }
    .page-header h1 { font-size: 1.6rem; }

    .single-post-header { padding: 36px 0 32px; }
    .single-post-header h1 { font-size: 1.7rem; }

    .posts-grid { grid-template-columns: 1fr; }

    .post-navigation { grid-template-columns: 1fr; }

    .footer-widgets { grid-template-columns: 1fr; }

    .footer-bottom {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .container { padding: 0 16px; }
}

@media (max-width: 480px) {
    .single-post-header h1 { font-size: 1.4rem; }
    .entry-content { font-size: 1rem; }
    .entry-content h2 { font-size: 1.35rem; }
    .entry-content h3 { font-size: 1.15rem; }
}
