/*
Theme Name: The Wine Decoder
Theme URI: https://www.thedecoder.wine/
Author: The Wine Decoder
Author URI: https://www.thedecoder.wine/
Description: A lightweight editorial theme for TWD Core, built for sourced wine education and the Wine Explorer.
Version: 0.1.0
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Text Domain: twd-theme
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

:root {
	--twd-theme-wine: #651d25;
	--twd-theme-wine-dark: #461119;
	--twd-theme-forest: #304638;
	--twd-theme-gold: #c89b52;
	--twd-theme-cream: #fbf6ec;
	--twd-theme-paper: #fffdf8;
	--twd-theme-ink: #1d251f;
	--twd-theme-muted: #647068;
	--twd-theme-line: rgba(48, 70, 56, .18);
	--twd-theme-serif: Georgia, "Times New Roman", serif;
	--twd-theme-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--twd-theme-wide: 1600px;
	--twd-theme-content: 780px;
}

html {
	scroll-behavior: smooth;
}

body {
	background: var(--twd-theme-paper);
	color: var(--twd-theme-ink);
	font-family: var(--twd-theme-sans);
	font-size: 16px;
	line-height: 1.7;
	margin: 0;
	overflow-x: hidden;
}

body,
button,
input,
select,
textarea {
	font-family: var(--twd-theme-sans);
}

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

a {
	color: var(--twd-theme-wine);
	text-decoration-thickness: .08em;
	text-underline-offset: .18em;
}

a:hover {
	color: var(--twd-theme-wine-dark);
}

:focus-visible {
	outline: 3px solid var(--twd-theme-gold);
	outline-offset: 3px;
}

.screen-reader-text,
.twd-skip-link:not(:focus) {
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute !important;
	white-space: nowrap;
	width: 1px;
}

.twd-skip-link:focus {
	background: var(--twd-theme-paper);
	color: var(--twd-theme-wine-dark);
	font-weight: 700;
	left: 1rem;
	padding: .75rem 1rem;
	position: fixed;
	top: 1rem;
	z-index: 100000;
}

.twd-site-container {
	box-sizing: border-box;
	margin-inline: auto;
	max-width: var(--twd-theme-wide);
	padding-inline: clamp(1.25rem, 5vw, 5rem);
	width: 100%;
}

/* Header */

.twd-site-header {
	backdrop-filter: blur(14px);
	background: rgba(255, 253, 248, .94);
	border-bottom: 1px solid var(--twd-theme-line);
	position: sticky;
	top: 0;
	z-index: 1000;
}

.admin-bar .twd-site-header {
	top: 32px;
}

.twd-site-header__inner {
	align-items: center;
	display: flex;
	gap: 2rem;
	justify-content: space-between;
	min-height: 82px;
}

.twd-site-brand {
	align-items: center;
	color: var(--twd-theme-wine-dark);
	display: inline-flex;
	gap: .85rem;
	text-decoration: none;
}

.twd-site-brand:hover {
	color: var(--twd-theme-wine-dark);
}

.twd-site-brand__mark {
	align-items: center;
	background:
		radial-gradient(circle at 68% 34%, var(--twd-theme-gold) 0 8%, transparent 9%),
		linear-gradient(145deg, var(--twd-theme-wine) 0 48%, var(--twd-theme-forest) 49% 100%);
	border: 3px solid var(--twd-theme-paper);
	border-radius: 50%;
	box-shadow: 0 0 0 1px rgba(48, 70, 56, .22);
	display: inline-flex;
	height: 42px;
	justify-content: center;
	width: 42px;
}

.twd-site-brand__mark::after {
	background: rgba(255, 253, 248, .82);
	content: "";
	height: 1px;
	transform: rotate(-35deg);
	width: 23px;
}

.twd-site-brand__copy {
	display: grid;
	line-height: 1.1;
}

.twd-site-brand__name {
	font-family: var(--twd-theme-serif);
	font-size: 1.32rem;
	letter-spacing: -.02em;
}

.twd-site-brand__line {
	color: var(--twd-theme-forest);
	font-size: .63rem;
	font-weight: 750;
	letter-spacing: .19em;
	margin-top: .35rem;
	text-transform: uppercase;
}

