/* ============================================================
   alfajor.sh — design tokens
   ============================================================ */
:root {
	color-scheme: light dark;
	--bg:            #f4f6f9;
	--surface:       #ffffff;
	--surface-alt:   #eef1f6;
	--text:          #1a2233;
	--text-muted:    #5b6472;
	--border:        #e2e6ed;

	--primary:       #4b2c82;
	--primary-dark:  #2c1a52;
	--primary-soft:  #efe9fb;
	--accent-orange: #ff7a29;
	--accent-green:  #4ade80;

	--radius:        14px;
	--radius-sm:     8px;
	--shadow:        0 1px 2px rgba(20, 30, 60, .04), 0 8px 24px rgba(20, 30, 60, .06);
	--shadow-hover:  0 4px 10px rgba(20, 30, 60, .06), 0 16px 32px rgba(20, 30, 60, .10);

	--font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Courier New", monospace;

	--max: 1120px;
	--header-bg: rgba(244, 246, 249, .88);
}

/* ============================================================
   Dark theme — follows the OS setting automatically via
   prefers-color-scheme. No JS, no manual switch.
   ============================================================ */
@media (prefers-color-scheme: dark) {
	:root {
		--bg:            #15101f;
		--surface:       #1e1832;
		--surface-alt:   #261e3c;
		--text:          #f2eefb;
		--text-muted:    #b6acd0;
		--border:        #392d57;

		--primary:       #9b7ff0;
		--primary-dark:  #7358cf;
		--primary-soft:  #2b2147;
		--accent-orange: #ff9152;
		--accent-green:  #6ee7a0;

		--shadow:        0 1px 2px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.45);
		--shadow-hover:  0 4px 12px rgba(0,0,0,.5), 0 18px 36px rgba(0,0,0,.5);
		--header-bg:     rgba(21, 16, 31, .88);
	}
}

/* ============================================================
   Cross-document view transitions — native slide, no JS.
   Unsupported browsers simply navigate normally (safe fallback).
   ============================================================ */
@view-transition {
	navigation: auto;
}
@keyframes vt-slide-out {
	to { transform: translateX(-100%); opacity: 0; }
}
@keyframes vt-slide-in {
	from { transform: translateX(100%); opacity: 0; }
}
::view-transition-old(root) {
	animation: 320ms cubic-bezier(.4, 0, .2, 1) both vt-slide-out;
}
::view-transition-new(root) {
	animation: 320ms cubic-bezier(.4, 0, .2, 1) both vt-slide-in;
}
@media (prefers-reduced-motion: reduce) {
	::view-transition-group(*),
	::view-transition-old(*),
	::view-transition-new(*) {
		animation: none !important;
	}
}

/* ============================================================
   Utility classes — replace inline style="" so the CSP can
   drop 'unsafe-inline' for styles.
   ============================================================ */
.u-m-0 { margin: 0; }
.u-mt-16 { margin-top: 16px; }
.u-mt-24-center { text-align: center; margin-top: 24px; }
.u-mt-8-center-muted { text-align: center; margin-top: 8px; color: var(--text-muted); }
.u-center-actions { justify-content: center; }
.u-mb-32 { margin-bottom: 32px; }
.u-rounded { border-radius: var(--radius); }
.u-muted-list { color: var(--text-muted); font-size: .93rem; }
.u-hero-grid-centered { align-items: center; margin-bottom: 48px; }
.eyebrow.u-tag-accent { background: transparent; color: var(--accent-green); padding: 0; }
.u-link-primary { color: var(--primary); font-weight: 600; text-decoration: none; }

/* ============================================================
   Reset & base
   ============================================================ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	transition: background .2s ease, color .2s ease;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
ul { padding-left: 1.1em; }

h1, h2, h3 {
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.15;
	margin: 0 0 .5em;
}
h1 { font-size: clamp(2rem, 4vw + 1rem, 3rem); }
h2 { font-size: clamp(1.5rem, 2vw + 1rem, 2.1rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; color: var(--text-muted); }

:focus-visible {
	outline: 2px solid var(--primary);
	outline-offset: 3px;
}

.container {
	max-width: var(--max);
	margin: 0 auto;
	padding: 0 24px;
}

.eyebrow {
	display: inline-block;
	font-family: var(--font-mono);
	font-size: .78rem;
	letter-spacing: .06em;
	text-transform: lowercase;
	color: var(--primary);
	background: var(--primary-soft);
	border-radius: 999px;
	padding: .3em .8em;
	margin-bottom: 1em;
}

/* ============================================================
   Bilingual toggle — pure CSS, JS only sets the attribute
   ============================================================ */
