/**
 * Goldleaf Tavern - Base styles & shared components
 *
 * Loaded after the _s style.css, so it overrides the starter defaults.
 * Values come exclusively from assets/css/variables.css.
 *
 * @package Goldleaf_Tavern
 */

/* -----------------------------------------------------------------------
 * Elements
 * -------------------------------------------------------------------- */

body,
button,
input,
select,
optgroup,
textarea {
	color: var(--gt-color-body-text);
	font-family: var(--gt-font-body);
	font-size: var(--gt-size-body);
	font-weight: var(--gt-weight-body);
	line-height: var(--gt-leading-body);
}

body {
	background-color: var(--gt-color-body-bg);
	margin: 0;
}

/*
 * _s sets `.post, .page { margin: 0 0 1.5em; }` for the article element, but
 * body_class() puts those same classes on <body>, where the bottom margin
 * showed up as whitespace under the footer. Needs to out-specify `.page`.
 */
body.page,
body.post {
	margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	color: var(--gt-color-heading);
	font-family: var(--gt-font-display);
	font-weight: var(--gt-weight-display);
	line-height: var(--gt-leading-heading);
}

/*
 * _s ships `a:visited { color: #800080 }`. Its (0,1,1) specificity beats any
 * single-class rule, so every selector in this theme that colours a link has
 * to cover :visited too - otherwise visited links revert to starter purple.
 */
a,
a:visited {
	color: var(--gt-color-link);
	text-decoration: none;
	transition: color var(--gt-transition);
}

a:hover,
a:focus,
a:active {
	color: var(--gt-color-link-hover);
	text-decoration: underline;
}

::selection {
	background: var(--gt-color-burgundy);
	color: var(--gt-color-parchment-light);
}

:focus-visible {
	outline: 2px solid var(--gt-color-gold);
	outline-offset: 2px;
}

img {
	height: auto;
	max-width: 100%;
}

/* -----------------------------------------------------------------------
 * Layout helpers
 * -------------------------------------------------------------------- */

.gt-section {
	background-color: var(--gt-section-bg-parchment);
	padding: var(--gt-section-padding-y) var(--gt-section-padding-x);
}

.gt-section--parchment {
	background-color: var(--gt-section-bg-parchment);
}

.gt-section--sand {
	background-color: var(--gt-section-bg-sand);
	border-bottom: var(--gt-border-width) solid var(--gt-color-rule-soft);
	border-top: var(--gt-border-width) solid var(--gt-color-rule-soft);
}

.gt-section--night {
	background-color: var(--gt-section-bg-night);
	color: var(--gt-color-on-dark-soft);
}

.gt-section--night h2,
.gt-section--night h3 {
	color: var(--gt-color-on-dark);
}

.gt-section--night .gt-section-heading__rule {
	background: var(--gt-color-on-dark-rule);
}

.gt-container {
	margin: 0 auto;
	max-width: var(--gt-content-width);
}

/* -----------------------------------------------------------------------
 * Components
 * -------------------------------------------------------------------- */

/* Small uppercase mono label, e.g. "Ouverture prochaine". */
.gt-eyebrow {
	color: var(--gt-color-gold);
	font-family: var(--gt-font-mono);
	font-size: var(--gt-size-eyebrow);
	letter-spacing: var(--gt-tracking-eyebrow);
	line-height: 1.4;
	margin: 0;
	text-transform: uppercase;
}

/* Section title followed by a rule filling the remaining space. */
.gt-section-heading {
	align-items: center;
	display: flex;
	gap: var(--gt-space-sm);
	margin-bottom: var(--gt-space-2xl);
}

.gt-section-heading__title {
	font-size: var(--gt-size-h2);
	margin: 0;
}

.gt-section-heading__rule {
	background: var(--gt-color-rule);
	flex: 1;
	height: var(--gt-border-width);
}

/* Buttons - also used to skin the Contact Form 7 submit button. */
.gt-button,
.gt-button:visited,
input.gt-button,
button.gt-button,
.gt-form input[type="submit"] {
	background: var(--gt-button-bg);
	border: var(--gt-border-width) solid var(--gt-button-border-color);
	border-radius: var(--gt-radius);
	color: var(--gt-button-color);
	cursor: pointer;
	display: inline-block;
	font-family: var(--gt-button-font);
	font-size: var(--gt-size-button);
	font-weight: var(--gt-button-weight);
	letter-spacing: var(--gt-tracking-button);
	line-height: 1.2;
	padding: var(--gt-button-padding);
	text-align: center;
	text-transform: uppercase;
	transition: background-color var(--gt-transition), border-color var(--gt-transition), color var(--gt-transition);
}

.gt-button:hover,
.gt-button:focus,
.gt-form input[type="submit"]:hover,
.gt-form input[type="submit"]:focus {
	background: var(--gt-button-bg-hover);
	color: var(--gt-button-color);
	text-decoration: none;
}

