/* Earth Windows — experience layer.
   Behaviours translated from the Fluid Glass reverse engineering
   (docs/research/reverse-engineering/2026-08-25-fluid-glass-direct-inspection.md):
   the floating dock and its sections panel, rolling link labels,
   the self-drawing arrow, the manual stories carousel and the
   pointer-fine hover preview. Every transition runs through tokens that
   base.css zeroes under prefers-reduced-motion. */

/* Dock ------------------------------------------------------------------- */

.ew-dock-root {
	/* Shared by the closed island and the panel, which are sibling layers. */
	--ew-dock-accent: #e2a75e;

	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 40;
	pointer-events: none;
}

.ew-dock-dim {
	position: fixed;
	inset: 0;
	z-index: 0;
	background-color: rgb(20 24 22 / 0.42);
	opacity: 0;
	pointer-events: none;
	transition: opacity 420ms var(--ew-motion-ease);
}

.ew-dock-root[data-ew-dock-open="true"] .ew-dock-dim {
	opacity: 1;
	pointer-events: auto;
}

.ew-dock {
	pointer-events: auto;
	position: absolute;
	left: 50%;
	bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
	transform: translateX(-50%);
	display: grid;
	grid-template-columns: minmax(2.75rem, 1fr) 2.75rem minmax(3.5rem, 1fr);
	align-items: center;
	/* 15rem gives the Quote roll room at 11–12px uppercase without
	   truncation on 320px viewports; 100vw cap keeps 2rem page margins. */
	width: min(15rem, calc(100vw - 2rem));
	padding: 0.25rem;
	background-color: color-mix(in srgb, var(--ew-green-dark) 92%, transparent);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	border: var(--ew-line-width) solid rgb(245 241 233 / 0.16);
	border-radius: 999px;
	color: var(--ew-on-brand);
	transition:
		opacity 280ms var(--ew-motion-ease),
		transform 280ms var(--ew-motion-ease);
}

.ew-dock-root[data-ew-dock-open="true"] .ew-dock {
	opacity: 0;
	pointer-events: none;
	transform: translateX(-50%) translateY(0.75rem) scale(0.96);
}

.ew-dock__home,
.ew-dock__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/* 44px meets the touch target floor without changing the icon size. */
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: none;
	color: inherit;
	cursor: pointer;
	transition: background-color var(--ew-motion-fast) var(--ew-motion-ease);
}

.ew-dock__toggle {
	justify-self: start;
}

.ew-dock__home {
	justify-self: center;
}

.ew-dock__home:hover,
.ew-dock__toggle:hover {
	background-color: rgb(245 241 233 / 0.12);
}

.ew-dock__home svg,
.ew-dock__home img {
	width: 26px;
	height: 26px;
}

.ew-dock__home .ew-brand-symbol {
	width: 26px;
	height: 26px;
}

.ew-dock__toggle svg {
	width: 22px;
	height: 22px;
}

.ew-dock__toggle .ew-icon-close {
	display: none;
}

.ew-dock-root[data-ew-dock-open="true"] .ew-dock__toggle .ew-icon-close {
	display: block;
}

.ew-dock-root[data-ew-dock-open="true"] .ew-dock__toggle .ew-icon-open {
	display: none;
}

.ew-dock__quote {
	display: inline-flex;
	align-items: center;
	justify-self: end;
	gap: 0.375rem;
	/* 44px touch floor; nowrap keeps Quote on one line in the pill. */
	min-height: 44px;
	white-space: nowrap;
	padding: 0 0.25rem;
	border-radius: 999px;
	color: inherit;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-decoration: none;
	transition: background-color var(--ew-motion-fast) var(--ew-motion-ease);
}

.ew-dock__quote:hover {
	background-color: rgb(245 241 233 / 0.12);
}

.ew-dock__quote .ew-draw {
	width: 1rem;
	height: 0.75rem;
	color: var(--ew-dock-accent);
}

/* Internal pages already expose the primary quote action in the header.
   Keep the floating dock navigational so the fold has one clear CTA. */
body:not(.home) .ew-dock__quote {
	display: none;
}

