/*
Theme Name: Suhareka Online
Template: astra
Theme URI: https://suharekaonline.com
Author: Suhareka Online
Description: Lean custom child theme for Suhareka Online — front-page news layout, no bundled frameworks.
Version: 1.1.1
Text Domain: suhareka-online
*/

:root {
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --ink: #17171D;
  --accent: #C8102E;
  --meta: #5B5F6B;
  --rule: #E4E2DC;
  --ad-bg: #F0EFEA;
  --ad-border: #C9C6BC;
  --img-a: #d8d6cf;
  --img-b: #b9b6ab;
  --lead-img-a: #2b2e3a;
  --lead-img-b: #4a4e60;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214;
    --surface: #1B1B1F;
    --ink: #EDEDEF;
    --accent: #FF5A6B;
    --meta: #9A9CA6;
    --rule: #2B2B30;
    --ad-bg: #1F1F24;
    --ad-border: #3A3A40;
    --img-a: #2c2c32;
    --img-b: #44444c;
    --lead-img-a: #0d0e13;
    --lead-img-b: #2a2c38;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

@font-face {
  font-family: 'Newsreader';
  src: url('fonts/newsreader-latin.woff2') format('woff2-variations'), url('fonts/newsreader-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Public Sans';
  src: url('fonts/public-sans-latin.woff2') format('woff2-variations'), url('fonts/public-sans-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

body.suhareka {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Public Sans', system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  margin: 0;
}
/* Explicit heading color: Astra paints every h1–h6 its own dark navy, which
   vanishes on the dark-mode background. */
.suhareka h1, .suhareka h2, .suhareka h3, .suhareka h4, .suhareka h5, .suhareka h6, .suhareka .headline {
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: var(--ink);
}
.suhareka a { color: inherit; text-decoration: none; }
.suhareka a, .suhareka button { -webkit-tap-highlight-color: transparent; }
.suhareka .wrap {
  max-width: 1160px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

#header-sentinel { height: 1px; margin: 0; padding: 0; }

/* Masthead */
.masthead {
  border-bottom: 1px solid var(--rule); background: var(--bg);
  position: sticky; top: 0; z-index: 50;
  transition: box-shadow 0.25s ease;
}
.masthead.is-compact { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06); }
.masthead-top {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-block: 22px 14px; transition: padding-block 0.25s ease;
}
.masthead.is-compact .masthead-top { padding-block: 10px 8px; }
.site-name {
  font-family: 'Newsreader', Georgia, serif; font-weight: 700; font-size: 30px;
  letter-spacing: -0.01em; transition: font-size 0.25s ease;
}
.masthead.is-compact .site-name { font-size: 21px; }

/* Uploaded logo: shrinks with the sticky header just like the text version. */
.site-name.has-logo { display: inline-block; line-height: 0; }
.site-logo-img { display: block; height: 44px; width: auto; max-width: 100%; transition: height 0.25s ease; }
.masthead.is-compact .site-logo-img { height: 30px; }
.footer-brand .site-logo-img { height: 38px; }
.site-name span { color: var(--accent); }
.locality {
  font-size: 13px; color: var(--meta);
  transition: font-size 0.25s ease;
}
.masthead.is-compact .locality { font-size: 11px; }

.masthead-top-right { display: flex; align-items: center; gap: 14px; }
.weather-widget {
  display: flex; align-items: center; gap: 6px;
  background: var(--ad-bg); border-radius: 999px; padding: 5px 12px 5px 9px;
  font-size: 12.5px; color: var(--meta); white-space: nowrap;
}
.weather-widget svg { flex-shrink: 0; }
.weather-temp { color: var(--ink); font-weight: 600; }

/* Wraps rather than scrolls: an overflow container would clip the dropdowns. */
.masthead-nav { display: flex; flex-wrap: wrap; align-items: center; column-gap: 28px; row-gap: 4px; padding-block: 12px; border-top: 1px solid var(--rule); font-size: 14.5px; font-weight: 600; }
.nav-item { position: relative; }
.nav-item.has-sub { display: flex; align-items: center; }
.nav-item > a { display: inline-block; white-space: nowrap; padding: 4px 0; }
.nav-item > a:hover, .nav-item a.current-cat { color: var(--accent); }

/* The parent link always navigates; this separate arrow opens the sub-items.
   (A hover-only dropdown makes touchscreens swallow the first tap on the parent.) */
.nav-sub-toggle, .nav-sub-toggle:hover, .nav-sub-toggle:focus {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 24px; height: 28px; margin-left: 2px; padding: 0; cursor: pointer;
  background: transparent !important; border: none !important; box-shadow: none !important; color: var(--meta) !important;
}
.nav-sub-toggle:focus-visible { outline: 2px solid var(--accent) !important; outline-offset: 1px; border-radius: 2px; }
.nav-sub-toggle span {
  width: 6px; height: 6px; margin-top: -3px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform 0.2s ease;
}
.nav-item.sub-open > .nav-sub-toggle span { transform: rotate(-135deg); margin-top: 3px; }

.nav-sub {
  display: none; position: absolute; top: 100%; left: -14px; z-index: 40; min-width: 210px; padding-block: 8px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 2px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.nav-item.sub-open > .nav-sub { display: block; }
/* Hover-to-open only for real mouse pointers on the desktop layout. */
@media (hover: hover) and (min-width: 861px) {
  .nav-item:hover > .nav-sub { display: block; }
}
.nav-sub a { display: block; padding: 8px 14px; font-weight: 500; white-space: nowrap; }
.nav-sub a:hover { background: var(--ad-bg); color: var(--accent); }

.nav-search { margin-left: auto; display: flex; align-items: center; gap: 8px; position: relative; }
.search-form { display: contents; }
.search-input {
  width: 0; min-width: 0; opacity: 0; padding: 0; border: none; font: inherit; font-size: 14px;
  background: var(--bg); color: var(--ink); border-radius: 2px;
  transition: width 0.2s ease, opacity 0.15s ease, padding 0.2s ease, border-color 0.2s ease;
}
.nav-search.search-open .search-input {
  width: 200px; opacity: 1; padding: 7px 10px; border: 1px solid var(--rule);
}
.search-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.search-toggle, .search-toggle:hover, .search-toggle:focus, .search-toggle:active {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font: inherit;
  padding: 4px 0; white-space: nowrap; flex-shrink: 0; cursor: pointer;
  background: transparent !important; border: none !important; box-shadow: none !important; outline: none !important;
  color: var(--meta) !important;
}
.search-toggle:hover, .search-toggle:focus { color: var(--accent) !important; }

.search-suggestions {
  position: absolute; top: 100%; right: 0; margin-top: 8px; width: 280px; max-height: 320px;
  overflow-y: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 2px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1); z-index: 30;
}
.search-suggestions a { display: block; padding: 10px 14px; font-size: 14px; color: var(--ink); border-bottom: 1px solid var(--rule); }
.search-suggestions a:last-child { border-bottom: none; }
.search-suggestions a:hover { background: var(--ad-bg); }
.search-suggestions .suggestion-note { padding: 12px 14px; font-size: 13.5px; color: var(--meta); }

/* Mobile quick-access category chips */
.category-chips {
  display: none; gap: 10px; overflow-x: auto; padding-block: 12px;
  border-bottom: 1px solid var(--rule); background: var(--bg);
}
.chip {
  flex: 0 0 auto; padding: 7px 16px; border: 1px solid var(--rule); border-radius: 999px;
  font-size: 13px; font-weight: 700; color: var(--meta); white-space: nowrap; background: var(--surface);
}
.chip:hover, .chip-active { color: var(--accent); border-color: var(--accent); }

.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 36px; height: 36px; padding: 0; background: none; border: none; cursor: pointer; flex-shrink: 0;
}
.nav-toggle-bar { display: block; width: 100%; height: 2px; background: var(--ink); transition: transform 0.2s ease, opacity 0.2s ease; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Lead / digest */
.lead-section { padding-block: 34px 10px; }
.lead-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 40px; }
.lead-image { aspect-ratio: 16/10; max-width: 100%; border-radius: 2px; margin-bottom: 16px; background: linear-gradient(135deg, var(--lead-img-a), var(--lead-img-b)); background-size: cover; background-position: center; }

/* The homepage hero is already narrowed by sitting next to the digest column,
   but a category page's featured block spans the full width on its own — cap
   its height so the headline is never pushed below the fold on desktop. */
.category-featured .lead-image { max-height: 420px; }
.lead-tag { display: inline-block; color: var(--accent); font-weight: 700; font-size: 13px; margin-bottom: 10px; }
.lead-headline { font-size: 38px; margin-bottom: 12px; }
.lead-dek { font-size: 17px; color: var(--meta); margin-bottom: 14px; max-width: 60ch; }
.byline { font-size: 13px; color: var(--meta); }

.digest { border-left: 1px solid var(--rule); padding-left: 32px; min-width: 0; }
.digest-item { padding-block: 16px; border-bottom: 1px solid var(--rule); }
.digest-item:first-child { padding-top: 0; }
.digest-tag { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 6px; display: block; }
.digest-headline { font-size: 17px; margin-bottom: 6px; }
.digest-time { font-size: 12.5px; color: var(--meta); }

/* Category sections */
.category-section { padding-block: 36px; border-top: 1px solid var(--rule); }
.cat-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.cat-title { font-size: 24px; }
.cat-title::after { content: ''; display: block; width: 40px; height: 3px; background: var(--accent); margin-top: 8px; }
.cat-more { font-size: 13.5px; color: var(--meta); font-weight: 600; white-space: nowrap; }
.cat-more:hover { color: var(--accent); }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.card-image { aspect-ratio: 4/3; max-width: 100%; border-radius: 2px; margin-bottom: 12px; background: linear-gradient(135deg, var(--img-a), var(--img-b)); background-size: cover; background-position: center; }
.card-headline { font-size: 18px; margin-bottom: 8px; }
.card-time { font-size: 12.5px; color: var(--meta); }
.empty-note { color: var(--meta); font-size: 14px; }

/* Body layout with sidebar */
.body-layout { display: grid; grid-template-columns: 1fr 300px; gap: 40px; }
.main-col { min-width: 0; }
.side-col { padding-top: 36px; min-width: 0; }
/* Ad positions (filled by Ad Inserter via the suhareka_ad_* hooks). */
.ad-zone { display: flex; justify-content: center; align-items: center; overflow: hidden; }
.ad-zone > * { max-width: 100%; }
.ad-banner { padding-block: 18px; }
.ad-zone-sidebar { margin-bottom: 28px; }

/* Admin-only placeholder showing where a position is and which hook it uses. */
.ad-placeholder {
  flex-direction: column; gap: 4px; min-height: 90px;
  background: var(--ad-bg); border: 1px dashed var(--ad-border); border-radius: 2px;
  color: var(--meta); font-size: 13px; text-align: center;
}
.ad-placeholder code { font-size: 11.5px; opacity: 0.8; }
.ad-banner.ad-placeholder { margin-block: 18px; }
.ad-zone-sidebar.ad-placeholder { min-height: 250px; }

/* Outer ad rails: bonus ad space in the page margins on very wide monitors
   only — the main content column stays at its normal reading width always,
   this just fills space that would otherwise sit empty beside it. */
.outer-rail { display: none; position: fixed; top: 170px; width: 160px; z-index: 10; }
.outer-rail.ad-placeholder { min-height: 600px; }
.outer-rail-left { left: calc(50% - 580px - 24px - 160px); }
.outer-rail-right { right: calc(50% - 580px - 24px - 160px); }
@media (min-width: 1560px) {
  .outer-rail { display: flex; }
}

/* Sticky footer banner */
.sticky-ad {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; justify-content: center;
  padding: 8px 48px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-top: 1px solid var(--rule);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}
.sticky-ad[hidden] { display: none; }
.sticky-ad .ad-placeholder { min-height: 50px; width: 100%; max-width: 728px; }
.sticky-ad-close, .sticky-ad-close:hover, .sticky-ad-close:focus {
  position: absolute; top: -14px; right: 12px; width: 28px; height: 28px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font: inherit; font-size: 18px; line-height: 1; cursor: pointer;
  background: var(--surface) !important; color: var(--ink) !important;
  border: 1px solid var(--rule) !important; border-radius: 50% !important; box-shadow: none !important;
}
.most-read { border-top: 3px solid var(--ink); padding-top: 16px; }
.most-read h3 { font-size: 18px; margin-bottom: 14px; }
.most-read-item { display: flex; gap: 14px; padding-block: 12px; border-bottom: 1px solid var(--rule); align-items: baseline; }
.most-read-num { font-family: 'Newsreader', serif; font-weight: 700; font-size: 20px; color: var(--rule); flex-shrink: 0; }
.most-read-text { font-size: 14.5px; }

/* Archive */
.archive-header { padding-block: 32px 10px; border-bottom: 1px solid var(--rule); margin-bottom: 30px; }
.archive-title { font-size: 32px; }
.pagination { display: flex; gap: 10px; padding-block: 30px; font-size: 14px; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid var(--rule); border-radius: 2px; }
.pagination .current { background: var(--ink); color: var(--bg); border-color: var(--ink); }

#load-sentinel { height: 1px; }
#load-status { text-align: center; padding-block: 24px; }
.loader {
  width: 28px; height: 28px; margin: 24px auto;
  border: 3px solid var(--rule); border-top-color: var(--accent);
  border-radius: 50%; animation: suhareka-spin 0.7s linear infinite;
}
@keyframes suhareka-spin { to { transform: rotate(360deg); } }

/* Single post */
.article-header { padding-block: 32px 20px; max-width: 760px; margin: 0 auto; }
.article-title { font-size: 36px; margin-bottom: 14px; }
.article-featured { aspect-ratio: 16/9; max-width: 100%; border-radius: 2px; margin: 0 auto 30px; background: linear-gradient(135deg, var(--lead-img-a), var(--lead-img-b)); background-size: cover; background-position: center; }
.article-body { max-width: 720px; margin: 0 auto; font-family: 'Newsreader', Georgia, serif; font-size: 19px; line-height: 1.65; }
.article-body p { margin: 0 0 1.3em; }
.article-body img { max-width: 100%; height: auto; border-radius: 2px; }
/* Links inside article text need to look like links (elsewhere they inherit text color). */
.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.footer-col-title a:hover { color: var(--accent); }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); margin-top: 40px; background: var(--surface); }
.footer-top { display: grid; grid-template-columns: 220px 1fr auto; gap: 40px; padding-block: 40px; align-items: start; }
.footer-brand .site-name { font-size: 22px; }
.footer-contact { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--meta); }
.footer-contact a:hover { color: var(--ink); }

