/*
Theme Name:   Tech Fold (GeneratePress Child)
Theme URI:    https://techfold.it.com/
Description:  Child theme for Tech Fold. Holds non-visual code only (locally hosted fonts,
              reading time, schema tweaks) plus minimal long-form prose styling.
              Layout and design live in Elementor Site Settings, not here.
Author:       Azy
Template:     generatepress
Version:      1.0.0
Text Domain:  techfold
*/

/* ---------------------------------------------------------------
   Long-form prose styling.
   This is the ONE place custom CSS is allowed (see brief rule 6):
   article body typography that Elementor widget controls cannot reach.
   Everything else is controlled in Elementor Site Settings.
   --------------------------------------------------------------- */

/* Article measure: 65-75 characters */
.techfold-prose { max-width: 720px; }

/* Inline links: clear underline, not colour alone (WCAG 1.4.1) */
.techfold-prose a {
	color: var(--e-global-color-accent, #1A56DB);
	text-decoration: underline;
	text-underline-offset: 2px;
	text-decoration-thickness: 1px;
}
.techfold-prose a:hover { color: var(--e-global-color-primary, #16181D); }

/* Headings inside prose get breathing room above, tight below */
.techfold-prose h2 { margin-top: 48px; margin-bottom: 16px; }
.techfold-prose h3 { margin-top: 32px; margin-bottom: 12px; }
.techfold-prose p,
.techfold-prose ul,
.techfold-prose ol { margin-bottom: 24px; }
.techfold-prose li { margin-bottom: 8px; }

/* Blockquote: ink rule, no giant quote glyph */
.techfold-prose blockquote {
	margin: 32px 0;
	padding: 4px 0 4px 24px;
	border-left: 3px solid var(--e-global-color-primary, #16181D);
	font-style: normal;
}

/* Tables scroll horizontally on mobile instead of breaking layout */
.techfold-prose .techfold-table-wrap { overflow-x: auto; margin: 32px 0; }
.techfold-prose table { border-collapse: collapse; width: 100%; min-width: 480px; }
.techfold-prose th,
.techfold-prose td {
	border: 1px solid var(--e-global-color-bordera, #E2E5EA);
	padding: 12px 16px;
	text-align: left;
}
.techfold-prose thead th {
	background: var(--e-global-color-surfalt, #F4F5F7);
	font-family: "Bricolage Grotesque", system-ui, sans-serif;
	font-weight: 600;
}

/* Code */
.techfold-prose code {
	background: var(--e-global-color-surfalt, #F4F5F7);
	padding: 2px 6px;
	border-radius: 4px;
	font-size: 0.9em;
}
.techfold-prose pre {
	background: var(--e-global-color-surfalt, #F4F5F7);
	padding: 20px;
	border-radius: 6px;
	overflow-x: auto;
}
.techfold-prose figcaption {
	color: var(--e-global-color-secondary, #5A6270);
	font-size: 15px;
	margin-top: 8px;
}

/* Skip link (accessibility) */
.techfold-skip-link {
	position: absolute; left: -9999px; top: 0; z-index: 100000;
	background: #16181D; color: #fff; padding: 12px 20px; text-decoration: none;
}
.techfold-skip-link:focus { left: 8px; top: 8px; }

/* Visible keyboard focus everywhere (WCAG 2.4.7) */
a:focus-visible, button:focus-visible,
input:focus-visible, textarea:focus-visible, select:focus-visible {
	outline: 3px solid var(--e-global-color-accent, #1A56DB);
	outline-offset: 2px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ---------------------------------------------------------------
   Category bar (desktop only).
   Colour here is identity, never decoration: each topic keeps the
   same accent everywhere it appears on the site.
   --------------------------------------------------------------- */

.techfold-catbar {
	border-top: 1px solid var(--base, #E2E5EA);
	border-bottom: 1px solid var(--base, #E2E5EA);
	background: var(--base-3, #fff);
}
.techfold-catbar__inner {
	max-width: 1240px;
	margin: 0 auto;
	padding: 0 40px;
}
.techfold-catbar__list {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.techfold-catbar__list li { margin: 0; }
.techfold-catbar__list a {
	display: block;
	padding: 12px 16px;
	font-family: "Bricolage Grotesque", system-ui, sans-serif;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--contrast, #16181D);
	text-decoration: none;
	/* The "fold": a 2px crease that opens on hover. One place only. */
	box-shadow: inset 0 -2px 0 0 transparent;
	transition: box-shadow 120ms ease, color 120ms ease;
}
.techfold-catbar__list a:hover,
.techfold-catbar__list a:focus-visible { box-shadow: inset 0 -2px 0 0 currentColor; }

.techfold-cat--tech             a:hover, .techfold-cat--tech.current-menu-item a             { color: #6D28D9; }
.techfold-cat--business         a:hover, .techfold-cat--business.current-menu-item a         { color: #334155; }
.techfold-cat--marketing        a:hover, .techfold-cat--marketing.current-menu-item a        { color: #C2410C; }
.techfold-cat--health           a:hover, .techfold-cat--health.current-menu-item a           { color: #15803D; }
.techfold-cat--lifestyle        a:hover, .techfold-cat--lifestyle.current-menu-item a        { color: #BE185D; }
.techfold-cat--home-improvement a:hover, .techfold-cat--home-improvement.current-menu-item a { color: #92400E; }
.techfold-cat--travel           a:hover, .techfold-cat--travel.current-menu-item a           { color: #0F766E; }
.techfold-cat--online-games     a:hover, .techfold-cat--online-games.current-menu-item a     { color: #B91C1C; }

.techfold-catbar__list .current-menu-item a { box-shadow: inset 0 -2px 0 0 currentColor; }

/* Tablet and below: the Topics submenu in the hamburger covers this. */
@media (max-width: 1024px) {
	.techfold-catbar { display: none; }
}
@media (max-width: 767px) {
	.techfold-catbar__inner { padding: 0 20px; }
}

/* ---------------------------------------------------------------
   Post cards.
   Deliberately NOT identical rounded boxes with a grey shadow -
   cards are borderless, separated by a hairline rule, and only the
   lead card gets an image-forward treatment. Hierarchy comes from
   size and space, not from chrome.
   --------------------------------------------------------------- */

.techfold-cards { display: grid; gap: 40px 32px; }
.techfold-cards--cols-2 { grid-template-columns: repeat(2, 1fr); }
.techfold-cards--cols-3 { grid-template-columns: repeat(3, 1fr); }
.techfold-cards--cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Lead card spans the full row and runs horizontally on desktop */
.techfold-cards--has-lead .techfold-card--lead {
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: 1.15fr 1fr;
	gap: 32px;
	align-items: center;
	padding-bottom: 40px;
	border-bottom: 1px solid var(--base, #E2E5EA);
}

.techfold-card { min-width: 0; }
.techfold-card__media { display: block; margin-bottom: 16px; }
.techfold-card--lead .techfold-card__media { margin-bottom: 0; }
.techfold-card__media img {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	display: block;
}

/* The category tag carries the one "fold" motif: a creased corner. */
.techfold-tag {
	display: inline-block;
	margin-bottom: 12px;
	padding: 4px 10px 4px 8px;
	font-family: "Bricolage Grotesque", system-ui, sans-serif;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.02em;
	line-height: 1.4;
	color: #fff;
	background: var(--cat, #16181D);
	text-decoration: none;
	clip-path: polygon(0 0, 100% 0, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.techfold-tag:hover, .techfold-tag:focus-visible { color: #fff; opacity: 0.88; }

.techfold-card__title { margin: 0 0 10px; }
.techfold-card--lead .techfold-card__title {
	font-size: 34px;
	line-height: 1.18;
	letter-spacing: -0.5px;
}
.techfold-card__title a {
	color: var(--contrast, #16181D);
	text-decoration: none;
	background-image: linear-gradient(var(--cat, #16181D), var(--cat, #16181D));
	background-size: 0% 2px;
	background-repeat: no-repeat;
	background-position: 0 100%;
	transition: background-size 160ms ease;
}
.techfold-card__title a:hover,
.techfold-card__title a:focus-visible { background-size: 100% 2px; }

.techfold-card__excerpt {
	margin: 0 0 12px;
	color: var(--contrast-2, #2A2E37);
	font-size: 17px;
	line-height: 1.6;
}
.techfold-card--lead .techfold-card__excerpt { font-size: 19px; }

.techfold-card__meta {
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	font-family: "Bricolage Grotesque", system-ui, sans-serif;
	font-size: 14px;
	color: var(--contrast-3, #5A6270);
}

.techfold-empty { color: var(--contrast-3, #5A6270); font-style: italic; }

/* ---- Category entry points ---- */
.techfold-cats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
}
.techfold-cats__item {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 20px;
	background: var(--base-2, #F4F5F7);
	text-decoration: none;
	border-left: 3px solid var(--cat, #16181D);
	transition: background 140ms ease, transform 140ms ease;
}
.techfold-cats__item:hover { background: #fff; transform: translateY(-2px); }
.techfold-cats__name {
	font-family: "Bricolage Grotesque", system-ui, sans-serif;
	font-size: 18px;
	font-weight: 600;
	color: var(--cat, #16181D);
}
.techfold-cats__count { font-size: 14px; color: var(--contrast-3, #5A6270); }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
	.techfold-cards--cols-3, .techfold-cards--cols-4 { grid-template-columns: repeat(2, 1fr); }
	.techfold-cats { grid-template-columns: repeat(3, 1fr); }
	.techfold-cards--has-lead .techfold-card--lead { grid-template-columns: 1fr; gap: 20px; }
	.techfold-card--lead .techfold-card__title { font-size: 28px; }
}
@media (max-width: 767px) {
	.techfold-cards { gap: 32px; }
	.techfold-cards--cols-2, .techfold-cards--cols-3, .techfold-cards--cols-4 { grid-template-columns: 1fr; }
	.techfold-cats { grid-template-columns: repeat(2, 1fr); }
	.techfold-card--lead .techfold-card__title { font-size: 26px; }
	.techfold-card__excerpt, .techfold-card--lead .techfold-card__excerpt { font-size: 16px; }
}

/* ---------------------------------------------------------------
   Single post components
   --------------------------------------------------------------- */

.techfold-postmeta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 20px;
	font-family: "Bricolage Grotesque", system-ui, sans-serif;
	font-size: 15px;
	color: var(--contrast-3, #5A6270);
}
.techfold-postmeta a { color: inherit; }
.techfold-updated { color: var(--contrast, #16181D); font-weight: 500; }

/* FTC disclosure: must be visible and above the first affiliate link */
.techfold-disclosure {
	margin: 0 0 24px;
	padding: 12px 16px;
	background: var(--base-2, #F4F5F7);
	border-left: 3px solid var(--contrast-3, #5A6270);
	font-size: 15px;
	color: var(--contrast-2, #2A2E37);
}

/* YMYL block for Health */
.techfold-ymyl {
	margin: 0 0 24px;
	padding: 16px 20px;
	border: 1px solid var(--base, #E2E5EA);
	border-left: 3px solid #15803D;
}
.techfold-ymyl__reviewer { margin: 0 0 8px; font-size: 16px; }
.techfold-ymyl__disclaimer {
	margin: 0;
	font-size: 15px;
	color: var(--contrast-2, #2A2E37);
}

/* Answer-first summary. The one place a box is allowed to shout. */
.techfold-answer {
	margin: 0 0 32px;
	padding: 24px 28px;
	background: var(--contrast, #16181D);
	color: #F4F5F7;
}
.techfold-answer__h {
	margin: 0 0 12px;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #9EC1FF;
}
.techfold-answer__lead {
	margin: 0 0 12px;
	font-size: 19px;
	line-height: 1.6;
	color: #FFFFFF;
}
.techfold-answer__list { margin: 0; padding-left: 20px; }
.techfold-answer__list li { margin-bottom: 6px; line-height: 1.6; }

/* Table of contents */
.techfold-toc {
	margin: 0 0 32px;
	padding: 16px 20px;
	border: 1px solid var(--base, #E2E5EA);
}
.techfold-toc summary {
	cursor: pointer;
	font-family: "Bricolage Grotesque", system-ui, sans-serif;
	font-size: 15px;
	font-weight: 600;
	color: var(--contrast, #16181D);
}
.techfold-toc__list { margin: 12px 0 0; padding-left: 18px; }
.techfold-toc__list li { margin-bottom: 6px; line-height: 1.5; }
.techfold-toc__l3 { margin-left: 16px; font-size: 15px; }

/* Author box */
.techfold-authorbox {
	display: flex;
	gap: 20px;
	margin: 48px 0 0;
	padding: 24px;
	background: var(--base-2, #F4F5F7);
}
.techfold-authorbox__avatar img { border-radius: 50%; display: block; }
.techfold-authorbox__name { margin: 0 0 8px; font-size: 20px; }
.techfold-authorbox__bio { margin: 0 0 8px; font-size: 16px; line-height: 1.6; }

/* Related posts */
.techfold-related { margin: 56px 0 0; padding-top: 40px; border-top: 1px solid var(--base, #E2E5EA); }
.techfold-related > h2 { margin: 0 0 28px; font-size: 24px; }

@media (max-width: 767px) {
	.techfold-answer { padding: 20px; }
	.techfold-answer__lead { font-size: 17px; }
	.techfold-authorbox { flex-direction: column; gap: 14px; }
}

/* ---------------------------------------------------------------
   Specificity guards.

   Elementor's kit and GeneratePress both emit site-wide `a{color:...}`
   rules at specificity (0,1,1), and both load after this stylesheet.
   A bare `.techfold-tag` (0,1,0) loses to them, and `.techfold-x a`
   (0,1,1) ties and loses on source order. These compound selectors sit
   above both so component colour is never hijacked by a global link rule.
   --------------------------------------------------------------- */

.techfold-card .techfold-card__title a,
.techfold-related .techfold-card__title a { color: var(--contrast, #16181D); }

.techfold-card a.techfold-tag,
.techfold-cards a.techfold-tag { color: #FFFFFF; }

.techfold-catbar .techfold-catbar__list a { color: var(--contrast, #16181D); }

.techfold-cats a.techfold-cats__item .techfold-cats__name { color: var(--cat, #16181D); }
.techfold-cats a.techfold-cats__item { text-decoration: none; }

.techfold-postmeta a,
.techfold-authorbox .techfold-authorbox__body a { color: var(--contrast-3, #5A6270); }
.techfold-postmeta a:hover,
.techfold-authorbox .techfold-authorbox__body a:hover { color: var(--accent, #1A56DB); }

.techfold-answer .techfold-answer__lead,
.techfold-answer .techfold-answer__list li { color: #FFFFFF; }

/* Prose links keep the accent - this is the one place it belongs. */
.techfold-prose a { color: var(--accent, #1A56DB); }
.techfold-prose a:hover { color: var(--contrast, #16181D); }

/* ---------------------------------------------------------------
   Single post: one consistent reading column.
   Every block - meta, takeaways, TOC, prose - shares the same measure
   so the article reads as a single column rather than a full-width
   page with a narrow paragraph inside it.
   --------------------------------------------------------------- */

.single-post .entry-content > .techfold-postmeta,
.single-post .entry-content > .techfold-disclosure,
.single-post .entry-content > .techfold-ymyl,
.single-post .entry-content > .techfold-answer,
.single-post .entry-content > .techfold-toc,
.single-post .entry-content > .techfold-prose,
.single-post .entry-content > .techfold-authorbox {
	max-width: 760px;
	margin-left: auto;
	margin-right: auto;
}
.single-post .entry-content > .techfold-prose { max-width: 760px; }

/* Featured image should not dominate the first screen - but a fixed
   max-width with no 100% ceiling widens the whole document on phones,
   which is what forced horizontal scroll on single posts. */
.single-post .post-image img,
.single-post .featured-image img,
.single-post img.wp-post-image {
	width: 100%;
	max-width: min(900px, 100%);
	height: auto;
	/* Reserve the space before the image loads. Without an explicit ratio,
	   `width:auto` defeats the browser's aspect-ratio box and the article
	   header gets shoved down ~500px on load, which is pure CLS. */
	aspect-ratio: 16 / 9;
	object-fit: cover;
	margin-left: auto;
	margin-right: auto;
	display: block;
}

/* Belt and braces: article tables scroll inside their own box. */
.techfold-prose .techfold-table-wrap,
.techfold-prose .wp-block-table { max-width: 100%; overflow-x: auto; }

/* Article H1 uses the display face at full weight. */
.single-post .entry-title,
.page .entry-title {
	font-family: "Bricolage Grotesque", system-ui, sans-serif;
	font-weight: 700;
	letter-spacing: -1px;
	line-height: 1.12;
}

/* ---------------------------------------------------------------
   Mobile fixes
   --------------------------------------------------------------- */

/* A one-column card grid had no explicit column definition, so
   `grid-column: 1 / -1` on the lead card resolved against an implicit
   grid and produced an extra column wider than the viewport. */
.techfold-cards--cols-1 { grid-template-columns: 1fr; }

/* Grid and flex children must be allowed to shrink below their content
   width, or long words and images force the page wider than the screen. */
.techfold-cards > *,
.techfold-cats > *,
.techfold-card__body { min-width: 0; }

.techfold-card__title,
.techfold-cats__name,
.techfold-card__excerpt { overflow-wrap: break-word; }

/* Nothing may scroll the page sideways. Tables opt out via their wrapper. */
.techfold-cards img,
.techfold-card__media img { max-width: 100%; height: auto; }

/* GeneratePress mobile menu toggle.

   The toggle is a <button>, so the theme's global button styling applied to it:
   an ink background with an ink-filled icon on top, which rendered as a solid
   black block. A bare `.menu-toggle` rule (0,1,0) loses to that, so these
   selectors are compound enough to win. */
.main-navigation button.menu-toggle,
.main-navigation button.menu-toggle:hover,
.main-navigation button.menu-toggle:focus,
.main-navigation button.menu-toggle:active,
button.menu-toggle {
	background-color: transparent;
	color: var(--contrast, #16181D);
	padding: 10px 12px;
	min-height: 44px;
	min-width: 44px;
	border-radius: 6px;
}
.main-navigation button.menu-toggle:hover,
.main-navigation button.menu-toggle:focus {
	background-color: var(--base-2, #F4F5F7);
}
/* The icon must contrast with the button, not match it. */
.main-navigation button.menu-toggle .gp-icon,
.main-navigation button.menu-toggle .gp-icon svg {
	fill: currentColor;
	color: var(--contrast, #16181D);
	width: 22px;
	height: 22px;
}

@media (max-width: 767px) {
	.techfold-cats { grid-template-columns: 1fr; }
	.techfold-cards--has-lead .techfold-card--lead { padding-bottom: 28px; }
	/* Tap targets stay at or above 44px. */
	.techfold-catbar__list a,
	.techfold-postmeta a { min-height: 44px; }
}

@media (max-width: 480px) {
	.techfold-tag { font-size: 11px; }
}

/* ---------------------------------------------------------------
   Homepage hero: lead story + two secondary stories.
   Magazine hierarchy - the lead is simply bigger, nothing is boxed.
   --------------------------------------------------------------- */

.techfold-hero {
	display: grid;
	grid-template-columns: 1.55fr 1fr;
	gap: 44px;
	align-items: start;
}

.techfold-hero__lead { min-width: 0; }

.techfold-hero__media { display: block; margin-bottom: 20px; }
.techfold-hero__media img {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	display: block;
}

.techfold-hero__title {
	margin: 0 0 12px;
	font-family: "Bricolage Grotesque", system-ui, sans-serif;
	font-size: 40px;
	font-weight: 700;
	line-height: 1.12;
	letter-spacing: -1px;
}
.techfold-hero__title a {
	color: var(--contrast, #16181D);
	text-decoration: none;
	background-image: linear-gradient(var(--cat, #16181D), var(--cat, #16181D));
	background-size: 0% 2px;
	background-repeat: no-repeat;
	background-position: 0 100%;
	transition: background-size 160ms ease;
}
.techfold-hero__title a:hover,
.techfold-hero__title a:focus-visible { background-size: 100% 2px; }

.techfold-hero__excerpt {
	margin: 0 0 12px;
	font-size: 19px;
	line-height: 1.6;
	color: var(--contrast-2, #2A2E37);
}

/* Secondary column: a divided stack, no cards */
.techfold-hero__side {
	display: flex;
	flex-direction: column;
	gap: 22px;
	min-width: 0;
}
.techfold-hero__item {
	display: grid;
	grid-template-columns: 104px 1fr;
	gap: 16px;
	align-items: start;
	min-width: 0;
}
.techfold-hero__item + .techfold-hero__item {
	padding-top: 24px;
	border-top: 1px solid var(--base, #E2E5EA);
}
.techfold-hero__itemmedia img {
	width: 104px;
	height: 78px;
	object-fit: cover;
	display: block;
}
.techfold-hero__itembody { min-width: 0; }
.techfold-hero__item .techfold-card__title {
	font-size: 18px;
	line-height: 1.3;
	margin: 0 0 6px;
}
.techfold-hero__item .techfold-tag {
	margin-bottom: 8px;
	padding: 3px 8px 3px 7px;
	font-size: 11px;
}

/* Section headings: a rule across the page, like a print masthead */
.techfold-sectionhead {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 28px;
}
.techfold-sectionhead::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--base, #E2E5EA);
}

@media (max-width: 1024px) {
	.techfold-hero { grid-template-columns: 1fr; gap: 32px; }
	.techfold-hero__title { font-size: 32px; }
	.techfold-hero__side {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 24px;
	}
	.techfold-hero__item + .techfold-hero__item { padding-top: 0; border-top: 0; }
}

@media (max-width: 767px) {
	.techfold-hero__title { font-size: 26px; letter-spacing: -0.5px; }
	.techfold-hero__excerpt { font-size: 16px; }
	.techfold-hero__side { grid-template-columns: 1fr; gap: 20px; }
	.techfold-hero__item + .techfold-hero__item {
		padding-top: 20px;
		border-top: 1px solid var(--base, #E2E5EA);
	}
	.techfold-hero__item { grid-template-columns: 88px 1fr; gap: 12px; }
	.techfold-hero__itemmedia img { width: 88px; height: 66px; }
}

/* ---------------------------------------------------------------
   Site title - GeneratePress dynamic typography was not reaching it,
   so it inherited the body serif. State it explicitly.
   --------------------------------------------------------------- */

/* GeneratePress renders the site name as <p class="main-title">, not
   .site-title, and its dynamic typography only emits a colour - so the
   name was inheriting the body serif. Name both classes explicitly. */
.main-title,
.main-title a,
.site-title,
.site-title a,
.main-navigation a,
.main-navigation .menu-toggle,
.site-description {
	font-family: "Bricolage Grotesque", system-ui, sans-serif;
}
.main-title,
.main-title a,
.site-title,
.site-title a {
	font-weight: 700;
	letter-spacing: -0.5px;
	color: var(--contrast, #16181D);
}
