/*
 * F-Tech W limicie: strony kont i ekran aplikacji.
 * Komponenty (ft-field, ft-input, ft-btn, ft-link) pochodzą z warstwy ft-core. Tu tylko układ i elementy unikalne.
 * Tokeny z kontraktu designu v1.1 z wartościami zapasowymi.
 */

.wlm-auth,
.wlm-app {
	--wlm-accent: var(--ft-accent, #80601F);
	--wlm-ink: var(--ft-ink, #111111);
	--wlm-muted: var(--ft-muted, #666666);
	--wlm-surface: var(--ft-surface, #FFFFFF);
	--wlm-surface-alt: var(--ft-surface-alt, #F7F7F7);
	--wlm-border: var(--ft-border, #E5E5E5);
	--wlm-border-strong: var(--ft-border-strong, #8C8C8C);
	--wlm-success: var(--ft-success, #46651F);
	--wlm-warning: var(--ft-warning, #8C5A0B);
	--wlm-danger: var(--ft-danger, #A23A21);
	--wlm-fs-xs: var(--ft-fs-xs, 0.8125rem);
	--wlm-fs-sm: var(--ft-fs-sm, 0.875rem);
	--wlm-fs-body: var(--ft-fs-body, 1rem);
	--wlm-fs-lead: var(--ft-fs-lead, clamp(1.0625rem, 1rem + 0.35vw, 1.25rem));
	--wlm-fs-h2: var(--ft-fs-h2, clamp(1.75rem, 1.4rem + 1.75vw, 2.625rem));
	--wlm-fs-h3: var(--ft-fs-h3, clamp(1.125rem, 1.05rem + 0.4vw, 1.375rem));
	--wlm-fw-medium: var(--ft-fw-medium, 500);
	--wlm-fw-semibold: var(--ft-fw-semibold, 600);
	--wlm-fw-bold: var(--ft-fw-bold, 700);
	--wlm-lh-tight: var(--ft-lh-tight, 1.08);
	--wlm-lh-snug: var(--ft-lh-snug, 1.3);
	--wlm-lh-body: var(--ft-lh-body, 1.65);
	--wlm-track: var(--ft-track-tight, -0.03em);
	--wlm-s1: var(--ft-space-1, 0.25rem);
	--wlm-s2: var(--ft-space-2, 0.5rem);
	--wlm-s3: var(--ft-space-3, 0.75rem);
	--wlm-s4: var(--ft-space-4, 1rem);
	--wlm-s5: var(--ft-space-5, 1.5rem);
	--wlm-s6: var(--ft-space-6, 2rem);
	--wlm-s7: var(--ft-space-7, 3rem);
	--wlm-s8: var(--ft-space-8, 4rem);
	--wlm-radius-sm: var(--ft-radius-sm, 4px);
	--wlm-radius-md: var(--ft-radius-md, 8px);
	--wlm-radius-lg: var(--ft-radius-lg, 16px);
	--wlm-shadow-float: var(--ft-shadow-float, 0 1px 2px rgba(17, 17, 17, 0.04), 0 32px 64px -24px rgba(17, 17, 17, 0.18));
	--wlm-ring: var(--ft-ring, 0 0 0 3px color-mix(in oklab, #80601F 35%, transparent));
	--wlm-slant: var(--ft-slant, -30deg);
	--wlm-dur: var(--ft-dur, 280ms);
	--wlm-dur-fast: var(--ft-dur-fast, 160ms);
	--wlm-ease: var(--ft-ease, cubic-bezier(0.4, 0, 0.2, 1));
	--wlm-ease-out: var(--ft-ease-out, cubic-bezier(0.16, 1, 0.3, 1));
	--wlm-container: var(--ft-container, 1360px);
	--wlm-gutter: var(--ft-gutter, clamp(1rem, 4vw, 2rem));
	--wlm-card-w: 30rem;
}

:where(.wlm-auth, .wlm-app) *,
:where(.wlm-auth, .wlm-app) *::before,
:where(.wlm-auth, .wlm-app) *::after { box-sizing: border-box; }

/* ==========================================================================
   1. STRONY KONT: pas tła i karta
   ========================================================================== */
.wlm-auth {
	display: flex;
	justify-content: center;
	padding: var(--wlm-s7) var(--wlm-gutter) var(--wlm-s8);
	background: var(--wlm-surface-alt);
	color: var(--wlm-ink);
}

/* Kolumna z kartą ma stałą szerokość niezależnie od układu treści motywu (Astra „pełna szerokość”). */
.wlm-auth__layout {
	display: grid;
	grid-template-columns: minmax(0, var(--wlm-card-w, 30rem));
	justify-content: center;
	width: 100%;
}

.wlm-auth__aside { display: none; }

.wlm-auth__card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: var(--wlm-s5);
	width: 100%;
	max-width: var(--wlm-card-w);
	padding: var(--wlm-s6) var(--wlm-s5);
	overflow: hidden;
	background: var(--wlm-surface);
	border: 1px solid var(--wlm-border);
	border-radius: var(--wlm-radius-lg);
	box-shadow: var(--wlm-shadow-float);
	animation: wlm-rise var(--wlm-dur) var(--wlm-ease-out) both;
}

/* Sygnatura: złoty ukośnik jak w logo, w prawym górnym rogu karty */
.wlm-auth__card::before {
	content: "";
	position: absolute;
	top: 0;
	right: var(--wlm-s6);
	width: var(--wlm-s4);
	height: var(--wlm-s6);
	background: var(--wlm-accent);
	transform: skewX(var(--wlm-slant));
	transform-origin: left top;
}

.entry-content .wlm-auth .wlm-auth__title,
.wlm-auth .wlm-auth__title {
	margin: 0;
	padding-right: var(--wlm-s7);
	color: var(--wlm-ink);
	font-size: var(--wlm-fs-h2);
	font-weight: var(--wlm-fw-bold);
	line-height: var(--wlm-lh-tight);
	letter-spacing: var(--wlm-track);
}

.entry-content .wlm-auth .wlm-auth__lead,
.wlm-auth .wlm-auth__lead {
	margin: calc(var(--wlm-s3) * -1) 0 0;
	color: var(--wlm-muted);
	font-size: var(--wlm-fs-body);
	line-height: var(--wlm-lh-body);
}

.entry-content .wlm-auth .wlm-auth__text,
.wlm-auth .wlm-auth__text {
	margin: 0;
	color: var(--wlm-ink);
	line-height: var(--wlm-lh-body);
}
.entry-content .wlm-auth .wlm-auth__text--muted,
.wlm-auth .wlm-auth__text--muted { color: var(--wlm-muted); font-size: var(--wlm-fs-sm); }

/* ==========================================================================
   2. FORMULARZ
   ========================================================================== */
.wlm-auth__form { display: flex; flex-direction: column; gap: var(--wlm-s4); margin: 0; }
.wlm-auth__form--compact { gap: var(--wlm-s3); }

/* Astra styluje input[type=...] z wyższą specyficznością niż .ft-input, więc wzmacniamy selektor */
.wlm-auth .ft-input {
	width: 100%;
	min-height: 48px;
	margin: 0;
	padding: var(--wlm-s3) var(--wlm-s4);
	border: 1px solid var(--wlm-border-strong);
	border-radius: var(--wlm-radius-md);
	background: var(--wlm-surface);
	box-shadow: none;
	color: var(--wlm-ink);
	font-family: inherit;
	font-size: var(--wlm-fs-body);
	line-height: 1.4;
}
.wlm-auth .ft-input:hover { border-color: var(--wlm-ink); }
.wlm-auth .ft-input:focus,
.wlm-auth .ft-input:focus-visible { outline: none; border-color: var(--wlm-accent); box-shadow: var(--wlm-ring); }
.wlm-auth .ft-input[aria-invalid="true"] { border-color: var(--wlm-danger); }

.entry-content .wlm-auth .ft-hint,
.entry-content .wlm-auth .ft-error,
.wlm-auth .ft-hint,
.wlm-auth .ft-error { margin: 0; line-height: var(--wlm-lh-snug); }

.wlm-auth__control { position: relative; }
.wlm-auth__control--password .ft-input { padding-right: 5.5rem; }

/* Przycisk pokazania hasła: pojawia się dopiero po starcie skryptu */
.wlm-auth .wlm-auth__reveal {
	position: absolute;
	top: 50%;
	right: var(--wlm-s2);
	min-width: 44px;
	min-height: 36px;
	margin: 0;
	padding: 0 var(--wlm-s3);
	border: 0;
	border-radius: var(--wlm-radius-sm);
	background: transparent;
	color: var(--wlm-ink);
	font-family: inherit;
	font-size: var(--wlm-fs-sm);
	font-weight: var(--wlm-fw-medium);
	line-height: 1;
	transform: translateY(-50%);
	cursor: pointer;
	transition: background-color var(--wlm-dur-fast) var(--wlm-ease);
}
.wlm-auth .wlm-auth__reveal:hover { background: var(--wlm-surface-alt); color: var(--wlm-ink); }
.wlm-auth .wlm-auth__reveal:focus-visible { outline: none; box-shadow: var(--wlm-ring); }
.wlm-auth__reveal[hidden] { display: none; }
.wlm-auth__reveal-hide,
.wlm-auth__reveal[aria-pressed="true"] .wlm-auth__reveal-show { display: none; }
.wlm-auth__reveal[aria-pressed="true"] .wlm-auth__reveal-hide { display: inline; }

/* Miernik siły hasła: pięć poziomów, kolory stanów z kontraktu */
.wlm-auth__meter {
	--wlm-meter: 0;
	--wlm-meter-c: var(--wlm-danger);
	display: flex;
	align-items: center;
	gap: var(--wlm-s3);
	margin-top: calc(var(--wlm-s2) * -1);
}
.wlm-auth__meter[hidden] { display: none; }
.wlm-auth__meter-bar {
	position: relative;
	flex: 1 1 auto;
	height: 4px;
	overflow: hidden;
	background: var(--wlm-border);
	border-radius: 999px;
}
.wlm-auth__meter-fill {
	position: absolute;
	inset: 0;
	background: var(--wlm-meter-c);
	transform: scaleX(calc((var(--wlm-meter) + 1) / 5));
	transform-origin: left center;
	transition: transform var(--wlm-dur) var(--wlm-ease-out), background-color var(--wlm-dur) var(--wlm-ease);
}
.wlm-auth__meter-text { flex: none; min-width: 7.5rem; color: var(--wlm-meter-c); font-size: var(--wlm-fs-xs); font-weight: var(--wlm-fw-semibold); text-align: right; }
.wlm-auth__meter[data-level="1"] { --wlm-meter: 1; }
.wlm-auth__meter[data-level="2"] { --wlm-meter: 2; --wlm-meter-c: var(--wlm-warning); }
.wlm-auth__meter[data-level="3"] { --wlm-meter: 3; --wlm-meter-c: var(--wlm-success); }
.wlm-auth__meter[data-level="4"] { --wlm-meter: 4; --wlm-meter-c: var(--wlm-success); }

/* Pole wyboru */
.wlm-auth__check {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: start;
	column-gap: var(--wlm-s3);
	row-gap: var(--wlm-s1);
}
.wlm-auth .wlm-auth__check input[type="checkbox"] {
	width: 20px;
	height: 20px;
	margin: 2px 0 0;
	accent-color: var(--wlm-accent);
	cursor: pointer;
}
.wlm-auth .wlm-auth__check input[type="checkbox"]:focus-visible { outline: none; box-shadow: var(--wlm-ring); border-radius: var(--wlm-radius-sm); }
.wlm-auth__check label { color: var(--wlm-ink); font-size: var(--wlm-fs-sm); line-height: var(--wlm-lh-snug); cursor: pointer; }
.wlm-auth__check .ft-error { grid-column: 2; }
.wlm-auth .wlm-auth__check a,
.wlm-auth .wlm-auth__check a:visited { color: var(--wlm-ink); text-decoration: underline; text-underline-offset: 0.2em; }
.wlm-auth .wlm-auth__check a:hover { color: var(--wlm-accent); }

.wlm-auth__row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--wlm-s2) var(--wlm-s4);
}
.wlm-auth__check--inline { align-items: center; }
.wlm-auth .wlm-auth__check--inline input[type="checkbox"] { margin-top: 0; }
.wlm-auth .wlm-auth__forgot { font-size: var(--wlm-fs-sm); }

.wlm-auth__submit { margin-top: var(--wlm-s2); }
.wlm-auth__submit[aria-busy="true"] { opacity: 0.7; pointer-events: none; }

/* Pułapka na boty: poza ekranem, niewidoczna dla ludzi i czytników */
.wlm-auth__trap {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Komunikaty: tło 10 procent koloru stanu, jak w kontrakcie */
.wlm-auth__notice {
	padding: var(--wlm-s3) var(--wlm-s4);
	border: 1px solid color-mix(in oklab, var(--wlm-notice-c, var(--wlm-danger)) 30%, var(--wlm-surface));
	border-radius: var(--wlm-radius-md);
	background: color-mix(in oklab, var(--wlm-notice-c, var(--wlm-danger)) 10%, var(--wlm-surface));
	color: var(--wlm-notice-c, var(--wlm-danger));
	font-size: var(--wlm-fs-sm);
	font-weight: var(--wlm-fw-medium);
	line-height: var(--wlm-lh-snug);
}
.wlm-auth__notice:focus { outline: none; }
.wlm-auth__notice--success { --wlm-notice-c: var(--wlm-success); }
.wlm-auth__notice--error { --wlm-notice-c: var(--wlm-danger); }
.wlm-auth__notice strong { color: inherit; font-weight: var(--wlm-fw-semibold); word-break: break-all; }

.entry-content .wlm-auth .wlm-auth__switch,
.wlm-auth .wlm-auth__switch {
	margin: 0;
	padding-top: var(--wlm-s4);
	border-top: 1px solid var(--wlm-border);
	color: var(--wlm-muted);
	font-size: var(--wlm-fs-sm);
	text-align: center;
}

/* ==========================================================================
   3. EKRAN APLIKACJI
   ========================================================================== */
.wlm-app {
	padding: var(--wlm-s7) 0 var(--wlm-s8);
	background: var(--wlm-surface-alt);
	color: var(--wlm-ink);
}
.wlm-app__inner {
	display: flex;
	flex-direction: column;
	gap: var(--wlm-s5);
	width: 100%;
	max-width: var(--wlm-container);
	margin-inline: auto;
	padding-inline: var(--wlm-gutter);
}
.wlm-app__head { display: flex; flex-direction: column; gap: var(--wlm-s2); }
.entry-content .wlm-app .wlm-app__title,
.wlm-app .wlm-app__title {
	margin: 0;
	color: var(--wlm-ink);
	font-size: var(--wlm-fs-h2);
	font-weight: var(--wlm-fw-bold);
	line-height: var(--wlm-lh-tight);
	letter-spacing: var(--wlm-track);
}
.entry-content .wlm-app .wlm-app__lead,
.wlm-app .wlm-app__lead { margin: 0; color: var(--wlm-muted); word-break: break-all; }

.wlm-app__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--wlm-s5); }
.wlm-app__card {
	display: flex;
	flex-direction: column;
	gap: var(--wlm-s3);
	padding: var(--wlm-s5);
	background: var(--wlm-surface);
	border: 1px solid var(--wlm-border);
	border-radius: var(--wlm-radius-lg);
}
.entry-content .wlm-app .wlm-app__card-title,
.wlm-app .wlm-app__card-title { margin: 0; color: var(--wlm-ink); font-size: var(--wlm-fs-h3); font-weight: var(--wlm-fw-semibold); line-height: var(--wlm-lh-snug); }
.entry-content .wlm-app .wlm-app__big,
.wlm-app .wlm-app__big { margin: 0; color: var(--wlm-ink); font-size: var(--wlm-fs-h2); font-weight: var(--wlm-fw-bold); line-height: var(--wlm-lh-tight); letter-spacing: var(--wlm-track); font-variant-numeric: tabular-nums; }
.entry-content .wlm-app .wlm-app__text,
.wlm-app .wlm-app__text { margin: 0; color: var(--wlm-muted); line-height: var(--wlm-lh-body); }
.entry-content .wlm-app .wlm-app__note,
.wlm-app .wlm-app__note { margin: 0; color: var(--wlm-muted); font-size: var(--wlm-fs-sm); }
.wlm-app__actions { display: flex; flex-wrap: wrap; gap: var(--wlm-s3); margin-top: var(--wlm-s2); }
.wlm-app__inline-form { margin: 0; }

.wlm-app .wlm-app__events { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.wlm-app .wlm-app__event {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: var(--wlm-s1) var(--wlm-s4);
	margin: 0;
	padding: var(--wlm-s3) 0;
	border-top: 1px solid var(--wlm-border);
}
.wlm-app__event-name { font-weight: var(--wlm-fw-medium); }
.wlm-app__event-meta { color: var(--wlm-muted); font-size: var(--wlm-fs-sm); font-variant-numeric: tabular-nums; }

.wlm-app .wlm-auth__notice { align-self: flex-start; }

/* ==========================================================================
   4. RUCH I RESPONSYWNOŚĆ
   ========================================================================== */
@keyframes wlm-rise {
	from { opacity: 0; transform: translateY(12px); }
	to { opacity: 1; transform: none; }
}

@media (min-width: 640px) {
	.wlm-auth__card { padding: var(--wlm-s7) var(--wlm-s6); }
}

@media (min-width: 768px) {
	.wlm-app__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
	.wlm-auth { padding-block: var(--wlm-s8); }
	.wlm-app { padding-block: var(--wlm-s8); }
}

/* Szeroki ekran: panel marki po lewej, formularz po prawej, obie kolumny tej samej wysokości. */
@media (min-width: 960px) {
	/* Strona z panelem wychodzi poza wąską kolumnę treści motywu, tak jak aplikacja. */
	.wlm-auth.wlm-auth--split {
		--wlm-auth-w: min(var(--wlm-container), calc(100vw - 2 * var(--wlm-gutter)));
		box-sizing: border-box;
		width: var(--wlm-auth-w) !important;
		max-width: none !important;
		margin-left: calc(50% - var(--wlm-auth-w) / 2) !important;
		margin-right: 0 !important;
		border-radius: var(--wlm-radius-lg);
	}
	.wlm-auth--split .wlm-auth__card::before { display: none; }
	.wlm-auth--split :is(.wlm-auth__aside-title, .wlm-auth__aside-item, .wlm-auth__lead) { text-wrap: pretty; }
	.wlm-auth--split .wlm-auth__layout {
		grid-template-columns: minmax(0, 1fr) minmax(0, var(--wlm-card-w, 30rem));
		gap: var(--wlm-s5);
		max-width: 66rem;
		align-items: stretch;
	}
	.wlm-auth--split .wlm-auth__aside {
		position: relative;
		display: flex;
		flex-direction: column;
		justify-content: center;
		gap: var(--wlm-s4);
		padding: var(--wlm-s7) var(--wlm-s6);
		overflow: hidden;
		border-radius: var(--wlm-radius-lg);
		background: var(--ft-surface-dark, #111111);
		color: var(--wlm-surface);
		animation: wlm-rise var(--wlm-dur) var(--wlm-ease-out) both;
	}
	.wlm-auth__aside-slash {
		position: absolute;
		top: 0;
		right: var(--wlm-s7);
		width: var(--wlm-s5);
		height: var(--wlm-s8);
		background: var(--wlm-accent);
		transform: skewX(var(--wlm-slant));
		transform-origin: left top;
	}
	.entry-content .wlm-auth .wlm-auth__aside-eyebrow,
	.wlm-auth .wlm-auth__aside-eyebrow {
		position: relative;
		margin: 0;
		color: color-mix(in oklab, var(--wlm-surface) 70%, var(--ft-surface-dark, #111111));
		font-size: var(--wlm-fs-xs);
		font-weight: var(--wlm-fw-semibold);
		letter-spacing: var(--ft-track-caps, 0.12em);
		text-transform: uppercase;
	}
	.entry-content .wlm-auth .wlm-auth__aside-title,
	.wlm-auth .wlm-auth__aside-title {
		position: relative;
		max-width: 22ch;
		margin: 0;
		color: var(--wlm-surface);
		font-size: var(--wlm-fs-h2);
		font-weight: var(--wlm-fw-semibold);
		line-height: var(--wlm-lh-tight);
		letter-spacing: var(--wlm-track);
	}
	.entry-content .wlm-auth .wlm-auth__aside-list,
	.wlm-auth .wlm-auth__aside-list {
		position: relative;
		display: flex;
		flex-direction: column;
		gap: var(--wlm-s3);
		max-width: 30rem;
		margin: var(--wlm-s2) 0 0;
		padding: 0;
		list-style: none;
	}
	.entry-content .wlm-auth .wlm-auth__aside-item,
	.wlm-auth .wlm-auth__aside-item {
		position: relative;
		margin: 0;
		padding-left: var(--wlm-s5);
		color: color-mix(in oklab, var(--wlm-surface) 88%, var(--ft-surface-dark, #111111));
		line-height: var(--wlm-lh-snug);
	}
	.wlm-auth__aside-item::before {
		content: "";
		position: absolute;
		top: 0.3em;
		left: 0.25rem;
		width: 0.3125rem;
		height: 0.875rem;
		background: var(--wlm-accent);
		transform: skewX(var(--wlm-slant));
	}
	.entry-content .wlm-auth .wlm-auth__aside-note,
	.wlm-auth .wlm-auth__aside-note {
		position: relative;
		margin: var(--wlm-s2) 0 0;
		color: color-mix(in oklab, var(--wlm-surface) 70%, var(--ft-surface-dark, #111111));
		font-size: var(--wlm-fs-sm);
	}
}

@media (prefers-reduced-motion: reduce) {
	.wlm-auth__card,
	.wlm-auth__aside { animation: none; }
	.wlm-auth__meter-fill,
	.wlm-auth .wlm-auth__reveal { transition: none; }
}
