/*
Theme Name: tasmag
Theme URI: https://tasmag.com
Author: For tasmag.com
Author URI: https://tasmag.com
Description: A bold editorial magazine theme with a distinctive display serif, strong typographic hierarchy, and a featured-story homepage. Includes category sections, sidebar widgets, custom logo support, and full block-editor styling.
Version: 1.0.0
Requires at least: 5.8
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tasmag
Tags: magazine, news, blog, two-columns, custom-menu, featured-images, editor-style, threaded-comments, translation-ready
*/

/* ============================================================
   1. Design tokens
   ============================================================ */
:root {
  --ink:        #1a1714;   /* near-black text */
  --ink-soft:   #4a443d;   /* secondary text */
  --paper:      #f6f1e7;   /* warm cream background */
  --paper-2:    #efe8db;   /* slightly darker panel */
  --card:       #fffdf8;   /* card background */
  --accent:     #d6321f;   /* editorial vermilion */
  --accent-dk:  #a8210f;
  --rule:       #d8cfbe;   /* hairline rules */
  --gold:       #b08d2e;

  --serif: "Fraunces", "Playfair Display", Georgia, "Times New Roman", serif;
  --sans:  "Space Grotesk", "Helvetica Neue", Arial, sans-serif;

  --maxw: 1200px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --shadow: 0 18px 40px -24px rgba(26, 23, 20, 0.5);
}

/* ============================================================
   2. Reset & base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 20% 0%, rgba(214,50,31,0.04), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(176,141,46,0.05), transparent 45%);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent-dk); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 0.5em;
}

p { margin: 0 0 1.2em; }

.site-container { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(1px,1px,1px,1px);
  white-space: nowrap;
}

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1rem; z-index: 1000; border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

/* ============================================================
   3. Header / masthead
   ============================================================ */
.site-header {
  border-bottom: 3px double var(--ink);
  background: var(--paper);
  position: relative;
}

.topbar {
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.topbar .site-container {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 0.55rem; padding-bottom: 0.55rem;
}
.topbar .topbar-date { font-weight: 500; }
.topbar .topbar-tag { color: var(--accent-dk); font-weight: 700; }

.masthead { text-align: center; padding: 1.8rem 0 1.4rem; }
.site-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 0.95;
}
.site-title a { color: var(--ink); text-decoration: none; }
.site-title a:hover { color: var(--accent); }
.site-description {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0.7rem 0 0;
}
/* Logo: auto-cropped on upload, then clamped here for crisp display
   across desktop, tablet, and mobile. height auto keeps aspect ratio. */
.custom-logo-link { display: inline-block; line-height: 0; }
.custom-logo {
  margin: 0 auto;
  display: block;
  width: auto;
  height: auto;
  max-height: 56px;     /* desktop */
  max-width: 100%;
}
@media (max-width: 1024px) {
  .custom-logo { max-height: 50px; }  /* tablet / iPad */
}
@media (max-width: 720px) {
  .custom-logo { max-height: 40px; }  /* mobile */
}

/* ============================================================
   4. Navigation
   ============================================================ */
.main-nav {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.main-nav .site-container {
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.main-nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0;
}
.main-nav li { position: relative; }
.main-nav a {
  display: block;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 0.95rem 1.1rem;
  text-decoration: none;
  transition: color 0.18s ease;
}
.main-nav a:hover,
.main-nav .current-menu-item > a { color: var(--accent); }
.main-nav .current-menu-item > a::after {
  content: ""; position: absolute; left: 1.1rem; right: 1.1rem; bottom: 0.55rem;
  height: 2px; background: var(--accent);
}

/* submenus */
.main-nav ul ul {
  display: none; position: absolute; top: 100%; left: 0;
  background: var(--card); min-width: 200px; flex-direction: column;
  box-shadow: var(--shadow); border: 1px solid var(--rule); z-index: 50;
}
.main-nav li:hover > ul { display: flex; }
.main-nav ul ul a { padding: 0.7rem 1rem; }

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent; color: var(--ink);
  border: 1px solid var(--rule); padding: 0.5rem 0.6rem; cursor: pointer;
  border-radius: 4px; line-height: 0;
}
.menu-toggle-bars { display: inline-block; width: 22px; height: 16px; position: relative; }
.menu-toggle-bars span {
  position: absolute; left: 0; right: 0; height: 2px;
  background: currentColor; border-radius: 2px; transition: transform 0.2s ease, opacity 0.2s ease;
}
.menu-toggle-bars span:nth-child(1) { top: 0; }
.menu-toggle-bars span:nth-child(2) { top: 7px; }
.menu-toggle-bars span:nth-child(3) { top: 14px; }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   5. Layout shell
   ============================================================ */
