/* ==========================================================================
   Elite Dental Clinic — content.css
   Clinic page, Contact page, Journal, articles and legal/generic pages.
   Mobile-first; breakpoint overrides at the end of responsive.css.
   Measurements: docs/phase4-visual-audit.md
   ========================================================================== */

/* Clinic: hero + image row ----------------------------------------------- */

/* Eyebrow sits above the H1 without moving the H1 off the 256px line (21px label + 16px gap). */
.clinic-hero {
	padding-top: calc(16rem - 2.3125rem);
	padding-bottom: 0;
}

.clinic-hero .page-hero__lede {
	max-width: 30rem;
}

/* Full-bleed landscape + portrait, sharing one height (reference 948 × 587 + 470 × 587 at 1440). */
.clinic-row {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
	gap: var(--grid-gap);
	padding-block: var(--space-l) var(--space-xl);
}

.clinic-row__item:first-child {
	aspect-ratio: 1.615;
}

/* The side image opens just after the main one. */
.clinic-row__item:last-child {
	--reveal-delay: 150ms;
}

/* The portrait follows the row height set by the landscape. */
.clinic-row__item:last-child img {
	position: absolute;
	inset: 0;
}

/* Clinic: philosophy ----------------------------------------------------- */

.clinic-intro__label {
	margin-bottom: var(--space-m);
}

.clinic-intro__content > p:first-child {
	font-family: var(--font-display);
	font-size: var(--text-heading-sm);
	font-weight: 500;
	line-height: 1.15;
	letter-spacing: var(--tracking-display);
	color: var(--edc-text);
	text-wrap: balance;
}

.clinic-intro__content > * + * {
	margin-top: 1.25em;
}

.clinic-intro__content > p:not(:first-child) {
	max-width: 36rem;
	font-size: var(--text-prose);
	color: var(--edc-text-soft);
}

.clinic-intro__content > p:first-child + p {
	margin-top: var(--space-m);
}

/* Clinic: the space (rail) ----------------------------------------------- */
/* A horizontal rail at every width: native swipe with snap points and a thin scrollbar for mouse users.
   From 1200px clinic.js may pin it (.is-pinned, see responsive.css). Card size, not column width, sets
   the image size, so tablets no longer stack full-width portraits. */

.clinic-space {
	--rail-card: 80vw;
	overflow-x: clip; /* the rail bleeds to the screen edge */
}

.clinic-space__text {
	max-width: 30rem;
	margin-top: var(--space-xs);
	color: var(--edc-text-soft);
}

.clinic-space__viewport {
	margin: var(--space-l) calc(var(--gutter) * -1) 0;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-padding-inline: var(--gutter);
	scrollbar-width: thin;
	scrollbar-color: var(--edc-border-strong) transparent;
}

.clinic-space__viewport:focus-visible {
	outline-offset: -2px;
}

.clinic-space__grid {
	display: flex;
	align-items: flex-start;
	gap: var(--space-s);
	width: max-content;
	margin: 0;
	padding: 0 var(--gutter) var(--space-s);
	list-style: none;
}

.clinic-space__item {
	flex: 0 0 var(--rail-card);
	scroll-snap-align: start;
}

.clinic-space__media {
	aspect-ratio: 4 / 5;
}

.clinic-space figcaption {
	display: flex;
	flex-direction: column;
	gap: var(--space-3xs);
	margin-top: var(--space-xs);
}

.clinic-space__caption {
	color: var(--edc-text-soft);
}

/* Clinic: approach (sticky story) ---------------------------------------- */
/* Stacked steps, each with its own image; from 1200px a sticky story (responsive.css + clinic.js). */

.clinic-approach {
	background: var(--edc-bg);
}

.clinic-approach__text {
	display: grid;
	gap: var(--space-xs) var(--space-m);
	margin-top: var(--space-m);
	color: var(--edc-text-soft);
}

