/*
Theme Name: Team Spotty
Theme URI: https://teamspotty.com
Author: Phil Konick
Description: Lightweight custom block theme for teamspotty.com. Replaces
  OceanWP and Elementor with core blocks and roughly 400 lines of CSS,
  reproducing the original design without a page builder.
Version: 0.1.0
Requires at least: 6.7
Tested up to: 7.0
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: teamspotty
Tags: blog, one-column, block-patterns, full-site-editing
*/

/* ---------------------------------------------------------------- base --- */

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* The original stacked its sections with explicit spacing, so no block
   should contribute a stray margin of its own. */
.wp-site-blocks > * {
	margin-block-start: 0;
	margin-block-end: 0;
}

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

/* -------------------------------------------------------------- header --- */

.ts-header {
	position: sticky;
	top: 0;
	z-index: 100;
	width: 100%;
	background: var(--wp--preset--color--base);
	transition: background-color 0.25s ease, color 0.25s ease;
}

.ts-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	/* 1240 minus the 20px gutters puts the logo on the original's 120px
	   left edge at desktop widths. */
	max-width: 1240px;
	min-height: 74px;
	margin: 0 auto;
	padding: 0 20px;
}

/* These groups are laid out with flex here, but core still treats them as
   flow layout and adds a 20px top margin to each sibling, which pushed the
   header 20px taller than the original. */
.ts-header__inner > *,
.ts-header__right > * {
	margin-block-start: 0;
	margin-block-end: 0;
}

.ts-logo,
.ts-logo a {
	font-size: var(--wp--preset--font-size--xx-large);
	font-weight: 400;
	line-height: 1.5;
	letter-spacing: 1px;
	text-transform: uppercase;
	text-decoration: none;
	color: inherit;
}

.ts-header__right {
	display: flex;
	align-items: center;
	gap: 0;
}

/* Navigation ------------------------------------------------------------- */

.ts-nav .wp-block-navigation__container {
	gap: 0;
}

.ts-nav .wp-block-navigation-item__content {
	display: block;
	padding: 0 15px;
	font-size: 15px;
	font-weight: 300;
	letter-spacing: 1px;
	line-height: 74px;
	text-transform: uppercase;
	text-decoration: none;
	color: inherit;
}

.ts-nav .wp-block-navigation-item__content:hover,
.ts-nav .current-menu-item > .wp-block-navigation-item__content {
	opacity: 0.7;
	text-decoration: none;
}

/* Search toggle, styled to match the original icon-only dropdown ---------- */

.ts-search .wp-block-search__button {
	background: none;
	border: 0;
	/* No padding on the right so the icon aligns to the header's edge, as the
	   original's search toggle did. */
	padding: 0 0 0 15px;
	color: inherit;
	cursor: pointer;
}

.ts-search .wp-block-search__button svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.ts-search .wp-block-search__input {
	border: 1px solid currentColor;
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	padding: 6px 10px;
	font-size: 15px;
}

/* Transparent-over-hero header, used on the front page only.
   It turns solid white with black text once the page is scrolled, which is
   what the original site's sticky header did. */

body.home .ts-header {
	position: fixed;
	background: transparent;
	color: var(--wp--preset--color--base);
}

body.home .ts-header a,
body.home .ts-header .wp-block-search__button {
	color: var(--wp--preset--color--base);
}

body.home .ts-header.is-stuck {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

body.home .ts-header.is-stuck a,
body.home .ts-header.is-stuck .wp-block-search__button {
	color: var(--wp--preset--color--contrast);
}

/* Mobile navigation inherits core's overlay; keep it legible on the hero. */
.ts-nav .wp-block-navigation__responsive-container.is-menu-open {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	padding: 40px 20px;
}

.ts-nav .wp-block-navigation__responsive-container.is-menu-open a {
	color: var(--wp--preset--color--contrast);
	line-height: 2.4;
}

/* ---------------------------------------------------------------- hero --- */

.ts-hero {
	min-height: 100vh;
	background-size: cover;
	background-position: 100% 100%;
	background-repeat: no-repeat;
	background-attachment: fixed;
}

/* A fixed attachment janks badly on touch devices, so scroll it there. */
@media (hover: none), (max-width: 781px) {
	.ts-hero {
		background-attachment: scroll;
		min-height: 60vh;
	}
}

/* --------------------------------------------------------------- intro --- */

.ts-intro {
	padding-top: 40px;
}

/* Spacing between the front page's bands is set explicitly below, so the
   default block gap must not add to it. */
.ts-intro > * {
	margin-block-start: 0;
	margin-block-end: 0;
}

.ts-intro .wp-block-column {
	justify-content: center;
}

.ts-intro .wp-block-image {
	margin: 0;
}

.ts-social {
	display: flex;
	gap: 8px;
	align-items: center;
}

.ts-social a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	color: var(--wp--preset--color--muted);
}

