/**
 * Astro Auth — sign-in and registration styling.
 *
 * Matches the chat surface so signing in does not feel like leaving the
 * product for a different site. Same first-light palette: warm paper, indigo
 * ink, marigold only as a thread. See app.css for why.
 */

.astro-auth.astro-auth {
	--astro-paper: #faf7f2;
	--astro-card: #ffffff;
	--astro-field: #fdfcfa;
	--astro-raise: #f6f2ea;

	--astro-ink: #252a44;
	--astro-ink-2: #4d5271;
	--astro-muted: #63687f;
	--astro-on-ink: #fdfbf7;

	--astro-line: #e7dfd2;
	--astro-accent: #a4551f;

	--astro-bad: #9d3f38;
	--astro-bad-soft: rgba(157, 63, 56, 0.08);
	--astro-bad-line: rgba(157, 63, 56, 0.3);

	--astro-shadow: 0 1px 2px rgba(37, 42, 68, 0.04), 0 10px 30px rgba(37, 42, 68, 0.07);

	--astro-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
	--astro-serif: Georgia, "Noto Serif", "Noto Serif Devanagari", "Times New Roman", serif;

	max-width: 420px;
	margin: 0 auto;
	padding: 16px;
	box-sizing: border-box;
	color: var(--astro-ink);
	font-family: var(--astro-sans);
}

@media (prefers-color-scheme: dark) {
	.astro-auth.astro-auth {
		--astro-paper: #15161d;
		--astro-card: #1e2029;
		--astro-field: #191b23;
		--astro-raise: #252832;

		--astro-ink: #ece7de;
		--astro-ink-2: #c3bfb5;
		--astro-muted: #948f88;
		--astro-on-ink: #1a1b22;

		--astro-line: #32343f;
		--astro-accent: #d98d52;

		--astro-bad: #d98b84;
		--astro-bad-soft: rgba(217, 139, 132, 0.1);
		--astro-bad-line: rgba(217, 139, 132, 0.3);

		--astro-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
	}
}



/* Same cascade problem as the chat surface, same answer: every selector here
   carries `.astro-auth` twice or once more than its own class, which lifts the
   sheet above a host theme's element rules — `.aft-default-mode button` and the
   like — without `!important`. See the long note in astro-chat/assets/app.css.
   `:where()` adds no specificity, so the component rules below still win. */
.astro-auth.astro-auth :where(button, input, select, textarea, a, p, label, span, div, h1, h2) {
	color: inherit;
	font-family: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-shadow: none;
}

.astro-auth.astro-auth :where(button, input, select, textarea, a) {
	background: none;
	box-shadow: none;
	text-decoration: none;
}

/* Size, which a theme also has opinions about — `input { height: 38px }` and
   `button { height: 38px; padding: 5px 10px }` are both in the one running on
   yudh.in, and neither is something a page of our own would need to undo. */
.astro-auth.astro-auth :where(button, input, select, textarea) {
	box-sizing: border-box;
	height: auto;
	min-height: 0;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	font-size: inherit;
	line-height: inherit;
	text-align: inherit;
	vertical-align: baseline;
	float: none;
	-webkit-appearance: none;
	appearance: none;
}

.astro-auth.astro-auth :where(input[type="checkbox"], input[type="radio"]) {
	-webkit-appearance: auto;
	appearance: auto;
	width: 16px;
	height: 16px;
}

.astro-auth.astro-auth *,
.astro-auth.astro-auth *::before,
.astro-auth.astro-auth *::after {
	box-sizing: inherit;
}

.astro-auth .astro-auth__card {
	padding: 28px 22px;
	background: var(--astro-card);
	box-shadow: var(--astro-shadow);
	border: 1px solid var(--astro-line);
	border-radius: 16px;
	text-align: center;
}

.astro-auth .astro-auth__logo {
	max-width: 200px;
	max-height: 76px;
	margin: 0 auto 18px;
}

.astro-auth .astro-auth__wordmark {
	margin: 0 0 18px;
	color: var(--astro-accent);
	font-size: 1.4rem;
	font-weight: 700;
	letter-spacing: 0.04em;
}

.astro-auth .astro-auth__title {
	margin: 0 0 6px;
	color: var(--astro-ink);
	font-size: 1.35rem;
}

.astro-auth .astro-auth__sub {
	margin: 0 0 20px;
	color: var(--astro-muted);
	font-size: 0.92rem;
}

