/*
Theme Name: Percorso
Description: Tema WordPress custom monopagina con upload foto e analisi tramite Assistant OpenAI.
Author: Stefano Gili
Version: 1.0.0
Text Domain: percorso
*/

:root {
	--bg: #000000;
	--bg-elevated: #121212;
	--bg-card: #1a1a1a;
	--border: rgba(255, 255, 255, 0.1);
	--text: #ffffff;
	--text-muted: rgba(255, 255, 255, 0.68);
	--text-faint: rgba(255, 255, 255, 0.4);
	--accent: #f2b705;
	--accent-hover: #d9a400;
	--danger: #ff6b6b;
	--success: #4ade80;
	--radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
	margin: 0;
	font-family: 'Inter', system-ui, -apple-system, sans-serif;
	color: var(--text);
	background: var(--bg);
	line-height: 1.6;
}

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

a { color: inherit; text-decoration: none; }

.container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 1.5rem;
}

hr.divider {
	border: none;
	border-top: 1px solid var(--border);
	max-width: 120px;
	margin: 1.75rem auto;
}

/* Header */
.site-header {
	background: var(--bg);
	border-bottom: 1px solid var(--border);
	padding: 1.25rem 0;
	position: sticky;
	top: 0;
	z-index: 100;
}

.site-header .container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
}

.site-header .logo {
	color: var(--text);
	font-weight: 700;
	font-size: 1.25rem;
	letter-spacing: 0.02em;
	display: flex;
	align-items: center;
}

.site-header .logo-image {
	max-height: 40px;
	width: auto;
}

.site-nav {
	display: flex;
	align-items: center;
	gap: 1.5rem;
}

.site-nav a.nav-link {
	font-size: 0.92rem;
	font-weight: 600;
	color: var(--text-muted);
	min-height: 44px;
	display: flex;
	align-items: center;
}

.site-nav a.nav-link:hover,
.site-nav a.nav-link.is-active { color: var(--accent); }

.user-state {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.user-state span {
	color: var(--text-muted);
	font-size: 0.9rem;
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0.75rem 1.5rem;
	border-radius: var(--radius);
	border: none;
	font-size: 1rem;
	font-weight: 700;
	cursor: pointer;
	transition: transform 0.15s ease, background 0.15s ease;
}

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

.btn-primary { background: var(--accent); color: #14110a; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { background: #4a4128; color: rgba(255, 255, 255, 0.4); cursor: not-allowed; }

.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--text-muted); }

.btn-link { background: none; color: var(--accent); padding: 0.5rem; min-width: auto; min-height: auto; font-weight: 600; }

/* Hero */
.hero {
	background: var(--bg);
	color: var(--text);
	padding: 6rem 0 4rem;
	text-align: center;
}

.hero.hero-small { padding: 3.5rem 0 1rem; }

.hero h1 {
	font-size: 3.25rem;
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.01em;
	margin: 0 0 1.25rem;
}

.hero.hero-small h1 { font-size: 1.85rem; color: var(--accent); }

.hero-brand { color: var(--accent); }

.hero-payoff {
	font-size: 1.3rem;
	font-weight: 600;
	color: var(--text);
	max-width: 620px;
	margin: 0 auto 1.5rem;
}

.hero-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 1.5rem;
	text-align: left;
}

.hero-row h1 { margin: 0; text-align: left; }

.hero-row .user-stats {
	justify-content: flex-end;
	text-align: right;
	margin-bottom: 0;
}

.hero p {
	font-size: 1.2rem;
	color: var(--text-muted);
	max-width: 620px;
	margin: 0 auto;
}

/* Main content sections */
.section {
	padding: 4rem 0;
}

.hero-small + .section {
	padding-top: 1.5rem;
}

