/*
Theme Name: Latest Tales
Theme URI: https://latest-tales.local
Author: Latest Tales
Description: A modern minimal news theme for Latest Tales, with a red/black editorial palette and multi-column category sections on the homepage.
Version: 1.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: latest-tales
*/

/* ---------- Variables ---------- */
:root {
  --color-black: #121212;
  --color-red: #d0021b;
  --color-red-dark: #a3010f;
  --color-white: #ffffff;
  --color-gray-light: #f4f4f4;
  --color-gray-border: #e5e5e5;
  --color-gray-text: #6b6b6b;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --max-width: 1200px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-black);
  background: var(--color-white);
  line-height: 1.5;
  font-size: 16px;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--color-red); }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.2; font-weight: 700; }
p { margin: 0 0 1em; }
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}
.screen-reader-text {
  position: absolute;
  clip: rect(1px, 1px, 1px, 1px);
  width: 1px; height: 1px;
  overflow: hidden;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--color-black);
  border-bottom: 3px solid var(--color-red);
  padding: 20px 0;
}
.site-header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  position: relative;
}
.site-branding { display: flex; align-items: center; justify-content: center; gap: 12px; }
.site-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0;
}
.site-title a { color: var(--color-white); }
.site-title .accent { color: var(--color-red); }
.site-description {
  margin: 2px 0 0;
  font-size: 13px;
  color: #b3b3b3;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.custom-logo { max-height: 48px; width: auto; }

.primary-nav ul {
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
}
.primary-nav a {
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-white);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.primary-nav a:hover,
.primary-nav .current-menu-item a {
  color: var(--color-red);
  border-bottom-color: var(--color-red);
}
.menu-toggle {
  display: none;
  background: none;
  border: 2px solid var(--color-white);
  color: var(--color-white);
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.header-actions {
  position: absolute;
  top: 4px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-toggle {
  background: none;
  border: none;
  color: var(--color-white);
  cursor: pointer;
  padding: 8px;
  line-height: 0;
}
.search-toggle:hover { color: var(--color-red); }
.header-search-panel {
  display: none;
  position: absolute;
  top: 100%;
  right: 24px;
  margin-top: 12px;
  background: var(--color-white);
  border: 1px solid var(--color-gray-border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 16px;
  z-index: 20;
  width: 280px;
}
.header-search-panel.is-open { display: block; }
.header-search-panel .search-form {
  display: flex;
  gap: 8px;
}
.header-search-panel input[type="search"] {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--color-gray-border);
  font-family: var(--font-sans);
}
.header-search-panel input[type="submit"] {
  background: var(--color-red);
  color: var(--color-white);
  border: none;
  padding: 10px 16px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  cursor: pointer;
}
.header-search-panel input[type="submit"]:hover { background: var(--color-red-dark); }

/* ---------- Breaking News Ticker ---------- */
.news-ticker {
  background: var(--color-red);
  overflow: hidden;
}
.news-ticker-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}
.ticker-label {
  flex-shrink: 0;
  background: var(--color-black);
  color: var(--color-white);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 14px;
}
.ticker-track-wrap {
  flex: 1;
  overflow: hidden;
  padding: 8px 0;
}
.ticker-track {
  display: inline-flex;
  gap: 48px;
  white-space: nowrap;
  animation: ticker-scroll 30s linear infinite;
}
.ticker-track li { flex-shrink: 0; }
.ticker-track a {
  color: var(--color-white);
  font-size: 13px;
  font-weight: 600;
}
.ticker-track a:hover { color: var(--color-black); }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- Hero / Featured ---------- */
.hero-section { padding: 40px 0; border-bottom: 1px solid var(--color-gray-border); }
.hero-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 48px;
  align-items: start;
}
.hero-main .hero-thumb img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  margin-bottom: 18px;
}
.hero-category {
  display: inline-block;
  background: var(--color-red);
  color: var(--color-white);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  margin-bottom: 14px;
}
.hero-main h2 {
  font-size: 30px;
  letter-spacing: -0.5px;
}
.hero-main h2 a:hover { color: var(--color-red); }

.hero-list { border-top: 3px solid var(--color-black); }
.hero-list-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-gray-border);
}
.hero-list-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
}
.hero-list-thumb img {
  width: 80px;
  height: 80px;
  object-fit: cover;
}
.hero-list-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}
.hero-list-title:hover { color: var(--color-red); }

