// Screen 01 — Front page (splash).
//
// The navy background comes from `set_active_mode( Dark )` — the
// runtime fills the surface from the active palette, so we don't need
// a fake full-bleed container. `app::enter` flips the mode back to
// light when we leave this screen.

use ltk::
{
	Color, Corners, Element,
	column, container, spacer,
};

use crate::app::Msg;
use crate::assets;
use crate::state::State;
use crate::ui::theme as t;

const SPLASH_BG: Color = Color::hex( 0x0A, 0x03, 0x2E );

pub fn view( state: &State ) -> Element<Msg>
{
	let ( w, h ) = state.viewport;
	let logo_px = ( w.min( h ) as f32 * 0.40 ) as u32;

	let logo: Element<Msg> = assets::splash_logo::<Msg>( logo_px )
		.unwrap_or_else( || spacer().into() );

	let body = column::<Msg>()
		.spacing( t::ITEM_SPACING )
		.center_y( true )
		.align_center_x( true )
		.padding( t::PAGE_PADDING_H )
		.push( spacer() )
		.push( logo )
		.push( spacer() );

	container::<Msg>( body )
		.background( SPLASH_BG )
		.radius( Corners::ZERO )
		.into()
}
