/* ===========================================================================
   AsterisMC — final layer
   Loaded last on every page, after the legacy template stylesheets, so these
   rules win without editing the 4 near-duplicate *_responsive.css files.
   Scope: small-screen correctness, tap targets, accessibility, motion safety.
   =========================================================================== */

/* ── 1. No horizontal scroll, ever ──────────────────────────────────────────
   Several template blocks use fixed pixel widths wider than a 320px viewport.
   Clip at the root so a stray child can never produce a sideways scrollbar,
   and keep the intrinsic size honest. */
html {
	overflow-x: hidden;
	scroll-behavior: smooth;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}
body {
	overflow-x: hidden;
	max-width: 100%;
}
img,
video,
svg {
	max-width: 100%;
}

/* Honour the notch/rounded corners on modern phones (viewport-fit=cover). */
.footer_inner,
.fs_menu_container {
	padding-left: env(safe-area-inset-left);
	padding-right: env(safe-area-inset-right);
}
/* The header keeps a real side gutter; a bare env() here used to zero the
   template's 48px and push the logo against the screen edge. */
.header {
	--header-gutter: 40px;
	padding-left: max(var(--header-gutter), env(safe-area-inset-left));
	padding-right: max(var(--header-gutter), env(safe-area-inset-right));
}
@media (max-width: 991px) { .header { --header-gutter: 24px; } }
@media (max-width: 575px) { .header { --header-gutter: 16px; } }
.footer_bottom {
	padding-bottom: env(safe-area-inset-bottom);
}

/* ── 2. (Removed 2026-11-20: the hero planet scene became the live map hero.) */

/* ── 3. Tap targets ─────────────────────────────────────────────────────────
   The hamburger hit area was ~42x43px and the full-screen menu links had no
   minimum height. WCAG 2.5.8 asks for 44x44 CSS px. */
.hamburger_container {
	min-width: 44px;
	min-height: 44px;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.fs_menu_list li a,
.footer_col a,
.nav_items li a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
}
.footer_col a {
	min-height: 36px;
}
/* Buttons and form controls need a comfortable minimum too. */
button,
input[type="submit"],
input[type="button"],
.button a,
.button2 a {
	min-height: 44px;
}
input,
select,
textarea {
	/* iOS Safari zooms the viewport when a focused field is under 16px. */
	font-size: max(16px, 1em);
}

/* ── 3b. Phone menu: a dark red dropdown under the header ───────────────────
   The template's full-screen white overlay is replaced by a panel that drops
   from under the header. The Menu button and the panel exist only at 991px and
   below; the desktop nav covers wider screens. site.js toggles .active on the
   panel and the overlay. */
:root { --header-h: 80px; }
@media (max-width: 479px) { :root { --header-h: 70px; } }

@media (min-width: 992px) {
	.hamburger_container,
	.fs_menu_container,
	.fs_menu_overlay {
		display: none !important;
	}
}
@media (max-width: 991px) {
	.hamburger_container { display: flex; }
}

.fs_menu_container,
.fs_menu_container.active {
	top: var(--header-h);
	left: auto;
	right: 0;
	width: 320px;
	height: auto;
	padding: 0;
	text-align: left;
}
.fs_menu_container {
	z-index: 19;
	max-height: 0;
	overflow: hidden;
	visibility: hidden;
	background: linear-gradient(180deg, var(--bg-card-alt) 0%, var(--bg-header) 100%);
	border-bottom: 2px solid var(--brand-fill);
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
	transition: max-height 350ms cubic-bezier(.19,1,.22,1), visibility 0s 350ms;
}
.fs_menu_container.active {
	max-height: calc(100vh - var(--header-h));
	overflow-y: auto;
	visibility: visible;
	transition: max-height 350ms cubic-bezier(.19,1,.22,1), visibility 0s;
}
@media (max-width: 575px) {
	.fs_menu_container,
	.fs_menu_container.active {
		left: 0;
		width: 100%;
	}
}
.fs_menu_shapes,
.fs_social_container {
	display: none;
}

.fs_menu_nav {
	padding: 6px 0 10px;
}
.fs_menu_list {
	display: block;
	margin: 0;
	padding: 0;
	list-style: none;
}
.fs_menu_list li {
	overflow: visible;
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
	transition: background-color 200ms ease;
}
.fs_menu_list li:last-child {
	border-bottom: 0;
}
.fs_menu_list li.active,
.fs_menu_list li:hover {
	background: var(--brand-fill);
}
.fs_menu_list li:has(.nav-discord):hover {
	background: #5865F2;
}
.fs_menu_list li a {
	display: flex;
	width: 100%;
	min-height: 48px;
	padding: 0 max(24px, env(safe-area-inset-left));
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 3.5px;
	text-transform: uppercase;
	color: #ffffff;
	transform: none;
	transition: none;
}
.fs_menu_list li:nth-child(n) a {
	transition-delay: 0s;
}
.fs_menu_list li a > span::after {
	display: none;
}

