/* Twofold client pages. Ported from the UI mockups (twofold.css, "Client phone").
   Carved sand behind everything. Words only ever sit on solid paper: a message from the advisor,
   then one card that holds the decision, then the actions below it. Content sits low, where a
   thumb reaches and the eye lands. No inline styles anywhere: the CSP forbids them. */

@font-face {
	font-family: "Atkinson Hyperlegible Next";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("/static/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2");
}

@font-face {
	font-family: "Atkinson Hyperlegible Next";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("/static/fonts/atkinson-hyperlegible-next-latin-700-normal.woff2") format("woff2");
}

@font-face {
	font-family: "DM Mono";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("/static/fonts/dm-mono-latin-400-normal.woff2") format("woff2");
}

:root {
	color-scheme: light dark;
	--tf-ink: #111111;
	--tf-muted: #4a4844;
	--tf-primary: #111111;
	--tf-on-primary: #ffffff;
	--tf-secondary: #ebe6de;
	--tf-panel: #f3efe8;
	--tf-line: #e4dfd6;
	--tf-line-strong: #cbc4b8;
	--tf-ok: #1d6b45;
	--tf-ok-bg: #e5f1e9;
	--tf-wait: #8a5200;
	--tf-wait-bg: #fbf0d9;
	--tf-stop: #b3261e;
	--tf-stop-bg: #fbe8e5;
	--tf-stone: url("/static/img/sand.jpg");
	--tf-stone-fallback: #bab09f;
	--tf-c-card: rgba(255, 253, 249, 0.95);
	--tf-c-halo: rgba(255, 255, 255, 0.38);
	--tf-c-glass: rgba(255, 253, 249, 0.7);
	--tf-c-glass-line: rgba(255, 255, 255, 0.8);

	--tf-sans: "Hanken Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
	--tf-client: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Helvetica Neue", Arial, sans-serif;
	--tf-mono: "DM Mono", Menlo, Consolas, monospace;
	--tf-firm: #22574a;
	--tf-firm-ink: #ffffff;
	--tf-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
	--tf-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
	--tf-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
	--tf-press: 160ms;
}

@media (prefers-color-scheme: dark) {
	:root {
		--tf-ink: #eee9df;
		--tf-muted: #c4bdb1;
		--tf-primary: #eee9df;
		--tf-on-primary: #0d0c0a;
		--tf-secondary: #26221d;
		--tf-panel: #1a1714;
		--tf-line: rgba(255, 244, 228, 0.09);
		--tf-line-strong: rgba(255, 244, 228, 0.2);
		--tf-ok: #7fd3a0;
		--tf-ok-bg: #12271b;
		--tf-wait: #efb764;
		--tf-wait-bg: #2b2210;
		--tf-stop: #ff9488;
		--tf-stop-bg: #36161a;
		--tf-stone: url("/static/img/sand-dark.jpg");
		--tf-stone-fallback: #433829;
		--tf-c-card: rgba(22, 20, 17, 0.94);
		--tf-c-halo: rgba(255, 255, 255, 0.07);
		--tf-c-glass: rgba(14, 13, 12, 0.55);
		--tf-c-glass-line: rgba(255, 255, 255, 0.14);
	}
}

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

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

body {
	background: var(--tf-stone-fallback) var(--tf-stone) center / cover no-repeat fixed;
	color: var(--tf-ink);
	-webkit-text-size-adjust: 100%;
}

[hidden] {
	display: none !important;
}

/* A page with two screens (review and tap) keeps the column layout inside each. */
[data-screen-part] {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 12px;
}

.tf-client {
	display: flex;
	flex-direction: column;
	gap: 12px;
	max-width: 480px;
	min-height: 100%;
	min-height: 100dvh;
	margin: 0 auto;
	padding: max(14px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
	font: 400 19px/1.45 var(--tf-client);
}

.tf-c-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

/* The firm leads: its color lives only in this small tile. */
.tf-c-firm {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 5px 16px 5px 5px;
	border: 1px solid var(--tf-c-glass-line);
	border-radius: 999px;
	background: var(--tf-c-glass);
	-webkit-backdrop-filter: blur(16px);
	backdrop-filter: blur(16px);
	font-size: 16px;
	line-height: 20px;
	font-weight: 700;
}

.tf-c-firm__tile {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--tf-firm);
	color: var(--tf-firm-ink);
	font-size: 12px;
}

