/*
Theme Name: GridPulse Classic
Theme URI: https://example.com/gridpulse
Author: Max
Author URI: https://example.com
Description: The original GridPulse design (pre-Apple redesign): a fast, lightweight, SEO-optimized viral content grid with image-top cards, built-in AdSense/ad management, logo upload, schema.org markup, Open Graph tags, and flicker-free dark mode. This is the classic v1.8.2 look kept as a separate theme so it can be activated alongside the newer version.
Version: 1.8.2
Requires at least: 6.0
Tested up to: 6.7
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: gridpulse
Tags: blog, news, photography, grid-layout, two-columns, custom-logo, custom-colors, custom-menu, featured-images, threaded-comments, translation-ready, dark-mode
*/

/* =========================================================
   1. DESIGN TOKENS (CSS Variables)
   ========================================================= */
:root {
  /* Light theme (default) */
  --gp-bg:            #ffffff;
  --gp-bg-alt:        #f4f4f6;
  --gp-surface:       #ffffff;
  --gp-text:          #16181d;
  --gp-text-muted:    #5c606b;
  --gp-heading:       #0d0e12;
  --gp-border:        #e7e8ec;
  --gp-accent:        #ff4d2e;   /* overridden by Customizer */
  --gp-accent-ink:    #ffffff;
  --gp-link:          var(--gp-accent);
  --gp-shadow:        0 1px 2px rgba(16,18,29,.06), 0 8px 24px rgba(16,18,29,.06);
  --gp-shadow-hover:  0 4px 10px rgba(16,18,29,.10), 0 18px 40px rgba(16,18,29,.12);

  --gp-radius:        14px;
  --gp-radius-sm:     8px;
  --gp-maxw:          1280px;
  --gp-gap:           22px;
  --gp-header-h:      62px;

  --gp-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gp-font-head: "Barlow Condensed", var(--gp-font-body);
}

html[data-theme="dark"] {
  --gp-bg:            #0e0f13;
  --gp-bg-alt:        #15171d;
  --gp-surface:       #181a21;
  --gp-text:          #e8e9ec;
  --gp-text-muted:    #9a9eaa;
  --gp-heading:       #f6f7f9;
  --gp-border:        #262932;
  --gp-accent-ink:    #ffffff;
  --gp-shadow:        0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --gp-shadow-hover:  0 4px 10px rgba(0,0,0,.5), 0 18px 40px rgba(0,0,0,.5);
}

/* =========================================================
   2. RESET / BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--gp-font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--gp-text);
  background: var(--gp-bg-alt);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .2s ease, color .2s ease;
}
img, video, iframe, embed, object { max-width: 100%; height: auto; }
img { display: block; }
a { color: var(--gp-link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4,h5,h6 {
  font-family: var(--gp-font-head);
  color: var(--gp-heading);
  line-height: 1.15;
  font-weight: 700;
  margin: 0 0 .5em;
  letter-spacing: .2px;
}
p { margin: 0 0 1.2em; }
.gp-container { max-width: var(--gp-maxw); margin: 0 auto; padding: 0 18px; }
.screen-reader-text {
  position: absolute !important; clip: rect(1px,1px,1px,1px);
  width: 1px; height: 1px; overflow: hidden; word-wrap: normal !important;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 9999;
  background: var(--gp-accent); color: var(--gp-accent-ink);
  padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* =========================================================
   3. HEADER / NAV
   ========================================================= */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--gp-surface);
  border-bottom: 1px solid var(--gp-border);
  backdrop-filter: saturate(140%) blur(8px);
}
.site-header .gp-container {
  display: flex; align-items: center; gap: 16px;
  height: var(--gp-header-h);
}
.site-branding { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.site-branding img { max-height: 38px; width: auto; }
.site-title {
  font-family: var(--gp-font-head);
  font-size: 28px; font-weight: 800; margin: 0; line-height: 1;
  letter-spacing: -.3px; text-transform: uppercase;
}
.site-title a { color: var(--gp-heading); }
.site-title a:hover { text-decoration: none; }
.site-title .gp-dot { color: var(--gp-accent); }

.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.main-nav a {
  display: block; padding: 8px 12px; border-radius: var(--gp-radius-sm);
  color: var(--gp-text); font-weight: 600; font-size: 14.5px;
  text-transform: uppercase; letter-spacing: .4px;
}
.main-nav a:hover { background: var(--gp-bg-alt); text-decoration: none; color: var(--gp-accent); }
.main-nav .current-menu-item > a { color: var(--gp-accent); }

.gp-header-tools { display: flex; align-items: center; gap: 6px; }
.gp-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 1px solid var(--gp-border);
  background: var(--gp-bg); color: var(--gp-text); border-radius: 10px;
  cursor: pointer; transition: .15s; padding: 0;
}
.gp-icon-btn:hover { border-color: var(--gp-accent); color: var(--gp-accent); }
.gp-icon-btn svg { width: 19px; height: 19px; }
.theme-toggle .gp-sun { display: none; }
html[data-theme="dark"] .theme-toggle .gp-sun { display: block; }
html[data-theme="dark"] .theme-toggle .gp-moon { display: none; }

