/* Contact Your Representative — front-end styles
   Motion is deliberate and limited to two moments the brief calls for:
   (1) the ZIP field growing up + left-to-right on mount, and
   (2) the field dissolving "to smoke" on submit. Everything else stays quiet.
   Colors are CSS variables so brand theming is a one-place change later. */

.cyr-app {
	--cyr-ink: #1c1c1c;
	--cyr-muted: #5d5d5d;
	--cyr-line: #e2e2e2;
	--cyr-surface: #ffffff;
	--cyr-surface-2: #f7f7f5;
	--cyr-accent: #2b4a6f;          /* deep navy; quiet, trustworthy */
	--cyr-accent-ink: #ffffff;
	--cyr-text: #333333;            /* typed input text */
	--cyr-placeholder: #777777;     /* input hint text */
	--cyr-dem: #2166a5;
	--cyr-rep: #b1283a;
	--cyr-radius: 12px;
	--cyr-shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);

	max-width: 620px;
	margin: 0 auto;
	font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--cyr-ink);
	line-height: 1.55;
}

.cyr-app .cyr-intro { text-align: center; margin-bottom: 1.5rem; }
.cyr-app .cyr-heading { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 .4rem; }
.cyr-app .cyr-description { color: var(--cyr-muted); margin: 0 auto; max-width: 46ch; }

/* ---- ZIP entry stage ---- */
.cyr-app .cyr-zip-stage { display: flex; justify-content: center; margin: 1.25rem 0; }
.cyr-app .cyr-zip-form { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 10px; }

/* Optional name field — matches the ZIP field, sits above it. */
.cyr-app .cyr-name-field { display: flex; flex-direction: column; gap: 6px; }
.cyr-app .cyr-name-input {
	box-sizing: border-box;
	width: 100%;
	margin: 0px;
	height: 56px;
	padding: 0 22px;
	font-size: 1.1rem;
	border: 1px solid var(--cyr-line);
	border-radius: 30px;
	background: var(--cyr-surface);
	box-shadow: var(--cyr-shadow);
	transition: border-color 160ms ease, box-shadow 160ms ease;
}
.cyr-app .cyr-name-input:focus {
	outline: none;
	border-color: var(--cyr-accent);
	box-shadow: 0 0 0 3px rgba(43,74,111,.15), var(--cyr-shadow);
}
.cyr-app .cyr-name-helper { margin: 0 4px 15px; font-size: .82rem; line-height: 1.4; color: var(--cyr-muted); }

/* The field grows up + left-to-right on mount. We animate a wrapper's
   transform so the input's own metrics stay intact for accessibility. */
.cyr-app .cyr-zip-field {
	display: flex;
	gap: 8px;
	align-items: stretch;
	transform-origin: left center;
	animation: cyr-grow-up 560ms cubic-bezier(.16,.84,.44,1) both;
}
@keyframes cyr-grow-up {
	0%   { opacity: 0; transform: translateY(14px) scaleX(.2); }
	60%  { opacity: 1; }
	100% { opacity: 1; transform: translateY(0) scaleX(1); }
}

.cyr-app .cyr-zip-input {
	flex: 1 1 auto;
	min-width: 0;
	box-sizing: border-box;
	height: 56px;
	padding: 0 22px;
	font-size: 1.1rem;
	letter-spacing: .04em;
	border: 1px solid var(--cyr-line);
	border-radius: 30px;
	background: var(--cyr-surface);
	box-shadow: var(--cyr-shadow);
	transition: border-color 160ms ease, box-shadow 160ms ease;
}
.cyr-app .cyr-zip-input:focus {
	outline: none;
	border-color: var(--cyr-accent);
	box-shadow: 0 0 0 3px rgba(43,74,111,.15), var(--cyr-shadow);
}

.cyr-app .cyr-zip-submit {
	flex: 0 0 auto;
	box-sizing: border-box;
	height: 56px;
	padding: 0 28px;
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: .03em;
	color: var(--cyr-accent-ink);
	background: var(--cyr-accent);
	border: 1px solid var(--cyr-accent);
	border-radius: 30px;
	cursor: pointer;
	transition: filter 140ms ease, transform 120ms ease;
}
.cyr-app .cyr-zip-submit:hover { filter: brightness(1.08); }
.cyr-app .cyr-zip-submit:active { transform: translateY(1px); }
.cyr-app .cyr-zip-submit:focus-visible { outline: 2px solid var(--cyr-accent); outline-offset: 2px; }

/* Typed text + placeholders: themes frequently force input text and
   placeholders to their own colors (often white, making entries vanish).
   We override on every plugin input. is deliberate — it's the only
   reliable way to beat a theme's own input rules. Colors come from CSS vars so
   the backend color pickers can change them. */
