/*
Theme Name: RomanFront Child
Theme URI: https://maltacreativa.com
Template: blogum
Author: Malta Creativa
Author URI: https://maltacreativa.com
Description: Child theme for RomanFront – a premium, multi-style magazine WordPress theme. Use this child theme to safely add your own customizations without losing them on parent theme updates.
Version: 1.11.0
Requires at least: 6.3
Tested up to: 7.0
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: blogum-child

Copyright: (C) 2026 Malta Creativa. All rights reserved.
*/

/*
 * Add your custom CSS overrides below this line.
 * The parent theme (Blogum) styles are automatically loaded before these.
 * =========================================================================
 */

/* ============================================================
   1. COVER / FEED SPLIT LAYOUT — single source of truth
   ------------------------------------------------------------
   The parent theme declares the split several times with
   conflicting values. The block that actually wins on the front
   end is assets/css/main.css (~line 17179):

     .blg-layout:not(.blg-layout--editor) .blg-cover,
     .blg-layout:not(.blg-layout--editor) .tft-single-hero,
     .blg-layout:not(.blg-layout--editor) #blg-cover { ... 44.5% !important }

   Because that selector list contains #blg-cover, the whole rule
   is matched with ID-level specificity (1,2,0). A plain
   `.blg-cover { width: X !important }` in this file (0,1,0) is
   therefore SILENTLY IGNORED, while the matching `.blg-feed`
   rule (no ID, 0,3,0) is not — which is how you end up with a
   cover at 44.5% next to a feed at 65% and a broken layout.

   The rules below re-declare both sides with the same ID-level
   specificity so they actually win, and read their values from
   the two custom properties right underneath. To change the
   split ratio, edit ONLY those two values (they must add up to
   100%). Do not add width rules for .blg-cover / .blg-feed
   anywhere else.

   NOTE: 44.5 / 55.5 is what the site currently renders. It is
   kept deliberately so this patch does not change the visual
   ratio — it only makes the ratio controllable from here.
   ============================================================ */
:root {
  --rf-cover-width: 44.5%;
  --rf-feed-width: 55.5%;
}

.blg-layout {
  display: flex !important;
  overflow-x: hidden !important;
}

@media (min-width: 1025px) {

  .blg-layout:not(.blg-layout--editor) #blg-cover,
  .blg-layout:not(.blg-layout--editor) .blg-cover {
    width: var(--rf-cover-width) !important;
    max-width: var(--rf-cover-width) !important;
    flex: 0 0 var(--rf-cover-width) !important;
    min-width: 320px !important;
  }

  .blg-layout:not(.blg-layout--editor) #blg-feed,
  .blg-layout:not(.blg-layout--editor) .blg-feed {
    width: var(--rf-feed-width) !important;
    max-width: var(--rf-feed-width) !important;
    flex: 0 0 var(--rf-feed-width) !important;
    min-width: 400px !important;
  }
}

.blg-cover {
  height: 100vh !important;
  position: sticky !important;
  top: 0 !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
  z-index: 10 !important;
}

.blg-feed {
  position: relative !important;
  z-index: 5 !important;
  overflow-x: hidden !important;
}

@media (max-width: 1024px) {

  .blg-cover,
  .blg-feed {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    position: relative !important;
  }
}

/* ============================================================
   2. ELEMENTOR: KEEP STRETCHED SECTIONS INSIDE THE FEED COLUMN
   ------------------------------------------------------------
   Elementor measures "Stretch Section" against the element set
   in Elementor > Settings > Advanced > "Stretched Section Fit
   To", which defaults to <body>. Inside this split layout that
   makes a stretched section 100vw wide and pulls it left by the
   width of the cover (inline style: width:100vw; left:-XXXpx),
   so its left half disappears underneath the cover panel and the
   right half of the feed is left empty.

   The correct fix is the Elementor setting itself:
       Elementor > Settings > Advanced
       > Stretched Section Fit To = #blg-feed

   These rules are the belt-and-braces fallback: they beat
   Elementor's inline styles (a stylesheet !important outranks a
   non-important inline declaration), so the layout stays correct
   even if the setting is lost, or a page still carries cached
   inline offsets. Covers both the legacy section markup and the
   Elementor 3.16+ flex container.
   ============================================================ */
