/*
Theme Name: Themefy Editorial
Author: Themefy
Description: A lightweight black-and-white editorial WordPress theme with a compact header, horizontal story rail, dark feature bands, story cards, latest-post feed, and AJAX Load More.
Version: 4.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: themefy-editorial
Tags: blog, news, magazine, one-column, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

:root {
  --tfy-black: #050505;
  --tfy-white: #ffffff;
  --tfy-ink: #080808;
  --tfy-blue: #1585bd;
  --tfy-line: #e6e6e6;
  --tfy-max: 1180px;
  --tfy-serif: Georgia, "Times New Roman", Times, serif;
  --tfy-sans: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.tfy-editorial-theme {
  margin: 0;
  background: var(--tfy-white);
  color: var(--tfy-ink);
  font-family: var(--tfy-sans);
  font-size: 14px;
  line-height: 1.25;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.screen-reader-text:focus {
  position: fixed !important;
  left: 8px; top: 8px; z-index: 999999;
  width: auto; height: auto; padding: 10px 14px; margin: 0;
  clip: auto; background: #fff; color: #000;
}

#page { width: 100%; overflow-x: hidden; overflow-y: visible; background: #fff; }
.tfy-shell { width: min(100%, var(--tfy-max)); margin-inline: auto; }
.tfy-light { background: #fff; }
.tfy-dark { background: #050505; }
.tfy-no-image { width: 100%; height: 100%; background: #161616; }

/* Correct colours even when old site-wide “all text white” CSS is still present. */
html:root body.tfy-editorial-theme:not(#wpadminbar) #page .tfy-light,
html:root body.tfy-editorial-theme:not(#wpadminbar) #page .tfy-light * {
  color: #080808 !important;
  -webkit-text-fill-color: #080808 !important;
}
html:root body.tfy-editorial-theme:not(#wpadminbar) #page .tfy-dark,
html:root body.tfy-editorial-theme:not(#wpadminbar) #page .tfy-dark * {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
html:root body.tfy-editorial-theme:not(#wpadminbar) #page .tfy-feed-category,
html:root body.tfy-editorial-theme:not(#wpadminbar) #page .tfy-feed-category * {
  color: var(--tfy-blue) !important;
  -webkit-text-fill-color: var(--tfy-blue) !important;
}

/* Header */
.tfy-header {
  --tfy-header-height: 48px;
  height: var(--tfy-header-height);
  background: #fff;
  border-bottom: 1px solid #ededed;
  position: relative;
  z-index: 100000;
}
.tfy-header-inner {
  min-height: var(--tfy-header-height);
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  position: relative;
}
.tfy-header-control {
  width: 48px;
  height: var(--tfy-header-height);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tfy-menu-control { justify-self: start; }
.tfy-search-control { justify-self: end; }
.tfy-toggle-input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.tfy-icon-button {
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 1px solid #e6e6e6;
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tfy-search-button { border-color: transparent; }
.tfy-icon-button svg {
  width: 17px;
  height: 17px;
  stroke: #111;
  pointer-events: none;
}
.tfy-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  overflow: hidden;
}
.tfy-brand a { display: inline-flex; align-items: center; justify-content: center; }
.tfy-brand img,
.tfy-brand .custom-logo {
  display: block;
  width: auto !important;
  height: var(--tfy-logo-height, 26px) !important;
  max-width: 190px !important;
  max-height: calc(var(--tfy-header-height) - 8px) !important;
  object-fit: contain;
}
.tfy-brand-text {
  display: inline-block;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 19px;
  line-height: 1;
  letter-spacing: -.55px;
  font-weight: 900;
  text-transform: uppercase;
}
.tfy-overlay-panel {
  position: fixed;
  top: var(--tfy-header-height);
  left: 0;
  right: 0;
  z-index: 100004;
  max-height: calc(100dvh - var(--tfy-header-height));
  overflow-y: auto;
  background: #fff;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #ddd;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.tfy-overlay-backdrop {
  position: fixed;
  top: var(--tfy-header-height);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100003;
  display: block;
  background: rgba(0, 0, 0, .36);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
}
.tfy-menu-toggle:checked ~ .tfy-menu-panel,
.tfy-search-toggle:checked ~ .tfy-search-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.tfy-menu-toggle:checked ~ .tfy-menu-backdrop,
.tfy-search-toggle:checked ~ .tfy-search-backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.tfy-panel-heading {
  min-height: 46px;
  padding: 8px 14px;
  border-bottom: 1px solid #ececec;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.tfy-panel-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-family: Arial, sans-serif;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tfy-menu-panel { padding: 0 14px 18px; }
.tfy-menu-panel .tfy-panel-heading { margin: 0 -14px 4px; }
.tfy-menu-panel ul { list-style: none; margin: 0; padding: 0; }
.tfy-menu-panel li { margin: 0; border-bottom: 1px solid #ececec; }
.tfy-menu-panel li:last-child { border-bottom: 0; }
.tfy-menu-panel a {
  display: flex;
  align-items: center;
  min-height: 45px;
  padding: 9px 2px;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.tfy-menu-panel .sub-menu {
  margin: 0 0 5px 10px;
  padding-left: 12px;
  border-left: 2px solid #ededed;
}
.tfy-menu-panel .sub-menu a {
  min-height: 39px;
  font-size: 12px;
  font-weight: 600;
}
.tfy-menu-panel a:hover,
.tfy-menu-panel a:focus,
.tfy-menu-panel .current-menu-item > a,
.tfy-menu-panel .current_page_item > a {
  text-decoration: underline;
}
.tfy-search-panel { padding: 0 14px 18px; }
.tfy-search-panel .tfy-panel-heading { margin: 0 -14px 14px; }
.tfy-search-form { display: flex; width: 100%; }
.tfy-search-form label { flex: 1 1 auto; min-width: 0; }
.tfy-search-form input[type="search"] {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 1px solid #aaa;
  border-radius: 0;
  background: #fff;
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
  padding: 8px 10px;
  font-size: 14px;
}
.tfy-search-form button {
  flex: 0 0 auto;
  height: 44px;
  border: 0;
  border-radius: 0;
  background: #050505;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  padding: 0 18px;
  font-size: 12px;
  font-weight: 700;
}

/* Top horizontal story rail */
.tfy-story-rail-wrap { padding: 6px 5px 7px; }
.tfy-story-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 56px;
  gap: 7px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tfy-story-rail::-webkit-scrollbar { display: none; }
.tfy-rail-card { min-width: 0; }
.tfy-rail-image {
  width: 56px;
  height: 44px;
  overflow: hidden;
  background: #111;
}
.tfy-rail-image img { width: 100%; height: 100%; object-fit: cover; }
.tfy-rail-title {
  margin: 3px 0 0;
  font-family: var(--tfy-serif);
  font-size: 8.4px;
  line-height: .98;
  font-weight: 700;
  letter-spacing: -.12px;
  overflow-wrap: anywhere;
}

/* Dark feature blocks */
.tfy-feature-band {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, .96fr);
  gap: 10px;
  align-items: center;
  padding: 9px 5px 8px;
}
.tfy-feature-copy { min-width: 0; }
.tfy-feature-title {
  margin: 0 0 6px;
  font-family: var(--tfy-serif);
  font-size: 13.7px;
  line-height: .98;
  letter-spacing: -.28px;
  font-weight: 700;
}
.tfy-feature-excerpt {
  margin: 0 0 6px;
  font-size: 7.6px;
  line-height: 1.12;
}
.tfy-feature-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 6.3px;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.tfy-feature-meta img { width: 12px; height: 12px; border-radius: 50%; }
.tfy-feature-image {
  width: 100%;
  aspect-ratio: 1.48 / 1;
  overflow: hidden;
  background: #151515;
}
.tfy-feature-image img { width: 100%; height: 100%; object-fit: cover; }

/* Four cards */
.tfy-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 8px;
  padding: 10px 5px 8px;
}
.tfy-card { min-width: 0; }
.tfy-card-image {
  width: 100%;
  aspect-ratio: 1.49 / 1;
  overflow: hidden;
  background: #111;
}
.tfy-card-image img { width: 100%; height: 100%; object-fit: cover; }
.tfy-card-title {
  margin: 4px 0 0;
  font-family: var(--tfy-serif);
  font-size: 8.5px;
  line-height: 1.03;
  letter-spacing: -.13px;
  font-weight: 700;
}

.tfy-feed-divider {
  height: 5px;
  margin: 7px 5px 25px;
  border-top: 2px solid #747474;
  border-bottom: 1px solid #bdbdbd;
}

/* Latest feed */
.tfy-feed { padding: 0 5px 1px; }
.tfy-feed-item {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin: 0 0 12px;
}
.tfy-feed-image {
  width: 118px;
  height: 95px;
  overflow: hidden;
  background: #111;
}
.tfy-feed-image img { width: 100%; height: 100%; object-fit: cover; }
.tfy-feed-copy { min-width: 0; padding-top: 1px; }
.tfy-feed-category {
  display: block;
  margin: 0 0 4px;
  font-family: var(--tfy-sans);
  font-size: 5.8px;
  line-height: 1;
  letter-spacing: .35px;
  font-weight: 700;
  text-transform: uppercase;
}
.tfy-feed-title {
  margin: 0 0 4px;
  font-family: var(--tfy-serif);
  font-size: 13.8px;
  line-height: 1.02;
  letter-spacing: -.25px;
  font-weight: 700;
}
.tfy-feed-date {
  margin: 0 0 4px;
  color: #777;
  font-size: 6.5px;
  line-height: 1;
}
html:root body.tfy-editorial-theme:not(#wpadminbar) #page .tfy-light .tfy-feed-date { color: #777 !important; -webkit-text-fill-color: #777 !important; }
.tfy-feed-excerpt {
  margin: 0;
  font-size: 7.6px;
  line-height: 1.16;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.tfy-load-more-wrap { text-align: center; padding: 5px 5px 22px; }
.tfy-load-more {
  min-width: 116px;
  height: 30px;
  border: 0;
  background: #050505;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.tfy-load-more[disabled] { opacity: .55; cursor: wait; }
.tfy-load-more.is-hidden { display: none; }

/* Footer */
.tfy-footer {
  margin-top: 12px;
  background: #050505;
  color: #fff;
  padding: 18px 5px 16px;
}
.tfy-footer-logo img,
.tfy-footer-logo .custom-logo {
  width: 96px;
  height: auto;
  max-height: 24px;
  object-fit: contain;
  filter: invert(1);
}
.tfy-footer-logo .tfy-brand-text {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 18px;
  letter-spacing: -.6px;
  text-transform: uppercase;
}
.tfy-footer-description {
  max-width: 620px;
  margin: 8px 0 22px;
  font-size: 7.4px;
  line-height: 1.18;
}
.tfy-footer-menu { list-style: none; margin: 0 0 25px; padding: 0; }
.tfy-footer-menu li { margin: 0 0 8px; }
.tfy-footer-menu a { font-size: 7.4px; }
.tfy-copyright { margin: 0; font-size: 6.2px; }

/* Inner pages */
.tfy-inner { padding: 24px 10px 40px; }
.tfy-inner-title { margin: 0 0 18px; font-family: var(--tfy-serif); font-size: 30px; line-height: 1.02; }
.tfy-entry-content { max-width: 760px; margin-inline: auto; font-family: var(--tfy-serif); font-size: 17px; line-height: 1.65; }
.tfy-entry-content h2, .tfy-entry-content h3 { line-height: 1.12; }
.tfy-entry-content a { text-decoration: underline; }
.tfy-single-image { margin: 0 auto 20px; max-width: 900px; }
.tfy-pagination { display: flex; gap: 6px; flex-wrap: wrap; padding: 16px 5px 30px; }
.tfy-pagination .page-numbers { border: 1px solid #ccc; padding: 6px 9px; font-size: 10px; }
.tfy-pagination .current { background: #050505; color: #fff !important; }

@media (min-width: 640px) {
  .tfy-header { --tfy-header-height: 56px; }
  .tfy-header-inner { grid-template-columns: 62px minmax(0, 1fr) 62px; }
  .tfy-header-control { width: 62px; }
  .tfy-icon-button { width: 38px; height: 38px; }
  .tfy-brand img, .tfy-brand .custom-logo { height: calc(var(--tfy-logo-height, 26px) + 4px) !important; max-width: 240px !important; }
  .tfy-brand-text { font-size: 23px; max-width: 260px; }
  .tfy-overlay-panel, .tfy-overlay-backdrop { top: 56px; }
  .tfy-menu-panel, .tfy-search-panel { width: min(100%, 720px); margin-inline: auto; }
  .tfy-story-rail-wrap { padding: 12px 10px 15px; }
  .tfy-story-rail { grid-auto-columns: 132px; gap: 12px; }
  .tfy-rail-image { width: 132px; height: 92px; }
  .tfy-rail-title { font-size: 13px; line-height: 1.05; }
  .tfy-feature-band { padding: 22px 14px; gap: 24px; }
  .tfy-feature-title { font-size: 31px; line-height: 1.01; }
  .tfy-feature-excerpt { font-size: 12px; line-height: 1.35; }
  .tfy-feature-meta { font-size: 9px; }
  .tfy-feature-meta img { width: 20px; height: 20px; }
  .tfy-card-grid { padding: 18px 10px; gap: 18px 14px; }
  .tfy-card-title { font-size: 15px; }
  .tfy-feed-divider { margin: 12px 10px 30px; }
  .tfy-feed { padding: 0 10px; max-width: 840px; margin-inline: auto; }
  .tfy-feed-item { grid-template-columns: 250px minmax(0, 1fr); gap: 18px; margin-bottom: 20px; }
  .tfy-feed-image { width: 250px; height: 178px; }
  .tfy-feed-category { font-size: 9px; }
  .tfy-feed-title { font-size: 24px; }
  .tfy-feed-date { font-size: 9px; }
  .tfy-feed-excerpt { font-size: 12px; line-height: 1.35; -webkit-line-clamp: 4; }
  .tfy-footer { padding: 34px 16px 24px; }
  .tfy-footer-logo img, .tfy-footer-logo .custom-logo { width: 150px; max-height: 36px; }
  .tfy-footer-description { font-size: 11px; line-height: 1.45; }
  .tfy-footer-menu a { font-size: 10px; }
  .tfy-copyright { font-size: 9px; }
}

@media (min-width: 1000px) {
  .tfy-header { --tfy-header-height: 66px; }
  .tfy-header-inner { grid-template-columns: 76px minmax(0, 1fr) 76px; }
  .tfy-header-control { width: 76px; }
  .tfy-icon-button { width: 42px; height: 42px; }
  .tfy-brand img, .tfy-brand .custom-logo { height: calc(var(--tfy-logo-height, 26px) + 8px) !important; max-width: 300px !important; }
  .tfy-brand-text { font-size: 27px; max-width: 320px; }
  .tfy-overlay-panel, .tfy-overlay-backdrop { top: 66px; }
  .tfy-story-rail-wrap { padding: 18px 14px 22px; }
  .tfy-story-rail { grid-auto-flow: initial; grid-template-columns: repeat(5, 1fr); overflow: visible; gap: 20px; }
  .tfy-story-rail .tfy-rail-card:nth-child(n+6) { display: none; }
  .tfy-rail-image { width: 100%; height: auto; aspect-ratio: 1.46 / 1; }
  .tfy-rail-title { font-size: 18px; }
  .tfy-feature-band { grid-template-columns: 1fr 1fr; padding: 34px 24px; gap: 38px; }
  .tfy-feature-title { font-size: 44px; }
  .tfy-feature-excerpt { max-width: 540px; font-size: 15px; }
  .tfy-feature-meta { font-size: 10px; }
  .tfy-card-grid { grid-template-columns: repeat(4, 1fr); padding: 24px 14px; gap: 20px; }
  .tfy-card-title { font-size: 18px; }
  .tfy-feed { max-width: 920px; }
  .tfy-feed-item { grid-template-columns: 300px minmax(0, 1fr); }
  .tfy-feed-image { width: 300px; height: 220px; }
  .tfy-feed-title { font-size: 30px; }
  .tfy-feed-excerpt { font-size: 14px; }
}

/* Controls that must stay white on black even inside a light section. */
html:root body.tfy-editorial-theme:not(#wpadminbar) #page .tfy-light .tfy-load-more,
html:root body.tfy-editorial-theme:not(#wpadminbar) #page .tfy-light .tfy-search-form button,
html:root body.tfy-editorial-theme:not(#wpadminbar) #page .tfy-light .tfy-pagination .current {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* Version 4: Popular Posts opens directly from the three-line header control */
.tfy-popular-panel {
  padding: 0 0 13px;
  overflow-x: hidden;
}
.tfy-popular-panel .tfy-panel-heading {
  margin: 0;
  padding-inline: 12px;
}
.tfy-popular-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 92px;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline mandatory;
  scrollbar-width: thin;
  padding: 9px 6px 12px;
  border-bottom: 1px solid #e9e9e9;
  -webkit-overflow-scrolling: touch;
}
.tfy-popular-card {
  min-width: 0;
  margin: 0;
  scroll-snap-align: start;
}
.tfy-popular-image {
  display: block !important;
  min-height: 0 !important;
  padding: 0 !important;
  aspect-ratio: 1.24 / 1;
  overflow: hidden;
  background: #090909;
}
.tfy-popular-image img,
.tfy-popular-image .tfy-no-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tfy-popular-title {
  margin: 5px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 10px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: 0;
}
.tfy-popular-title a {
  display: block !important;
  min-height: 0 !important;
  padding: 0 !important;
  color: #050505 !important;
  -webkit-text-fill-color: #050505 !important;
}
.tfy-popular-title a:hover,
.tfy-popular-title a:focus {
  text-decoration: underline;
}
.tfy-popular-empty {
  margin: 0;
  padding: 15px 12px;
  border-bottom: 1px solid #e9e9e9;
  font-size: 12px;
}
.tfy-panel-nav-heading {
  padding: 11px 12px 6px;
  font-family: Arial, sans-serif;
  font-size: 9px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: #777 !important;
  -webkit-text-fill-color: #777 !important;
}
.tfy-panel-menu-nav {
  padding: 0 12px;
}
.tfy-panel-menu-nav > .tfy-menu-list {
  display: flex;
  gap: 5px 12px;
  overflow-x: auto;
  margin: 0;
  padding: 0 0 3px;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
.tfy-panel-menu-nav > .tfy-menu-list > li {
  flex: 0 0 auto;
  border: 0;
}
.tfy-panel-menu-nav > .tfy-menu-list > li > a {
  min-height: 29px;
  padding: 5px 0;
  font-family: Arial, sans-serif;
  font-size: 10px;
  line-height: 1.1;
  font-weight: 700;
  text-transform: uppercase;
}
.tfy-panel-menu-nav .sub-menu {
  display: none;
}

@media (min-width: 640px) {
  .tfy-popular-panel {
    width: min(100%, 980px);
    margin-inline: auto;
  }
  .tfy-popular-strip {
    grid-auto-flow: initial;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    overflow: visible;
    padding: 12px;
    gap: 12px;
  }
  .tfy-popular-title {
    font-size: 12px;
    line-height: 1.12;
  }
  .tfy-panel-menu-nav > .tfy-menu-list {
    flex-wrap: wrap;
    overflow: visible;
  }
}