.menu-toggle { display: none; }

/* Mobile nav */
@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .main-nav {
    position: fixed; inset: var(--gp-header-h) 0 auto 0;
    background: var(--gp-surface); border-bottom: 1px solid var(--gp-border);
    transform: translateY(-130%); transition: transform .25s ease;
    box-shadow: var(--gp-shadow); max-height: calc(100vh - var(--gp-header-h));
    overflow-y: auto;
  }
  .main-nav.is-open { transform: translateY(0); }
  .main-nav ul { flex-direction: column; padding: 8px 12px; gap: 0; }
  .main-nav a { padding: 12px; border-radius: 0; }
}

/* =========================================================
   4. AD SLOTS — styled to match: divider label + bordered box
   ========================================================= */

/* ── Wrapper ─────────────────────────────────────────────── */
.gp-ad-wrap {
  margin: 28px auto;
  text-align: center;
  max-width: 100%;
}

/* ── "Advertisement" label row with horizontal rules ──────── */
.gp-ad-label-row {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 10px; color: var(--gp-text-muted);
}
.gp-ad-label-row::before,
.gp-ad-label-row::after {
  content: ''; flex: 1; height: 1px; background: var(--gp-border);
}
.gp-ad-label-row span {
  font-size: 11.5px; font-weight: 400; letter-spacing: 1.6px;
  text-transform: uppercase; white-space: nowrap;
}

/* ── Ad content box ──────────────────────────────────────── */
.gp-ad-box {
  background: var(--gp-surface);
  border: 1px solid var(--gp-border);
  border-radius: 10px;
  overflow: hidden;
  display: inline-block; max-width: 100%;
  text-align: center;
}
.gp-ad-box ins,
.gp-ad-box iframe,
.gp-ad-box img { display: block; margin: 0 auto; max-width: 100%; }

/* ── Bottom rule ─────────────────────────────────────────── */
.gp-ad-bottom-line {
  height: 1px; background: var(--gp-border); margin-top: 10px;
}

/* ── Specific slot modifiers ─────────────────────────────── */
/* Below header: full-bleed strip, no inner box */
.gp-ad-wrap--header {
  margin: 0; border-bottom: 1px solid var(--gp-border);
  background: var(--gp-bg);
}
.gp-ad-wrap--header .gp-ad-box {
  border: none; border-radius: 0; background: transparent;
  width: 100%;
}
.gp-ad-wrap--header .gp-ad-bottom-line { display: none; }

/* In-content (inside single post) */
.gp-ad-wrap--incontent { margin: 2em 0; }

/* Homepage full-width in-grid */
.gp-ad-wrap--homepage {
  grid-column: 1 / -1;
  margin: 8px 0 16px;
}


/* =========================================================
   5. POST GRID (home / archive)
   ========================================================= */
.gp-layout { display: flex; gap: 32px; align-items: flex-start; padding: 26px 0 60px; }
.gp-main { flex: 1 1 auto; min-width: 0; }
.gp-sidebar { flex: 0 0 300px; position: sticky; top: calc(var(--gp-header-h) + 20px); }

.gp-grid {
  display: grid;
  grid-template-columns: repeat(var(--gp-cols, 3), 1fr);
  gap: var(--gp-gap);
}
/* Mobile overrides win because they set the property directly (not the var). */
@media (max-width: 1024px) { .gp-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px)  { .gp-grid { grid-template-columns: 1fr; } }

