/**
 * Branch Creative — base.css
 *
 * Reset, base HTML element styles, typography defaults, and layout primitives.
 * No component-level styles live here — those go in components.css.
 *
 * @package Branch_Creative
 */

/* ── Reset ──────────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	font-size: 100%; /* 16px base */
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	font-family: var(--font-family-base);
	font-size: var(--font-size-base);
	font-weight: var(--font-weight-normal);
	line-height: var(--line-height-normal);
	color: var(--color-text);
	background-color: var(--color-bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
canvas,
svg {
	display: block;
	max-width: 100%;
}

input,
button,
textarea,
select {
	font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
	overflow-wrap: break-word;
}

ul,
ol {
	list-style: none;
}

a {
	color: var(--color-link);
	text-decoration: underline;
	text-decoration-color: transparent;
	transition: var(--transition-colors);
}

a:hover {
	color: var(--color-link-hover);
	text-decoration-color: currentColor;
}

/* Excludes .btn / .wp-block-button__link — a plain type+pseudo-class selector
   like "a:visited" (specificity 0,0,1,1) otherwise beats a single class
   selector like ".btn--primary" (0,0,1,0) once a button's link has been
   visited, silently overriding its intended text color with this generic
   link color and rendering dark text on a dark button. */
a:visited:not(.btn, .wp-block-button__link) {
	color: var(--color-link-visited);
}

a:focus-visible {
	outline: 2px solid var(--color-border-focus);
	outline-offset: 2px;
	border-radius: var(--radius-sm);
}

hr {
	border: none;
	border-top: 1px solid var(--color-border);
	margin: var(--space-8) 0;
}

/* ── Typography ─────────────────────────────────────────────────────────────── */
/* Editorial serif (Instrument Serif) for headings, Manrope for everything else.
   Sizes are fluid via clamp() so large display type never overflows small
   viewports — see variables.css --font-size-display-* tokens. */

h1, h2, h3, h4, h5, h6 {
	font-family: var(--font-family-heading);
	font-weight: var(--font-weight-normal);
	line-height: var(--line-height-tight);
	letter-spacing: var(--letter-spacing-tight);
	color: var(--color-heading);
	margin-bottom: 0.55em;
}

h1 { font-size: var(--font-size-display-lg); }
h2 { font-size: var(--font-size-display-md); }
h3 { font-size: var(--font-size-display-sm); }
h4 { font-size: var(--font-size-xl);  font-family: var(--font-family-base); font-weight: var(--font-weight-semibold); }
h5 { font-size: var(--font-size-lg);  font-family: var(--font-family-base); font-weight: var(--font-weight-semibold); }
h6 { font-size: var(--font-size-base); font-family: var(--font-family-base); font-weight: var(--font-weight-semibold); letter-spacing: var(--letter-spacing-wide); text-transform: uppercase; }

p {
	margin-bottom: var(--space-4);
	max-width: 70ch; /* prevent overly long lines */
}

p:last-child {
	margin-bottom: 0;
}

em, i { font-style: italic; }

/* ── Rich text / entry content ───────────────────────────────────────────── */

.entry__content,
.wp-block-post-content {
	font-size: var(--font-size-md);
	line-height: var(--line-height-relaxed);
}

.entry__content p,
.wp-block-post-content p {
	max-width: 100%;
}

.entry__content > * + * {
	margin-top: var(--space-4);
}

.entry__content h2,
.entry__content h3,
.entry__content h4 {
	margin-top: var(--space-10);
	margin-bottom: var(--space-3);
}

.entry__content ul,
.entry__content ol {
	list-style: revert;
	padding-left: var(--space-6);
}

.entry__content ul li,
.entry__content ol li {
	margin-bottom: var(--space-2);
}

.entry__content blockquote {
	border-left: 4px solid var(--color-primary);
	padding: var(--space-4) var(--space-6);
	margin: var(--space-8) 0;
	background: var(--color-primary-light);
	border-radius: 0 var(--radius-md) var(--radius-md) 0;
	font-style: italic;
	font-size: var(--font-size-lg);
	color: var(--color-gray-700);
}

.entry__content code {
	font-family: var(--font-family-mono);
	font-size: 0.875em;
	background: var(--color-gray-100);
	padding: 0.1em 0.4em;
	border-radius: var(--radius-sm);
}

.entry__content pre {
	background: var(--color-gray-900);
	color: var(--color-gray-100);
	padding: var(--space-6);
	border-radius: var(--radius-md);
	overflow-x: auto;
	font-family: var(--font-family-mono);
	font-size: var(--font-size-sm);
	line-height: var(--line-height-relaxed);
}

.entry__content pre code {
	background: none;
	padding: 0;
}

.entry__content table {
	width: 100%;
	border-collapse: collapse;
	margin: var(--space-6) 0;
}

.entry__content th,
.entry__content td {
	border: 1px solid var(--color-border);
	padding: var(--space-3) var(--space-4);
	text-align: left;
}

.entry__content th {
	background: var(--color-gray-100);
	font-weight: var(--font-weight-semibold);
}

/* ── Layout Utilities ────────────────────────────────────────────────────── */

.container {
	width: 100%;
	max-width: var(--container-max);
	margin-left: auto;
	margin-right: auto;
	padding-left: var(--container-px);
	padding-right: var(--container-px);
}

.container--sm  { max-width: var(--container-sm); }
.container--md  { max-width: var(--container-md); }
.container--lg  { max-width: var(--container-lg); }
.container--xl  { max-width: var(--container-xl); }
.container--2xl { max-width: var(--container-2xl); }

.section {
	padding-top: var(--section-padding-y);
	padding-bottom: var(--section-padding-y);
}

.section--alt {
	background-color: var(--color-bg-alt);
}

.section--dark {
	background-color: var(--color-bg-dark);
	color: var(--color-text-inverse);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4,
.section--dark h5,
.section--dark h6 {
	color: #ffffff;
}

/* ── Accessibility ───────────────────────────────────────────────────────── */

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

.screen-reader-text:focus {
	background-color: var(--color-bg);
	border-radius: var(--radius-base);
	box-shadow: var(--shadow-md);
	clip: auto !important;
	clip-path: none;
	color: var(--color-text);
	display: block;
	font-size: var(--font-size-sm);
	font-weight: var(--font-weight-semibold);
	height: auto;
	left: var(--space-4);
	line-height: normal;
	padding: var(--space-3) var(--space-6);
	text-decoration: none;
	top: var(--space-4);
	width: auto;
	z-index: var(--z-toast);
}

/* Visible focus for keyboard users */
:focus-visible {
	outline: 2px solid var(--color-border-focus);
	outline-offset: 2px;
}

/* ── WordPress Core Classes ──────────────────────────────────────────────── */

.wp-block-image img {
	border-radius: var(--radius-md);
}

.alignleft  { float: left; margin: 0 var(--space-6) var(--space-4) 0; }
.alignright { float: right; margin: 0 0 var(--space-4) var(--space-6); }
.aligncenter { margin: 0 auto var(--space-4); }

.wp-caption { max-width: 100%; }
.wp-caption-text {
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
	text-align: center;
	margin-top: var(--space-2);
}

/* ── Single Post ─────────────────────────────────────────────────────────── */

.single-post__hero {
	width: 100%;
	height: clamp(320px, 50vw, 560px);
	background-size: cover;
	background-position: center;
	position: relative;
}

.single-post__hero-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to bottom,
		rgba(0, 0, 0, 0) 50%,
		rgba(0, 0, 0, 0.35) 100%
	);
}

