/* ============================================================
   Courage to Start — launch page
   ------------------------------------------------------------
   1. Tokens
   2. Base
   3. Hero layout
   4. Book cover
   5. Content column
   6. Waitlist form (toggle, fields, button, states)
   7. Footer
   8. Animations
   9. Responsive
   10. Accessibility (focus, reduced motion)
   ============================================================ */

/* 1. Tokens ------------------------------------------------- */

:root {
	--green: #1c4a2e; /* deep forest green            */
	--green-deep: #143722; /* hover / emphasis             */
	--gold: #c9a85c; /* soft gold — decorative only  */
	--gold-text: #8a6c2f; /* gold that passes AA on bg    */
	--bg: #faf7f1; /* warm white                   */
	--surface: #ffffff;
	--text: #26251f; /* charcoal                     */
	--text-muted: #6d6a60;
	--line: #e6e1d5; /* hairlines                    */
	--error: #a33c2a;

	--font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
	--font-sans: "Inter", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;

	--ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* 2. Base --------------------------------------------------- */

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

html {
	height: 100%;
}

body {
	margin: 0;
	min-height: 100svh;
	display: flex;
	flex-direction: column;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-sans);
	font-size: 1rem;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

img {
	max-width: 100%;
	display: block;
}

[hidden] {
	display: none;
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* 3. Hero layout -------------------------------------------- */

.hero {
	flex: 1;
	display: grid;
	grid-template-columns: auto minmax(0, 30rem);
	align-items: center;
	justify-content: center;
	gap: clamp(3rem, 8vw, 7.5rem);
	padding: clamp(2rem, 5vh, 4rem) clamp(1.5rem, 6vw, 5rem);
}

/* 4. Book cover --------------------------------------------- */

.cover {
	margin: 0;
	animation: fade-up 0.9s var(--ease) 0.05s both;
}

.cover img {
	height: min(34rem, 72svh);
	width: auto;
	border-radius: 4px;
	box-shadow:
		0 1px 2px rgba(24, 34, 24, 0.1),
		0 12px 28px rgba(24, 34, 24, 0.16),
		0 32px 64px -24px rgba(24, 34, 24, 0.28);
	transition:
		transform 0.45s var(--ease),
		box-shadow 0.45s var(--ease);
}

.cover:hover img {
	transform: translateY(-8px);
	box-shadow:
		0 1px 2px rgba(24, 34, 24, 0.08),
		0 20px 40px rgba(24, 34, 24, 0.18),
		0 48px 88px -24px rgba(24, 34, 24, 0.32);
}

/* 5. Content column ----------------------------------------- */

.content > * {
	animation: fade-up 0.8s var(--ease) both;
}

.content > :nth-child(1) {
	animation-delay: 0.15s;
}
.content > :nth-child(2) {
	animation-delay: 0.22s;
}
.content > :nth-child(3) {
	animation-delay: 0.29s;
}
.content > :nth-child(4) {
	animation-delay: 0.36s;
}
.content > :nth-child(5) {
	animation-delay: 0.43s;
}

.badge {
	margin: 0 0 1rem;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--gold-text);
}

.badge::after {
	content: "";
	display: block;
	width: 2.25rem;
	height: 1px;
	margin-top: 0.5rem;
	background: var(--gold);
}

h1 {
	margin: 0;
	font-family: var(--font-serif);
	font-weight: 500;
	font-size: clamp(2.75rem, 5.5vw, 4.25rem);
	line-height: 1.05;
	letter-spacing: -0.01em;
	color: var(--green);
	text-wrap: balance;
}

.subtitle {
	margin: 1rem 0 0;
	font-family: var(--font-serif);
	font-size: 1.25rem;
	color: var(--text);
}

.subtitle em {
	font-style: italic;
	font-weight: 500;
}

.subtitle .author {
	display: block;
	margin-top: 0.375rem;
	font-family: var(--font-sans);
	font-size: 0.8125rem;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--text-muted);
}

.description {
	margin: 1.5rem 0 0;
	max-width: 26rem;
	font-size: 1.0625rem;
	color: var(--text-muted);
	text-wrap: pretty;
}

/* 6. Waitlist form ------------------------------------------ */

.waitlist {
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px solid var(--line);
	max-width: 27rem;
}

.waitlist-title {
	margin: 0;
	margin-bottom: 10px;
	font-family: var(--font-serif);
	font-weight: 600;
	font-size: 1.1875rem;
	color: var(--text);
}

/* Segmented toggle */

.toggle {
	position: relative;
	display: inline-grid;
	grid-template-columns: 1fr 1fr;
	margin: 0 0 0.875rem;
	padding: 3px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: #efeadf;
}

.toggle::before {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: calc(50% - 3px);
	height: calc(100% - 6px);
	border-radius: 999px;
	background: var(--surface);
	box-shadow: 0 1px 3px rgba(24, 34, 24, 0.14);
	transition: transform 0.35s var(--ease);
}

