/*
Theme Name: Unchange
Theme URI: https://github.com/ssunchange/unchange
Author: ssunchange
Description: A clean and modern WordPress blog/media theme
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: unchange
Tags: blog, news, media, clean, modern, responsive, custom-menu, featured-images, post-formats
*/

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

:root {
  --color-primary:   #1a1a2e;
  --color-accent:    #e94560;
  --color-bg:        #f8f8f8;
  --color-surface:   #ffffff;
  --color-text:      #2d2d2d;
  --color-muted:     #888888;
  --color-border:    #e5e5e5;
  --font-sans:       'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-serif:      'Georgia', 'Times New Roman', serif;
  --radius:          8px;
  --shadow:          0 2px 12px rgba(0,0,0,0.08);
  --max-width:       1200px;
  --content-width:   720px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
}

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

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: opacity .2s;
}
a:hover { opacity: .75; }

ul { list-style: none; }

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

.site-main {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 48px;
  padding: 48px 0;
}

@media (max-width: 900px) {
  .site-main { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
}

/* ========================================
   Header
======================================== */
.site-header {
  background: var(--color-primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-branding a {
  color: #fff;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.site-branding span { color: var(--color-accent); }

/* Nav */
.main-navigation ul {
  display: flex;
  gap: 8px;
  align-items: center;
}

.main-navigation a {
  color: rgba(255,255,255,0.85);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 4px;
  transition: background .2s, color .2s;
}

.main-navigation a:hover,
.main-navigation .current-menu-item a {
  background: rgba(255,255,255,0.12);
  color: #fff;
  opacity: 1;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
}

@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .main-navigation { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--color-primary); padding: 16px 24px; }
  .main-navigation.is-open { display: block; }
  .main-navigation ul { flex-direction: column; align-items: flex-start; }
}

/* ========================================
   Hero / Featured Post
======================================== */
.hero-featured {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 48px;
  min-height: 420px;
  display: flex;
  align-items: flex-end;
}

.hero-featured .hero-image {
  position: absolute;
  inset: 0;
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.hero-featured .hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 60%);
}

.hero-featured .hero-content {
  position: relative;
  padding: 32px;
  color: #fff;
}

.hero-featured .hero-category {
  background: var(--color-accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 3px;
  display: inline-block;
  margin-bottom: 12px;
}

.hero-featured .hero-title {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
}

.hero-featured .hero-title a { color: #fff; }
.hero-featured .hero-meta { font-size: 0.85rem; opacity: .8; }

/* ========================================
   Posts Grid
======================================== */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-muted);
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 10px;
  margin-bottom: 24px;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

@media (max-width: 640px) {
  .posts-grid { grid-template-columns: 1fr; }
}

/* Card */
.post-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.post-card .card-thumbnail {
  aspect-ratio: 16/9;
  overflow: hidden;
}

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

.post-card:hover .card-thumbnail img { transform: scale(1.04); }

.post-card .card-body { padding: 20px; }

.post-card .card-category {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-accent);
  margin-bottom: 8px;
  display: block;
}

.post-card .card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 8px;
}

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

.post-card .card-excerpt {
  font-size: 0.875rem;
  color: var(--color-muted);
  line-height: 1.6;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card .card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--color-muted);
}

.post-card .card-meta .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
}

/* List style card */
.post-card-list {
  display: flex;
  gap: 16px;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 16px;
  margin-bottom: 16px;
  transition: transform .2s;
}

.post-card-list:hover { transform: translateX(4px); }

.post-card-list .card-thumbnail {
  width: 100px;
  height: 75px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
}

.post-card-list .card-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

.post-card-list .card-body { flex: 1; }

.post-card-list .card-title {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 6px;
}

.post-card-list .card-title a { color: var(--color-text); }
.post-card-list .card-meta { font-size: 0.75rem; color: var(--color-muted); }

/* ========================================
   Pagination
======================================== */
.pagination {
  margin-top: 40px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow);
  transition: background .2s, color .2s;
}

.pagination .page-numbers.current,
.pagination .page-numbers:hover {
  background: var(--color-accent);
  color: #fff;
  opacity: 1;
}

