/* ==========================================================================
   Linuxhackingid — Enterprise UI layer for Gitea 1.27.x
   Injected via custom/templates/custom/header.tmpl (loads AFTER the active
   theme CSS, so :root variable overrides win by source order).

   Design intent: sit ON TOP of the selected base theme (gitea-* / github-*),
   adding the Linuxhackingid brand — signature RED accent, Inter/JetBrains
   typography, a dark brand navbar, and polished components + repo view — while
   letting each theme own its own surfaces (works for all 7 enabled themes:
   gitea-auto/light/dark, github-auto/light/dark, github-soft-dark).

   Change --lhid-red (below) to re-tint the whole UI.
   ========================================================================== */

/* ------------------------------------------------------------------ *
 * 1) Self-hosted fonts (relative URLs → subpath-safe: /assets/fonts) *
 * ------------------------------------------------------------------ */
@font-face{font-family:"Inter";font-style:normal;font-weight:400;font-display:swap;src:url("../fonts/inter-400.woff2") format("woff2")}
@font-face{font-family:"Inter";font-style:normal;font-weight:500;font-display:swap;src:url("../fonts/inter-500.woff2") format("woff2")}
@font-face{font-family:"Inter";font-style:normal;font-weight:600;font-display:swap;src:url("../fonts/inter-600.woff2") format("woff2")}
@font-face{font-family:"Inter";font-style:normal;font-weight:700;font-display:swap;src:url("../fonts/inter-700.woff2") format("woff2")}
@font-face{font-family:"JetBrains Mono";font-style:normal;font-weight:400;font-display:swap;src:url("../fonts/jetbrains-mono-400.woff2") format("woff2")}
@font-face{font-family:"JetBrains Mono";font-style:normal;font-weight:500;font-display:swap;src:url("../fonts/jetbrains-mono-500.woff2") format("woff2")}

/* ------------------------------------------------------------------ *
 * 2) Brand tokens — single source of truth                            *
 * ------------------------------------------------------------------ */
:root{
	--lhid-red:        #cc101e; /* signature accent (safe on light & dark) */
	--lhid-red-deep:   #c20a18; /* light-mode links, AA on white           */
	--lhid-red-bright: #ef2233; /* dark-mode links, vivid on near-black     */

	/* navbar logo swaps with the theme: white on dark navbars, black on light.
	   Default = white (covers dark + fixed-dark); light contexts override below. */
	--lhid-logo: url("../img/logo-white.png");

	--lhid-ease:  cubic-bezier(.4,0,.2,1);
	--lhid-speed: .16s;
}

/* ------------------------------------------------------------------ *
 * 3) Variable remap                                                   *
 * ------------------------------------------------------------------ */

/* --- unconditional: typography, radius, brand navbar, red ramp ----- */
:root{
	--fonts-proportional: "Inter", -apple-system, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial;
	--fonts-monospace: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace, var(--fonts-emoji);

	--border-radius: 6px;
	--border-radius-medium: 8px;

	/* navbar follows the active theme (light navbar in light themes, dark in dark)
	   so the theme-adaptive logo reads correctly on both. */

	/* signature red ramp (base) — applies to all themes */
	--color-primary:          var(--lhid-red);
	--color-primary-contrast: #ffffff;
	--color-primary-dark-1:   #b60e1a;
	--color-primary-dark-2:   #a00c17;
	--color-primary-dark-3:   #8a0a14;
	--color-primary-dark-4:   #740810;
	--color-primary-dark-5:   #500509;
	--color-primary-dark-6:   #280205;
	--color-primary-dark-7:   #140102;
	--color-primary-light-1:  #d62533;
	--color-primary-light-2:  #dc4450;
	--color-primary-light-3:  #e2626c;
	--color-primary-light-4:  #e88089;
	--color-primary-light-5:  #f0a7ad;
	--color-primary-light-6:  #f7d2d5;
	--color-primary-light-7:  #fcf2f3;
	--color-primary-hover:  var(--color-primary-dark-1);
	--color-primary-active: var(--color-primary-dark-2);
	--color-primary-alpha-10: #cc101e19;
	--color-primary-alpha-20: #cc101e33;
	--color-primary-alpha-30: #cc101e4b;
	--color-primary-alpha-40: #cc101e66;
	--color-primary-alpha-50: #cc101e80;
	--color-primary-alpha-60: #cc101e99;
	--color-primary-alpha-70: #cc101eb3;
	--color-primary-alpha-80: #cc101ecc;
	--color-primary-alpha-90: #cc101ee1;
	--color-accent: var(--color-primary);
}

