/*
 * AI Companion theme styles.
 * Mobile-first, token-driven, no framework.
 */

:root {
	--bg: #0d0b1a;
	--bg-soft: #16132b;
	--surface: #1d1936;
	--surface-2: #262046;
	--line: rgba(255, 255, 255, 0.09);
	--text: #f4f1ff;
	--muted: #a49dc4;
	--brand: #ff6b8a;
	--brand-2: #7c6cff;
	--accent: #4be0b4;
	--danger: #ff5470;
	--radius: 18px;
	--radius-sm: 12px;
	--shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
	--font: "Söhne", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--space: 16px;
}

* {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background:
		radial-gradient(900px 500px at 15% -10%, rgba(124, 108, 255, 0.28), transparent 60%),
		radial-gradient(700px 420px at 100% 0%, rgba(255, 107, 138, 0.22), transparent 55%),
		var(--bg);
	color: var(--text);
	font-family: var(--font);
	line-height: 1.55;
	min-height: 100vh;
	padding-bottom: 84px;
}

body.is-ringing {
	overflow: hidden;
}

img {
	max-width: 100%;
	height: auto;
}

a {
	color: var(--text);
	text-decoration: none;
}

a:hover,
a:focus-visible {
	text-decoration: underline;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
	border-radius: 6px;
}

.skip-link {
	position: absolute;
	left: -9999px;
}

.skip-link:focus {
	left: 12px;
	top: 12px;
	background: var(--surface);
	padding: 8px 14px;
	z-index: 999;
	border-radius: 8px;
}

.wrap {
	width: min(1100px, 100% - 32px);
	margin-inline: auto;
}

.wrap.narrow {
	width: min(520px, 100% - 32px);
}

.stack > * + * {
	margin-top: var(--space);
}

.section {
	margin-block: 48px;
}

/* Header ------------------------------------------------------------------ */

.site-header {
	position: sticky;
	top: 0;
	z-index: 40;
	backdrop-filter: blur(14px);
	background: rgba(13, 11, 26, 0.72);
	border-bottom: 1px solid var(--line);
}

.header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-block: 12px;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-weight: 700;
}

.brand-mark {
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--brand), var(--brand-2));
	font-size: 14px;
}

.site-nav {
	display: flex;
	align-items: center;
	gap: 14px;
	font-size: 14px;
}

.site-nav a:not(.btn) {
	color: var(--muted);
}

@media (max-width: 640px) {
	.site-nav a:not(.btn) {
		display: none;
	}
}

/* Buttons ----------------------------------------------------------------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 11px 18px;
	border-radius: 999px;
	border: 1px solid transparent;
	font: inherit;
	font-weight: 600;
	font-size: 15px;
	cursor: pointer;
	transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.btn:active {
	transform: scale(0.97);
}

.btn[disabled] {
	opacity: 0.55;
	cursor: not-allowed;
}

.btn-primary {
	background: linear-gradient(135deg, var(--brand), var(--brand-2));
	color: #fff;
	box-shadow: 0 10px 26px rgba(124, 108, 255, 0.35);
}

.btn-ghost {
	background: rgba(255, 255, 255, 0.06);
	border-color: var(--line);
	color: var(--text);
}

.btn-danger {
	background: rgba(255, 84, 112, 0.14);
	border-color: rgba(255, 84, 112, 0.5);
	color: #ffc4ce;
}

.btn-lg {
	padding: 14px 24px;
	font-size: 16px;
}

/* Typography -------------------------------------------------------------- */

.h1,
.hero-title {
	font-size: clamp(28px, 6vw, 46px);
	line-height: 1.1;
	letter-spacing: -0.02em;
	margin: 0;
}

.h2 {
	font-size: clamp(22px, 4vw, 30px);
	margin: 0 0 16px;
	letter-spacing: -0.01em;
}

.h3 {
	font-size: 18px;
	margin: 0 0 12px;
}

