/* =============================================================
   AFRC site shell — top navigation bar + final footer.
   Folded in from the afrc-site-shell plugin (v0.3.4). The plugin's
   !important spam (needed to override Divi) is dropped: the theme
   owns this markup, so normal specificity is enough.
   ============================================================= */

html,
body {
	margin: 0;
}

/* ---------- Topbar ---------- */
.afrc-topbar {
	position: sticky;
	top: 0;
	z-index: 30;
	min-height: 45px;
	display: grid;
	grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
	gap: 14px;
	align-items: center;
	padding: 2px clamp(12px, 2.2vw, 30px);
	color: #fff;
	background: var(--afrc-navy-bar);
	border-bottom: 1px solid rgba(255,255,255,.06);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	font-family: var(--afrc-font);
}

/* Hero pages (homepage, play-rugby-in-tokyo): restore the glassy overlay —
   the bar floats absolutely over the dark hero instead of sitting in normal
   flow. The .afrc-has-hero class is added to <body> by afrc_body_classes().
   Everywhere else the bar stays sticky + solid and the content flows below. */
.afrc-has-hero .afrc-topbar {
	position: absolute;
	inset: 0 0 auto;
	border-bottom-color: rgba(255,255,255,.04);
	background:
		linear-gradient(180deg, rgba(0,12,48,.72) 0%, rgba(0,20,72,.42) 58%, rgba(0,20,72,0) 100%),
		linear-gradient(90deg, rgba(0,12,48,.42), rgba(0,27,104,.10) 50%, rgba(0,12,48,.20));
	-webkit-backdrop-filter: blur(10px) saturate(.96);
	backdrop-filter: blur(10px) saturate(.96);
}

/* Symmetric row: logo, centered nav, language/tools on the right. */
.afrc-topbar__left  { grid-column: 1; grid-row: 1; justify-self: start;  display: flex; align-items: center; gap: 12px; }
.afrc-topbar__nav   { grid-column: 2; grid-row: 1; justify-self: center; display: flex; align-items: center; justify-content: center; gap: .35rem; }
.afrc-topbar__tools { grid-column: 3; grid-row: 1; justify-self: end;    display: flex; align-items: center; gap: 14px; }
.afrc-topbar__lang  { grid-column: 3; grid-row: 1; justify-self: end; }

.afrc-topbar__nav a {
	display: inline-flex;
	padding: .28rem .56rem;
	border-radius: 7px;
	color: rgba(255,255,255,.82);
	font-size: .84rem;
	font-weight: 500;
	white-space: nowrap;
	text-decoration: none;
	transition: color .2s ease, background-color .2s ease, transform .2s ease;
}
.afrc-topbar__nav a:hover { color: #fff; background: rgba(255,255,255,.12); transform: translateY(-1px); }
.afrc-topbar__nav a.is-active { color: #fff; background: rgba(227,6,19,.35); }

/* Dropdowns (lang + next match) */
.afrc-topbar details { position: relative; }
.afrc-topbar summary {
	list-style: none;
	display: inline-flex;
	align-items: center;
	gap: .42rem;
	padding: .26rem .52rem;
	border: 1px solid rgba(255,255,255,.16);
	border-radius: 7px;
	color: #fff;
	background: rgba(255,255,255,.08);
	font-size: .74rem;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}
.afrc-topbar summary::-webkit-details-marker { display: none; }
.afrc-topbar summary:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.28); }

.afrc-topbar__brand {
	width: 38px;
	height: 38px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	text-decoration: none;
}
.afrc-topbar__brand img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}
.afrc-topbar__lang {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-left: clamp(10px, 1.4vw, 22px);
	color: rgba(255,255,255,.82);
	font-size: .84rem;
	font-weight: 500;
	letter-spacing: 0;
	line-height: 1;
	white-space: nowrap;
}

.afrc-topbar__lang summary {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	min-height: 31px;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: rgba(255,255,255,.82);
	font-size: .84rem;
	font-weight: 500;
	letter-spacing: 0;
}