/* --- per-scheme primary nudge, gated so it never fights a fixed theme --- */
/* auto themes: follow the OS setting */
@media (prefers-color-scheme: light){
	:root[data-theme$="-auto"]{
		--color-primary: var(--lhid-red-deep);
		--color-primary-hover: #a80814;
		--color-primary-active: #8f0712;
		--color-accent: var(--lhid-red-deep);
		--lhid-logo: url("../img/logo-black.png");
	}
}
@media (prefers-color-scheme: dark){
	:root[data-theme$="-auto"]{
		--color-primary: var(--lhid-red-bright);
		--color-primary-hover: #f23a48;
		--color-primary-active: #f55160;
		--color-accent: var(--lhid-red-bright);
	}
}
/* explicitly-selected fixed themes: follow the theme, not the OS */
:root[data-theme$="-light"]{
	--color-primary: var(--lhid-red-deep);
	--color-primary-hover: #a80814;
	--color-primary-active: #8f0712;
	--color-accent: var(--lhid-red-deep);
	--lhid-logo: url("../img/logo-black.png");
}
:root[data-theme$="-dark"]{
	--color-primary: var(--lhid-red-bright);
	--color-primary-hover: #f23a48;
	--color-primary-active: #f55160;
	--color-accent: var(--lhid-red-bright);
}

/* ================================================================== *
 * 4) Global                                                           *
 * ================================================================== */
body{
	font-family:var(--fonts-regular);
	-webkit-font-smoothing:antialiased;
	text-rendering:optimizeLegibility;
	letter-spacing:.1px;
}
h1,h2,h3,h4,h5,.ui.header{font-family:var(--fonts-proportional);letter-spacing:-.01em}

/* brand focus ring for keyboard users */
a:focus-visible,button:focus-visible,input:focus-visible,textarea:focus-visible,
select:focus-visible,summary:focus-visible,.ui.button:focus-visible,[tabindex]:focus-visible{
	outline:2px solid var(--color-primary);
	outline-offset:2px;
	border-radius:var(--border-radius);
}
::selection{background:var(--color-primary-alpha-30)}

/* refined scrollbars */
*{scrollbar-width:thin;scrollbar-color:var(--color-secondary) transparent}
::-webkit-scrollbar{width:11px;height:11px}
::-webkit-scrollbar-thumb{background:var(--color-secondary);border-radius:8px;border:3px solid transparent;background-clip:content-box}
::-webkit-scrollbar-thumb:hover{background:var(--color-text-light-2);background-clip:content-box}

/* ================================================================== *
 * 4b) Top navbar (follows the active theme; brand-red active accent)  *
 * ================================================================== */
#navbar{
	box-shadow:0 1px 0 var(--color-shadow);
	padding:0 14px;
	min-height:52px;
}
#navbar .item{font-weight:500;border-radius:var(--border-radius);transition:background-color var(--lhid-speed) var(--lhid-ease),color var(--lhid-speed) var(--lhid-ease)}
#navbar .item.active{position:relative}
#navbar .item.active::after{content:"";position:absolute;left:10px;right:10px;bottom:6px;height:2px;border-radius:2px;background:var(--color-primary)}

/* Theme-adaptive brand logo: swap the <img> bitmap for a CSS background
   (white on dark navbars, black on light) via --lhid-logo. The padding-left
   equal to width collapses the img content-box so the original src is hidden,
   while the background paints the full box — reliable across browsers. */
#navbar #navbar-logo img{
	box-sizing:border-box;
	width:62px;height:32px;
	padding-left:62px;
	overflow:hidden;
	background:left center/contain no-repeat var(--lhid-logo);
}

/* ================================================================== *
 * 4c) Buttons                                                         *
 * ================================================================== */