.twd-primary-nav ul,
.twd-mobile-nav ul {
	align-items: center;
	display: flex;
	gap: clamp(1rem, 2.5vw, 2.25rem);
	list-style: none;
	margin: 0;
	padding: 0;
}

.twd-primary-nav a,
.twd-mobile-nav a {
	color: var(--twd-theme-ink);
	font-size: .86rem;
	font-weight: 700;
	letter-spacing: .035em;
	text-decoration: none;
}

.twd-primary-nav a:hover,
.twd-primary-nav .current-menu-item > a,
.twd-primary-nav a[aria-current="page"],
.twd-mobile-nav a:hover,
.twd-mobile-nav .current-menu-item > a,
.twd-mobile-nav a[aria-current="page"] {
	color: var(--twd-theme-wine);
}

.twd-menu-toggle {
	display: none;
	position: relative;
}

.twd-menu-toggle summary {
	align-items: center;
	border: 1px solid var(--twd-theme-line);
	border-radius: 999px;
	color: var(--twd-theme-forest);
	cursor: pointer;
	display: inline-flex;
	font-size: .8rem;
	font-weight: 750;
	gap: .55rem;
	list-style: none;
	padding: .62rem .85rem;
}

.twd-menu-toggle summary::-webkit-details-marker {
	display: none;
}

.twd-menu-toggle summary::after {
	content: "+";
	font-size: 1.05rem;
	line-height: 1;
}

.twd-menu-toggle[open] summary::after {
	content: "−";
}

.twd-mobile-nav {
	background: var(--twd-theme-paper);
	border: 1px solid var(--twd-theme-line);
	box-shadow: 0 20px 45px rgba(29, 37, 31, .12);
	min-width: 210px;
	padding: 1rem;
	position: absolute;
	right: 0;
	top: calc(100% + .65rem);
}

.twd-mobile-nav ul {
	align-items: stretch;
	flex-direction: column;
	gap: 0;
}

.twd-mobile-nav a {
	display: block;
	padding: .7rem .65rem;
}

/* Main document layouts */

.twd-site-main {
	display: block;
	min-height: 58vh;
}

.twd-site-main--canvas {
	background: var(--twd-theme-cream);
}

.twd-document {
	box-sizing: border-box;
	margin-inline: auto;
	max-width: var(--twd-theme-content);
	padding: clamp(3.5rem, 8vw, 7rem) 1.25rem;
}

.twd-document--wide {
	max-width: 1220px;
}

.twd-document__header {
	border-bottom: 1px solid var(--twd-theme-line);
	margin-bottom: 2.5rem;
	padding-bottom: 2rem;
}

.twd-document__eyebrow {
	color: var(--twd-theme-forest);
	font-size: .74rem;
	font-weight: 750;
	letter-spacing: .2em;
	margin: 0 0 .9rem;
	text-transform: uppercase;
}

.twd-document h1,
.twd-document h2,
.twd-document h3 {
	color: var(--twd-theme-wine-dark);
	font-family: var(--twd-theme-serif);
	font-weight: 400;
	letter-spacing: -.025em;
	line-height: 1.08;
}

.twd-document h1 {
	font-size: clamp(2.8rem, 7vw, 5.75rem);
	margin: 0;
}

.twd-document h2 {
	font-size: clamp(2rem, 4vw, 3.3rem);
	margin-top: 2.2em;
}

.twd-document h3 {
	font-size: clamp(1.5rem, 3vw, 2.15rem);
}

.twd-document__content > * {
	max-width: 100%;
}

.twd-document__content p,
.twd-document__content li {
	font-size: 1.05rem;
}

.twd-document__content blockquote {
	border-left: 3px solid var(--twd-theme-gold);
	color: var(--twd-theme-wine-dark);
	font-family: var(--twd-theme-serif);
	font-size: 1.45rem;
	margin: 2.5rem 0;
	padding-left: 1.5rem;
}

.twd-post-list {
	display: grid;
	gap: 1px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	list-style: none;
	margin: 3rem 0 0;
	padding: 1px;
	background: var(--twd-theme-line);
}

.twd-post-card {
	background: var(--twd-theme-paper);
	padding: clamp(1.5rem, 4vw, 2.5rem);
}

.twd-post-card h2 {
	font-size: clamp(1.8rem, 3vw, 2.7rem);
	margin: 0 0 1rem;
}