.clinic-approach__text p {
	max-width: 36rem;
}

.approach {
	margin-top: var(--space-l);
}

.approach__media {
	display: none;
}

.approach__steps {
	display: grid;
	gap: var(--space-l);
	margin: 0;
	padding: 0;
	list-style: none;
}

.approach__step-media {
	aspect-ratio: 3 / 2;
}

.approach__step-body {
	margin-top: var(--space-s);
}

.approach__step-index {
	display: block;
	font-family: var(--font-display);
	font-size: var(--text-small);
	letter-spacing: var(--tracking-caps);
	color: var(--edc-muted);
}

.approach__step-title {
	margin-top: var(--space-2xs);
}

.approach__step-text {
	max-width: 36rem;
	margin-top: var(--space-2xs);
	font-size: var(--text-lede);
	color: var(--edc-text-soft);
}

/* Clinic: technology. Dark by design (data-edc-tone="dark", the Original pattern); role tokens only, so a
   section pattern can give it any tone. ------------------------------------------------------------------ */

.clinic-tech {
	padding-block: var(--section-space-lg);
	background: var(--edc-bg);
	color: var(--edc-text);
}

.clinic-tech__copy {
	max-width: 36rem;
	margin-top: var(--space-m);
	color: var(--edc-text-soft);
}

.clinic-tech__list {
	margin: var(--space-s) 0 0;
	padding: 0;
	list-style: none;
	color: var(--edc-text);
}

.clinic-tech__list li {
	padding-block: var(--space-2xs);
	border-top: var(--border-width) solid var(--edc-border);
}

/* One column of landscape crops below 810px; the layered collage from there (responsive.css). */
.clinic-tech__collage {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--grid-gap);
	margin-top: var(--space-l);
}

.clinic-tech__image {
	aspect-ratio: 3 / 2;
}

.clinic-tech .media-frame {
	background: var(--edc-surface-alt);
}

/* Clinic: team + history ------------------------------------------------- */

.clinic-team__grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin-top: var(--space-m);
}

.clinic-history {
	padding-bottom: var(--section-space-lg);
}

.clinic-history__head .eyebrow {
	margin-bottom: var(--space-m);
}

.timeline {
	margin: var(--space-l) 0 0;
	padding: 0;
	list-style: none;
	border-bottom: var(--border-width) solid var(--edc-border);
}

.timeline__item {
	display: grid;
	grid-template-columns: 5rem minmax(0, 1fr);
	gap: var(--space-s);
	padding-block: var(--space-m);
	border-top: var(--border-width) solid var(--edc-border);
}

.timeline__year {
	font-family: var(--font-display);
	font-size: var(--text-heading-sm);
	line-height: var(--leading-tight);
	letter-spacing: var(--tracking-display);
	color: var(--edc-accent);
}

.timeline__text {
	margin-top: var(--space-2xs);
	color: var(--edc-text-soft);
}

/* Contact ---------------------------------------------------------------- */

.contact__title {
	margin-bottom: var(--space-m);
}

.contact__details {
	display: grid;
	gap: var(--space-s) var(--space-m);
	font-size: var(--text-reading);
	line-height: var(--leading-body);
}

.contact__address {
	font-style: normal;
}

.contact__hours {
	margin: 0;
}

.contact__hours div + div {
	margin-top: var(--space-2xs);
}

.contact__hours dt {
	font-size: var(--text-body);
	color: var(--edc-text-soft);
}

.contact__hours dd {
	margin: 0;
}

.contact__subtitle {
	margin: var(--space-l) 0 var(--space-xs);
}

.contact__notes {
	max-width: 36rem;
	color: var(--edc-text-soft);
}

.contact__notes > * + * {
	margin-top: 1em;
}

.contact__links {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: var(--text-reading);
}

.contact__links li + li {
	margin-top: var(--space-2xs);
}

.contact__links a {
	overflow-wrap: anywhere;
}