.tf-c-chip {
	padding: 6px 12px;
	border: 1px solid var(--tf-c-glass-line);
	border-radius: 999px;
	background: var(--tf-c-glass);
	-webkit-backdrop-filter: blur(16px);
	backdrop-filter: blur(16px);
	font-size: 13px;
	line-height: 18px;
	font-weight: 700;
	letter-spacing: 0.08em;
}

.tf-c-space {
	flex: 1;
	min-height: 8px;
}

.tf-c-hero {
	display: grid;
	flex: 1;
	place-items: center;
	min-height: 180px;
}

.tf-c-hero--small > .tf-card {
	max-width: 200px;
}

.tf-c-hero > .tf-card {
	max-width: 250px;
	box-shadow: 0 0 0 7px var(--tf-c-halo), 0 26px 40px -24px rgba(0, 0, 0, 0.7);
}

/* The advisor speaks first, as a message, so the request feels like the relationship. */
.tf-c-msg {
	display: grid;
	grid-template-columns: 44px minmax(0, 1fr);
	align-items: end;
	gap: 10px;
}

.tf-avatar {
	display: grid;
	place-items: center;
	flex: none;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--tf-c-card);
	font-size: 15px;
	font-weight: 700;
}

.tf-c-bubble {
	padding: 12px 16px 14px;
	border-radius: 22px 22px 22px 6px;
	background: var(--tf-c-card);
	overflow-wrap: anywhere;
}

.tf-c-bubble b {
	display: block;
	margin-bottom: 2px;
	color: var(--tf-muted);
	font-size: 15px;
	line-height: 20px;
}

.tf-c-bubble__note {
	display: block;
	margin-top: 8px;
}

/* One paper card holds the decision. Label at the top, the thing that matters big at the bottom. */
.tf-c-card {
	display: flex;
	flex-direction: column;
	gap: 22px;
	margin: 6px;
	padding: 20px;
	border-radius: 24px;
	background: var(--tf-c-card);
	box-shadow: 0 0 0 6px var(--tf-c-halo);
}

.tf-c-card--center {
	align-items: center;
	text-align: center;
}

