/*
 * Knot Code 登录页 v1
 * 只在 .knot-login-page 存在时生效。
 */

/* =========================
   Forgejo 外层
   ========================= */

html:has(.knot-login-page),
body:has(.knot-login-page),
html.knot-login-active,
body.knot-login-active {
	margin: 0 !important;
	padding: 0 !important;
	background: #080b10 !important;
}

body.knot-login-active {
	overflow-x: hidden;
}

body:has(.knot-login-page) #navbar,
body.knot-login-active #navbar,
body:has(.knot-login-page) > footer,
body.knot-login-active > footer,
body:has(.knot-login-page) .page-footer,
body.knot-login-active .page-footer {
	display: none !important;
}

body:has(.knot-login-page) .full.height,
body.knot-login-active .full.height {
	min-height: 100vh !important;
	min-height: 100dvh !important;
	margin: 0 !important;
	padding: 0 !important;
	background: #080b10 !important;
}

/* Forgejo 默认给 .page-content 第一个子元素增加 page-spacing */
.knot-login-page > .knot-login-background {
	margin-top: 0 !important;
}

.knot-login-page {
	position: relative !important;
	display: flex !important;
	flex: 1 !important;
	width: 100% !important;
	max-width: none !important;
	min-height: 100vh !important;
	min-height: 100dvh !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden;
	background: #080b10 !important;
	color: #f3f5f7;
}

/* =========================
   背景
   ========================= */

.knot-login-background {
	position: absolute;
	inset: 0;
	margin: 0 !important;
	padding: 0 !important;
	pointer-events: none;
	overflow: hidden;
}

.knot-login-grid {
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
	background-size: 58px 58px;
	-webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.55) 70%, transparent 100%);
	mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.55) 70%, transparent 100%);
}

.knot-login-glow {
	position: absolute;
	width: 620px;
	height: 620px;
	border-radius: 50%;
	filter: blur(115px);
}

.knot-login-glow-a {
	top: -330px;
	right: -160px;
	background: rgba(92,85,255,.16);
}

.knot-login-glow-b {
	left: -300px;
	bottom: -420px;
	background: rgba(40,211,147,.08);
}

/* =========================
   页面布局
   ========================= */

.knot-login-shell {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: min(1180px, calc(100% - 64px));
	min-height: 100vh;
	min-height: 100dvh;
	margin: 0 auto !important;
}

.knot-login-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 76px;
	border-bottom: 1px solid rgba(255,255,255,.065);
}

.knot-login-brand {
	display: inline-flex;
	align-items: center;
	gap: 11px;
	color: #f0f3f6 !important;
	font-size: 14px;
	font-weight: 700;
	text-decoration: none !important;
}

.knot-login-brand-mark {
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	border: 1px solid rgba(255,255,255,.13);
	border-radius: 8px;
	background: rgba(255,255,255,.04);
	color: #f5f7f9;
	font-size: 13px;
	box-shadow: inset 0 1px rgba(255,255,255,.04);
}

.knot-login-back {
	padding: 9px 13px;
	border-radius: 8px;
	color: #89939f !important;
	font-size: 13px;
	font-weight: 550;
	text-decoration: none !important;
	transition: color .16s ease, background .16s ease;
}

.knot-login-back:hover {
	color: #e2e6ea !important;
	background: rgba(255,255,255,.045);
}

.knot-login-layout {
	display: grid;
	grid-template-columns: minmax(0, 1.04fr) minmax(360px, .72fr);
	align-items: center;
	gap: 110px;
	flex: 1;
	padding: 64px 0 58px;
}

/* =========================
   左侧
   ========================= */

.knot-login-intro {
	display: flex;
	flex-direction: column;
	gap: 48px;
	min-width: 0;
}

.knot-login-intro h1 {
	margin: 0;
	color: #f5f7f9;
	font-size: clamp(54px, 5.5vw, 84px);
	font-weight: 680;
	line-height: .96;
	letter-spacing: -.06em;
}

.knot-login-slogan {
	margin: 22px 0 0;
	color: #8f98a5;
	font-size: clamp(18px, 1.6vw, 23px);
	font-weight: 450;
	line-height: 1.45;
	letter-spacing: -.015em;
}

