/* =====================================================================
   Mobile-first responsive foundation + per-template layout
   Story US-002 — fluid layouts for every template the theme owns.

   Breakpoints:  mobile < 768px  |  tablet 768–1023px  |  desktop >= 1024px
   Strategy:     single-column stacked by default; grids/columns are added
                 progressively at >=768px and >=1024px. Nothing here styles
                 #primary by width, so self-contained templates such as
                 .gallery-page keep their own full-bleed layout untouched.
   ===================================================================== */

:root {
	/* Dark navy/graphite + orange scheme (US-001). These map onto the
	   canonical --color-* palette defined in style.css; hex fallbacks keep
	   the scheme intact if style.css is ever unavailable. */
	--mytheme-ink: var(--color-light-gray, #c7ced9);
	--mytheme-muted: var(--color-muted, #94a0b2);
	--mytheme-surface: var(--color-graphite, #2d3142);
	--mytheme-bg: var(--color-navy, #1a1f2e);
	--mytheme-border: var(--color-border, rgba(255, 255, 255, 0.10));
	--mytheme-accent: var(--color-orange, #e87a2f);
	--mytheme-accent-dark: var(--color-orange-dark, #cf6420);
	--mytheme-radius: 12px;
	--mytheme-radius-sm: 8px;
	--mytheme-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
	--mytheme-shadow-lg: 0 22px 50px rgba(0, 0, 0, 0.45);
	--mytheme-maxw: 1180px;
	--mytheme-touch: 44px;
	--mytheme-ease: cubic-bezier(0.2, 0.7, 0.3, 1);
	--mytheme-duration: 220ms;
}

/* ---- Reset & box model ------------------------------------------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	/* Fluid body copy that never drops below the 16px readability floor. */
	font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
	font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
	line-height: 1.65;
	color: var(--mytheme-ink);
	/* Navy page base so graphite cards/surfaces stand out against it. */
	background: var(--mytheme-bg);
	/* clip (not hidden) guards against horizontal overflow WITHOUT creating a
	   scroll container that would break the sticky header. */
	overflow-x: clip;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* ---- Fluid media -------------------------------------------------- */
img,
video,
iframe,
embed,
object,
svg {
	max-width: 100%;
	height: auto;
}

figure {
	margin: 0;
}

.wp-block-embed,
.wp-block-image img {
	max-width: 100%;
}

/* ---- Links -------------------------------------------------------- */
a {
	color: var(--mytheme-accent);
	transition: color var(--mytheme-duration) var(--mytheme-ease);
}

a:hover,
a:focus {
	color: var(--mytheme-accent-dark);
}

a:focus-visible,
button:focus-visible,
.mytheme-btn:focus-visible {
	outline: 3px solid var(--mytheme-accent);
	outline-offset: 2px;
	border-radius: 3px;
}

/* ---- Fluid typography (element-level; page/section classes override) */
h1,
h2,
h3,
h4 {
	line-height: 1.2;
	letter-spacing: -0.01em;
	color: var(--mytheme-ink);
	overflow-wrap: break-word;
}

h1 {
	font-size: clamp(1.9rem, 1.3rem + 3vw, 3rem);
}

h2 {
	font-size: clamp(1.55rem, 1.15rem + 2vw, 2.25rem);
}

h3 {
	font-size: clamp(1.3rem, 1.05rem + 1.2vw, 1.6rem);
}

/* ---- Fluid container --------------------------------------------- */
.site-container {
	width: 100%;
	max-width: var(--mytheme-maxw);
	margin-inline: auto;
	padding-inline: 1rem; /* mobile: 16px gutter */
}

@media (min-width: 768px) {
	.site-container {
		padding-inline: 2rem; /* tablet */
	}
}

@media (min-width: 1024px) {
	.site-container {
		padding-inline: 3rem; /* desktop */
	}
}

/* ---- Section rhythm ---------------------------------------------- */
.site-main {
	display: block;
	background: var(--mytheme-surface);
	/* Proportional vertical breathing room: ~2rem mobile up to ~4rem desktop. */
	padding-block: clamp(2rem, 1.2rem + 4vw, 4rem);
}

/* =====================================================================
   Singular content: page.php & single.php
   ===================================================================== */
.entry {
	margin-inline: auto;
	max-width: 760px; /* comfortable measure for long-form reading */
}

.entry__header {
	margin-bottom: clamp(1.25rem, 3vw, 2rem);
}

.entry__title {
	margin: 0 0 0.5rem;
}

.entry__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 1rem;
	margin: 0;
	color: var(--mytheme-muted);
	font-size: 0.95rem;
}

.entry__meta a {
	color: var(--mytheme-muted);
	text-decoration: none;
}

.entry__meta a:hover {
	color: var(--mytheme-accent);
}

.entry__thumb {
	margin: 0 0 clamp(1.25rem, 3vw, 2rem);
}

.entry__thumb img {
	width: 100%;
	border-radius: var(--mytheme-radius);
	box-shadow: var(--mytheme-shadow);
}

.entry__content {
	font-size: 1.0625rem;
	line-height: 1.75;
}

/* Flow spacing keeps vertical rhythm without per-element margins. */
.entry__content > * + * {
	margin-top: 1.25em;
}

.entry__content p,
.entry__content li {
	overflow-wrap: break-word;
}

.entry__content h2 {
	margin-top: 2em;
}

.entry__content h3 {
	margin-top: 1.6em;
}

.entry__content img {
	border-radius: var(--mytheme-radius-sm);
}

.entry__content a {
	text-underline-offset: 2px;
}

.entry__content blockquote {
	margin: 1.5em 0;
	padding: 0.75rem 1.25rem;
	border-left: 4px solid var(--mytheme-accent);
	background: var(--mytheme-bg);
	border-radius: 0 var(--mytheme-radius-sm) var(--mytheme-radius-sm) 0;
	color: var(--mytheme-ink);
	font-style: italic;
}

/* Wide elements scroll internally instead of breaking the layout. */
.entry__content pre,
.entry__content table {
	display: block;
	max-width: 100%;
	overflow-x: auto;
}

.entry__content table {
	width: 100%;
	border-collapse: collapse;
}

.entry__content th,
.entry__content td {
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--mytheme-border);
	text-align: left;
}

.entry__pages {
	margin-top: 2rem;
	font-weight: 600;
}

.entry__footer {
	margin-top: clamp(1.5rem, 4vw, 2.5rem);
	padding-top: 1.25rem;
	border-top: 1px solid var(--mytheme-border);
	color: var(--mytheme-muted);
	font-size: 0.95rem;
}

.post-navigation {
	max-width: 760px;
	margin: clamp(2rem, 5vw, 3rem) auto 0;
}

.post-navigation .nav-links {
	display: grid;
	gap: 1rem;
}

@media (min-width: 768px) {
	.post-navigation .nav-links {
		grid-template-columns: 1fr 1fr;
	}

	.post-navigation .nav-next {
		text-align: right;
	}
}

.post-navigation a {
	display: block;
	padding: 1rem 1.25rem;
	background: var(--mytheme-bg);
	border: 1px solid var(--mytheme-border);
	border-radius: var(--mytheme-radius-sm);
	text-decoration: none;
	color: var(--mytheme-ink);
	font-weight: 600;
	transition: border-color var(--mytheme-duration) var(--mytheme-ease),
		box-shadow var(--mytheme-duration) var(--mytheme-ease);
}

.post-navigation a:hover {
	border-color: var(--mytheme-accent);
	box-shadow: var(--mytheme-shadow);
}

/* =====================================================================
   Listing / archive: index.php & archive.php  — card grid
   ===================================================================== */
.archive-header {
	max-width: var(--mytheme-maxw);
	margin: 0 auto clamp(1.5rem, 4vw, 2.5rem);
	text-align: center;
}

.archive-header__title {
	margin: 0 0 0.5rem;
}

.archive-header__desc {
	color: var(--mytheme-muted);
	max-width: 60ch;
	margin-inline: auto;
}

.post-cards {
	display: grid;
	grid-template-columns: 1fr; /* mobile: single column */
	gap: clamp(1.25rem, 3vw, 2rem);
}

@media (min-width: 768px) {
	.post-cards {
		grid-template-columns: repeat(2, 1fr); /* tablet: two columns */
	}
}

@media (min-width: 1024px) {
	.post-cards {
		grid-template-columns: repeat(3, 1fr); /* desktop: three columns */
	}
}

.post-card {
	display: flex;
	flex-direction: column;
	background: var(--mytheme-surface);
	border: 1px solid var(--mytheme-border);
	border-radius: var(--mytheme-radius);
	overflow: hidden;
	box-shadow: var(--mytheme-shadow);
	transition: transform var(--mytheme-duration) var(--mytheme-ease),
		box-shadow var(--mytheme-duration) var(--mytheme-ease);
}

.post-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--mytheme-shadow-lg);
}

.post-card__thumb {
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--mytheme-bg);
}

.post-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 400ms var(--mytheme-ease);
}

