/*
 * Free Sites
 *
 * Visual direction: two-colour risograph printing. A publishing tool ought to
 * look like it came off a press — flat inks, a hard yellow highlight used the
 * way a marker is used, and no gradients or glass anywhere.
 */

:root {
	--ink: #14342e;
	--ink-soft: #4a635c;
	--paper: #fbf8f0;
	--paper-sunk: #f2ede0;
	--rule: #d9d2c0;
	--blue: #2c5f6b;
	--blue-deep: #1d434c;
	--yellow: #f2c230;
	--red: #d6453a;
	--green: #3f7d55;

	--sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
		"Helvetica Neue", Arial, sans-serif;
	--serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
	--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

	--rail: 340px;
	--radius: 3px;
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
	margin: 0;
}

body {
	font-family: var(--sans);
	background: var(--paper);
	color: var(--ink);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

/* ---------- Type ---------- */

.eyebrow {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--ink-soft);
	margin: 0 0 10px;
}

h1,
h2,
h3 {
	margin: 0;
	line-height: 1.08;
	letter-spacing: -0.02em;
	font-weight: 800;
}

h1 {
	font-size: clamp(38px, 7vw, 62px);
}

h2 {
	font-size: 22px;
}

h3 {
	font-size: 15px;
	letter-spacing: 0;
}

.lede {
	font-family: var(--serif);
	font-size: 18px;
	line-height: 1.55;
	color: var(--ink-soft);
}

/* The yellow is a marker, not a background. It sits behind words. */
.mark {
	background: linear-gradient(
		transparent 58%,
		var(--yellow) 58%,
		var(--yellow) 94%,
		transparent 94%
	);
	padding: 0 2px;
}

/* ---------- Controls ---------- */

.btn {
	font: inherit;
	font-weight: 650;
	border: 1.5px solid var(--ink);
	background: var(--paper);
	color: var(--ink);
	padding: 10px 16px;
	border-radius: var(--radius);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	transition: transform 0.08s ease, box-shadow 0.08s ease;
	box-shadow: 2px 2px 0 var(--ink);
}

.btn:hover:not(:disabled) {
	transform: translate(-1px, -1px);
	box-shadow: 3px 3px 0 var(--ink);
}

.btn:active:not(:disabled) {
	transform: translate(1px, 1px);
	box-shadow: 1px 1px 0 var(--ink);
}

.btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	box-shadow: 2px 2px 0 var(--rule);
	border-color: var(--ink-soft);
}

.btn-primary {
	background: var(--blue);
	border-color: var(--blue-deep);
	color: #fff;
	box-shadow: 2px 2px 0 var(--ink);
}

.btn-publish {
	background: var(--yellow);
	border-color: var(--ink);
	color: var(--ink);
	width: 100%;
	justify-content: center;
	font-size: 16px;
	padding: 13px 16px;
}

.btn-quiet {
	border: 1.5px solid transparent;
	box-shadow: none;
	padding: 6px 10px;
	font-weight: 600;
	color: var(--ink-soft);
}

.btn-quiet:hover:not(:disabled) {
	box-shadow: none;
	transform: none;
	color: var(--ink);
	border-color: var(--rule);
}

.btn:focus-visible,
input:focus-visible,
a:focus-visible {
	outline: 3px solid var(--blue);
	outline-offset: 2px;
}

label {
	display: block;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--ink-soft);
	margin-bottom: 6px;
}

input[type='text'],
input[type='url'],
select {
	font: inherit;
	width: 100%;
	padding: 10px 12px;
	border: 1.5px solid var(--rule);
	border-radius: var(--radius);
	background: var(--paper);
	color: var(--ink);
}

input[type='text']:focus,
input[type='url']:focus,
select:focus {
	border-color: var(--blue);
}

.field {
	margin-bottom: 16px;
}

.hint {
	font-size: 13px;
	color: var(--ink-soft);
	margin: 6px 0 0;
}

/* ---------- Landing ---------- */

.landing {
	min-height: 100%;
	display: grid;
	place-items: center;
	padding: 32px 24px 64px;
}

.landing-inner {
	width: min(720px, 100%);
}

.wordmark {
	display: flex;
	align-items: baseline;
	gap: 10px;
	margin-bottom: 40px;
}

.wordmark strong {
	font-size: 17px;
	font-weight: 800;
	letter-spacing: -0.01em;
}

.wordmark span {
	font-size: 11px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--ink-soft);
}

.landing h1 {
	margin-bottom: 18px;
}

.landing .lede {
	max-width: 46ch;
	margin-bottom: 32px;
}

.card {
	border: 1.5px solid var(--ink);
	border-radius: var(--radius);
	background: var(--paper);
	box-shadow: 4px 4px 0 var(--ink);
	padding: 24px;
}

.facts {
	list-style: none;
	margin: 32px 0 0;
	padding: 0;
	display: grid;
	gap: 1px;
	background: var(--rule);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	overflow: hidden;
}

