/*
Theme Name: Most – The Bridge
Theme URI: https://most-thebridge.hr
Description: Custom block theme for Most / The Bridge, the Croatian journal of international literary relations.
Author: Most / The Bridge
Version: 1.1.0
Requires at least: 6.9
Requires PHP: 8.1
Text Domain: most
*/

/* ---------- Top bar ---------- */

/* Let the top bar stick to the viewport while the masthead scrolls away. */
.wp-site-blocks > header.wp-block-template-part {
	display: contents;
}

.most-topbar {
	position: sticky;
	top: 0;
	z-index: 50;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 2rem;
	min-height: 70px;
	padding: 0.5rem 30px;
	border-bottom: 1px solid var(--wp--preset--color--border);
	box-sizing: border-box;
}

/* The blur sits on a pseudo-element: backdrop-filter on the bar itself would become the
   containing block of the navigation's fixed overlay and clip it to the bar. */
.most-topbar::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: color-mix(in srgb, var(--wp--preset--color--base) 94%, transparent);
	backdrop-filter: saturate(1.4) blur(10px);
}

body.admin-bar .most-topbar {
	top: var(--wp-admin--admin-bar--height, 0px);
}

.most-topbar > * {
	margin: 0 !important;
}

.most-topbar__side {
	gap: 1.75rem;
	min-width: 0;
}

.most-topbar__side--right {
	justify-content: flex-end;
}

.most-topbar .wp-block-navigation .wp-block-navigation__container {
	gap: 1.9rem;
}

.most-topbar .wp-block-navigation a {
	text-decoration: none;
	white-space: nowrap;
}

.most-topbar .wp-block-navigation a:hover,
.most-topbar .wp-block-navigation .current-menu-item > a {
	color: var(--wp--preset--color--accent);
}

/* The small logo appears once the masthead logo has scrolled out of view. */
.most-brand {
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.most-brand .wp-block-site-logo img {
	width: 72px;
	height: auto;
}

.has-masthead:not(.masthead-out) .most-brand {
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
}

.most-nav-mobile,
.most-search-mobile {
	display: none !important;
}

/* Collapsed search: only the icon takes space. */
.most-topbar .wp-block-search__searchfield-hidden,
.most-topbar .wp-block-search__searchfield-hidden .wp-block-search__inside-wrapper {
	width: auto !important;
}

@media (max-width: 1199px) {
	.most-topbar {
		gap: 1rem;
		padding-left: 20px;
		padding-right: 20px;
	}

	.most-nav-desktop,
	.most-search-desktop {
		display: none !important;
	}

	.most-nav-mobile,
	.most-search-mobile {
		display: flex !important;
	}
}

.most-nav-mobile .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	align-items: center;
	padding-top: var(--wp--preset--spacing--60);
}

.most-nav-mobile .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	align-items: center;
	gap: 1.5rem;
	font-size: 1rem;
}

/* ---------- Masthead ---------- */

.most-masthead {
	padding-left: var(--wp--style--root--padding-left);
	padding-right: var(--wp--style--root--padding-right);
}

.most-masthead .wp-block-site-logo img {
	width: 306px;
	max-width: 70vw;
	height: auto;
}

.most-masthead .wp-block-site-title a {
	text-decoration: none;
}

/* ---------- Labels and meta ---------- */

.wp-block-post-terms.is-style-label,
.wp-block-post-terms.is-style-pill {
	font-family: var(--wp--preset--font-family--rubik);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	line-height: 1.5;
	text-transform: uppercase;
	color: var(--wp--preset--color--text);
	margin: 0 0 12px;
}

.wp-block-post-terms.is-style-label a {
	color: inherit;
	text-decoration: none;
}

.wp-block-post-terms.is-style-label.is-accent,
.wp-block-post-terms.is-style-label a:hover {
	color: var(--wp--preset--color--accent);
}

.wp-block-post-terms.is-style-pill .wp-block-post-terms__separator {
	display: none;
}

.wp-block-post-terms.is-style-pill a {
	display: inline-block;
	margin: 0 2px;
	padding: 3px 11px 3px 12px;
	border-radius: 10px;
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--white);
	text-decoration: none;
	transition: background-color 0.2s ease;
}