/* Contact form ----------------------------------------------------------- */

.contact-form {
	display: grid;
	gap: var(--space-s);
	max-width: 37.5rem;
	margin-top: var(--space-m);
}

.form-row {
	display: grid;
	gap: var(--space-s) var(--grid-gap);
}

.form-field {
	display: flex;
	flex-direction: column;
	gap: var(--space-2xs);
}

.form-field label {
	font-size: var(--text-body);
}

.form-field__optional {
	color: var(--edc-muted);
}

.form-field select {
	appearance: none;
	padding-right: 2.5rem;
	background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position: calc(100% - 1.25rem) 50%, calc(100% - 0.9rem) 50%;
	background-size: 0.35rem 0.35rem;
	background-repeat: no-repeat;
	cursor: pointer;
}

.form-field textarea {
	min-height: 10.25rem;
	resize: vertical;
}

.form-field [aria-invalid="true"] {
	border-color: var(--edc-accent);
	box-shadow: inset 0 0 0 1px var(--edc-accent);
}

.form-field__error {
	font-size: var(--text-small);
	color: var(--edc-accent);
}

.form-field--check {
	flex-flow: row wrap;
	align-items: flex-start;
	gap: var(--space-2xs) var(--space-xs);
}

.form-field--check input {
	flex: none;
	width: 1.25rem;
	height: 1.25rem;
	margin-top: 0.15rem;
	accent-color: var(--edc-button-bg);
}

.form-field--check label {
	flex: 1;
	color: var(--edc-text-soft);
}

.form-field--check .form-field__error {
	flex-basis: 100%;
}

/* Honeypot: off-screen for people, still in the form for bots. */
.form-field--trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.contact-form .button {
	justify-self: start;
	border: 0;
}

.form-message {
	max-width: 37.5rem;
	margin-top: var(--space-m);
	padding: var(--space-xs) var(--space-s);
	border: var(--border-width) solid var(--edc-border-strong);
	background: var(--edc-surface);
}

.form-message--error {
	border-color: var(--edc-accent);
}

.form-message ul {
	margin: var(--space-2xs) 0 0;
	padding-left: 1.25em;
}

.form-message:focus-visible {
	outline-offset: 4px;
}

/* Map panel -------------------------------------------------------------- */

.map-panel {
	border: var(--border-width) solid var(--edc-frame);
}

.map-panel__media {
	aspect-ratio: 4 / 3; /* landscape while stacked: a draggable map should not fill the phone */
}

.map-panel__media img {
	filter: grayscale(1) contrast(0.92);
}

