/**
 * Casa Terra: tokens, type, layout and shared components.
 *
 * Breakpoints match Elementor's defaults: tablet <= 1024px, mobile <= 767px.
 * Figma frames: desktop 1440, tablet 834, mobile 390.
 * The Figma file has no styles or variables; every token below was read from the frames
 * (P1.2, details in data/_figma-export/reports/tokens.md while it exists).
 * Section styles live in assets/css/parts/<widget>.css and use only these tokens.
 */

/* ------------------------------------------------------------------ */
/* Tokens                                                             */
/* ------------------------------------------------------------------ */

/*
 * Colours and fonts follow Elementor's global colours and fonts (Site Settings), so changing
 * them in Elementor restyles every section. Elementor prints those variables on the kit class
 * of <body>, so these tokens are declared on body; the hex values are the Figma colours, used
 * when Elementor is off or a global is missing. The demo importer writes the same values into
 * the kit: system colours primary/secondary/text/accent and the custom colours below.
 */
body {
	/* Seven solids, no near-duplicates. */
	--ct-c-earth: var(--e-global-color-primary, #4c241b);       /* text, primary button, footer, photo overlay */
	--ct-c-earth-dark: var(--e-global-color-secondary, #3a1b14); /* primary button hover (not in Figma: one step darker than earth) */
	--ct-c-muted: var(--e-global-color-text, #694d3f);          /* secondary text, captions, labels, placeholders */
	--ct-c-cream: var(--e-global-color-accent, #f4e8d7);        /* page background, nav bar, secondary button */
	--ct-c-paper: var(--e-global-color-ctpaper, #fff9ef);       /* Journal, Article and The place background; fields, cards; text on dark */
	--ct-c-sand: var(--e-global-color-ctsand, #e3c8ae);         /* tinted panels (stay summary, form alert); muted text on the footer */
	--ct-c-line: var(--e-global-color-ctline, #cab398);         /* every 1px border and divider */
	--ct-c-error: var(--e-global-color-cterror, #ac3022);       /* error text */
	/* Kept for code shared with other Margick themes: "ink" text is the earth brown here. */
	--ct-c-ink: var(--ct-c-earth);

	/* Headings: Elementor "Primary" font; text: Elementor "Text" font. */
	--ct-serif: var(--e-global-typography-primary-font-family, "DM Serif Display"), Georgia, "Times New Roman", serif;
	--ct-sans: var(--e-global-typography-text-font-family, "Outfit"), system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

:root {
	/* "Overlay · flat dark 32%" on hero photos; the photos themselves carry no overlay. */
	--ct-overlay: rgb(76 36 27 / 0.32);

	--ct-max: 1200px;
	--ct-gutter: 120px;
	--ct-section-pad: 56px;
	--ct-heading-gap: 40px;
	--ct-radius: 12px;
	--ct-radius-panel: 16px;
	--ct-radius-control: 8px;

	/* Figma type (desktop): display (home hero 104/108), h1 (section title 56/64), title (page
	   title 56/64), h2 (panel title 36/44), h3 (28/36). */
	--ct-fs-display: 104px;
	--ct-lh-display: 108px;
	--ct-fs-h1: 56px;
	--ct-lh-h1: 64px;
	--ct-fs-title: 56px;
	--ct-lh-title: 64px;
	--ct-fs-h2: 36px;
	--ct-lh-h2: 44px;
	--ct-fs-h3: 28px;
	--ct-lh-h3: 36px;
	--ct-fs-lead: 20px;
	--ct-lh-lead: 30px;
	--ct-fs-body-lg: 18px;
	--ct-lh-body-lg: 28px;
	--ct-fs-body: 16px;
	--ct-lh-body: 24px;
	--ct-fs-small: 14px;
	--ct-lh-small: 20px;
	--ct-fs-label: 12px;
	--ct-lh-label: 16px;
	/* Big numbers (drive times, prices). */
	--ct-fs-figure: 44px;
	--ct-lh-figure: 48px;
	/* FAQ question, Outfit medium. */
	--ct-fs-faq: 18px;
	--ct-lh-faq: 28px;
}

@media (max-width: 1279px) {
	:root {
		--ct-gutter: 32px;
	}
}

/* Tablet: the 834 frames. */
@media (max-width: 1024px) {
	:root {
		--ct-section-pad: 40px;
		--ct-heading-gap: 24px;
		--ct-fs-display: 56px;
		--ct-lh-display: 60px;
		--ct-fs-h1: 36px;
		--ct-lh-h1: 44px;
		--ct-fs-title: 44px;
		--ct-lh-title: 52px;
	}
}

/* Phone: the 390 frames. */
@media (max-width: 767px) {
	:root {
		--ct-gutter: 20px;
		--ct-section-pad: 32px;
		--ct-fs-display: 36px;
		--ct-lh-display: 44px;
		--ct-fs-title: 32px;
		--ct-lh-title: 38px;
		--ct-fs-lead: 16px;
		--ct-lh-lead: 24px;
		--ct-fs-body-lg: 16px;
		--ct-lh-body-lg: 24px;
		--ct-fs-figure: 36px;
		--ct-lh-figure: 44px;
	}
}

/* Palettes: cream (#f4e8d7), paper (#fff9ef), earth (dark). Elementor colour controls override them per widget. */
.ct--cream,
.ct--paper,
.ct--earth {
	--ct-heading: var(--ct-c-earth);
	--ct-text: var(--ct-c-earth);
	--ct-muted: var(--ct-c-muted);
	--ct-line: var(--ct-c-line);
	--ct-accent: var(--ct-c-earth);
	--ct-on-accent: var(--ct-c-paper);
	--ct-field: var(--ct-c-paper);
}

.ct--cream {
	--ct-bg: var(--ct-c-cream);
}

.ct--paper {
	--ct-bg: var(--ct-c-paper);
}

.ct--earth {
	--ct-bg: var(--ct-c-earth);
	--ct-heading: var(--ct-c-paper);
	--ct-text: var(--ct-c-paper);
	--ct-muted: var(--ct-c-sand);
	--ct-line: var(--ct-c-muted);
	--ct-accent: var(--ct-c-paper);
	--ct-on-accent: var(--ct-c-earth);
	--ct-field: transparent;
}

/* ------------------------------------------------------------------ */
/* Base                                                               */
/* ------------------------------------------------------------------ */

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}

body {
	margin: 0;
	background: var(--ct-c-cream);
	color: var(--ct-c-earth);
	font-family: var(--ct-sans);
	font-size: var(--ct-fs-body);
	line-height: var(--ct-lh-body);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

img,
svg,
video {
	max-width: 100%;
}

a {
	color: inherit;
}

:focus-visible {
	outline: 2px solid var(--ct-c-earth);
	outline-offset: 2px;
}

.ct--earth :focus-visible {
	outline-color: var(--ct-c-paper);
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.ct-skip-link {
	position: absolute;
	top: -100px;
	left: 16px;
	z-index: 1000;
	padding: 12px 16px;
	border-radius: var(--ct-radius-control);
	background: var(--ct-c-earth);
	color: var(--ct-c-paper);
	font-weight: 600;
	text-decoration: none;
}

.ct-skip-link:focus {
	top: 16px;
}

/* A section rendered by a Casa Terra widget. */
.ct {
	/* Reset, so a section placed inside a narrow column (e.g. inside a post) keeps its 1200 container. */
	--ct-max: 1200px;
	position: relative;
	background: var(--ct-bg);
	color: var(--ct-text);
	font-family: var(--ct-sans);
	font-size: var(--ct-fs-body);
	line-height: var(--ct-lh-body);
}

/* Zero specificity, so a section's own margins (".ct-heading__text { margin-top }") always win. */
:where(.ct) :where(h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd) {
	margin: 0;
}

:where(.ct) :where(ul, ol) {
	list-style: none;
	padding: 0;
}

/* Vertical rhythm: every section uses these, Elementor "Padding" controls override them. */
.ct-pad {
	padding-top: var(--ct-pad-t, var(--ct-section-pad));
	padding-bottom: var(--ct-pad-b, var(--ct-section-pad));
}

.ct-container {
	width: min(var(--ct-max), 100% - 2 * var(--ct-gutter));
	margin-inline: auto;
}

/* Wider container (64px gutters at 1440). */
.ct-container--wide {
	--ct-max: 1312px;
	width: min(var(--ct-max), 100% - 2 * min(var(--ct-gutter), 64px));
}

/* Article and page header measure (8 of 12 columns). */
.ct-container--narrow {
	--ct-max: 792px;
}

/* Dark photo overlay (hero, page headers): put it inside the photo's positioned wrapper. */
.ct-overlay {
	position: absolute;
	inset: 0;
	background: var(--ct-overlay);
	pointer-events: none;
}

/* ------------------------------------------------------------------ */
/* Type                                                               */
/* ------------------------------------------------------------------ */

.ct-display,
.ct-h1,
.ct-title,
.ct-h2,
.ct-h3,
.ct-figure-value {
	font-family: var(--ct-serif);
	font-weight: 400;
	color: var(--ct-heading, var(--ct-c-ink));
	letter-spacing: 0;
}

.ct-display {
	font-size: var(--ct-fs-display);
	line-height: var(--ct-lh-display);
}

.ct-h1 {
	font-size: var(--ct-fs-h1);
	line-height: var(--ct-lh-h1);
}

.ct-title {
	font-size: var(--ct-fs-title);
	line-height: var(--ct-lh-title);
}

.ct-h2 {
	font-size: var(--ct-fs-h2);
	line-height: var(--ct-lh-h2);
}

.ct-h3 {
	font-size: var(--ct-fs-h3);
	line-height: var(--ct-lh-h3);
}

.ct-figure-value {
	font-size: var(--ct-fs-figure);
	line-height: var(--ct-lh-figure);
}

.ct-lead {
	font-size: var(--ct-fs-lead);
	line-height: var(--ct-lh-lead);
}

.ct-body-lg {
	font-size: var(--ct-fs-body-lg);
	line-height: var(--ct-lh-body-lg);
}

.ct-small {
	font-size: var(--ct-fs-small);
	line-height: var(--ct-lh-small);
}

.ct-label {
	font-family: var(--ct-sans);
	font-size: var(--ct-fs-label);
	line-height: var(--ct-lh-label);
	font-weight: 600;
	text-transform: uppercase;
}

.ct-muted {
	color: var(--ct-muted, var(--ct-c-muted));
}

.ct-eyebrow {
	color: var(--ct-muted);
}

/* Section heading: title then one line of text 8px under it (Figma "Heading" + "Body line"). */
.ct-heading {
	margin-bottom: var(--ct-heading-gap);
}

.ct-heading .ct-eyebrow {
	margin-bottom: 16px;
}

.ct-heading__text {
	margin-top: 8px;
	color: var(--ct-muted);
	font-size: var(--ct-fs-body-lg);
	line-height: var(--ct-lh-body-lg);
}

/* ------------------------------------------------------------------ */
/* Buttons and links                                                  */
/* ------------------------------------------------------------------ */

.ct-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	padding: 0 24px;
	border: 1px solid transparent;
	border-radius: var(--ct-radius-control);
	font-family: var(--ct-sans);
	font-size: 16px;
	line-height: 24px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.ct .ct-btn--primary,
.ct-btn--primary {
	background: var(--ct-accent, var(--ct-c-earth));
	color: var(--ct-on-accent, var(--ct-c-paper));
}

.ct .ct-btn--primary:hover,
.ct-btn--primary:hover {
	background: var(--ct-c-earth-dark);
	color: var(--ct-c-paper);
}

.ct--earth .ct-btn--primary:hover {
	background: var(--ct-c-cream);
	color: var(--ct-c-earth);
}

.ct .ct-btn--outline,
.ct-btn--outline {
	background: var(--ct-c-cream);
	border-color: var(--ct-c-line);
	color: var(--ct-c-earth);
}

.ct .ct-btn--outline:hover,
.ct-btn--outline:hover {
	border-color: var(--ct-c-earth);
	color: var(--ct-c-earth);
}

.ct-btn--block {
	width: 100%;
}

.ct .ct-link,
.ct-link {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--ct-heading, var(--ct-c-ink));
	font-size: 16px;
	line-height: 24px;
	font-weight: 600;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.ct .ct-link:hover,
.ct-link:hover {
	text-decoration-thickness: 2px;
}

.ct-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px 32px;
}

/* ------------------------------------------------------------------ */
/* Form fields (booking bars, stay request, newsletter)               */
/* ------------------------------------------------------------------ */

.ct-field {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
}

.ct-field__label {
	color: var(--ct-text, var(--ct-c-ink));
}

/* Boxed control: 48px, 1px rule, paper. Selects and the date field share it. */
.ct-control {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 48px;
	padding: 0 12px;
	border: 1px solid var(--ct-c-line);
	border-radius: var(--ct-radius-control);
	background: var(--ct-field, var(--ct-c-paper));
	color: var(--ct-c-ink);
}

.ct-control:focus-within {
	border-color: var(--ct-c-ink);
}

.ct-control select,
.ct-control input {
	flex: 1;
	min-width: 0;
	height: 46px;
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	background: transparent;
	color: inherit;
	font-family: var(--ct-sans);
	font-size: 16px;
	line-height: 24px;
	appearance: none;
	-webkit-appearance: none;
}

.ct-control select {
	padding-right: 28px;
	cursor: pointer;
}

.ct-control__icon {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
}

.ct-control__lead {
	flex: none;
}

/* Date: native input under the formatted text; theme.js opens the picker. */
.ct-control--date {
	cursor: pointer;
}

.ct-control__value {
	display: none;
	flex: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ct-js .ct-control--date .ct-control__value {
	display: block;
}

.ct-js .ct-control--date input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
}

.ct-js .ct-control--date input::-webkit-calendar-picker-indicator {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
}

/* Plain text input (stay request, newsletter). */
.ct-input {
	width: 100%;
	min-height: 48px;
	padding: 12px;
	border: 1px solid var(--ct-c-line);
	border-radius: var(--ct-radius-control);
	background: var(--ct-c-paper);
	color: var(--ct-c-earth);
	font-family: var(--ct-sans);
	font-size: 16px;
	line-height: 24px;
}

.ct-input::placeholder {
	color: var(--ct-c-muted);
	opacity: 1;
}

.ct-input:focus {
	outline: 0;
	border-color: var(--ct-c-ink);
}

/* Error state (Figma "Inquiry / error"): the border stays tan, the message turns brick. */
.ct-field__error {
	color: var(--ct-c-error);
	font-size: var(--ct-fs-small);
	line-height: var(--ct-lh-small);
}

.ct-form-note {
	color: var(--ct-muted);
	font-size: var(--ct-fs-small);
	line-height: var(--ct-lh-small);
}

.ct-form-note:empty {
	display: none;
}

/* ------------------------------------------------------------------ */
/* FAQ accordion                                                      */
/* ------------------------------------------------------------------ */

.ct-faq__item {
	border-bottom: 1px solid var(--ct-line);
}

.ct-faq__q {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 48px;
	padding: 16px 0;
	list-style: none;
	cursor: pointer;
}

.ct-faq__q::-webkit-details-marker {
	display: none;
}

.ct-faq__question {
	color: var(--ct-heading);
	font-size: var(--ct-fs-faq);
	line-height: var(--ct-lh-faq);
	font-weight: 500;
}

.ct-faq__icon {
	flex: none;
	width: 24px;
	height: 24px;
	color: var(--ct-heading);
	transition: transform 0.2s ease;
}

/* Figma "FAQ" component: plus when closed, minus when open. */
.ct-faq__icon--close,
.ct-faq__item[open] .ct-faq__icon--open {
	display: none;
}

.ct-faq__item[open] .ct-faq__icon--close {
	display: block;
}

/* Open: the answer 4px under the question, 24px above the rule. */
.ct-faq__a {
	margin-top: -12px;
	padding: 4px 64px 24px 0;
	color: var(--ct-muted);
	font-size: 17px;
	line-height: 26px;
}

@media (max-width: 767px) {
	.ct-faq__a {
		padding-right: 0;
		font-size: var(--ct-fs-body);
		line-height: var(--ct-lh-body);
	}
}

.ct-faq__a p + p {
	margin-top: 12px;
}

/* ------------------------------------------------------------------ */
/* Photos with captions                                               */
/* ------------------------------------------------------------------ */

.ct-figure {
	margin: 0;
	min-width: 0;
}

.ct-figure__media {
	overflow: hidden;
	border-radius: var(--ct-radius);
	background: var(--ct-c-line);
}

.ct .ct-figure__media img,
.ct-figure__media img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

.ct-figure__caption {
	margin-top: 8px;
	color: var(--ct-muted);
	font-size: var(--ct-fs-small);
	line-height: var(--ct-lh-small);
}

/* Photo credit on a full-bleed photo. */
.ct-credit {
	color: rgb(255 249 239 / 0.9);
	font-size: var(--ct-fs-small);
	line-height: var(--ct-lh-small);
}

/* Horizontal scroll rows (Figma "Scroll row · …": tablet and phone card rows, plans, photo strips). */
.ct-scroll {
	display: flex;
	gap: 24px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-padding-inline: var(--ct-gutter);
	scrollbar-width: none;
}

.ct-scroll::-webkit-scrollbar {
	display: none;
}

.ct-scroll > * {
	flex: none;
	scroll-snap-align: start;
}

@media (max-width: 1024px) {
	.ct-scroll {
		gap: 16px;
	}
}

/* Bleeds a scroll row to the viewport edge while its first item lines up with the container. */
.ct-bleed {
	margin-inline: calc(-1 * var(--ct-gutter));
	padding-inline: var(--ct-gutter);
}

/* Inline SVG drawings (assets/svg/plans, assets/svg/maps) recolour through these, so they
   follow the Elementor global colours like the rest of the page. */
.ct-drawing {
	--ct-plan-ink: var(--ct-c-earth);
	--ct-plan-wall: var(--ct-c-earth);
	--ct-plan-room: var(--ct-c-paper);
	--ct-plan-court: var(--ct-c-cream);
	--ct-plan-pool: var(--ct-c-sand);
	--ct-plan-muted: var(--ct-c-muted);
	--ct-map-bg: var(--ct-c-cream);
	--ct-map-ink: var(--ct-c-earth);
	--ct-map-pin: var(--ct-c-earth);
	--ct-map-route: var(--ct-c-earth);
	--ct-shade-wall: var(--ct-c-sand);
	--ct-shade-sun: var(--ct-c-cream);
	--ct-shade-shade: var(--ct-c-muted);
	--ct-shade-pool: var(--ct-c-sand);
	--ct-shade-edge: var(--ct-c-earth);
	--ct-shade-sun-icon: var(--ct-c-earth);
	position: relative;
}

.ct-drawing svg {
	display: block;
	width: 100%;
	height: auto;
}

/* HTML labels laid over a drawing, positioned in % of its viewBox. */
.ct-drawing__label {
	position: absolute;
	color: var(--ct-c-muted);
	font-family: var(--ct-sans);
	font-size: var(--ct-fs-label);
	line-height: var(--ct-lh-label);
	font-weight: 600;
	white-space: nowrap;
	pointer-events: none;
}

.ct-drawing__label--center {
	transform: translate(-50%, -50%);
	font-weight: 400;
}

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

/* Casa Terra widgets bring their own spacing; remove wrapper gaps around them. */
.elementor-widget[class*="elementor-widget-ct-"],
.elementor-widget[class*="elementor-widget-ct-"] > .elementor-widget-container {
	margin: 0;
	padding: 0;
}
