/* frappe.page/ when it serves the landing site's copy (control/landing_page.py). The page's look is Builder's: its block
   styles and tokens, inlined by the compiler. This file holds only what blocks cannot say: the states landing.js,
   prompt_box.js and control.js set (data-state, .is-ready, aria-busy, aria-invalid, .is-over, aria-current,
   --lp-fill), the theme swap on :root[data-theme], focus, reduced motion and touch; the pseudo-elements blocks cannot
   style (placeholder, selection, scrollbars); the root's background; and the widths Builder's two breakpoints (576
   and 1023 px) miss: phones under 390 px for the nav, and 577 to 600 px, where the legacy page had the phone cut. It
   loads after the page's CSS, so a state wins over a block's own style; display toggles say !important for the same
   reason.

   Hooks: behaviour keys on data-* (data-clip, data-clip-toggle, data-film, data-theme-only, data-chapters, data-at,
   data-action=theme, data-prompt, data-prompt-start); style hooks the editor keeps are classes (sr-only, skip-link,
   lp-theme-sun/-moon, lp-clip-play/-pause/-word, prompt, prompt-input, prompt-count, error-text, lp-nav-inner,
   lp-nav-signin). */

:root {
	--fp-strong: #0f0f0f;
	--fp-line: #ececec;
	--fp-focus: #0f0f0f;
	--fp-red-line: #f79596;
	--fp-red-text: #b41d1d;
	--fp-field-focus: #383838;
	--fp-placeholder: #999;
	--fp-scroll-track: #f8f8f8;
	--fp-scroll-thumb: #ededed;
}
/* without JS data-theme is never set: the page stays light, as the copy's tokens do (control.landing_css), and as the
   legacy page did. Builder's head says color-scheme: light dark. */
:root:not([data-theme]) {
	color-scheme: light;
}
:root[data-theme="dark"] {
	--fp-strong: #f8f8f8;
	--fp-line: #262626;
	--fp-focus: #f8f8f8;
	--fp-red-line: #b03030;
	--fp-red-text: #ff7575;
	--fp-field-focus: #afafaf;
	--fp-placeholder: #7a7a7a;
	--fp-scroll-track: #1f1f1f;
	--fp-scroll-thumb: #383838;
}

/* the page's ground is its body block's, past the body too (overscroll): on Builder's own pages an inline style on
   <html> paints it, which the copy does not keep, and Builder's head says :root { background: white }. With none on
   the root, the body's background is the canvas's. */
:root:root {
	background: none;
}
/* Builder dims every image in dark mode; the landing dims only its light recordings (below) */
img {
	filter: none;
}
[hidden] {
	display: none !important;
}
/* the sticky nav must not cover what keyboard focus or an in-page link scrolls to */
html {
	scroll-padding-top: 68px;
}
/* pseudo-elements blocks cannot style: control.css's selection and scrollbars, over Builder's own */
::selection {
	background-color: rgba(153, 153, 153, 0.3);
	color: inherit;
}
*::-webkit-scrollbar {
	width: 8px;
	height: 8px;
	background-color: var(--fp-scroll-track);
}
*::-webkit-scrollbar-corner {
	background-color: var(--fp-scroll-track);
}
*::-webkit-scrollbar-thumb {
	border-radius: 9999px;
	background-color: var(--fp-scroll-thumb);
}
/* phones under 390 px: brand, theme and two buttons don't fit on one line, and "Frappe Builder" would wrap, so Sign
   in goes (Get started leads to sign-in too); at 320 px the nav is tighter too. Hooks: the nav's .lp-nav-inner and
   its .lp-nav-signin */
@media (max-width: 389px) {
	.lp-nav-signin {
		display: none !important;
	}
}
@media (max-width: 359px) {
	.lp-nav-inner {
		gap: 8px !important;
		padding: 0 14px !important;
	}
}
/* 577 to 600 px, over Builder's mobile breakpoint: the recordings' phone cut (landing_media.PHONE) needs its 4:5 box,
   and the film's chapters their phone size, as on the legacy page */
@media (min-width: 577px) and (max-width: 600px) {
	[data-clip] {
		aspect-ratio: 4 / 5 !important;
		border-radius: 8px !important;
	}
	[data-chapters] [data-at] {
		font-size: 12px !important;
	}
}

/* ---------- reading and focus ---------- */

.sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border-width: 0 !important;
}
.skip-link {
	position: absolute !important;
	left: 8px;
	top: -48px !important;
	z-index: 200;
}
.skip-link:focus {
	top: 8px !important;
}
:focus-visible {
	outline: 2px solid var(--fp-focus);
	outline-offset: 2px;
}
main:focus,
main:focus-visible,
.prompt-input:focus-visible {
	outline: none;
}

/* ---------- the theme toggle: it needs JS, and shows the theme it switches to ---------- */