.lede {
	color: var(--muted);
	margin: 8px 0 0;
}

.small {
	font-size: 13px;
	color: var(--muted);
}

.muted {
	color: var(--muted);
}

.label {
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
	margin: 0 0 4px;
}

.value {
	font-size: 20px;
	font-weight: 650;
	margin: 0 0 10px;
}

.page-head {
	padding-top: 28px;
}

/* Hero -------------------------------------------------------------------- */

.hero {
	display: grid;
	gap: 32px;
	padding-block: 48px 24px;
}

@media (min-width: 900px) {
	.hero {
		grid-template-columns: 1.15fr 0.85fr;
		align-items: center;
		padding-block: 72px 40px;
	}
}

.eyebrow {
	color: var(--accent);
	font-size: 13px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	margin: 0 0 12px;
}

.hero-sub {
	color: var(--muted);
	font-size: clamp(16px, 2.4vw, 19px);
	max-width: 46ch;
	margin: 16px 0 24px;
}

.hero-cta {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.hero-note {
	margin-top: 16px;
	font-size: 13px;
	color: var(--muted);
}

.hero-phone {
	display: grid;
	place-items: center;
}

.phone-frame {
	width: min(300px, 90%);
	padding: 32px 22px 26px;
	text-align: center;
	border-radius: 34px;
	border: 1px solid var(--line);
	background: linear-gradient(180deg, var(--surface), var(--bg-soft));
	box-shadow: var(--shadow);
}

.phone-label,
.incoming-label {
	font-size: 13px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--muted);
	margin: 0 0 20px;
}

.phone-avatar,
.incoming-avatar,
.call-avatar {
	width: 104px;
	height: 104px;
	margin: 0 auto;
	display: grid;
	place-items: center;
	font-size: 44px;
	border-radius: 50%;
	background: linear-gradient(135deg, rgba(255, 107, 138, 0.3), rgba(124, 108, 255, 0.3));
	border: 1px solid var(--line);
}

.phone-name,
.incoming-name,
.call-name {
	font-size: 24px;
	font-weight: 700;
	margin: 16px 0 2px;
}

.phone-role,
.incoming-role,
.call-role {
	color: var(--muted);
	margin: 0;
	font-size: 14px;
}

.phone-actions,
.incoming-actions {
	display: flex;
	justify-content: center;
	gap: 44px;
	margin-top: 28px;
}

.round {
	width: 62px;
	height: 62px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	font-size: 22px;
	border: none;
	color: #fff;
	cursor: pointer;
}

.round.decline {
	background: var(--danger);
}

.round.accept {
	background: #2fbf71;
}

.pulse {
	animation: pulse 1.6s infinite;
}

