/*
Theme Name: APH24 2027
Theme URI: https://avvocatopenalistah24.it
Description: Theme child di GeneratePress per Avvocato Penalista H24. Direzione "Editoriale, classico" (Concept A) approvata 2026-05-19. Costruito mobile-first, WCAG 2.2 AA, performance e SEO oriented.
Author: _blank Growth Agency
Author URI: https://blankgrowth.agency
Template: generatepress
Version: 1.0.0
Text Domain: aph24-2027
Tags: editorial, accessibility-ready
*/

/* =========================================================
   DESIGN TOKENS (mobile-first)
   ========================================================= */
:root {
	/* Palette - panna caldo + verde brand attenuato */
	--c-bg: #fcfbf8;
	--c-bg-soft: #f5f3ec;
	--c-bg-dark: #14181a;
	--c-text: #1a1a1a;
	--c-text-on-dark: #f3f1ea;
	--c-text-muted: #5a5a5a;
	--c-text-muted-dark: #9a958b;
	--c-accent: #2d5f5f;
	--c-accent-hover: #1f4444;
	--c-accent-on-dark: #c5d8d8;
	--c-line: #d9d5c8;
	--c-line-dark: rgba(255,255,255,0.1);
	--c-gold: #b89a3a;          /* decorativo: usare solo su sfondi dark o per icone/border, fail AA su panna */
	--c-gold-text: #8a7028;     /* variante scura per testi su sfondo chiaro: ~5.5:1 AA pass */
	--c-error: #b3261e;
	--c-success: #2d5f5f;

	/* Tipografia */
	--f-serif: "Crimson Pro", Georgia, "Times New Roman", serif;
	--f-sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

	/* Scale tipografica (fluid clamp) */
	--fs-xs: 0.78rem;
	--fs-sm: 0.875rem;
	--fs-base: 1.0625rem;
	--fs-md: 1.125rem;
	--fs-lg: clamp(1.2rem, 1vw + 0.9rem, 1.5rem);
	--fs-xl: clamp(1.75rem, 2.5vw + 0.5rem, 2.5rem);
	--fs-xxl: clamp(2rem, 3vw + 0.5rem, 3rem);
	--fs-display: clamp(2.2rem, 5vw + 0.5rem, 4.25rem);

	/* Spacing scala (base 8px) */
	--s-1: 0.5rem;
	--s-2: 1rem;
	--s-3: 1.5rem;
	--s-4: 2rem;
	--s-5: 2.5rem;
	--s-6: 3rem;
	--s-8: 4rem;
	--s-10: 5rem;
	--s-12: 6rem;
	--s-16: 8rem;

	/* Layout */
	--w-prose: 720px;
	--w-base: 1350px;
	--w-wide: 1440px;

	/* Radius, shadow */
	--r-sm: 4px;
	--r-md: 8px;
	--r-lg: 16px;
	--r-full: 999px;
	--shadow-soft: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);

	/* Motion */
	--ease: cubic-bezier(.4, 0, .2, 1);
	--dur-fast: 200ms;
	--dur: 300ms;
	--dur-slow: 500ms;
}

/* Dark mode opzionale (futuro) */
@media (prefers-color-scheme: dark) {
	/* non attivo, palette resta light. Hook futuro */
}

/* Riduzione motion */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* =========================================================
   BASE / RESET LIGHT
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
}
body {
	margin: 0;
	background: var(--c-bg);
	color: var(--c-text);
	font-family: var(--f-sans);
	font-size: var(--fs-base);
	line-height: 1.6;
	font-weight: 400;
}
img, svg, video { max-width: 100%; height: auto; display: block; }

/* Mobile overflow protection — batte inline style width:XXXpx legacy in vecchi post */
@media (max-width: 768px) {
	img, svg, video, iframe, table, pre, blockquote, figure {
		max-width: 100% !important;
		height: auto;
	}
	.aph-content img, .aph-content table, .aph-content iframe,
	.aph-prose img,   .aph-prose table,   .aph-prose iframe {
		width: auto !important;
		max-width: 100% !important;
	}
	.aph-content table, .aph-prose table { display: block; overflow-x: auto; }
	.aph-content pre,   .aph-prose pre   { overflow-x: auto; }
	body { overflow-x: hidden; }
}
a {
	color: var(--c-accent);
	text-decoration: none;
	transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--c-accent-hover); }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
	outline: 2px solid var(--c-accent);
	outline-offset: 3px;
	border-radius: 2px;
}
button { font-family: inherit; cursor: pointer; }

/* Skip link a11y */
.skip-link {
	position: absolute;
	left: -9999px;
	z-index: 999;
}
.skip-link:focus {
	left: var(--s-2);
	top: var(--s-2);
	background: var(--c-accent);
	color: #fff;
	padding: var(--s-1) var(--s-3);
	border-radius: var(--r-sm);
	font-weight: 600;
}

/* Screen-reader only */
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* =========================================================
   LAYOUT (container, sezioni)
   ========================================================= */
.aph-wrap { max-width: var(--w-base); margin-inline: auto; padding-inline: var(--s-3); }
.aph-wrap--prose { max-width: var(--w-prose); }
.aph-wrap--wide { max-width: var(--w-wide); }

