/* Darmstadt News - Global Theme Styles */

:root {
	/* Primary Colors - Conservative for news */
	--primary: hsl(0, 75%, 45%); /* Conservative red */
	--primary-light: hsl(0, 75%, 55%); /* Lighter red */
	--primary-dark: hsl(0, 75%, 35%); /* Darker red */

	/* Secondary Colors - Muted */
	--secondary: hsl(220, 13%, 18%); /* Dark gray-blue */
	--secondary-light: hsl(220, 9%, 40%); /* Medium gray */
	--secondary-dark: hsl(220, 18%, 12%); /* Very dark gray-blue */

	/* News Site Colors - Conservative Palette */
	/* --sepia-bg: hsl(45, 8%, 97%);      /* Very subtle sepia background */
	--sepia-bg: hsl(27.7, 100%, 97.5%); /* Very subtle sepia background */
	/* --paper-white: hsl(0, 0%, 100%);   /* Pure white for cards */
	--paper-white: hsl(28, 100%, 94.1%); /* actually not white. name's kept b/c legacy */
	--text-primary: hsl(0, 0%, 8%); /* Very dark for headlines */
	--text-secondary: hsl(0, 0%, 18%); /* Dark gray for body text */
	--text-muted: hsl(0, 0%, 50%); /* Neutral gray for meta info */
	--border-light: hsl(0, 0%, 90%); /* Light neutral borders */
	--border-medium: hsl(0, 0%, 80%); /* Medium neutral borders */
	--accent-red: hsl(0, 70%, 45%); /* Muted red for accents */

	/* Legacy color names for compatibility */
	--white: var(--paper-white);
	--gray-50: hsl(0, 0%, 98%);
	--gray-100: hsl(0, 0%, 95%);
	--gray-200: var(--border-light);
	--gray-300: var(--border-medium);
	--gray-400: hsl(0, 0%, 60%);
	--gray-500: var(--text-muted);
	--gray-600: hsl(0, 0%, 40%);
	--gray-700: var(--text-secondary);
	--gray-800: hsl(0, 0%, 15%);
	--gray-900: var(--text-primary);
	--black: hsl(0, 0%, 0%);

	/* Semantic Colors - Conservative */
	--success: hsl(120, 40%, 35%); /* Muted green */
	--warning: hsl(35, 85%, 45%); /* Muted orange */
	--error: hsl(0, 70%, 45%); /* Muted red */
	--info: hsl(210, 50%, 45%); /* Muted blue */

	/* Typography - News-focused stacks */
	--font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
	--font-family-serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, serif;
	--font-family-headline: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;

	/* Spacing */
	--spacing-xs: 0.25rem;
	--spacing-sm: 0.5rem;
	--spacing-md: 1rem;
	--spacing-lg: 1.5rem;
	--spacing-xl: 2rem;
	--spacing-2xl: 3rem;

	/* Border Radius */
	--radius-sm: 0.25rem;
	--radius-md: 0.5rem;
	--radius-lg: 0.75rem;
	--radius-xl: 1rem;

	/* Shadows */
	--shadow-sm: 0 1px 2px 0 hsl(from var(--black) h s l / 0.05);
	--shadow-md: 0 4px 6px -1px hsl(from var(--black) h s l / 0.1), 0 2px 4px -2px hsl(from var(--black) h s l / 0.1);
	--shadow-lg: 0 10px 15px -3px hsl(from var(--black) h s l / 0.1), 0 4px 6px -4px hsl(from var(--black) h s l / 0.1);

	/* Alpha Colors */
	--white-10: hsl(from var(--white) h s l / 0.1);
	--white-15: hsl(from var(--white) h s l / 0.15);
	--white-20: hsl(from var(--white) h s l / 0.2);
	--white-90: hsl(from var(--white) h s l / 0.9);
	--white-95: hsl(from var(--white) h s l / 0.95);
	--black-10: hsl(from var(--black) h s l / 0.1);
	--black-20: hsl(from var(--black) h s l / 0.2);
	--black-30: hsl(from var(--black) h s l / 0.3);
}

/* Unified Block System */
.block--text {
	line-height: 1.7;
	color: var(--text-secondary);
}