.gp-card {
  background: var(--gp-surface);
  border: 1px solid var(--gp-border);
  border-radius: var(--gp-radius);
  overflow: hidden;
  box-shadow: var(--gp-shadow);
  transition: transform .18s ease, box-shadow .18s ease;
  display: flex; flex-direction: column;
}
.gp-card:hover { transform: translateY(-4px); box-shadow: var(--gp-shadow-hover); }
.gp-card__thumb { position: relative; aspect-ratio: 16/10; overflow: hidden; background: var(--gp-bg-alt); }
.gp-card__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.gp-card:hover .gp-card__thumb img { transform: scale(1.05); }
.gp-card__cat {
  position: absolute; top: 10px; left: 10px;
  background: var(--gp-accent); color: var(--gp-accent-ink);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  padding: 4px 9px; border-radius: 6px;
}
.gp-card__cat:hover { text-decoration: none; opacity: .92; }
.gp-card__body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.gp-card__title { font-size: 20px; line-height: 1.2; margin: 0; }
.gp-card__title a { color: var(--gp-heading); }
.gp-card__title a:hover { color: var(--gp-accent); text-decoration: none; }
.gp-card__excerpt { color: var(--gp-text-muted); font-size: 14px; margin: 0; }
.gp-card__meta { margin-top: auto; font-size: 12.5px; color: var(--gp-text-muted); display: flex; gap: 10px; align-items: center; }

/* Featured / large card (first item) */
.gp-grid .gp-card--feature { grid-column: 1 / -1; }
.gp-grid .gp-card--feature .gp-card__thumb { aspect-ratio: 21/8; }
.gp-grid .gp-card--feature .gp-card__title { font-size: 30px; }
@media (max-width: 560px){ .gp-grid .gp-card--feature .gp-card__thumb { aspect-ratio: 16/10; } }

/* =========================================================
   6. SINGLE / PAGE
   ========================================================= */
.gp-article { background: var(--gp-surface); border: 1px solid var(--gp-border); border-radius: var(--gp-radius); padding: clamp(20px,4vw,44px); box-shadow: var(--gp-shadow); }
.gp-article__header { margin-bottom: 22px; }
.entry-title { font-size: clamp(28px,5vw,46px); margin: 0 0 14px; }
.gp-entry-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--gp-text-muted); font-size: 14px; align-items: center; }
.gp-entry-meta a { color: var(--gp-text-muted); }
.gp-entry-meta a:hover { color: var(--gp-accent); }
.gp-featured { margin: 0 0 26px; border-radius: var(--gp-radius); overflow: hidden; }
.gp-featured img { width: 100%; }

.entry-content { font-size: 17.5px; line-height: 1.75; }
.entry-content > * { margin-bottom: 1.25em; }
.entry-content h2 { font-size: 28px; margin-top: 1.4em; }
.entry-content h3 { font-size: 22px; margin-top: 1.3em; }
.entry-content a { text-decoration: underline; }
.entry-content img, .entry-content figure { border-radius: var(--gp-radius-sm); }
.entry-content blockquote {
  border-left: 4px solid var(--gp-accent); margin: 1.5em 0; padding: .4em 0 .4em 20px;
  font-style: italic; color: var(--gp-text-muted);
}
.entry-content pre { background: var(--gp-bg-alt); padding: 16px; border-radius: var(--gp-radius-sm); overflow:auto; }
.entry-content code { background: var(--gp-bg-alt); padding: 2px 6px; border-radius: 4px; font-size: .9em; }

.gp-breadcrumbs { font-size: 13px; color: var(--gp-text-muted); margin-bottom: 16px; }
.gp-breadcrumbs a { color: var(--gp-text-muted); }
.gp-breadcrumbs a:hover { color: var(--gp-accent); }
.gp-breadcrumbs .sep { margin: 0 6px; opacity: .5; }

.gp-tags { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 8px; }
.gp-tags a {
  font-size: 13px; background: var(--gp-bg-alt); color: var(--gp-text-muted);
  padding: 5px 11px; border-radius: 999px; text-decoration: none;
}
.gp-tags a:hover { background: var(--gp-accent); color: var(--gp-accent-ink); }

.gp-share { display: flex; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.gp-share a {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--gp-border); color: var(--gp-text);
}
.gp-share a:hover { border-color: var(--gp-accent); color: var(--gp-accent); text-decoration: none; }

