/*
Theme Name:        Antonio Tahhan
Theme URI:         https://antoniotahhan.com/
Author:            Antonio Tahhan
Author URI:        https://antoniotahhan.com/
Description:       The block theme for antoniotahhan.com, a food writing site.
Requires at least: 6.6
Tested up to:      7.1
Requires PHP:      7.4
Version:           0.1.0
License:           GNU General Public License v2 or later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:       antoniotahhan
*/

/*
 * Arabic text uses Baloo Bhaijaan 2. Mark it in the HTML with lang="ar" dir="rtl".
 */
:lang(ar) {
	font-family: var(--wp--preset--font-family--arabic);
}

/*
 * Text for screen readers only, such as the search box label. This is the standard
 * WordPress rule; block themes must include it themselves.
 */
.screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

.screen-reader-text:focus {
	background-color: var(--wp--preset--color--base);
	clip-path: none;
	color: var(--wp--preset--color--contrast);
	display: block;
	font-size: 1rem;
	height: auto;
	left: 5px;
	padding: 1rem 1.5rem;
	text-decoration: none;
	top: 5px;
	width: auto;
	z-index: 100000;
}

/*
 * Header: logo and site title on the left, main menu on the right.
 */
.site-header {
	border-bottom: 1px solid var(--wp--preset--color--border);
	padding-top: 1.1rem;
	padding-bottom: 1.1rem;
}

.site-header > .alignwide,
.site-footer > .alignwide {
	gap: 0.75rem 2rem;
}

.site-brand {
	gap: 0.75rem;
}

.site-header .wp-block-site-title {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.1;
}

.site-header .wp-block-site-title a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

/*
 * Menus: bold, no underline, except the page you are on.
 */
.site-nav,
.social-nav {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	gap: 0.4rem 1.25rem;
}