.block--text p {
	margin-bottom: var(--spacing-md);
}

.block--image {
	text-align: center;
}

.block--image img {
	max-width: 100%;
	height: auto;
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-md);
}

.block--quote {
	padding: var(--spacing-lg);
	background-color: var(--gray-50);
	border-left: 4px solid var(--accent-red);
	border-radius: var(--radius-sm);
	font-size: 1.05rem;
	font-style: italic;
	color: var(--text-secondary);
}

.block--media {
	text-align: center;
}

.block--media iframe {
	max-width: 100%;
	border-radius: var(--radius-md);
}

.image-caption {
	margin-top: var(--spacing-sm);
	font-size: 0.9rem;
	color: var(--text-muted);
	font-style: italic;
}

/* Utility Classes */
.full-width {
	grid-column: full-start / full-end !important;
}

.text-center {
	text-align: center;
}

.text-muted {
	color: var(--text-muted);
}

.mb-lg {
	margin-bottom: var(--spacing-lg);
}

.mt-xl {
	margin-top: var(--spacing-xl);
}

/* Reset and Base Styles */
* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	scroll-behavior: smooth;
}

html,
body {
	margin: 0;
	padding: 0;
	width: 100%;
}

body {
	font-family: var(--font-family-serif);
	line-height: 1.65;
	color: var(--text-secondary);
	background-color: var(--sepia-bg);
	font-size: 16px;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

/* .site-footer has to be its own grid, so it can be pushed down to the screen end */
.site-grid,
.site-footer {
	display: grid;
	grid-template-columns:
		[full-start] 0
		[content-start] 1fr
		[content-end] 0
		[full-end];
	grid-auto-rows: min-content;
	align-content: start;
	column-gap: 1rem;
	height: 100%;
}

.site-grid {
	margin-bottom: var(--spacing-2xl);
}

/* Headlines use condensed sans-serif */
.site-title,
.article-title,
.news-index-title,
.latest-news-title,
.home-hero-title,
.news-card-title,
h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--font-family-headline);
	font-weight: 700;
	color: var(--text-primary);
	letter-spacing: 0.5px;
	font-variant-caps: small-caps;
}

/* UI elements use system sans-serif */
.nav-link,
.category-badge,
.meta-item,
.button,
.btn,
.site-tagline,
.home-hero-subtitle {
	font-family: var(--font-family-sans);
}

/* Content headings within articles use serif */
article h1,
article h2,
article h3,
article h4,
article h5,
article h6 {
	font-family: var(--font-family-serif);
	font-weight: 700;
	line-height: 1.3;
	margin-block: var(--spacing-sm) var(--spacing-md);
}