.wp-block-post-terms.is-style-pill a:hover {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--white);
}

.most-meta {
	gap: 14px;
	align-items: center;
	font-family: var(--wp--preset--font-family--rubik);
	font-size: 0.75rem;
	line-height: 1.5;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

.most-meta > *,
.most-meta p {
	margin: 0 !important;
}

.most-meta .wp-block-post-author,
.most-meta .wp-block-post-author__content {
	display: flex;
	align-items: baseline;
	flex: 0 0 auto;
	white-space: nowrap;
}

.most-meta .wp-block-post-author__byline {
	display: inline;
	margin: 0 0.35em 0 0 !important;
	font-size: inherit;
}

.most-meta .wp-block-post-author__name {
	margin: 0;
	font-weight: 600;
	color: var(--wp--preset--color--contrast);
}

.most-meta .wp-block-post-time-to-read::before,
.most-meta .most-views::before {
	content: "";
	display: inline-block;
	width: 0.95em;
	height: 0.95em;
	margin-right: 0.35em;
	vertical-align: -0.12em;
	background: currentColor;
	-webkit-mask: var(--most-icon) center / contain no-repeat;
	mask: var(--most-icon) center / contain no-repeat;
}

.most-meta .wp-block-post-time-to-read {
	--most-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 6.5V12l3.5 2.5'/%3E%3C/svg%3E");
}

.most-meta .most-views {
	--most-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2'%3E%3Cpath d='M1.5 12S5.5 4.5 12 4.5 22.5 12 22.5 12 18.5 19.5 12 19.5 1.5 12 1.5 12z'/%3E%3Ccircle cx='12' cy='12' r='3.2'/%3E%3C/svg%3E");
}

/* ---------- Section titles ---------- */

.is-style-lines {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 2rem;
}

.is-style-lines::before,
.is-style-lines::after {
	content: "";
	flex: 0 1 9.5rem;
	height: 1px;
	background: var(--wp--preset--color--border);
}

/* ---------- Cards ---------- */

.most-card .wp-block-post-featured-image {
	margin: 0 0 20px;
	overflow: hidden;
}

.most-card .wp-block-post-featured-image img {
	width: 100%;
	height: auto;
	transition: transform 0.6s ease;
}

.most-card:hover .wp-block-post-featured-image img {
	transform: scale(1.04);
}

.most-card__title {
	margin: 0 0 10px;
	font-size: 1.625rem;
	font-weight: 500;
	line-height: 1.3;
}

.most-card__title a {
	text-decoration: none;
}

.most-card--compact .most-card__title,
.most-card--popular .most-card__title,
.most-card--related .most-card__title {
	font-size: 1.3125rem;
	line-height: 1.29;
}

.most-card--related .most-meta {
	margin-bottom: 8px;
}

/* Masonry (see assets/js/most.js): 1px rows, each card spans its own height. */
.most-masonry .wp-block-post-template.is-masonry-ready {
	grid-auto-rows: 1px;
	row-gap: 0 !important;
	column-gap: 30px !important;
	align-items: start;
}

/* ---------- Cover cards ---------- */

.most-cover {
	width: 100%;
	min-height: 0 !important;
	aspect-ratio: 3 / 4;
	overflow: hidden;
}

.most-cover .wp-block-cover__background {
	background: linear-gradient(rgb(0 0 0 / 0), rgb(0 0 0 / 0.95)) !important;
	opacity: 1 !important;
}

.most-cover .wp-block-cover__image-background {
	transition: transform 0.8s ease;
}

.most-cover:hover .wp-block-cover__image-background {
	transform: scale(1.04);
}

.most-cover__title {
	margin: 0 0 16px;
	font-size: 2.1875rem;
	font-weight: 500;
	line-height: 1.3;
}

.most-cover__title a {
	color: var(--wp--preset--color--white);
	text-decoration: none;
}

.most-cover__title a:hover {
	color: var(--wp--preset--color--accent);
}

.most-cover .most-meta .wp-block-post-author__name {
	color: var(--wp--preset--color--white);
}

/* The whole cover card is clickable: the inner container fills the card (and carries the
   padding), the title link stretches over it, and the language pill stays above the link
   so it keeps pointing to its category. */
.most-cover.wp-block-cover {
	padding: 0 !important;
}

.most-cover .wp-block-cover__inner-container {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-self: stretch;
	width: 100% !important;
	height: 100%;
	padding: 2rem 2.5rem 2.5rem;
	box-sizing: border-box;
}

.most-cover__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
}

