/*
 * Valotalive brand styling.
 *
 * Follows Valotalive-Graphic-Guidelines.pdf:
 *
 *   Primary    Valota gradient (Red > Orange), Red #DE2F59, Dark grey #212121
 *   Supporting Orange #F27039, Burgundy #631B2D, Light grey #F2F2F2,
 *              Grey #5E5E5E, Mid grey #ADADAD
 *   Headings   Montserrat ExtraBold      Subheadings  Montserrat Bold
 *   Eyebrows   Montserrat Medium/SemiBold, uppercase, letterspaced
 *   Body       Open Sans Regular
 *   Text       Dark grey #212121         Links        Red #DE2F59
 *
 * The flowing line motif from the cover spreads is in assets/waves.svg.
 */

:root {
	/* --- brand palette, verbatim from the guidelines --- */
	--valota-red: #de2f59;
	--valota-orange: #f27039;
	--valota-burgundy: #631b2d;
	--valota-dark-grey: #212121;
	--valota-grey: #5e5e5e;
	--valota-mid-grey: #adadad;
	--valota-light-grey: #f2f2f2;
	--valota-gradient: linear-gradient(115deg, var(--valota-red) 0%, var(--valota-orange) 100%);

	/* --- roles --- */
	--bg: var(--valota-light-grey);
	--surface: #ffffff;
	--surface-sunken: var(--valota-light-grey);
	--border: #e3e3e3;
	--border-strong: var(--valota-mid-grey);
	--text: var(--valota-dark-grey);
	--text-muted: var(--valota-grey);
	--accent: var(--valota-red);
	--accent-soft: #fdeef2;
	/* Success is carried by the Valota gradient, failure by Burgundy -- both
	   from the guidelines. The palette has no green, so nothing here invents one. */
	--good: var(--valota-red);
	--good-soft: var(--valota-light-grey);
	--bad: var(--valota-burgundy);
	--bad-soft: #f7ebef;

	--font-heading: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	--font-body: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

	--radius: 16px;
	--radius-sm: 10px;
}

