/* =========================================================
   La Torre dei Canonici — theme.css
   Replica del design originale (beige/oro, Playfair + Libre Franklin)
   tutto costruito su var(--wp--preset--*) esposte da theme.json.
   Mobile-first, responsive, accessibile.
========================================================= */

/* ---------- Reset leggero + base ---------- */
.tdc-site-header *,
.tdc-site-footer * { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
	margin: 0;
	font-family: 'Libre Franklin', 'Helvetica Neue', Arial, sans-serif;
	font-weight: 400;
	line-height: 1.6;
	color: var(--wp--preset--color--text, #3A2818);
	background: var(--wp--preset--color--cream, #FAF6F0);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
	font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
	font-weight: 400;
	line-height: 1.15;
	letter-spacing: -0.01em;
	color: var(--wp--preset--color--brown, #50362A);
}

/* Compensazione admin bar WordPress per nav fixed */
body.admin-bar .tdc-nav { top: 32px; }
@media (max-width: 782px) { body.admin-bar .tdc-nav { top: 46px; } }

/* Offset per ancore interne (nav fissa) */
:where(main [id]) { scroll-margin-top: clamp(72px, 10vh, 100px); }

/* =========================================================
   HEADER / NAV
========================================================= */
.tdc-site-header {
	position: relative;
	z-index: 1000;
}

.tdc-nav {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: clamp(12px, 2vw, 24px);
	padding: clamp(14px, 2vw, 24px) clamp(18px, 3vw, 48px);
	transition: background 0.5s cubic-bezier(0.22, 1, 0.36, 1),
				padding 0.5s cubic-bezier(0.22, 1, 0.36, 1),
				box-shadow 0.5s;
	background: transparent;
	/* Safe area per iOS notch */
	padding-top: max(clamp(14px, 2vw, 24px), env(safe-area-inset-top));
}

.tdc-nav.is-scrolled {
	background: rgba(250, 246, 240, 0.92);
	backdrop-filter: blur(24px);
	-webkit-backdrop-filter: blur(24px);
	padding-top: 14px;
	padding-bottom: 14px;
	box-shadow: 0 1px 0 rgba(163, 138, 124, 0.12);
}

.tdc-nav-brand {
	display: inline-flex;
	align-items: center;
	gap: 14px;
	text-decoration: none;
	flex-shrink: 0;
}

.tdc-nav-logo {
	height: clamp(30px, 5vw, 42px);
	width: auto;
	transition: height 0.5s;
	border-radius: 8px;
	border: 1.5px solid rgba(255, 255, 255, 0.35);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	display: block;
}
.tdc-nav.is-scrolled .tdc-nav-logo {
	height: clamp(28px, 4vw, 36px);
	border-color: rgba(80, 54, 42, 0.15);
}

.tdc-nav-links {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	gap: clamp(18px, 2.4vw, 36px);
	align-items: center;
}

.tdc-nav-links a {
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.72rem;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.85);
	text-decoration: none;
	position: relative;
	transition: color 0.3s;
	white-space: nowrap;
}

.tdc-nav-links a::after {
	content: '';
	position: absolute;
	bottom: -4px;
	left: 0;
	width: 0;
	height: 1px;
	background: var(--wp--preset--color--gold);
	transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.tdc-nav-links a:hover::after,
.tdc-nav-links a:focus-visible::after { width: 100%; }
.tdc-nav-links a:hover,
.tdc-nav-links a:focus-visible { color: var(--wp--preset--color--gold); }

.tdc-nav.is-scrolled .tdc-nav-links a { color: var(--wp--preset--color--coffee); }

/* CTA button */
.tdc-nav-cta {
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	padding: 11px 28px;
	border: 1.5px solid rgba(255, 255, 255, 0.35);
	color: #fff;
	text-decoration: none;
	transition: all 0.4s;
	background: transparent;
	white-space: nowrap;
}
.tdc-nav.is-scrolled .tdc-nav-cta {
	border-color: var(--wp--preset--color--gold);
	color: var(--wp--preset--color--gold);
}
.tdc-nav-cta:hover,
.tdc-nav-cta:focus-visible {
	background: var(--wp--preset--color--gold);
	border-color: var(--wp--preset--color--gold);
	color: #fff;
}

/* Language switch */
.tdc-lang-switch {
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.6);
	text-decoration: none;
	padding: 11px 14px;
	transition: color 0.4s;
}
.tdc-nav.is-scrolled .tdc-lang-switch { color: var(--wp--preset--color--taupe); }
.tdc-lang-switch:hover,
.tdc-lang-switch:focus-visible { color: var(--wp--preset--color--gold); }

/* Toggle hamburger */
.tdc-nav-toggle {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	width: 28px;
	height: 20px;
	position: relative;
	z-index: 1001;
	padding: 0;
}
.tdc-nav-toggle span {
	display: block;
	width: 100%;
	height: 1.5px;
	background: #fff;
	position: absolute;
	left: 0;
	transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.tdc-nav-toggle span:nth-child(1) { top: 0; }
.tdc-nav-toggle span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.tdc-nav-toggle span:nth-child(3) { bottom: 0; }
.tdc-nav.is-scrolled .tdc-nav-toggle span { background: var(--wp--preset--color--brown); }

.tdc-nav-toggle.is-active span:nth-child(1) { top: 50%; transform: translateY(-50%) rotate(45deg); background: var(--wp--preset--color--brown); }
.tdc-nav-toggle.is-active span:nth-child(2) { opacity: 0; }
.tdc-nav-toggle.is-active span:nth-child(3) { bottom: 50%; transform: translateY(50%) rotate(-45deg); background: var(--wp--preset--color--brown); }

/* ---------- Mobile overlay ---------- */
.tdc-mobile-menu {
	position: fixed;
	inset: 0;
	z-index: 999;
	background: rgba(250, 246, 240, 0.98);
	backdrop-filter: blur(30px);
	-webkit-backdrop-filter: blur(30px);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: clamp(18px, 3vh, 28px);
	padding: env(safe-area-inset-top) 24px env(safe-area-inset-bottom);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.4s;
	overflow-y: auto;
}
.tdc-mobile-menu.is-open {
	opacity: 1;
	pointer-events: all;
}
.tdc-mobile-menu a {
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(1.4rem, 5vw, 1.8rem);
	font-weight: 400;
	color: var(--wp--preset--color--brown);
	text-decoration: none;
	transition: color 0.3s;
}
.tdc-mobile-menu a:hover,
.tdc-mobile-menu a:focus-visible { color: var(--wp--preset--color--gold); }

.tdc-mobile-menu .tdc-mobile-cta {
	margin-top: 12px;
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	padding: 14px 32px;
	border: 1.5px solid var(--wp--preset--color--gold);
	color: var(--wp--preset--color--gold);
}
.tdc-mobile-menu .tdc-mobile-cta:hover {
	background: var(--wp--preset--color--gold);
	color: #fff;
}
.tdc-mobile-menu .tdc-mobile-lang {
	font-size: 0.75rem;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--wp--preset--color--taupe);
}

/* Quando il menu è aperto, blocca scroll del body */
body.tdc-menu-open { overflow: hidden; }

/* =========================================================
   FOOTER
========================================================= */
.tdc-site-footer {
	color: rgba(250, 246, 240, 0.7);
}
.tdc-footer-inner {
	max-width: 1440px;
	margin: 0 auto;
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	flex-wrap: wrap;
	gap: 40px;
}
.tdc-footer-brand {
	display: flex;
	align-items: center;
	gap: 10px;
}
.tdc-footer-logo {
	height: 28px;
	width: auto;
	opacity: 0.6;
	border-radius: 6px;
	border: 1.5px solid rgba(0, 0, 0, 0.5);
	display: block;
}
.tdc-footer-brand-name {
	font-family: var(--wp--preset--font-family--display);
	font-size: 1rem;
	color: rgba(250, 246, 240, 0.5);
}
.tdc-footer-nav {
	display: flex;
	gap: 32px;
	flex-wrap: wrap;
}
.tdc-footer-nav a {
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.68rem;
	font-weight: 500;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: rgba(250, 246, 240, 0.35);
	text-decoration: none;
	transition: color 0.3s;
}
.tdc-footer-nav a:hover,
.tdc-footer-nav a:focus-visible { color: var(--wp--preset--color--gold); }

.tdc-footer-bottom {
	max-width: 1440px;
	margin: 32px auto 0;
	padding-top: 24px;
	border-top: 1px solid rgba(250, 246, 240, 0.06);
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
}
.tdc-footer-copy {
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.72rem;
	color: rgba(250, 246, 240, 0.25);
}
.tdc-footer-legal {
	display: flex;
	gap: 20px;
	flex-wrap: wrap;
}
.tdc-footer-legal a {
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.65rem;
	color: rgba(250, 246, 240, 0.2);
	text-decoration: none;
	transition: color 0.3s;
}
.tdc-footer-legal a:hover,
.tdc-footer-legal a:focus-visible { color: rgba(250, 246, 240, 0.5); }

.tdc-footer-codes {
	max-width: 1440px;
	margin: 12px auto 0;
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.62rem;
	color: rgba(250, 246, 240, 0.15);
	text-align: center;
}

/* =========================================================
   BREAKPOINT — Tablet (≤1024px)
========================================================= */
@media (max-width: 1024px) {
	.tdc-nav { padding-left: 28px; padding-right: 28px; }
	.tdc-nav-links { display: none; }
	.tdc-nav-cta { display: none; }
	.tdc-lang-switch { display: none; }
	.tdc-nav-toggle { display: block; }
}

/* =========================================================
   BREAKPOINT — Mobile (≤680px)
========================================================= */
@media (max-width: 680px) {
	.tdc-nav { padding: 14px 18px; }
	.tdc-nav.is-scrolled { padding: 10px 18px; }
	.tdc-nav-logo { height: 34px; }
	.tdc-nav.is-scrolled .tdc-nav-logo { height: 30px; }

	.tdc-footer-inner {
		flex-direction: column;
		align-items: center;
		text-align: center;
	}
	.tdc-footer-nav {
		justify-content: center;
		gap: 16px 20px;
	}
	.tdc-footer-bottom {
		flex-direction: column;
		align-items: center;
		text-align: center;
		gap: 16px;
	}
	.tdc-footer-legal {
		justify-content: center;
		gap: 12px;
	}
}

/* =========================================================
   BREAKPOINT — Mobile piccolo (≤380px)
========================================================= */
@media (max-width: 380px) {
	.tdc-nav { padding: 12px 14px; }
}

/* =========================================================
   Riduci animazioni se richiesto dall'utente
========================================================= */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.tdc-nav,
	.tdc-nav-logo,
	.tdc-nav-links a::after,
	.tdc-nav-cta,
	.tdc-lang-switch,
	.tdc-nav-toggle span,
	.tdc-mobile-menu,
	.tdc-footer-nav a,
	.tdc-footer-legal a {
		transition: none !important;
	}
}

/* =========================================================
   Focus visibility per accessibilità
========================================================= */
.tdc-nav a:focus-visible,
.tdc-nav button:focus-visible,
.tdc-mobile-menu a:focus-visible,
.tdc-footer-nav a:focus-visible,
.tdc-footer-legal a:focus-visible {
	outline: 2px solid var(--wp--preset--color--gold);
	outline-offset: 4px;
	border-radius: 2px;
}

/* === TDC-FORM-VISIBILITY-FIX page-id-36 (Prenota) === */
/* Form ha background marrone scuro: testo deve essere chiaro per contrasto */
body.page-id-36 .form-group input,
body.page-id-36 .form-group select,
body.page-id-36 .form-group textarea,
body.page-id-36 .captcha-group input {
	color: #FAF6F0 !important;
	-webkit-text-fill-color: #FAF6F0 !important;
	opacity: 1 !important;
	caret-color: #B8963E !important;
}
body.page-id-36 .form-group input::placeholder,
body.page-id-36 .form-group textarea::placeholder {
	color: rgba(250, 246, 240, 0.45) !important;
	-webkit-text-fill-color: rgba(250, 246, 240, 0.45) !important;
	opacity: 1 !important;
}
body.page-id-36 .form-group input[type="date"]::-webkit-datetime-edit {
	color: #FAF6F0 !important;
}
body.page-id-36 .form-group select option {
	color: #2C1810 !important;
	background: #FAF6F0 !important;
}
body.page-id-36 .form-group input:-webkit-autofill,
body.page-id-36 .form-group select:-webkit-autofill,
body.page-id-36 .form-group textarea:-webkit-autofill {
	-webkit-text-fill-color: #FAF6F0 !important;
	-webkit-box-shadow: 0 0 0 1000px transparent inset !important;
	caret-color: #B8963E !important;
}