/* Solid variant used on light backgrounds (z-pattern CTA). */
.gt-button--solid {
	border-color: var(--gt-button-bg);
	padding: var(--gt-button-padding-sm);
}

.gt-button--solid:hover,
.gt-button--solid:focus {
	background: var(--gt-color-ink);
	border-color: var(--gt-color-ink);
}

/* Image placeholder - hatched box shown when no image is selected. */
.gt-placeholder {
	background-color: var(--gt-placeholder-bg);
	background-image: var(--gt-placeholder-hatch);
	border: var(--gt-placeholder-border);
	display: grid;
	place-items: center;
}

.gt-placeholder__label {
	color: var(--gt-placeholder-color);
	font-family: var(--gt-font-mono);
	font-size: var(--gt-size-meta);
	letter-spacing: var(--gt-tracking-label);
	padding: var(--gt-space-xs);
	text-align: center;
	text-transform: uppercase;
}

/* Media frame shared by the z-pattern and cards blocks. */
.gt-media {
	border: var(--gt-placeholder-border);
	display: block;
	overflow: hidden;
	width: 100%;
}

.gt-media img {
	display: block;
	height: 100%;
	object-fit: cover;
	width: 100%;
}

.gt-media--landscape,
.gt-placeholder--landscape {
	aspect-ratio: var(--gt-ratio-landscape);
}

.gt-media--square,
.gt-placeholder--square {
	aspect-ratio: var(--gt-ratio-square);
}

.gt-media--portrait,
.gt-placeholder--portrait {
	aspect-ratio: var(--gt-ratio-portrait);
}

/* -----------------------------------------------------------------------
 * Contact Form 7 skin
 *
 * Expected form template, pasted in the CF7 Form tab:
 *
 *   div class="gt-form__row" wrapping an email field with class gt-input
 *   and a submit button with class gt-button.
 * -------------------------------------------------------------------- */

.gt-form .wpcf7-form,
.gt-form form {
	margin: 0;
}

.gt-form__row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--gt-space-xs);
	justify-content: center;
	position: relative;
}

.gt-form .wpcf7-form-control-wrap {
	display: block;
	flex: 1 1 260px;
	min-width: 0;
}

.gt-form input[type="email"],
.gt-form input[type="text"],
.gt-form input[type="tel"],
.gt-form .gt-input {
	background: var(--gt-input-bg);
	border: var(--gt-border-width) solid var(--gt-input-border-color);
	border-radius: var(--gt-radius);
	color: var(--gt-input-color);
	font-family: var(--gt-font-body);
	font-size: var(--gt-input-size);

	/* Without this the input inherits the 1.65 body leading and runs tall. */
	line-height: var(--gt-input-line-height);
	padding: var(--gt-input-padding);
	transition: border-color var(--gt-transition);
	width: 100%;
}

.gt-form input:focus {
	border-color: var(--gt-input-border-focus-color);
	outline: none;
}

.gt-form .wpcf7-submit,
.gt-form input[type="submit"] {
	flex: 0 0 auto;
	width: auto;
}

/*
 * CF7 renders the spinner as a permanent flex item: hidden, but still 24px
 * wide with 24px margins, which shoved the visible input and button off
 * centre. Take it out of flow and park it under the row.
 */
.gt-form .wpcf7-spinner {
	left: 50%;
	margin: 0;
	position: absolute;
	top: calc(100% + var(--gt-space-2xs));
	transform: translateX(-50%);
}

/* CF7 messages, restyled in tavern colours. */
.gt-form .wpcf7-response-output {
	border: var(--gt-border-width) solid var(--gt-color-gold);
	border-radius: var(--gt-radius);
	color: var(--gt-color-on-dark);
	font-family: var(--gt-font-body);
	font-size: var(--gt-size-small);
	letter-spacing: 0.06em;
	margin: var(--gt-space-sm) 0 0;
	padding: var(--gt-space-xs) var(--gt-space-sm);
	text-align: center;
}

.gt-form form.sent .wpcf7-response-output {
	border-color: var(--gt-color-gold);
	color: var(--gt-color-gold);
}

.gt-form .wpcf7-not-valid-tip {
	color: var(--gt-color-gold);
	font-family: var(--gt-font-mono);
	font-size: var(--gt-size-meta);
	letter-spacing: var(--gt-tracking-meta);
	margin-top: var(--gt-space-3xs);
	text-align: left;
}

/* -----------------------------------------------------------------------
 * Page scaffolding
 * -------------------------------------------------------------------- */

.site-main--full {
	margin: 0;
	max-width: none;
	padding: 0;
	width: 100%;
}

.site-main--full .entry-content {
	margin: 0;
	max-width: none;
}

/* _s gives articles a bottom margin, which leaks a gap above the footer. */
.site-main--full > article {
	margin: 0;
}

/* Pages without a hero need room under the fixed header. */
body:not(.gt-has-hero) .site-main {
	padding-top: var(--gt-header-height);
}

@media (prefers-reduced-motion: reduce) {

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}