html[data-lang="en"] .es { display: none; }
html[data-lang="es"] .en { display: none; }

/* ============================================================
   Home splash — full viewport, no scroll needed to see options
   ============================================================ */
.splash {
	min-height: calc(100vh - 72px);
	min-height: calc(100dvh - 72px);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 20px;
	padding-top: 16px;
	padding-right: 24px;
	padding-bottom: 32px;
	padding-left: 24px;
}
.splash-logo {
	width: 140px;
	height: 140px;
	object-fit: contain;
	margin: 0 auto;
	box-sizing: border-box;
	background: #fff;
	border: 1px solid var(--border);
	border-radius: 28px;
	padding: 16px;
	box-shadow: var(--shadow);
}
.splash h1 { max-width: 16ch; }
.splash .lead { max-width: 48ch; margin: 0 auto; }

.splash-links {
	display: grid;
	grid-template-columns: repeat(2, minmax(130px, 1fr));
	gap: 12px;
	width: 100%;
	max-width: 520px;
	margin-top: 8px;
}
@media (min-width: 640px) {
	.splash-links { grid-template-columns: repeat(4, 1fr); }
}
.splash-link {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 20px 12px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	text-decoration: none;
	color: var(--text);
	font-weight: 600;
	font-size: .93rem;
	transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.splash-link:hover {
	transform: translateY(-3px);
	box-shadow: var(--shadow-hover);
	border-color: var(--primary);
}
.splash-link .ic { font-size: 1.6rem; }

.scroll-cue {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	margin-top: 6px;
	color: var(--text-muted);
	text-decoration: none;
	font-family: var(--font-mono);
	font-size: .78rem;
}
.scroll-cue:hover { color: var(--primary); }
.scroll-cue .arrow { animation: scroll-bounce 1.8s ease-in-out infinite; }
@keyframes scroll-bounce {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(6px); }
}
@media (prefers-reduced-motion: reduce) {
	.scroll-cue .arrow { animation: none; }
}

/* ============================================================
   Utility classes — replace one-off inline styles so CSP can
   run without 'unsafe-inline' on style-src.
   ============================================================ */
.hero-tight { padding-bottom: 0; }
.price-sub { margin: 0; }
.pricing-note { text-align: center; margin-top: 24px; }
.pricing-note-muted { text-align: center; margin-top: 8px; color: var(--text-muted); }
.link-strong { color: var(--primary); font-weight: 600; text-decoration: none; }
.contact-note { margin-top: 16px; }
.section-alt .trust-row { margin-bottom: 32px; }
.cta .eyebrow { background: transparent; color: var(--accent-green); padding: 0; }
.cta .hero-actions { justify-content: center; }

/* ============================================================
   Header / Nav
   ============================================================ */
.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: var(--header-bg);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--border);
	transition: background .2s ease, border-color .2s ease;
}

.nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-top: 14px;
	padding-bottom: 14px;
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	color: var(--text);
	font-weight: 700;
	font-size: 1.15rem;
}
.brand img {
	width: 32px;
	height: 32px;
	object-fit: contain;
	box-sizing: border-box;
	background: #fff;
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 3px;
}

.nav-links {
	display: flex;
	align-items: center;
	gap: 4px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.nav-links a {
	display: block;
	padding: 8px 14px;
	border-radius: var(--radius-sm);
	text-decoration: none;
	color: var(--text-muted);
	font-size: .95rem;
	font-weight: 500;
	transition: background .15s ease, color .15s ease;
}
.nav-links a:hover { background: var(--surface-alt); color: var(--text); }
.nav-links a[aria-current="page"] {
	color: var(--primary);
	background: var(--primary-soft);
}
.nav-links a.btn-primary { color: #fff; }
.nav-links a.btn-outline { color: var(--text); }

.nav-right { display: flex; align-items: center; gap: 8px; }

.lang-btn {
	font-family: var(--font-mono);
	font-size: .82rem;
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text-muted);
	border-radius: 999px;
	padding: 6px 12px;
	cursor: pointer;
}
.lang-btn:hover { border-color: var(--primary); color: var(--primary); }

.nav-toggle-checkbox {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	pointer-events: none;
}

.nav-toggle {
	display: none;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	width: 40px;
	height: 40px;
	cursor: pointer;
	color: var(--text);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 22px;
	border-radius: var(--radius-sm);
	font-weight: 600;
	font-size: .95rem;
	text-decoration: none;
	border: 1px solid transparent;
	cursor: pointer;
	transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
}
.btn-primary {
	background: var(--primary);
	color: #fff;
	box-shadow: var(--shadow);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-hover); }
