﻿/*
Theme Name: Nàng Ther
Theme URI: https://ngocanhblog.com/
Author: Antigravity
Description: A minimalist, typography-first WordPress theme optimized for Core Web Vitals. Zero-framework, semantic HTML, and accessibility-ready.
Version: 1.1.0
Text Domain: aether
*/

:root {
    /* Colors - Light Theme (Default) */
    --bg-color: #fafafa;
    --text-main: #1a1a1a;
    --text-muted: #555555;
    --primary-color: #0056b3;
    --border-color: #e5e5e5;
    --progress-color: var(--primary-color);
    
    /* Fluid Typography using clamp() */
    --base-font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem); /* 16px to 18px */
    --h1-size: clamp(2rem, 1.8rem + 1vw, 2.5rem);
    --h2-size: clamp(1.5rem, 1.4rem + 0.5vw, 2rem);
    
    /* Fluid Spacing using clamp() */
    --spacing-sm: clamp(0.5rem, 0.4rem + 0.5vw, 0.75rem);
    --spacing-md: clamp(1rem, 0.8rem + 1vw, 1.5rem);
    --spacing-lg: clamp(1.5rem, 1.2rem + 1.5vw, 2.5rem);
    --spacing-xl: clamp(2.5rem, 2rem + 2.5vw, 4rem);
    
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    --container-width: 1000px;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-color: #121212;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --primary-color: #66b2ff;
    --border-color: #333333;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-color: #121212;
        --text-main: #e0e0e0;
        --text-muted: #a0a0a0;
        --primary-color: #66b2ff;
        --border-color: #333333;
    }
}

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

html {
    scroll-behavior: smooth;
}

body { 
    margin: 0; 
    padding: 0; 
    font-family: var(--font-sans); 
    background: var(--bg-color); 
    color: var(--text-main); 
    line-height: 1.6; 
    font-size: var(--base-font-size); 
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 { 
    font-family: var(--font-serif); 
    margin-top: 0; 
    line-height: 1.2; 
    font-weight: 700; 
    color: var(--text-main); 
    transition: color 0.3s ease;
}

h1 { font-size: var(--h1-size); }
h2 { font-size: var(--h2-size); }

a { 
    color: var(--primary-color); 
    text-decoration: none; 
    position: relative;
    transition: color 0.2s ease; 
}

/* Micro-interaction: Animated underline for links */
.post-content a:not(.post-thumbnail a) {
    background-image: linear-gradient(var(--primary-color), var(--primary-color));
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px;
    transition: background-size 0.3s ease;
}

.post-content a:not(.post-thumbnail a):hover, 
.post-content a:not(.post-thumbnail a):focus { 
    background-size: 100% 2px;
    color: #003d82; 
}

[data-theme="dark"] .post-content a:not(.post-thumbnail a):hover { color: #99ccff; }

img { 
    max-width: 100%; 
    height: auto; 
    display: block; 
    border-radius: 4px;
}

/* Reading Progress Bar */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--progress-color);
    transform-origin: 0 50%;
    transform: scaleX(0);
    z-index: 9999;
    pointer-events: none;
}

/* Layout */
.site-container { 
    max-width: var(--container-width); 
    margin: 0 auto; 
    padding: 0 var(--spacing-md); 
}

.site-header { 
    padding: var(--spacing-lg) 0; 
    border-bottom: 1px solid var(--border-color); 
    margin-bottom: var(--spacing-xl); 
    display: flex; 
    flex-wrap: wrap;
    justify-content: space-between; 
    align-items: center; 
    transition: border-color 0.3s ease;
}

.site-title { 
    margin: 0; 
    font-family: var(--font-sans); 
    font-weight: 700;
}

.site-title a { 
    color: var(--text-main); 
    text-decoration: none; 
}

.site-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.site-nav ul { 
    list-style: none; 
    margin: 0; 
    padding: 0; 
    display: flex; 
    gap: var(--spacing-md); 
}

/* Theme Toggle Button */
.theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.3s ease;
}

.theme-toggle:hover {
    background-color: rgba(0,0,0,0.05);
}
[data-theme="dark"] .theme-toggle:hover {
    background-color: rgba(255,255,255,0.1);
}

.site-main { 
    min-height: 60vh; 
    transition: opacity 0.2s ease-in-out;
}

