/*
 * iSign AirGap site styles.
 * A deep green cover panel (white pen stroke from the logo) beside white sheets.
 * Form fields are signature lines rather than boxes.
 */

@font-face {
	font-family: "Public Sans";
	src: url("../fonts/public-sans-latin.woff2") format("woff2");
	font-weight: 400 700;
	font-style: normal;
	font-display: swap;
}

:root {
	color-scheme: light;

	--ink: #14231a;
	--ink-soft: #4a5a4f;
	--signing-green: #1e6b35;
	--signing-green-dark: #17552a;
	--brand-green: #47b862;
	--sage: #e7eee9;
	--sage-deep: #d6e1d9;
	--paper: #ffffff;
	--line: #9db0a2;
	--line-soft: #dbe3dd;
	--error: #b3261e;
	--error-wash: #fbeceb;

	--font: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	--measure: 34rem;
	--radius: 10px;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: var(--sage);
	color: var(--ink);
	font-family: var(--font);
	font-size: 1.0625rem; /* 17px */
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

a {
	color: var(--signing-green);
	text-underline-offset: 0.15em;
}

a:hover {
	color: var(--signing-green-dark);
}

:focus-visible {
	outline: 3px solid var(--brand-green);
	outline-offset: 2px;
}

/* Page frame -------------------------------------------------------------- */

.masthead,
.split,
.stack,
.colophon {
	width: 100%;
	max-width: 68rem;
	margin-inline: auto;
	padding-inline: 1.5rem;
}

.masthead {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding-block: 1.25rem;
}

/* The logo PNG has a wide white margin around the green disc; clip to the disc. */
.masthead-logo {
	width: 4.5rem;
	height: 4.5rem;
	margin: -1rem;
	clip-path: circle(28.5% at 50% 50%);
}

.masthead-name {
	font-weight: 700;
	font-size: 1.125rem;
	letter-spacing: -0.005em;
}

.masthead-action {
	margin: 0 0 0 auto;
}

.colophon {
	margin-top: auto;
	padding-bottom: 1.5rem;
	color: var(--ink-soft);
	font-size: 0.8125rem;
}

.colophon p {
	margin: 0;
}

/* Cover panel beside a sheet ---------------------------------------------- */

.split {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
	align-items: stretch;
	padding-bottom: 2.5rem;
}

/* Inside .stack the split is already padded by its parent. */
.stack .split {
	padding-inline: 0;
	padding-bottom: 0;
}

.cover,
.sheet {
	padding: clamp(1.75rem, 4vw, 3.25rem);
}

.cover {
	background: var(--signing-green);
	color: var(--paper);
	border-radius: var(--radius) 0 0 var(--radius);
}

.cover h1 {
	margin: 0;
	font-size: clamp(2.125rem, 3.6vw, 3rem);
	line-height: 1.08;
	font-weight: 700;
	letter-spacing: -0.02em;
	max-width: 14ch;
	text-wrap: balance;
}

.pen-stroke {
	display: block;
	width: min(15rem, 100%);
	height: auto;
	margin: 1.25rem 0 1.5rem;
	overflow: visible;
}

.pen-stroke path {
	fill: none;
	stroke: var(--paper);
	stroke-width: 5;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-dasharray: 1;
	stroke-dashoffset: 1;
	animation: draw-stroke 1.4s cubic-bezier(0.55, 0.1, 0.25, 1) 0.25s forwards;
}

@keyframes draw-stroke {
	to {
		stroke-dashoffset: 0;
	}
}

.cover-lede {
	margin: 0 0 2rem;
	max-width: 26ch;
	font-size: 1.1875rem;
	line-height: 1.45;
}

.cover-lede:last-child {
	margin-bottom: 0;
}

/* The three-step journey: a real sequence, so the numbers carry meaning. */
.steps {
	list-style: none;
	margin: 0;
	padding: 0;
	counter-reset: step;
	border-top: 1px solid rgb(255 255 255 / 0.28);
}

.steps li {
	counter-increment: step;
	display: grid;
	grid-template-columns: 2rem 1fr;
	column-gap: 0.5rem;
	padding: 0.875rem 0;
	border-bottom: 1px solid rgb(255 255 255 / 0.28);
	color: rgb(255 255 255 / 0.78);
}

.steps li::before {
	content: counter(step);
	grid-row: span 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.5rem;
	height: 1.5rem;
	border-radius: 50%;
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.steps strong {
	font-weight: 600;
	color: var(--paper);
}

.steps span {
	font-size: 0.9375rem;
}

.steps li[aria-current="step"] {
	color: var(--paper);
}

.steps li[aria-current="step"]::before {
	background: var(--paper);
	color: var(--signing-green);
}

.steps li.done::before {
	content: "\2713"; /* check mark */
	border: 1.5px solid rgb(255 255 255 / 0.78);
}

/* Sheets ------------------------------------------------------------------ */

.sheet {
	background: var(--paper);
	border-radius: 0 var(--radius) var(--radius) 0;
}

.stack {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	padding-bottom: 2.5rem;
}

.stack > .sheet {
	border-radius: var(--radius);
}

.sheet h2 {
	margin: 0 0 1.75rem;
	font-size: 1.3125rem;
	font-weight: 700;
	letter-spacing: -0.005em;
}

.sheet-lede {
	margin: -1rem 0 1.75rem;
	color: var(--ink-soft);
	max-width: var(--measure);
}

.sheet-note {
	margin: 1.25rem 0 0;
	color: var(--ink-soft);
	font-size: 0.875rem;
	max-width: 30rem;
}

/* Sheet whose content sits in the vertical middle (the download box). */
.sheet-centered {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: flex-start;
}

/* Messages ---------------------------------------------------------------- */

.alert,
.notice {
	margin: 0 0 1.5rem;
	padding: 0.75rem 1rem;
	font-weight: 600;
	font-size: 0.9375rem;
	max-width: var(--measure);
}

.alert {
	border-left: 3px solid var(--error);
	background: var(--error-wash);
	color: var(--error);
}

.notice {
	border-left: 3px solid var(--signing-green);
	background: var(--sage);
	color: var(--ink);
}

/* Form fields: signature lines -------------------------------------------- */

.field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 1.75rem;
	max-width: var(--measure);
}

.field {
	margin-bottom: 1.75rem;
	max-width: var(--measure);
}

.field label,
.tiers legend,
.tiers-label {
	display: block;
	margin-bottom: 0.25rem;
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--ink-soft);
}

