/**
 * Fugamma — launch announcement popup (splash landing page only).
 *
 * The card is the splash's own glass: near-black, frosted, Fraunces italic over
 * Roboto. What it holds is the product's: its logo, and its blue drawn around
 * the card as a selection frame, one edge after the next, a handle landing at
 * each corner as the line reaches it. Then the logo wipes in, the words rise,
 * and the button is made the way the product makes things: its markup is typed,
 * a pen traces the button in the code's place, and it fills in as the real thing.
 *
 * Everything is hidden until fg-announce.js adds .is-active, and the whole
 * entrance is skipped under prefers-reduced-motion. Imports nothing.
 */

.fg-announce {
	--fa-blue: #007aff;
	--fa-ink: #05070c;
	--fa-on-blue: #020a16;
	--fa-ease: cubic-bezier(0.16, 1, 0.3, 1);
	--fa-wipe: cubic-bezier(0.65, 0, 0.35, 1);
	--fa-frame-gap: 10px;   /* how far the drawn frame stands off the card */
	--fa-draw: 0.22s;       /* delay before the frame starts drawing */

	position: fixed;
	inset: 0;
	z-index: 60; /* above the splash and its own modals (z 50) */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(48px, 8vh, 72px) clamp(22px, 5vw, 40px);
}
.fg-announce[hidden] { display: none; }

/* ---- Backdrop ------------------------------------------------------------ */
.fg-announce__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(4, 6, 12, 0.62);
	-webkit-backdrop-filter: blur(14px) saturate(1.1);
	backdrop-filter: blur(14px) saturate(1.1);
	opacity: 0;
	transition: opacity 0.45s ease;
}

/* ---- Card ---------------------------------------------------------------- */
.fg-announce__dialog {
	position: relative;
	width: 100%;
	max-width: 540px;
	border-radius: 22px;
	border: 1px solid rgba(255, 255, 255, 0.14);
	background:
		radial-gradient(120% 90% at 0% 0%, rgba(0, 122, 255, 0.16) 0%, rgba(0, 122, 255, 0) 58%),
		rgba(12, 14, 22, 0.88);
	-webkit-backdrop-filter: blur(30px) saturate(1.3);
	backdrop-filter: blur(30px) saturate(1.3);
	box-shadow:
		0 30px 80px rgba(0, 0, 0, 0.55),
		inset 0 1px 0 rgba(255, 255, 255, 0.16);
	opacity: 0;
	transform: translateY(18px) scale(0.975);
	transition:
		opacity 0.5s ease,
		transform 0.7s var(--fa-ease);
}
.fg-announce__dialog:focus { outline: none; }

.fg-announce__body {
	max-height: calc(100vh - 2 * clamp(48px, 8vh, 72px));
	max-height: calc(100dvh - 2 * clamp(48px, 8vh, 72px));
	overflow-y: auto;
	padding: clamp(2rem, 1.3rem + 3vw, 3rem);
	border-radius: inherit;
}

/* ---- The drawn frame ----------------------------------------------------- */
.fg-announce__frame {
	position: absolute;
	inset: calc(-1 * var(--fa-frame-gap));
	pointer-events: none;
}

.fg-announce__edge {
	position: absolute;
	background: var(--fa-blue);
}
.fg-announce__edge--t { top: 0; left: 0; right: 0; height: 1px; transform: scaleX(0); transform-origin: left center; }
.fg-announce__edge--r { top: 0; right: 0; bottom: 0; width: 1px; transform: scaleY(0); transform-origin: center top; }
.fg-announce__edge--b { bottom: 0; left: 0; right: 0; height: 1px; transform: scaleX(0); transform-origin: right center; }
.fg-announce__edge--l { top: 0; left: 0; bottom: 0; width: 1px; transform: scaleY(0); transform-origin: center bottom; }

.fg-announce__handle {
	position: absolute;
	width: 8px;
	height: 8px;
	background: #ffffff;
	border: 1px solid var(--fa-blue);
	opacity: 0;
	transform: scale(0.3);
}
.fg-announce__handle--tl { top: -4px; left: -4px; }
.fg-announce__handle--tr { top: -4px; right: -4px; }
.fg-announce__handle--br { bottom: -4px; right: -4px; }
.fg-announce__handle--bl { bottom: -4px; left: -4px; }