.knot-login-graph {
	overflow: hidden;
	width: min(580px, 100%);
	border: 1px solid #252b34;
	border-radius: 13px;
	background: rgba(13,16,22,.83);
	box-shadow:
		0 28px 80px rgba(0,0,0,.36),
		inset 0 1px rgba(255,255,255,.035);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
}

.knot-login-graph-head {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	height: 42px;
	padding: 0 14px;
	border-bottom: 1px solid #222831;
	color: #65707d;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
	font-size: 9px;
}

.knot-login-dots {
	display: flex;
	gap: 6px;
}

.knot-login-dots span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #3b424d;
}

.knot-login-branch-badge {
	justify-self: end;
	padding: 3px 6px;
	border: 1px solid #2b333e;
	border-radius: 5px;
}

.knot-login-graph-body {
	padding: 10px 16px 14px;
}

.knot-login-svg {
	display: block;
	width: 100%;
	height: auto;
}

.knot-login-path {
	fill: none;
	stroke-width: 3;
	stroke-linecap: round;
	stroke-linejoin: round;
	opacity: .8;
}

.knot-login-path-main { stroke: #717b88; }
.knot-login-path-dev { stroke: #4fd09a; }
.knot-login-path-feature { stroke: #8177ef; }

.knot-login-nodes circle {
	stroke: #0d1117;
	stroke-width: 3;
}

.knot-login-nodes-main circle { fill: #aeb6c0; }
.knot-login-nodes-dev circle { fill: #58d6a1; }
.knot-login-nodes-feature circle { fill: #8f83ff; }

.knot-login-labels text {
	fill: #66717d;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
	font-size: 10px;
	font-weight: 600;
}

/* =========================
   原生 Forgejo 登录表单
   ========================= */

.knot-login-form-wrap {
	display: flex;
	justify-content: flex-end;
}

.knot-login-form {
	width: 100%;
	max-width: 410px;
	padding: 8px;
	border: 1px solid rgba(255,255,255,.075);
	border-radius: 17px;
	background: rgba(255,255,255,.025);
	box-shadow: 0 30px 90px rgba(0,0,0,.34);
	backdrop-filter: blur(24px);
	-webkit-backdrop-filter: blur(24px);
}

/* 清除 Forgejo 原生登录容器尺寸限制 */
.knot-login-form .ui.user.signin.container,
.knot-login-form .ui.container {
	width: 100% !important;
	max-width: none !important;
	margin: 0 !important;
}

/* 标题 */
.knot-login-form .ui.top.attached.header,
.knot-login-form .ui.header {
	margin: 0 !important;
	padding: 25px 25px 16px !important;
	border: 0 !important;
	background: transparent !important;
	color: #f1f4f7 !important;
	font-size: 22px !important;
	font-weight: 650 !important;
	text-align: left !important;
	box-shadow: none !important;
}

/* 表单主体 */
.knot-login-form .ui.attached.segment,
.knot-login-form .ui.segment {
	margin: 0 !important;
	padding: 10px 25px 25px !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
}

.knot-login-form .ui.form {
	width: 100% !important;
	max-width: none !important;
	margin: 0 !important;
}

.knot-login-form .ui.form .field {
	margin-bottom: 18px !important;
}

.knot-login-form .ui.form .field > label {
	margin-bottom: 8px !important;
	color: #858f9c !important;
	font-size: 12px !important;
	font-weight: 550 !important;
}

/* 输入框 */
.knot-login-form .ui.form input[type="text"],
.knot-login-form .ui.form input[type="password"],
.knot-login-form .ui.form input[type="email"] {
	width: 100% !important;
	min-height: 45px !important;
	padding: 0 13px !important;
	border: 1px solid #2b323c !important;
	border-radius: 8px !important;
	outline: none !important;
	background: rgba(4,7,11,.55) !important;
	color: #e8ecf0 !important;
	font-size: 13px !important;
	box-shadow: none !important;
	transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.knot-login-form .ui.form input[type="text"]:focus,
.knot-login-form .ui.form input[type="password"]:focus,
.knot-login-form .ui.form input[type="email"]:focus {
	border-color: #596574 !important;
	background: rgba(6,9,14,.72) !important;
	box-shadow: 0 0 0 3px rgba(110,123,140,.09) !important;
}

.knot-login-form .ui.form input::placeholder {
	color: #4f5965 !important;
}

/* 登录按钮 */
.knot-login-form .ui.primary.button,
.knot-login-form button.primary,
.knot-login-form button[type="submit"] {
	min-height: 44px !important;
	border: 0 !important;
	border-radius: 8px !important;
	background: #f1f3f5 !important;
	color: #080b10 !important;
	font-size: 13px !important;
	font-weight: 680 !important;
	box-shadow: 0 10px 30px rgba(0,0,0,.24) !important;
}

.knot-login-form .ui.primary.button:hover,
.knot-login-form button.primary:hover,
.knot-login-form button[type="submit"]:hover {
	background: #fff !important;
	color: #080b10 !important;
}

/* 链接 */
.knot-login-form a {
	color: #9ca6b2 !important;
	text-decoration: none !important;
}

.knot-login-form a:hover {
	color: #e1e5e9 !important;
}

/* 复选框和辅助文字 */
.knot-login-form .ui.checkbox label,
.knot-login-form .field,
.knot-login-form .tw-text {
	color: #77818d;
}

/* 错误提示 */
.knot-login-form .ui.error.message,
.knot-login-form .ui.negative.message {
	border: 1px solid rgba(224,93,93,.25) !important;
	border-radius: 8px !important;
	background: rgba(224,93,93,.08) !important;
	color: #e5a1a1 !important;
	box-shadow: none !important;
}

/* OAuth / OpenID 分隔 */
.knot-login-form .divider,
.knot-login-form .divider-text {
	color: #58626e !important;
}

.knot-login-form .divider::before,
.knot-login-form .divider::after {
	border-color: #252c35 !important;
}

/* 第三方登录按钮 */
.knot-login-form #oauth2-login-navigator a,
.knot-login-form #oauth2-login-navigator button {
	border-color: #2b323c !important;
	background: rgba(255,255,255,.025) !important;
	color: #cfd5db !important;
	box-shadow: none !important;
}

/* =========================
   底部
   ========================= */

.knot-login-footer {
	display: flex;
	align-items: center;
	min-height: 63px;
	border-top: 1px solid rgba(255,255,255,.065);
	color: #596370;
	font-size: 10px;
}

.knot-login-footer-dot {
	width: 3px;
	height: 3px;
	margin: 0 10px;
	border-radius: 50%;
	background: #39414b;
}

.knot-login-footer-spacer {
	flex: 1;
}

.knot-login-state {
	display: inline-flex;
	align-items: center;
	gap: 7px;
}

.knot-login-state i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #46d89d;
	box-shadow: 0 0 0 4px rgba(70,216,157,.06);
}

/* =========================
   响应式
   ========================= */

@media (max-width: 900px) {
	.knot-login-shell {
		width: min(760px, calc(100% - 42px));
	}

	.knot-login-layout {
		grid-template-columns: 1fr;
		gap: 52px;
		padding: 54px 0;
	}

	.knot-login-intro {
		gap: 36px;
	}

	.knot-login-graph {
		display: none;
	}

	.knot-login-form-wrap {
		justify-content: flex-start;
	}

	.knot-login-form {
		max-width: 460px;
	}
}

@media (max-width: 600px) {
	.knot-login-shell {
		width: calc(100% - 28px);
	}

	.knot-login-nav {
		height: 66px;
	}

	.knot-login-layout {
		gap: 36px;
		padding: 44px 0;
	}

	.knot-login-intro h1 {
		font-size: clamp(48px, 16vw, 68px);
	}

	.knot-login-slogan {
		margin-top: 16px;
		font-size: 17px;
	}

	.knot-login-form {
		max-width: none;
		padding: 5px;
	}

	.knot-login-form .ui.top.attached.header,
	.knot-login-form .ui.header {
		padding: 21px 19px 14px !important;
	}

	.knot-login-form .ui.attached.segment,
	.knot-login-form .ui.segment {
		padding: 8px 19px 21px !important;
	}

	.knot-login-footer {
		min-height: 54px;
	}
}
