/**
 * LunarBase — Responsive rules.
 *
 * Breakpoints mirror the original static build: the desktop navigation
 * collapses to a panel below 980px, and the layout compresses further at
 * 640px. Additional breakpoints cover the blog and forms.
 */

/* --------------------------------------------------------------------------
Large desktop / small laptops
-------------------------------------------------------------------------- */

@media (max-width: 1180px) {
	.layout-grid {
		grid-template-columns: minmax(0, 1fr) 260px;
	}

	.main-nav ul {
		gap: 1.5rem;
	}
}

/* --------------------------------------------------------------------------
Tablet and mobile navigation (<= 980px)
-------------------------------------------------------------------------- */

@media (max-width: 980px) {
	.site-header {
		/* minmax(0, 1fr) lets the brand shrink instead of pushing the
		   menu toggle off-screen on very narrow phones. */
		grid-template-columns: minmax(0, 1fr) auto;
	}

	.brand {
		min-width: 0;
	}

	.brand-text {
		min-width: 0;
	}

	.brand-name {
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.header-cta {
		display: none;
	}

	.menu-toggle {
		display: grid;
	}

	.main-nav {
		position: fixed;
		top: var(--header-h-sm);
		left: 0;
		right: 0;
		display: block;
		max-height: calc(100vh - var(--header-h-sm));
		overflow-y: auto;
		overscroll-behavior: contain;
		padding: 0.5rem 1.25rem 2rem;
		background: var(--black);
		border-bottom: 1px solid var(--line);
		transform: translateY(-130%);
		transition: transform 0.3s var(--ease);
		z-index: 45;
	}

	.main-nav.is-open {
		transform: none;
	}

	.main-nav ul {
		display: grid;
		gap: 0;
		align-items: stretch;
	}

	.main-nav li {
		border-bottom: 1px solid var(--line);
	}

	.main-nav li:last-child {
		border-bottom: 0;
	}

	.main-nav a {
		display: block;
		padding: 1rem 0;
		font-size: 0.8rem;
	}

	/* Sub-menus become static blocks inside the panel. */
	.main-nav .sub-menu {
		position: static;
		display: none;
		min-width: 0;
		padding: 0 0 0.75rem 1rem;
		background: none;
		border: 0;
		opacity: 1;
		visibility: visible;
		transform: none;
	}

	.main-nav .sub-menu::before {
		display: none;
	}

	.main-nav li:hover > .sub-menu,
	.main-nav li:focus-within > .sub-menu {
		display: grid;
	}

	.main-nav .sub-menu .sub-menu {
		padding-left: 1rem;
	}

	.main-nav .sub-menu a {
		padding: 0.5rem 0;
	}

	.hero-content {
		width: min(800px, 88vw);
		margin-left: 6vw;
	}

	.scroll-cue {
		display: none;
	}

	.manifesto-copy,
	.section-heading,
	.economy-intro {
		grid-template-columns: 1fr;
	}

	.manifesto-copy > p:last-child {
		grid-column: auto;
	}

	.manifesto-copy .kicker {
		padding-top: 0;
	}

	.manifesto-stats {
		margin-left: 0;
	}

	.build-feature {
		grid-template-columns: 1fr;
	}

	.build-image {
		min-height: 60vw;
	}

	.system-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.section-heading {
		align-items: start;
		gap: 1.25rem;
	}

	.economy-intro .section-index {
		margin-bottom: 2rem;
	}

	.briefing {
		grid-template-columns: 1fr;
	}

	.briefing-copy {
		grid-column: 1;
	}

	.briefing-orbit {
		opacity: 0.35;
		width: 85vw;
		left: -30vw;
	}

	.layout-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.post-card--featured {
		flex-direction: column;
	}

	.post-card--featured .post-card-media {
		flex: none;
		aspect-ratio: 16 / 9;
	}

	.site-footer {
		grid-template-columns: 1fr;
		gap: 1.2rem;
	}

	.site-footer-extras {
		justify-content: flex-start;
	}

	.footer-widgets {
		grid-column: 1 / -1;
	}
}

/* --------------------------------------------------------------------------
Phones (<= 640px)
-------------------------------------------------------------------------- */

@media (max-width: 640px) {
	.site-header {
		height: var(--header-h-sm);
		padding-inline: 1rem;
	}

	.brand img,
	.brand .custom-logo {
		width: 34px;
		height: 34px;
	}

	.brand-name {
		font-size: 1.08rem;
	}

	/* The tagline stays in the footer; the header keeps the wordmark only. */
	.site-header .brand-tagline {
		display: none;
	}

	.hero {
		min-height: 860px;
		align-items: flex-start;
	}

	.hero-image {
		background-position: 61% center;
	}

	.hero-shade {
		background: linear-gradient(180deg, rgba(6, 7, 8, 0.86), rgba(6, 7, 8, 0.4) 55%, rgba(5, 6, 7, 0.97));
	}

	.hero-grid {
		background-size: 44px 44px;
		-webkit-mask-image: linear-gradient(#000, transparent 78%);
		mask-image: linear-gradient(#000, transparent 78%);
	}

	.hero-content {
		width: auto;
		margin: 9rem 1.15rem 12rem;
	}

	.hero-title {
		/* Slightly smaller than the static build so the longest word,
		   "Construction.", never overflows a 320px viewport. */
		font-size: clamp(3.2rem, 17vw, 6rem);
		line-height: 0.84;
	}

	.hero-copy {
		font-size: 0.95rem;
		max-width: 92%;
	}

	.hero-actions {
		align-items: flex-start;
		flex-direction: column;
		gap: 1.5rem;
	}

	.button {
		width: 100%;
		min-width: 0;
	}

	.hero-telemetry {
		left: 1.15rem;
		right: 1.15rem;
		bottom: 1.25rem;
		gap: 1.2rem;
		flex-wrap: wrap;
	}

	.hero-telemetry > div:last-child {
		display: none;
	}

	.section {
		padding: 5.5rem 1.15rem;
	}

	.content-area {
		padding: 3rem 1.15rem;
	}

	.manifesto > .section-index {
		top: 1.5rem;
	}

	.manifesto .section-title,
	.section-heading .section-title,
	.economy .section-title,
	.briefing .section-title,
	.build-copy .section-title {
		font-size: 3.45rem;
	}

	.manifesto-stats {
		grid-template-columns: 1fr;
		margin-top: 3.5rem;
	}

	.manifesto-stats article,
	.manifesto-stats article + article {
		min-height: auto;
		padding: 1.5rem 0;
		border-right: 0;
		border-bottom: 1px solid #cfd1ce;
	}

	.manifesto-stats h3 {
		margin: 0.9rem 0 0.4rem;
	}

	.build-image {
		min-height: 72vw;
	}

	.image-label {
		left: 1.15rem;
		bottom: 1.15rem;
		max-width: calc(100% - 2.3rem);
	}

	.build-copy {
		padding: 4rem 1.15rem 5rem;
	}

	.system-grid {
		grid-template-columns: 1fr;
	}

	.system-card {
		min-height: 350px;
	}

	.economy-intro {
		gap: 0.5rem;
	}

	.economy-list {
		margin-top: 3.5rem;
	}

	.economy-row {
		grid-template-columns: 0.25fr 1fr;
		gap: 0.3rem 1rem;
	}

	.economy-row p {
		grid-column: 2;
		font-size: 0.85rem;
	}

	.economy-row b {
		display: none;
	}

	.briefing {
		min-height: 760px;
		padding: 5rem 1.15rem;
	}

	.briefing-orbit {
		width: 110vw;
		left: -58vw;
	}

	.briefing-form {
		display: grid;
		border: 0;
		gap: 0.7rem;
	}

	.briefing-form .field-control {
		border-bottom: 1px solid #5b5f5f;
	}

	.briefing-form button {
		background: var(--orange);
		padding: 1rem;
		text-align: left;
	}

	.briefing-form button span {
		color: #fff;
	}

	.contact-columns {
		grid-template-columns: 1fr;
	}

	.post-grid {
		grid-template-columns: 1fr;
	}

	.author-box {
		grid-template-columns: 1fr;
		text-align: left;
	}

	.pagination {
		justify-content: center;
	}

	.contact-details li {
		grid-template-columns: 1fr;
		gap: 0.25rem;
	}

	.form-actions .button,
	.search-form .search-submit {
		width: 100%;
		min-width: 0;
	}

	.search-form {
		flex-direction: column;
	}
}

/* --------------------------------------------------------------------------
Short viewports / landscape phones
-------------------------------------------------------------------------- */

@media (max-height: 620px) and (max-width: 980px) {
	.main-nav {
		max-height: calc(100vh - var(--header-h-sm));
	}
}

/* --------------------------------------------------------------------------
Print
-------------------------------------------------------------------------- */

@media print {
	.site-header,
	.site-footer,
	.share-links,
	.pagination,
	.post-navigation,
	.hero-telemetry,
	.scroll-cue,
	.contact-form-wrap {
		display: none !important;
	}

	body {
		background: #fff;
		color: #000;
	}

	.entry-content,
	.entry-title,
	.section-title {
		color: #000;
	}
}