@media (prefers-color-scheme: dark) {
	:root {
		/* Dark grey is a primary brand colour, so dark mode is the palette
		   inverted around it rather than an off-brand set of greys. */
		--bg: var(--valota-dark-grey);
		--surface: #2a2a2a;
		--surface-sunken: #1a1a1a;
		--border: #3a3a3a;
		--border-strong: #4e4e4e;
		--text: #f2f2f2;
		--text-muted: var(--valota-mid-grey);
		--accent: #f0567c;
		--accent-soft: #3a1b25;
		--good: var(--valota-orange);
		--good-soft: #1a1a1a;
		--bad: #e993a8;
		--bad-soft: #35202a;
	}
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

.wrap {
	width: 100%;
	max-width: 820px;
	margin: 0 auto;
	padding: 0 20px;
}

/* --- masthead ------------------------------------------------------------ */

/* A hairline of the Valota gradient across the top of the page: the primary
   brand colour is present without competing with the content. */
body::before {
	content: '';
	display: block;
	height: 4px;
	background: var(--valota-gradient);
}

/* The hero follows the guidelines' cover spreads: a light ground carrying the
   flowing white line motif, with the primary logo on it. */
.masthead {
	position: relative;
	overflow: hidden;
	background: linear-gradient(168deg, #f8f8f8 0%, #e9e9e9 100%);
	border-bottom: 1px solid var(--border);
	padding: 34px 0 50px;
	margin-bottom: 28px;
}

.masthead::after {
	content: '';
	position: absolute;
	inset: 0;
	background: url('/assets/waves.svg') center bottom / cover no-repeat;
	opacity: .9;
	pointer-events: none;
}

.masthead .wrap { position: relative; z-index: 1; }

.brand {
	display: block;
	margin-bottom: 30px;
}

.brand picture { display: block; }

/* Safe area: 80% of logo height, per the guidelines. */
.brand img {
	display: block;
	width: 152px;
	height: auto;
	padding: 12px 0;
}

.masthead h1 {
	font-family: var(--font-heading);
	font-weight: 800;
	margin: 0 0 12px;
	font-size: clamp(1.9rem, 5.4vw, 2.7rem);
	line-height: 1.12;
	letter-spacing: -0.015em;
	color: var(--text);
}

.lede {
	margin: 0;
	max-width: 52ch;
	font-size: 1.02rem;
	color: var(--text-muted);
}

/* --- panels -------------------------------------------------------------- */

.panel {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 26px;
	margin-bottom: 18px;
}

/* Eyebrow heading: Montserrat SemiBold, uppercase, letterspaced, in Red. */
.panel h2 {
	font-family: var(--font-heading);
	font-weight: 600;
	margin: 0 0 18px;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	color: var(--accent);
}

.field {
	border: 0;
	padding: 0;
	margin: 0 0 20px;
}

.field:last-child { margin-bottom: 0; }

/* Subheading: Montserrat Bold. */
.field legend {
	font-family: var(--font-heading);
	font-weight: 700;
	padding: 0 0 10px;
	font-size: 1rem;
	color: var(--text);
}

.choices {
	display: grid;
	gap: 10px;
}

@media (min-width: 640px) {
	.choices { grid-template-columns: 1fr 1fr; }
}

.choice {
	display: flex;
	gap: 11px;
	align-items: flex-start;
	padding: 14px 16px;
	border: 1.5px solid var(--border);
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: border-color .14s, background .14s;
}

.choice:hover { border-color: var(--border-strong); }

.choice:has(input:checked) {
	border-color: var(--accent);
	background: var(--accent-soft);
}

.choice input {
	margin: 5px 0 0;
	accent-color: var(--valota-red);
	flex: none;
}

.choice strong {
	display: block;
	font-family: var(--font-body);
	font-weight: 700;
	font-size: 0.94rem;
	line-height: 1.35;
}

.choice small {
	display: block;
	margin-top: 3px;
	color: var(--text-muted);
	font-size: 0.82rem;
	line-height: 1.45;
}

/* --- dropzone ------------------------------------------------------------ */

.dropzone {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 180px;
	padding: 28px;
	text-align: center;
	border: 2px dashed var(--border-strong);
	border-radius: var(--radius);
	background: var(--surface-sunken);
	cursor: pointer;
	transition: border-color .14s, background .14s;
}

.dropzone:hover,
.dropzone:focus-visible {
	border-color: var(--accent);
	outline: none;
}

.dropzone.dragging {
	border-color: var(--accent);
	background: var(--accent-soft);
}

.dropzone-icon {
	width: 36px;
	height: 36px;
	color: var(--accent);
}

.dropzone-title {
	font-family: var(--font-heading);
	font-weight: 700;
	margin: 6px 0 0;
	font-size: 1rem;
}

.dropzone-hint {
	margin: 0;
	color: var(--text-muted);
	font-size: 0.85rem;
}

.global-error {
	margin: 16px 0 0;
	padding: 11px 14px;
	border-radius: var(--radius-sm);
	background: var(--bad-soft);
	color: var(--bad);
	font-size: 0.89rem;
	font-weight: 600;
}

/* --- job list ------------------------------------------------------------ */

.empty {
	margin: 0;
	color: var(--text-muted);
	font-size: 0.92rem;
}

.jobs {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 12px;
}

.job {
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 16px 18px;
	background: var(--surface);
}

/* A finished conversion is marked with the Valota gradient down its edge --
   the brand's primary colour doing the work a green tick would otherwise do. */
.job[data-state="ready"] {
	position: relative;
	overflow: hidden;
	border-color: var(--border-strong);
}

.job[data-state="ready"]::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
	background: var(--valota-gradient);
}

.job-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
}

.job-ident { min-width: 0; }