/* ========================================
   Single Post
======================================== */
.single-header { margin-bottom: 36px; }

.single-category {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-accent);
  margin-bottom: 12px;
  display: block;
}

.single-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
}

.single-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--color-muted);
  flex-wrap: wrap;
}

.single-meta .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
}

.single-meta .author-name { font-weight: 600; color: var(--color-text); }

.single-thumbnail {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 36px;
  aspect-ratio: 16/9;
}

.single-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

/* Article content */
.entry-content {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--color-text);
}

.entry-content h2 { font-size: 1.6rem; font-weight: 800; margin: 2em 0 0.6em; font-family: var(--font-sans); }
.entry-content h3 { font-size: 1.3rem; font-weight: 700; margin: 1.8em 0 0.5em; font-family: var(--font-sans); }
.entry-content p { margin-bottom: 1.5em; }
.entry-content ul, .entry-content ol { margin: 0 0 1.5em 1.5em; }
.entry-content li { margin-bottom: 0.4em; }
.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-muted);
}
.entry-content code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: 'Courier New', monospace;
}
.entry-content pre {
  background: var(--color-primary);
  color: #e0e0e0;
  padding: 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1.5em;
}
.entry-content pre code { background: none; padding: 0; color: inherit; }
.entry-content img { border-radius: var(--radius); margin: 1.5em auto; }
.entry-content a { border-bottom: 1px solid var(--color-accent); }

/* Tags */
.entry-tags { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 8px; }
.entry-tags a {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.8rem;
  color: var(--color-text);
  transition: background .2s;
}
.entry-tags a:hover { background: var(--color-accent); color: #fff; border-color: var(--color-accent); opacity: 1; }

/* Author box */
.author-box {
  display: flex;
  gap: 20px;
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 40px;
  box-shadow: var(--shadow);
}

.author-box .author-avatar { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.author-box .author-name { font-weight: 700; font-size: 1rem; margin-bottom: 6px; }
.author-box .author-bio { font-size: 0.875rem; color: var(--color-muted); }

/* Related posts */
.related-posts { margin-top: 48px; }

/* ========================================
   Comments
======================================== */
.comments-area { margin-top: 48px; }
.comments-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 24px; }

.comment-list .comment { padding: 20px 0; border-bottom: 1px solid var(--color-border); }
.comment-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.comment-meta img { width: 40px; height: 40px; border-radius: 50%; }
.comment-author { font-weight: 600; font-size: 0.9rem; }
.comment-date { font-size: 0.8rem; color: var(--color-muted); }
.comment-body p { font-size: 0.9rem; }

.comment-respond { margin-top: 32px; }
.comment-respond h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; }
.comment-form input,
.comment-form textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  margin-bottom: 12px;
  background: var(--color-surface);
  transition: border-color .2s;
}
.comment-form input:focus,
.comment-form textarea:focus { outline: none; border-color: var(--color-accent); }
.comment-form textarea { resize: vertical; min-height: 120px; }
.comment-form .submit {
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s;
}
.comment-form .submit:hover { opacity: .85; }

/* ========================================
   Sidebar
======================================== */
.sidebar { align-self: start; }

.widget {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.widget-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--color-muted);
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 10px;
  margin-bottom: 16px;
}

/* Search widget */
.widget-search { display: flex; gap: 8px; }
.widget-search input {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.875rem;
  font-family: var(--font-sans);
}
.widget-search button {
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.875rem;
}

/* Categories widget */
.widget-categories li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.875rem;
}
.widget-categories li:last-child { border-bottom: none; }
.widget-categories a { color: var(--color-text); font-weight: 500; }
.widget-categories a:hover { color: var(--color-accent); opacity: 1; }
.widget-categories .count {
  background: var(--color-bg);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 0.75rem;
  color: var(--color-muted);
}

