/* Baremetal auction listing
   ------------------------------------------------------------------
   Card-per-server layout with a filter rail, in the site's dark +
   deep-orange palette. Cards are rendered server-side; auction.js only
   shows/hides and reorders them. */

.auction {
	margin: 0 0 60px;
}

/* Materialize's .container is 70% wide on large screens, which left only about
   340px for five spec columns and forced them onto a second row. The listing
   breaks out of that container on desktop while everything else on the page
   keeps the normal width. */
@media only screen and (min-width: 993px) {
	.auction {
		/* Negative side margins rather than translateX: a transform on this
		   element would become the containing block for its descendants and
		   break `position: sticky` on the filter rail. */
		--auction-width: min(94vw, 1360px);
		margin-left: calc((100% - var(--auction-width)) / 2);
		margin-right: calc((100% - var(--auction-width)) / 2);
	}
}

.auction__intro h2 {
	margin-bottom: 6px;
}

.auction__sub {
	color: #9e9e9e;
	max-width: 640px;
	margin: 0 auto 28px;
}

/* ---- Toolbar ---- */

.auction__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 0 0 14px;
	border-bottom: 1px solid #2b2b2b;
	margin-bottom: 20px;
	flex-wrap: wrap;
}

.auction__count {
	font-size: 0.95rem;
	color: #bdbdbd;
}

.auction__count strong {
	color: #ff7043;
	font-size: 1.3rem;
	margin-right: 4px;
}

.auction__count-total {
	color: #757575;
}

.auction__sortwrap {
	display: flex;
	align-items: center;
	gap: 10px;
}

.auction__sortwrap label {
	color: #9e9e9e;
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

select.auction__sort {
	background-color: #1e1e1e;
	color: #ececec;
	border: 1px solid #3a3a3a;
	border-radius: 3px;
	height: 2.4rem;
	padding: 0 10px;
	font-size: 0.9rem;
	width: auto;
	display: inline-block;
}

select.auction__sort:focus {
	outline: none;
	border-color: #ff7043;
}

select.auction__sort option {
	background-color: #1e1e1e;
	color: #ececec;
}

/* ---- Layout ---- */

.auction__layout {
	display: grid;
	grid-template-columns: 210px minmax(0, 1fr);
	gap: 26px;
	/* No align-items:start here. A sticky element can only travel inside its
	   own containing block, so the column must stretch to full height --
	   otherwise the rail's box is exactly its own height and it never sticks. */
	align-items: stretch;
}

@media only screen and (max-width: 992px) {
	.auction__layout {
		grid-template-columns: 1fr;
	}
}

/* ---- Filter rail ---- */

.auction__filters-col {
	min-width: 0;
}

.auction__filters {
	background-color: #161616;
	border: 1px solid #262626;
	border-radius: 4px;
	padding: 16px 16px 8px;
	position: sticky;
	top: 16px;
}

@media only screen and (max-width: 992px) {
	.auction__filters {
		position: static;
	}
}

.auction__filter-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 14px;
}

.auction__filter-head h6 {
	margin: 0;
	font-size: 0.8rem;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: #ff8a65;
}

.auction__reset {
	background: none;
	border: none;
	color: #9e9e9e;
	font-size: 0.78rem;
	cursor: pointer;
	padding: 2px 4px;
	text-decoration: underline;
}

.auction__reset:hover {
	color: #ff7043;
}

.auction__group {
	padding-bottom: 14px;
	margin-bottom: 14px;
	border-bottom: 1px solid #242424;
}

.auction__group:last-child {
	border-bottom: none;
}

.auction__group-title {
	display: block;
	font-size: 0.74rem;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: #8a8a8a;
	margin-bottom: 9px;
}

.auction__range {
	display: flex;
	gap: 8px;
}

.auction__range label {
	flex: 1 1 0;
	display: block;
}

.auction__range span {
	display: block;
	font-size: 0.7rem;
	color: #757575;
	margin-bottom: 2px;
}

.auction__range input {
	width: 100%;
	height: 2rem;
	margin: 0;
	padding: 0 7px;
	background-color: #1e1e1e;
	border: 1px solid #3a3a3a;
	border-radius: 3px;
	color: #ececec;
	font-size: 0.88rem;
	box-sizing: border-box;
}

