/**
 * Practice Areas page template. The hero is the shared .page-hero and the
 * closing call to action the shared .cta, both in main.css.
 *
 * 1. Hero
 * 2. Area rows
 * 3. Advice list (in the side panel, or in the rows without JavaScript)
 * 4. Side panel
 */

/* 1. Hero ----------------------------------------------------------------- */

.areas-hero {
	padding-block: clamp(80px, 10vw, 140px);
}

.areas-hero .page-hero__inner {
	gap: clamp(24px, 3vw, 32px);
}

.areas-hero .page-hero__lead {
	max-width: 620px;
	line-height: 1.7;
}

/* 2. Area rows ------------------------------------------------------------
 * Title and preview on the left, count and arrow on the right. With
 * JavaScript the arrow button covers the whole row and opens the panel.
 */

.areas {
	padding: clamp(72px, 9vw, 128px) 0;
	background: var(--c-white);
}

.areas__list {
	margin: 0;
	padding: 0;
	border-top: 1px solid var(--c-navy);
	list-style: none;
}

.area-row {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto auto;
	gap: 12px 24px;
	align-items: center;
	padding: clamp(28px, 3.2vw, 44px) clamp(12px, 1.6vw, 24px);
	border-bottom: 1px solid rgba(23, 34, 63, 0.14);
	color: var(--c-navy);
	scroll-margin-top: 110px;
}

.area-row__fill {
	position: absolute;
	inset: 0;
	background: var(--c-cream);
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.6s var(--ease-drawer);
	pointer-events: none;
}

.area-row__title,
.area-row__preview {
	position: relative;
	grid-column: 1;
	padding-right: clamp(0px, calc(4vw - 24px), 40px);
}

.area-row__title {
	grid-row: 1;
	font-size: clamp(24px, 3vw, 42px);
	font-weight: 300;
	line-height: 1.15;
	letter-spacing: -0.02em;
	text-wrap: balance;
}