.ui.button{
	border-radius:var(--border-radius);
	font-weight:600;
	transition:background-color var(--lhid-speed) var(--lhid-ease),
		border-color var(--lhid-speed) var(--lhid-ease),
		color var(--lhid-speed) var(--lhid-ease),
		box-shadow var(--lhid-speed) var(--lhid-ease),
		transform var(--lhid-speed) var(--lhid-ease);
}
.ui.button:not(.basic):not(.text):hover{transform:translateY(-1px)}
.ui.button:active{transform:translateY(0)}
.ui.primary.button,.ui.primary.buttons .button{background:var(--color-primary);box-shadow:0 1px 2px #00000026}
.ui.primary.button:hover,.ui.primary.buttons .button:hover{background:var(--color-primary-hover);box-shadow:0 4px 12px var(--color-primary-alpha-30)}
.ui.basic.button:hover{border-color:var(--color-text-light-3)}

/* ================================================================== *
 * 4d) Cards / boxes / segments                                        *
 * ================================================================== */
.ui.segment,.ui.segments,.ui.attached.segment,.repository-summary,
.ui.card,.ui.cards>.card{
	border-radius:var(--border-radius-medium);
	box-shadow:0 1px 2px var(--color-shadow);
}
.ui.segments>.segment{border-radius:0}
.ui.segments>.segment:first-child{border-top-left-radius:var(--border-radius-medium);border-top-right-radius:var(--border-radius-medium)}
.ui.segments>.segment:last-child{border-bottom-left-radius:var(--border-radius-medium);border-bottom-right-radius:var(--border-radius-medium)}

/* ================================================================== *
 * 4e) Forms / inputs                                                  *
 * ================================================================== */
.ui.input>input,.ui.form input:not([type]),.ui.form input[type=text],
.ui.form input[type=search],.ui.form input[type=email],.ui.form input[type=password],
.ui.form textarea,.ui.selection.dropdown{
	border-radius:var(--border-radius);
	transition:border-color var(--lhid-speed) var(--lhid-ease),box-shadow var(--lhid-speed) var(--lhid-ease);
}
.ui.input>input:focus,.ui.form input:focus,.ui.form textarea:focus,.ui.selection.dropdown:focus,
.ui.selection.active.dropdown{
	border-color:var(--color-primary);
	box-shadow:0 0 0 3px var(--color-primary-alpha-20);
}

/* ================================================================== *
 * 4f) Labels / footer                                                 *
 * ================================================================== */
.ui.label,.ui.basic.label{border-radius:2em;font-weight:600}
.page-footer{border-top:1px solid var(--color-secondary);padding:14px 0}
.page-footer a:hover{color:var(--color-primary)}

/* ================================================================== *
 * 5) REPOSITORY VIEW                                                  *
 * ================================================================== */

/* --- 5a) repo header ------------------------------------------------ */
.repository .repo-header{padding:1.1em 0 .5em}
.repo-header .flex-text-block.tw-text-18{font-size:1.35rem;letter-spacing:-.01em}
.repo-header .flex-text-block.tw-text-18 a.muted{font-weight:700;color:var(--color-text-dark)}
.repo-header .flex-text-block.tw-text-18 a.muted.tw-font-normal{font-weight:400;color:var(--color-text-light-1)}
.repo-header .flex-text-block.tw-text-18 a.muted:hover{color:var(--color-primary)}
.repo-header .ui.labeled.button:hover>.button:first-child{border-color:var(--color-primary);color:var(--color-primary)}

/* --- 5b) tab bar (active underline follows currentcolor → recolor) -- */
.repository .ui.secondary.pointing.menu{gap:2px}
.repository .ui.secondary.pointing.menu .item{
	border-radius:var(--border-radius) var(--border-radius) 0 0;
	border-bottom-width:2px;
	font-weight:500;
	color:var(--color-text-light);
	transition:color var(--lhid-speed) var(--lhid-ease),background-color var(--lhid-speed) var(--lhid-ease),border-color var(--lhid-speed) var(--lhid-ease);
}
.repository .ui.secondary.pointing.menu .item:hover{color:var(--color-text-dark);background:var(--color-hover)}
.repository .ui.secondary.pointing.menu .active.item,
.repository .ui.secondary.pointing.menu .active.item:hover{
	color:var(--color-primary);
	border-color:var(--color-primary);
	background:transparent;
	font-weight:600;
}
.repository .ui.secondary.pointing.menu .item .ui.label{
	background:var(--color-primary-alpha-10);color:var(--color-primary);border-radius:2em;font-weight:600;
}

/* --- 5c) file list -------------------------------------------------- */
.repo-file-item{transition:background-color var(--lhid-speed) var(--lhid-ease)}
.repo-file-item:hover{background:var(--color-hover)}
.repo-file-cell.name .entry-name{font-family:var(--fonts-monospace);font-size:.92em}
.repo-file-cell.name a:hover{color:var(--color-primary)}
.svg.git-entry-icon.octicon-file-directory-fill,.svg.git-entry-icon.octicon-file-directory{color:var(--color-primary)}

/* --- 5d) clone panel + action controls ------------------------------ */
.clone-panel-list,.flex-items-block.clone-panel-list{gap:6px}
.js-clone-url-editor{border-radius:var(--border-radius)}

/* --- 5e) sidebar "About" card -------------------------------------- */
.repo-home-sidebar-top,.repo-home-sidebar-bottom{
	background:var(--color-box-body);
	border:1px solid var(--color-secondary);
	border-radius:var(--border-radius-medium);
	padding:16px;
	box-shadow:0 1px 2px var(--color-shadow);
}
.repo-home-sidebar-top{margin-bottom:16px}
.repo-home-sidebar-header{
	font-weight:700;font-size:.82rem;letter-spacing:.04em;text-transform:uppercase;
	color:var(--color-text-light-2);
	padding-bottom:6px;margin-bottom:4px;border-bottom:1px solid var(--color-secondary);
}
.repo-description{color:var(--color-text);line-height:1.55}
#repo-topics .repo-topic,.repo-home-sidebar-top .repo-topic.ui.label{
	background:var(--color-primary-alpha-10);
	color:var(--color-primary);
	border:1px solid var(--color-primary-alpha-30);
	border-radius:2em;font-weight:600;
	transition:background-color var(--lhid-speed) var(--lhid-ease);
}
#repo-topics .repo-topic:hover,.repo-home-sidebar-top .repo-topic.ui.label:hover{background:var(--color-primary-alpha-20)}
.repo-home-sidebar-top .flex-text-block.muted:hover{color:var(--color-primary)}