.site-footer { 
    margin-top: var(--spacing-xl); 
    padding: var(--spacing-lg) 0; 
    border-top: 1px solid var(--border-color); 
    text-align: center; 
    color: var(--text-muted); 
    font-size: 0.9rem; 
    transition: border-color 0.3s ease, color 0.3s ease;
}

/* Components: Post List (Grid Layout) */
.post-list { 
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
    list-style: none; 
    padding: 0; 
    margin: 0; 
}

@media (min-width: 768px) {
    .post-list {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-xl) var(--spacing-lg);
    }
}

.post-item { 
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    height: 100%;
}
.post-item:hover {
    transform: translateY(-4px);
}

.post-thumbnail-link {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: var(--spacing-md);
    aspect-ratio: 16 / 10;
    background: rgba(0,0,0,0.03);
}
[data-theme="dark"] .post-thumbnail-link { background: rgba(255,255,255,0.05); }

.post-thumbnail {
    margin: 0;
    height: 100%;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.post-item:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-item-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.post-category {
    margin-bottom: var(--spacing-sm);
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-category a {
    color: var(--primary-color);
    background-image: none; /* remove global link underline */
}

.post-title { 
    font-size: var(--h2-size);
    margin-bottom: var(--spacing-sm); 
    line-height: 1.3;
}
.post-title a {
    color: var(--text-main);
    background-image: none;
}
.post-title a:hover {
    color: var(--primary-color);
}

.post-meta { 
    font-size: 0.85rem; 
    color: var(--text-muted); 
    margin-bottom: var(--spacing-md); 
}

.entry-summary {
    font-size: 1rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0;
}

/* Components: Single Post Content */
.post-content { 
    font-family: var(--font-serif); 
    line-height: 1.8; 
}

.post-content p { 
    margin-bottom: 1.5em; 
}

.post-content h2, .post-content h3 {
    margin-top: 2em;
    margin-bottom: 0.75em;
}

.post-content blockquote {
    margin: 2em 0;
    padding-left: 1.5em;
    border-left: 4px solid var(--primary-color);
    font-style: italic;
    color: var(--text-muted);
}

.post-content pre {
    background: rgba(0,0,0,0.05);
    padding: 1rem;
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.9rem;
    border-radius: 4px;
}
[data-theme="dark"] .post-content pre {
    background: rgba(255,255,255,0.05);
}

.entry-footer {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Pagination */
.pagination { 
    display: flex; 
    justify-content: space-between; 
    margin-top: var(--spacing-xl); 
}

.nav-links { 
    display: flex; 
    gap: var(--spacing-sm); 
}

.nav-links .page-numbers { 
    padding: 0.5rem 1rem; 
    border: 1px solid var(--border-color); 
    border-radius: 4px; 
    transition: all 0.2s;
    color: var(--text-main);
}

.nav-links .current { 
    background: var(--text-main); 
    color: var(--bg-color); 
    border-color: var(--text-main); 
}

.nav-links a.page-numbers:hover {
    background: rgba(0,0,0,0.05);
}
[data-theme="dark"] .nav-links a.page-numbers:hover {
    background: rgba(255,255,255,0.1);
}

/* 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 !important; 
}

.screen-reader-text:focus {
    background-color: var(--bg-color);
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    clip-path: none;
    color: var(--text-main);
    display: block;
    font-size: 1rem;
    font-weight: bold;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* Mobile Menu */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
    z-index: 100;
    transition: color 0.3s ease;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .site-nav-wrapper {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--bg-color);
        box-shadow: -5px 0 15px rgba(0,0,0,0.05);
        transition: right 0.3s ease, background-color 0.3s ease;
        z-index: 90;
        padding: var(--spacing-xl) var(--spacing-md);
        display: flex;
        flex-direction: column;
    }

    [data-theme="dark"] .site-nav-wrapper {
        box-shadow: -5px 0 15px rgba(0,0,0,0.5);
    }

    body.is-menu-open .site-nav-wrapper {
        right: 0;
    }

    .site-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-lg);
    }

    .site-nav ul {
        flex-direction: column;
        width: 100%;
    }

    .site-nav ul li a {
        display: block;
        padding: 0.5rem 0;
        font-size: 1.25rem;
    }

    /* Body overlay */
    body::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.4);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 80;
    }

    body.is-menu-open {
        overflow: hidden;
    }

    body.is-menu-open::after {
        opacity: 1;
        visibility: visible;
    }
}

/* Custom Logo */
.site-logo img {
    max-height: 50px;
    width: auto;
}

