/*
 Theme Name:   Kowethas an Yeth Kernewek
 Theme URI:    https://cornish-language.org
 Description:  Child theme of Unify for cornish-language.org. Replaces the old "website" theme with the same look, ACF fields, widget areas and menus. Bilingual (WPML) and WooCommerce ready.
 Author:       Unify Studio
 Author URI:   https://unify-studio.co.uk
 Template:     unify
 Version:      1.0.3
 Requires PHP: 8.1
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Text Domain:  unify-kowethas
*/

/* ══════════════════════════════════════════════════════
   BRAND — overrides the Unify defaults
   ══════════════════════════════════════════════════════ */

:root {
	--unify-primary:      #faa41a;  /* Kowethas orange */
	--unify-secondary:    #414042;  /* charcoal */
	--unify-accent:       #271082;  /* deep blue (Join Us, highlight boxes) */
	--unify-bg:           #ffffff;
	--unify-bg-alt:       #eef8f7;  /* pale mint (news cards, footer) */
	--unify-text:         #414042;
	--unify-text-muted:   #6d6c6e;
	--unify-border:       #cfcfcf;

	--unify-font-heading: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	--unify-font-body:    'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

	--unify-max-width:    1180px;
	--unify-radius-md:    10px;

	--kl-line:            #f4f5f5;
	--kl-gap:             20px;
}

/* ══════════════════════════════════════════════════════
   BASE TYPE (as the old site)
   ══════════════════════════════════════════════════════ */

body {
	font-size: 16px;
	line-height: 1.5;
	color: var(--unify-text);
}

h1, h2, h3, h4 { font-family: var(--unify-font-heading); color: var(--unify-primary); }
h1 { font-size: clamp(2.25rem, 5vw, 3.75rem); font-weight: 600; line-height: 1.07; margin: 0 0 20px; }
h2 { font-size: 1.625rem; font-weight: 400; line-height: 1.3; margin: 0 0 20px; }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; margin: 0 0 15px; }
h4 { font-size: 1.875rem; font-weight: 400; line-height: 1.33; margin: 0 0 20px; color: var(--unify-text); }

/* Unify colours every <p> charcoal; inherit instead so text in dark boxes stays white. */
p { margin: 0 0 15px; color: inherit; line-height: 1.5; }
p:last-child { margin-bottom: 15px; }

a { color: var(--unify-primary); }
a:hover { opacity: 1; text-decoration: underline; }

/* Unify makes every image display:block; the old site's content expects inline images. */
img, svg { display: inline; height: auto; }

hr { border: 0; border-bottom: 1px solid var(--unify-border); margin: 40px 0; }

.kl-center { text-align: center; }
.kl-section { padding-block: 40px; }
.kl-title { margin-top: 0; }

:focus-visible { outline: 2px solid var(--unify-accent); outline-offset: 2px; }

.kl-skip:focus {
	position: fixed; top: 10px; left: 10px; z-index: 100000;
	width: auto; height: auto; clip: auto; margin: 0;
	padding: 8px 16px; background: #fff; color: var(--unify-text);
}

/* Buttons (also WooCommerce buttons, as before) */
.kl-btn,
.woocommerce #respond input#submit,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce a.button.alt,
.woocommerce button.button.alt {
	display: inline-block;
	background-color: var(--unify-primary);
	color: #fff;
	border: 3px solid var(--unify-primary);
	border-radius: 10px;
	line-height: 40px;
	padding: 0 40px;
	font-weight: 400;
	text-decoration: none;
	transition: background-color .3s ease, color .3s ease;
}
.kl-btn:hover,
.woocommerce #respond input#submit:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover {
	background-color: #fff;
	color: var(--unify-primary);
	text-decoration: none;
}