.twd-post-card h2 a {
	color: inherit;
	text-decoration: none;
}

.twd-pagination {
	margin-top: 3rem;
}

/* TWD Core integration */

body .twd-shell.alignfull {
	margin-left: auto;
	margin-right: auto;
	max-width: var(--twd-theme-wide) !important;
	width: 100% !important;
}

body .twd-home.twd-shell.alignfull {
	margin: 0;
	max-width: none !important;
	width: 100% !important;
}

body .twd-explorer.twd-shell.alignfull {
	margin-inline: auto;
	max-width: var(--twd-theme-wide) !important;
}

body .twd-hero {
	min-height: min(700px, calc(100vh - 82px));
}

body .twd-hero h1 {
	font-size: clamp(3.5rem, 7vw, 7rem);
}

body .twd-section-heading h2 {
	font-size: clamp(2.4rem, 4.6vw, 4.5rem);
}

body .twd-manifesto__quote {
	font-size: clamp(2.5rem, 5vw, 5rem);
}

body .twd-explorer__intro h1 {
	font-size: clamp(2.8rem, 5vw, 5.15rem);
}

body .twd-explorer__toolbar {
	align-items: start;
	grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
}

body .twd-filter-row {
	flex-wrap: wrap;
	justify-content: flex-start;
	overflow: visible;
}

body .twd-entry-profile {
	margin-left: 0;
	margin-right: 0;
}

/* Footer */

.twd-site-footer {
	background: var(--twd-theme-wine-dark);
	color: rgba(255, 253, 248, .78);
}

.twd-site-footer a {
	color: var(--twd-theme-paper);
}

.twd-site-footer__main {
	align-items: end;
	display: grid;
	gap: 3rem;
	grid-template-columns: 1.25fr .75fr;
	padding-block: clamp(3.5rem, 7vw, 6rem);
}

.twd-site-footer__eyebrow {
	color: var(--twd-theme-gold);
	font-size: .7rem;
	font-weight: 750;
	letter-spacing: .2em;
	margin: 0 0 1rem;
	text-transform: uppercase;
}

.twd-site-footer__title {
	color: var(--twd-theme-paper);
	font-family: var(--twd-theme-serif);
	font-size: clamp(2.35rem, 5vw, 4.8rem);
	letter-spacing: -.035em;
	line-height: 1;
	margin: 0;
}

.twd-site-footer__note {
	border-top: 1px solid rgba(255, 253, 248, .2);
	font-size: .95rem;
	margin: 0;
	padding-top: 1rem;
}

.twd-site-footer__bottom {
	align-items: center;
	border-top: 1px solid rgba(255, 253, 248, .14);
	display: flex;
	font-size: .76rem;
	gap: 1.5rem;
	justify-content: space-between;
	letter-spacing: .04em;
	padding-block: 1.2rem;
}

.twd-site-footer__bottom p {
	margin: 0;
}

.twd-footer-nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.twd-footer-nav a {
	text-decoration: none;
}

@media (max-width: 1100px) {
	body .twd-explorer__toolbar {
		grid-template-columns: 1fr;
	}

	body .twd-filter-row {
		justify-content: flex-start;
	}
}

@media (max-width: 782px) {
	.admin-bar .twd-site-header {
		top: 46px;
	}
}

@media (max-width: 760px) {
	html {
		scroll-behavior: auto;
	}

	.twd-site-header__inner {
		min-height: 72px;
	}

	.twd-primary-nav {
		display: none;
	}

	.twd-menu-toggle {
		display: block;
	}

	.twd-site-footer__main {
		align-items: start;
		grid-template-columns: 1fr;
	}

	.twd-site-footer__bottom {
		align-items: flex-start;
		flex-direction: column;
	}

	body .twd-hero {
		min-height: auto;
	}

	body .twd-hero h1 {
		font-size: clamp(3.2rem, 16vw, 5.3rem);
	}
}

@media (max-width: 560px) {
	.twd-site-brand__line {
		display: none;
	}

	.twd-site-brand__name {
		font-size: 1.08rem;
	}

	.twd-site-brand__mark {
		height: 36px;
		width: 36px;
	}

	.twd-post-list {
		grid-template-columns: 1fr;
	}

	body .twd-explorer {
		padding-inline: 1.1rem;
	}

	body .twd-search input {
		font-size: 1rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
}