/* Without the quote action the pill holds two controls: centre them in a
   compact two-column island instead of leaving an empty third column. */
body:not(.home) .ew-dock {
	grid-template-columns: 44px 44px;
	justify-content: center;
	gap: 0.5rem;
	width: auto;
	padding: 0.25rem 0.75rem;
}

/* Sections panel ----------------------------------------------------------- */

.ew-dock__panel {
	z-index: 1;
	pointer-events: auto;
	position: absolute;
	left: 50%;
	bottom: calc(6.75rem + env(safe-area-inset-bottom, 0px));
	transform: translate(-50%, 0.875rem) scaleY(0.92);
	transform-origin: center bottom;
	width: min(25.5rem, calc(100vw - 2rem));
	height: min(41rem, calc(100svh - 10rem));
	max-height: min(41rem, calc(100svh - 10rem));
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: clamp(2rem, 4vw, 3.25rem);
	background-color: var(--ew-green-dark);
	color: var(--ew-on-brand);
	border: 0;
	border-radius: 0.125rem 0.125rem 0 0;
	box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 0.36);
	clip-path: inset(100% 0 0 0);
	opacity: 0;
	transition:
		opacity 180ms var(--ew-motion-ease),
		transform 420ms var(--ew-motion-ease),
		clip-path 420ms var(--ew-motion-ease);
}

.ew-dock-root[data-ew-dock-open="true"] .ew-dock__panel {
	opacity: 1;
	transform: translate(-50%, 0) scaleY(1);
	clip-path: inset(0);
}

.ew-dock__label {
	font-family: var(--ew-font-body);
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--ew-dock-accent);
	margin: 0 0 1.25rem;
}

.ew-dock__list {
	list-style: none;
	margin: 0 0 1.75rem;
	padding: 0;
}

.ew-dock__link {
	display: block;
	padding: 0.125rem 0;
	border: 0;
	color: inherit;
	font-family: var(--ew-font-body);
	font-size: clamp(2rem, 3.35vw, 2.5rem);
	font-weight: 400;
	line-height: 1.03;
	letter-spacing: -0.055em;
	text-decoration: none;
	transition: color var(--ew-motion-fast) var(--ew-motion-ease);
}

.ew-dock__link:hover,
.ew-dock__link:focus-visible {
	color: var(--ew-dock-accent);
}

/* The roll needs a little internal breathing room for ascenders and
   descenders; the negative margin preserves the editorial row rhythm. */
.ew-dock__link .ew-roll {
	padding-block: 0.08em;
	margin-block: -0.08em;
}

.ew-dock__link .ew-roll span {
	transition-duration: 640ms;
}

.ew-dock__link .ew-roll span + span {
	transform: translateY(120%);
}

.ew-dock__link:hover .ew-roll span:first-child,
.ew-dock__link:focus-visible .ew-roll span:first-child {
	transform: translateY(-120%);
}

.ew-dock__link:hover .ew-roll span + span,
.ew-dock__link:focus-visible .ew-roll span + span {
	transform: translateY(0);
}

.ew-dock__list--secondary .ew-dock__link {
	display: block;
	font-family: var(--ew-font-body);
	font-size: 1.0625rem;
	font-weight: 500;
	letter-spacing: -0.025em;
	line-height: 1.25;
	padding: 0;
	margin: 0;
}

.ew-dock__list--secondary {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.625rem 1rem;
	margin-bottom: 1.75rem;
}

.ew-dock__cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.875rem;
	width: 100%;
	min-height: 3.25rem;
	padding: 0.75rem 1rem;
	background-color: rgb(7 17 12 / 0.78);
	border: 0;
	border-radius: 0;
	color: var(--ew-on-brand);
	font-family: var(--ew-font-body);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	transition:
		background-color var(--ew-motion-fast) var(--ew-motion-ease),
		color var(--ew-motion-fast) var(--ew-motion-ease);
}

.ew-dock__cta:hover,
.ew-dock__cta:focus-visible {
	background-color: rgb(7 17 12 / 1);
	color: var(--ew-dock-accent);
}

.ew-dock__cta .ew-draw {
	width: 1rem;
	height: 0.75rem;
	color: inherit;
	transition: transform var(--ew-motion-fast) var(--ew-motion-ease);
}