/* Reset list styles */
ul,
ol {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* Reset link styles */
a {
	text-decoration: none;
	color: inherit;
}

/* Responsive Grid Layout - Streamlined */
@media (min-width: 768px) {
	.site-grid,
	.site-footer {
		grid-template-columns:
			[full-start] 1fr
			[content-start] minmax(240px, 45%)
			[content-mid] minmax(240px, 45%)
			[content-end] 1fr
			[full-end];
	}
}

@media (min-width: 1200px) {
	.site-grid,
	.site-footer {
		grid-template-columns:
			[full-start] minmax(1rem, 1fr)
			[content-start] minmax(320px, 480px)
			[content-mid] minmax(320px, 480px)
			[content-end] minmax(1rem, 1fr)
			[full-end];
	}
}

/* Navigation Styles - Traditional News Site */
.main-navigation {
	background-color: var(--paper-white);
	border-bottom: 3px solid var(--text-primary);
	position: sticky;
	top: 0;
	z-index: 1000;
	grid-column: full-start / full-end;
	display: grid;
	grid-template-columns: subgrid;
	box-shadow: 0 2px 4px hsl(from var(--black) h s l / 0.1);
}

/* Scroll sentinel for intersection observer */
.scroll-sentinel {
	height: 100px;
	position: absolute;
	top: 0;
	left: 0;
	width: 1px;
	pointer-events: none;
	opacity: 0;
}

.main-navigation.scrolled {
	box-shadow: 0 2px 8px hsl(from var(--black) h s l / 0.15);
}

.nav-container {
	grid-column: content-start / content-end;
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 4rem;
	padding: var(--spacing-md) 0;
}

/* Brand Styling */
.nav-brand {
	text-decoration: none;
	color: var(--text-primary);
	transition: transform 0.3s ease;
	display: flex;
	flex-direction: column;
	gap: 0;
	translate: 0 2px;
}

.nav-brand:hover {
}

.site-title {
	margin: 0;
	font-size: 2.2rem;
	font-weight: 900;
	color: var(--text-primary);
	letter-spacing: -1px;
	line-height: 0.9;
	text-transform: uppercase;
	font-style: italic;
}

.site-tagline {
	margin: 0;
	font-size: 0.8rem;
	color: var(--text-muted);
	font-weight: 400;
	font-style: italic;
	text-transform: none;
	letter-spacing: 0.5px;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
	display: none;
	flex-direction: column;
	gap: 4px;
	background: none;
	border: none;
	padding: var(--spacing-sm);
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.mobile-menu-toggle:hover {
	background-color: var(--white-10);
}

.hamburger-line {
	width: 24px;
	height: 3px;
	background-color: var(--text-primary);
	border-radius: 2px;
	transition: all 0.3s ease;
	transform-origin: center;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
	transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
	opacity: 0;
	transform: scale(0);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
	transform: rotate(-45deg) translate(5px, -5px);
}

/* Navigation Menu */
.nav-menu {
	display: flex;
	position: relative;
}

.nav-links {
	display: flex;
	list-style: none;
	margin: 0;
	padding: 0;
	gap: var(--spacing-sm);
	align-items: center;
	transition: opacity 0.3s ease;
}

.nav-links li {
	margin: 0;
	position: relative;
}

.nav-link {
	color: var(--text-primary);
	text-decoration: none;
	font-weight: 700;
	padding: var(--spacing-sm) var(--spacing-md);
	font-size: 0.9rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border-bottom: 2px solid transparent;
	transition: border-color 0.2s ease;
}

.nav-link:hover {
	border-bottom-color: var(--accent-red);
}

.nav-link:focus {
	outline: 2px solid var(--accent-red);
	outline-offset: 2px;
}

/* Dropdown Styles */
.nav-dropdown {
	position: relative;
}

.dropdown-menu {
	position: absolute;
	top: 100%;
	left: 0;
	background-color: var(--white);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
	min-width: 200px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-10px);
	transition: all 0.3s ease;
	list-style: none;
	margin: var(--spacing-sm) 0 0 0;
	padding: var(--spacing-sm);
	border: 1px solid var(--gray-200);
	overflow: hidden;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.dropdown-link {
	display: block;
	padding: var(--spacing-sm) var(--spacing-md);
	color: var(--gray-700);
	text-decoration: none;
	transition:
		background-color 0.2s ease,
		color 0.2s ease;
	font-weight: 500;
	font-size: 0.9rem;
	border-radius: var(--radius-md);
}

.dropdown-link:hover {
	background-color: var(--primary-light);
	color: var(--gray-900);
}

/* Search Functionality */

.search-container.active {
	opacity: 1;
	visibility: visible;
}

.search-container {
	display: flex;
	align-items: center;
	background-color: var(--paper-white);
	border-bottom: 2px solid var(--accent-red);
	padding: var(--spacing-sm) 0;
	gap: var(--spacing-sm);
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	transform: translateY(-50%);
	opacity: 0;
	visibility: hidden;
	transition:
		opacity 0.3s ease,
		visibility 0.3s ease;
	z-index: 10;
}

.search-input {
	flex: 1;
	border: none;
	background: transparent;
	padding: var(--spacing-sm) 0;
	font-size: 0.9rem;
	color: var(--text-primary);
	outline: none;
	font-family: var(--font-family-sans);
	font-weight: 700;
	letter-spacing: 0.5px;
}

.search-input::placeholder {
	color: var(--text-muted);
}

.search-submit {
	background: none;
	border: none;
	cursor: pointer;
	padding: var(--spacing-sm);
	color: var(--text-muted);
	transition: color 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-family-sans);
	box-shadow: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	margin: 0;
	text-decoration: none;
}

.search-submit:hover {
	color: var(--accent-red);
}

.search-icon {
	font-size: 1rem;
	line-height: 1;
}

.search-close {
	background: none;
	border: none;
	cursor: pointer;
	padding: var(--spacing-sm);
	color: var(--text-muted);
	transition: color 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-family-sans);
	font-weight: 700;
}