.map-panel__pin {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

.map-panel__pin,
.map-panel .map-panel__marker {
	width: 1rem;
	height: 1rem;
	border-radius: var(--radius-round);
	border: 0;
	/* The pin always sits on a light map: the palette accent, even inside a dark or accent section. */
	background: var(--edc-c-accent, var(--edc-accent));
	box-shadow: 0 0 0 0.5rem color-mix(in srgb, var(--edc-c-accent, var(--edc-accent)) 18%, transparent);
}

/* Before "Enable map": a quiet notice over the illustration. */
.map-panel__consent {
	position: absolute;
	inset: auto var(--space-2xs) var(--space-2xs);
	z-index: 1;
	display: grid;
	justify-items: start;
	gap: var(--space-xs);
	padding: var(--space-xs);
	border: var(--border-width) solid var(--edc-border);
	background: color-mix(in srgb, var(--edc-surface) 94%, transparent);
	color: var(--edc-text);
}

.map-panel__consent[hidden] {
	display: none;
}

.map-panel__notice {
	font-size: var(--text-small);
	line-height: var(--leading-body);
	color: var(--edc-text-soft);
}

.map-panel__enable[disabled] {
	cursor: progress;
	opacity: 0.6;
}

/* Live map (Leaflet + OpenStreetMap): fills the same frame, so nothing moves; shown once a tile arrives. */
.map-panel__map {
	position: absolute;
	inset: 0;
	z-index: 2;
	opacity: 0;
	transition: opacity var(--duration-normal) var(--ease-standard);
}

.map-panel__media.is-live .map-panel__map {
	opacity: 1;
}

.map-panel .leaflet-container {
	background: var(--edc-surface-alt);
	font: inherit;
	font-size: var(--text-small);
}

/* Monochrome tiles washed over the palette's own surface: muted in every palette, no map-blue. */
.map-panel .leaflet-tile-pane {
	filter: grayscale(1) contrast(1.05);
	opacity: 0.72;
}

.map-panel .leaflet-bar.leaflet-control {
	border: var(--border-width) solid var(--edc-border-strong);
	border-radius: 0;
	box-shadow: none;
}

.map-panel .leaflet-bar.leaflet-control a,
.map-panel .leaflet-bar.leaflet-control a:hover {
	width: 2rem;
	height: 2rem;
	border-color: var(--edc-border);
	border-radius: 0;
	background: var(--edc-surface);
	color: var(--edc-text);
	font: 400 1.125rem/2rem var(--font-body);
}

.map-panel .leaflet-bar.leaflet-control a[role] {
	border-radius: 0; /* outranks Leaflet's touch corner rules */
}

.map-panel .leaflet-bar.leaflet-control a:hover {
	background: var(--edc-surface-alt);
}

.map-panel .leaflet-bar.leaflet-control a.leaflet-disabled {
	background: var(--edc-surface);
	color: var(--edc-muted);
}

.map-panel .leaflet-container .leaflet-control-attribution {
	padding: 0.125rem 0.375rem;
	background: color-mix(in srgb, var(--edc-surface) 88%, transparent);
	color: var(--edc-text-soft);
	font-size: 0.6875rem;
}

.map-panel .leaflet-control-attribution a {
	color: inherit;
}

.map-panel .leaflet-container :focus-visible,
.map-panel .leaflet-container:focus-visible {
	outline: 2px solid var(--edc-focus);
	outline-offset: -2px;
}

.map-panel__body {
	padding: var(--space-xs);
}

.map-panel__title {
	font-size: var(--text-title);
	letter-spacing: var(--tracking-title);
}

.map-panel__address {
	margin-top: var(--space-2xs);
	color: var(--edc-text-soft);
}

.map-panel__link {
	margin-top: var(--space-s);
}

/* Journal listing -------------------------------------------------------- */

.journal-hero {
	padding-top: calc(16rem - 2.3125rem); /* eyebrow above, H1 stays on the 256px line */
}

.journal-filter ul {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2xs) var(--space-s);
	margin: var(--space-s) 0 0;
	padding: 0;
	list-style: none;
}

.journal-filter a {
	position: relative;
	display: inline-block;
	padding-block: var(--space-2xs);
	font-family: var(--font-display);
	font-size: var(--text-label);
	letter-spacing: var(--tracking-caps);
	text-transform: uppercase;
	text-decoration: none;
	color: var(--edc-muted);
	transition: color var(--duration-normal) var(--ease-standard);
}

.journal-filter a::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	height: 1px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: right;
	transition: transform var(--duration-normal) var(--ease-editorial);
}

.journal-filter a:hover,
.journal-filter a[aria-current] {
	color: var(--edc-text);
}

.journal-filter a:hover::after,
.journal-filter a[aria-current]::after {
	transform: scaleX(1);
	transform-origin: left;
}

.card-grid--journal {
	row-gap: var(--space-l);
}