.btn-outline {
	background: var(--surface);
	color: var(--text);
	border-color: var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
	padding-top: 72px;
	padding-bottom: 56px;
}
.hero-grid {
	display: grid;
	gap: 40px;
	align-items: center;
	grid-template-columns: 1fr;
}
.hero p.lead {
	font-size: 1.1rem;
	max-width: 46ch;
}
.hero-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 1.5em;
}

/* Signature element: stacked infrastructure "layers", echoing the
   alfajor's own cross-section of layers. Pure CSS, no images. */
.layers {
	display: flex;
	flex-direction: column-reverse;
	gap: 14px;
	max-width: 380px;
	margin: 0 auto;
}
.layer {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 16px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	transform: perspective(600px) rotateX(2deg);
}
.layer .name { font-weight: 700; font-size: .95rem; }
.layer .tag {
	font-family: var(--font-mono);
	font-size: .75rem;
	color: var(--text-muted);
}
.layer-1 { background: var(--primary-soft); }
.layer-4 {
	background: linear-gradient(135deg, var(--primary), var(--primary-dark));
	color: #fff;
	border-color: transparent;
}
.layer-4 .tag { color: var(--accent-green); }

/* ============================================================
   Trust bar
   ============================================================ */
.trust {
	padding: 28px 0;
	border-top: 1px solid var(--border);
	border-bottom: 1px solid var(--border);
	background: var(--surface);
}
.trust-row {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 28px;
	justify-content: center;
	font-family: var(--font-mono);
	font-size: .85rem;
	color: var(--text-muted);
}
.trust-row span { white-space: nowrap; }

/* ============================================================
   Sections
   ============================================================ */
.section { padding-top: 64px; padding-bottom: 64px; }
.section-head {
	max-width: 60ch;
	margin: 0 auto 40px;
	text-align: center;
}
.section-alt { background: var(--surface); border-radius: var(--radius); }

/* ============================================================
   Services carousel — horizontal scroll-snap, no JS. Swipe on
   touch, drag/scroll on desktop, arrow keys when focused.
   ============================================================ */
.scroll-hint {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--text-muted);
	font-family: var(--font-mono);
	font-size: .8rem;
	margin-bottom: 16px;
}
.services-scroll {
	display: flex;
	gap: 18px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	padding: 4px 8px 28px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: var(--border) transparent;
}
.services-scroll::-webkit-scrollbar { height: 8px; }
.services-scroll::-webkit-scrollbar-track { background: transparent; }
.services-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.services-scroll:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.services-scroll .card {
	flex: 0 0 clamp(240px, 78%, 380px);
	scroll-snap-align: start;
}
.services-scroll .card:last-child { margin-right: 4px; }

.carousel { position: relative; }
.carousel-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text);
	font-size: 1.3rem;
	line-height: 1;
	cursor: pointer;
	box-shadow: var(--shadow);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
.carousel-arrow:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-50%) scale(1.06); }
.carousel-arrow.prev { left: -6px; }
.carousel-arrow.next { right: -6px; }
@media (max-width: 640px) {
	.carousel-arrow { width: 32px; height: 32px; font-size: 1rem; }
	.carousel-arrow.prev { left: 0; }
	.carousel-arrow.next { right: 0; }
}

/* ============================================================
   Cards / grid
   ============================================================ */
.grid {
	display: grid;
	gap: 20px;
	grid-template-columns: 1fr;
}
@media (min-width: 640px) {
	.grid-2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
	.grid-3 { grid-template-columns: repeat(3, 1fr); }
	.grid-3 > :last-child:nth-child(3n+1) { grid-column: 2; }
}

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 26px;
	box-shadow: var(--shadow);
	transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