.field input {
	display: block;
	width: 100%;
	padding: 0.375rem 0 0.5rem;
	border: 0;
	border-bottom: 2px solid var(--line);
	border-radius: 0;
	background: transparent;
	color: var(--ink);
	font: inherit;
	font-size: 1.125rem;
	transition: border-color 0.15s ease;
}

.field input:hover {
	border-bottom-color: var(--ink-soft);
}

.field input:focus {
	outline: none;
	border-bottom-color: var(--signing-green);
	box-shadow: 0 2px 0 var(--signing-green);
}

.field-hint {
	margin: 0.375rem 0 0;
	color: var(--ink-soft);
	font-size: 0.875rem;
}

.field-error {
	margin: 0.375rem 0 0;
	color: var(--error);
	font-size: 0.875rem;
	font-weight: 600;
}

.has-error input {
	border-bottom-color: var(--error);
}

.has-error label,
.has-error legend {
	color: var(--error);
}

/* Account details: read-only values on signature lines --------------------- */

.details {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 1.75rem;
	margin: 0 0 1.75rem;
	max-width: var(--measure);
}

.detail {
	margin-bottom: 1.25rem;
	min-width: 0;
}

.detail dt {
	margin-bottom: 0.25rem;
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--ink-soft);
}

.detail dd {
	margin: 0;
	padding: 0.375rem 0 0.5rem;
	border-bottom: 2px solid var(--line-soft);
	color: var(--ink);
	font-size: 1.125rem;
	overflow-wrap: anywhere;
}