/* --- 5f) README / markup ------------------------------------------- */
.markup{font-size:16px;line-height:1.65}
.markup h1,.markup h2{border-bottom:1px solid var(--color-secondary);padding-bottom:.3em}
.markup h1,.markup h2,.markup h3{letter-spacing:-.01em}
.markup code,.markup tt{font-family:var(--fonts-monospace);background:var(--color-primary-alpha-10);color:var(--color-primary);border-radius:4px;padding:.18em .4em;font-size:.88em}
.markup pre{border-radius:var(--border-radius-medium)}
.markup pre code,.markup pre tt{background:transparent;color:inherit;padding:0}
.markup blockquote{border-left:.25em solid var(--color-primary);color:var(--color-text-light-1)}
.markup a{color:var(--color-primary);font-weight:500}
.code-block-container,.code-block{border-radius:var(--border-radius-medium)}
.chroma{font-family:var(--fonts-monospace)}

/* ================================================================== *
 * 6) Responsive (mobile refinements)                                  *
 * ================================================================== */
@media (max-width:767.98px){
	#navbar{padding:0 8px}
	#navbar .item.active::after{display:none}

	.repo-header .flex-text-block.tw-text-18{font-size:1.15rem}
	.repository .repo-header.flex-left-right{flex-wrap:wrap;gap:8px}
	.repository .repo-header .ui.button,
	.repository .repo-header .ui.labeled.button>.button{min-height:40px}

	/* horizontally scrollable tab bar instead of cramped wrap */
	.repository overflow-menu .overflow-menu-items{
		overflow-x:auto;flex-wrap:nowrap;-webkit-overflow-scrolling:touch;scrollbar-width:none;
	}
	.repository overflow-menu .overflow-menu-items::-webkit-scrollbar{display:none}
	.repository .ui.secondary.pointing.menu .item{white-space:nowrap}

	.repo-file-item{min-height:44px}
	.ui.container{padding-left:12px;padding-right:12px}
	.repo-home-sidebar-top,.repo-home-sidebar-bottom{padding:14px}
	.markup{font-size:15px}
	.clone-panel-list{flex-wrap:wrap}
}
@media (max-width:479.98px){
	.repo-header .flex-text-block.tw-flex-wrap .ui.basic.label.not-mobile{display:none}
	.ui.container{padding-left:10px;padding-right:10px}
}

/* ================================================================== *
 * 7) Motion / accessibility                                           *
 * ================================================================== */
a,.muted,.muted-links a,.repo-topic,.flex-text-block.muted{
	transition:color var(--lhid-speed) var(--lhid-ease),background-color var(--lhid-speed) var(--lhid-ease);
}
@media (prefers-reduced-motion: reduce){
	*,*::before,*::after{
		transition-duration:.001ms !important;
		animation-duration:.001ms !important;
		animation-iteration-count:1 !important;
		scroll-behavior:auto !important;
	}
	.ui.button:not(.basic):not(.text):hover{transform:none}
}