.single-post .container {
	max-width: 90%;
}

.single-post__body {
	max-width: 100%;
	margin: 0 auto;
	padding: var(--space-12) 0 var(--space-16);
}

.single-post__category {
	font-size: var(--font-size-xs);
	font-weight: var(--font-weight-semibold);
	text-transform: uppercase;
	letter-spacing: var(--letter-spacing-wide);
	margin-bottom: var(--space-3);
}

.single-post__category a {
	color: var(--color-primary);
	text-decoration: none;
}

.single-post__category a:hover { text-decoration: underline; }

.single-post__title {
	font-size: clamp(var(--font-size-3xl), 4vw, var(--font-size-5xl));
	font-weight: var(--font-weight-bold);
	line-height: var(--line-height-tight);
	color: var(--color-heading);
	margin-bottom: var(--space-4);
}

.single-post__meta {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
	margin-bottom: var(--space-10);
	padding-bottom: var(--space-6);
	border-bottom: 1px solid var(--color-border);
}

.single-post__meta-sep { opacity: 0.5; }

.single-post__footer {
	margin-top: var(--space-12);
	padding-top: var(--space-8);
	border-top: 1px solid var(--color-border);
}

.post-navigation .nav-links {
	display: flex;
	gap: var(--space-10, 2.5rem);
	flex-wrap: wrap;
	margin-top: var(--space-6);
}