/* Signature limit chips (radio group) ------------------------------------- */

.tiers {
	margin: 0 0 2.25rem;
	padding: 0;
	border: 0;
	min-width: 0;
	max-width: var(--measure);
}

.tiers legend {
	padding: 0;
	margin-bottom: 0.625rem;
}

.tier-options {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(0, 1.8fr);
	gap: 0.5rem;
}

/* Radios stay in the tab order and keep arrow-key behavior; the label is the visible control. */
.tier-input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
}

.tier {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 2.75rem;
	padding: 0 0.5rem;
	border: 1.5px solid var(--line);
	border-radius: 4px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	color: var(--ink);
	cursor: pointer;
	user-select: none;
	transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.tier:hover {
	border-color: var(--signing-green);
}

.tier-input:checked + .tier {
	background: var(--signing-green);
	border-color: var(--signing-green);
	color: var(--paper);
}

/* Read-only limits for a signed-in user: not clickable, the saved one filled in. */
.tier-options-static {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tiers-label {
	margin: 0 0 0.625rem;
}

.tier-static {
	cursor: default;
	color: var(--ink-soft);
	border-color: var(--line-soft);
}

.tier-static:hover {
	border-color: var(--line-soft);
}

.tier-static.tier-current {
	background: var(--signing-green);
	border-color: var(--signing-green);
	color: var(--paper);
}

.tier-input:focus-visible + .tier {
	outline: 3px solid var(--brand-green);
	outline-offset: 2px;
}

/* Buttons ----------------------------------------------------------------- */

.button {
	display: inline-block;
	padding: 0.875rem 1.75rem;
	border: 0;
	border-radius: 4px;
	background: var(--signing-green);
	color: var(--paper);
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.button:hover {
	background: var(--signing-green-dark);
	color: var(--paper);
}

.button:active {
	transform: translateY(1px);
}

.button:focus-visible {
	outline-offset: 3px;
}

.button-large {
	padding: 1.125rem 2rem;
	font-size: 1.1875rem;
}

.button-quiet {
	padding: 0.5rem 1rem;
	border: 1.5px solid var(--line);
	border-radius: 4px;
	background: transparent;
	color: var(--ink);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	cursor: pointer;
}

.button-quiet:hover {
	border-color: var(--signing-green);
	color: var(--signing-green);
}

/* Install guide ----------------------------------------------------------- */

.guide-steps {
	list-style: none;
	margin: 0;
	padding: 0;
	counter-reset: guide;
	max-width: 54rem;
}

.guide-steps > li {
	counter-increment: guide;
	position: relative;
	padding: 0 0 2.25rem 3.25rem;
}

/* Number in a ring, joined to the next step by a thin line. */
.guide-steps > li::before {
	content: counter(guide);
	position: absolute;
	left: 0;
	top: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border: 2px solid var(--signing-green);
	border-radius: 50%;
	color: var(--signing-green);
	font-weight: 700;
	font-size: 0.9375rem;
	font-variant-numeric: tabular-nums;
	background: var(--paper);
}

.guide-steps > li:not(:last-child)::after {
	content: "";
	position: absolute;
	left: calc(1rem - 1px);
	top: 2.25rem;
	bottom: 0.25rem;
	width: 2px;
	background: var(--line-soft);
}

.guide-steps > li:last-child {
	padding-bottom: 0;
}

.guide-steps h3 {
	margin: 0.125rem 0 0.25rem;
	font-size: 1.125rem;
	font-weight: 600;
}

.guide-steps p {
	margin: 0 0 0.75rem;
	color: var(--ink-soft);
	max-width: var(--measure);
}

.guide-steps ul {
	margin: 0 0 1rem;
	padding-left: 1.25rem;
	color: var(--ink-soft);
	max-width: var(--measure);
}

.guide-steps ul li {
	margin-bottom: 0.25rem;
}

.guide-steps ul strong {
	color: var(--ink);
	font-weight: 600;
}

.guide-steps figure {
	margin: 0;
}

/* Screenshots shown at natural size (never stretched), framed like a window. */
.guide-steps img {
	display: block;
	max-width: 100%;
	height: auto;
	border: 1px solid var(--line-soft);
	border-radius: 6px;
	box-shadow: 0 1px 0 var(--line-soft);
}

/* Admin ledger ------------------------------------------------------------ */

.ledger-head h1 {
	margin: 0 0 0.25rem;
	font-size: clamp(1.75rem, 3vw, 2.25rem);
	line-height: 1.15;
	letter-spacing: -0.015em;
}

.ledger-head .sheet-lede {
	margin: 0 0 1.75rem;
}

.table-scroll {
	overflow-x: auto;
	margin-inline: -0.5rem;
	padding-inline: 0.5rem;
}

.registrations {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
}

.registrations th,
.registrations td {
	padding: 0.75rem 1rem 0.75rem 0;
	text-align: left;
	vertical-align: baseline;
	white-space: nowrap;
}

.registrations th {
	border-bottom: 2px solid var(--ink);
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--ink-soft);
}

.registrations td {
	border-bottom: 1px solid var(--line-soft);
}

.registrations tbody tr:hover {
	background: var(--sage);
}

.registrations .num {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.registrations .muted {
	color: var(--ink-soft);
}

.empty {
	padding: 2rem 0 0.5rem;
	border-top: 1px solid var(--line-soft);
}

.empty p {
	margin: 0 0 1.25rem;
	max-width: var(--measure);
}

/* Admin: editing a registration ------------------------------------------- */

/* Text for screen readers only (e.g. which person an "Edit" link is for). */
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.registrations .row-action {
	text-align: right;
	padding-right: 0;
}

.registrations .row-action a {
	font-weight: 600;
}

.edit-sheet {
	max-width: 46rem;
}

.edit-sheet h1 {
	margin: 0.75rem 0 1.25rem;
	font-size: clamp(1.75rem, 3vw, 2.25rem);
	line-height: 1.15;
	letter-spacing: -0.015em;
}

.back-link {
	font-size: 0.9375rem;
	font-weight: 600;
}

.admin-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
}

.admin-accounts {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 2rem;
}

.admin-accounts .row-action {
	text-align: right;
	padding-right: 0;
}

.admin-accounts .row-action a {
	color: var(--error);
	font-weight: 600;
}

.admin-accounts .row-action a.grant-link {
	color: var(--signing-green);
	margin-right: 1rem;
}

.admin-accounts .row-action a.demote-link {
	color: var(--ink);
	margin-right: 1rem;
}

.button-danger {
	background: var(--error);
	border-color: var(--error);
}

.button-danger:hover {
	background: #8c1d17;
	border-color: #8c1d17;
}

.admin-accounts th,
.admin-accounts td {
	padding: 0.5rem 0.75rem 0.5rem 0;
	border-bottom: 1px solid var(--line);
	text-align: left;
}

.form-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
}

a.button-quiet {
	display: inline-block;
	padding: 0.8125rem 1.5rem;
	font-size: 1rem;
	text-decoration: none;
}

/* Small screens ----------------------------------------------------------- */

@media (max-width: 52rem) {
	.split {
		grid-template-columns: 1fr;
	}

	.cover {
		border-radius: var(--radius) var(--radius) 0 0;
	}

	.sheet {
		border-radius: 0 0 var(--radius) var(--radius);
	}

	.cover h1 {
		max-width: none;
	}
}

@media (max-width: 30rem) {
	.masthead,
	.split,
	.stack,
	.colophon {
		padding-inline: 1rem;
	}

	.stack .split {
		padding-inline: 0;
	}

	.field-row,
	.details {
		grid-template-columns: 1fr;
	}

	.tier-options {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.split .button {
		width: 100%;
	}

	.guide-steps > li {
		padding-left: 2.75rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pen-stroke path {
		animation: none;
		stroke-dashoffset: 0;
	}

	.field input,
	.tier,
	.button {
		transition: none;
	}
}