/* Quotes */
blockquote { margin: 15px; padding: 0; border: 0; font-size: inherit; font-style: italic; color: #666; }
.wp-block-quote {
	position: relative;
	padding-left: 100px;
	border: 0;
	font-style: normal;
}
.wp-block-quote::before {
	content: '';
	position: absolute;
	left: 20px; top: 10px;
	width: 50px; height: 38px;
	background: url('assets/images/quote.png') no-repeat;
	background-size: 50px 38px;
}
.wp-block-quote p { font-size: 1.25rem; line-height: 1.3; }

.alignleft  { float: left;  margin: 0 40px 15px 0; }
.alignright { float: right; margin: 0 0 15px 40px; }
.aligncenter { margin-inline: auto; }

/* ══════════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════════ */

.unify-main.kl-main { padding-top: 0; } /* header is not fixed */

.kl-header { background: #fff; position: relative; z-index: 100; }

.kl-header__top {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: start;
	gap: var(--kl-gap);
	padding-block: 10px;
}

.kl-header__logo { text-align: center; }
.kl-logo { display: inline-block; }
.kl-logo img { width: 258px; max-width: 100%; height: auto; display: block; }

.kl-header__tools { text-align: right; }

.kl-search { display: flex; justify-content: flex-end; align-items: center; }
.kl-search input {
	border: 1px solid transparent;
	background: transparent;
	line-height: 30px;
	padding: 0 5px;
	text-align: right;
	font: inherit;
	color: inherit;
	max-width: 180px;
}
.kl-search input:focus { border-color: var(--kl-line); outline: none; text-align: left; }
.kl-search button {
	background: none; border: 0; cursor: pointer;
	color: var(--unify-primary); font-size: 20px; padding: 0 0 0 5px;
}

.kl-cart { display: inline-block; margin-top: 6px; padding-right: 7px; }

/* WPML legacy dropdown switcher */
.kl-header__lang .wpml-ls-legacy-dropdown,
.kl-header__lang .wpml-ls-legacy-dropdown-click { position: relative; z-index: 200; }
.kl-header__lang .wpml-ls-legacy-dropdown a,
.kl-header__lang .wpml-ls-legacy-dropdown-click a { border: none; background: var(--kl-line); }
.wpml-ls-legacy-dropdown-click a span::before { content: 'View in '; }

/* Menu bar */
.kl-nav { border-top: 1px solid var(--kl-line); }
.kl-nav__toggle { display: none; }

.kl-menu {
	list-style: none;
	margin: 0; padding: 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
}
.kl-menu li { position: relative; margin: 0; }
.kl-menu > li > a {
	display: block;
	padding: 0 18px;
	line-height: 45px;
	color: var(--unify-text);
	font-weight: 400;
	text-decoration: none;
}
.kl-menu > li > a:hover,
.kl-menu > .current-menu-item > a,
.kl-menu > .current-menu-ancestor > a { color: var(--unify-primary); }

.kl-menu .sub-menu {
	display: none;
	position: absolute;
	top: 100%; left: 0;
	min-width: 220px;
	list-style: none;
	margin: 0; padding: 5px 0;
	background: var(--unify-secondary);
	z-index: 1500;
}
.kl-menu .sub-menu a {
	display: block;
	padding: 0 20px;
	line-height: 30px;
	color: #fff;
	text-decoration: none;
}
.kl-menu .sub-menu a:hover { color: var(--unify-primary); }

.kl-menu > .menu-item-has-children:hover,
.kl-menu > .menu-item-has-children:focus-within { background: var(--unify-secondary); }
.kl-menu > .menu-item-has-children:hover > a,
.kl-menu > .menu-item-has-children:focus-within > a { color: #fff; }
.kl-menu > li:hover > .sub-menu,
.kl-menu > li:focus-within > .sub-menu { display: block; }

.kl-sub-toggle { display: none; }

/* ══════════════════════════════════════════════════════
   HOME — slider
   ══════════════════════════════════════════════════════ */

.kl-slider {
	position: relative;
	height: 60vh;
	min-height: 320px;
	margin-bottom: 60px;
	overflow: hidden;
	background: var(--unify-secondary);
}
.kl-slide {
	position: absolute; inset: 0;
	background-size: cover;
	background-position: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity .8s ease, visibility .8s;
}
.kl-slide__img {
	position: absolute; inset: 0;
	display: block;
	width: 100%; height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center;
}
.kl-slide.is-active { opacity: 1; visibility: visible; }
.kl-slide::after {
	content: '';
	position: absolute; inset: 0;
	background: linear-gradient(0deg, rgba(0,0,0,.68) 0%, rgba(0,0,0,0) 50%);
}
.kl-slide__overlay {
	position: absolute;
	left: 0; right: 0; bottom: 100px;
	text-align: center;
	color: #fff;
	z-index: 2;
	padding-inline: 110px;
}
.kl-slide__title { font-size: 2.25rem; line-height: 1.1; margin-bottom: 15px; }
.kl-slide__text  { font-size: 1.125rem; line-height: 1.25; }

.kl-slider__prev,
.kl-slider__next {
	position: absolute; top: 0; bottom: 0;
	width: 100px;
	display: flex; align-items: center; justify-content: center;
	background: none; border: 0; cursor: pointer;
	color: var(--unify-primary);
	font-size: 50px;
	z-index: 3;
}
.kl-slider__prev { left: 0; }
.kl-slider__next { right: 0; }

.kl-slider__pager {
	position: absolute; left: 0; right: 0; bottom: 40px;
	text-align: center;
	z-index: 3;
}
.kl-slider__pager button {
	width: 10px; height: 10px;
	margin: 5px;
	padding: 0;
	border-radius: 50%;
	border: 2px solid var(--unify-primary);
	background: var(--unify-primary);
	box-shadow: 0 0 0 2px var(--unify-primary);
	cursor: pointer;
}
.kl-slider__pager button.is-active {
	background: #fff;
	border-color: var(--unify-primary);
	box-shadow: 0 0 0 2px #fff;
}

/* ══════════════════════════════════════════════════════
   HOME — signposts
   ══════════════════════════════════════════════════════ */

.kl-signposts {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--kl-gap);
	margin-bottom: 60px;
}
.kl-signpost {
	position: relative;
	display: block;
	background: var(--unify-secondary);
	text-decoration: none;
}
.kl-signpost:hover { text-decoration: none; }
.kl-signpost img { display: block; width: 100%; transition: opacity .3s; }
.kl-signpost:hover img,
.kl-signpost:focus img { opacity: .6; }

.kl-signpost__title {
	position: absolute;
	top: 0; left: 50%;
	transform: translateX(-50%);
	padding: 20px 60px;
	background: #fff;
	color: var(--unify-text);
	text-transform: uppercase;
	font-size: 1.5rem;
	line-height: 1.25;
	white-space: nowrap;
}
.kl-signpost:hover .kl-signpost__title { background: var(--unify-secondary); color: #fff; }

.kl-signpost__hover {
	display: none;
	position: absolute;
	left: 50%; top: 50%;
	transform: translate(-50%, -50%);
	padding: 0 60px;
	border-top: 1px solid #fff;
	border-bottom: 1px solid #fff;
	color: #fff;
	font-size: 1.5rem;
	line-height: 40px;
	white-space: nowrap;
}
.kl-signpost:hover .kl-signpost__hover,
.kl-signpost:focus .kl-signpost__hover { display: block; }

/* ══════════════════════════════════════════════════════
   NEWS
   ══════════════════════════════════════════════════════ */

.kl-news { margin: 40px 0; }

.kl-news-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--kl-gap);
	margin-bottom: 20px;
}
.kl-news-card { background: var(--unify-bg-alt); padding: 10px; }
.kl-news-card__thumb { display: block; margin-bottom: 10px; }
.kl-news-card__thumb img { display: block; width: 100%; }
.kl-news-card__title { margin-bottom: 10px; }
.kl-news-card__title a { color: var(--unify-primary); }
.kl-news-card__meta { font-size: 10px; margin-bottom: 10px; }
.kl-read-more { font-size: 35px; line-height: 1; text-decoration: none; }

.kl-post-nav {
	display: flex;
	justify-content: space-between;
	gap: var(--kl-gap);
	margin: 20px 0;
}

/* ══════════════════════════════════════════════════════
   HOME — Join Us, social, highlights
   ══════════════════════════════════════════════════════ */

.kl-join {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 260px;
	background: var(--unify-accent);
	text-align: center;
	overflow: hidden;
}
.kl-join img {
	position: absolute; inset: 0;
	width: 100%; height: 100%;
	object-fit: cover;
	opacity: .4;
}
.kl-join__overlay { position: relative; padding-block: 30px; }
.kl-join h2, .kl-join h3 { color: #fff; }

.kl-social { background: var(--unify-bg-alt); padding: 40px 0; }
.kl-social h2 { color: var(--unify-text); }

.kl-highlight { padding: 40px 0; }
.kl-highlight__inner { position: relative; }
.kl-highlight__image img { border-radius: 10px; margin-left: 10%; width: 540px; max-width: 80%; }
.kl-highlight__text {
	position: absolute;
	top: 50%; left: 55%;
	transform: translateY(-50%);
	width: 300px;
	padding: 20px;
	border-radius: 10px;
	background: var(--unify-accent);
	color: #fff;
}
.kl-highlight__text h1, .kl-highlight__text h2, .kl-highlight__text h3 { color: #fff; }

/* ══════════════════════════════════════════════════════
   PAGES, POSTS, SIDEBARS
   ══════════════════════════════════════════════════════ */

.kl-feature img {
	display: block;
	width: 100%;
	height: 60vh;
	object-fit: cover;
	margin-bottom: 60px;
}

.kl-content { padding-bottom: 20px; }
.kl-content::after { content: ''; display: table; clear: both; }

.kl-meta {
	border-top: 1px solid var(--unify-border);
	border-bottom: 1px solid var(--unify-border);
	padding: 10px 0;
	margin-bottom: 15px;
}
.kl-meta a { color: var(--unify-text); }

.kl-with-sidebar {
	display: grid;
	grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
	gap: 40px;
}
.kl-with-sidebar--left { grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); }

.kl-sidebar h3 { color: var(--unify-text); border-bottom: 1px solid var(--unify-border); }
.kl-sidebar ul { list-style: none; padding: 0; margin: 0 0 20px; }
.kl-sidebar ul a { color: var(--unify-text); }

/* ══════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════ */

.kl-footer {
	background: var(--unify-bg-alt);
	color: var(--unify-text);
	padding: 40px 0;
	margin-top: 60px;
}
.kl-footer__cols {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 40px;
}
.kl-footer__main { background: #fff; padding: 20px; }
.kl-footer h3 { font-weight: 400; line-height: 1.4; margin-bottom: 10px; }
.kl-footer hr { margin: 40px 0 5px; }

.kl-footer__bar {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 10px;
	font-size: 10px;
	line-height: 12px;
}
.kl-footer__copy { margin: 0; }
.kl-footer__credit a { color: var(--unify-text); }
.kl-footer__nav { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.kl-footer__nav li { border-right: 1px solid var(--unify-text); }
.kl-footer__nav li:last-child { border-right: 0; }
.kl-footer__nav a { display: block; padding: 0 5px; color: var(--unify-text); }

/* ══════════════════════════════════════════════════════
   WOOCOMMERCE
   ══════════════════════════════════════════════════════ */

.woocommerce ul.products li.product .woocommerce-loop-category__title,
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product h3 {
	padding: .5em 0;
	margin: 0;
	font-size: 16px;
	line-height: 1.2;
}
.woocommerce div.product { padding-top: 20px; }
.woocommerce div.product .product_title { color: var(--unify-primary); }
.related.products { clear: both; }
.kl-shop__intro { margin-bottom: 20px; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */

@media (max-width: 980px) {
	.kl-news-grid { grid-template-columns: repeat(2, 1fr); }
	.kl-signpost__title, .kl-signpost__hover { padding-inline: 30px; font-size: 1.25rem; }
}

@media (max-width: 672px) {
	.kl-header__top { grid-template-columns: 1fr; text-align: center; }
	.kl-header__tools { text-align: center; }
	.kl-search { justify-content: center; }
	.kl-search input { text-align: left; }

	.kl-nav__toggle {
		display: block;
		margin: 0 auto;
		padding: 10px 20px;
		background: none; border: 0; cursor: pointer;
		font-size: 40px;
		color: var(--unify-text);
	}
	.kl-menu { display: none; flex-direction: column; }
	.kl-menu.is-open { display: flex; }
	.kl-menu .sub-menu { position: static; display: none; }
	.kl-menu > li:hover > .sub-menu,
	.kl-menu > li:focus-within > .sub-menu { display: none; }
	.kl-menu > .menu-item-has-children.is-open > .sub-menu { display: block; }
	.kl-menu > .menu-item-has-children:hover,
	.kl-menu > .menu-item-has-children:focus-within { background: transparent; }
	.kl-menu > .menu-item-has-children:hover > a,
	.kl-menu > .menu-item-has-children:focus-within > a { color: var(--unify-text); }

	.kl-sub-toggle {
		display: block;
		position: absolute; top: 0; right: 0;
		width: 45px; height: 45px;
		background: none; border: 0; cursor: pointer;
	}
	.kl-sub-toggle::after {
		content: '';
		position: absolute; top: 19px; left: 15px;
		border-left: 8px solid transparent;
		border-right: 8px solid transparent;
		border-top: 8px solid var(--unify-text);
	}
	.kl-menu .is-open > .kl-sub-toggle::after { transform: rotate(180deg); }

	.kl-slider, .kl-feature img { height: 40vh; }
	.kl-slide__overlay { display: none; }
	.kl-slider__prev, .kl-slider__next { width: 60px; font-size: 36px; }

	.kl-signposts,
	.kl-news-grid,
	.kl-with-sidebar,
	.kl-with-sidebar--left,
	.kl-footer__cols { grid-template-columns: 1fr; }

	.kl-highlight__image { display: none; }
	.kl-highlight__text { position: static; transform: none; width: auto; }

	.kl-btn,
	.woocommerce a.button,
	.woocommerce button.button,
	.woocommerce input.button { padding: 0 25px; line-height: 35px; }

	.alignleft, .alignright { float: none; margin: 0 0 15px; }
}

@media (prefers-reduced-motion: reduce) {
	.kl-slide { transition: none; }
}