.cyr-app input { color: var(--cyr-text); }
.cyr-app input::placeholder { color: var(--cyr-placeholder); text-transform: uppercase; opacity: 1; letter-spacing: .05em; font-size: 16px; }
.cyr-app input::-webkit-input-placeholder { color: var(--cyr-placeholder); text-transform: uppercase; opacity: 1; letter-spacing: .05em; font-size: 16px; }
.cyr-app input::-moz-placeholder { color: var(--cyr-placeholder); text-transform: uppercase; opacity: 1; letter-spacing: .05em; font-size: 16px; }
.cyr-app input:-ms-input-placeholder { color: var(--cyr-placeholder); text-transform: uppercase; letter-spacing: .05em; font-size: 16px; }

/* The "to smoke" dissolve: blur up, drift, fade. Applied via JS on submit.
   Covers the whole form so the name and ZIP fields dissolve together. */
.cyr-app .cyr-zip-stage.cyr-dissolving .cyr-zip-form {
	animation: cyr-smoke 620ms ease-in forwards;
	pointer-events: none;
}
@keyframes cyr-smoke {
	0%   { opacity: 1; filter: blur(0);    transform: translateY(0) scale(1); }
	100% { opacity: 0; filter: blur(14px); transform: translateY(-26px) scale(1.04); }
}

/* ---- Loader ---- */
.cyr-app .cyr-loader { display: flex; gap: 8px; justify-content: center; padding: 1.5rem 0; }
.cyr-app .cyr-loader[hidden] { display: none; }
.cyr-app .cyr-loader-dot {
	width: 9px; height: 9px; border-radius: 50%;
	background: var(--cyr-accent); opacity: .35;
	animation: cyr-bounce 1s infinite ease-in-out;
}
.cyr-app .cyr-loader-dot:nth-child(2) { animation-delay: .15s; }
.cyr-app .cyr-loader-dot:nth-child(3) { animation-delay: .3s; }
@keyframes cyr-bounce { 0%,80%,100% { transform: translateY(0); opacity:.35; } 40% { transform: translateY(-8px); opacity:1; } }

/* ---- Generation wait message ---- */
.cyr-app .cyr-wait {
	text-align: center;
	padding: 2rem 1.25rem;
	border: 1px solid var(--cyr-line);
	border-radius: var(--cyr-radius);
	background: var(--cyr-surface);
	box-shadow: var(--cyr-shadow);
}
/* Compact wait box used inline under a senator card (was an inline style). */
.cyr-app .cyr-wait.cyr-wait-inline {
	border: none;
	box-shadow: none;
	padding: 1.25rem;
}
.cyr-app .cyr-wait-text {
	margin: 0 0 1.1rem;
	font-size: 1.08rem;
	font-weight: 600;
	color: var(--cyr-ink);
	/* gentle shimmer so it reads as "actively working", not stuck */
	background: linear-gradient(90deg, var(--cyr-ink) 0%, var(--cyr-ink) 35%, var(--cyr-accent) 50%, var(--cyr-ink) 65%, var(--cyr-ink) 100%);
	background-size: 200% 100%;
	-webkit-background-clip: text; background-clip: text;
	-webkit-text-fill-color: transparent;
	animation: cyr-shimmer 2.4s linear infinite;
}
@keyframes cyr-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.cyr-app .cyr-wait-ellipsis { -webkit-text-fill-color: var(--cyr-accent); color: var(--cyr-accent); }
.cyr-app .cyr-wait-bar { display: flex; gap: 8px; justify-content: center; }
.cyr-app .cyr-wait-bar span {
	width: 11px; height: 11px; border-radius: 50%;
	background: var(--cyr-accent); opacity: .35;
	animation: cyr-bounce 1.1s infinite ease-in-out;
}
.cyr-app .cyr-wait-bar span:nth-child(2) { animation-delay: .18s; }
.cyr-app .cyr-wait-bar span:nth-child(3) { animation-delay: .36s; }

/* ---- Results / rep cards ---- */
.cyr-app .cyr-results { display: flex; flex-direction: column; gap: 1rem; }
.cyr-app .cyr-reveal { animation: cyr-fade-in 420ms ease both; }
@keyframes cyr-fade-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.cyr-app .cyr-multi-header { font-size: 1.15rem; font-weight: 700; text-align: center; margin: .25rem 0; }

.cyr-app .cyr-card {
	display: flex; gap: 16px; align-items: center;
	padding: 18px;
	border: 1px solid var(--cyr-line);
	border-radius: var(--cyr-radius);
	background: var(--cyr-surface);
	box-shadow: var(--cyr-shadow);
}
.cyr-app .cyr-card.cyr-selectable { cursor: pointer; transition: border-color 160ms ease, transform 120ms ease; }
.cyr-app .cyr-card.cyr-selectable:hover { border-color: var(--cyr-accent); transform: translateY(-1px); }

/* Photos are round, square aspect, cropped at 40% from top (where faces sit in
   the taller official portraits). Default (confirmed/single rep) is larger;
   the compact variant is used in the multi-rep list. */
.cyr-app .cyr-card-photo {
	width: 96px; height: 96px;
	border-radius: 50%;
	object-fit: cover;
	object-position: center 40%;
	background: var(--cyr-surface-2);
	flex: 0 0 auto;
}
.cyr-app .cyr-card.cyr-compact { padding: 14px 18px; }
.cyr-app .cyr-card.cyr-compact .cyr-card-photo { width: 65px; height: 65px; }