.toggle:has(input[value="phone"]:checked)::before {
	transform: translateX(100%);
}

.toggle-option {
	position: relative;
	z-index: 1;
	cursor: pointer;
}

.toggle-option input {
	position: absolute;
	inset: 0;
	opacity: 0;
	margin: 0;
	cursor: pointer;
}

.toggle-option span {
	display: block;
	padding: 0.4375rem 1.375rem;
	font-size: 0.8125rem;
	font-weight: 500;
	text-align: center;
	color: var(--text-muted);
	transition: color 0.25s ease;
}

.toggle-option input:checked + span {
	color: var(--green);
	font-weight: 600;
}

.toggle-option input:focus-visible + span {
	outline: 2px solid var(--green);
	outline-offset: 2px;
	border-radius: 999px;
}

/* Fields + button */

.field-row {
	display: flex;
	gap: 0.625rem;
}

.field {
	flex: 1;
	min-width: 0;
}

.field:not([hidden]) {
	animation: field-in 0.3s var(--ease) both;
}

.field input {
	width: 100%;
	padding: 0.8125rem 1rem;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: var(--surface);
	color: var(--text);
	font: inherit;
	font-size: 0.9375rem;
	transition:
		border-color 0.25s ease,
		box-shadow 0.25s ease;
}

.field input::placeholder {
	color: #a3a094;
}

.field input:hover {
	border-color: #d4cebe;
}

.field input:focus {
	outline: none;
	border-color: var(--green);
	box-shadow: 0 0 0 3px rgba(28, 74, 46, 0.12);
}

.field input[aria-invalid="true"] {
	border-color: var(--error);
}

.field input[aria-invalid="true"]:focus {
	box-shadow: 0 0 0 3px rgba(163, 60, 42, 0.12);
}

/* Button */

.submit {
	flex-shrink: 0;
	padding: 0.8125rem 1.625rem;
	border: 1px solid var(--green);
	border-radius: 8px;
	background: var(--green);
	color: #fdfcf8;
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 500;
	cursor: pointer;
	transition:
		background-color 0.25s ease,
		border-color 0.25s ease,
		transform 0.25s var(--ease),
		box-shadow 0.25s var(--ease);
}

.submit:hover {
	background: var(--green-deep);
	border-color: var(--green-deep);
	transform: translateY(-1px);
	box-shadow: 0 6px 16px -6px rgba(20, 55, 34, 0.45);
}

.submit:active {
	transform: translateY(0);
	box-shadow: none;
}

.submit:disabled {
	opacity: 0.65;
	cursor: default;
	transform: none;
	box-shadow: none;
}

/* Messages */

.form-error {
	margin: 0.625rem 0 0;
	min-height: 1.4rem; /* one line reserved even when empty */
	font-size: 0.875rem;
	color: var(--error);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.form-error.is-visible {
	opacity: 1;
}

.form-success:not([hidden]) {
	margin: 0;
	display: flex;
	align-items: baseline;
	gap: 0.625rem;
	font-size: 0.9375rem;
	color: var(--text);
	animation: fade-up 0.5s var(--ease) both;
}

.form-success .check {
	color: var(--gold-text);
	font-weight: 600;
}

/* 7. Footer ------------------------------------------------- */

.footer {
	padding: 1.25rem clamp(1.5rem, 6vw, 5rem) 1.5rem;
	text-align: center;
}

.footer p {
	margin: 0;
	font-size: 0.75rem;
	letter-spacing: 0.02em;
	color: var(--text-muted);
}

/* 8. Animations --------------------------------------------- */

@keyframes fade-up {
	from {
		opacity: 0;
		transform: translateY(16px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes field-in {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* 9. Responsive --------------------------------------------- */

@media (max-width: 60rem) {
	.hero {
		grid-template-columns: minmax(0, 30rem);
		justify-items: center;
		text-align: center;
		gap: 2rem;
		padding-top: clamp(1rem, 8vh, 1.5rem);
	}

	.cover img {
		height: min(24rem, 52svh);
	}

	.badge::after,
	.description {
		margin-inline: auto;
	}

	.waitlist {
		width: 100%;
	}
}

@media (max-width: 36rem) {
	.field-row {
		flex-direction: column;
	}

	.submit {
		width: 100%;
	}

	.cover:hover img {
		transform: none;
	}
}

/* 10. Accessibility ----------------------------------------- */

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

@media (prefers-reduced-motion: reduce) {
	.cover,
	.content > *,
	.field:not([hidden]),
	.form-success:not([hidden]) {
		animation: none;
	}

	.cover img,
	.field input,
	.form-error,
	.submit,
	.toggle::before,
	.toggle-option span {
		transition: none;
	}

	.cover:hover img,
	.submit:hover {
		transform: none;
	}
}