/* ---------- Category Sections ---------- */
.category-section { padding: 40px 0; border-bottom: 1px solid var(--color-gray-border); }
.category-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  border-bottom: 3px solid var(--color-black);
  padding-bottom: 8px;
}
.category-section-header h3 {
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
}
.category-section-header h3::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--color-red);
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: middle;
}
.category-section-header .view-all {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-red);
  white-space: nowrap;
}
.article-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
}
.article-card .article-thumb img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  margin-bottom: 14px;
}
.article-card h4 {
  font-size: 17px;
  line-height: 1.3;
  margin-bottom: 8px;
}
.article-card h4 a:hover { color: var(--color-red); }
.article-card .article-meta {
  font-size: 12px;
  color: var(--color-gray-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------- Archive / Blog list ---------- */
.content-area { padding: 40px 0; }
.page-title {
  font-size: 32px;
  border-bottom: 3px solid var(--color-black);
  padding-bottom: 16px;
  margin-bottom: 32px;
}
.post-list {
  display: grid;
  grid-template-columns: 4fr 1fr;
  gap: 48px;
  align-items: start;
}
.widget-area {
  position: sticky;
  top: 20px;
}
.post-list-main .post-entry {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  padding: 28px 0;
  border-bottom: 1px solid var(--color-gray-border);
}
.post-entry .entry-thumb img { aspect-ratio: 4/3; object-fit: cover; }
.post-entry h2 { font-size: 22px; }
.post-entry h2 a:hover { color: var(--color-red); }
.entry-meta {
  font-size: 12px;
  color: var(--color-gray-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.entry-meta .cat-label { color: var(--color-red); font-weight: 700; }
.entry-summary { color: #333; }

/* ---------- Sidebar ---------- */
.widget { margin-bottom: 36px; }
.widget-title {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 3px solid var(--color-black);
  padding-bottom: 10px;
  margin-bottom: 16px;
}
.widget ul li {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-gray-border);
  font-size: 14px;
}
.widget ul li a:hover { color: var(--color-red); }
.widget select, .widget input[type="search"], .widget input[type="text"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--color-gray-border);
  font-family: var(--font-sans);
}

.trending-list { counter-reset: none; }
.trending-list li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-gray-border);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.trending-rank {
  flex-shrink: 0;
  font-size: 22px;
  font-weight: 800;
  font-style: italic;
  color: var(--color-red);
  min-width: 24px;
}
.trending-list a:hover { color: var(--color-red); }

.latest-list li {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-gray-border);
}
.latest-thumb { flex-shrink: 0; width: 64px; height: 64px; }
.latest-thumb img { width: 64px; height: 64px; object-fit: cover; }
.latest-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 4px;
}
.latest-title:hover { color: var(--color-red); }
.latest-date {
  font-size: 11px;
  color: var(--color-gray-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------- Single Post ---------- */
.single-post-header { padding: 40px 0 20px; border-bottom: 1px solid var(--color-gray-border); }
.single-post-header .hero-category { margin-bottom: 16px; }
.single-post-header h1 {
  font-size: 40px;
  letter-spacing: -0.5px;
  max-width: 900px;
}
.single-post-subheading {
  font-size: 19px;
  line-height: 1.5;
  color: #444;
  max-width: 800px;
  margin: 4px 0 20px;
}
.single-post-byline {
  display: flex;
  align-items: center;
  gap: 12px;
}
.author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.byline-info { display: flex; flex-direction: column; gap: 2px; }
.byline-name {
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.byline-date {
  font-size: 12px;
  color: var(--color-gray-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.verified-badge { flex-shrink: 0; vertical-align: middle; }
.single-featured-image { margin: 32px 0; }
.author-bio-box {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  max-width: 760px;
  margin-top: 40px;
  padding: 24px;
  background: var(--color-gray-light);
  border-left: 4px solid var(--color-red);
}
.author-bio-box .author-avatar { width: 64px; height: 64px; }
.author-bio-name {
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}
.author-bio-text {
  font-size: 14px;
  color: #444;
  line-height: 1.6;
  margin: 0;
}
.single-content {
  max-width: 760px;
  font-size: 18px;
  line-height: 1.7;
}
.single-content p { margin-bottom: 1.4em; }
.single-content h2, .single-content h3 { margin-top: 1.4em; }
.single-content blockquote {
  border-left: 4px solid var(--color-red);
  padding-left: 20px;
  margin: 2em 0;
  font-style: italic;
  color: #333;
}
.single-content img { margin: 1.5em 0; }
.post-tags {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--color-gray-border);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.post-tags a {
  font-size: 12px;
  text-transform: uppercase;
  border: 1px solid var(--color-gray-border);
  padding: 6px 12px;
}
.post-tags a:hover { border-color: var(--color-red); color: var(--color-red); }

/* ---------- Comments ---------- */
.comments-area { max-width: 760px; margin-top: 48px; padding-top: 32px; border-top: 3px solid var(--color-black); }
.comment-list { }
.comment-list .comment { padding: 20px 0; border-bottom: 1px solid var(--color-gray-border); }
.comment-form input, .comment-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--color-gray-border);
  font-family: var(--font-sans);
  margin-bottom: 16px;
}
.comment-form input[type="submit"] {
  width: auto;
  background: var(--color-black);
  color: var(--color-white);
  border: none;
  padding: 12px 28px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
}
.comment-form input[type="submit"]:hover { background: var(--color-red); }

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  gap: 8px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 8px 14px;
  border: 1px solid var(--color-gray-border);
  font-size: 14px;
  font-weight: 600;
}
.pagination .current { background: var(--color-black); color: var(--color-white); }
.pagination a:hover { border-color: var(--color-red); color: var(--color-red); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-black);
  color: var(--color-white);
  margin-top: 40px;
  padding: 48px 0 24px;
}
.footer-widgets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 32px;
}
.site-footer .widget-title { color: var(--color-white); border-bottom-color: var(--color-red); }
.site-footer .widget ul li { border-bottom-color: rgba(255,255,255,0.15); }
.site-footer a { color: #cfcfcf; }
.site-footer a:hover { color: var(--color-red); }
.footer-brand { margin-bottom: 16px; }
.footer-brand .custom-logo { max-height: 40px; margin-bottom: 16px; }
.footer-brand .site-title { font-size: 22px; margin-bottom: 16px; }
.footer-brand .site-title a { color: var(--color-white); }
.footer-brand .site-title .accent { color: var(--color-red); }
.tag-cloud-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud-list a {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 5px 10px;
  color: #cfcfcf;
}
.tag-cloud-list a:hover { border-color: var(--color-red); color: var(--color-red); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 20px;
  font-size: 13px;
  color: #999;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-bottom nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-bottom nav a {
  font-size: 13px;
  color: #cfcfcf;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.footer-bottom nav a:hover { color: var(--color-red); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .article-grid { grid-template-columns: repeat(2, 1fr); }
  .post-list { grid-template-columns: 1fr; }
  .footer-widgets { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .site-header-inner {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    text-align: left;
  }
  .site-branding { justify-content: flex-start; }
  .custom-logo { max-height: 28px; }
  .site-title { font-size: 20px; }
  .header-actions { position: static; order: 2; gap: 10px; }
  .search-toggle { border: 2px solid var(--color-white); padding: 6px; }
  .menu-toggle { display: inline-block; }
  .header-search-panel { right: 16px; width: calc(100% - 32px); max-width: 320px; }
  .primary-nav { display: none; width: 100%; order: 3; }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { flex-direction: column; gap: 0; }
  .primary-nav li { border-bottom: 1px solid rgba(255,255,255,0.15); padding: 10px 0; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
  .footer-bottom nav ul { gap: 12px 16px; }
  .article-grid { grid-template-columns: repeat(2, 1fr); gap: 16px 12px; }
  .article-card .article-thumb img { aspect-ratio: 1/1; margin-bottom: 8px; }
  .article-card h4 { font-size: 13px; line-height: 1.3; margin-bottom: 6px; }
  .article-card .article-meta { font-size: 10px; }
  .category-section { padding: 28px 0; }
  .category-section-header { margin-bottom: 16px; }
  .category-section-header h3 { font-size: 16px; }
  .post-entry { grid-template-columns: 1fr; }
  .footer-widgets { grid-template-columns: 1fr; }
  .single-post-header h1 { font-size: 28px; }
  .hero-main h2 { font-size: 24px; }
}