.cyr-app .cyr-card-body { flex: 1 1 auto; min-width: 0; }
.cyr-app .cyr-card-name { font-size: 1.15rem; font-weight: 700; margin: 0 0 2px; }
.cyr-app .cyr-card-meta { color: var(--cyr-muted); font-size: .92rem; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px 12px; }
/* In the compact (multi-rep, button-less) card, drop the meta's bottom margin
   so the text block centers cleanly against the photo instead of sitting high. */
.cyr-app .cyr-card.cyr-compact .cyr-card-meta { margin-bottom: 0; }
.cyr-app .cyr-pill { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; color: #fff; }
.cyr-app .cyr-pill.cyr-dem { background: var(--cyr-dem); }
.cyr-app .cyr-pill.cyr-rep { background: var(--cyr-rep); }
.cyr-app .cyr-pill.cyr-other { background: var(--cyr-muted); }

.cyr-app .cyr-actions { display: flex; gap: 8px; }
.cyr-app .cyr-actions .cyr-btn { flex: 1 1 0; justify-content: center; }
.cyr-app .cyr-btn {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 9px 16px; font-size: .92rem; font-weight: 600;
	border-radius: 30px;
	border: 1px solid var(--cyr-accent);
	background: var(--cyr-accent);
	color: var(--cyr-accent-ink);
	text-decoration: none; cursor: pointer; text-align: center;
}
.cyr-app .cyr-btn.cyr-btn-ghost {
	background: transparent;
	color: var(--cyr-accent);
}
.cyr-app .cyr-btn:focus-visible { outline: 2px solid var(--cyr-accent); outline-offset: 2px; }

/* Vacant seat notice */
.cyr-app .cyr-vacant {
	padding: 18px; border: 1px dashed var(--cyr-line); border-radius: var(--cyr-radius);
	background: var(--cyr-surface-2); color: var(--cyr-muted); text-align: center;
}

/* Address fallback */
.cyr-app .cyr-address-prompt { text-align: center; color: var(--cyr-muted); margin: .5rem 0; }
.cyr-app .cyr-address-form {
	display: grid;
	gap: 8px;            /* vertical gap between rows = horizontal gap in the row */
	max-width: 460px;
	margin: 0 auto;
}
.cyr-app .cyr-address-form input {
	margin: 0;
	padding: 12px 18px; border: 1px solid var(--cyr-line); border-radius: 30px;
	font-size: 1rem; box-sizing: border-box; width: 100%;
}
.cyr-app .cyr-address-row { display: grid; grid-template-columns: 1fr 90px 110px; gap: 8px; margin: 0; }
/* The address submit reuses .cyr-btn but needs the pill radius and full width. */
.cyr-app .cyr-address-form .cyr-btn { border-radius: 30px; justify-content: center; padding: 12px 18px; margin: 0; }

/* Letter panel */
.cyr-app .cyr-letter-panel { border: 1px solid var(--cyr-line); border-radius: var(--cyr-radius); background: var(--cyr-surface); box-shadow: var(--cyr-shadow); overflow: hidden; }
.cyr-app .cyr-letter-head { padding: 14px 18px; border-bottom: 1px solid var(--cyr-line); font-weight: 700; }
.cyr-app .cyr-letter-body {
	margin: 0; padding: 18px; white-space: pre-wrap; word-wrap: break-word;
	font-family: ui-serif, Georgia, "Times New Roman", serif; font-size: 1rem; line-height: 1.6;
	max-height: 360px; overflow: auto; background: var(--cyr-surface);
}
.cyr-app .cyr-letter-foot { padding: 14px 18px; border-top: 1px solid var(--cyr-line); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* Copy + Open form share the row 50/50 until they need to wrap on narrow screens. */
.cyr-app .cyr-letter-foot .cyr-btn { flex: 1 1 200px; justify-content: center; }
.cyr-app .cyr-copied { flex: 1 1 100%; color: var(--cyr-accent); font-size: .9rem; font-weight: 600; text-align: center; }

.cyr-app .cyr-error { text-align: center; color: var(--cyr-rep); padding: 1rem; }

@media (max-width: 480px) {
	.cyr-app .cyr-address-row { grid-template-columns: 1fr; }
	.cyr-app .cyr-card { flex-direction: column; }
}

/* Respect reduced-motion: keep the meaning, drop the movement. */
@media (prefers-reduced-motion: reduce) {
	.cyr-zip-field, .cyr-zip-stage.cyr-dissolving .cyr-zip-form,
	.cyr-reveal, .cyr-loader-dot,
	.cyr-app .cyr-wait-text { animation: none !important; }
	.cyr-app .cyr-zip-stage.cyr-dissolving .cyr-zip-form { opacity: 0; }
	/* Keep the shimmer text legible (no gradient animation = transparent text);
	   restore a solid fill. The dots keep a gentle pulse so it still reads as working. */
	.cyr-app .cyr-wait-text { -webkit-text-fill-color: var(--cyr-ink); color: var(--cyr-ink); background: none; }
}