.auction__range input:focus {
	outline: none;
	border-color: #ff7043;
	box-shadow: none;
}

/* Materialize hides real checkboxes and draws its own box with :before/:after
   on the following span. Un-hiding the input without suppressing that box
   renders TWO boxes per filter, so both halves are needed here. */
.auction__check {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 5px 0;
	cursor: pointer;
	color: #cfcfcf;
	font-size: 0.88rem;
	line-height: 1.35;
}

.auction__check input[type="checkbox"] {
	position: static;
	opacity: 1;
	pointer-events: auto;
	width: 15px;
	height: 15px;
	min-width: 15px;
	margin: 1px 0 0;
	accent-color: #ff7043;
	cursor: pointer;
	/* Materialize sets left:-9999px on bare checkboxes. */
	left: auto;
}

/* Kill Materialize's drawn box and its label offset. */
.auction__check input[type="checkbox"] + span {
	padding-left: 0;
	line-height: 1.35;
}

.auction__check input[type="checkbox"] + span::before,
.auction__check input[type="checkbox"] + span::after {
	display: none !important;
	content: none !important;
}

.auction__check:hover {
	color: #fff;
}

/* ---- Server card ---- */

.auction__results {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.srv {
	display: grid;
	grid-template-columns: 116px minmax(0, 1fr) 168px;
	gap: 18px;
	align-items: center;
	background-color: #161616;
	border: 1px solid #272727;
	border-left: 3px solid #333;
	border-radius: 4px;
	padding: 16px 18px;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.srv:hover {
	border-color: #3d3d3d;
	border-left-color: #ff7043;
	background-color: #191919;
}

.srv--featured {
	border-left-color: #ff7043;
}

/* `display: grid` above is an author rule and therefore beats the user-agent
   `[hidden] { display: none }`, so filtered-out cards would stay visible
   without this. Same reason the empty-state paragraph needs it. */
.srv[hidden],
.auction__empty[hidden] {
	display: none !important;
}

/* Dimmed, but still legible: a sold-out box is useful information about what
   we stock, so the specs should stay readable. The stock label keeps full
   contrast so the state is unmistakable. */
.srv--gone {
	opacity: 0.62;
}

.srv--gone .srv__stock {
	opacity: 1;
	font-weight: 500;
}

.srv--gone:hover {
	border-left-color: #333;
}

@media only screen and (max-width: 768px) {
	.srv {
		grid-template-columns: 1fr;
		gap: 14px;
		text-align: center;
	}
}

/* Vendor block */

.srv__vendor {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
}

.srv__vendor img {
	width: 88px;
	max-width: 100%;
}

.srv__vendor-text {
	font-size: 1rem;
	color: #e0e0e0;
}

.srv__chassis {
	font-size: 0.76rem;
	color: #8a8a8a;
	letter-spacing: 0.03em;
}

.srv__tag {
	font-size: 0.62rem;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	padding: 2px 7px;
	border-radius: 2px;
	font-weight: 500;
}

.srv__tag {
	font-variant-numeric: tabular-nums;
	cursor: help;
}

/* Grade colour tracks the letter, so the scale reads without a legend. */
.srv__tag--a { background-color: #1b5e20; color: #c8e6c9; }
.srv__tag--b { background-color: #4e342e; color: #ffccbc; }

/* Spec grid */

.srv__specs {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 14px;
}

@media only screen and (max-width: 1200px) {
	.srv__specs {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media only screen and (max-width: 992px) {
	.srv__specs {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media only screen and (max-width: 480px) {
	.srv__specs {
		grid-template-columns: 1fr;
	}
}

.srv__spec {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.srv__k {
	font-size: 0.66rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #7c7c7c;
}

.srv__v {
	font-size: 0.93rem;
	color: #ececec;
	line-height: 1.35;
}

.srv__badges {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 2px;
	/* `inherit` here resolved to the flex-column default, pinning badges to the
	   left edge of a full-width cell on mobile instead of following the card's
	   centred text. Set it explicitly per breakpoint instead. */
	justify-content: flex-start;
}

.srv__badge {
	display: inline-block;
	background-color: #bf360c;
	color: #fff;
	border-radius: 2px;
	padding: 1px 5px;
	font-size: 0.62rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	white-space: nowrap;
}

/* Buy block */

.srv__buy {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
	text-align: right;
}

@media only screen and (max-width: 768px) {
	.srv__buy {
		align-items: center;
		text-align: center;
	}

	.srv__badges {
		justify-content: center;
	}

	.srv__spec {
		align-items: center;
	}
}

.srv__stock {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #81c784;
}

.srv__stock--out {
	color: #ef9a9a;
}

.srv__price {
	font-size: 1.75rem;
	line-height: 1;
	color: #fff;
	font-weight: 300;
}

.srv__per {
	font-size: 0.82rem;
	color: #9e9e9e;
	font-weight: 400;
}

.srv__order {
	width: 100%;
	max-width: 160px;
}

.srv__note {
	color: #8a8a8a;
	font-size: 0.74rem;
	max-width: 170px;
}

/* ---- Empty state ---- */

.auction__empty {
	text-align: center;
	color: #9e9e9e;
	padding: 40px 12px;
	background-color: #161616;
	border: 1px dashed #303030;
	border-radius: 4px;
}

.auction__foot {
	margin-top: 26px;
	color: #8a8a8a;
	font-size: 0.88rem;
	text-align: center;
}

.auction__foot a {
	color: #ff8a65;
}

/* ---- Promo popup ----
   Bottom-right, dismissible. The countdown reflects a real FOSSBilling expiry,
   so when it reaches zero the code has genuinely stopped working. */

.promo {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 1000;
	width: 290px;
	max-width: calc(100vw - 32px);
	padding: 18px 18px 16px;
	background: linear-gradient(160deg, #1d1d1d, #141414);
	border: 1px solid #333;
	border-left: 3px solid #ff7043;
	border-radius: 5px;
	box-shadow: 0 10px 32px rgba(0, 0, 0, 0.6);
	opacity: 0;
	transform: translateY(14px);
	transition: opacity 0.24s ease, transform 0.24s ease;
}

.promo--in {
	opacity: 1;
	transform: translateY(0);
}

.promo--expired {
	border-left-color: #616161;
	opacity: 0.75;
}

.promo__close {
	position: absolute;
	top: 6px;
	right: 8px;
	background: none;
	border: none;
	color: #8a8a8a;
	font-size: 1.3rem;
	line-height: 1;
	cursor: pointer;
	padding: 4px 6px;
}

.promo__close:hover {
	color: #fff;
}

.promo__head {
	display: flex;
	align-items: baseline;
	gap: 7px;
	margin-bottom: 12px;
}

.promo__pct {
	font-size: 1.5rem;
	color: #ff7043;
	font-weight: 500;
	line-height: 1;
}

.promo__lede {
	color: #bdbdbd;
	font-size: 0.85rem;
}

.promo__coderow {
	display: flex;
	align-items: stretch;
	gap: 8px;
	margin-bottom: 10px;
}

.promo__code {
	flex: 1 1 auto;
	background-color: #0e0e0e;
	border: 1px dashed #4a4a4a;
	border-radius: 3px;
	padding: 8px 10px;
	font-family: "Roboto Mono", Menlo, Consolas, monospace;
	font-size: 1rem;
	letter-spacing: 0.09em;
	color: #ffd7c7;
	text-align: center;
	user-select: all;
}

.promo__copy {
	flex: 0 0 auto;
	background-color: #bf360c;
	color: #fff;
	border: none;
	border-radius: 3px;
	padding: 0 13px;
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	cursor: pointer;
}

.promo__copy:hover {
	background-color: #ff7043;
}

.promo__timer {
	font-size: 0.85rem;
	color: #9e9e9e;
}

.promo__clock {
	color: #81c784;
	font-variant-numeric: tabular-nums;
}

.promo--urgent .promo__clock {
	color: #ff8a65;
}

.promo__note {
	margin: 8px 0 0;
	font-size: 0.72rem;
	color: #7c7c7c;
	line-height: 1.4;
}

@media only screen and (max-width: 600px) {
	.promo {
		right: 12px;
		left: 12px;
		bottom: 12px;
		width: auto;
	}
}

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