.ts-social a:hover {
	color: var(--wp--preset--color--contrast);
}

.ts-social svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
}

/* ------------------------------------------------------------- divider --- */

/* The rule sits at the content width, inset 10px each side, matching the
   1120px line the original drew inside its 1140px column. */
.ts-divider.wp-block-separator {
	border: 0;
	border-top: 1px solid var(--wp--preset--color--contrast);
	border-bottom: 0;
	width: auto;
	max-width: 1120px;
	opacity: 1;
	margin: 65px auto 0;
}

/* --------------------------------------------------- latest adventures --- */

.ts-latest {
	padding-top: 75px;
}

.ts-latest__heading {
	text-align: center;
	font-size: var(--wp--preset--font-size--large);
	line-height: 1;
	margin: 0 10px 20px;
}

.ts-latest .wp-block-post-template {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
	margin: 0 10px;
	padding: 0;
	list-style: none;
}

/* Grid cells must not inherit the flow-layout gap, or every card after the
   first is nudged down inside its cell. */
.ts-latest .wp-block-post,
.ts-related .wp-block-post {
	margin-block-start: 0;
	margin-block-end: 0;
}

.ts-latest .wp-block-post {
	position: relative;
	overflow: hidden;
	aspect-ratio: 367 / 242;
}

.ts-latest .wp-block-post-featured-image,
.ts-latest .wp-block-post-featured-image a,
.ts-latest .wp-block-post-featured-image img {
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: cover;
	display: block;
}

/* The dark wash and centred white title sat over the image in the original
   portfolio widget. */
.ts-latest .wp-block-post::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	pointer-events: none;
}

.ts-latest .wp-block-post-title {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0 20px;
	text-align: center;
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--wp--preset--color--base);
}

.ts-latest .wp-block-post-title a {
	color: inherit;
	text-decoration: none;
}

.ts-latest .wp-block-post-title a:hover {
	text-decoration: underline;
}

.ts-latest__more {
	margin-top: 20px;
	text-align: center;
}

/* ----------------------------------------------------------- blog grid --- */

/* Masonry without JavaScript. CSS columns fill top-to-bottom rather than the
   left-to-right of the original isotope grid, so cards land in a slightly
   different order; the card design itself is unchanged. */
.ts-blog .wp-block-post-template {
	columns: 3;
	column-gap: 40px;
	/* 3 cards of 364px plus two 40px gutters reproduces the original grid. */
	max-width: 1172px;
	margin: 0 auto;
	padding: 0;
	list-style: none;
	display: block;
}

.ts-blog .wp-block-post {
	break-inside: avoid;
	page-break-inside: avoid;
	display: inline-block;
	width: 100%;
	margin: 0 0 40px;
	border: 1px solid var(--wp--preset--color--border);
	background: var(--wp--preset--color--base);
}

.ts-blog .wp-block-post-featured-image {
	margin: 0;
}

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

.ts-card__body {
	padding: 20px;
}

.ts-caption {
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
	text-align: center;
	color: var(--wp--preset--color--contrast);
	margin: 12px 0 0;
	padding: 0 20px;
}

.ts-blog .wp-block-post-title {
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
	letter-spacing: 1px;
	text-transform: uppercase;
	margin: 0 0 10px;
}

.ts-blog .wp-block-post-title a {
	text-decoration: none;
	color: inherit;
}

.ts-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
	margin: 0 0 16px;
}

