/* ------------------------------------------------------------------
 * eEGI — Atlantic Galician editorial
 * Type: Ibarra Real Nova (display, c. 1780 Real Imprenta de Madrid)
 *       Public Sans     (body)
 *       JetBrains Mono  (numerals)
 * ------------------------------------------------------------------ */

:root {
	--sand:           #F5F1EA;
	--sand-deep:      #ECE5D5;
	--sand-shadow:    #D8CFB8;
	--line:           #E5DECC;
	--ink:            #1A1A1A;
	--atlantic:       #0B2030;
	--atlantic-night: #061521;
	--terracotta:     #B85042;
	--terracotta-deep:#9A3F33;
	--whisper:        #8B7E66;
	--error:          #8E2A2A;

	--display: "Ibarra Real Nova", Georgia, serif;
	--body:    "Public Sans", system-ui, -apple-system, sans-serif;
	--mono:    "JetBrains Mono", ui-monospace, Menlo, monospace;

	--gutter:  3rem;
	--gutter-sm: 1.5rem;
}

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

html { font-size: 16px; }

body {
	margin: 0;
	font-family: var(--body);
	font-weight: 400;
	font-size: 1rem;
	line-height: 1.55;
	color: var(--ink);
	background-color: var(--sand);
	background-image:
		radial-gradient(circle at 18% 12%, rgba(184, 80, 66, 0.07) 0%, transparent 38%),
		radial-gradient(circle at 82% 78%, rgba(11, 32, 48, 0.06) 0%, transparent 48%);
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	overflow-x: hidden;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	background: var(--atlantic);
	color: var(--sand);
	padding: 0.5rem 1rem;
	font-family: var(--body);
	font-size: 0.85rem;
	z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------- chrome ---------- */

.masthead {
	padding: 2.25rem var(--gutter) 0;
	display: flex;
	align-items: baseline;
	gap: 1.5rem;
	position: relative;
	z-index: 2;
}

.logo {
	font-family: var(--display);
	font-weight: 500;
	font-size: 1.4rem;
	color: var(--atlantic);
	letter-spacing: -0.01em;
	text-decoration: none;
	line-height: 1;
}
.logo em {
	font-style: italic;
	font-weight: 500;
}

.tagline {
	margin: 0;
	font-family: var(--body);
	font-size: 0.68rem;
	font-weight: 500;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--whisper);
}

.footer {
	padding: 1.5rem var(--gutter) 2rem;
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	font-family: var(--body);
	font-size: 0.68rem;
	color: var(--whisper);
	letter-spacing: 0.22em;
	text-transform: uppercase;
	position: relative;
	z-index: 2;
}

/* ---------- page ---------- */

.page {
	flex: 1;
	display: flex;
	align-items: center;
	padding: 4rem var(--gutter);
	position: relative;
	z-index: 1;
}

.auth-card {
	max-width: 32rem;
	width: 100%;
	margin-left: 0;
	position: relative;
}

/* ---------- typography ---------- */

.eyebrow {
	font-family: var(--body);
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.24em;
	text-transform: uppercase;
	color: var(--terracotta);
	margin: 0 0 1.5rem;
	display: flex;
	align-items: center;
	gap: 0.85rem;
}
.eyebrow-rule {
	display: inline-block;
	width: 2.25rem;
	height: 1px;
	background: var(--terracotta);
}

.display {
	font-family: var(--display);
	font-weight: 500;
	font-size: clamp(2.5rem, 5vw, 3.85rem);
	line-height: 1.04;
	letter-spacing: -0.018em;
	color: var(--atlantic);
	margin: 0 0 1.85rem;
}
.display em {
	font-style: italic;
	font-weight: 500;
}

.lede {
	margin: 0 0 2.5rem;
	font-family: var(--body);
	font-size: 1.075rem;
	line-height: 1.6;
	color: var(--ink);
	max-width: 30rem;
}
.lede em {
	font-family: var(--display);
	font-style: italic;
	font-weight: 500;
	color: var(--atlantic);
}

.email-callout {
	font-family: var(--mono);
	font-weight: 500;
	font-size: 0.92em;
	color: var(--atlantic);
	background: var(--sand-deep);
	padding: 0.12em 0.45em;
	border-radius: 2px;
	white-space: nowrap;
}

/* ---------- forms ---------- */