/* Tablet: three columns, the newest article across all of them. */
@media (min-width: 37.5rem) {
	.card-grid--journal {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.card-grid--journal > :first-child {
		grid-column: 1 / -1;
	}

	/* The lead keeps a landscape crop on tablets instead of a full-width square. */
	.card-grid--journal > :first-child .journal-card__media {
		aspect-ratio: 3 / 2;
	}
}

.journal-card__link {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	color: inherit;
	text-decoration: none;
}

.journal-card__media {
	width: 100%;
	aspect-ratio: 1;
}

.journal-card__media img {
	transition: transform var(--duration-cinematic) var(--ease-editorial);
}

/* Zoom on hover: mouse only, motion allowed. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
	.journal-card__link:hover .journal-card__media img,
	.journal-card__link:focus-visible .journal-card__media img {
		transform: scale(1.04);
	}
}

.journal-card__link:focus-visible {
	outline-offset: 4px;
}

.journal-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3xs) var(--space-xs);
	margin-top: var(--space-xs);
	font-size: var(--text-small);
	color: var(--edc-muted);
}

.journal-card__category {
	font-family: var(--font-display);
	letter-spacing: var(--tracking-caps);
	text-transform: uppercase;
	color: var(--edc-text);
}

.journal-card__title {
	margin-top: var(--space-2xs);
}

.journal-card__excerpt {
	margin-top: var(--space-2xs);
	color: var(--edc-text-soft);
}

.journal-card__more {
	margin-top: var(--space-xs);
}

/* Article ---------------------------------------------------------------- */

.article__header {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-xs);
	padding-top: 8rem;
	text-align: center;
}

.article__meta {
	display: inline-flex;
	gap: var(--space-2xs);
	padding: 0.125rem 0.5rem;
	border-radius: var(--radius-chip);
	background: var(--edc-surface-alt);
	color: var(--edc-text-soft);
}

.article__meta a {
	text-decoration: none;
}

.article__meta a:hover {
	text-decoration: underline;
}

.article__title {
	max-width: 37.5rem;
}

.article__byline {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2xs);
	font-size: var(--text-small);
	color: var(--edc-text-soft);
}

.article__avatar {
	display: grid;
	place-items: center;
	width: 1.5rem;
	height: 1.5rem;
	border-radius: var(--radius-round);
	background: var(--edc-accent);
	color: var(--edc-on-accent);
	font-family: var(--font-display);
	font-size: 0.625rem;
	letter-spacing: 0.04em;
}

.article__author {
	font-size: var(--text-body);
	color: var(--edc-text);
}

.article__media {
	margin-top: var(--space-l);
}

.article__media .media-frame {
	aspect-ratio: 1.92;
}

.article__media figcaption {
	margin-top: var(--space-2xs);
	font-size: var(--text-small);
	color: var(--edc-muted);
}

.article__body {
	max-width: calc(var(--content-max) + 2 * var(--gutter));
	padding-top: var(--space-xl);
	padding-bottom: var(--section-space-lg);
}

.article__lead {
	margin-bottom: 1.25em;
	font-size: var(--text-reading);
	line-height: var(--leading-body);
	color: var(--edc-text);
}

/* Block content in articles and simple pages. */
.article__content,
.page-prose {
	line-height: var(--leading-body);
	color: var(--edc-text-soft);
}

.article__content {
	font-size: var(--text-reading);
}

.page-prose {
	max-width: var(--content-max);
	padding-bottom: var(--section-space-lg);
	font-size: var(--text-lede);
}

:is(.article__content, .page-prose) > * + * {
	margin-top: 1.25em;
}

:is(.article__content, .page-prose) :is(h2, h3, h4) {
	color: var(--edc-text);
}

:is(.article__content, .page-prose) h2 {
	margin-top: 2em;
	font-size: var(--text-heading-sm);
	line-height: var(--leading-tight);
	letter-spacing: var(--tracking-display);
}

:is(.article__content, .page-prose) h3 {
	margin-top: 1.75em;
	font-size: var(--text-title);
	letter-spacing: var(--tracking-title);
}

:is(.article__content, .page-prose) :is(h2, h3) + * {
	margin-top: 0.75em;
}

:is(.article__content, .page-prose) :is(ul, ol) {
	padding-left: 1.25em;
}