.ew-dock__cta .ew-draw path {
	stroke-dashoffset: 0;
}

.ew-dock__cta:hover .ew-draw,
.ew-dock__cta:focus-visible .ew-draw {
	transform: translateX(0.25rem);
}

.ew-dock__close {
	position: absolute;
	left: 50%;
	bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
	z-index: 2;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: var(--ew-line-width) solid rgb(245 241 233 / 0.24);
	border-radius: 999px;
	background-color: color-mix(in srgb, var(--ew-green-dark) 88%, transparent);
	color: var(--ew-on-brand);
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transform: translate(-50%, 0.75rem) scale(0.96);
	transition:
		opacity 280ms var(--ew-motion-ease),
		transform 280ms var(--ew-motion-ease),
		background-color var(--ew-motion-fast) var(--ew-motion-ease);
}

.ew-dock__close svg {
	width: 1rem;
	height: 1rem;
	margin: auto;
	opacity: 0.82;
}

.ew-dock-root[data-ew-dock-open="true"] .ew-dock__close {
	opacity: 1;
	pointer-events: auto;
	transform: translate(-50%, 0) scale(1);
}

.ew-dock__close:hover,
.ew-dock__close:focus-visible {
	background-color: color-mix(in srgb, var(--ew-green-dark) 78%, var(--ew-dock-accent));
}

/* Footer clearance: the dock floats above the page, so the legal line keeps
   a breathing margin instead of resting permanently under the pill.
   4.75rem clears the 44px controls plus the 1.25rem bottom offset. */
.ew-footer {
	padding-bottom: calc(var(--ew-space-sm) + 4.75rem);
}

/* Contact and quote are focused conversion flows. Their floating dock would
   duplicate navigation, cover the first visible action on narrow screens and
   insert unrelated keyboard stops before the shared form. */
.contact .ew-dock-root,
.page-template-page-contact .ew-dock-root,
.page-template-page-contact-php .ew-dock-root,
.request-a-quote .ew-dock-root {
	display: none;
}

/* Rolling label ------------------------------------------------------------ */

.ew-roll {
	position: relative;
	display: inline-block;
	overflow: hidden;
	vertical-align: top;
}

.ew-roll span {
	display: block;
	transition: transform 320ms var(--ew-motion-ease);
}

.ew-roll span + span {
	position: absolute;
	inset: 0;
	transform: translateY(110%);
}

a:hover .ew-roll span:first-child,
a:focus-visible .ew-roll span:first-child,
button:hover > .ew-roll span:first-child,
button:focus-visible > .ew-roll span:first-child {
	transform: translateY(-110%);
}

a:hover .ew-roll span + span,
a:focus-visible .ew-roll span + span,
button:hover > .ew-roll span + span,
button:focus-visible > .ew-roll span + span {
	transform: translateY(0);
}

/* Self-drawing arrow ------------------------------------------------------- */

.ew-draw path {
	stroke-dasharray: 1;
	stroke-dashoffset: 1;
	transition: stroke-dashoffset 420ms var(--ew-motion-ease);
}

a:hover .ew-draw path,
a:focus-visible .ew-draw path,
button:hover > .ew-draw path,
button:focus-visible > .ew-draw path {
	stroke-dashoffset: 0;
}

/* Stories carousel (manual, dormant until approved reviews exist) ---------- */

.ew-stories__head {
	display: flex;
	align-items: center;
	gap: var(--ew-space-sm);
	margin-bottom: var(--ew-space-md);
}

.ew-stories__head .ew-eyebrow {
	margin-bottom: 0;
}

.ew-stories__count {
	margin: 0;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	color: var(--ew-text-muted);
	font-variant-numeric: tabular-nums;
}

.ew-stories__nav {
	display: flex;
	gap: 0.5rem;
	margin-left: auto;
}

.ew-stories__nav button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: none;
	border: var(--ew-line-width) solid var(--ew-line);
	border-radius: var(--ew-radius);
	color: var(--ew-text);
	cursor: pointer;
	transition:
		color var(--ew-motion-fast) var(--ew-motion-ease),
		border-color var(--ew-motion-fast) var(--ew-motion-ease);
}

