/* =============================================================
   GnetNP Child — custom.css
   Loaded last by functions.php so these rules win specificity ties.

   NOTE: The parent's CSS reset (link defaults, ul/ol margins,
   p/h1 padding, etc.) is pulled in by the child's style.css via
   @import — see comment at top of style.css. Don't duplicate
   reset rules here.
   ============================================================= */


/* -------------------------------------------------------------
   ZERO HTML/BODY MARGIN — kill the gap below the footer
   -------------------------------------------------------------
   The browser default is body { margin: 8px }, which shows as a
   thin strip of damask wallpaper at the very bottom of the page
   (below #footer) and along the top/sides. The parent reset in
   style.css does zero this via its universal selector, but we
   re-assert it here as a safety net in case style.css is being
   served from an aggressive cache layer.
   ----------------------------------------------------------- */
html, body {
	margin: 0;
	padding: 0;
}


/* -------------------------------------------------------------
   HOMEPAGE: single full-width post list
   -------------------------------------------------------------
   The parent splits the homepage main column into #PrimaryLeft
   (160px tower-ad column) + #PrimaryMid (~510px tabs column).
   The child collapses that into a single full-width column
   called #PrimaryFull which inherits .post / .archiveTitle /
   .metas styles from /styles/dark.css.
   ----------------------------------------------------------- */
#PrimaryFull {
	width: 680px;       /* matches #container width set in /styles/dark.css */
	float: left;
}

#PrimaryFull .post {
	margin-bottom: 24px;
	padding-bottom: 4px;
	/* No bottom border — the .metas top hairline (below) acts as the
	   visual separator between stories AND the divider between
	   content and metadata. One line, two jobs. */
}

/* Quiet down the parent theme's noisy .metas styling on the homepage
   list: drop the dashed border and lighter-grey background box. Use
   a single solid hairline above the meta as the only separator.
   Scoped to #PrimaryFull so category/archive pages keep the parent
   look until we decide to apply the same treatment there too —
   to extend it globally, remove the "#PrimaryFull " prefix below. */
#PrimaryFull .metas {
	border: none !important;
	background: transparent !important;
	border-top: 1px solid #3a3a3a !important;
	padding: 10px 0 0 !important;
	margin-top: 12px;
	margin-bottom: 0;
}

/* Give the archive title a little more breathing room on the
   homepage list since each story stands on its own here. */
#PrimaryFull h1.archiveTitle {
	margin-bottom: 6px;
}

/* Larger 220x124 thumbnails in the homepage post list.
   Paired with the gnet-home-thumb image size in functions.php.
   max-width handles the responsive case (drops below). */
#PrimaryFull .post img.alignleft {
	width: 220px;
	height: auto;
	max-width: 100%;
	margin: 4px 8px 2px 0;
	float: left;
	display: block;
}

/* Bump body / excerpt type for easier reading in the wider single
   column. Paired with the excerpt_length filter in functions.php
   (~85 words instead of WP's default 55). Scoped to #PrimaryFull
   so article pages and category pages keep their current size. */
#PrimaryFull .post p {
	font-size: 1.3em;
	line-height: 1.2;
}

/* The "Read More »" link injected at the end of each excerpt by
   gnetnp_child_excerpt_more (functions.php). Inherits the parent
   theme's link color; this just nudges it slightly so it reads as
   a call-to-action rather than a stray word in the paragraph. */
#PrimaryFull .post .read-more {
	white-space: nowrap;
	font-weight: bold;
}

/* Pagination row sits cleanly under the last story. */
#PrimaryFull + .navigation,
#PrimaryFull .navigation {
	clear: both;
	padding: 14px 0 4px;
	text-align: right;
}