.search-close:hover {
	color: var(--accent-red);
}

.close-icon {
	font-size: 1.4rem;
	font-weight: 700;
	line-height: 1;
}

/* Hide/show navigation links during search */
.nav-links {
	transition: opacity 0.3s ease;
}

.nav-menu.search-active .nav-links {
	opacity: 0;
	pointer-events: none;
}

/* Search visibility - CSS-only responsive */
@media (max-width: 968px) {
	.search-mobile {
		display: block;
	}

	.search-desktop {
		display: none;
	}
}

@media (min-width: 969px) {
	.search-mobile {
		display: none;
	}

	.search-desktop {
		display: block;
	}
}

/* Fix nav-links positioning when search is active - duplicate removed */

/* Main Content */
.main-content {
	display: contents;
}

.main-content > * {
	grid-column: content-start / content-end;
}

main {
	display: contents;
}

main > article {
	width: 100%;
	max-width: none;
	margin: 0;
	display: grid;
	grid-template-columns: subgrid;
	grid-column: content-start / content-end;
}

.site-footer {
	margin-top: auto;
	padding-block: var(--spacing-lg);
	background: var(--paper-white);
}

.site-footer > * {
	grid-column: content-start / content-end;
}

/* Article content spans both middle columns on larger screens */
@media (min-width: 768px) {
	main > article {
		grid-column: content-start / content-end;
	}

	/* Article sections that should stay within the content columns */
	.article-container,
	.article-header,
	.block--text,
	.block--quote,
	.block--media,
	.block--html,
	.block--heading {
		grid-column: content-start / content-end;
	}

	/* Special blocks span content columns, images can break out to full width */
	.block--special {
		grid-column: content-start / content-end;
	}

	.block--image.full-width,
	.article-banner {
		grid-column: full-start / full-end;
	}
}

/* Wagtail image formats */
.full-width {
	width: 100%;
	height: auto;
	display: block;
	margin: var(--spacing-lg) 0;
}

/* True full-width images that break out of content area */
.breakout-full {
	grid-column: full-start / full-end;
	width: 100%;
	height: auto;
	display: block;
	margin: var(--spacing-lg) 0;
}

.left,
.right {
	width: 100%;
	height: auto;
	display: block;
	margin: var(--spacing-lg) 0;
}

/* Float left/right on larger screens */
@media (min-width: 768px) {
	.left {
		float: left;
		max-width: 50%;
		margin: 0 var(--spacing-lg) var(--spacing-lg) 0;
	}

	.right {
		float: right;
		max-width: 50%;
		margin: 0 0 var(--spacing-lg) var(--spacing-lg);
	}
}

/* Base template overrides for immediate styling removed - using main nav-links rule above */