.content-area { padding: 2.5rem 0 3.5rem; }
.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.layout-grid.full-width { grid-template-columns: minmax(0, 1fr); }

/* ============================================================
   6. Homepage — featured block
   ============================================================ */
.section-label {
  display: flex; align-items: center; gap: 0.9rem;
  font-family: var(--sans);
  font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent-dk);
  margin: 0 0 1.4rem;
}
.section-label::after {
  content: ""; flex: 1; height: 1px; background: var(--rule);
}

.featured-block {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 2rem;
  align-items: start;
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 3px double var(--ink);
}
.feature-lead .feature-thumb { display: block; aspect-ratio: 16/10; overflow: hidden; border-radius: 3px; }
.feature-lead .feature-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.feature-lead:hover .feature-thumb img { transform: scale(1.04); }
.feature-lead .entry-title {
  font-size: clamp(1.9rem, 3.6vw, 3rem);
  margin: 1rem 0 0.5rem;
}
.feature-lead .entry-title a { color: var(--ink); }
.feature-lead .entry-title a:hover { color: var(--accent); text-decoration: none; }
.feature-lead .entry-excerpt { font-size: 1.05rem; color: var(--ink-soft); max-width: 56ch; }

.feature-secondary { display: flex; flex-direction: column; gap: 1.4rem; }
.feature-mini {
  display: grid; grid-template-columns: 96px 1fr; gap: 1rem; align-items: start;
  padding-bottom: 1.4rem; border-bottom: 1px solid var(--rule);
}
.feature-mini:last-child { border-bottom: 0; padding-bottom: 0; }
.feature-mini .feature-thumb { display: block; aspect-ratio: 1; border-radius: 3px; overflow: hidden; }
.feature-mini .feature-thumb img { width: 100%; height: 100%; object-fit: cover; }
.feature-mini .entry-title { font-size: 1.12rem; line-height: 1.15; margin: 0; }
.feature-mini .entry-title a { color: var(--ink); }
.feature-mini .entry-title a:hover { color: var(--accent); text-decoration: none; }

/* ============================================================
   7. Post grids & cards
   ============================================================ */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2rem 1.8rem;
}
.category-section { margin-bottom: 3rem; }

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card .card-thumb { display: block; aspect-ratio: 3/2; overflow: hidden; background: var(--paper-2); }
.card .card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .card-body { padding: 1.1rem 1.2rem 1.4rem; display: flex; flex-direction: column; flex: 1; }
.card .entry-title { font-size: 1.3rem; margin: 0.5rem 0 0.6rem; }
.card .entry-title a { color: var(--ink); }
.card .entry-title a:hover { color: var(--accent); text-decoration: none; }
.card .entry-excerpt { font-size: 0.92rem; color: var(--ink-soft); margin-bottom: 1rem; }
.card .read-more { margin-top: auto; }

/* meta */
.entry-meta {
  font-family: var(--sans);
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-soft);
  display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; align-items: center;
}
.entry-meta .cat-link {
  color: var(--accent-dk); font-weight: 700;
}
.entry-meta .sep { opacity: 0.4; }

.read-more {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--sans); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-dk);
}
.read-more::after { content: "\2192"; transition: transform 0.2s ease; }
.read-more:hover { text-decoration: none; }
.read-more:hover::after { transform: translateX(4px); }

/* ============================================================
   8. Single post & pages
   ============================================================ */
.single-header { max-width: 760px; margin: 0 auto 2rem; text-align: center; }
.single-header .entry-meta { justify-content: center; margin-bottom: 1rem; }
.single-header .entry-title { font-size: clamp(2.1rem, 5vw, 3.6rem); }
.single-header .entry-subtitle { font-size: 1.15rem; color: var(--ink-soft); font-style: italic; }

.featured-media { margin: 0 0 2.5rem; }
.featured-media img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 4px;
}
.featured-media--top img { border-radius: 6px; }
.featured-media figcaption {
  font-family: var(--sans); font-size: 0.78rem; color: var(--ink-soft);
  text-align: center; margin-top: 0.6rem; letter-spacing: 0.04em;
}