/* -------------------------------------------------------------
   IN-FEED LEADERBOARD SLOTS
   -------------------------------------------------------------
   Three Customizer-driven slots (gnet_home_leader_1/2/3) injected
   by home.php after stories 3, 6, and 10. Default content is a
   728x90 buzzclick "Body Leaders" ad. The content column is 680px,
   so the banner needs to scale DOWN proportionally to fit cleanly
   inside the column rather than break out.

   Scaling strategy:
     • Container constrained to 100% of the column width
     • Images inside: max-width 100% + height auto → natural scaling
     • Iframes inside: max-width 100% + aspect-ratio hint so the
       iframe collapses proportionally (modern browsers, 2021+).
       For the standard 728x90 banner, the rendered slot is
       680 x ~84px at the current column width.
   ----------------------------------------------------------- */
#PrimaryFull .home-leaderboard-slot {
	margin: 22px auto 28px;
	padding: 4px 0;
	max-width: 100%;
	text-align: center;
	overflow: hidden;
	line-height: 0;          /* kills any phantom space from text nodes around inline-block ad markup */
}

/* If a buzzclick script (or any ad) renders an <img>, scale it
   to fit the column. Browsers preserve aspect ratio automatically
   with max-width + height: auto. */
#PrimaryFull .home-leaderboard-slot img {
	max-width: 100%;
	height: auto;
	display: inline-block;
	border: 0;
}

/* If the ad renders an iframe (some buzzclick zones do this),
   max-width handles the shrinking. aspect-ratio keeps the height
   proportional instead of leaving the iframe boxed at its width
   attribute's full height. Targeted at common banner sizes so
   non-banner iframes (e.g. videos) aren't affected. */
#PrimaryFull .home-leaderboard-slot iframe {
	max-width: 100%;
	border: 0;
	display: inline-block;
}

#PrimaryFull .home-leaderboard-slot iframe[width="728"][height="90"] {
	width: 100%;
	height: auto;
	aspect-ratio: 728 / 90;
}

/* Some ad scripts wrap their output in a div with fixed inline
   dimensions. Force the wrapper to be flexible too. */
#PrimaryFull .home-leaderboard-slot > div,
#PrimaryFull .home-leaderboard-slot > a {
	max-width: 100%;
	display: inline-block;
}

/* The widget's H2 title would normally show as a chunky heading
   above the ad. We mark it screen-reader-only via the widget
   registration in functions.php, but assert it here too. */
.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;
}


/* -------------------------------------------------------------
   CLICK-ANYWHERE-ON-STORY NAVIGATION
   -------------------------------------------------------------
   The whole .post block becomes a click target (JS in home.php
   reads data-href and navigates). Visual cue is the pointer
   cursor. Carve-outs:
     • .metas — date / categories / edit row. The row has its
       own links; clicking dead space in the row must NOT trigger
       story navigation, so the cursor returns to default text-
       select inside it. The links themselves stay pointer.
     • Real <a> tags everywhere else keep pointer naturally.
   ----------------------------------------------------------- */
#PrimaryFull .clickable-post {
	cursor: pointer;
}

#PrimaryFull .clickable-post .metas {
	cursor: default;
}

#PrimaryFull .clickable-post .metas a {
	cursor: pointer;
}


/* -------------------------------------------------------------
   SEARCH FORM
   -------------------------------------------------------------
   Replaces the parent's bright-white pill with a dark, minimal
   input that fits the dark.css palette. Inline SVG icon button
   on the right, accent-color border on focus.

   These rules override the parent's #s / #searchsubmit ID rules
   from /styles/dark.css by being more specific (form.gnetnp-
   searchform input#s instead of just #s) AND loading later.
   Wrapped under .gnetnp-searchform so they only apply to our
   replacement searchform.php template — not anywhere the parent
   theme still uses the old markup.
   ----------------------------------------------------------- */
form.gnetnp-searchform {
	position: relative;
	display: block;
	width: 100%;
	margin: 0 0 14px;
	padding: 0;
	background: transparent;
	border: none;
}

form.gnetnp-searchform fieldset {
	border: 0;
	padding: 0;
	margin: 0;
}

form.gnetnp-searchform input[type="search"]#s {
	width: 100%;
	height: 38px;
	padding: 0 42px 0 12px;
	background: #1a1a1a;
	border: 1px solid #3a3a3a;
	border-radius: 0;
	color: #e6e2dd;
	font-family: Georgia, 'Cormorant Garamond', serif;
	font-size: 14px;
	font-style: italic;
	box-sizing: border-box;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
	float: none;        /* parent had float:left on #s */
}