@keyframes pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(47, 191, 113, 0.55);
	}
	70% {
		box-shadow: 0 0 0 20px rgba(47, 191, 113, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(47, 191, 113, 0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.pulse {
		animation: none;
	}
}

/* Cards & grid ------------------------------------------------------------ */

.card {
	background: linear-gradient(180deg, var(--surface), var(--bg-soft));
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 20px;
	box-shadow: var(--shadow);
}

.notice-card {
	border-color: rgba(255, 187, 84, 0.45);
	background: rgba(255, 187, 84, 0.1);
}

.grid {
	display: grid;
	gap: 14px;
}

.grid.two {
	grid-template-columns: 1fr;
}

@media (min-width: 640px) {
	.grid.two {
		grid-template-columns: 1fr 1fr;
	}
}

.grid.cards {
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.companion-card {
	text-align: center;
}

.companion-avatar {
	width: 72px;
	height: 72px;
	margin: 0 auto 12px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	font-size: 30px;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid var(--line);
	overflow: hidden;
}

.companion-name {
	margin: 0;
	font-size: 18px;
}

.companion-role {
	margin: 2px 0 8px;
	color: var(--accent);
	font-size: 13px;
}

.companion-blurb {
	color: var(--muted);
	font-size: 14px;
	min-height: 3.2em;
}

.companion-actions {
	display: flex;
	gap: 8px;
	justify-content: center;
	flex-wrap: wrap;
}

.steps {
	display: grid;
	gap: 12px;
	padding-left: 20px;
	color: var(--muted);
}

.steps strong {
	display: block;
	color: var(--text);
}

.plan .price strong {
	font-size: 30px;
}

/* Lists ------------------------------------------------------------------- */

.list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 10px;
}

.list .row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 14px;
	border-radius: var(--radius-sm);
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid var(--line);
}

.row-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* Forms ------------------------------------------------------------------- */

.form {
	display: grid;
	gap: 14px;
}

.form.inline {
	grid-template-columns: 1fr;
}

@media (min-width: 640px) {
	.form.inline {
		grid-template-columns: 1fr 1fr auto;
		align-items: end;
	}
}

.field {
	display: grid;
	gap: 6px;
	font-size: 14px;
	color: var(--muted);
	border: 0;
	padding: 0;
	margin: 0;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="time"],
.field input[type="number"],
.field select,
.login input[type="text"],
.login input[type="password"] {
	width: 100%;
	padding: 12px 14px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--line);
	background: rgba(0, 0, 0, 0.28);
	color: var(--text);
	font: inherit;
}

.field.switch {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--text);
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid var(--line);
	font-size: 13px;
	color: var(--text);
}

.form-msg {
	min-height: 1.2em;
	font-size: 14px;
	color: var(--accent);
}

.login {
	display: grid;
	gap: 12px;
}

.login-submit input,
.login .button {
	width: 100%;
	padding: 13px 18px;
	border-radius: 999px;
	border: none;
	background: linear-gradient(135deg, var(--brand), var(--brand-2));
	color: #fff;
	font: inherit;
	font-weight: 650;
	cursor: pointer;
}

/* Incoming call overlay ---------------------------------------------------- */

.incoming {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: grid;
	place-items: center;
	background: linear-gradient(180deg, rgba(13, 11, 26, 0.97), rgba(29, 25, 54, 0.99));
	animation: fade 0.25s ease;
	padding: 24px;
	text-align: center;
}

@keyframes fade {
	from {
		opacity: 0;
	}
}

.incoming-disclosure,
.call-disclosure {
	margin-top: 14px;
	font-size: 12px;
	color: var(--muted);
}

/* Call screen -------------------------------------------------------------- */

.call-screen {
	min-height: calc(100vh - 140px);
	display: grid;
	grid-template-rows: auto 1fr auto auto;
	gap: 18px;
	padding: 24px 20px 32px;
	text-align: center;
	max-width: 520px;
	margin-inline: auto;
}

.call-top {
	display: flex;
	justify-content: space-between;
	color: var(--muted);
	font-size: 14px;
}

.call-body {
	display: grid;
	align-content: center;
	gap: 4px;
}

.call-visualizer {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-top: 22px;
	height: 34px;
	align-items: flex-end;
}

.call-visualizer span {
	width: 6px;
	height: 10px;
	border-radius: 4px;
	background: linear-gradient(180deg, var(--brand), var(--brand-2));
	opacity: 0.5;
}

[data-speaking="true"] .call-visualizer span {
	animation: bars 0.8s ease-in-out infinite;
	opacity: 1;
}

.call-visualizer span:nth-child(2) {
	animation-delay: 0.1s;
}
.call-visualizer span:nth-child(3) {
	animation-delay: 0.2s;
}
.call-visualizer span:nth-child(4) {
	animation-delay: 0.3s;
}
.call-visualizer span:nth-child(5) {
	animation-delay: 0.4s;
}

@keyframes bars {
	0%,
	100% {
		height: 10px;
	}
	50% {
		height: 32px;
	}
}

.call-transcript {
	max-height: 34vh;
	overflow-y: auto;
	text-align: left;
	padding: 14px;
	border-radius: var(--radius);
	background: rgba(0, 0, 0, 0.3);
	border: 1px solid var(--line);
	font-size: 14px;
}