.entry-content {
  max-width: 720px; margin: 0 auto;
  font-size: 1.12rem; line-height: 1.75;
}
.entry-content > p:first-of-type::first-letter {
  font-family: var(--serif); float: left;
  font-size: 4.4rem; line-height: 0.78; font-weight: 600;
  padding: 0.1em 0.12em 0 0; color: var(--accent);
}
.entry-content h2 { font-size: 1.9rem; margin-top: 2rem; }
.entry-content h3 { font-size: 1.45rem; margin-top: 1.6rem; }
.entry-content a { text-decoration: underline; text-underline-offset: 2px; }
.entry-content blockquote {
  margin: 1.8rem 0; padding: 0.4rem 0 0.4rem 1.6rem;
  border-left: 4px solid var(--accent);
  font-family: var(--serif); font-size: 1.4rem; font-style: italic;
  color: var(--ink);
}
.entry-content img { border-radius: 4px; margin: 1.6rem auto; }
.entry-content ul, .entry-content ol { padding-left: 1.4rem; }
.entry-content code {
  background: var(--paper-2); padding: 0.15em 0.4em; border-radius: 3px;
  font-size: 0.92em;
}
.entry-content pre {
  background: var(--ink); color: #f4ede0; padding: 1.2rem; border-radius: 6px;
  overflow-x: auto;
}
.entry-content pre code { background: none; padding: 0; }

.entry-footer {
  max-width: 720px; margin: 2.5rem auto 0; padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center;
}
.tag-links a {
  display: inline-block; font-family: var(--sans);
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--paper-2); color: var(--ink-soft);
  padding: 0.3rem 0.7rem; border-radius: 999px; margin: 0 0.3rem 0.3rem 0;
}
.tag-links a:hover { background: var(--accent); color: #fff; text-decoration: none; }

.author-box {
  max-width: 720px; margin: 2.5rem auto 0;
  display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 1.2rem;
  background: var(--card); border: 1px solid var(--rule);
  border-radius: 6px; padding: 1.4rem;
}
.author-box .avatar { border-radius: 50%; width: 72px; height: 72px; }
.author-box-body { min-width: 0; }   /* allow text to wrap instead of overflowing */
.author-box h4 { margin: 0 0 0.3rem; font-size: 1.2rem; }
.author-box p {
  margin: 0; font-size: 0.95rem; color: var(--ink-soft);
  overflow-wrap: anywhere; word-break: break-word;  /* break long URLs */
}
.author-box p a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.author-box p a:hover { color: var(--accent-dk); }
@media (max-width: 480px) {
  .author-box { grid-template-columns: 1fr; text-align: center; }
  .author-box .avatar { margin: 0 auto; }
}

/* page header for archives */
.archive-header {
  text-align: center; padding: 1rem 0 2.2rem; margin-bottom: 2rem;
  border-bottom: 3px double var(--ink);
}
.archive-header .archive-title { font-size: clamp(2rem, 5vw, 3.2rem); }
.archive-header .archive-description { color: var(--ink-soft); max-width: 60ch; margin: 0.6rem auto 0; }

/* ============================================================
   9. Sidebar / widgets
   ============================================================ */
.sidebar { font-size: 0.95rem; }
.widget {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: 6px; padding: 1.3rem 1.4rem; margin-bottom: 1.6rem;
}
.widget-title {
  font-family: var(--sans); font-size: 0.82rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-dk);
  margin: 0 0 1rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--rule);
}
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: 0.45rem 0; border-bottom: 1px solid var(--rule); }
.widget li:last-child { border-bottom: 0; }
.widget a { color: var(--ink); }
.widget a:hover { color: var(--accent); }

/* ============================================================
   10. Pagination & comments
   ============================================================ */