.job-name {
	display: block;
	font-family: var(--font-heading);
	font-weight: 700;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.job-meta {
	display: block;
	margin-top: 2px;
	color: var(--text-muted);
	font-size: 0.81rem;
}

.job-action {
	flex: none;
	border: 1.5px solid var(--border);
	background: transparent;
	color: var(--text-muted);
	font-family: var(--font-body);
	font-weight: 600;
	border-radius: 7px;
	padding: 5px 12px;
	font-size: 0.8rem;
	cursor: pointer;
	transition: border-color .14s, color .14s;
}

.job-action:hover {
	border-color: var(--accent);
	color: var(--accent);
}

/* --- progress ------------------------------------------------------------ */

.job-progress { margin-top: 14px; }

.bar {
	height: 9px;
	border-radius: 999px;
	background: var(--surface-sunken);
	border: 1px solid var(--border);
	overflow: hidden;
}

/* Progress uses the Valota gradient — the brand's primary colour. */
.bar-fill {
	height: 100%;
	width: 0;
	background: var(--valota-gradient);
	border-radius: 999px;
	transition: width .25s ease-out;
}

.job[data-state="ready"] .bar-fill { background: var(--valota-gradient); }
.job[data-state="failed"] .bar-fill,
.job[data-state="cancelled"] .bar-fill,
.job[data-state="expired"] .bar-fill { background: var(--border-strong); }

/* Phases with no measurable percentage get a moving stripe instead of a lie. */
.job[data-state="analysing"] .bar-fill,
.job[data-state="queued"] .bar-fill {
	width: 100%;
	background: repeating-linear-gradient(
		115deg,
		var(--valota-red) 0 10px,
		var(--valota-orange) 10px 20px
	);
	background-size: 200% 100%;
	animation: slide 1s linear infinite;
	opacity: .45;
}

@keyframes slide {
	from { background-position: 0 0; }
	to   { background-position: -40px 0; }
}

@media (prefers-reduced-motion: reduce) {
	.bar-fill { transition: none; animation: none; }
}

.bar-labels {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin-top: 7px;
	font-size: 0.82rem;
}

.job-phase {
	font-family: var(--font-heading);
	font-weight: 600;
}

.job-detail {
	color: var(--text-muted);
	font-variant-numeric: tabular-nums;
	text-align: right;
}

/* --- result -------------------------------------------------------------- */

.job-result { margin-top: 16px; }

.stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
	gap: 12px;
	margin: 0 0 16px;
	padding: 14px;
	background: var(--surface-sunken);
	border-radius: var(--radius-sm);
}

.stats div { min-width: 0; }

.stats dt {
	font-family: var(--font-heading);
	font-weight: 600;
	font-size: 0.68rem;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--text-muted);
}

.stats dd {
	font-family: var(--font-heading);
	margin: 3px 0 0;
	font-weight: 700;
	font-size: 1.02rem;
	font-variant-numeric: tabular-nums;
}

.stats dd.saving {
	background: var(--valota-gradient);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.job-result-actions {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
}

.button {
	display: inline-block;
	background: var(--valota-gradient);
	color: #fff;
	text-decoration: none;
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: 0.94rem;
	padding: 11px 24px;
	border-radius: 999px;
	border: 0;
	cursor: pointer;
	transition: filter .14s, transform .14s;
}

.button:hover {
	filter: brightness(1.07);
	transform: translateY(-1px);
}

.job-expiry {
	color: var(--text-muted);
	font-size: 0.82rem;
	font-variant-numeric: tabular-nums;
}

.job-expiry.urgent {
	color: var(--accent);
	font-weight: 700;
}

.job-error {
	margin: 14px 0 0;
	padding: 11px 14px;
	border-radius: var(--radius-sm);
	background: var(--bad-soft);
	color: var(--bad);
	font-size: 0.87rem;
	font-weight: 600;
}

.job-note {
	margin: 12px 0 0;
	padding: 10px 14px;
	border-left: 3px solid var(--valota-orange);
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	background: var(--surface-sunken);
	color: var(--text);
	font-size: 0.85rem;
	font-weight: 600;
}

/* --- footer -------------------------------------------------------------- */

.footnote {
	padding: 14px 20px 60px;
	color: var(--text-muted);
	font-size: 0.86rem;
	max-width: 820px;
}

.footnote p { margin: 0 0 10px; }

.footnote strong {
	font-family: var(--font-heading);
	font-weight: 700;
	color: var(--text);
}

.footnote a { color: var(--accent); }

.fineprint {
	font-size: 0.77rem;
	color: var(--valota-mid-grey);
}

/* --- dark mode ----------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
	.masthead {
		background: linear-gradient(170deg, #2a2a2a 0%, var(--valota-dark-grey) 100%);
	}

	/* The motif is drawn in white; at full strength it would glare. */
	.masthead::after { opacity: .07; }
}

/* --- BETA BADGE ---------------------------------------------------------- *
 * Temporary. To remove the badge, delete the <span class="beta"> in
 * index.html; these rules then match nothing and this whole block can go too.
 *
 * Sized in `em` so it tracks the heading's clamp() rather than fighting it.
 * Outlined rather than filled, so it reads as a status marker and does not
 * compete with the gradient Download button for attention.
 * ------------------------------------------------------------------------- */

.beta {
	display: inline-block;
	vertical-align: middle;
	position: relative;
	top: -0.12em;
	margin-left: 0.45em;
	padding: 0.28em 0.75em;
	border: 1.5px solid var(--accent);
	border-radius: 999px;
	font-family: var(--font-heading);
	font-size: 0.3em;
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--accent);
	white-space: nowrap;
	cursor: help;
}