/* Table of Contents */
.table-of-contents {
    background: rgba(0,0,0,0.03);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: 8px;
    margin: var(--spacing-lg) 0;
    border-left: 4px solid var(--primary-color);
}
[data-theme="dark"] .table-of-contents {
    background: rgba(255,255,255,0.05);
}
.table-of-contents strong {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-family: var(--font-sans);
    font-size: 1.1rem;
}
.table-of-contents ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.table-of-contents ul li {
    margin-bottom: 0.5rem;
}
.table-of-contents ul li a {
    color: var(--text-muted);
    background-image: none; /* remove animated underline for toc */
}
.table-of-contents ul li a:hover {
    color: var(--primary-color);
}

/* Dropdown Menus (Multi-level Support) */
.site-nav ul li.menu-item-has-children > a::after {
    content: " ▾";
    font-size: 0.8em;
    opacity: 0.7;
}

@media (min-width: 769px) {
    .site-nav ul li {
        position: relative;
    }

    .site-nav ul .sub-menu {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        min-width: 200px;
        background: var(--bg-color);
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        border: 1px solid var(--border-color);
        border-radius: 4px;
        padding: 0.5rem 0;
        flex-direction: column;
        gap: 0;
        
        /* Hidden by default */
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: all 0.2s ease;
        z-index: 100;
    }

    [data-theme="dark"] .site-nav ul .sub-menu {
        box-shadow: 0 4px 6px rgba(0,0,0,0.5);
    }

    /* Show on hover / focus */
    .site-nav ul li:hover > .sub-menu,
    .site-nav ul li:focus-within > .sub-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .site-nav ul .sub-menu li {
        width: 100%;
    }

    .site-nav ul .sub-menu li a {
        display: block;
        padding: 0.5rem 1rem;
        font-size: 1rem;
        white-space: nowrap;
    }

    .site-nav ul .sub-menu li a:hover {
        background: rgba(0,0,0,0.03);
    }
    
    [data-theme="dark"] .site-nav ul .sub-menu li a:hover {
        background: rgba(255,255,255,0.05);
    }
    
    /* Support for multi-level (sub-menu inside sub-menu) */
    .site-nav ul .sub-menu .sub-menu {
        top: 0;
        left: 100%;
    }
}

/* Mobile Dropdown Sub-menu */
@media (max-width: 768px) {
    .site-nav ul .sub-menu {
        display: flex;
        flex-direction: column;
        padding-left: 1.5rem;
        margin-top: 0.5rem;
        gap: 0.5rem;
        border-left: 2px solid var(--border-color);
    }
    
    .site-nav ul .sub-menu li a {
        font-size: 1.1rem;
        padding: 0.2rem 0;
    }
}

/* Comments Area (Zero-Avatar Style) */
.comments-area {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-xl);
    border-top: 2px solid var(--border-color);
}

.comments-title, .comment-reply-title {
    font-size: var(--h2-size);
    margin-bottom: var(--spacing-lg);
}

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

.comment-list .children {
    list-style: none;
    padding-left: 1.5rem;
    margin-left: 0.5rem;
    border-left: 2px solid var(--border-color);
}

.custom-comment-box {
    margin-bottom: var(--spacing-lg);
}

.comment-body {
    background: rgba(0,0,0,0.03);
    padding: var(--spacing-md);
    border-radius: 8px;
}

[data-theme="dark"] .comment-body {
    background: rgba(255,255,255,0.05);
}

.comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: var(--spacing-sm);
}

.comment-author.vcard {
    font-weight: 700;
    font-size: 1.1rem;
}

.comment-metadata a {
    color: var(--text-muted);
    font-size: 0.85rem;
    background-image: none;
}

.comment-metadata a:hover {
    color: var(--primary-color);
}

.comment-content p {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.comment-content p:last-child {
    margin-bottom: 0;
}

.comment-reply {
    margin-top: 0.5rem;
}

.reply-link-wrapper a {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-image: none;
}

.reply-link-wrapper a:hover {
    color: var(--primary-color);
}

/* Comment Form */
.comment-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.comment-form label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: transparent;
    color: var(--text-main);
    font-family: var(--font-sans);
}

.comment-form textarea {
    min-height: 120px;
    resize: vertical;
}

.comment-form .submit-btn {
    align-self: flex-start;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.comment-form .submit-btn:hover {
    opacity: 0.9;
}