.card-icon {
	font-size: 1.6rem;
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--primary-soft);
	border-radius: var(--radius-sm);
	margin-bottom: 14px;
}

.card ul { margin: .8em 0 0; padding-left: 1.2em; color: var(--text-muted); font-size: .93rem; }
.card ul li { margin-bottom: .35em; }

/* ============================================================
   Pricing
   ============================================================ */
.price-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 28px;
	box-shadow: var(--shadow);
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.price-card.featured {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-hover);
	position: relative;
}
.price-card .badge {
	position: absolute;
	top: -12px;
	right: 20px;
	background: var(--accent-orange);
	color: #241a3d;
	font-size: .72rem;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	padding: 4px 10px;
	border-radius: 999px;
}
.price {
	font-size: 2.1rem;
	font-weight: 700;
	color: var(--text);
}
.price .period { font-size: .95rem; font-weight: 500; color: var(--text-muted); }
.price-card ul { list-style: none; padding: 0; margin: 0; color: var(--text-muted); font-size: .93rem; }
.price-card ul li { padding: 6px 0; border-top: 1px solid var(--border); }
.price-card ul li:first-child { border-top: none; }

/* ============================================================
   CTA band
   ============================================================ */
.cta {
	background: linear-gradient(135deg, var(--primary-dark), var(--primary));
	color: #fff;
	border-radius: var(--radius);
	padding: 48px 32px;
	text-align: center;
}
.cta h2 { color: #fff; }
.cta p { color: rgba(255,255,255,.85); }
.cta .btn-outline { background: transparent; border-color: rgba(255,255,255,.5); color: #fff; }
.cta .btn-outline:hover { background: rgba(255,255,255,.12); border-color: #fff; }
.cta .btn-primary { background: #fff; color: var(--primary-dark); }
.cta .btn-primary:hover { background: #eef1f6; }

/* ============================================================
   Contact
   ============================================================ */
.contact-grid {
	display: grid;
	gap: 20px;
	grid-template-columns: 1fr;
}
@media (min-width: 760px) {
	.contact-grid { grid-template-columns: 1.1fr .9fr; }
}
.contact-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 28px;
	box-shadow: var(--shadow);
}
.contact-email {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	background: var(--primary-soft);
	border-radius: var(--radius-sm);
	padding: 14px 18px;
	font-family: var(--font-mono);
	font-size: .95rem;
	margin: 14px 0;
	flex-wrap: wrap;
}

.xmpp-card {
	grid-column: 1 / -1;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 24px;
}
.xmpp-card .xmpp-text { flex: 1 1 260px; }
.xmpp-qr-wrap {
	flex: 0 0 auto;
	background: #fff;
	padding: 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow);
}
.xmpp-qr { display: block; width: 160px; height: 160px; }
.copy-btn {
	border: 1px solid var(--border);
	background: var(--surface);
	border-radius: var(--radius-sm);
	padding: 6px 12px;
	font-size: .82rem;
	cursor: pointer;
	color: var(--text);
}
.copy-btn:hover { border-color: var(--primary); color: var(--primary); }
.copy-btn[data-copied="true"]::after { content: " ✓"; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
	border-top: 1px solid var(--border);
	padding-top: 32px;
	padding-bottom: 32px;
	margin-top: 40px;
}
.footer-row {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	align-items: center;
	justify-content: space-between;
	font-size: .85rem;
	color: var(--text-muted);
}
.footer-row a { color: var(--text-muted); text-decoration: none; }
.footer-row a:hover { color: var(--primary); }

/* ============================================================
   About page bits
   ============================================================ */
.about-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: grid;
	gap: 10px;
}
.about-list li {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 12px 16px;
	font-size: .95rem;
}

/* ============================================================
   Responsive: nav / hero at wider widths
   ============================================================ */
@media (min-width: 860px) {
	.hero-grid { grid-template-columns: 1.1fr .9fr; }
}

@media (max-width: 760px) {
	.nav-toggle { display: flex; align-items: center; justify-content: center; }
	.nav-links {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background: var(--surface);
		border-bottom: 1px solid var(--border);
		flex-direction: column;
		align-items: stretch;
		padding: 8px 16px 16px;
		gap: 2px;
		display: none;
	}
	.nav-toggle-checkbox:checked ~ .nav-links { display: flex; }
	.nav-links a { padding: 12px 10px; }
}