.card {
	background: var(--bg-card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 2.5rem;
	max-width: 520px;
	margin: 0 auto;
}

.card h2 {
	margin-top: 0;
	font-size: 1.5rem;
}

.form-field {
	margin-bottom: 1.25rem;
}

.form-field label {
	display: block;
	margin-bottom: 0.4rem;
	font-weight: 600;
	font-size: 0.9rem;
	color: var(--text-muted);
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="file"],
.form-field textarea {
	width: 100%;
	min-height: 44px;
	padding: 0.65rem 0.85rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font-size: 1rem;
	font-family: inherit;
	background: var(--bg-elevated);
	color: var(--text);
}

.form-field input:focus,
.form-field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.form-msg {
	margin-top: 1rem;
	padding: 0.85rem 1rem;
	border-radius: var(--radius);
	font-size: 0.92rem;
	display: none;
}

.form-msg.visible { display: block; }
.form-msg.error { background: rgba(255, 107, 107, 0.12); color: var(--danger); }
.form-msg.success { background: rgba(74, 222, 128, 0.12); color: var(--success); }

/* Auth toggle (login/register) */
.auth-tabs {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 1.5rem;
}

.auth-tabs button {
	flex: 1;
	background: none;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 0.75rem;
	min-height: 44px;
	font-weight: 600;
	cursor: pointer;
	color: var(--text-muted);
}

.auth-tabs button.active {
	background: var(--accent);
	color: #14110a;
	border-color: var(--accent);
}

.auth-panel { display: none; }
.auth-panel.active { display: block; }

.auth-panel .login-username,
.auth-panel .login-password,
.auth-panel .login-remember,
.auth-panel .login-submit { margin-bottom: 1.25rem; }

.auth-panel label { display: block; margin-bottom: 0.4rem; font-weight: 600; font-size: 0.9rem; color: var(--text-muted); }

.auth-panel input.input {
	width: 100%;
	min-height: 44px;
	padding: 0.65rem 0.85rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font-size: 1rem;
	background: var(--bg-elevated);
	color: var(--text);
}

.auth-panel .login-submit input[type="submit"] {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0.75rem 1.5rem;
	border-radius: var(--radius);
	border: none;
	font-size: 1rem;
	font-weight: 700;
	cursor: pointer;
	background: var(--accent);
	color: #14110a;
	transition: transform 0.15s ease, background 0.15s ease;
}

.auth-panel .login-submit input[type="submit"]:hover { background: var(--accent-hover); }
.auth-panel .login-submit input[type="submit"]:active { transform: scale(0.98); }

.auth-panel .login-remember label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 400;
	color: var(--text-muted);
}

/* User stats (upload page) */
.user-stats {
	display: flex;
	justify-content: center;
	gap: 2.5rem;
	flex-wrap: wrap;
	margin-bottom: 2.5rem;
	text-align: center;
}

.user-stats .stat-label {
	display: block;
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--text-faint);
	margin-bottom: 0.35rem;
}

.user-stats .stat-value {
	display: block;
	font-size: 1.6rem;
	font-weight: 800;
	color: var(--accent);
}