.most-cover .wp-block-post-terms {
	position: relative;
	z-index: 3;
}

.most-cover:hover .most-cover__title a {
	color: var(--wp--preset--color--accent);
}

.most-hero-feature .most-cover {
	aspect-ratio: 683 / 910;
}

.most-hero-feature .most-cover__title {
	font-size: 3.125rem;
}

.most-cover-row .wp-block-post-template {
	gap: 0 !important;
}

/* ---------- About band ---------- */

.most-about-band p {
	font-size: 1.0625rem;
	line-height: 1.9;
}

/* ---------- Print Journal ---------- */

.most-issue .wp-block-post-featured-image {
	margin: 0 0 20px;
	overflow: hidden;
}

.most-issue .wp-block-post-featured-image img {
	transition: transform 0.5s ease;
}

.most-issue:hover .wp-block-post-featured-image img {
	transform: scale(1.04);
}

.most-issue__title {
	margin: 0;
	font-size: 1.125rem;
	font-weight: 500;
	line-height: 1.25;
}

.most-issues .most-issue__title {
	font-size: 1rem;
}

.most-issue__title a {
	text-decoration: none;
}

.most-issue-toc h3 {
	margin-top: var(--wp--preset--spacing--50);
	padding-top: var(--wp--preset--spacing--30);
	border-top: 1px solid var(--wp--preset--color--border);
}

.most-issue-toc h3:first-child,
.most-issue-toc .wp-block-buttons + h3 {
	padding-top: 0;
	border-top: 0;
}

.most-issue-toc h3:first-child {
	margin-top: 0;
}

.most-issue-toc .wp-block-buttons + h3 {
	margin-top: var(--wp--preset--spacing--40);
}

/* ---------- Single post ---------- */

.most-post-header .wp-block-post-title {
	margin: 0;
	font-size: 3.125rem;
	font-weight: 700;
	line-height: 1.3;
}

.most-post-header .most-meta {
	gap: 18px;
}

.wp-block-post-featured-image.alignwide img {
	width: 100%;
	height: auto;
}

.most-article > * + * {
	margin-top: 2.5rem;
}

.most-tags {
	font-family: var(--wp--preset--font-family--rubik);
	font-size: 0.9375rem;
	color: var(--wp--preset--color--muted);
}

.most-tags a {
	color: var(--wp--preset--color--text);
}

.most-share {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	padding-top: 1.5rem;
	border-top: 1px solid var(--wp--preset--color--border);
}

.most-share__label {
	margin-right: 6px;
	font-family: var(--wp--preset--font-family--merriweather);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--wp--preset--color--contrast);
}

.most-share__link {
	display: inline-flex;
	align-items: center;
	padding: 6px 14px;
	font: 600 0.75rem/1.5 var(--wp--preset--font-family--rubik);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--contrast);
	background: transparent;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 20px;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.most-share__link:hover {
	color: #fff;
	background: var(--wp--preset--color--accent);
	border-color: var(--wp--preset--color--accent);
}

.most-share__link--copy.is-copied::after {
	content: " ✓";
}

.most-sidebar .most-widget {
	position: sticky;
	top: 100px;
}

.most-widget__title {
	margin: 0;
	padding-bottom: 14px;
	font-size: 1.3125rem;
	font-weight: 700;
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.most-widget-list > li {
	padding: 18px 0;
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.most-widget-list .wp-block-post-terms {
	margin-bottom: 4px;
}

.most-widget-list__title {
	margin: 0;
	font-size: 1rem;
	font-weight: 500;
	line-height: 1.4;
}

.most-widget-list__title a {
	text-decoration: none;
}

/* ---------- Footer ---------- */

.most-footer h3,
.most-footer h4 {
	margin-bottom: 0;
}

.most-footer a {
	text-decoration: none;
}

.most-footer .most-partners a:hover img {
	opacity: 0.8;
}

.most-to-top {
	position: fixed;
	right: 34px;
	bottom: 85px;
	z-index: 40;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 51px;
	height: 51px;
	margin: 0 !important;
	border-radius: 50%;
	color: #fff;
	background: var(--wp--preset--color--accent);
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px);
	transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s, background-color 0.2s ease;
}

.most-to-top.is-visible {
	opacity: 1;
	visibility: visible;
	transform: none;
}

.most-to-top:hover {
	color: #fff;
	background: var(--wp--preset--color--contrast);
}

/* ---------- Forms (Contact Form 7, search) ---------- */

.wpcf7 label {
	display: block;
	font-family: var(--wp--preset--font-family--rubik);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--contrast);
}