.blg-feed .elementor-section-stretched,
.blg-feed .e-con--stretched {
  width: 100% !important;
  max-width: 100% !important;
  left: 0 !important;
  right: auto !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Same problem, WordPress core version: the parent theme styles
   .alignfull / .alignwide with `margin: 2rem calc(50% - 50vw)`
   and `width: 100vw` (style.css lines 22-23), which is measured
   against the viewport, not the feed column. Contain them. */
.blg-feed .alignfull,
.blg-feed .alignwide {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* ============================================================
   3. OVERLAY MENU: REMOVE BROKEN LOCAL-FILE BACKGROUND IMAGE
   ------------------------------------------------------------
   The parent theme's assets/css/main.css hardcodes the full-screen
   hamburger overlay menu's decorative background image as a literal
   local filesystem path from whoever last edited that file on their
   own computer:

     .blg-overlay-menu::before {
       background-image: url('C:/Users/ftnav/.gemini/antigravity/brain/...');
     }

   A file:// path can never resolve for a site visitor — every browser
   blocks it ("Not allowed to load local resource"), so this fires a
   console error and a failed image load on every page, on every visit,
   for every visitor. There is no real asset to point it at (it only
   ever existed on that one computer), so the safe fix is to remove the
   image rather than guess a replacement.
   ============================================================ */
.blg-overlay-menu::before {
  background-image: none !important;
}

/* ============================================================
   4. MOBILE HERO TITLE DISAPPEARS BELOW 640px
   ------------------------------------------------------------
   The parent theme's assets/css/main.css has, inside a media
   query meant for a DIFFERENT cover layout (one built from a
   grid with an inline style="grid-template-columns:..."):

     @media (max-width: 640px) {
       .blg-cover-articles>div:first-child { display: none !important; }
     }

   That rule is a positional selector, not a specific one — "the
   first <div> child of .blg-cover-articles, whatever it is". In
   the grid layout it was written for, that first child is some
   decorative element meant to be hidden on small phones. But on
   THIS site's cover layout (skin: vogue), that same first child
   is .blg-hero-main-wrap — the entire headline block (title +
   category tag). Below 640px width, every visitor's phone shows
   the cover background image with no headline text at all.

   .blg-cover-articles>div:first-child has specificity (0,2,0)
   (one class + :first-child, which counts the same as a class)
   with !important, so a plain ".blg-hero-main-wrap { display:
   flex !important }" (0,1,0) still loses on specificity even
   though this file loads after the parent's. Qualifying the
   selector with two ancestors pushes it to (0,3,0), which wins
   outright — no reliance on cascade order to break a tie.
   ============================================================ */
@media (max-width: 640px) {
  .blg-layout .blg-cover-articles .blg-hero-main-wrap {
    display: flex !important;
  }
}

/* ============================================================
   5. HERO TITLE OVERSIZED ON TALL NARROW PHONES
   ------------------------------------------------------------
   Revealing the headline above exposed a second parent-theme bug
   in the same spot. Three rules compete for .blg-hero-main-title's
   font-size, all !important:

     (default)          clamp(3rem,   6.5vw, 7.5rem)
     max-width: 480px   clamp(2.2rem, 18vw,  3.5rem)   <- sized for narrow screens
     max-height: 850px  clamp(2.5rem, 10vh,  5.5rem)   <- sized for SHORT screens

   All three have equal specificity, so the LAST one in the
   stylesheet wins ties — which happens to be the max-height rule.
   On a normal tall-narrow phone (e.g. 375×812) both the
   max-width:480px and max-height:850px conditions are true at
   once, but the max-height rule's 10vh formula was written
   assuming a short/landscape viewport; on a tall portrait phone
   it computes a huge font (10vh of 812px ≈ 81px) that doesn't
   fit in a 375px-wide line, so the title clips off-screen instead
   of wrapping.

   Re-declaring the max-width:480px rule here (same selector,
   same specificity, !important) makes IT the last one instead,
   since this file is enqueued after the parent's main.css —
   restoring the width-based sizing that actually fits narrow
   phones, regardless of viewport height.
   ============================================================ */
@media (max-width: 480px) {
  .blg-hero-main-title {
    font-size: clamp(2.2rem, 18vw, 3.5rem) !important;
  }
}

/* ============================================================
   6. MOBILE-ONLY CLICKABLE "SCROLL DOWN" HINT ON THE COVER
   ------------------------------------------------------------
   A bouncing chevron button, injected into .blg-cover by the
   small script in functions.php (romanfront_child_scroll_hint_button),
   shown only in the same max-width: 1024px range where the layout
   stacks cover-above-feed — i.e. exactly when a visitor could
   plausibly not realize there's more content below. On desktop's
   side-by-side split view both columns are already visible, so
   the hint stays hidden there. It's a real <button> (not a CSS
   ::after pseudo-element) specifically so it can be clicked —
   it smooth-scrolls to #blg-feed on click, see functions.php.

   Colored via `mask-image` (not `background-image` on an <img>)
   so it inherits `--blg-accent-color` and re-colors itself
   automatically with whatever skin is active, same as every other
   accent-colored element in the theme.

   z-index: 20 clears .blg-cover-content's own z-index: 10 stacking
   context so the arrow isn't hidden behind the cover's text block,
   while staying below .blg-side-badge-wrap (z-index: 30) and the
   overlay menu (z-index in the thousands) in case of overlap.

   It scrolls away naturally with the rest of the cover once the
   visitor scrolls past it (position: absolute within .blg-cover,
   not fixed) — no extra logic needed to hide it after the first
   scroll, and no risk of it getting stuck on-screen over the feed.

   Positioned with `top: calc(100vh - 60px)`, NOT `bottom`: as
   fixed elsewhere in this file, .blg-cover's own box is taller
   than 100vh on this site (measured ~1078px on a 812px-tall
   viewport). `bottom: 32px` would sit 32px from .blg-cover's own
   (taller) bottom edge — mostly below the fold, invisible until
   the visitor had already scrolled partway down, defeating the
   whole point of the hint. `top: calc(100vh - 60px)` anchors it
   to a fixed distance from the CURRENT viewport's bottom edge
   instead, however tall .blg-cover's own box turns out to be.
   ============================================================ */
.rf-scroll-hint-btn {
  display: none;
}

@media (max-width: 1024px) {
  .rf-scroll-hint-btn {
    display: block;
    position: absolute;
    top: calc(100vh - 60px);
    inset-inline-start: 50%;
    width: 44px;
    height: 44px;
    z-index: 20;
    cursor: pointer;
    border: 0;
    padding: 0;
    background: transparent;
    transform: translateX(-50%);
  }

  .rf-scroll-hint-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 30px;
    height: 30px;
    background-color: var(--blg-accent-color, #ffffff);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 16.5a1 1 0 0 1-.7-.29l-6-6a1 1 0 1 1 1.41-1.42L12 14.09l5.29-5.3a1 1 0 1 1 1.41 1.42l-6 6a1 1 0 0 1-.7.29z'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 16.5a1 1 0 0 1-.7-.29l-6-6a1 1 0 1 1 1.41-1.42L12 14.09l5.29-5.3a1 1 0 1 1 1.41 1.42l-6 6a1 1 0 0 1-.7.29z'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
  }

  @media (prefers-reduced-motion: no-preference) {
    .rf-scroll-hint-btn::after {
      animation: rf-scroll-hint 1.8s ease-in-out infinite;
    }
  }
}

@keyframes rf-scroll-hint {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50%      { transform: translateY(10px); opacity: 1; }
}