.ew-stories__nav button:hover:not(:disabled) {
	color: var(--ew-action);
	border-color: var(--ew-action);
}

.ew-stories__nav button:disabled {
	color: var(--ew-text-muted);
	border-color: var(--ew-line);
	cursor: default;
	opacity: 0.55;
}

.ew-stories__nav svg {
	width: 18px;
	height: 18px;
}

.ew-stories__viewport {
	overflow: hidden;
}

.ew-stories__track {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: stretch;
	transition: transform 480ms var(--ew-motion-ease);
}

.ew-stories__item {
	flex: 0 0 100%;
	min-width: 0;
	margin: 0;
	padding: 0;
}

.ew-stories__item blockquote {
	margin: 0 0 var(--ew-space-sm);
}

.ew-stories__item blockquote p {
	font-family: var(--ew-font-display);
	font-size: var(--ew-display-lg);
	line-height: 1.18;
	letter-spacing: -0.01em;
	margin: 0;
	max-width: 24ch;
}

.ew-stories__author {
	margin: 0;
	font-weight: 600;
}

.ew-stories__role {
	margin: 0;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ew-text-muted);
}

/* Hover preview (pointer-fine only; decorative) ----------------------------- */

.ew-preview {
	position: fixed;
	left: 0;
	top: 0;
	z-index: 45;
	/* Section-scoped sizing hook (Phase 2): consumers may narrow the hint via
	   --ew-preview-w; default matches the approved foundation clamp. */
	width: var(--ew-preview-w, clamp(9rem, 22vw, 13rem));
	aspect-ratio: 4 / 3;
	overflow: hidden;
	pointer-events: none;
	border: var(--ew-line-width) solid rgb(20 24 22 / 0.2);
	background-color: var(--ew-stone);
	opacity: 0;
	transition: opacity 240ms var(--ew-motion-ease);
	will-change: auto;
}

/* The compositor hint exists only while the preview is visible/moving
   (spec §6.3): idle cost returns to auto as soon as it hides. */
.ew-preview[data-ew-preview-active="true"] {
	will-change: transform, opacity;
}

.ew-preview[data-ew-preview-visible="true"] {
	opacity: 1;
}

.ew-preview img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

@media (max-width: 30em) {
	.ew-dock {
		padding: 0.25rem 0.5rem;
	}

	.ew-dock__quote {
		/* Keep the 12px label readable without retruncating the roll:
		   tighter padding and tracking fit Quote in the 94px column. */
		padding: 0 0.5rem;
		font-size: 0.75rem;
		letter-spacing: 0.06em;
	}

	.ew-dock__panel {
		height: min(38rem, calc(100svh - 8.5rem));
		overflow-y: auto;
		padding: 2rem;
	}
}

/* Quote action, revised 23/10/2026 ----------------------------------------
   Yago found the floating quote too small. It is now a filled pill that
   stays on every page (the header carries no quote action of its own), with
   a larger target on desktop and a ~15% larger dock on phones. */
.ew-dock,
body:not(.home) .ew-dock {
	grid-template-columns: 44px 44px minmax(0, 1fr);
	gap: 0.25rem;
	width: min(17.25rem, calc(100vw - 2rem));
	padding: 0.3rem;
}

body:not(.home) .ew-dock__quote {
	display: inline-flex;
}

.ew-dock__quote {
	justify-self: stretch;
	justify-content: center;
	gap: 0.5rem;
	min-height: 48px;
	padding: 0 clamp(0.375rem, 2vw, 1rem);
	background-color: var(--ew-brand-beige);
	color: var(--ew-brand-deep-green);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.06em;
}

.ew-dock__quote:hover,
.ew-dock__quote:focus-visible {
	background-color: #ffffff;
}

.ew-dock__quote .ew-draw {
	color: currentColor;
}

@media (min-width: 64em) {
	.ew-dock,
	body:not(.home) .ew-dock {
		width: 21rem;
		padding: 0.35rem;
	}

	.ew-dock__quote {
		min-height: 52px;
		font-size: 0.9375rem;
	}
}