.post-card:hover .post-card__thumb img {
	transform: scale(1.05);
}

/* Styled placeholder so a thumb-less post never renders an empty box. */
.post-card__thumb--empty {
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #1f2a38 0%, #33475b 100%);
	color: rgba(255, 255, 255, 0.85);
}

.post-card__thumb--empty svg {
	width: 42px;
	height: 42px;
}

.post-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 0.6rem;
	padding: clamp(1rem, 3vw, 1.5rem);
}

.post-card__title {
	margin: 0;
	font-size: 1.25rem;
	line-height: 1.3;
}

.post-card__title a {
	color: var(--mytheme-ink);
	text-decoration: none;
}

.post-card__title a:hover {
	color: var(--mytheme-accent);
}

.post-card__meta {
	margin: 0;
	color: var(--mytheme-muted);
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.post-card__excerpt {
	margin: 0;
	flex: 1 1 auto;
	color: var(--mytheme-muted);
}

.post-card__more {
	align-self: flex-start;
	margin-top: 0.25rem;
}

.no-posts {
	max-width: 60ch;
	margin-inline: auto;
	text-align: center;
	color: var(--mytheme-muted);
}

/* ---- Pagination --------------------------------------------------- */
.mytheme-pagination,
.pagination {
	margin-top: clamp(2rem, 5vw, 3rem);
}

.mytheme-pagination .nav-links,
.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
}