.gp-author-box {
  display: flex; gap: 16px; margin-top: 34px; padding: 20px;
  background: var(--gp-bg-alt); border-radius: var(--gp-radius);
}
.gp-author-box img { border-radius: 50%; width: 64px; height: 64px; }
.gp-author-box h4 { margin: 0 0 4px; }
.gp-author-box p { margin: 0; color: var(--gp-text-muted); font-size: 14px; }

.gp-related { margin-top: 50px; }
.gp-related h3 { font-size: 22px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 18px; }

/* =========================================================
   7. SIDEBAR / WIDGETS
   ========================================================= */
.gp-widget { background: var(--gp-surface); border: 1px solid var(--gp-border); border-radius: var(--gp-radius); padding: 18px; margin-bottom: var(--gp-gap); }
.gp-widget .widget-title { font-size: 16px; text-transform: uppercase; letter-spacing: .6px; margin: 0 0 14px; padding-bottom: 10px; border-bottom: 2px solid var(--gp-accent); display: inline-block; }
.gp-widget ul { list-style: none; margin: 0; padding: 0; }
.gp-widget li { padding: 7px 0; border-bottom: 1px solid var(--gp-border); }
.gp-widget li:last-child { border-bottom: 0; }
.gp-widget a { color: var(--gp-text); }
.gp-widget a:hover { color: var(--gp-accent); }
@media (max-width: 980px) {
  /* In column direction, align-items controls WIDTH (cross axis).
     Switch to stretch so .gp-main fills the full container width —
     this stops the article card from overflowing the right edge on mobile. */
  .gp-layout  { flex-direction: column; align-items: stretch; }
  .gp-sidebar { flex-basis: auto; width: 100%; position: static; }
}

/* =========================================================
   8. SECTION HEADINGS / PAGINATION
   ========================================================= */
.gp-section-head { display: flex; align-items: center; gap: 14px; margin: 4px 0 20px; }
.gp-section-head h2 { font-size: 22px; text-transform: uppercase; letter-spacing: .6px; margin: 0; }
.gp-section-head::after { content: ""; flex: 1; height: 2px; background: var(--gp-border); }
.gp-section-head .bar { width: 30px; height: 4px; background: var(--gp-accent); border-radius: 2px; }

.gp-pagination { margin: 40px 0 0; display: flex; justify-content: center; }
.gp-pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; height: 42px; padding: 0 10px; margin: 0 3px;
  border: 1px solid var(--gp-border); border-radius: 10px; color: var(--gp-text);
  font-weight: 600; background: var(--gp-surface);
}
.gp-pagination .page-numbers.current,
.gp-pagination a.page-numbers:hover { background: var(--gp-accent); color: var(--gp-accent-ink); border-color: var(--gp-accent); text-decoration: none; }

/* =========================================================
   9. FOOTER
   ========================================================= */
.site-footer { background: var(--gp-surface); border-top: 1px solid var(--gp-border); margin-top: 30px; }
.gp-footer-widgets { display: grid; grid-template-columns: repeat(4,1fr); gap: 30px; padding: 44px 0 26px; }
@media (max-width: 880px){ .gp-footer-widgets { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 480px){ .gp-footer-widgets { grid-template-columns: 1fr; } }
.gp-footer-bottom { border-top: 1px solid var(--gp-border); padding: 18px 0; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; font-size: 13.5px; color: var(--gp-text-muted); }
.gp-social { display: flex; gap: 8px; }
.gp-social a { display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; border: 1px solid var(--gp-border); border-radius: 8px; color: var(--gp-text-muted); }
.gp-social a:hover { color: var(--gp-accent); border-color: var(--gp-accent); }
.gp-social svg { width: 17px; height: 17px; }

/* =========================================================
   10. FORMS / SEARCH / 404 / COMMENTS
   ========================================================= */
input[type=text], input[type=search], input[type=email], input[type=url], textarea, select {
  width: 100%; padding: 11px 14px; border: 1px solid var(--gp-border);
  border-radius: 10px; background: var(--gp-bg); color: var(--gp-text); font: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--gp-accent); outline-offset: 1px; border-color: var(--gp-accent); }
.gp-btn, button, input[type=submit] {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--gp-accent); color: var(--gp-accent-ink); border: 0;
  padding: 11px 20px; border-radius: 10px; font-weight: 700; cursor: pointer; font: inherit;
}
.gp-btn:hover, button:hover, input[type=submit]:hover { opacity: .92; text-decoration: none; }
.search-form { display: flex; gap: 8px; }
.gp-404 { text-align: center; padding: 80px 0; }
.gp-404 h1 { font-size: clamp(70px,15vw,140px); color: var(--gp-accent); margin: 0; line-height: 1; }