.call-transcript .line.you {
	color: var(--accent);
}

.call-controls {
	display: flex;
	justify-content: center;
	gap: 12px;
	flex-wrap: wrap;
}

.ctrl {
	display: grid;
	gap: 4px;
	justify-items: center;
	padding: 12px 14px;
	min-width: 74px;
	border-radius: var(--radius);
	border: 1px solid var(--line);
	background: rgba(255, 255, 255, 0.05);
	color: var(--text);
	font: inherit;
	font-size: 20px;
	cursor: pointer;
}

.ctrl.active {
	background: rgba(255, 107, 138, 0.2);
	border-color: var(--brand);
}

.ctrl.end {
	background: var(--danger);
	border-color: var(--danger);
	color: #fff;
}

.ctrl-label {
	font-size: 12px;
}

.call-error {
	color: #ffc4ce;
	font-size: 14px;
}

/* Tab bar & footer --------------------------------------------------------- */

.tabbar {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 30;
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 2px;
	padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
	background: rgba(13, 11, 26, 0.94);
	backdrop-filter: blur(14px);
	border-top: 1px solid var(--line);
}

.tabbar a {
	display: grid;
	justify-items: center;
	gap: 2px;
	font-size: 11px;
	color: var(--muted);
	text-decoration: none;
}

.tabbar a span {
	font-size: 18px;
}

.site-footer {
	margin-top: 48px;
	padding: 28px 0;
	border-top: 1px solid var(--line);
	text-align: center;
}

.ai-disclosure {
	color: var(--muted);
	font-size: 13px;
	max-width: 60ch;
	margin-inline: auto;
}

.prose h2 {
	margin-top: 24px;
}

.prose p {
	color: var(--muted);
}

/* Chat screen --------------------------------------------------------------
   New block for the text-chat feature. Reuses existing tokens (--surface,
   --brand, --radius, etc.) and doesn't touch any rule above this line. */

.chat-screen {
	display: flex;
	flex-direction: column;
	gap: var(--space);
	max-width: 640px;
	margin-inline: auto;
	height: calc(100vh - 140px);
	padding: var(--space) 0;
}

.chat-top {
	display: flex;
	align-items: center;
	gap: 12px;
}

.chat-top-text {
	flex: 1;
	min-width: 0;
}

.chat-avatar {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--surface-2);
	font-size: 22px;
	flex-shrink: 0;
}

.chat-name {
	font-size: 18px;
	margin: 0;
}

.chat-disclosure {
	color: var(--muted);
	font-size: 12px;
	margin: 2px 0 0;
}

.chat-log {
	flex: 1;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 14px;
	border-radius: var(--radius);
	background: rgba(0, 0, 0, 0.2);
	border: 1px solid var(--line);
}

.chat-bubble {
	margin: 0;
	padding: 10px 14px;
	border-radius: var(--radius-sm);
	max-width: 78%;
	font-size: 14px;
	line-height: 1.4;
	white-space: pre-wrap;
	word-break: break-word;
}

.chat-bubble-user {
	align-self: flex-end;
	background: linear-gradient(135deg, var(--brand), var(--brand-2));
	color: #fff;
}

.chat-bubble-ai {
	align-self: flex-start;
	background: var(--surface-2);
	color: var(--text);
}

.chat-bubble-typing {
	color: var(--muted);
	font-style: italic;
}

.chat-error {
	color: #ffc4ce;
	font-size: 14px;
}

.chat-composer {
	display: flex;
	gap: 10px;
	align-items: flex-end;
}

.chat-input {
	flex: 1;
	resize: none;
	max-height: 160px;
	padding: 12px 14px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--line);
	background: var(--surface);
	color: var(--text);
	font: inherit;
	font-size: 14px;
}

.chat-input:focus {
	outline: 2px solid var(--accent);
}