.site-nav a,
.social-nav a {
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus,
.social-nav a:hover,
.social-nav a:focus,
.site-nav .current-menu-item > a,
.site-nav .current-menu-ancestor > a {
	color: var(--wp--preset--color--accent-1);
	text-decoration: underline;
	text-underline-offset: 5px;
}

/*
 * Footer: copyright on the left, social links on the right.
 */
.site-footer {
	border-top: 1px solid var(--wp--preset--color--border);
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
	margin-top: 3rem;
	padding-top: 1.4rem;
	padding-bottom: 1.4rem;
}

.site-footer p {
	margin: 0;
}

/*
 * Search: a magnifying glass at the end of the menu that opens a search box.
 */
.site-menu {
	gap: 0.4rem 1.25rem;
}

.site-search .wp-block-search__button {
	background: transparent;
	color: var(--wp--preset--color--contrast);
	margin-left: 0;
	padding: 0.35rem;
}

.site-search .wp-block-search__button:hover,
.site-search .wp-block-search__button:focus {
	color: var(--wp--preset--color--accent-1);
}

.site-search .wp-block-search__input {
	border: 1px solid var(--wp--preset--color--border);
	font-family: inherit;
	border-radius: 4px;
	font-size: var(--wp--preset--font-size--small);
	padding: 0.35rem 0.6rem;
}

/*
 * Single post: course tag and date above the title, then the photo.
 */
.post-header {
	padding-top: clamp(1.75rem, 5vw, 3.25rem);
}

.post-meta {
	align-items: center;
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.95rem;
	gap: 0.4rem 0.75rem;
}

/* Course tags sit side by side as separate pills, with no commas between them. */
.course-tag .wp-block-post-terms__separator {
	display: none;
}

.course-tag a ~ a {
	margin-inline-start: 0.4rem;
}

.course-tag a {
	background: var(--wp--preset--color--accent-2);
	border-radius: 999px;
	color: var(--wp--preset--color--contrast);
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	padding: 0.2rem 0.6rem;
	text-decoration: none;
	text-transform: uppercase;
}

.post-header .wp-block-post-title {
	margin-top: 0.75rem;
}

/*
 * Photos never grow wider than the column, including in older posts
 * written in the classic editor.
 */
img {
	height: auto;
	max-width: 100%;
}

.wp-block-post-content figure {
	margin-left: 0;
	margin-right: 0;
}

.post-photo img,
.wp-block-post-content img {
	border-radius: 6px;
}

/*
 * Recipe card, built by the recipe card plugin from the [startrecipe] tags.
 */
.recipe {
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 8px;
	margin-top: 2.5rem;
	margin-bottom: 2.5rem;
}

.recipe > div {
	padding: clamp(1.25rem, 4vw, 2.25rem);
}

.recipe h1 {
	font-size: var(--wp--preset--font-size--x-large);
	margin: 0;
}

.recipe .arabic-name {
	color: var(--wp--preset--color--accent-1);
	font-size: 1.45rem;
	font-weight: 600;
	line-height: 1.4;
	margin: 0.2rem 0 0;
	text-align: left;
}

.recipe .subtitle {
	color: var(--wp--preset--color--muted);
	font-size: 1rem;
	margin: 0.4rem 0 0;
}

.recipe h2 {
	font-size: 1.3rem;
	margin: 1.75rem 0 0.5rem;
}

.recipe ul {
	margin: 0 0 1rem;
	padding-left: 1.4em;
}

.recipe ul li {
	margin-bottom: 0.35em;
	padding-left: 0.3em;
}

.recipe ul li::marker {
	color: var(--wp--preset--color--accent-1);
}

.recipe ol {
	margin: 0 0 1rem;
	padding-left: 1.4em;
}

.recipe ol li {
	margin-bottom: 0.7em;
	padding-left: 0.3em;
}

.recipe ol li::marker {
	color: var(--wp--preset--color--accent-1);
	font-family: var(--wp--preset--font-family--mono);
	font-weight: 600;
}

.recipe .print {
	margin: 1.5rem 0 0;
}

.recipe .print button {
	background: var(--wp--preset--color--accent-1);
	border: 0;
	border-radius: 4px;
	color: var(--wp--preset--color--base);
	cursor: pointer;
	font-family: inherit;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	padding: 0.6rem 1.4rem;
}

/*
 * Subscribe box, at the end of each post, above the comments.
 * The stamp sits beside the heading; the form below is Jetpack's Subscribe block.
 */
.subscribe-box {
	background-color: var(--wp--preset--color--surface);
	border-radius: 4px;
	margin-top: 3rem;
	/* Less on the left: the stamp's postmark waves already add white space there. */
	padding: 1.5rem 1.5rem 1.5rem 1rem;
}

.subscribe-box > * {
	margin: 0;
}

.subscribe-box > * + * {
	margin-top: 1rem;
}

.subscribe-intro {
	gap: 1rem;
}

.subscribe-stamp {
	flex: none;
	margin: 0;
}

.subscribe-text > * {
	margin: 0;
}

.subscribe-text > * + * {
	margin-top: 0.4rem;
}

.subscribe-box h2 {
	font-size: 1.5rem;
}

.subscribe-box input[type="email"] {
	background: #fff;
	font-family: inherit;
}

/*
 * Comments: compact, no profile pictures, replies one step in.
 */
.post-comments {
	border-top: 1px solid var(--wp--preset--color--border);
	margin-top: 3rem;
	padding-top: 1.5rem;
}

.post-comments .wp-block-comments-title {
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.9rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.wp-block-comment-template {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wp-block-comment-template li {
	border-bottom: 1px solid var(--wp--preset--color--border);
	padding: 1.25rem 0;
}

.wp-block-comment-template ol {
	border-left: 2px solid var(--wp--preset--color--border);
	list-style: none;
	margin: 0.75rem 0 0 1rem;
	padding: 0 0 0 1rem;
}

/* Replies sit closer together than the comments around them. */
.wp-block-comment-template ol li {
	padding: 0.75rem 0;
}

.wp-block-comment-template ol li:first-child {
	padding-top: 0;
}

.wp-block-comment-template ol li:last-child {
	border-bottom: 0;
	padding-bottom: 0;
}

.comment-meta {
	align-items: baseline;
	gap: 0.25rem 0.75rem;
}

.comment-meta .wp-block-comment-author-name {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 1.1rem;
	font-weight: 600;
}

.comment-meta .wp-block-comment-date,
.comment-meta .wp-block-comment-reply-link {
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.85rem;
}

.wp-block-comment-content p {
	margin: 0.4rem 0 0;
}

.wp-block-post-comments-form input:not([type="submit"]):not([type="checkbox"]),
.wp-block-post-comments-form textarea {
	background: #fff;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 4px;
	font-family: inherit;
	font-size: 1rem;
	padding: 0.5rem 0.75rem;
}

/*
 * Previous and next posts, at the end of a post.
 */
.post-navigation {
	border-top: 1px solid var(--wp--preset--color--border);
	margin-top: 2rem;
	padding-top: 1.5rem;
}

.post-navigation .wp-block-post-navigation-link {
	display: grid;
	gap: 0.2rem;
	max-width: 45%;
}

.post-navigation .post-navigation-link-next {
	margin-left: auto;
	text-align: right;
}

.post-navigation-link__label {
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.85rem;
}

.post-navigation a {
	align-items: center;
	display: flex;
	font-weight: 700;
	gap: 0.75rem;
}

/* On the Next side the photo sits on the right, at the outer edge. */
.post-navigation .post-navigation-link-next a {
	flex-direction: row-reverse;
}

.post-navigation-photo {
	border-radius: 6px;
	flex: none;
	height: 4rem;
	object-fit: cover;
	width: 4rem;
}

/* Blog page and archives */

.page-title {
	margin-block: clamp(1.75rem, 5vw, 3rem) 0.5rem;
}

.post-row {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
	gap: 1.25rem 2.25rem;
	align-items: start;
	padding-block: clamp(1.75rem, 4vw, 2.75rem);
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.post-row > * {
	margin-block: 0;
}

/* A post without a featured photo gives the whole row to its text. */
.post-row:not(:has(.post-photo)) {
	grid-template-columns: minmax(0, 1fr);
}

/* On phones the photo goes on top. */
@media (max-width: 760px) {
	.post-row {
		grid-template-columns: minmax(0, 1fr);
	}
}

.post-row .post-photo img {
	border-radius: 6px;
}

.post-text > * {
	margin-block: 0;
}

.post-text > * + * {
	margin-block-start: 0.75rem;
}

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

.post-text .wp-block-post-title a:hover,
.post-text .wp-block-post-title a:focus {
	text-decoration: underline;
}

.more-link {
	display: block;
	width: fit-content;
	margin-top: 0.75rem;
	font-weight: 700;
}

.pager {
	gap: 0.5rem;
	margin-block: 2rem 2.75rem;
	font-family: var(--wp--preset--font-family--mono);
}

.pager a,
.pager .page-numbers {
	padding: 0.2rem 0.65rem;
	border-radius: 4px;
}

.pager .current {
	background: var(--wp--preset--color--accent-1);
	color: var(--wp--preset--color--base);
	font-weight: 600;
}

/* Homepage */

.home-hello {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 1.5rem 2.5rem;
	align-items: center;
	padding-block: clamp(2rem, 6vw, 4rem) clamp(1.5rem, 4vw, 2.5rem);
}

.home-hello > *,
.home-hello-text > * {
	margin-block: 0;
}

.home-hello-text > * + * {
	margin-block-start: 0.75rem;
}

.home-hello-photo img {
	width: clamp(150px, 28vw, 260px);
	aspect-ratio: 4 / 5;
	object-fit: cover;
	border-radius: 0px;
}

.home-hello-text p {
	max-width: 46ch;
}

/* On phones the photo goes above the hello. */
@media (max-width: 560px) {
	.home-hello {
		grid-template-columns: minmax(0, 1fr);
	}
}

.home-recent {
	padding-block: clamp(1.75rem, 5vw, 3rem);
	border-top: 1px solid var(--wp--preset--color--border);
}

.home-recent > * {
	margin-block: 0;
}

.home-recent > * + * {
	margin-block-start: 1.25rem;
}

.home-recent h2 {
	font-size: 1.6rem;
}

.recent-list {
	max-width: 760px;
}

/* Each post: a small square photo, then the date above the title. */
.recent-list li {
	display: grid;
	grid-template-columns: 5rem minmax(0, 1fr);
	gap: 1rem;
	align-items: center;
	margin: 0;
	padding: 0.75rem 0;
	border-top: 1px solid var(--wp--preset--color--border);
}

.recent-list li:last-child {
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.recent-list li > * {
	margin: 0;
}

.recent-thumb img {
	width: 5rem;
	height: 5rem;
	object-fit: cover;
	border-radius: 6px;
}

/* A post without a featured photo gets a plain tile, so the titles stay lined up. */
.recent-list li:not(:has(.recent-thumb))::before {
	content: "";
	width: 5rem;
	height: 5rem;
	background: var(--wp--preset--color--surface);
	border-radius: 6px;
}

.recent-text {
	grid-column: 2;
}

.recent-text > * {
	margin: 0;
}

.recent-list .wp-block-post-date {
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--small);
}

.post-kind {
	margin-inline-start: 0.5rem;
	color: var(--wp--preset--color--accent-1);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.recent-list .wp-block-post-title {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 500;
	line-height: 1.4;
}

.recent-list .wp-block-post-title a {
	color: inherit;
	text-decoration-color: var(--wp--preset--color--border);
	text-underline-offset: 4px;
}

.recent-list .wp-block-post-title a:hover,
.recent-list .wp-block-post-title a:focus {
	text-decoration-color: var(--wp--preset--color--accent-1);
}

.home-recent-more a {
	font-weight: 700;
}

/* Recipes page and course pages */

.course-nav {
	padding-bottom: 0.75rem;
}

/* The course description sits under the buttons, so the buttons never move. */
.course-description p {
	margin: 0;
}

.recipe-list {
	border-top: 1px solid var(--wp--preset--color--border);
}

/* "All" and the course list flow together as one row of buttons. */
.course-all,
.course-list,
.course-list li {
	display: inline;
	margin: 0;
	padding: 0;
}

.course-all a,
.course-list a {
	display: inline-block;
	margin: 0 0.35rem 0.5rem 0;
	padding: 0.35rem 0.9rem;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 999px;
	color: var(--wp--preset--color--accent-1);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	line-height: 1.4;
	text-decoration: none;
}

.course-all a:hover,
.course-all a:focus,
.course-list a:hover,
.course-list a:focus {
	border-color: var(--wp--preset--color--accent-1);
}

/* The current course is filled in; on the Recipes page itself, "All" is. */
body:not(.tax-recipe_course) .course-all a,
.course-list .current-cat > a {
	background: var(--wp--preset--color--accent-1);
	border-color: var(--wp--preset--color--accent-1);
	color: var(--wp--preset--color--base);
}

.recipe-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 2rem 1.5rem;
	padding-block: 2rem;
}

@media (max-width: 900px) {
	.recipe-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 560px) {
	.recipe-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Each card: the photo, then the name with the Arabic name beside it or below. */
.recipe-grid li {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: baseline;
	gap: 0.15rem 0.75rem;
	margin: 0;
}

.recipe-grid li > * {
	margin: 0;
}

.recipe-grid .wp-block-post-featured-image {
	flex-basis: 100%;
	margin-bottom: 0.5rem;
}

.recipe-grid .wp-block-post-featured-image img {
	border-radius: 6px;
}

.recipe-card-name {
	font-size: 1.25rem;
	line-height: 1.2;
}

.recipe-card-name a {
	color: inherit;
	text-decoration: none;
}

.recipe-card-name a:hover,
.recipe-card-name a:focus {
	text-decoration: underline;
}

.recipe-card-arabic {
	color: var(--wp--preset--color--accent-1);
	font-size: 1.25rem;
	font-weight: 600;
	line-height: 1.4;
}

/* Search results and the page-not-found page */

.page-search {
	max-width: 36rem;
}

.page-search .wp-block-search__input {
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 4px;
	font: inherit;
}

.not-found {
	padding-block: clamp(2.5rem, 8vw, 5rem);
}

.not-found .page-search {
	margin-inline: auto;
}

/* The pomegranate's white background blends into the page colour. */
.not-found-image img {
	mix-blend-mode: multiply;
}