/* Tapping the page below the open panel closes it. */
.fs_menu_overlay {
	position: fixed;
	top: var(--header-h);
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 18;
	background: rgba(13, 8, 11, 0.55);
	opacity: 0;
	visibility: hidden;
	transition: opacity 300ms ease, visibility 0s 300ms;
}
.fs_menu_overlay.active {
	opacity: 1;
	visibility: visible;
	transition: opacity 300ms ease, visibility 0s;
}

/* ── 3c. Hover shine ────────────────────────────────────────────────────────
   One sweep for buttons and nav tabs, replacing the template's faint 60px bar
   (10% white, rotated) that was nearly invisible on maroon. The link is the
   stacking context, so the bar paints over the parent's fill but under the
   text. It sweeps on hover or keyboard focus and snaps back unseen. It is kept
   under reduced motion by the user's choice (see the exemption in section 7).
   This lives here, not in theme.css, because the template's equal-specificity
   rules load after theme.css. */
.button a,
.button2 a,
.nav_items li a {
	position: relative;
	overflow: hidden;
	z-index: 0;
}
.button a::after,
.button2 a::after,
.nav_items li a::after {
	content: '';
	display: block;
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 55%;
	height: auto;
	z-index: -1;
	pointer-events: none;
	background: linear-gradient(90deg,
		rgba(255, 255, 255, 0) 0%,
		rgba(255, 255, 255, 0.35) 50%,
		rgba(255, 255, 255, 0) 100%);
	transform: translateX(-140%) skewX(-20deg);
	transition: none;
}
.button a:hover::after,
.button a:focus-visible::after,
.button2 a:hover::after,
.button2 a:focus-visible::after,
.nav_items li:hover a::after,
.nav_items li a:focus-visible::after {
	left: 0;
	transform: translateX(240%) skewX(-20deg);
	transition: transform 600ms cubic-bezier(.4, 0, .2, 1);
}

/* ── 4. Visible keyboard focus ──────────────────────────────────────────────
   The template removed outlines wholesale; restore them for keyboard users
   only, so mouse users see no change. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.hamburger_container:focus-visible,
[tabindex]:focus-visible {
	outline: 2px solid var(--cmc-gold, #e8735a);
	outline-offset: 3px;
	border-radius: 2px;
}

/* ── 5. Accordion affordance (rules / FAQ / policy) ─────────────────────────
   These panels are now server-rendered, so they are the first thing a reader
   sees. Make the click target obvious and comfortable on touch. */
.accordion {
	min-height: 48px;
	cursor: pointer;
	transition: background-color 0.18s ease, color 0.18s ease;
}
.accordion_panel {
	overflow: hidden;
	max-height: 0;
	transition: max-height 0.28s ease;
}
.accordion_panel p {
	overflow-wrap: anywhere;
}
/* Long command strings and tables inside wiki/rules copy must scroll in place
   rather than widening the page. */
.accordion_panel table,
.news-content table {
	display: block;
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
.accordion_panel pre,
.news-content pre {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
.accordion_panel code,
.news-content code {
	overflow-wrap: anywhere;
}

/* ── 6. Small-screen typography and rhythm ──────────────────────────────────
   Fluid clamps stop headings from overflowing on 320px screens without
   needing another breakpoint ladder. */
@media (max-width: 767px) {
	h1 {
		font-size: clamp(26px, 7.5vw, 40px);
		line-height: 1.15;
		overflow-wrap: break-word;
	}
	h2 {
		font-size: clamp(20px, 5.5vw, 30px);
		overflow-wrap: break-word;
	}
	.section_title h2,
	.section_title2 h2 {
		font-size: clamp(20px, 6vw, 28px);
	}
	.container,
	.container-fluid {
		padding-left: 16px;
		padding-right: 16px;
	}
	.news-card,
	.appeal-card {
		border-radius: 10px;
	}
}

/* ── 7. Motion safety ───────────────────────────────────────────────────────
   Respect the OS "reduce motion" setting: transitions and animations finish
   at once, and the starfield (via CMC_REDUCED_MOTION in index.html) renders
   one still frame. Two exceptions, both the user's choice: the hover shine
   below, and the homepage map drift (js/hero-map.js), which keeps moving. */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
	*,
	*::before,
	*::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}
	/* The hover shine (section 3c) is exempt: the user wants it everywhere. */
	.button a:hover::after,
	.button a:focus-visible::after,
	.button2 a:hover::after,
	.button2 a:focus-visible::after,
	.nav_items li:hover a::after,
	.nav_items li a:focus-visible::after {
		transition-duration: 600ms !important;
	}
}