.ts-meta__item {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.ts-meta svg {
	width: 14px;
	height: 14px;
	fill: currentColor;
	flex: none;
}

.ts-meta .wp-block-post-terms {
	font-size: inherit;
	color: inherit;
}

.ts-meta a {
	color: inherit;
	text-decoration: none;
}

.ts-meta__sep {
	opacity: 0.6;
}

.ts-blog .wp-block-post-excerpt__excerpt {
	margin: 0 0 16px;
}

.ts-blog .wp-block-post-excerpt__more-text a,
.ts-more a {
	font-size: var(--wp--preset--font-size--small);
	text-transform: none;
	border-bottom: 1px solid currentColor;
	text-decoration: none;
	padding-bottom: 2px;
}

/* ------------------------------------------------------- single & page --- */

.ts-single__figure {
	margin: 0 auto 30px;
	max-width: 1060px;
}

.ts-single__figure img {
	width: 100%;
	height: auto;
	display: block;
}

.ts-single__title {
	text-align: center;
	font-size: var(--wp--preset--font-size--x-large);
	margin: 0 0 18px;
}

.ts-meta.ts-single__meta {
	justify-content: center;
	border-top: 1px solid var(--wp--preset--color--border);
	border-bottom: 1px solid var(--wp--preset--color--border);
	padding: 10px 0;
	margin: 0 auto 40px;
	max-width: 840px;
}

.ts-prose {
	max-width: 660px;
	margin: 0 auto;
}

.ts-prose p {
	margin: 0 0 26px;
}

.ts-prose img {
	height: auto;
}

.ts-related__heading {
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 1px;
	margin: 60px 0 30px;
	padding-top: 30px;
	border-top: 1px solid var(--wp--preset--color--border);
}

.ts-related .wp-block-post-template {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 30px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ts-related .wp-block-post-title {
	font-size: var(--wp--preset--font-size--small);
	text-align: center;
	margin: 12px 0 6px;
}

.ts-related .wp-block-post-date {
	font-size: var(--wp--preset--font-size--x-small);
	color: var(--wp--preset--color--muted);
	text-align: center;
}

.ts-related .wp-block-post-featured-image img {
	width: 100%;
	aspect-ratio: 3 / 2;
	object-fit: cover;
	display: block;
}

/* -------------------------------------------------------------- footer --- */

.ts-footer {
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	text-align: center;
	font-size: var(--wp--preset--font-size--x-small);
	line-height: 1.2;
	padding: 18px 20px;
	margin-top: 50px;
}

.ts-footer p {
	margin: 0;
}

.ts-footer a {
	color: var(--wp--preset--color--base);
	text-decoration: none;
}

.ts-footer a:hover {
	text-decoration: underline;
}

/* ------------------------------------------------------------- comments -- */

.ts-comments {
	max-width: 660px;
	margin: 60px auto 0;
}

.ts-comments .wp-block-post-comments-form .comment-reply-title {
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
	letter-spacing: 1px;
	text-transform: uppercase;
}

.ts-comments input[type="text"],
.ts-comments input[type="email"],
.ts-comments input[type="url"],
.ts-comments textarea {
	border: 1px solid var(--wp--preset--color--border);
	padding: 10px;
	font-family: inherit;
	font-size: 15px;
	width: 100%;
}

/* ------------------------------------------------------ subscribe modal -- */

.ts-modal {
	border: 0;
	padding: 0;
	max-width: 480px;
	width: calc(100% - 40px);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

.ts-modal::backdrop {
	background: rgba(0, 0, 0, 0.6);
}

.ts-modal__inner {
	padding: 40px 30px;
	text-align: center;
}

.ts-modal__inner h2 {
	margin: 0 0 12px;
}

.ts-modal__close {
	position: absolute;
	top: 8px;
	right: 12px;
	background: none;
	border: 0;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	color: inherit;
}

/* --------------------------------------------------------- pagination --- */

.wp-block-query-pagination {
	justify-content: center;
	gap: 14px;
	margin-top: 20px;
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 1px;
}

/* ------------------------------------------------------------ responsive - */

@media (max-width: 1024px) {
	.ts-blog .wp-block-post-template {
		columns: 2;
		column-gap: 30px;
	}

	.ts-latest .wp-block-post-template,
	.ts-related .wp-block-post-template {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 781px) {
	.ts-header__inner {
		min-height: 64px;
	}

	.ts-logo,
	.ts-logo a {
		font-size: 26px;
	}

	.ts-blog .wp-block-post-template {
		columns: 1;
	}

	.ts-latest .wp-block-post-template,
	.ts-related .wp-block-post-template {
		grid-template-columns: 1fr;
	}

	.ts-intro {
		padding-top: 30px;
	}

	.ts-divider {
		margin: 35px 10px 30px;
	}

	.ts-single__title {
		font-size: 24px;
	}
}