.astro-auth .astro-auth__error {
	margin: 0 0 16px;
	padding: 10px 12px;
	background: var(--astro-bad-soft);
	border: 1px solid var(--astro-bad-line);
	border-radius: 10px;
	color: var(--astro-bad);
	font-size: 0.9rem;
	text-align: left;
}

.astro-auth .astro-auth__form,
.astro-auth.astro-auth #astro-login-form {
	text-align: left;
}

.astro-auth.astro-auth label,
.astro-auth.astro-auth .login-username label,
.astro-auth.astro-auth .login-password label {
	display: block;
	margin-bottom: 6px;
	color: var(--astro-muted);
	font-size: 0.84rem;
	font-weight: 600;
}

.astro-auth.astro-auth input[type="text"],
.astro-auth.astro-auth input[type="email"],
.astro-auth.astro-auth input[type="tel"],
.astro-auth.astro-auth input[type="password"] {
	width: 100%;
	margin-bottom: 16px;
	padding: 13px 14px;
	background: var(--astro-field);
	border: 1px solid var(--astro-line);
	border-radius: 10px;
	color: var(--astro-ink);
	/* 16px keeps iOS Safari from zooming the viewport on focus. */
	font-size: 16px;
	font-family: inherit;
}

.astro-auth.astro-auth input:focus-visible,
.astro-auth.astro-auth button:focus-visible {
	outline: 2px solid var(--astro-accent);
	outline-offset: 2px;
}

.astro-auth.astro-auth .login-remember {
	margin-bottom: 16px;
	color: var(--astro-muted);
	font-size: 0.88rem;
}

.astro-auth.astro-auth .login-remember label {
	display: inline;
	font-weight: 400;
}

.astro-auth .astro-auth__btn,
.astro-auth.astro-auth input[type="submit"] {
	width: 100%;
	padding: 14px 20px;
	background: var(--astro-ink);
	border: 0;
	border-radius: 10px;
	color: var(--astro-on-ink);
	font-size: 1rem;
	font-weight: 700;
	font-family: inherit;
	cursor: pointer;
}

.astro-auth .astro-auth__alt {
	margin: 18px 0 0;
	color: var(--astro-muted);
	font-size: 0.88rem;
	text-align: center;
}

.astro-auth.astro-auth a {
	color: var(--astro-accent);
}

/* ---------- Continue with Google ---------- */

/* Google's brand guidelines require their mark on white or near-white, so
   this one button steps out of the night palette rather than being tinted to
   match it. Full width and 52px tall: the readers this is for are on a phone,
   often one-handed, sometimes with a cracked screen. */
.astro-auth .astro-auth__google {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	width: 100%;
	min-height: 52px;
	padding: 14px 18px;
	box-sizing: border-box;
	/* Google's own colours, not ours. The mark has brand rules, and the card
	   behind this is now white — so the button needs its own edge rather than
	   disappearing into it. */
	background: #fff;
	border: 1px solid #c9c4bb;
	border-radius: 10px;
	color: #1f1f1f;
	font-size: 1rem;
	font-weight: 600;
	font-family: inherit;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

/* The colour has to be forced: `.astro-auth a { color: gold }` above would
   otherwise make the label unreadable on white. */
.astro-auth.astro-auth a.astro-auth__google,
.astro-auth.astro-auth a.astro-auth__google:hover,
.astro-auth.astro-auth a.astro-auth__google:focus {
	color: #1f1f1f;
	text-decoration: none;
}

/* Google permits the white button on a dark surface; what it does not permit
   is recolouring the mark, so the button keeps its own colours in both
   themes and only its edge changes. */
@media (prefers-color-scheme: dark) {
	.astro-auth .astro-auth__google {
		border-color: #3d3f4a;
	}
}

.astro-auth .astro-auth__google:hover {
	background: #f7f8f8;
}

.astro-auth .astro-auth__google:focus-visible {
	outline: 2px solid var(--astro-accent);
	outline-offset: 2px;
}

.astro-auth .astro-auth__gmark {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
}

/* A rule with the word sitting in it, so the two routes read as alternatives
   rather than as steps. */
.astro-auth .astro-auth__or {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 18px 0;
	color: var(--astro-muted);
	font-size: 0.82rem;
}

.astro-auth .astro-auth__or::before,
.astro-auth .astro-auth__or::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--astro-line);
}

@media (max-width: 420px) {
	.astro-auth .astro-auth__card { padding: 22px 16px; }

	/* Long enough in Hindi to wrap on a narrow screen, which would break the
	   button's height; allowing it to wrap inside a taller button is better
	   than letting it overflow. */
	.astro-auth .astro-auth__google {
		padding: 14px 12px;
		font-size: 0.95rem;
	}
}