:is(.article__content, .page-prose) li + li {
	margin-top: 0.4em;
}

:is(.article__content, .page-prose) a {
	color: var(--edc-text);
}

:is(.article__content, .page-prose) strong {
	color: var(--edc-text);
	font-weight: 600;
}

:is(.article__content, .page-prose) blockquote {
	margin: 2em 0;
	padding-left: var(--space-s);
	border-left: var(--border-width) solid var(--edc-accent);
	font-family: var(--font-display);
	font-size: var(--text-title);
	line-height: 1.35;
	letter-spacing: var(--tracking-heading);
	color: var(--edc-text);
}

:is(.article__content, .page-prose) blockquote cite {
	display: block;
	margin-top: var(--space-2xs);
	font-family: var(--font-body);
	font-size: var(--text-small);
	font-style: normal;
	color: var(--edc-muted);
}

:is(.article__content, .page-prose) figure {
	margin-block: 2em;
}

:is(.article__content, .page-prose) img {
	border-radius: var(--radius-image);
}

:is(.article__content, .page-prose) figcaption {
	margin-top: var(--space-2xs);
	font-size: var(--text-small);
	color: var(--edc-muted);
}

:is(.article__content, .page-prose) hr {
	margin-block: 3em;
	border: 0;
	border-top: var(--border-width) solid var(--edc-border);
}

.article__content .alignwide {
	width: min(calc(100vw - 2 * var(--gutter)), 65rem);
	max-width: none;
	margin-inline: calc(50% - min(calc(100vw - 2 * var(--gutter)), 65rem) / 2);
}

.article__content .alignfull {
	width: 100vw;
	max-width: none;
	margin-inline: calc(50% - 50vw);
}

.wp-block-embed__wrapper iframe {
	width: 100%;
}

/* Tables (legal pages, articles) */
.wp-block-table {
	overflow-x: auto;
}

.wp-block-table table {
	width: 100%;
	min-width: 32rem;
	border-collapse: collapse;
	font-size: var(--text-body);
}

.wp-block-table th,
.wp-block-table td {
	padding: 0.75rem 1rem 0.75rem 0;
	border-bottom: var(--border-width) solid var(--edc-border);
	text-align: left;
	vertical-align: top;
}

.wp-block-table th {
	font-family: var(--font-display);
	font-size: var(--text-small);
	font-weight: 500;
	letter-spacing: var(--tracking-caps);
	text-transform: uppercase;
	color: var(--edc-text);
}

/* Template notice at the top of the demo legal pages. */
.page-prose > p:first-child:has(> strong:first-child) {
	padding: var(--space-xs) var(--space-s);
	border: var(--border-width) solid var(--edc-frame);
	background: var(--edc-surface);
	font-size: var(--text-body);
}

.page-hero__meta {
	font-size: var(--text-small);
	color: var(--edc-muted);
}

/* Next article ----------------------------------------------------------- */

.next-article__link {
	position: relative;
	display: flex;
	align-items: center;
	min-height: 28rem;
	overflow: hidden;
	background: var(--edc-dark);
	color: var(--edc-on-dark);
	text-decoration: none;
	isolation: isolate;
}

.next-article__media {
	position: absolute;
	inset: 0;
	z-index: -1;
}

.next-article__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: color-mix(in srgb, var(--edc-dark) 55%, transparent);
}

.next-article__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--duration-cinematic) var(--ease-editorial);
}

/* Zoom on hover: mouse only, motion allowed. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
	.next-article__link:hover .next-article__media img,
	.next-article__link:focus-visible .next-article__media img {
		transform: scale(1.04);
	}
}

.next-article__content {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-xs);
	padding-block: var(--space-xl);
	text-align: center;
}

.next-article__title {
	max-width: 36rem;
	margin-bottom: var(--space-2xs);
}

.next-article__link:focus-visible {
	outline-offset: -4px;
}