.auth-form, .otp-form {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.field {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.field-label {
	font-family: var(--body);
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.05em;
	color: var(--ink);
	text-transform: uppercase;
}

.field-input {
	font-family: var(--body);
	font-size: 1.075rem;
	font-weight: 400;
	padding: 0.85rem 0;
	border: none;
	border-bottom: 1.5px solid var(--ink);
	background: transparent;
	color: var(--ink);
	outline: none;
	border-radius: 0;
	transition: border-color 0.2s ease;
	width: 100%;
}
.field-input::placeholder {
	color: var(--whisper);
	font-style: italic;
}
.field-input:focus {
	border-color: var(--terracotta);
}

.field-error {
	margin: 0;
	padding: 0.5rem 0.75rem;
	font-family: var(--body);
	font-size: 0.875rem;
	color: var(--error);
	background: rgba(142, 42, 42, 0.06);
	border-left: 2px solid var(--error);
	line-height: 1.45;
}

.primary-button {
	font-family: var(--body);
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	padding: 1.15rem 2.25rem;
	background: var(--atlantic);
	color: var(--sand);
	border: none;
	cursor: pointer;
	align-self: flex-start;
	margin-top: 1.25rem;
	transition: background 0.2s ease, transform 0.08s ease;
	border-radius: 0;
}
.primary-button:hover {
	background: var(--atlantic-night);
}
.primary-button:focus-visible {
	outline: 2px solid var(--terracotta);
	outline-offset: 3px;
}
.primary-button:active {
	transform: translateY(1px);
}
.primary-button::after {
	content: " →";
	display: inline-block;
	margin-left: 0.45rem;
	transition: transform 0.2s ease;
}
.primary-button:hover::after {
	transform: translateX(4px);
}

.secondary-link {
	font-family: var(--body);
	font-size: 0.85rem;
	color: var(--whisper);
	text-decoration: none;
	margin-top: 0.6rem;
	align-self: flex-start;
	border-bottom: 1px solid var(--line);
	padding-bottom: 1px;
	transition: color 0.2s, border-color 0.2s;
}
.secondary-link:hover, .secondary-link:focus-visible {
	color: var(--terracotta);
	border-color: var(--terracotta);
	outline: none;
}

.footnote {
	margin: 3rem 0 0;
	padding-top: 1.5rem;
	font-family: var(--body);
	font-size: 0.875rem;
	color: var(--whisper);
	border-top: 1px solid var(--line);
	max-width: 28rem;
}

/* ---------- OTP slots ---------- */

.otp-slots {
	display: grid;
	/* minmax(0, 1fr) so the inputs' intrinsic size (browser default size=20)
	 * doesn't blow past the container's max-width. */
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 0.6rem;
	max-width: 26rem;
	margin: 0.25rem 0 0.5rem;
}

.otp-slot {
	font-family: var(--mono);
	font-size: 2rem;
	font-weight: 500;
	color: var(--atlantic);
	text-align: center;
	width: 100%;
	min-width: 0;
	padding: 1.1rem 0;
	border: none;
	border-bottom: 2px solid var(--ink);
	background: transparent;
	outline: none;
	border-radius: 0;
	transition: border-color 0.2s ease, transform 0.15s ease, color 0.15s ease;
	font-feature-settings: "tnum" 1;
	-moz-appearance: textfield;
}
.otp-slot::-webkit-outer-spin-button,
.otp-slot::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.otp-slot:focus {
	border-color: var(--terracotta);
	transform: translateY(-2px);
}

.otp-slot:not(:placeholder-shown) { color: var(--atlantic); }

/* ---------- watermark ---------- */

.watermark {
	position: fixed;
	right: -1.5rem;
	bottom: -3rem;
	font-family: var(--display);
	font-style: italic;
	font-weight: 400;
	font-size: 24vw;
	color: var(--atlantic);
	opacity: 0.04;
	pointer-events: none;
	user-select: none;
	line-height: 0.8;
	z-index: 0;
	letter-spacing: -0.02em;
}

/* ---------- motion (one choreographed load) ---------- */

@keyframes fadeUp {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

.eyebrow      { animation: fadeUp 0.5s ease-out 0.05s both; }
.display      { animation: fadeUp 0.55s ease-out 0.15s both; }
.lede         { animation: fadeUp 0.55s ease-out 0.28s both; }
.auth-form,
.otp-form     { animation: fadeUp 0.55s ease-out 0.42s both; }
.footnote     { animation: fadeUp 0.55s ease-out 0.6s both; }

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

/* ---------- flash ---------- */

.flash {
	max-width: 32rem;
	margin: 0 0 2rem;
	padding: 0.85rem 1rem;
	font-family: var(--body);
	font-size: 0.95rem;
	color: var(--atlantic);
	background: rgba(184, 80, 66, 0.08);
	border-left: 2px solid var(--terracotta);
	animation: fadeUp 0.4s ease-out 0.05s both;
}

/* ---------- responsive ---------- */

@media (max-width: 768px) {
	:root { --gutter: var(--gutter-sm); }
	.masthead { padding-top: 1.5rem; flex-direction: column; align-items: flex-start; gap: 0.4rem; }
	.tagline { font-size: 0.62rem; }
	.page { padding-top: 2.5rem; padding-bottom: 2.5rem; align-items: flex-start; }
	.display { font-size: clamp(2rem, 9vw, 2.65rem); line-height: 1.06; }
	.lede { font-size: 1rem; margin-bottom: 2rem; }
	.otp-slots { gap: 0.4rem; max-width: 100%; }
	.otp-slot { font-size: 1.6rem; padding: 0.85rem 0; }
	.primary-button { padding: 1rem 1.75rem; width: 100%; text-align: center; }
	.watermark { font-size: 38vw; right: -1rem; bottom: -1.5rem; }
	.footer { flex-direction: column; gap: 0.4rem; padding-bottom: 1.5rem; }
}