/* ---------- The reader's own account ----------
   Three cards: what they have, who they are, what they paid. Scoped like
   everything else here so a host theme cannot repaint it. */

.astro-account.astro-account {
	--astro-paper: #faf7f2;
	--astro-card: #ffffff;
	--astro-ink: #252a44;
	--astro-ink-2: #4d5271;
	--astro-muted: #63687f;
	--astro-line: #e7dfd2;
	--astro-accent: #a4551f;
	--astro-good: #2f6d4f;
	--astro-bad: #9d3f38;
	--astro-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
	--astro-serif: Georgia, "Noto Serif", "Noto Serif Devanagari", "Times New Roman", serif;

	display: grid;
	gap: 14px;
	max-width: 720px;
	margin: 0 auto;
	box-sizing: border-box;
	color: var(--astro-ink);
	font-family: var(--astro-sans);
	font-size: 16px;
	line-height: 1.6;
}

.astro-account :where(p, h2, dt, dd, td, th, a, section, table) {
	color: inherit;
	font-family: inherit;
	letter-spacing: normal;
	text-transform: none;
	box-sizing: border-box;
}

.astro-account .astro-account__card {
	background: var(--astro-card);
	border: 1px solid var(--astro-line);
	border-radius: 14px;
	padding: 20px 22px;
	margin: 0;
}

.astro-account .astro-account__title {
	margin: 0 0 12px;
	padding: 0;
	border: 0;
	font-family: var(--astro-serif);
	font-size: 1.1rem;
	font-weight: 600;
}

/* The one thing they came to check, said in one line. */
.astro-account .astro-account__badge {
	display: inline-block;
	margin: 0 0 10px;
	padding: 4px 11px;
	border-radius: 999px;
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.astro-account .astro-account__badge.is-paid {
	background: rgba(47, 109, 79, 0.1);
	color: var(--astro-good);
}

.astro-account .astro-account__badge.is-free {
	background: rgba(164, 85, 31, 0.1);
	color: var(--astro-accent);
}

.astro-account .astro-account__big {
	margin: 0 0 4px;
	font-family: var(--astro-serif);
	font-size: 1.35rem;
	line-height: 1.3;
}

.astro-account .astro-account__note {
	margin: 8px 0 0;
	font-size: 0.86rem;
	color: var(--astro-muted);
}

.astro-account .astro-account__empty { margin: 0; color: var(--astro-muted); }

.astro-account .astro-account__cta {
	display: inline-block;
	margin-top: 12px;
	padding: 12px 20px;
	background: var(--astro-ink);
	border-radius: 10px;
	color: #fdfbf7;
	font-weight: 600;
	text-decoration: none;
}

.astro-account .astro-account__rows {
	display: grid;
	grid-template-columns: minmax(80px, 30%) 1fr;
	gap: 7px 14px;
	margin: 0;
}

.astro-account .astro-account__rows dt { color: var(--astro-muted); font-size: 0.88rem; }
.astro-account .astro-account__rows dd { margin: 0; }

.astro-account .astro-account__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.astro-account .astro-account__table :where(th, td) {
	padding: 9px 8px;
	border-bottom: 1px solid var(--astro-line);
	text-align: left;
	vertical-align: top;
}

.astro-account .astro-account__table th {
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--astro-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.astro-account .astro-account__table .is-paid { color: var(--astro-good); font-weight: 600; }
.astro-account .astro-account__table .is-failed { color: var(--astro-bad); }
.astro-account .astro-account__table .is-created { color: var(--astro-muted); }

@media (max-width: 520px) {
	.astro-account .astro-account__card { padding: 16px; }
	.astro-account .astro-account__rows { grid-template-columns: 1fr; gap: 2px; }
	.astro-account .astro-account__rows dd { margin-bottom: 8px; }
	.astro-account .astro-account__table { font-size: 0.84rem; }
}

@media (prefers-color-scheme: dark) {
	.astro-account.astro-account {
		--astro-card: #1e2029;
		--astro-ink: #ece7de;
		--astro-ink-2: #c7c1b6;
		--astro-muted: #9a958c;
		--astro-line: #33363f;
		--astro-accent: #e8a35f;
		--astro-good: #6fbf93;
		--astro-bad: #e08a82;
	}

	.astro-account .astro-account__cta { background: #e8a35f; color: #15161d; }
}