:root:not(.js) [data-action="theme"] {
	display: none !important;
}
.lp-theme-sun,
:root[data-theme="dark"] .lp-theme-moon {
	display: none !important;
}
:root[data-theme="dark"] .lp-theme-sun {
	display: block !important;
}
:root[data-theme="dark"] span.lp-theme-sun {
	display: inline !important;
}

/* ---------- a recording: the poster until the clip has a frame, then the clip over it ---------- */

[data-clip] video {
	opacity: 0;
	transition: opacity 0.3s ease;
}
[data-clip].is-ready video {
	opacity: 1;
}
/* the recordings are of the light editor: a little dimmer on a dark page; the film has a dark cut of its own */
:root[data-theme="dark"] [data-clip] :is(img, video) {
	filter: brightness(0.86);
}
:root[data-theme="dark"] [data-film] [data-clip] :is(img, video) {
	filter: none;
}

/* pause and play: quiet in a corner while it plays, plain on the poster when it waits for a click */
[data-clip-toggle] {
	opacity: 0;
	transition: opacity 0.15s ease;
}
[data-clip]:hover [data-clip-toggle],
[data-clip-toggle]:focus-visible,
[data-clip][data-state="paused"] [data-clip-toggle],
[data-clip][data-state="idle"] [data-clip-toggle] {
	opacity: 1;
}
@media (hover: none) {
	[data-clip-toggle] {
		opacity: 1;
	}
}
[data-clip-toggle]:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
	box-shadow: 0 0 0 4px rgb(23 23 23 / 0.6);
}
.lp-clip-pause,
[data-clip][data-state="playing"] .lp-clip-play,
.lp-clip-word {
	display: none !important;
}
[data-clip][data-state="playing"] .lp-clip-pause {
	display: block !important;
}
[data-clip][data-state="idle"] .lp-clip-word {
	display: inline !important;
}
[data-clip][data-state="idle"] [data-clip-toggle] {
	height: 40px;
	padding: 0 16px 0 12px;
	border-radius: 8px;
	font-size: 15px;
	box-shadow: 0 4px 16px rgb(0 0 0 / 0.18);
}

/* a cut for each theme: only the page's poster shows, so only it loads (both are lazy) */
picture[data-theme-only="dark"],
:root[data-theme="dark"] picture[data-theme-only="light"] {
	display: none !important;
}
:root[data-theme="dark"] picture[data-theme-only="dark"] {
	display: inline !important;
}

/* ---------- the film's chapters: they need JS to seek; those played are filled, the current one fills ---------- */

:root:not(.js) [data-chapters] {
	display: none !important;
}
[data-chapters] [data-at] {
	position: relative;
}
[data-chapters] [data-at]::before,
[data-chapters] [data-at]::after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 2px;
	border-radius: 1px;
	background: var(--fp-line);
}
[data-chapters] [data-at]::after {
	background: var(--fp-strong);
	transform: scaleX(var(--lp-fill, 0));
	transform-origin: left;
	transition: transform 0.25s linear;
}
[data-chapters] [data-at].is-rewinding::after {
	transition: none;
}
[data-chapters] [data-at][aria-current="true"] {
	color: var(--fp-strong);
}

/* ---------- "Describe your website" (prompt_box.js): focus, the count near the limit, an error, sending ---------- */

[data-prompt] {
	cursor: text;
}
.prompt-input {
	resize: none;
	overflow-y: auto;
}
.prompt-input::placeholder {
	color: var(--fp-placeholder);
	opacity: 1;
}
/* over the limit: a red border, unless the box has focus (its focus border wins, as on the legacy page) */
[data-prompt]:has([aria-invalid]) {
	border-color: var(--fp-red-line) !important;
}
[data-prompt]:focus-within {
	border-color: var(--fp-field-focus) !important;
	box-shadow: 0 0 0 1px var(--fp-field-focus) !important;
}
.prompt-count.is-over {
	color: var(--fp-red-text) !important;
}
.error-text {
	white-space: pre-line;
	color: var(--fp-red-text);
}
.error-text:empty,
.prompt-count:empty {
	display: none !important;
}
button[aria-busy="true"] {
	pointer-events: none;
}
/* control.js's busy(): a spinner in front of the button's label while it sends */
.spinner {
	display: inline-block;
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	margin-right: 6px;
	vertical-align: -3px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: fp-spin 0.7s linear infinite;
}
@keyframes fp-spin {
	to {
		transform: rotate(360deg);
	}
}
/* touch phones: 16px text in fields, or iOS Safari zooms the page in on focus */
@media (max-width: 639px) and (pointer: coarse) {
	.prompt-input {
		font-size: 16px !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition: none !important;
	}
	.spinner {
		animation-duration: 1.6s;
	}
}