/* Prose container: testo lungo centrato a 720, ma immagini/grandi possono uscire fino a 1180 */
.aph-prose { max-width: var(--w-prose); margin-inline: auto; }
.aph-prose > figure, .aph-prose > .alignwide, .aph-prose > .alignfull { max-width: 100%; margin-inline: calc((var(--w-prose) - var(--w-base)) / 2); }
@media (max-width: 1180px) { .aph-prose > .alignwide, .aph-prose > .alignfull { margin-inline: 0; } }

/* I pattern wide (hero/strip/servizi) usano layout default + .aph-wrap interno (1180).
   I pattern testuali (intro/perche/metodo/dove) usano layout constrained 720 da theme.json.
   Neutralizzo eventuali constraint Gutenberg che limitano i figli di .aph-wrap. */
.aph-hero .aph-wrap > *,
.aph-strip .aph-wrap > *,
.aph-section .aph-wrap > * {
	max-width: none;
}

.aph-section { padding-block: var(--s-8); }
.aph-section--soft { background: var(--c-bg-soft); }
.aph-section--dark { background: var(--c-bg-dark); color: var(--c-text-on-dark); }

@media (min-width: 768px) {
	.aph-wrap { padding-inline: var(--s-4); }
	.aph-section { padding-block: var(--s-12); }
}

@media (min-width: 1024px) {
	.aph-section { padding-block: var(--s-16); }
}

/* =========================================================
   TIPOGRAFIA
   ========================================================= */
.aph-eyebrow {
	font-size: var(--fs-xs);
	text-transform: uppercase;
	letter-spacing: 0.18em;
	font-weight: 600;
	color: var(--c-accent);
	margin: 0 0 var(--s-3);
}

.aph-h1, .aph-h2, .aph-h3, .aph-h4 {
	font-family: var(--f-serif);
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: -0.005em;
	margin: 0 0 var(--s-3);
}

.aph-h1 {
	font-family: var(--f-serif);
	font-style: italic;
	font-weight: 400;
	font-size: var(--fs-display);
	line-height: 1.1;
}
.aph-h2 { font-size: var(--fs-xxl); }
.aph-h3 { font-size: var(--fs-xl); }
.aph-h4 { font-size: var(--fs-lg); }

.aph-lead {
	font-family: var(--f-serif);
	font-size: var(--fs-lg);
	color: var(--c-text);
	line-height: 1.5;
	font-weight: 400;
	margin: 0 0 var(--s-3);
}

.aph-pull-quote {
	font-family: var(--f-serif);
	font-style: italic;
	font-size: var(--fs-xxl);
	line-height: 1.3;
	color: var(--c-text);
	border-left: 2px solid var(--c-gold);
	padding-left: var(--s-4);
	margin: var(--s-6) 0;
}
.aph-section--dark .aph-pull-quote { color: var(--c-text-on-dark); }

/* =========================================================
   COMPONENTI: button, pill
   ========================================================= */
.aph-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--s-1);
	min-height: 44px;
	padding: var(--s-2) var(--s-4);
	background: var(--c-accent);
	color: #fff;
	font-family: var(--f-sans);
	font-size: var(--fs-sm);
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	border: 1px solid var(--c-accent);
	border-radius: var(--r-full);
	cursor: pointer;
	transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
	text-decoration: none;
}
.aph-btn:hover, .aph-btn:focus-visible {
	background: var(--c-accent-hover);
	border-color: var(--c-accent-hover);
	color: #fff;
}
.aph-btn--ghost {
	background: transparent;
	color: var(--c-accent);
}
.aph-btn--ghost:hover, .aph-btn--ghost:focus-visible {
	background: var(--c-accent);
	color: #fff;
}
.aph-btn--lg { min-height: 52px; padding: var(--s-2) var(--s-5); font-size: var(--fs-base); }

.aph-pill {
	display: inline-flex;
	align-items: center;
	padding: 3px var(--s-1);
	border: 1px solid var(--c-line);
	border-radius: var(--r-full);
	font-size: var(--fs-xs);
	color: var(--c-text-muted);
	background: transparent;
}

/* Link "freccia" */
.aph-arrow-link {
	display: inline-flex;
	align-items: center;
	gap: var(--s-1);
	font-size: var(--fs-sm);
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--c-accent);
}
.aph-arrow-link::after {
	content: "→";
	transition: transform var(--dur-fast) var(--ease);
}
.aph-arrow-link:hover::after, .aph-arrow-link:focus-visible::after { transform: translateX(4px); }

/* =========================================================
   BREADCRUMB (Yoast)
   Rendering: <nav.aph-breadcrumbs><div.aph-wrap><p.aph-breadcrumbs__list>...</p></div></nav>
   Piazzato subito sotto header, sopra il primo contenuto (tranne home).
   ========================================================= */
.aph-breadcrumbs {
	padding-block: var(--s-3) var(--s-2);
	border-bottom: 1px solid var(--c-line);
	background: var(--c-bg);
}
.aph-breadcrumbs__list {
	margin: 0;
	font-size: var(--fs-xs);
	color: var(--c-text-muted);
	line-height: 1.5;
	letter-spacing: 0.01em;
}
.aph-breadcrumbs__list a {
	color: var(--c-text-muted);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.aph-breadcrumbs__list a:hover,
.aph-breadcrumbs__list a:focus-visible {
	color: var(--c-accent);
	border-bottom-color: var(--c-accent);
}
.aph-breadcrumbs__list .breadcrumb_last {
	color: var(--c-text);
	font-weight: 500;
}
.aph-breadcrumbs__list > span > span { display: inline; }