/* Mobile Navigation */
@media (max-width: 968px) {
	/* Mobile search is always visible in menu */
	.search-container {
		position: static;
		opacity: 1;
		visibility: visible;
		margin-bottom: var(--spacing-sm);
		padding: 0;
		z-index: auto;
		transform: none;
		order: -1; /* Put search first in flex order */
	}

	.search-container {
		background-color: transparent;
		border-bottom: 1px solid var(--border-light);
		padding: var(--spacing-sm) 0;
	}

	/* Hide close button on mobile since search is always available */
	.search-close {
		display: none;
	}

	/* Keep submit button visible on mobile */
	.search-submit {
		display: flex;
	}

	/* Don't hide nav links on mobile */
	.nav-menu.search-active .nav-links {
		opacity: 1;
		pointer-events: auto;
	}
	.mobile-menu-toggle {
		display: flex;
	}

	.nav-menu {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background: var(--paper-white);
		border-top: 1px solid var(--border-light);
		box-shadow: var(--shadow-lg);
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		transform: translateY(-20px);
		transition: all 0.3s ease;
		flex-direction: column;
		padding: var(--spacing-md);
		max-height: calc(100vh - 4rem);
		overflow-y: scroll;
	}

	.nav-menu.active {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		transform: translateY(0);
	}

	.nav-links {
		flex-direction: column;
		padding: var(--spacing-lg);
		gap: var(--spacing-xs);
		display: flex;
		list-style: none;
		margin: 0;
		align-items: stretch;
	}

	.nav-link {
		width: 100%;
		justify-content: flex-start;
		padding: var(--spacing-md);
	}

	.nav-dropdown .dropdown-menu {
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		background-color: var(--gray-50);
		margin: var(--spacing-xs) 0 0 var(--spacing-lg);
		border: 1px solid var(--border-light);
		border-radius: var(--radius-md);
		padding: var(--spacing-sm);
		overflow: hidden;
	}

	.dropdown-link {
		color: var(--text-secondary);
		transition:
			background-color 0.2s ease,
			color 0.2s ease;
	}

	.dropdown-link:hover {
		background-color: var(--gray-100);
		color: var(--text-primary);
	}

	.search-trigger-mobile:hover {
		background-color: var(--gray-100);
	}
}

@media (max-width: 480px) {
	.nav-container {
		padding: 0 1rem;
		min-height: 4.5rem;
	}

	.nav-menu {
		max-height: calc(100vh - 4.5rem);
	}

	.brand-content {
		gap: var(--spacing-sm);
	}

	.brand-icon {
		font-size: 1.5rem;
	}

	.site-title {
		font-size: 1.4rem;
	}

	.site-tagline {
		font-size: 0.7rem;
	}
}

/* styles that are shared between apps */
.news-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: var(--spacing-md);
	margin-bottom: var(--spacing-lg);
}

/* Responsive grid for 3-column layout */
@media (min-width: 768px) {
	.news-grid {
		grid-template-columns: 1fr 1fr;
		gap: var(--spacing-lg);
	}
}

.news-card {
	border-bottom: 1px solid var(--border-medium);
	overflow: hidden;
	transition: border-color 0.2s ease;
	text-decoration: none;
	color: inherit;
	display: block;
}

.news-card:hover {
	border-color: var(--border-medium);
}

.news-card-image {
	width: 100%;
	height: 140px;
	overflow: hidden;
	position: relative;
}

.news-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.news-card-overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	background: linear-gradient(to top, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.5));
	background: linear-gradient(to top, color(from var(--sepia-bg) srgb r g b / 0.9), color(from var(--sepia-bg) srgb r g b / 0.5));
	backdrop-filter: blur(5px);
	padding: var(--spacing-sm);
	display: flex;
	flex-direction: column;
	gap: var(--spacing-xs);
	text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.news-card-meta-overlay {
	margin-bottom: 0;
}

.news-card-title-overlay {
	color: var(--text-primary);
	font-size: 0.9rem;
	line-height: 1.3;
	margin: 0;
}

.news-card-content {
	padding-block: var(--spacing-md);
}

.news-card-meta {
	display: flex;
	align-items: center;
	gap: var(--spacing-sm);
	margin-bottom: var(--spacing-xs);
	font-size: 0.75rem;
	color: var(--text-muted);
}

.news-card-date {
	color: var(--text-muted);
	font-weight: 500;
	font-size: 0.75rem;
}

.news-card-category {
	background-color: var(--accent-red);
	color: var(--paper-white);
	padding: 2px var(--spacing-xs);
	border-radius: var(--radius-sm);
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.3px;
}

.news-card-title {
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.3;
	margin-bottom: var(--spacing-xs);
	color: var(--text-primary);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-variant-caps: unset;
}

.news-card-intro {
	color: var(--text-secondary);
	line-height: 1.4;
	margin: 0;
	font-size: 0.85rem;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.no-articles {
	text-align: center;
	padding: var(--spacing-2xl);
	color: var(--gray-600);
	font-size: 1.1rem;
}

@media (max-width: 768px) {
	.news-grid {
		grid-template-columns: 1fr;
		gap: var(--spacing-md);
	}

	.news-card-meta {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--spacing-xs);
	}
}
