/*
Theme Name: KYTYW Global News
Theme URI: https://kytyw.com
Author: KYTYW Global
Author URI: https://kytyw.com
Description: A tabbed news-portal theme for News Network KYTYW Global — utility ribbon, hero carousel, Latest/Popular/Update tabs, and a ranked Trending rail.
Version: 1.0.4
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: kytyw
Tags: news, blog, two-columns, right-sidebar, custom-menu, custom-logo, featured-images, translation-ready
*/

/* -------------------------------------------------
   Design tokens
   Color:
     --ink:    #16233A  (headings, nav)
     --paper:  #F5F6F8  (page background)
     --card:   #FFFFFF  (card surfaces)
     --signal: #EE5D3A  (ribbon, tags, rank badges, active tab)
     --slate:  #64748B  (meta text)
     --line:   #E3E6EC  (hairlines)
   Type:
     Masthead / headlines -> 'Spectral' (serif, editorial weight)
     UI / meta            -> 'Manrope' (grotesque, rounded terminals)
------------------------------------------------- */

:root {
  --ink: #16233A;
  --paper: #F5F6F8;
  --card: #FFFFFF;
  --signal: #EE5D3A;
  --slate: #64748B;
  --line: #E3E6EC;
  --serif: 'Spectral', Georgia, serif;
  --sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max: 1200px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.55;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; margin: 0 0 .4em; line-height: 1.2; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* -------------------- Utility ribbon -------------------- */
.ribbon { background: var(--signal); color: #fff; font-size: 13px; }
.ribbon .wrap { display: flex; justify-content: space-between; align-items: center; min-height: 38px; flex-wrap: wrap; gap: 10px; }
.ribbon .clock { display: flex; align-items: center; gap: 8px; opacity: .95; }
.ribbon .cta a { background: rgba(255,255,255,.16); padding: 5px 12px; border-radius: 3px; font-weight: 600; }
.ribbon .cta a:hover { background: rgba(255,255,255,.28); }

/* -------------------- Masthead -------------------- */
.masthead { background: var(--card); border-bottom: 1px solid var(--line); }
.masthead .wrap { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; gap: 20px; }
.social-row { display: flex; gap: 10px; }
.social-row a { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; color: var(--ink); }
.social-row a:hover { border-color: var(--signal); color: var(--signal); }
.site-title { font-family: var(--serif); font-size: 30px; font-weight: 700; letter-spacing: -.01em; text-align: center; }
.masthead img.custom-logo { max-height: 48px; width: auto; }
.masthead-tools { display: flex; align-items: center; gap: 16px; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; background: none; }
.menu-toggle { display: none; }

/* -------------------- Primary nav -------------------- */
.primary-nav { background: var(--card); border-bottom: 1px solid var(--line); }
.primary-nav .wrap { display: flex; align-items: center; justify-content: space-between; }
.primary-nav ul { list-style: none; display: flex; margin: 0; padding: 0; }
.primary-nav a { display: block; padding: 15px 18px; font-weight: 700; font-size: 14px; color: var(--ink); border-bottom: 3px solid transparent; }
.primary-nav a:hover, .primary-nav .current-menu-item > a { color: var(--signal); border-color: var(--signal); }
.subscribe-btn { background: var(--signal); color: #fff !important; padding: 9px 18px !important; border-radius: 4px; font-size: 13px; margin: 10px 0; }
.subscribe-btn:hover { background: #d94d2f; }

/* -------------------- Ticker -------------------- */
.ticker { background: #fff; border-bottom: 1px solid var(--line); }
.ticker .wrap { display: flex; align-items: center; gap: 16px; min-height: 46px; font-size: 13.5px; overflow: hidden; }
.ticker .flag { background: var(--signal); color: #fff; font-weight: 800; font-size: 11.5px; padding: 4px 10px; letter-spacing: .04em; flex: none; }
.ticker .items { display: flex; gap: 34px; white-space: nowrap; }
.ticker .items a:hover { color: var(--signal); }

/* -------------------- Tabs (Latest / Popular / Update) -------------------- */
.tabs-panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 20px; box-shadow: 0 1px 2px rgba(16,23,42,.04); }
.tabs-panel .tabs { display: flex; gap: 22px; border-bottom: 2px solid var(--ink); margin-bottom: 16px; }
.tabs-panel .tabs button { background: none; border: none; font-family: var(--sans); font-weight: 700; font-size: 14px; color: var(--slate); padding: 0 0 10px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs-panel .tabs button.active { color: var(--ink); border-color: var(--signal); }
.tab-pane { display: none; flex-direction: column; gap: 16px; }
.tab-pane.active { display: flex; }
.tab-pane article { display: flex; gap: 12px; padding: 10px 6px; margin: 0 -6px; border-radius: 6px; border-bottom: 1px solid var(--line); transition: background-color .15s ease; }
.tab-pane article:last-child { border-bottom: none; }
.tab-pane article:hover { background: var(--paper); }
.tab-pane .thumb { width: 100px; flex: none; aspect-ratio: 4/3; background: var(--line); overflow: hidden; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.tab-pane .thumb img { width: 100%; height: 100%; object-fit: contain; }
.tab-pane h3 { font-size: 15px; }
.tab-pane .post-meta { font-size: 12px; color: var(--slate); }

/* -------------------- Hero carousel -------------------- */
.home-grid { align-items: start; }
.hero { position: relative; border-radius: 6px; overflow: hidden; background: var(--ink); aspect-ratio: 4/3; }
.hero-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .5s ease; }
.hero-slide.active { opacity: 1; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-slide::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(22,35,58,0) 30%, rgba(22,35,58,.92) 100%); }
.hero-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px; color: #fff; z-index: 2; }
.hero-caption .tag { display: inline-block; background: var(--signal); font-size: 11.5px; font-weight: 700; padding: 4px 10px; letter-spacing: .03em; margin-bottom: 12px; }
.hero-caption h1, .hero-caption h2 { font-size: 26px; color: #fff; }
.hero-caption .byline { font-size: 12.5px; opacity: .85; margin-top: 8px; }
.hero-dots { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 3; }
.hero-dots button { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #fff; background: transparent; padding: 0; cursor: pointer; }
.hero-dots button.active { background: #fff; }
.hero-nav { position: absolute; top: 16px; right: 16px; z-index: 3; display: flex; gap: 8px; }
.hero-nav button { width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(255,255,255,.9); cursor: pointer; }

/* -------------------- Trending rail -------------------- */
.trending { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 20px 20px 8px; height: 100%; box-shadow: 0 1px 2px rgba(16,23,42,.04); }
.trending .head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 6px; }
.trending .head h2 { font-size: 19px; margin: 0; }
.trend-item { display: flex; gap: 12px; padding: 14px 6px; margin: 0 -6px; border-bottom: 1px solid var(--line); position: relative; border-radius: 6px; transition: background-color .15s ease; }
.trend-item:hover { background: var(--paper); }
.trend-item:last-child { border-bottom: none; }
.trend-item .rank { width: 28px; height: 28px; background: var(--signal); color: #fff; font-size: 12.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; border-radius: 3px; flex: none; margin-top: 2px; }
.trend-item .thumb { width: 104px; height: 76px; flex: none; border-radius: 4px; overflow: hidden; background: var(--line); display: flex; align-items: center; justify-content: center; }
.trend-item .thumb img { width: 100%; height: 100%; object-fit: contain; }
.trend-item h3 { font-size: 14px; margin: 0 0 4px; }
.trend-item .post-meta { font-size: 11.5px; color: var(--slate); }

/* -------------------- Top stories grid -------------------- */
.top-stories { margin-top: 48px; }
.top-stories .head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 20px; }
.top-stories .head h2 { font-size: 20px; margin: 0; }
.top-stories .head a { font-size: 13px; color: var(--slate); }
.top-stories .head a:hover { color: var(--signal); }
.story-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.story-card .thumb { aspect-ratio: 4/3; border-radius: 6px; overflow: hidden; background: var(--line); margin-bottom: 10px; display: flex; align-items: center; justify-content: center; }
.story-card .thumb img { width: 100%; height: 100%; object-fit: contain; }
.story-card .region { font-size: 11px; color: var(--signal); font-weight: 700; letter-spacing: .03em; }
.story-card h3 { font-size: 15.5px; }

/* -------------------- Main grid -------------------- */
.home-grid { display: grid; grid-template-columns: 260px 1fr 300px; gap: 26px; padding: 28px 0; }

/* -------------------- Content + sidebar (archive/single) -------------------- */
.content-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; padding: 8px 0 56px; }
.post-list { display: flex; flex-direction: column; gap: 24px; }
.post-list article { display: flex; gap: 16px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.post-list .thumb { width: 190px; flex: none; aspect-ratio: 4/3; border-radius: 5px; overflow: hidden; background: var(--line); display: flex; align-items: center; justify-content: center; }
.post-list .thumb img { width: 100%; height: 100%; object-fit: contain; }
.post-list h2 { font-size: 19px; }
.post-list .excerpt { color: var(--slate); font-size: 14px; }
.post-meta { font-size: 12px; color: var(--slate); }
.post-meta .region { color: var(--signal); font-weight: 700; }

.pagination { display: flex; gap: 8px; margin-top: 10px; }
.pagination a, .pagination span { border: 1px solid var(--line); padding: 7px 13px; font-size: 13px; border-radius: 4px; }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }

.sidebar .widget { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 18px; margin-bottom: 22px; }
.sidebar .widget-title { font-family: var(--serif); font-size: 16px; border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 12px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.sidebar li a:hover { color: var(--signal); }

/* -------------------- Single post -------------------- */
.single-header { padding: 34px 0 16px; border-bottom: 1px solid var(--line); }
.single-header .region { color: var(--signal); font-weight: 700; font-size: 12.5px; }
.single-header h1 { font-size: 32px; margin-top: 10px; }
.single-header .byline { color: var(--slate); font-size: 13px; margin-top: 8px; }
.single-thumb { margin: 24px 0; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; background: var(--line); }
.single-thumb img { width: 100%; height: 100%; object-fit: cover; }
.entry-content { font-size: 16.5px; line-height: 1.75; max-width: 720px; }
.entry-content h2 { font-size: 22px; margin-top: 1.4em; }
.entry-content a { color: var(--signal); text-decoration: underline; }
.entry-content blockquote { border-left: 3px solid var(--signal); margin: 1.5em 0; padding: .2em 0 .2em 18px; font-style: italic; color: var(--slate); }

/* -------------------- Footer -------------------- */
.site-footer { background: var(--ink); color: #fff; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; padding: 46px 0 26px; }
.footer-grid h4 { font-family: var(--sans); font-size: 12.5px; letter-spacing: .04em; color: var(--signal); margin-bottom: 12px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { padding: 6px 0; font-size: 13.5px; }
.footer-grid li a { color: rgba(255,255,255,.82); }
.footer-grid li a:hover { color: #fff; }
.footer-about p { color: rgba(255,255,255,.68); font-size: 13.5px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.14); padding: 16px 0; font-size: 12px; color: rgba(255,255,255,.6); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* -------------------- Responsive -------------------- */
@media (max-width: 980px) {
  .home-grid { grid-template-columns: 1fr; }
  .content-layout { grid-template-columns: 1fr; }
  .story-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .site-title { font-size: 22px; }
  .masthead .wrap { flex-wrap: wrap; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .primary-nav ul { display: none; flex-direction: column; width: 100%; }
  .primary-nav.open ul { display: flex; }
  .post-list article { flex-direction: column; }
  .post-list .thumb { width: 100%; }
  .story-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; padding: 36px 0 18px; }
}