.afrc-topbar__lang summary::after {
	content: "";
	display: block;
	width: 0;
	height: 0;
	margin-left: 2px;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid rgba(255,255,255,.72);
}

.afrc-topbar__lang summary span,
.afrc-topbar__lang-menu span span,
.afrc-topbar__lang-menu a span {
	font-size: 16px;
	line-height: 1;
	letter-spacing: 0;
}

.afrc-topbar__lang-menu {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 40;
	display: grid;
	min-width: 86px;
	padding: 6px;
	border: 1px solid rgba(255,255,255,.14);
	border-radius: 10px;
	background: rgba(0,18,62,.96);
	box-shadow: 0 18px 44px rgba(0,0,0,.28);
}

.afrc-topbar__lang:not([open]) .afrc-topbar__lang-menu {
	display: none;
}

.afrc-topbar__lang-menu a,
.afrc-topbar__lang-menu span {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 7px;
	min-height: 30px;
	border-radius: 7px;
	color: rgba(255,255,255,.76);
	font-size: 13px;
	font-weight: 850;
	letter-spacing: .03em;
	text-decoration: none;
}

.afrc-topbar__lang-menu a:hover {
	background: rgba(255,255,255,.12);
	color: #fff;
}

.afrc-topbar__lang-menu span.is-disabled {
	color: rgba(255,255,255,.34);
	cursor: default;
}

/* The "Next match" dropdown is hidden to match the live (preprod) design,
   where it does not appear in the topbar. header.php still renders it, so
   removing this rule re-enables the button (the styling below is ready). */
.afrc-topbar__match { display: none; }

.afrc-topbar__match-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--afrc-red-accent);
	box-shadow: 0 0 0 4px rgba(244,8,24,.16);
}
.afrc-topbar__match-panel {
	position: absolute;
	right: 0;
	top: calc(100% + 10px);
	width: min(360px, calc(100vw - 32px));
	z-index: 40;
}

/* Next-match card tweaks inside the topbar dropdown.
   The card itself is rendered by the afrc-events shortcode
   [afrc_events kind="game" format="next-match"] which keeps its own
   base styling; these rules only reshape it for the dropdown. */
.afrc-topbar__match-panel .afrc-next-match {
	width: 100%;
	max-width: none;
	border-radius: 16px;
	background: linear-gradient(135deg, #243f9f, #162a73);
	box-shadow: 0 24px 60px rgba(0,0,0,.28);
	border: 1px solid rgba(255,255,255,.18);
	font-family: var(--afrc-font);
}
.afrc-topbar__match-panel .afrc-next-match__inner    { padding: 18px; }
.afrc-topbar__match-panel .afrc-next-match__topbar   { border-radius: 16px 16px 0 0; }
.afrc-topbar__match-panel .afrc-next-match__title    { font-size: clamp(20px,1.8vw,25px); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; margin-bottom: 10px; }
.afrc-topbar__match-panel .afrc-next-match__countdown{ display: none; }
.afrc-topbar__match-panel .afrc-next-match__cta      { padding: 8px 14px; font-size: 12px; font-weight: 600; line-height: 1.1; border-radius: 9px; background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.24); }

.afrc-topbar__mobile-toggle { display: none; }