.facts li {
	background: var(--paper);
	padding: 14px 16px;
	display: flex;
	gap: 14px;
	align-items: baseline;
	font-size: 14px;
}

.facts b {
	font-family: var(--mono);
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--blue);
	min-width: 86px;
	flex: none;
}

.project-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.project-list li + li {
	margin-top: 8px;
}

.project-row {
	width: 100%;
	text-align: left;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
}

.project-row small {
	color: var(--ink-soft);
	font-weight: 500;
}

/* ---------- Workspace ---------- */

.workspace {
	display: grid;
	grid-template-columns: var(--rail) 1fr;
	height: 100%;
}

.rail {
	border-right: 1.5px solid var(--ink);
	background: var(--paper-sunk);
	display: flex;
	flex-direction: column;
	overflow-y: auto;
}

.rail-head {
	padding: 18px 20px;
	border-bottom: 1px solid var(--rule);
}

.rail-head h2 {
	font-size: 19px;
	word-break: break-word;
}

.rail-section {
	padding: 18px 20px;
	border-bottom: 1px solid var(--rule);
}

.rail-foot {
	margin-top: auto;
	padding: 14px 20px;
	border-top: 1px solid var(--rule);
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 13px;
	color: var(--ink-soft);
}

.stage {
	position: relative;
	background: var(--paper-sunk);
}

.stage iframe {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
	background: #fff;
}

.boot {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	background: var(--paper);
	z-index: 5;
	text-align: center;
	padding: 24px;
}

.boot[hidden] {
	display: none;
}

.boot-bar {
	width: 260px;
	height: 8px;
	border: 1.5px solid var(--ink);
	border-radius: 99px;
	overflow: hidden;
	margin: 18px auto 10px;
	background: var(--paper);
}

.boot-bar i {
	display: block;
	height: 100%;
	background: var(--yellow);
	width: 12%;
	transition: width 0.3s ease;
}

/* ---------- The publish ledger ---------- */

/*
 * The signature element. A deploy writes real files to a repo the person owns,
 * so the interface shows the manifest the way a press shows a proof: counted,
 * itemised, and legible.
 */
.ledger {
	font-family: var(--mono);
	font-size: 12px;
	border: 1.5px solid var(--ink);
	border-radius: var(--radius);
	background: var(--paper);
	overflow: hidden;
}

.ledger-head {
	display: flex;
	justify-content: space-between;
	padding: 8px 12px;
	background: var(--ink);
	color: var(--paper);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	font-size: 10px;
}

.ledger-rows {
	max-height: 190px;
	overflow-y: auto;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ledger-rows li {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	padding: 5px 12px;
	border-bottom: 1px solid var(--paper-sunk);
}

.ledger-rows li:last-child {
	border-bottom: 0;
}

.ledger-rows .path {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ledger-rows .tag {
	flex: none;
	font-size: 10px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ink-soft);
}

.ledger-rows .tag.new {
	color: var(--blue);
	font-weight: 700;
}

.ledger-total {
	display: flex;
	justify-content: space-between;
	padding: 8px 12px;
	border-top: 1.5px solid var(--ink);
	background: var(--paper-sunk);
	font-weight: 700;
}

/* ---------- Status ---------- */

.status {
	font-size: 13px;
	padding: 10px 12px;
	border-radius: var(--radius);
	border-left: 4px solid var(--blue);
	background: var(--paper);
	margin-top: 12px;
}

.status.error {
	border-left-color: var(--red);
}

.status.ok {
	border-left-color: var(--green);
}

.status.warn {
	border-left-color: var(--yellow);
}

.live-url {
	display: block;
	font-family: var(--mono);
	font-size: 12px;
	word-break: break-all;
	color: var(--blue);
	margin-top: 6px;
}

.spinner {
	width: 13px;
	height: 13px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	display: inline-block;
	animation: spin 0.7s linear infinite;
	vertical-align: -2px;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

.toggle {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	text-transform: none;
	letter-spacing: 0;
	font-weight: 600;
	color: var(--ink);
	cursor: pointer;
	margin-bottom: 12px;
}

.toggle input {
	width: 16px;
	height: 16px;
	accent-color: var(--blue);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
	.workspace {
		grid-template-columns: 1fr;
		grid-template-rows: auto 1fr;
		height: auto;
		min-height: 100%;
	}

	.rail {
		border-right: 0;
		border-bottom: 1.5px solid var(--ink);
	}

	.stage {
		min-height: 70vh;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}

[hidden] {
	display: none !important;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

code {
	font-family: var(--mono);
	font-size: 0.9em;
	background: var(--paper);
	border: 1px solid var(--rule);
	border-radius: 2px;
	padding: 1px 4px;
}

#saveState {
	font-family: var(--mono);
	font-size: 11px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

#saveState[data-state='pending'],
#saveState[data-state='saving'] {
	color: var(--blue);
}

#saveState[data-state='error'] {
	color: var(--red);
}

#saveState[data-state='local-only'],
#saveState[data-state='offline'] {
	color: var(--ink-soft);
}