.comment-list { list-style: none; padding: 0; }
.comment-list .comment { background: var(--gp-bg-alt); border-radius: var(--gp-radius); padding: 16px; margin-bottom: 14px; }
.comment-list .children { list-style: none; margin-left: 24px; }
.comment-author { font-weight: 700; }
.comment-meta { font-size: 12.5px; color: var(--gp-text-muted); }

/* =========================================================
   11. UTIL
   ========================================================= */
.gp-load-more-wrap { text-align: center; margin-top: 36px; }
.gp-spin { animation: gpspin 1s linear infinite; }
@keyframes gpspin { to { transform: rotate(360deg); } }
.gp-fade-up { animation: gpfade .5s ease both; }
@keyframes gpfade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* =========================================================
   11b. GRADIENT PLACEHOLDER (no featured image)
   ========================================================= */

/* Wrapper — fills the .gp-card__thumb slot exactly */
.gp-no-img {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

/* Decorative SVG circles — subtle, stays behind the initial */
.gp-no-img__pattern {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* Large typographic initial — the hero character */
.gp-no-img__initial {
  position: relative; z-index: 1;
  font-family: var(--gp-font-head);
  font-size: clamp(64px, 14vw, 130px);
  font-weight: 800;
  color: rgba(255, 255, 255, .22);
  line-height: 1;
  letter-spacing: -.02em;
  user-select: none;
  text-transform: uppercase;
}

/* Single post hero placeholder: taller, larger initial */
.gp-featured--nophoto { margin: 0 0 26px; border-radius: var(--gp-radius); overflow: hidden; }
.gp-featured--nophoto .gp-no-img { position: relative; aspect-ratio: 21/8; }
.gp-featured--nophoto .gp-no-img__initial { font-size: clamp(80px, 18vw, 200px); }

/* =========================================================
   12. MOBILE POLISH (v1.4)
   ========================================================= */

/* ---- Safety: prevent wide media breaking layout (NOT overflow:hidden on html/body) ---- */
/* We do NOT use overflow-x on html or body — that clips article text and ads. */
/* Instead we ensure all known overflow sources are contained at element level.  */
img, video, iframe, embed, object, figure { max-width: 100%; height: auto; }
.entry-content pre { white-space: pre-wrap; word-break: break-all; }
.entry-content table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- Flex/grid children: prevent min-content blowout ---- */
.gp-main { min-width: 0; }

/* ---- Long text in articles: wrap gracefully ---- */
.entry-content,
.entry-title { overflow-wrap: break-word; }

/* ---- Never render visually empty widget boxes ---- */
.gp-widget:empty { display: none; }
.gp-footer-col:empty { display: none; }

/* ---- Footer widget grid (--gp-footer-cols set dynamically in PHP) ---- */
.gp-footer-widgets { grid-template-columns: repeat(var(--gp-footer-cols, 4), 1fr); }
@media (max-width: 880px) { .gp-footer-widgets { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .gp-footer-widgets { grid-template-columns: 1fr; } }

/* ---- Tablet (601 – 860px) ---- */
@media (max-width: 860px) {
  .gp-container { padding-left: 16px; padding-right: 16px; }
}

/* ---- Mobile (≤ 600px) ---- */
@media (max-width: 600px) {
  /* Keep enough side padding — do NOT go below 16px or content feels jammed */
  .gp-container { padding-left: 16px; padding-right: 16px; }
  :root { --gp-gap: 16px; }

  /* Header: prevent long site name from pushing buttons off-screen */
  .site-header .gp-container { gap: 8px; }
  .site-title { font-size: 20px; max-width: 56vw;
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gp-icon-btn { width: 36px; height: 36px; }

  /* Grid cards: image top, text below */
  .gp-card__thumb { aspect-ratio: 16/10; }
  .gp-card__body  { padding: 12px 14px 16px; }
  .gp-card__title { font-size: 18px; line-height: 1.25; }
  .gp-card__excerpt { display: none; }
  .gp-card__meta  { font-size: 12px; gap: 6px; }

  /* Feature card hero */
  .gp-grid .gp-card--feature .gp-card__thumb   { aspect-ratio: 16/9; }
  .gp-grid .gp-card--feature .gp-card__title   { font-size: 22px; }
  .gp-grid .gp-card--feature .gp-card__excerpt { display: block; }

  /* Single post article — comfortable readable padding, NOT compressed */
  .gp-article { padding: 20px 18px; }
  .entry-title { font-size: 26px; line-height: 1.2; }
  .entry-content { font-size: 16.5px; line-height: 1.8; }
  .gp-entry-meta { font-size: 13px; gap: 10px; }

  /* Footer bottom: stack on narrow screens */
  .gp-footer-bottom { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ---- Very small phones (≤ 360px) ---- */
@media (max-width: 360px) {
  .gp-container { padding-left: 12px; padding-right: 12px; }
  .site-title { font-size: 18px; max-width: 52vw; }
  .gp-card__title { font-size: 16px; }
  .gp-article { padding: 16px 14px; }
}

/* =========================================================
   13. FLOATING ELEMENTS — Reading bar, scroll-top, promo
   ========================================================= */

/* ── Reading progress bar ──────────────────────────────── */
#gp-read-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  height: 3px; background: transparent; pointer-events: none;
}
#gp-read-bar__fill {
  height: 100%; width: 0%;
  background: var(--gp-accent);
  transition: width .1s linear;
  border-radius: 0 2px 2px 0;
}

/* ── Scroll-to-top button (bottom-LEFT so it never overlaps the promo) ── */
#gp-scroll-top {
  position: fixed; z-index: 250;
  left: 16px; right: auto;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--gp-accent); color: var(--gp-accent-ink);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.26);
  opacity: 0; transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}
#gp-scroll-top.gp-visible { opacity: 1; transform: none; pointer-events: auto; }
#gp-scroll-top svg { width: 18px; height: 18px; }

/* ── Floating promo widget (compact, sits low in the bottom-right) ── */
#gp-promo {
  position: fixed; z-index: 300;
  right: 14px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: 260px;
  background: var(--gp-surface);
  border: 1px solid var(--gp-border);
  border-radius: 14px; padding: 11px 12px;
  box-shadow: 0 6px 26px rgba(0,0,0,.20), 0 2px 6px rgba(0,0,0,.10);
  display: flex; align-items: flex-start; gap: 10px;
  opacity: 0; transform: translateY(16px) scale(.97);
  transition: opacity .28s ease, transform .28s ease;
  pointer-events: none;
}
#gp-promo.gp-promo--visible { opacity: 1; transform: none; pointer-events: auto; }
#gp-promo[hidden] { display: none !important; }
.gp-promo--bottom-left { right: auto; left: 14px; }