.tf-c-stack {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.tf-c-title {
	margin: 0;
	font-size: 26px;
	line-height: 1.2;
	font-weight: 700;
	letter-spacing: -0.01em;
	text-wrap: balance;
}

.tf-c-lede {
	margin: 0;
}

.tf-c-muted {
	color: var(--tf-muted);
}

.tf-amount {
	font-size: 48px;
	line-height: 1;
	font-weight: 700;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

.tf-c-route {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.tf-c-route b {
	font-weight: 700;
}

.tf-c-tag {
	display: inline-flex;
	align-self: flex-start;
	align-items: center;
	gap: 8px;
	padding: 7px 12px;
	border-radius: 10px;
	background: var(--tf-wait-bg);
	color: var(--tf-wait);
	font-size: 17px;
	line-height: 22px;
	font-weight: 700;
}

.tf-c-note {
	margin: 0;
	padding-top: 14px;
	border-top: 1px solid var(--tf-line);
	color: var(--tf-muted);
	font-size: 17px;
	line-height: 1.4;
}

/* A short message after something went wrong. Calm, on paper, never red text on sand. */
.tf-c-alert {
	margin: 0 6px;
	padding: 14px 16px;
	border-radius: 16px;
	background: var(--tf-stop-bg);
	color: var(--tf-stop);
	font-size: 17px;
	line-height: 1.4;
	font-weight: 700;
}

/* A mailed card's setup page: one field, the code printed in the letter. */
.tf-c-form {
	display: contents;
}

.tf-c-label {
	margin-bottom: -12px;
	color: var(--tf-muted);
	font-size: 17px;
	font-weight: 700;
}

.tf-c-input {
	width: 100%;
	min-height: 64px;
	padding: 10px 16px;
	border: 2px solid var(--tf-line-strong);
	border-radius: 16px;
	background: transparent;
	color: var(--tf-ink);
	font: 400 30px/1 var(--tf-mono);
	letter-spacing: 0.16em;
	text-align: center;
	text-transform: uppercase;
	transition: border-color 150ms ease;
}

.tf-c-input::placeholder {
	color: var(--tf-line-strong);
}

.tf-c-input:focus-visible {
	outline: none;
	border-color: var(--tf-ink);
}

/* The 4-digit enrollment code, read aloud to staff. */
.tf-c-code {
	margin: 0;
	font: 400 56px/1 var(--tf-mono);
	letter-spacing: 0.18em;
	font-variant-numeric: tabular-nums;
}

/* Actions sit below the card. The second choice is glass. */
.tf-c-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding-inline: 6px;
}

.tf-c-actions form {
	display: contents;
}

.tf-c-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 60px;
	padding: 12px 18px;
	border: 0;
	border-radius: 18px;
	background: var(--tf-primary);
	color: var(--tf-on-primary);
	font: 700 20px/1.2 var(--tf-client);
	text-decoration: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: transform var(--tf-press) var(--tf-ease-out), background-color 150ms ease, color 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

.tf-c-btn:active {
	transform: scale(0.97);
}

.tf-c-btn:focus-visible {
	outline: 3px solid var(--tf-ink);
	outline-offset: 3px;
}

.tf-c-btn[disabled] {
	opacity: 0.55;
	cursor: default;
	transform: none;
}

.tf-c-btn--glass {
	border: 1px solid var(--tf-c-glass-line);
	background: var(--tf-c-glass);
	color: var(--tf-ink);
	-webkit-backdrop-filter: blur(16px);
	backdrop-filter: blur(16px);
}

@media (hover: hover) and (pointer: fine) {
	.tf-c-btn:not([disabled]):hover {
		background: color-mix(in srgb, var(--tf-primary) 86%, transparent);
	}

	.tf-c-btn--glass:not([disabled]):hover {
		background: var(--tf-c-card);
	}
}

.tf-c-foot {
	display: inline-flex;
	align-self: center;
	align-items: center;
	gap: 8px;
	padding: 6px 14px;
	border: 1px solid var(--tf-c-glass-line);
	border-radius: 999px;
	background: var(--tf-c-glass);
	-webkit-backdrop-filter: blur(16px);
	backdrop-filter: blur(16px);
	font-size: 14px;
	line-height: 20px;
}

/* A paper sheet with a handle rising over the sand, for anything read at length. */
.tf-c-sheet {
	display: flex;
	flex-direction: column;
	gap: 16px;
	margin: 0 -14px calc(-1 * max(18px, env(safe-area-inset-bottom)));
	padding: 10px 20px max(22px, env(safe-area-inset-bottom));
	border-radius: 28px 28px 0 0;
	background: var(--tf-c-card);
}

.tf-c-handle {
	align-self: center;
	width: 40px;
	height: 5px;
	border-radius: 999px;
	background: var(--tf-line-strong);
}

.tf-c-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tf-c-list li {
	display: grid;
	grid-template-columns: 30px minmax(0, 1fr);
	gap: 10px;
}

.tf-c-list .tf-n {
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border: 1px solid var(--tf-line-strong);
	border-radius: 50%;
	font-size: 15px;
	font-weight: 700;
}

/* Icons */
.tf-i {
	flex: none;
	width: 16px;
	height: 16px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.tf-i--l {
	width: 20px;
	height: 20px;
}

/* The mark: two circles, the firm and the client. */
.tf-mark {
	display: block;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
}

.tf-c-foot .tf-mark {
	width: 22px;
	height: 14px;
}

/* The confirmed ring, drawn once inside the card. */
.tf-c-ring {
	position: relative;
	display: grid;
	place-items: center;
	width: 120px;
	height: 120px;
	color: var(--tf-ok);
}

.tf-c-ring--stop {
	color: var(--tf-stop);
}

.tf-c-ring__line {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: visible;
	transform: rotate(-90deg);
}

.tf-c-ring__line circle {
	fill: none;
	stroke: currentColor;
	stroke-width: 0.8;
	stroke-dasharray: 100;
}

.tf-c-ring__check {
	width: 42px;
	height: 42px;
	stroke-dasharray: 20;
}

.tf-enter .tf-c-ring__line circle {
	animation: tf-draw 700ms var(--tf-ease-in-out) 160ms backwards;
}

.tf-enter .tf-c-ring__check {
	animation: tf-draw-check 260ms var(--tf-ease-out) 680ms backwards;
}

@keyframes tf-draw {
	from {
		stroke-dashoffset: 100;
	}
}

@keyframes tf-draw-check {
	from {
		stroke-dashoffset: 20;
	}
}

/* A screen settles in once when it opens: pieces rise 8px, 50ms apart (.tf-d1, .tf-d2, ...).
   The page adds .tf-enter only when a screen is first shown. Buttons never wait. */
.tf-d1 {
	--i: 1;
}

.tf-d2 {
	--i: 2;
}

.tf-d12 {
	--i: 12;
}

.tf-d13 {
	--i: 13;
}

.tf-enter .tf-c-rise {
	animation: tf-rise 300ms var(--tf-ease-out) calc(var(--i, 0) * 50ms) backwards;
}

.tf-enter .tf-c-sheet {
	animation: tf-sheet 460ms var(--tf-ease-drawer) backwards;
}

@keyframes tf-rise {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
}

@keyframes tf-sheet {
	from {
		transform: translateY(100%);
	}
}

@keyframes tf-fade {
	from {
		opacity: 0;
	}
}

/* The card. Black, matte, the mark pressed into it. */
.tf-card {
	position: relative;
	width: 100%;
	max-width: 300px;
	aspect-ratio: 85.6 / 54;
	overflow: hidden;
	border-radius: 12px;
	background:
		radial-gradient(120% 90% at 18% 0%, rgba(255, 255, 255, 0.12), transparent 55%),
		radial-gradient(80% 60% at 100% 100%, rgba(255, 255, 255, 0.06), transparent 60%),
		#0d0d0e;
	box-shadow: 0 18px 30px -18px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
	color: rgba(255, 255, 255, 0.86);
}

.tf-card .tf-mark {
	position: absolute;
	left: 8%;
	top: 13%;
	width: 18%;
	height: auto;
}

.tf-card__name {
	position: absolute;
	left: 8%;
	bottom: 12%;
	font: 400 15px/1 var(--tf-sans);
	letter-spacing: 0.02em;
}

.tf-card__tap {
	position: absolute;
	right: 8%;
	bottom: 11%;
	width: 9%;
	height: auto;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
}

/* Card tap: the card rises to the top of the phone. */
.tf-tapviz {
	position: relative;
	align-self: center;
	width: 210px;
	height: 230px;
}

.tf-tapviz__phone {
	position: absolute;
	left: 50px;
	top: 6px;
	width: 110px;
	height: 214px;
	border: 2px solid var(--tf-ink);
	border-radius: 22px;
	background: var(--tf-c-glass);
	animation: tf-buzz 3.2s infinite;
}

.tf-tapviz__zone {
	position: absolute;
	left: 50%;
	top: 16px;
	width: 70px;
	height: 40px;
	border: 1.5px dashed var(--tf-ink);
	border-radius: 10px;
	transform: translateX(-50%);
	animation: tf-zone 3.2s infinite;
}

.tf-tapviz .tf-card {
	position: absolute;
	left: 45px;
	top: 18px;
	width: 120px;
	animation: tf-tap 3.2s infinite;
}

.tf-tapviz .tf-card__name {
	display: none;
}

/* The loop starts on its landed frame, so a still frame always shows where the card goes. */
@keyframes tf-tap {
	0%,
	30% {
		opacity: 1;
		transform: translateY(0);
	}
	40% {
		opacity: 0;
		transform: translateY(0);
	}
	41% {
		opacity: 0;
		transform: translateY(150px);
		animation-timing-function: cubic-bezier(0.77, 0, 0.175, 1);
	}
	82%,
	100% {
		opacity: 1;
		transform: translateY(0);
	}
}

/* The phone buzzes once when the card lands, the moment the client is told to wait for. */
@keyframes tf-buzz {
	0%,
	82%,
	92%,
	100% {
		transform: translateX(0);
	}
	84% {
		transform: translateX(-1.5px);
	}
	86% {
		transform: translateX(1.5px);
	}
	88% {
		transform: translateX(-1.5px);
	}
	90% {
		transform: translateX(1px);
	}
}

@keyframes tf-zone {
	0%,
	30%,
	84%,
	100% {
		opacity: 1;
	}
	40%,
	78% {
		opacity: 0.4;
	}
}

/* Reduced motion: nothing moves, orbits or draws. Short fades stay, because they explain that
   something changed. */
@media (prefers-reduced-motion: reduce) {
	.tf-tapviz .tf-card,
	.tf-tapviz__phone,
	.tf-tapviz__zone,
	.tf-enter .tf-c-ring__line circle,
	.tf-enter .tf-c-ring__check {
		animation: none;
	}

	.tf-enter .tf-c-rise,
	.tf-enter .tf-c-sheet {
		animation-name: tf-fade;
		animation-delay: 0ms;
	}

	.tf-c-btn {
		transition: none;
	}
}

/* Shown to screen readers only. */
.tf-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}