.mytheme-pagination .page-numbers,
.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: var(--mytheme-touch);
	min-height: var(--mytheme-touch);
	padding: 0 0.75rem;
	border: 1px solid var(--mytheme-border);
	border-radius: var(--mytheme-radius-sm);
	background: var(--mytheme-surface);
	color: var(--mytheme-ink);
	text-decoration: none;
	transition: background var(--mytheme-duration) var(--mytheme-ease),
		border-color var(--mytheme-duration) var(--mytheme-ease);
}

.mytheme-pagination .page-numbers:hover,
.pagination .page-numbers:hover {
	border-color: var(--mytheme-accent);
}

.mytheme-pagination .page-numbers.current,
.pagination .page-numbers.current {
	background: var(--mytheme-accent);
	border-color: var(--mytheme-accent);
	color: #fff;
}

/* =====================================================================
   Buttons
   ===================================================================== */
.mytheme-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--mytheme-touch);
	padding: 0.7rem 1.4rem;
	border: 2px solid var(--mytheme-accent);
	border-radius: var(--mytheme-radius-sm);
	background: var(--mytheme-accent);
	color: #fff;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background var(--mytheme-duration) var(--mytheme-ease),
		transform var(--mytheme-duration) var(--mytheme-ease);
}

.mytheme-btn:hover,
.mytheme-btn:focus {
	background: var(--mytheme-accent-dark);
	border-color: var(--mytheme-accent-dark);
	color: #fff;
	transform: translateY(-2px);
}

.mytheme-btn--ghost {
	background: transparent;
	color: var(--mytheme-accent);
}

.mytheme-btn--ghost:hover,
.mytheme-btn--ghost:focus {
	background: var(--mytheme-accent);
	color: #fff;
}

/* =====================================================================
   404
   ===================================================================== */
.error-404 {
	max-width: 620px;
	margin-inline: auto;
	text-align: center;
}

.error-404__code {
	margin: 0;
	font-size: clamp(4rem, 2rem + 18vw, 9rem);
	font-weight: 800;
	line-height: 1;
	color: var(--mytheme-accent);
	letter-spacing: -0.03em;
}

.error-404__title {
	margin: 0.5rem 0 1rem;
}

.error-404__text {
	color: var(--mytheme-muted);
	margin: 0 auto 1.75rem;
	max-width: 48ch;
}

.error-404 .search-form {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
	margin-bottom: 1.75rem;
}

.error-404 .search-field {
	flex: 1 1 240px;
	min-height: var(--mytheme-touch);
	padding: 0 0.9rem;
	border: 1px solid var(--mytheme-border);
	border-radius: var(--mytheme-radius-sm);
	font-size: 1rem;
}

.error-404 .search-submit {
	min-height: var(--mytheme-touch);
	padding: 0 1.25rem;
	border: 0;
	border-radius: var(--mytheme-radius-sm);
	background: var(--mytheme-accent);
	color: #fff;
	font-weight: 600;
	cursor: pointer;
	transition: background var(--mytheme-duration) var(--mytheme-ease);
}

.error-404 .search-submit:hover {
	background: var(--mytheme-accent-dark);
}

/* =====================================================================
   Reduced motion
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