.upload-column {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.user-stats-compact {
	gap: 1.5rem;
	margin-bottom: 1.25rem;
	justify-content: flex-start;
}

.user-stats-compact .stat-label { font-size: 0.68rem; margin-bottom: 0.2rem; }
.user-stats-compact .stat-value { font-size: 1.1rem; }

/* Upload section */
.upload-preview {
	margin: 1rem 0;
	border: 2px dashed var(--border);
	border-radius: var(--radius);
	aspect-ratio: 4 / 3;
	max-width: 280px;
	max-height: 210px;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	background: var(--bg-elevated);
}

.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview span { color: var(--text-faint); font-size: 0.9rem; padding: 1rem; text-align: center; }

.analysis-result {
	margin-top: 2rem;
	width: 100%;
	display: none;
}

.analysis-result.visible { display: block; }

.chat-thread {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.chat-message {
	max-width: 80%;
	padding: 1rem 1.25rem;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	white-space: pre-wrap;
	color: var(--text);
}

.chat-message-user {
	align-self: flex-end;
	background: var(--bg-elevated);
}

.chat-message-assistant {
	align-self: flex-start;
	background: var(--bg-card);
	border-left: 4px solid var(--accent);
}

@media (max-width: 480px) {
	.chat-message { max-width: 100%; }
}

.spinner {
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2px solid rgba(20, 17, 10, 0.35);
	border-top-color: #14110a;
	border-radius: 50%;
	animation: spin 0.7s linear infinite;
	margin-right: 0.5rem;
	vertical-align: -3px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Footer */
.site-footer {
	background: var(--bg);
	color: var(--text-muted);
	border-top: 1px solid var(--border);
	padding: 2.5rem 0 1.5rem;
	margin-top: 4rem;
}

.site-footer .container { text-align: center; }

.footer-privacy {
	border-top: 1px solid var(--border);
	padding: 1.25rem 0;
	text-align: center;
	font-size: 0.82rem;
	color: var(--text-faint);
	line-height: 1.7;
	margin-top: 1.5rem;
}

.footer-privacy a { color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; }
.footer-privacy a:hover { color: var(--accent); }
.footer-privacy p { margin: 0; }

.footer-copy { font-size: 0.85rem; margin-top: 0.5rem; }

/* Below-the-fold content-visibility optimization */
.site-footer { content-visibility: auto; contain-intrinsic-size: 0 220px; }

/* page.php content styling */
.page-hero {
	background: var(--bg);
	color: var(--text);
	padding-top: 120px;
	padding-bottom: 3rem;
	text-align: center;
}

.page-content {
	background: var(--bg);
	padding-bottom: 100px;
	min-height: 40vh;
}

.page-body {
	max-width: 780px;
	margin: 0 auto;
	color: var(--text-muted);
}

.page-body h2 { font-size: 1.6rem; margin-top: 2rem; color: var(--text); }
.page-body h3 { font-size: 1.25rem; color: var(--text); }
.page-body p, .page-body ul, .page-body ol { font-size: 1rem; }
.page-body a { color: var(--accent); text-decoration: underline; }
.page-body blockquote { border-left: 3px solid var(--accent); margin: 1.5rem 0; padding-left: 1rem; color: var(--text-faint); }
.page-body img { border-radius: var(--radius); margin: 1.5rem 0; }
.page-body table { width: 100%; border-collapse: collapse; }
.page-body table td, .page-body table th { border: 1px solid var(--border); padding: 0.5rem; }

.upload-grid {
	display: grid;
	grid-template-columns: 3fr 7fr;
	gap: 3rem;
	align-items: stretch;
	margin-bottom: 3rem;
}

.upload-grid .upload-intro {
	max-width: none;
	margin: 0;
	color: var(--text);
}

.upload-grid .card {
	max-width: none;
	margin: 0;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.upload-intro h3:first-child { margin-top: 0; }

@media (max-width: 768px) {
	.upload-grid {
		grid-template-columns: 1fr;
		gap: 2rem;
	}
}

/* Responsive breakpoints */
@media (max-width: 1024px) {
	.hero h1 { font-size: 2.5rem; }
}

@media (max-width: 768px) {
	.hero { padding: 3.5rem 0 3rem; }
	.hero h1 { font-size: 1.9rem; }
	.hero p { font-size: 1rem; }
	.section { padding: 2.5rem 0; }
	.card { padding: 1.75rem; margin: 0 1.5rem; }
	.user-stats { gap: 1.5rem; }
	.user-stats .stat-value { font-size: 1.3rem; }
	.site-header .user-state span { display: none; }
	.hero-row { flex-direction: column; align-items: flex-start; }
	.hero-row .user-stats { justify-content: flex-start; text-align: left; }
}

@media (max-width: 480px) {
	.hero h1 { font-size: 1.6rem; }
	.hero.hero-small h1 { font-size: 1.4rem; }
	.card { padding: 1.25rem; }
	.auth-tabs { flex-direction: column; }
	.user-stats { gap: 1rem; }
}
