/* ==========================================================================
   Touchstone-new: WordPress, Elementor and Contact Form 7 integration.
   The design itself is in main.css (original) and site.css (animations).
   ========================================================================== */

/* Brand colours and heading font follow Elementor → Site Settings
   (Global Colors / Global Fonts). Fallbacks are the original values. */
body {
	--ts-blue: var(--e-global-color-primary, #0b7ad1);
	--ts-blue-2: var(--e-global-color-accent, #12aef0);
	--ts-ink: var(--e-global-color-secondary, #111418);
	--ts-body: var(--e-global-color-text, #4a5058);
	--tsn-blue-dark: color-mix(in srgb, var(--ts-blue) 85%, #000);
}
.font-display { font-family: var(--e-global-typography-primary-font-family, "Nunito"), "Nunito", sans-serif; }

/* Accessibility helpers */
.tsn-sr {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.tsn-skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; }
.tsn-skip-link:focus { left: 8px; background: #fff; color: var(--ts-ink); padding: 10px 16px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, .15); }
:focus-visible { outline: 2px solid var(--ts-blue); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   Elementor
   -------------------------------------------------------------------------- */

/* Touchstone widgets span the full width of their container. */
.e-con > .elementor-widget[class*="elementor-widget-tsn-"],
.e-con > .e-con-inner > .elementor-widget[class*="elementor-widget-tsn-"] { width: 100%; max-width: 100%; }

/* Elementor sets img { height: auto }; keep the original cover-fit photos. */
.elementor img.h-full { height: 100%; }
.elementor .aspect-\[4\/3\] img { height: 100%; }

/* Blue call-to-action follows the global brand colours. */
.tsn-cta { background-image: linear-gradient(120deg, var(--ts-blue-2) 0%, var(--ts-blue) 70%, var(--tsn-blue-dark) 100%); }

/* Rich text inside Touchstone widgets */
.tsn-prose a,
.tsn-notes a { color: var(--ts-blue); font-weight: 600; }
.tsn-prose a:hover,
.tsn-notes a:hover { text-decoration: underline; }
.tsn-prose strong,
.tsn-notes strong { color: #111827; font-weight: 700; }
.tsn-prose ul { list-style: disc; padding-left: 1.5rem; }
.tsn-prose ol { list-style: decimal; padding-left: 1.5rem; }

/* Policy / long text (also used for pages not built with Elementor) */
.tsn-legal { font-size: 14px; line-height: 1.75; color: #4b5563; }
.tsn-legal h2 { font-size: 1.5rem; line-height: 2rem; color: #111827; font-weight: 400; margin: 1.75rem 0 .5rem; }
.tsn-legal h3 { font-size: 1.2rem; color: #111827; margin: 1.5rem 0 .5rem; }
.tsn-legal > :first-child { margin-top: 0; }
.tsn-legal p { margin: 0 0 .25rem; }
.tsn-legal ul { list-style: disc; padding-left: 1.5rem; }
.tsn-legal ol { list-style: decimal; padding-left: 1.5rem; }
.tsn-legal li { margin: .25rem 0; }
.tsn-legal a { color: var(--ts-blue); }
.tsn-legal img { border-radius: 12px; margin: 1rem 0; }
.tsn-entry p { margin-bottom: 1rem; }

/* --------------------------------------------------------------------------
   Contact Form 7 (matches the original form)
   -------------------------------------------------------------------------- */
.tsn-cf7 .tsn-field + .tsn-field { margin-top: .75rem; }
.tsn-cf7 label,
.tsn-cf7 .wpcf7-form-control-wrap { display: block; }
.tsn-cf7 .ts-input { display: block; }
.tsn-cf7 textarea.ts-input { min-height: 110px; resize: vertical; }
.tsn-form--boxed .ts-input { background: #fff; border: 1px solid #e3e6ea; }
.tsn-form--boxed .ts-input:focus { background: #fff; border-color: var(--ts-blue); }
.tsn-cf7 .ts-input.wpcf7-not-valid { border-color: #dc2626; }

.tsn-cf7 .tsn-field--submit { position: relative; }
.tsn-cf7 .tsn-field + .tsn-field--submit { margin-top: 20px; }
.tsn-cf7 .wpcf7-submit {
	width: 100%; display: flex; align-items: center; justify-content: center; gap: .5rem;
	background: var(--ts-blue); color: #fff; font-weight: 600; font-size: 1rem; line-height: 1.5rem;
	border: 0; border-radius: .375rem; padding: .75rem 1rem; cursor: pointer;
	transition: background-color .3s ease;
}
.tsn-cf7 .wpcf7-submit:hover { background: var(--tsn-blue-dark); }
.tsn-cf7 .wpcf7-submit:disabled { opacity: .7; cursor: default; }
.tsn-cf7 .wpcf7-spinner { position: absolute; right: 14px; top: 50%; margin: -12px 0 0; background-color: rgba(255, 255, 255, .45); }

.tsn-cf7 .wpcf7-not-valid-tip { font-size: .8rem; margin-top: .3rem; color: #dc2626; }
.wpcf7 form.tsn-cf7 .wpcf7-response-output {
	margin: .75rem 0 0; padding: .6rem .85rem; border-radius: 6px; font-size: .85rem; line-height: 1.5;
	border: 1px solid #e5e7eb; color: #374151; background: #fff;
}
.wpcf7 form.tsn-cf7.sent .wpcf7-response-output { border-color: var(--ts-blue); color: var(--ts-blue); background: #f2f8fd; }
.wpcf7 form.tsn-cf7.invalid .wpcf7-response-output,
.wpcf7 form.tsn-cf7.unaccepted .wpcf7-response-output,
.wpcf7 form.tsn-cf7.failed .wpcf7-response-output,
.wpcf7 form.tsn-cf7.aborted .wpcf7-response-output,
.wpcf7 form.tsn-cf7.spam .wpcf7-response-output { border-color: #fca5a5; color: #b91c1c; background: #fef2f2; }
.tsn-form-missing { padding: 16px; border: 1px dashed var(--ts-blue); background: #f5faff; color: #0b5fa5; font-size: 14px; border-radius: 6px; }

/* --------------------------------------------------------------------------
   Footer extras (shown only when filled in, Touchstone → Site Settings)
   -------------------------------------------------------------------------- */
.tsn-footer-address { margin-top: .75rem; font-size: 13px; line-height: 1.6; color: #1f2937; max-width: 240px; text-align: center; }
.tsn-social { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; justify-content: center; }
.tsn-social a { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 999px; border: 1px solid #e5e7eb; color: var(--ts-ink); transition: color .3s ease, border-color .3s ease; }
.tsn-social a:hover { color: var(--ts-blue); border-color: var(--ts-blue); }
.tsn-social svg { width: 18px; height: 18px; }
@media (min-width: 640px) {
	.tsn-footer-address { text-align: left; }
	.tsn-social { justify-content: flex-start; }
}

/* --------------------------------------------------------------------------
   Blog list (when posts are published)
   -------------------------------------------------------------------------- */
.tsn-post-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.tsn-post-card__date { font-size: 13px; color: #6b7280; margin-bottom: .5rem; }
.tsn-pagination .nav-links { display: flex; gap: .5rem; justify-content: center; margin-top: 2.5rem; }
.tsn-pagination .page-numbers { padding: .4rem .8rem; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 14px; }
.tsn-pagination .page-numbers.current { background: var(--ts-blue); border-color: var(--ts-blue); color: #fff; }

@media (prefers-reduced-motion: reduce) {
	.js .reveal, .js .mask-line { opacity: 1; transform: none; transition: none; }
	.ts-marquee-track { animation-duration: 240s; }
}