.area-row__preview {
	grid-row: 2;
	max-width: 760px;
	margin: 0;
	overflow: hidden;
	color: var(--c-text-soft);
	font-size: 14.5px;
	line-height: 1.6;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.area-row__count {
	position: relative;
	grid-column: 2;
	grid-row: 1 / span 2;
	color: var(--c-gold-deep);
	font-size: 12.5px;
	white-space: nowrap;
}

.area-row__open {
	grid-column: 3;
	grid-row: 1 / span 2;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: inherit;
	cursor: pointer;
}

.area-row__open::after {
	position: absolute;
	inset: 0;
	content: "";
}

.area-row__arrow {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: clamp(44px, 4vw, 52px);
	height: clamp(44px, 4vw, 52px);
	border-radius: 50%;
	background: var(--c-navy);
	color: var(--c-white);
	transition: transform 0.5s var(--ease-out), background-color 0.35s ease, color 0.35s ease;
}

.area-row:focus-within .area-row__fill {
	transform: scaleX(1);
}

.area-row:focus-within .area-row__arrow {
	background: var(--c-gold);
	color: var(--c-navy);
	transform: translateX(4px);
}

@media (hover: hover) {
	.area-row:hover .area-row__fill {
		transform: scaleX(1);
	}

	.area-row:hover .area-row__arrow {
		background: var(--c-gold);
		color: var(--c-navy);
		transform: translateX(4px);
	}
}

.area-row__detail {
	position: relative;
	grid-column: 1 / -1;
	grid-row: 3;
	display: flex;
	flex-direction: column;
	gap: 24px;
	margin-top: 12px;
}

.js .area-row__detail {
	display: none;
}

/* Without JavaScript the rows show their advice instead of a preview. */
.no-js .area-row__preview,
.no-js .area-row__open {
	display: none;
}

.no-js .area-row__fill {
	display: none;
}

@media (max-width: 639.98px) {
	.area-row {
		grid-template-columns: minmax(0, 1fr) auto;
	}

	.area-row__count {
		grid-column: 1;
		grid-row: 3;
	}

	.area-row__open {
		grid-column: 2;
		grid-row: 1 / span 3;
	}

	.area-row__detail {
		grid-row: 4;
	}
}

/* 3. Advice list ---------------------------------------------------------- */

.area-detail__items {
	margin: 0;
	padding: 0;
	border-top: 1px solid var(--c-navy);
	list-style: none;
}

.area-detail__item {
	display: grid;
	grid-template-columns: 20px minmax(0, 1fr);
	gap: 12px;
	padding: 16px 0;
	border-bottom: 1px solid rgba(23, 34, 63, 0.12);
	color: #2f3649;
	font-size: 15.5px;
	line-height: 1.65;
}

.area-detail__item::before {
	width: 6px;
	height: 6px;
	margin-top: 0.62em;
	background: var(--c-gold);
	content: "";
}

.area-detail__cta {
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	gap: 14px;
	padding: 16px 22px;
	background: var(--c-navy);
	color: var(--c-white);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	transition: background-color 0.3s, color 0.3s;
}

.area-detail__cta:hover {
	background: var(--c-gold);
	color: var(--c-navy);
}

/* 4. Side panel ----------------------------------------------------------- */

body.has-area-panel-open {
	overflow: hidden;
}

.area-panel-backdrop {
	position: fixed;
	inset: 0;
	z-index: 90;
	background: rgba(17, 26, 49, 0.5);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.5s ease;
}

.area-panel-backdrop.is-open {
	opacity: 1;
	pointer-events: auto;
}

.area-panel {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 100;
	display: flex;
	flex-direction: column;
	width: min(100vw, max(62vw, 760px));
	background: var(--c-white);
	transform: translateX(102%);
	transition: transform 0.75s var(--ease-drawer);
}

/* Until practice-areas.js takes over. */
.area-panel[hidden] {
	display: none;
}

.area-panel.is-open {
	box-shadow: -30px 0 80px -30px rgba(0, 0, 0, 0.4);
	transform: none;
}

.area-panel__head {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	height: 76px;
	padding: 0 clamp(24px, 3vw, 40px);
	border-bottom: 1px solid rgba(23, 34, 63, 0.1);
}

.area-panel__close {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 0;
	border: 0;
	background: none;
	color: var(--c-navy);
	font-size: 11.5px;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	cursor: pointer;
}

.area-panel__close-icon {
	position: relative;
	width: 18px;
	height: 18px;
}

.area-panel__close-icon::before,
.area-panel__close-icon::after {
	position: absolute;
	top: 8px;
	left: 0;
	width: 18px;
	height: 1.5px;
	background: var(--c-navy);
	content: "";
	transform: rotate(45deg);
}

.area-panel__close-icon::after {
	transform: rotate(-45deg);
}

.area-panel__scroll {
	flex: 1 1 auto;
	padding: clamp(28px, 3.4vw, 48px) clamp(24px, 3vw, 40px);
	overflow-y: auto;
	overscroll-behavior: contain;
}

.area-panel__body {
	display: flex;
	flex-direction: column;
	gap: 32px;
	opacity: 0;
	transform: translateY(14px);
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.area-panel.is-open .area-panel__body {
	opacity: 1;
	transform: none;
	transition: opacity 0.5s ease 0.2s, transform 0.7s var(--ease-out) 0.2s;
}

/* Previous and Next fade the content out before the next area comes in. */
.area-panel.is-open.is-switching .area-panel__body {
	opacity: 0;
	transform: translateY(14px);
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.area-panel__title {
	color: var(--c-navy);
	font-size: clamp(28px, 2.8vw, 38px);
	font-weight: 300;
	line-height: 1.18;
	letter-spacing: -0.02em;
	text-wrap: balance;
}

.area-panel__content {
	display: flex;
	flex-direction: column;
	gap: 32px;
}

.area-panel__steps {
	display: grid;
	flex-shrink: 0;
	grid-template-columns: 1fr 1fr;
	border-top: 1px solid rgba(23, 34, 63, 0.1);
}

.area-panel__step {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	padding: 18px clamp(24px, 3vw, 40px);
	border: 0;
	background: none;
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition: background-color 0.3s;
}

.area-panel__step--next {
	align-items: flex-end;
	border-left: 1px solid rgba(23, 34, 63, 0.1);
	text-align: right;
}

.area-panel__step:hover {
	background: var(--c-cream);
}

.area-panel__step-label {
	color: var(--c-gold-deep);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.area-panel__step-title {
	max-width: 100%;
	overflow: hidden;
	color: var(--c-navy);
	font-size: 13.5px;
	line-height: 1.4;
	text-overflow: ellipsis;
	white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
	.area-row__fill,
	.area-row__arrow,
	.area-panel,
	.area-panel-backdrop,
	.area-panel__body,
	.area-panel.is-open .area-panel__body,
	.area-panel.is-open.is-switching .area-panel__body {
		transition: none;
	}
}