.post-navigation .nav-links a,
.post-navigation .nav-links a:visited {
	color: var(--color-text, #111827);
	font-weight: var(--font-weight-bold, 700);
	text-decoration: none;
	padding-bottom: 3px;
	background-image: linear-gradient(var(--color-text, #111827), var(--color-text, #111827));
	background-position: 0% 100%;
	background-repeat: no-repeat;
	background-size: 0% 2px;
	transition: background-size 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.post-navigation .nav-links a:hover {
	text-decoration: none;
	background-size: 100% 2px;
}

/* ── Blog Featured Hero ──────────────────────────────────────────────────── */

.blog-hero {
	position: relative;
	min-height: 580px;
	display: flex;
	align-items: flex-end;
	background-color: var(--color-dark);
	background-size: cover;
	background-position: center;
	margin-bottom: var(--space-12);
}

.blog-hero__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to bottom,
		rgba(0, 0, 0, 0.15) 0%,
		rgba(0, 0, 0, 0.65) 100%
	);
}

.blog-hero .container {
	position: relative;
	z-index: 1;
	width: 100%;
	padding-bottom: var(--space-12);
}

.blog-hero__content {
	max-width: 720px;
}

.blog-hero__category {
	display: inline-block;
	font-size: var(--font-size-xs);
	font-weight: var(--font-weight-semibold);
	text-transform: uppercase;
	letter-spacing: var(--letter-spacing-wide);
	color: #fff;
	background: var(--color-primary);
	padding: var(--space-1) var(--space-3);
	border-radius: var(--radius-full);
	text-decoration: none;
	margin-bottom: var(--space-4);
}

.blog-hero__category:hover {
	background: var(--color-primary-dark);
}

.blog-hero__title {
	font-size: clamp(var(--font-size-3xl), 4vw, var(--font-size-5xl));
	font-weight: var(--font-weight-bold);
	line-height: var(--line-height-tight);
	color: #fff;
	margin-bottom: var(--space-4);
}

.blog-hero__title a {
	color: inherit;
	text-decoration: none;
	padding-bottom: 6px;
	background-image: linear-gradient(currentColor, currentColor);
	background-position: 0% 100%;
	background-repeat: no-repeat;
	background-size: 0% 2px;
	transition: background-size 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.blog-hero__title a:hover {
	background-size: 100% 2px;
}

.blog-hero__excerpt {
	font-size: var(--font-size-lg);
	color: rgba(255, 255, 255, 0.85);
	line-height: var(--line-height-relaxed);
	margin-bottom: var(--space-6);
	max-width: 60ch;
}

@media (max-width: 640px) {
	.blog-hero { min-height: 420px; }
	.blog-hero__title { font-size: var(--font-size-2xl); }
	.blog-hero__excerpt { font-size: var(--font-size-base); }
}

/* ── Post Grid (archive / search) ───────────────────────────────────────── */

.post-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--space-8);
	margin: var(--space-8) 0;
}

@media (max-width: 1024px) {
	.post-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
	.post-grid { grid-template-columns: 1fr; }
}

/* ── Archive Header ──────────────────────────────────────────────────────── */

.archive-header {
	padding: var(--space-12) 0 var(--space-6);
	border-bottom: 1px solid var(--color-border);
	margin-bottom: var(--space-2);
}

.archive-header__title {
	font-size: var(--font-size-4xl);
	font-weight: var(--font-weight-bold);
	color: var(--color-heading);
	margin-bottom: var(--space-2);
}

.archive-header__description {
	font-size: var(--font-size-lg);
	color: var(--color-text-muted);
	max-width: 60ch;
}

.archive-header__description p { margin: 0; }

/* ── Entry Meta ──────────────────────────────────────────────────────────── */

.entry__meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-4);
	font-size: var(--font-size-sm);
	color: var(--color-text-muted);
	margin-bottom: var(--space-6);
}

/* ── Site Layout ─────────────────────────────────────────────────────────── */

.site {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

.site-main {
	flex: 1;
}

/* ── Scroll Reveal ───────────────────────────────────────────────────────── */

/* Applied to the root element of every custom "branch/*" block automatically
   via a render_block filter (inc/scroll-reveal.php) — no per-block markup
   changes needed. Starts every block at opacity:0/translateY(28px) from the
   very first server-rendered HTML (so there's no flash of visible content
   before JS runs), then assets/js/scroll-reveal.js adds the "--visible"
   modifier via IntersectionObserver the first time each block scrolls into
   view, triggering the transition back to its natural position. */
.branch-reveal {
	opacity: 0;
	transform: translateY(28px);
	transition: opacity 0.7s ease, transform 0.7s ease;
}

.branch-reveal.branch-reveal--visible {
	opacity: 1;
	transform: translateY(0);
}

/* Not-yet-revealed content sits below the viewport in practice, but opacity
   alone doesn't stop it from being clicked or tab-focused — this closes
   that gap without needing extra JS. */
.branch-reveal:not(.branch-reveal--visible) {
	pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
	.branch-reveal {
		opacity: 1;
		transform: none;
		transition: none;
		pointer-events: auto;
	}
}