form.gnetnp-searchform input[type="search"]#s::placeholder {
	color: #8a8a8a;
	opacity: 1;         /* Firefox defaults placeholder to 0.54 opacity */
}

form.gnetnp-searchform input[type="search"]#s:focus {
	outline: none;
	border-color: #7a1f2b;   /* oxblood accent on focus */
	background: #222;
	color: #ffffff;
}

/* Kill the small "x" clear button Webkit adds inside type=search.
   It clashes with our SVG icon position. */
form.gnetnp-searchform input[type="search"]#s::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}

form.gnetnp-searchform button#searchsubmit {
	position: absolute;
	top: 0;
	right: 0;
	width: 38px;
	height: 38px;
	margin: 0;
	padding: 0;
	background: transparent;
	border: none;
	cursor: pointer;
	color: #8a8a8a;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.18s ease;
	float: none;        /* parent had float:left on #searchsubmit */
}

form.gnetnp-searchform button#searchsubmit:hover,
form.gnetnp-searchform button#searchsubmit:focus {
	color: #c8825a;     /* warm accent on hover */
	outline: none;
}

form.gnetnp-searchform button#searchsubmit svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
	display: block;
}

/* Note: .screen-reader-text styles live in the global block at the
   top of the leaderboard section above — applies to the search form
   label too. */


/* -------------------------------------------------------------
   SIDEBAR TOWER (bottom of right sidebar)
   -------------------------------------------------------------
   The 160x600 tower ad block lives at the bottom of the right
   sidebar now. Center it so a non-standard widget width (e.g.
   a 300x250 ad widget swapped in later) still looks deliberate.
   ----------------------------------------------------------- */
#sidebar_tower_wrap {
	margin-top: 12px;
	text-align: center;
}

#sidebar_tower_wrap iframe {
	display: inline-block;
	max-width: 100%;
}


/* =============================================================
   RESPONSIVE — stack sidebar under body on narrow viewports
   -------------------------------------------------------------
   The desktop layout is fixed: #container at 680px floats left,
   #sidebar floats right. Below ~1000px viewport that arrangement
   doesn't fit, so we collapse to a single column: content first,
   sidebar stacked underneath.

   Same #container + #sidebar IDs are used by home.php, archive.php
   (category / tag / date archives), single.php and page.php — so
   unscoped selectors apply to all of them.

   The parent theme isn't responsive, so we're overriding several
   of its fixed widths with !important to win specificity.
   ============================================================= */

@media (max-width: 1000px) {

	/* Drop the floats and let everything be full-width.
	 * Bare #container / #sidebar (no ancestor) so the rule applies
	 * on every template, not just the homepage. */
	#container,
	#sidebar {
		float: none !important;
		width: auto !important;
		max-width: 100% !important;
		margin-left: auto !important;
		margin-right: auto !important;
	}

	#PrimaryFull {
		width: 100% !important;
		max-width: 100%;
		float: none !important;
		padding: 0 12px;
		box-sizing: border-box;
	}

	#sidebar {
		clear: both;
		margin-top: 36px !important;
		padding: 0 12px;
		box-sizing: border-box;
	}

	/* The featured slider has a fixed 680px width baked into the
	   parent CSS. Cap it at the viewport so it doesn't blow out. */
	#featured-slider,
	#paginate-featured-slider {
		max-width: 100%;
	}

	#mediabar {
		max-width: 100%;
		overflow: hidden;
	}
}


/* Phone-sized screens: stack the thumbnail above the excerpt text
   instead of beside it (220px image squeezed next to body text on
   a 360px screen looks bad). */
@media (max-width: 600px) {
	#PrimaryFull .post img.alignleft {
		float: none;
		display: block;
		margin: 0 auto 12px;
		width: 100%;
		max-width: 320px;
		height: auto;
	}

	/* Center post titles since image is now centered too */
	#PrimaryFull h1.archiveTitle {
		text-align: left;
	}
}