/* The label rides the frame's top-left corner, the way a frame is named. */
.fg-announce__label {
	position: absolute;
	left: calc(-1 * var(--fa-frame-gap));
	bottom: calc(100% + var(--fa-frame-gap) + 6px);
	margin: 0;
	padding: 0.36rem 0.65rem 0.34rem;
	font-family: 'Roboto', sans-serif;
	font-size: 0.8125rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--fa-on-blue);
	background: var(--fa-blue);
	border-radius: 3px;
	opacity: 0;
	transform: translateY(4px);
}

/* ---- Close --------------------------------------------------------------- */
.fg-announce__close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 1;
	width: 40px;
	height: 40px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: rgba(255, 255, 255, 0.82);
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.25s ease, color 0.25s ease, transform 0.25s var(--fa-ease);
}
.fg-announce__close svg { width: 18px; height: 18px; }
.fg-announce__close:hover { background: rgba(255, 255, 255, 0.14); color: #ffffff; transform: rotate(90deg); }
.fg-announce__close:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }

/* ---- Content ------------------------------------------------------------- */
.fg-announce__logo {
	display: block;
	width: min(100%, 400px);
	height: auto;
	margin: 0 0 clamp(1.5rem, 1rem + 2vw, 2.2rem);
	-webkit-clip-path: inset(0 100% 0 0);
	clip-path: inset(0 100% 0 0);
}

.fg-announce__title {
	margin: 0 0 0.85rem;
	font-family: 'Fraunces', Georgia, serif;
	font-style: italic;
	font-weight: 300;
	font-size: clamp(1.8rem, 1.25rem + 2.4vw, 2.55rem);
	line-height: 1.08;
	letter-spacing: -0.01em;
	color: #ffffff;
	text-wrap: balance;
}

.fg-announce__text {
	margin: 0 0 1.75rem;
	max-width: 44ch;
	font-family: 'Roboto', sans-serif;
	font-size: 1rem;
	line-height: 1.6;
	color: rgba(255, 255, 255, 0.82);
}
/* The emphasised phrase: the splash's own italic, bold. */
.fg-announce__em {
	font-family: 'Fraunces', Georgia, serif;
	font-style: italic;
	font-weight: 600;
	font-size: 1.1em;
	line-height: 1;
	color: #ffffff;
}

/* ---- The button, and how it is made ---------------------------------------
   The wrapper holds the button's place. Over it, first, the button's own
   markup is typed; then the code goes and the button is traced in its place by
   a 1px pen line; then it fills in and its label arrives. */
.fg-announce__cta {
	position: relative;
	display: inline-block;
	vertical-align: top;
}

