/* Civic Connect — 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. */

.cc-app {
	--cc-ink: #1c1c1c;
	--cc-muted: #5d5d5d;
	--cc-line: #e2e2e2;
	--cc-surface: #ffffff;
	--cc-surface-2: #f7f7f5;
	--cc-accent: #2b4a6f;          /* civic navy; quiet, trustworthy */
	--cc-accent-ink: #ffffff;
	--cc-text: #333333;            /* typed input text */
	--cc-placeholder: #777777;     /* input hint text */
	--cc-dem: #2166a5;
	--cc-rep: #b1283a;
	--cc-radius: 12px;
	--cc-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(--cc-ink);
	line-height: 1.55;
}

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

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

/* Optional name field — matches the ZIP field, sits above it. */
.cc-name-field { display: flex; flex-direction: column; gap: 6px; }
.cc-name-input {
	box-sizing: border-box;
	width: 100% !important;
	margin: 0px !important;
	height: 56px;
	padding: 0 22px;
	font-size: 1.1rem;
	border: 1px solid var(--cc-line);
	border-radius: 30px !important;
	background: var(--cc-surface);
	box-shadow: var(--cc-shadow);
	transition: border-color 160ms ease, box-shadow 160ms ease;
}
.cc-name-input:focus {
	outline: none;
	border-color: var(--cc-accent);
	box-shadow: 0 0 0 3px rgba(43,74,111,.15), var(--cc-shadow);
}
.cc-name-helper { margin: 0 4px 15px; font-size: .82rem; line-height: 1.4; color: var(--cc-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. */
.cc-zip-field {
	display: flex;
	gap: 8px;
	align-items: stretch;
	transform-origin: left center;
	animation: cc-grow-up 560ms cubic-bezier(.16,.84,.44,1) both;
}
@keyframes cc-grow-up {
	0%   { opacity: 0; transform: translateY(14px) scaleX(.2); }
	60%  { opacity: 1; }
	100% { opacity: 1; transform: translateY(0) scaleX(1); }
}

.cc-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(--cc-line);
	border-radius: 30px !important;
	background: var(--cc-surface);
	box-shadow: var(--cc-shadow);
	transition: border-color 160ms ease, box-shadow 160ms ease;
}
.cc-zip-input:focus {
	outline: none;
	border-color: var(--cc-accent);
	box-shadow: 0 0 0 3px rgba(43,74,111,.15), var(--cc-shadow);
}

.cc-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(--cc-accent-ink) !important;
	background: var(--cc-accent) !important;
	border: 1px solid var(--cc-accent) !important;
	border-radius: 30px !important;
	cursor: pointer;
	transition: filter 140ms ease, transform 120ms ease;
}
.cc-zip-submit:hover { filter: brightness(1.08); }
.cc-zip-submit:active { transform: translateY(1px); }
.cc-zip-submit:focus-visible { outline: 2px solid var(--cc-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. !important 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. */
.cc-app input { color: var(--cc-text) !important; }
.cc-app input::placeholder { color: var(--cc-placeholder) !important; text-transform: uppercase; opacity: 1 !important; letter-spacing: .05em; font-size: 16px; }
.cc-app input::-webkit-input-placeholder { color: var(--cc-placeholder) !important; text-transform: uppercase; opacity: 1 !important; letter-spacing: .05em; font-size: 16px; }
.cc-app input::-moz-placeholder { color: var(--cc-placeholder) !important; text-transform: uppercase; opacity: 1 !important; letter-spacing: .05em; font-size: 16px; }
.cc-app input:-ms-input-placeholder { color: var(--cc-placeholder) !important; 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. */
.cc-zip-stage.cc-dissolving .cc-zip-form {
	animation: cc-smoke 620ms ease-in forwards;
	pointer-events: none;
}
@keyframes cc-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 ---- */
.cc-loader { display: flex; gap: 8px; justify-content: center; padding: 1.5rem 0; }
.cc-loader[hidden] { display: none; }
.cc-loader-dot {
	width: 9px; height: 9px; border-radius: 50%;
	background: var(--cc-accent); opacity: .35;
	animation: cc-bounce 1s infinite ease-in-out;
}
.cc-loader-dot:nth-child(2) { animation-delay: .15s; }
.cc-loader-dot:nth-child(3) { animation-delay: .3s; }
@keyframes cc-bounce { 0%,80%,100% { transform: translateY(0); opacity:.35; } 40% { transform: translateY(-8px); opacity:1; } }

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

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

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

.cc-card {
	display: flex; gap: 16px; align-items: center;
	padding: 18px;
	border: 1px solid var(--cc-line);
	border-radius: var(--cc-radius);
	background: var(--cc-surface);
	box-shadow: var(--cc-shadow);
}
.cc-card.cc-selectable { cursor: pointer; transition: border-color 160ms ease, transform 120ms ease; }
.cc-card.cc-selectable:hover { border-color: var(--cc-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. */
.cc-card-photo {
	width: 96px; height: 96px !important;
	border-radius: 50% !important;
	object-fit: cover;
	object-position: center 40%;
	background: var(--cc-surface-2);
	flex: 0 0 auto;
}
.cc-card.cc-compact { padding: 14px 18px; }
.cc-card.cc-compact .cc-card-photo { width: 65px; height: 65px !important; }

.cc-card-body { flex: 1 1 auto; min-width: 0; }
.cc-card-name { font-size: 1.15rem; font-weight: 700; margin: 0 0 2px; }
.cc-card-meta { color: var(--cc-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. */
.cc-card.cc-compact .cc-card-meta { margin-bottom: 0; }
.cc-pill { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; color: #fff; }
.cc-pill.cc-dem { background: var(--cc-dem); }
.cc-pill.cc-rep { background: var(--cc-rep); }
.cc-pill.cc-other { background: var(--cc-muted); }

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

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

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

/* Letter panel */
.cc-letter-panel { border: 1px solid var(--cc-line); border-radius: var(--cc-radius); background: var(--cc-surface); box-shadow: var(--cc-shadow); overflow: hidden; }
.cc-letter-head { padding: 14px 18px; border-bottom: 1px solid var(--cc-line); font-weight: 700; }
.cc-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(--cc-surface);
}
.cc-letter-foot { padding: 14px 18px; border-top: 1px solid var(--cc-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. */
.cc-letter-foot .cc-btn { flex: 1 1 200px; justify-content: center; }
.cc-copied { flex: 1 1 100%; color: var(--cc-accent); font-size: .9rem; font-weight: 600; text-align: center; }

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

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

/* Respect reduced-motion: keep the meaning, drop the movement. */
@media (prefers-reduced-motion: reduce) {
	.cc-zip-field, .cc-zip-stage.cc-dissolving .cc-zip-form,
	.cc-reveal, .cc-loader-dot,
	.cc-wait-text { animation: none !important; }
	.cc-zip-stage.cc-dissolving .cc-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. */
	.cc-wait-text { -webkit-text-fill-color: var(--cc-ink); color: var(--cc-ink); background: none; }
}