/* ---------- Final footer ---------- */
.afrc-final-footer {
	position: relative;
	overflow: hidden;
	color: #fff;
	background: var(--afrc-red-footer);
	font-family: var(--afrc-font);
}
.afrc-final-footer::before {
	content: "";
	position: absolute;
	inset: 0;
	background:
		radial-gradient(ellipse at 18% 0%, rgba(255,255,255,.11), transparent 52%),
		linear-gradient(135deg, rgba(0,27,104,.24), transparent 46%);
	pointer-events: none;
}
.afrc-final-footer__rule {
	height: 5px;
	background: linear-gradient(90deg, var(--afrc-navy-flag) 0 33.33%, #fff 33.33% 66.66%, var(--afrc-red-flag) 66.66%);
}
.afrc-final-footer__inner {
	position: relative;
	max-width: 1440px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 22px;
	margin: 0 auto;
	padding: 18px clamp(22px, 5vw, 76px);
}
.afrc-final-footer__mark { display: flex; align-items: center; gap: 13px; }
.afrc-final-footer__mark img { width: 42px; height: 48px; object-fit: contain; }
.afrc-final-footer__mark strong { color: #fff; font-size: 15px; }
.afrc-final-footer__mark p { margin: 2px 0 0; color: rgba(255,255,255,.7); font-size: 13px; }
.afrc-final-footer__social { display: flex; align-items: center; gap: 10px; }
.afrc-final-footer__social a {
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid rgba(255,255,255,.22);
	border-radius: 50%;
	color: #fff;
	background: rgba(255,255,255,.06);
	text-decoration: none;
	transition: background .18s ease, transform .18s ease;
}
.afrc-final-footer__social a:hover { background: rgba(255,255,255,.14); transform: translateY(-2px); }
.afrc-final-footer__social svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.afrc-final-footer__social a[aria-label="Facebook"] svg { fill: currentColor; stroke: none; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
	.afrc-topbar {
		grid-template-columns: 1fr auto auto;
		gap: 8px;
		padding: 5px 12px;
	}
	.afrc-topbar__left  { grid-column: 1; }
	.afrc-topbar__lang  { grid-column: 2; justify-self: end; margin-left: 0; }
	.afrc-topbar__tools { display: none; }

	.afrc-topbar__mobile-toggle {
		grid-column: 3;
		display: block;
		width: 36px;
		height: 34px;
		padding: 0;
		border: 0;
		color: #fff;
		background: transparent;
		cursor: pointer;
		position: relative;
	}
	.afrc-topbar__mobile-toggle span,
	.afrc-topbar__mobile-toggle span::before,
	.afrc-topbar__mobile-toggle span::after {
		position: absolute;
		width: 18px;
		height: 2px;
		border-radius: 2px;
		background: #fff;
		content: "";
	}
	.afrc-topbar__mobile-toggle span        { transform: translate(-9px, -1px); }
	.afrc-topbar__mobile-toggle span::before { transform: translate(-9px, -6px); }
	.afrc-topbar__mobile-toggle span::after  { transform: translate(-9px, 6px); }

	.afrc-topbar__nav {
		position: absolute;
		/* Span the whole bar so the abs-pos containing block is the full topbar
		   width — without this the base `grid-column: 2` placement shrinks the
		   containing block to the (tiny) hamburger column and the dropdown
		   collapses to a sliver on the right. */
		grid-column: 1 / -1;
		top: calc(100% + 6px);
		left: 12px;
		right: 12px;
		width: auto;
		max-width: none;
		margin: 0;
		justify-self: stretch;
		display: grid;
		/* One full-width column so each link stretches to a tappable row
		   (overrides the desktop `justify-content: center` single auto column). */
		grid-template-columns: 1fr;
		justify-content: stretch;
		gap: 4px;
		padding: 8px;
		border: 1px solid rgba(255,255,255,.16);
		border-radius: 10px;
		background: var(--afrc-navy-panel);
		box-shadow: 0 18px 45px rgba(0,0,0,.24);
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		transform: translateY(-5px);
		transition: .2s ease;
	}
	.afrc-topbar.is-menu-open .afrc-topbar__nav {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		transform: translateY(0);
	}
	.afrc-topbar__nav a { justify-content: flex-start; min-height: 38px; padding: 0 12px; }

	.afrc-final-footer__inner { align-items: flex-start; flex-direction: column; padding: 18px 20px; }
}

/* ---------- WordPress admin bar compatibility ----------
   When a logged-in user sees the admin bar, WordPress fixes it over the top of
   the viewport (32px, or 46px on small screens). Offset the topbar so it is not
   covered: the sticky bar would otherwise slide under the admin bar on scroll,
   and the absolute (hero) bar would sit beneath it. */
body.admin-bar .afrc-topbar {
	top: var( --wp-admin--admin-bar--height, 32px );
}

@media screen and ( max-width: 782px ) {
	body.admin-bar .afrc-topbar {
		top: 46px;
	}
}