.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 input[type="tel"],
.wpcf7 input[type="url"],
.wpcf7 textarea,
.wp-block-search__input {
	width: 100%;
	margin-top: 0.4rem;
	padding: 0.75rem 1rem;
	font: inherit;
	font-family: var(--wp--preset--font-family--rubik);
	color: var(--wp--preset--color--contrast);
	background: #fff;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 2px;
	box-sizing: border-box;
}

.wpcf7 textarea {
	min-height: 10rem;
}

.wpcf7 input:focus,
.wpcf7 textarea:focus,
.wp-block-search__input:focus {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 1px;
	border-color: var(--wp--preset--color--accent);
}

.wpcf7 input[type="submit"] {
	padding: 14px 44px;
	font-family: var(--wp--preset--font-family--merriweather);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #fff;
	background: var(--wp--preset--color--accent);
	border: 0;
	border-radius: 30px;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.wpcf7 input[type="submit"]:hover {
	background: var(--wp--preset--color--contrast);
}

.wpcf7-not-valid-tip,
.wpcf7-response-output {
	font-family: var(--wp--preset--font-family--rubik);
	font-size: var(--wp--preset--font-size--small);
}

.wp-block-search__button {
	color: var(--wp--preset--color--contrast);
	background: transparent;
	border: 0;
}

.wp-block-search__button-inside .wp-block-search__inside-wrapper {
	background: #fff;
	border-color: var(--wp--preset--color--border);
}

.wp-block-search__button-inside .wp-block-search__input {
	margin: 0;
	border: 0;
}

/* ---------- Misc ---------- */

:where(.wp-block-post-content) a {
	color: var(--wp--preset--color--accent-strong);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

.wp-block-post-content .has-drop-cap:not(:focus)::first-letter {
	font-family: var(--wp--preset--font-family--merriweather);
	font-size: 4.2em;
	line-height: 0.85;
	margin: 0.08em 0.12em 0 0;
	color: var(--wp--preset--color--contrast);
}

/* Issues appear in search results; a reading time makes no sense for them. */
.type-broj .most-meta {
	display: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 1023px) {
	.most-masonry .wp-block-post-template.is-layout-grid,
	.most-issues .wp-block-post-template.is-layout-grid,
	.wp-block-query:not(.most-cover-row) > .wp-block-post-template.is-layout-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}

	.most-hero-feature .most-cover__title,
	.most-post-header .wp-block-post-title {
		font-size: 2.4rem;
	}

	.most-cover__title {
		font-size: 1.75rem;
	}
}

@media (max-width: 781px) {
	.most-cover-row .wp-block-post-template.is-layout-grid {
		grid-template-columns: 1fr !important;
	}

	.most-cover-row .most-cover,
	.most-hero-feature .most-cover {
		aspect-ratio: 4 / 5;
	}

	.most-sidebar .most-widget {
		position: static;
	}
}

@media (max-width: 599px) {
	.most-masonry .wp-block-post-template.is-layout-grid,
	.most-issues .wp-block-post-template.is-layout-grid,
	.wp-block-query:not(.most-cover-row) > .wp-block-post-template.is-layout-grid {
		grid-template-columns: 1fr !important;
	}

	.most-hero-feature .most-cover__title,
	.most-post-header .wp-block-post-title {
		font-size: 2rem;
	}

	.most-to-top {
		right: 16px;
		bottom: 24px;
	}

	.is-style-lines::before,
	.is-style-lines::after {
		flex-basis: 2rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition: none !important;
	}
}