.footer-sitemap { display: grid; grid-template-columns: repeat(6, 1fr); gap: 24px; min-width: 0; }
.footer-col { min-width: 0; }
.footer-col-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.footer-col-title::after { content: ''; display: block; width: 24px; height: 2px; background: var(--accent); margin-top: 7px; margin-bottom: 12px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { font-size: 13.5px; color: var(--meta); }
.footer-col a:hover { color: var(--accent); }

.footer-social { display: flex; gap: 10px; flex-wrap: wrap; }
.social-icon {
  width: 36px; height: 36px; border-radius: 50%; background: var(--ad-bg);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--meta);
}
.social-icon:hover { background: var(--ink); color: var(--bg); }

.footer-legal { border-top: 1px solid var(--rule); padding-block: 24px; font-size: 12.5px; color: var(--meta); display: flex; flex-direction: column; gap: 10px; }
.footer-legal p { margin: 0; max-width: 90ch; }

@media (max-width: 860px) {
  .footer-top { grid-template-columns: 1fr; }
  .footer-sitemap { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 520px) {
  .footer-sitemap { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .lead-grid { grid-template-columns: 1fr; }
  .digest { border-left: none; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 20px; }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .body-layout { grid-template-columns: 1fr; }

  .nav-toggle { display: flex; }
  .masthead-nav { display: none; flex-direction: column; flex-wrap: nowrap; gap: 0; align-items: stretch; }
  .masthead-nav.nav-open { display: flex; }
  .nav-item > a { display: block; padding: 14px 0; border-bottom: 1px solid var(--rule); }
  /* Hamburger panel: parent link fills the row, arrow on the right expands the
     sub-items underneath (collapsed by default so the list stays short). */
  .nav-item.has-sub { flex-wrap: wrap; border-bottom: 1px solid var(--rule); }
  .nav-item.has-sub > a { flex: 1; border-bottom: none; }
  .nav-sub-toggle, .nav-sub-toggle:hover, .nav-sub-toggle:focus { width: 44px; height: 44px; }
  .nav-sub { position: static; flex-basis: 100%; min-width: 0; padding: 0 0 6px 16px; background: none; border: none; box-shadow: none; }
  .nav-sub a { padding: 10px 0; border-top: 1px solid var(--rule); font-size: 14px; color: var(--meta); }
  .nav-sub a:hover { background: none; }

  .nav-search { margin-left: 0; padding-block: 10px; flex-wrap: wrap; }
  .nav-search.search-open .search-input { width: 100%; order: 3; margin-top: 8px; }
  .search-suggestions { left: 0; right: 0; width: 100%; }

  .category-chips { display: flex; }
}
@media (max-width: 520px) {
  .card-grid { grid-template-columns: 1fr; }
  .lead-headline { font-size: 28px; }
  .article-title { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-toggle-bar { transition: none; }
  .loader { animation: none; }
  .masthead, .masthead-top, .site-name, .locality, .site-logo-img, .nav-sub-toggle span { transition: none; }
}