.gp-promo__close {
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--gp-bg-alt); border: 1px solid var(--gp-border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; color: var(--gp-text-muted); transition: .15s;
}
.gp-promo__close:hover { background: var(--gp-accent); color: #fff; border-color: var(--gp-accent); }
.gp-promo__close svg { width: 11px; height: 11px; }

.gp-promo__icon { flex-shrink: 0; width: 42px; height: 42px; }
.gp-promo__icon svg,
.gp-promo__icon img { width: 42px; height: 42px; border-radius: 11px; display: block; }

.gp-promo__body { flex: 1; min-width: 0; padding-right: 16px; display: flex; flex-direction: column; gap: 2px; }
.gp-promo__title { display: block; font-size: 13.5px; font-weight: 700; color: var(--gp-heading); line-height: 1.25; }
.gp-promo__sub   { display: block; font-size: 11.5px; color: var(--gp-text-muted); line-height: 1.35; }
.gp-promo__btn {
  display: inline-block; margin-top: 7px;
  padding: 5px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: #fff;
  text-decoration: none; background: var(--gp-accent);
  transition: opacity .15s; align-self: flex-start;
}
.gp-promo__btn:hover { opacity: .88; text-decoration: none; }
.gp-promo--telegram .gp-promo__btn { background: #2AABEE; }
.gp-promo--whatsapp .gp-promo__btn { background: #25D366; }

/* Mobile: keep compact, anchor low, never full-bleed */
@media (max-width: 600px) {
  .gp-promo--no-mobile { display: none !important; }
  #gp-promo {
    width: min(300px, calc(100vw - 28px));
    right: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
  .gp-promo--bottom-left { left: 12px; right: auto; }
  /* On mobile the promo owns the bottom-right; nudge scroll-top up a touch */
  #gp-scroll-top { left: 12px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
}