/* Popular posts widget */
.widget-popular .popular-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}
.widget-popular .popular-item:last-child { border-bottom: none; }
.widget-popular .popular-thumb { width: 60px; height: 45px; border-radius: 4px; overflow: hidden; flex-shrink: 0; }
.widget-popular .popular-thumb img { width: 100%; height: 100%; object-fit: cover; }
.widget-popular .popular-title { font-size: 0.825rem; font-weight: 600; line-height: 1.4; }
.widget-popular .popular-title a { color: var(--color-text); }
.widget-popular .popular-date { font-size: 0.75rem; color: var(--color-muted); margin-top: 4px; }

/* Tags widget */
.widget-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.widget-tags a {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.8rem;
  color: var(--color-text);
  transition: all .2s;
}
.widget-tags a:hover { background: var(--color-accent); color: #fff; border-color: var(--color-accent); opacity: 1; }

/* ========================================
   Breaking News Ticker
======================================== */
.breaking-bar {
  background: var(--color-accent);
  color: #fff;
  display: flex;
  align-items: center;
  overflow: hidden;
  height: 36px;
}

.breaking-label {
  background: rgba(0,0,0,0.25);
  padding: 0 16px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  height: 100%;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.breaking-ticker {
  flex: 1;
  overflow: hidden;
  height: 100%;
  display: flex;
  align-items: center;
}

.breaking-ticker-inner {
  display: flex;
  animation: ticker 30s linear infinite;
  white-space: nowrap;
}

.breaking-ticker-inner span {
  padding: 0 40px;
  font-size: 0.85rem;
}

.breaking-ticker-inner span::before {
  content: '▸ ';
}

@keyframes ticker {
  0% { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}

/* ========================================
   Category Archive Header
======================================== */
.archive-header {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.archive-header .archive-icon {
  width: 48px;
  height: 48px;
  background: var(--color-accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.archive-header .archive-name {
  font-size: 1.6rem;
  font-weight: 800;
}

.archive-header .archive-desc { font-size: 0.9rem; color: var(--color-muted); margin-top: 4px; }

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

.error-404 .error-code {
  font-size: clamp(6rem, 15vw, 12rem);
  font-weight: 900;
  color: var(--color-border);
  line-height: 1;
  margin-bottom: 16px;
}

.error-404 h1 { font-size: 1.8rem; margin-bottom: 12px; }
.error-404 p { color: var(--color-muted); margin-bottom: 24px; }

.btn {
  display: inline-block;
  background: var(--color-accent);
  color: #fff;
  padding: 12px 28px;
  border-radius: 6px;
  font-weight: 700;
  transition: opacity .2s;
}
.btn:hover { opacity: .85; }

/* ========================================
   Footer
======================================== */
.site-footer {
  background: var(--color-primary);
  color: rgba(255,255,255,0.75);
  padding: 64px 0 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 48px;
}

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
}

.footer-brand .brand-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
}

.footer-brand .brand-name span { color: var(--color-accent); }
.footer-brand p { font-size: 0.875rem; line-height: 1.7; }

.footer-col-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #fff;
  margin-bottom: 16px;
}

.footer-links li { margin-bottom: 10px; }
.footer-links a { font-size: 0.875rem; color: rgba(255,255,255,0.65); transition: color .2s; }
.footer-links a:hover { color: #fff; opacity: 1; }

/* Social icons */
.social-links { display: flex; gap: 10px; margin-top: 16px; }
.social-links a {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.875rem;
  transition: background .2s;
}
.social-links a:hover { background: var(--color-accent); opacity: 1; }

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

@media (max-width: 560px) {
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
}

/* ========================================
   Search Results
======================================== */
.search-header { margin-bottom: 32px; }
.search-header h1 { font-size: 1.5rem; font-weight: 800; }
.search-header p { color: var(--color-muted); font-size: 0.9rem; }

.search-form-wrap { display: flex; gap: 8px; margin-top: 16px; }
.search-form-wrap input {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 1rem;
  font-family: var(--font-sans);
}
.search-form-wrap button {
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

/* ========================================
   Reading Progress Bar
======================================== */
.reading-progress {
  position: fixed;
  top: 64px;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--color-accent);
  z-index: 99;
  transition: width .1s linear;
}

/* ========================================
   Back to Top
======================================== */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(233,69,96,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top.visible { opacity: 1; pointer-events: auto; }