/* ── 8. Colour consistency ──────────────────────────────────────────────────
   theme.css defines the palette but most of the template hard-codes hex
   values. Route the recurring accents through the tokens so a future palette
   change lands everywhere. */
.footer_col_label,
.wiki-cat-title,
.section_title h2 span,
.hero_static_content h1 span {
	color: var(--cmc-gold, #e8735a);
}
.accordion.active {
	color: var(--cmc-gold, #e8735a);
	/* The template's open state was an olive #2a2010 left from the old theme. */
	background: var(--brand-fill-deep, #541830);
}
.accordion:active {
	background: var(--brand-fill-deep, #541830) !important;
}
/* The IP button: the fixed 225px (170px on phones) box cut "play.asterismc.net"
   off at phone widths. Let it size to its text instead. */
.button.contact_button {
	width: fit-content;
	min-width: 225px;
	max-width: 100%;
	padding: 0 28px;
}
@media (max-width: 575px) {
	.button.contact_button {
		min-width: 0;
		padding: 0 20px;
	}
	.button.contact_button a {
		letter-spacing: 3px;
	}
}
::selection {
	background: var(--cmc-gold, #e8735a);
	color: #0d080b;
}
/* Firefox renders the default scrollbar light against this dark theme. */
html {
	scrollbar-color: var(--cmc-gold, #e8735a) var(--bg-void, #0d080b);
	scrollbar-width: thin;
}
::-webkit-scrollbar {
	width: 10px;
	height: 10px;
}
::-webkit-scrollbar-track {
	background: var(--bg-void, #0d080b);
}
::-webkit-scrollbar-thumb {
	background: rgba(232, 115, 90, 0.5);
	border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
	background: var(--cmc-gold, #e8735a);
}

/* ── 9. Map page prose ──────────────────────────────────────────────────────
   The descriptive block under the live map: real copy for readers who want
   context, and the only text a crawler can read on a canvas-driven page. */
.map_about {
	padding: 64px 0 72px;
	background: linear-gradient(180deg,
		var(--bg-void, #0d080b) 0%,
		var(--bg-base, #170d12) 100%);
	border-top: 1px solid rgba(232, 115, 90, 0.18);
}
.map_about h2 {
	font-size: clamp(22px, 3.4vw, 30px);
	font-weight: 800;
	letter-spacing: 0.04em;
	color: #fff;
	margin-bottom: 18px;
}
.map_about h3 {
	font-size: clamp(15px, 2.1vw, 18px);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--cmc-gold, #e8735a);
	margin: 32px 0 12px;
}
.map_about p,
.map_about li {
	font-size: 15px;
	line-height: 1.75;
	color: rgba(255, 255, 255, 0.72);
}
.map_about ul {
	padding-left: 20px;
	margin-bottom: 8px;
}
.map_about li {
	margin-bottom: 8px;
}
.map_about li strong {
	color: rgba(255, 255, 255, 0.92);
}
.map_about code {
	background: rgba(0, 0, 0, 0.35);
	border-radius: 4px;
	padding: 1px 6px;
	font-size: 13px;
	color: var(--cmc-gold-light, #f19a85);
}
.map_about a {
	color: var(--cmc-gold, #e8735a);
	text-decoration: underline;
	text-underline-offset: 3px;
}
.map_about a:hover {
	color: var(--cmc-gold-light, #f19a85);
}
@media (max-width: 767px) {
	.map_about {
		padding: 40px 0 48px;
	}
	.map_about h3 {
		margin-top: 26px;
	}
}

/* News card titles are <h2> for a valid heading outline; strip the UA margin
   so they sit exactly where the previous <div> did. */
.news-title {
	margin-top: 0;
}

/* ── 10. Print ──────────────────────────────────────────────────────────────
   Rules, policy and legal pages get printed; drop the chrome and the dark
   background so they are readable on paper. */
@media print {
	.header,
	.fs_menu_container,
	.fs_menu_overlay,
	.hamburger_container,
	.footer,
	#starfield,
	canvas {
		display: none !important;
	}
	body {
		background: #fff !important;
		color: #000 !important;
	}
	.accordion_panel {
		max-height: none !important;
		overflow: visible !important;
	}
	a[href^="http"]::after {
		content: " (" attr(href) ")";
		font-size: 0.85em;
	}
}