.fg-announce__code {
	position: absolute;
	left: 0;
	top: 50%;
	margin: -10px 0 0;
	font: 500 13px/20px ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
	white-space: pre;
	color: rgba(255, 255, 255, 0.72);
	pointer-events: none;
	opacity: 0;
}
.fg-announce__code-k { color: #4da3ff; }  /* tags */
.fg-announce__code-v { color: #ffffff; }  /* quoted values */

.fg-announce__btn {
	position: relative;
	display: inline-flex;
	box-sizing: border-box;
	white-space: nowrap;
	font-family: 'Roboto', sans-serif;
	/* White on the product blue is 4.02:1, so the label is set at large-text
	   size (19px bold), where WCAG AA asks for 3:1. Do not make it smaller. */
	font-size: 1.1875rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	line-height: 1;
	color: #ffffff;
	text-decoration: none;
	border-radius: 12px;
}
/* The fill is its own layer, so it can arrive on its beat and still answer
   the pointer at once afterwards. */
.fg-announce__btn::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: var(--fa-blue);
	opacity: 0;
}
/* The pen: the button's outline and a stroke standing in for its label.
   fg-announce.js sizes both and sets each one's length as --fa-pen-len. */
.fg-announce__pen {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: visible;
	pointer-events: none;
}
.fg-announce__pen-line {
	fill: none;
	stroke: var(--fa-blue);
	stroke-width: 1;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-dasharray: var(--fa-pen-len, 640);
	stroke-dashoffset: var(--fa-pen-len, 640);
}
.fg-announce__btn-label {
	position: relative;
	display: inline-flex;
	flex: 1 1 auto;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	padding: 0.85rem 1.4rem;
	opacity: 0;
}
.fg-announce__btn-label svg { width: 16px; height: 16px; transition: transform 0.25s var(--fa-ease); }
/* Hover: the blue lifts a shade and the arrow steps forward. Nothing else. */
.fg-announce__btn:hover::before { background: #0a84ff; }
.fg-announce__btn:hover .fg-announce__btn-label svg { transform: translateX(4px); }
.fg-announce__btn:focus-visible { outline: 2px solid #ffffff; outline-offset: 3px; }

.fg-announce__title,
.fg-announce__text {
	opacity: 0;
	transform: translateY(12px);
}

/* Read by assistive technology, not drawn. */
.fg-announce__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---- Open: the entrance, in order ---------------------------------------- */
.fg-announce.is-active .fg-announce__backdrop { opacity: 1; }
.fg-announce.is-active .fg-announce__dialog { opacity: 1; transform: none; }

/* 1. The frame draws clockwise from the top-left, one continuous line. */
.fg-announce.is-active .fg-announce__edge { transform: none; transition: transform 0.3s linear; }
.fg-announce.is-active .fg-announce__edge--t { transition-delay: var(--fa-draw); }
.fg-announce.is-active .fg-announce__edge--r { transition-duration: 0.22s; transition-delay: calc(var(--fa-draw) + 0.3s); }
.fg-announce.is-active .fg-announce__edge--b { transition-delay: calc(var(--fa-draw) + 0.52s); }
.fg-announce.is-active .fg-announce__edge--l { transition-duration: 0.22s; transition-delay: calc(var(--fa-draw) + 0.82s); }

/* 2. A handle lands at each corner as the line reaches it. */
.fg-announce.is-active .fg-announce__handle {
	opacity: 1;
	transform: none;
	transition: opacity 0.2s ease, transform 0.34s var(--fa-ease);
}
.fg-announce.is-active .fg-announce__handle--tl { transition-delay: var(--fa-draw); }
.fg-announce.is-active .fg-announce__handle--tr { transition-delay: calc(var(--fa-draw) + 0.3s); }
.fg-announce.is-active .fg-announce__handle--br { transition-delay: calc(var(--fa-draw) + 0.52s); }
.fg-announce.is-active .fg-announce__handle--bl { transition-delay: calc(var(--fa-draw) + 0.82s); }

.fg-announce.is-active .fg-announce__label {
	opacity: 1;
	transform: none;
	transition: opacity 0.4s ease var(--fa-draw), transform 0.5s var(--fa-ease) var(--fa-draw);
}

/* 3. The logo wipes in left to right. */
.fg-announce.is-active .fg-announce__logo {
	-webkit-clip-path: inset(0 0 0 0);
	clip-path: inset(0 0 0 0);
	transition: clip-path 0.8s var(--fa-wipe) 0.32s, -webkit-clip-path 0.8s var(--fa-wipe) 0.32s;
}

/* 4. The words rise, one after the other. */
.fg-announce.is-active .fg-announce__title,
.fg-announce.is-active .fg-announce__text {
	opacity: 1;
	transform: none;
	transition: opacity 0.6s ease, transform 0.8s var(--fa-ease);
}
.fg-announce.is-active .fg-announce__title { transition-delay: 0.62s; }
.fg-announce.is-active .fg-announce__text { transition-delay: 0.72s; }

/* 5. The button is made, code to UI (the product site's own move, its timings):
      its markup is typed in half a second, read for a beat, and goes ... */
.fg-announce.is-active .fg-announce__code {
	animation:
		fgAnnounceType 0.5s steps(var(--fa-code-n, 30), end) 0.7s both,
		fgAnnounceCodeOut 0.1s linear 1.55s forwards;
}
/* ... the pen traces the button where the code stood (outline, then label stroke) ... */
.fg-announce.is-active .fg-announce__pen-line {
	stroke-dashoffset: 0;
	transition: stroke-dashoffset 0.6s cubic-bezier(0.65, 0, 0.35, 1) 1.65s;
}
.fg-announce.is-active .fg-announce__pen-line--label { transition-delay: 1.77s; }
/* ... then it fills, the pen lines go, and the real label comes up ... */
.fg-announce.is-active .fg-announce__btn::before {
	opacity: 1;
	transition: opacity 0.3s ease-out 2.37s, background-color 0.25s ease;
}
.fg-announce.is-active .fg-announce__pen {
	opacity: 0;
	transition: opacity 0.2s ease 2.47s;
}
.fg-announce.is-active .fg-announce__btn-label {
	opacity: 1;
	transition: opacity 0.35s cubic-bezier(0.33, 1, 0.68, 1) 2.47s;
}
/* ... and, a beat later, it is pressed once. */
.fg-announce.is-active .fg-announce__btn { animation: fgAnnouncePress 0.16s ease-in-out 3.25s 1; }

@keyframes fgAnnounceType {
	from { opacity: 1; -webkit-clip-path: inset(0 100% 0 0); clip-path: inset(0 100% 0 0); }
	to   { opacity: 1; -webkit-clip-path: inset(0 0 0 0); clip-path: inset(0 0 0 0); }
}
@keyframes fgAnnounceCodeOut {
	to { opacity: 0; visibility: hidden; }
}
@keyframes fgAnnouncePress {
	50% { transform: scale(0.955); }
}

/* ---- Close: one quick fade of the finished card, nothing replays --------- */
.fg-announce.is-active.is-closing .fg-announce__backdrop { opacity: 0; transition: opacity 0.32s ease; }
.fg-announce.is-active.is-closing .fg-announce__dialog {
	opacity: 0;
	transform: translateY(8px) scale(0.985);
	transition: opacity 0.26s ease, transform 0.32s ease;
}

/* ---- Phones -------------------------------------------------------------- */
@media (max-width: 520px) {
	.fg-announce { --fa-frame-gap: 8px; }
	/* The close button and the logo share the top edge: give the logo its own row. */
	.fg-announce__body { padding: 3.9rem 1.5rem 1.75rem; }
	.fg-announce__close { top: 10px; right: 10px; }
	.fg-announce__cta { display: block; }
	.fg-announce__btn { display: flex; }
	.fg-announce__code { font-size: 12px; }
}

/* ---- Small phones: tighten so the whole card, button included, is in view */
@media (max-width: 520px) and (max-height: 700px) {
	.fg-announce { padding-top: 42px; padding-bottom: 18px; }
	.fg-announce__body {
		max-height: calc(100vh - 60px);
		max-height: calc(100dvh - 60px);
		padding: 3.5rem 1.25rem 1.25rem;
	}
	.fg-announce__logo { margin-bottom: 1.1rem; }
	.fg-announce__title { font-size: 1.6rem; margin-bottom: 0.6rem; }
	.fg-announce__text { margin-bottom: 1.15rem; font-size: 0.9rem; line-height: 1.45; }
	.fg-announce__btn-label { padding: 0.7rem 1.2rem; }
}

/* ---- Short screens (a phone on its side): tighten so the button stays in view */
@media (max-height: 520px) and (min-width: 521px) {
	.fg-announce { padding-top: 44px; padding-bottom: 26px; }
	.fg-announce__dialog { max-width: 620px; }
	.fg-announce__body {
		max-height: calc(100vh - 70px);
		max-height: calc(100dvh - 70px);
		padding: 1.5rem 1.75rem;
	}
	.fg-announce__logo { width: min(100%, 280px); margin-bottom: 1rem; }
	.fg-announce__title { font-size: 1.6rem; margin-bottom: 0.5rem; }
	.fg-announce__text { max-width: none; margin-bottom: 1.1rem; font-size: 0.95rem; line-height: 1.5; }
	.fg-announce__btn-label { padding: 0.7rem 1.2rem; }
}

/* ---- Reduced motion: no entrance, everything simply present -------------- */
@media (prefers-reduced-motion: reduce) {
	.fg-announce .fg-announce__backdrop,
	.fg-announce .fg-announce__dialog,
	.fg-announce .fg-announce__dialog *,
	.fg-announce .fg-announce__dialog *::before {
		transition: none !important;
		animation: none !important;
	}
	.fg-announce__close:hover { transform: none; }
}