.pagination {
  display: flex; justify-content: center; gap: 0.5rem;
  margin: 3rem 0 0; font-family: var(--sans);
}
.pagination .page-numbers {
  display: inline-flex; min-width: 42px; height: 42px;
  align-items: center; justify-content: center;
  border: 1px solid var(--rule); border-radius: 3px;
  font-size: 0.85rem; font-weight: 600; color: var(--ink); padding: 0 0.6rem;
}
.pagination .page-numbers.current { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pagination a.page-numbers:hover { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }

.comments-area { max-width: 720px; margin: 3rem auto 0; }
.comments-title { font-size: 1.6rem; margin-bottom: 1.4rem; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .children { list-style: none; padding-left: 1.6rem; }
.comment-body {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: 6px; padding: 1.1rem 1.3rem; margin-bottom: 1.2rem;
}
.comment-author { font-family: var(--sans); font-weight: 700; font-size: 0.9rem; }
.comment-metadata { font-size: 0.74rem; color: var(--ink-soft); letter-spacing: 0.06em; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%; padding: 0.7rem 0.9rem; border: 1px solid var(--rule);
  border-radius: 4px; font-family: var(--sans); font-size: 1rem;
  background: var(--card); margin-bottom: 1rem;
}
.comment-form input:focus, .comment-form textarea:focus {
  outline: 2px solid var(--accent); border-color: var(--accent);
}

/* buttons */
.btn, button, input[type="submit"], .wp-block-button__link {
  font-family: var(--sans); font-size: 0.82rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--accent); color: #fff; border: 0;
  padding: 0.8rem 1.5rem; border-radius: 3px; cursor: pointer;
  transition: background 0.2s ease;
}
.btn:hover, button:hover, input[type="submit"]:hover { background: var(--accent-dk); }

/* ============================================================
   11. Footer
   ============================================================ */
.site-footer {
  background: var(--ink); color: #e8ddc9; margin-top: 3rem;
  padding: 3rem 0 1.5rem;
}
.site-footer a { color: #e8ddc9; }
.site-footer a:hover { color: #fff; }
.footer-widgets {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem; margin-bottom: 2.5rem;
}
.site-footer .widget { background: transparent; border: 0; padding: 0; }
.site-footer .widget-title { color: var(--gold); border-color: rgba(255,255,255,0.12); }
.site-footer .widget li { border-color: rgba(255,255,255,0.1); }
.site-footer .widget a { color: #e8ddc9; }

/* Any image placed in a footer widget (logo, badge) autoscales and centers,
   mirroring the header logo behaviour — without forcing the widget's text
   alignment to change. */
.site-footer .widget img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 80px;
  width: auto;
  margin-left: auto;
  margin-right: auto;
}
.footer-bottom {
  padding-top: 1.4rem;
  display: flex; flex-direction: column; align-items: center;
  gap: 1.1rem;
  font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.08em;
  color: #b9ad97;
}
.footer-social-row { display: flex; justify-content: center; }
/* Add the top divider only when there are footer widgets above the bottom row. */
.footer-widgets + .footer-bottom { border-top: 1px solid rgba(255,255,255,0.14); }

.footer-copyright {
  text-align: center;
  margin-top: 1.2rem;
  font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.06em;
  color: #b9ad97;
}
.footer-copyright a { color: #e8ddc9; text-decoration: underline; text-underline-offset: 2px; }
/* If there's a bottom row above it, give the copyright a subtle separation. */
.footer-bottom + .footer-copyright { margin-top: 1.4rem; }

/* ============================================================
   12. Responsive
   ============================================================ */
@media (max-width: 900px) {
  .layout-grid { grid-template-columns: minmax(0, 1fr); }
  .featured-block { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  body { font-size: 17px; }
  .menu-toggle { display: block; }
  .main-nav ul { display: none; flex-direction: column; width: 100%; }
  .main-nav ul.is-open { display: flex; }
  .main-nav a { padding: 0.8rem 0; border-bottom: 1px solid var(--rule); width: 100%; text-align: center; }
  .main-nav ul ul { position: static; box-shadow: none; border: 0; }
  .topbar .topbar-tag { display: none; }
  .entry-content > p:first-of-type::first-letter { font-size: 3.4rem; }
}

/* ============================================================
   13. v1.1 — Dark mode, social, share, ads, visibility
   ============================================================ */

/* ---- Dark mode palette ---- */
:root[data-theme="dark"] {
  --ink:        #f1e9da;
  --ink-soft:   #b3a892;
  --paper:      #14110d;
  --paper-2:    #1d1812;
  --card:       #1b1610;
  --accent:     #ef5a3f;
  --accent-dk:  #f4795f;
  --rule:       #382f25;
  --gold:       #caa14a;
  --shadow:     0 18px 40px -24px rgba(0,0,0,0.7);
}
/* Elements that must stay dark regardless of mode */
:root[data-theme="dark"] .site-footer { background: #0e0b08; }
.entry-content pre { background: #161210; }
:root[data-theme="dark"] .entry-content pre { background: #0b0907; }
html { transition: none; }
body, .site-header, .card, .widget, .site-footer { transition: background-color 0.25s ease, color 0.25s ease; }

/* ---- Nav tools row (social + mode toggle) ---- */
.nav-inner { position: relative; min-height: 48px; gap: 1rem; }
.nav-tools {
  margin-left: auto;
  display: flex; align-items: center; gap: 0.5rem;
  flex: 0 0 auto;
}
#primary-menu { flex: 1 1 auto; }

/* ---- Social bar (own row beneath the nav) ---- */
.social-bar {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.social-bar .site-container {
  display: flex; justify-content: center; align-items: center;
  padding-top: 0.6rem; padding-bottom: 0.6rem;
}
.social-bar .social-icons { gap: 0.6rem; }

/* ---- Mode toggle button ---- */
.mode-toggle {
  width: 36px; height: 36px; padding: 0; border-radius: 50%;
  border: 1px solid var(--rule); background: transparent; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; text-transform: none; letter-spacing: 0; transition: background 0.2s ease, color 0.2s ease;
  flex: 0 0 auto;
}
.mode-toggle:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.mode-toggle svg { fill: currentColor; display: block; }
.mode-toggle .icon-sun { display: none; }
.mode-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .mode-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .mode-toggle .icon-moon { display: none; }

/* ---- Social icons ---- */
.social-icons { display: inline-flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.social-icon {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink); border: 1px solid var(--rule);
  flex: 0 0 auto; padding: 0; line-height: 1;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.social-icon svg {
  fill: currentColor; display: block;
  width: 16px; height: 16px;
  margin: auto;                /* dead-center inside the flex circle */
}
.social-icon:hover { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }
.social-icons--header .social-icon { width: 32px; height: 32px; }
.social-icons--footer .social-icon { color: #e8ddc9; border-color: rgba(255,255,255,0.2); }
.social-icons--footer .social-icon:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- Share buttons ---- */
.share-buttons {
  max-width: 720px; margin: 0 auto; display: flex; flex-wrap: wrap;
  align-items: center; gap: 0.5rem; padding-top: 0.5rem;
}
.share-label {
  font-family: var(--sans); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft);
  margin-right: 0.3rem;
}
.share-btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--sans); font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0; text-transform: none;
  padding: 0.45rem 0.95rem; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink);
  cursor: pointer; transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.share-btn .share-icon { fill: currentColor; flex: 0 0 auto; transition: fill 0.18s ease; }

/* Per-brand colours. Resting state: brand-coloured icon + subtle border.
   Hover/focus: fill with the brand colour, white text + icon. */
.share-x        { --brand: #000000; }
.share-facebook { --brand: #1877f2; }
.share-linkedin { --brand: #0a66c2; }
.share-whatsapp { --brand: #25d366; }
.share-email    { --brand: #d6321f; }   /* theme accent for generic email */
.share-copy     { --brand: #555555; }

.share-btn[class*="share-"] { border-color: color-mix(in srgb, var(--brand) 35%, var(--rule)); }
.share-btn .share-icon { color: var(--brand); }
.share-btn:hover, .share-btn:focus-visible {
  background: var(--brand); border-color: var(--brand); color: #fff; text-decoration: none;
}
.share-btn:hover .share-icon, .share-btn:focus-visible .share-icon { color: #fff; }

/* Dark mode: keep brand fills, just lift the resting border a touch. */
:root[data-theme="dark"] .share-btn { background: var(--card); }


/* ---- Ad slots ---- */
.ad-slot { margin: 2rem auto; text-align: center; }
.ad-slot.ad-header, .ad-widget-wrap { margin: 1.4rem auto; text-align: center; }
.ad-in-article { margin: 2.4rem 0; }
.ad-label {
  display: block; font-family: var(--sans); font-size: 0.62rem;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-soft);
  opacity: 0.6; margin-bottom: 0.4rem;
}
.ad-slot img { display: inline-block; margin: 0 auto; }
.ad-widget .widget-title { text-align: center; }

/* ---- Per-article layout variants ---- */
.single-post.layout-minimal .entry-content > p:first-of-type::first-letter {
  float: none; font-size: inherit; line-height: inherit; padding: 0; color: inherit; font-family: var(--sans);
}
.single-post.layout-minimal .entry-content { font-size: 1.05rem; }
.single-post.layout-minimal .single-header .entry-title { font-size: clamp(1.8rem, 4vw, 2.8rem); }

/* ============================================================
   14. Visibility utility classes (driven by Customizer)
   ============================================================ */
.hide-excerpts .card .entry-excerpt,
.hide-excerpts .feature-lead .entry-excerpt { display: none; }
.hide-meta .card .entry-meta,
.hide-meta .feature-mini .entry-meta,
.hide-meta .feature-lead .entry-meta { display: none; }
.hide-readmore .card .read-more,
.hide-readmore .feature-lead .read-more { display: none; }
.no-sidebar .sidebar { display: none; }

@media (max-width: 900px) {
  .mobile-hide-sidebar .sidebar { display: none; }
}

@media (max-width: 720px) {
  .mobile-hide-topbar .topbar { display: none; }
  .mobile-hide-footer-widgets .footer-widgets { display: none; }
  .mobile-hide-excerpts .entry-excerpt { display: none; }

  /* Compact cards: image + title only */
  .mobile-compact .card .entry-excerpt,
  .mobile-compact .card .read-more,
  .mobile-compact .card .entry-meta { display: none; }
  .mobile-compact .card .card-body { padding: 0.8rem 0.9rem 1rem; }
  .mobile-compact .card .entry-title { font-size: 1.15rem; margin: 0; }

  /* Nav tools become inline on mobile; menu drops below */
  .nav-inner { justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
  .nav-tools { position: static; transform: none; }
  .menu-toggle { display: inline-flex; }
  #primary-menu { order: 5; flex-basis: 100%; width: 100%; }
  .share-buttons { gap: 0.4rem; }
}

/* ============================================================
   15. v1.1 — Reading experience (time, progress, related)
   ============================================================ */

/* Featured image leading the article */
.featured-media--top { margin-top: 0.5rem; margin-bottom: 1.6rem; }

/* Meta row + reading time */
.single-meta-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 0.4rem 0.9rem; margin-bottom: 0.6rem;
}
.single-meta-row .entry-meta { margin: 0; }
.reading-time {
  font-family: var(--sans); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft);
  position: relative; padding-left: 0.95rem;
}
.reading-time::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 4px; height: 4px;
  margin-top: -2px; border-radius: 50%; background: var(--accent);
}

/* Scroll progress bar */
.reading-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  background: transparent; z-index: 1000; pointer-events: none;
}
.reading-progress-fill {
  display: block; height: 100%; width: 0;
  background: var(--accent); will-change: width;
}

/* Related stories */
.related-stories {
  max-width: var(--maxw); margin: 3rem auto 1rem;
  padding-top: 2rem; border-top: 1px solid var(--rule);
}
.related-stories .section-label { margin-bottom: 1.4rem; }

@media print {
  .reading-progress, .share-buttons, .ad-slot, .site-footer, .main-nav { display: none !important; }
}

/* ============================================================
   16. Featured carousel
   ============================================================ */
.featured-carousel { position: relative; margin: 0 0 2.5rem; }
.carousel-viewport {
  position: relative; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; border-radius: 4px;
}
.carousel-viewport::-webkit-scrollbar { display: none; }
.carousel-track { display: flex; }
.carousel-slide {
  flex: 0 0 100%; scroll-snap-align: start; position: relative;
  min-height: 460px; display: flex; align-items: flex-end;
  background: var(--card); overflow: hidden;
}
.carousel-media { position: absolute; inset: 0; }
.carousel-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carousel-slide::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(10,8,6,0.92) 0%, rgba(10,8,6,0.55) 38%, rgba(10,8,6,0.05) 70%, transparent 100%);
}
.carousel-caption {
  position: relative; z-index: 2; color: #fff;
  padding: 2.4rem clamp(1.5rem, 4vw, 3rem); max-width: 760px;
}
.carousel-caption .entry-meta { color: rgba(255,255,255,0.85); }
.carousel-caption .cat-link { color: #fff; background: var(--accent); padding: 0.15rem 0.6rem; border-radius: 2px; }
.carousel-caption .entry-title { color: #fff; font-size: clamp(1.8rem, 4vw, 3rem); margin: 0.5rem 0 0.6rem; }
.carousel-caption .entry-title a { color: #fff; }
.carousel-caption .entry-excerpt { color: rgba(255,255,255,0.9); margin-bottom: 0.9rem; max-width: 60ch; }
.carousel-caption .read-more { color: #fff; }

.carousel-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0,0,0,0.45); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s ease; padding: 0;
}
.carousel-arrow:hover { background: var(--accent); }
.carousel-prev { left: 0.8rem; }
.carousel-next { right: 0.8rem; }

.carousel-dots {
  position: absolute; bottom: 1rem; left: 0; right: 0; z-index: 3;
  display: flex; gap: 0.5rem; justify-content: center;
}
.carousel-dot {
  width: 9px; height: 9px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 0; background: rgba(255,255,255,0.45); transition: background 0.2s ease, transform 0.2s ease;
}
.carousel-dot.is-active { background: #fff; transform: scale(1.3); }

@media (max-width: 720px) {
  .carousel-slide { min-height: 380px; }
  .carousel-arrow { width: 38px; height: 38px; }
}

/* ============================================================
   17. Newsletter signup (inline, sidebar, pop-up)
   ============================================================ */
.newsletter-block {
  background: var(--paper-2); border: 1px solid var(--rule);
  border-radius: 6px; padding: 1.8rem;
}
.newsletter-end-article { max-width: 720px; margin: 0 auto; }
.newsletter-title { font-size: 1.4rem; margin: 0 0 0.4rem; }
.newsletter-text { color: var(--ink-soft); font-family: var(--sans); font-size: 0.95rem; margin: 0 0 1rem; }
.newsletter-fields { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.newsletter-fields input[type="text"],
.newsletter-fields input[type="email"] {
  flex: 1 1 180px; min-width: 0; padding: 0.7rem 0.9rem;
  border: 1px solid var(--rule); border-radius: 4px; background: var(--paper);
  color: var(--ink); font-family: var(--sans); font-size: 0.95rem;
}
.newsletter-fields input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.newsletter-submit {
  flex: 0 0 auto; padding: 0.7rem 1.4rem; border: 0; border-radius: 4px;
  background: var(--accent); color: #fff; font-family: var(--sans);
  font-weight: 600; letter-spacing: 0.03em; cursor: pointer;
}
.newsletter-submit:hover { background: var(--accent-dk); }
.newsletter-submit:disabled { opacity: 0.6; cursor: default; }
.newsletter-status { font-family: var(--sans); font-size: 0.88rem; margin: 0.7rem 0 0; min-height: 1.1em; }
.newsletter-status.is-ok { color: #2e7d32; }
.newsletter-status.is-error { color: var(--accent); }
:root[data-theme="dark"] .newsletter-status.is-ok { color: #7fd28b; }
/* Honeypot — hidden from people, visible to dumb bots */
.newsletter-hp { position: absolute !important; left: -9999px !important; height: 0; overflow: hidden; }

/* Sidebar variant */
.widget .newsletter-block { padding: 1.3rem; }
.widget .newsletter-fields { flex-direction: column; }
.widget .newsletter-fields input[type="text"],
.widget .newsletter-fields input[type="email"] { flex: 0 0 auto; width: 100%; }
.widget .newsletter-submit { width: 100%; }

/* Pop-up modal */
.nl-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.nl-modal[hidden] { display: none; }
.nl-modal-overlay { position: absolute; inset: 0; background: rgba(10,8,6,0.62); backdrop-filter: blur(2px); }
.nl-modal-card {
  position: relative; z-index: 1; width: 100%; max-width: 440px;
  background: var(--paper); border-radius: 10px; padding: 2rem 1.8rem 1.8rem;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,0.5); animation: tasmag-pop 0.25s ease;
}
/* The form block inside the modal is plain — the card provides the chrome. */
.nl-modal-card .newsletter-title { padding-right: 2rem; }
.nl-modal-card .newsletter-block { border: 0; background: transparent; padding: 0; }
.nl-modal-card .newsletter-fields { flex-direction: column; align-items: stretch; }
.nl-modal-card .newsletter-fields input[type="text"],
.nl-modal-card .newsletter-fields input[type="email"] { flex: 0 0 auto; width: 100%; }
.nl-modal-card .newsletter-submit { width: 100%; }
.nl-modal-close {
  position: absolute; top: 0.5rem; right: 0.7rem; z-index: 2;
  width: 2rem; height: 2rem; background: transparent; border: 0;
  font-size: 1.7rem; line-height: 1; color: var(--ink-soft); cursor: pointer;
}
.nl-modal-close:hover { color: var(--accent); }
@keyframes tasmag-pop { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .nl-modal-card { animation: none; } }

/* ============================================================
   18. Search form
   ============================================================ */
.search-form { width: 100%; }
.search-form-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  box-sizing: border-box;
  align-items: stretch;
}
.search-form .search-field {
  flex: 1 1 0;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.2;
  background: var(--card);
  color: var(--ink);
}
.search-form .search-field:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-form .search-submit {
  flex: 0 0 auto;
  white-space: nowrap;
  margin: 0;
  padding: 0.7rem 1.4rem;
  border-radius: 4px;
}

/* Only stack on genuinely tiny widths where side-by-side would cramp. */
@media (max-width: 360px) {
  .search-form-row { flex-direction: column; }
  .search-form .search-field,
  .search-form .search-submit { width: 100%; }
}

/* In a sidebar/footer widget, fill the column width. */
.widget .search-form-row { max-width: 100%; }

/* ============================================================
   19. Mobile sticky share bar (single posts, phones only)
   ============================================================ */
.mobile-share-bar { display: none; }
@media (max-width: 720px) {
  .mobile-share-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    justify-content: space-around; align-items: center; gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px)); /* iPhone home bar */
    background: var(--paper); border-top: 1px solid var(--rule);
    box-shadow: 0 -6px 20px -12px rgba(0,0,0,0.3);
  }
  .mshare-btn {
    flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center;
    height: 44px; border: 0; border-radius: 8px; background: transparent;
    color: var(--ink); cursor: pointer;
  }
  .mshare-btn svg { fill: currentColor; }
  .mshare-x:hover, .mshare-x:active { color: #000; }
  .mshare-facebook { color: #1877f2; }
  .mshare-whatsapp { color: #25d366; }
  .mshare-copy { color: var(--accent); }
  /* Keep the in-flow share buttons too, but add breathing room so the
     fixed bar never covers the footer/content. */
  body.single-post-has-bar { padding-bottom: 60px; }
}

/* ============================================================
   19. Sticky mobile share bar
   ============================================================ */
.share-bar-mobile { display: none; }

@media (max-width: 720px) {
  .share-bar-mobile {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1500;
    background: var(--paper);
    border-top: 1px solid var(--rule);
    padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    gap: 0.4rem;
    box-shadow: 0 -6px 20px -12px rgba(0,0,0,0.4);
  }
  .share-bar-btn {
    flex: 1 1 0;
    display: inline-flex; align-items: center; justify-content: center;
    height: 42px; border-radius: 6px;
    border: 0; cursor: pointer; color: #fff;
    background: var(--brand, var(--accent));
  }
  .share-bar-btn .share-icon { fill: currentColor; }
  .share-bar-btn.share-x        { background: #000; }
  .share-bar-btn.share-facebook { background: #1877f2; }
  .share-bar-btn.share-whatsapp { background: #25d366; }
  .share-bar-btn.share-email    { background: #d6321f; }
  .share-bar-btn.share-copy     { background: #555; }
  /* Keep content clear of the fixed bar so it never hides the footer/last line. */
  body.single-post-has-sticky-share { padding-bottom: 64px; }
}

/* ============================================================
   20. Back to top button
   ============================================================ */
.back-to-top {
  position: fixed;
  right: 1.2rem; bottom: 1.2rem;
  z-index: 1400;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--accent); color: #fff;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.45);
  transition: background 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}
.back-to-top[hidden] { display: none; }
.back-to-top:hover { background: var(--accent-dk); transform: translateY(-2px); }
.back-to-top svg { display: block; }

/* On mobile single posts the sticky share bar sits at the bottom, so lift the
   button above it to avoid overlap. */
@media (max-width: 720px) {
  .single-post-has-sticky-share .back-to-top { bottom: 66px; }
}

/* ============================================================
   21. Category section variants + "More" link
   ============================================================ */

/* Compact: smaller cards, more per row, tighter type. */
.category-style-compact .post-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1.4rem 1.2rem;
}
.category-style-compact .card .card-body { padding: 0.8rem 0.9rem 1rem; }
.category-style-compact .card .entry-title { font-size: 1.05rem; margin: 0.35rem 0 0.4rem; }
.category-style-compact .card .entry-excerpt { font-size: 0.85rem; }
.category-style-compact .card .entry-meta { font-size: 0.66rem; }

/* List: image + title only, horizontal rows, very compact. */
.category-style-list .post-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem 1.6rem;
}
.category-style-list .card {
  flex-direction: row; align-items: stretch;
  box-shadow: none; border: 0; background: transparent; border-radius: 0;
}
.category-style-list .card:hover { transform: none; box-shadow: none; }
.category-style-list .card .card-thumb {
  flex: 0 0 96px; width: 96px; height: 96px; aspect-ratio: 1/1; border-radius: 4px;
}
.category-style-list .card .card-body { padding: 0 0 0 0.9rem; justify-content: center; }
.category-style-list .card .entry-title { font-size: 1.05rem; margin: 0.2rem 0 0; }
.category-style-list .card .entry-excerpt,
.category-style-list .card .read-more { display: none; }

/* "More in [Category]" link below each section. */
.section-more { margin-top: 1.4rem; }
.section-more-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--sans); font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent);
}
.section-more-link span { transition: transform 0.2s ease; }
.section-more-link:hover { text-decoration: none; }
.section-more-link:hover span { transform: translateX(4px); }
