/*
Theme Name:        NutriScript
Theme URI:         https://nutriscript.co.uk/
Author:            Detoxpeople
Author URI:        https://detoxpeople.co.uk/
Description:       Custom theme for the NutriScript website. The homepage is built with core blocks in the block editor (NutriScript Homepage page template + block patterns for every section); header and footer are theme templates. Includes templates for pages, posts, archives, search and 404.
Version:           1.1.0
Requires at least: 6.3
Tested up to:      7.1
Requires PHP:      7.4
License:           GNU General Public License v2 or later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:       nutriscript
Tags:              one-column, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, wide-blocks
*/

/* ==========================================================================
   Global styles: base, buttons, header, navigation, footer, forms and
   inner-page templates. Homepage sections live in assets/css/homepage.css.

   Palette
     Green #55B795   Mint #E5F8F2   Aqua #43B5D1   Yellow #FFC943
     Ink #20212D     Ink soft #4A4B57   Line #D9E3E0   Field line #868B95
     Yellow tint #FFF4D6   Aqua tint #DDF2F8   Error #B42318

   Colour rule (WCAG 2.2 AA): white text on green or aqua fails contrast,
   so green and aqua are only used as surfaces with ink text, or as
   decoration. Green is never used for text.

   Breakpoints: 1080 / 960 / 860 (mobile menu) / 782 (admin bar) / 600
   ========================================================================== */

/* 1. Base ------------------------------------------------------------------ */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	scroll-padding-top: 104px;
}

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

body {
	margin: 0;
	background: #fff;
	color: #20212D;
	font-family: "Figtree", "Helvetica Neue", Arial, sans-serif;
	font-size: 17px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: "Quicksand", "Nunito", "Avenir Next", "Segoe UI", sans-serif;
	font-weight: 600;
	color: #20212D;
	letter-spacing: -0.015em;
	text-wrap: balance;
}

a {
	color: #20212D;
}

/* Visible keyboard focus everywhere */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
	outline: 3px solid #20212D;
	outline-offset: 3px;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	word-wrap: normal !important;
}

.skip-link {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 2000;
	padding: 10px 16px;
	transform: translateY(-160%);
	border-radius: 8px;
	background: #20212D;
	color: #fff;
	text-decoration: none;
}

.skip-link:focus {
	transform: translateY(0);
}

/* 2. Buttons --------------------------------------------------------------
   Same markup as the core Buttons block (used in the header, the 404 page
   and the homepage blocks). Add the class ns-btn (plus ns-btn--dark or
   ns-btn--ghost) to a Button block to get these styles in the editor. */
.wp-block-buttons {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

.ns-btn .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	padding: 15px 26px;
	border: 2px solid transparent;
	border-radius: 999px;
	background: #55B795;
	color: #fff;
	font-family: "Figtree", "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

.ns-btn .wp-block-button__link:hover {
	background: #20212D;
	color: #fff;
}

.ns-btn--dark .wp-block-button__link {
	background: #20212D;
	color: #fff;
}

.ns-btn--dark .wp-block-button__link:hover {
	background: #55B795;
	color: #20212D;
}

.ns-btn--ghost .wp-block-button__link {
	padding-top: 12px;
	padding-bottom: 12px;
	border-color: #20212D;
	background: transparent;
	color: #20212D;
}

.ns-btn--ghost .wp-block-button__link:hover {
	background: #20212D;
	color: #fff;
}

/* Full-width buttons: add the class ns-buttons--block to a Buttons block */
.ns-buttons--block .ns-btn,
.ns-buttons--block .ns-btn .wp-block-button__link {
	width: 100%;
}

/* 3. Header ---------------------------------------------------------------- */
.ns-header {
	position: sticky;
	top: 0;
	z-index: 100;
	width: 100%;
	padding: 0 40px;
	border-bottom: 1px solid #D9E3E0;
	background: rgba(255, 255, 255, .94);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
}

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

.ns-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	max-width: 1280px;
	min-height: 76px;
	margin: 0 auto;
}

.ns-header__cta {
	flex: none;
}

.ns-header__cta .wp-block-button__link {
	padding: 11px 20px;
	font-size: 15px;
}

/* Logo (custom logo or the bundled fallback) */
.ns-logo {
	flex: none;
	line-height: 0;
}

.ns-logo a {
	display: block;
}

.ns-logo img {
	display: block;
	width: 100%;
	height: auto;
}

.ns-header .ns-logo {
	width: 80px;
}

.ns-footer .ns-logo {
	width: 112px;
}

/* 4. Navigation ------------------------------------------------------------ */
.ns-nav {
	display: flex;
	align-items: center;
}

.ns-nav__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ns-nav__link {
	color: #20212D;
	text-decoration: none;
}

.ns-nav--primary {
	flex: 1;
	justify-content: center;
	font-size: 16px;
	font-weight: 500;
}

.ns-nav--primary .ns-nav__list {
	gap: 4px;
}

.ns-nav--primary .ns-nav__link {
	display: block;
	padding: 9px 14px;
	border-radius: 999px;
	transition: background-color .2s ease;
}

.ns-nav--primary .ns-nav__link:hover,
.ns-nav--primary .current-menu-item > .ns-nav__link {
	background: #E5F8F2;
}

/* Mobile menu buttons: hidden on desktop, shown at 860px and below */
.ns-nav__toggle,
.ns-nav__close {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: #20212D;
	cursor: pointer;
}

.ns-nav__toggle svg,
.ns-nav__close svg {
	display: block;
}

.ns-nav--footer {
	font-size: 15px;
	font-weight: 500;
}

.ns-nav--footer .ns-nav__list {
	gap: 8px 24px;
}

.ns-nav--footer .ns-nav__link:hover {
	text-decoration: underline;
	text-underline-offset: 4px;
}

/* Lock page scroll while the mobile menu is open */
body.ns-menu-open {
	overflow: hidden;
}

/* 5. Footer ---------------------------------------------------------------- */
.ns-footer {
	width: 100%;
	margin: 0;
	padding: 56px 40px;
	background: #fff;
}

.ns-footer__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	max-width: 1280px;
	margin: 0 auto;
}

.ns-footer__copy {
	width: 100%;
	margin: 0;
	padding-top: 24px;
	border-top: 1px solid #D9E3E0;
	color: #4A4B57;
	font-size: 14px;
}

/* 6. Form fields (contact form, search form, comment form) ----------------- */
.ns-form input[type="text"],
.ns-form input[type="email"],
.ns-form input[type="tel"],
.ns-form textarea,
.ns-form select,
.search-form .search-field,
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
	width: 100%;
	padding: 14px 16px;
	border: 1.5px solid #868B95;
	border-radius: 12px;
	background: #fff;
	color: #20212D;
	font: inherit;
	font-size: 16px;
	transition: border-color .2s ease, box-shadow .2s ease;
}

.ns-form input:focus,
.ns-form textarea:focus,
.ns-form select:focus,
.search-form .search-field:focus,
.comment-form input:focus,
.comment-form textarea:focus {
	outline: none;
	border-color: #20212D;
	box-shadow: 0 0 0 3px #E5F8F2, 0 0 0 5px #55B795;
}

.ns-form input[type="submit"],
.ns-form button[type="submit"],
.search-form .search-submit,
.comment-form .submit {
	padding: 15px 28px;
	border: 2px solid transparent;
	border-radius: 999px;
	background: #20212D;
	color: #fff;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease;
}

.ns-form input[type="submit"]:hover,
.ns-form button[type="submit"]:hover,
.search-form .search-submit:hover,
.comment-form .submit:hover {
	background: #55B795;
	color: #20212D;
}

.search-form {
	display: flex;
	gap: 12px;
	max-width: 520px;
}

.search-form label {
	flex: 1;
}

/* 7. Inner pages: pages, posts, archives, search, 404 ---------------------- */
.ns-main {
	padding: 64px 40px 88px;
}

.ns-container {
	max-width: 1280px;
	margin: 0 auto;
}

.ns-page-header {
	max-width: 760px;
	margin: 0 auto 48px;
	text-align: center;
}

.ns-page-title,
.ns-entry__title {
	margin: 0;
	font-size: 52px;
	line-height: 1.08;
}

.ns-archive-description {
	margin-top: 16px;
	color: #4A4B57;
}

.ns-archive-description p {
	margin: 0;
}

.ns-entry__header {
	max-width: 760px;
	margin: 0 auto 40px;
}

.ns-entry__meta {
	margin: 16px 0 0;
	color: #4A4B57;
	font-size: 15px;
}

.ns-entry__meta a {
	color: inherit;
}

.ns-entry__thumbnail {
	max-width: 1040px;
	margin: 0 auto 48px;
}

.ns-entry__thumbnail img {
	display: block;
	width: 100%;
	border-radius: 24px;
}

/* Post content (block editor output) */
.ns-entry-content > * {
	max-width: 760px;
	margin: 0 auto 24px;
}

.ns-entry-content > *:last-child {
	margin-bottom: 0;
}

.ns-entry-content > .alignwide {
	max-width: 1200px;
}

.ns-entry-content > .alignfull {
	max-width: none;
	margin-left: -40px;
	margin-right: -40px;
}

.ns-entry-content h2 {
	margin-top: 48px;
	font-size: 34px;
	line-height: 1.15;
}

.ns-entry-content h3 {
	margin-top: 40px;
	font-size: 26px;
	line-height: 1.2;
}

.ns-entry-content h4 {
	margin-top: 32px;
	font-size: 21px;
	line-height: 1.25;
}

.ns-entry-content a {
	text-decoration-color: #55B795;
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

.ns-entry-content blockquote {
	padding: 24px 28px;
	border-left: 4px solid #55B795;
	border-radius: 0 16px 16px 0;
	background: #E5F8F2;
}

.ns-entry-content blockquote p {
	margin: 0;
}

.ns-entry-content table {
	width: 100%;
	border-collapse: collapse;
}

.ns-entry-content th,
.ns-entry-content td {
	padding: 10px 14px;
	border: 1px solid #D9E3E0;
	text-align: left;
}

.ns-entry-content pre {
	overflow-x: auto;
	padding: 20px;
	border-radius: 12px;
	background: #E5F8F2;
}

.ns-entry-content figcaption,
.wp-caption-text {
	margin-top: 8px;
	color: #4A4B57;
	font-size: 14px;
}

.alignleft {
	float: left;
	margin: 0 24px 16px 0;
}

.alignright {
	float: right;
	margin: 0 0 16px 24px;
}

.aligncenter {
	display: block;
	margin-left: auto;
	margin-right: auto;
}

.ns-entry__footer {
	max-width: 760px;
	margin: 48px auto 0;
	padding-top: 24px;
	border-top: 1px solid #D9E3E0;
	color: #4A4B57;
	font-size: 15px;
}

.page-links {
	margin-top: 32px;
	font-weight: 600;
}

/* Previous / next post */
.post-navigation {
	max-width: 760px;
	margin: 48px auto 0;
}

.post-navigation .nav-links {
	display: flex;
	justify-content: space-between;
	gap: 24px;
}

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

.post-navigation a {
	display: block;
	text-decoration: none;
}

.post-navigation .ns-post-nav__label {
	display: block;
	color: #4A4B57;
	font-size: 14px;
}

.post-navigation .ns-post-nav__title {
	font-family: "Quicksand", "Nunito", "Avenir Next", "Segoe UI", sans-serif;
	font-size: 19px;
	font-weight: 600;
}

/* Post cards (blog, archive, search) */
.ns-posts {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
}

.ns-card {
	display: flex;
	flex-direction: column;
	padding: 12px 12px 24px;
	border: 1px solid #D9E3E0;
	border-radius: 24px;
	background: #fff;
}

.ns-card__media {
	display: block;
	overflow: hidden;
	border-radius: 16px;
	background: #E5F8F2;
}

.ns-card__media img {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
}

.ns-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 10px;
	padding: 20px 12px 0;
}

.ns-card__meta {
	margin: 0;
	color: #4A4B57;
	font-size: 14px;
}

.ns-card__title {
	margin: 0;
	font-size: 22px;
	line-height: 1.25;
}

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

.ns-card__title a:hover {
	text-decoration: underline;
}

.ns-card__excerpt {
	color: #4A4B57;
	font-size: 16px;
}

.ns-card__excerpt p {
	margin: 0;
}

.ns-card__more {
	margin-top: auto;
	font-weight: 600;
	text-decoration-color: #55B795;
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

/* Pagination */
.pagination {
	margin-top: 56px;
}

.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
}

.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 14px;
	border: 1px solid #D9E3E0;
	border-radius: 999px;
	font-weight: 600;
	text-decoration: none;
}

.pagination a.page-numbers:hover {
	background: #E5F8F2;
}

.pagination .page-numbers.current {
	border-color: #20212D;
	background: #20212D;
	color: #fff;
}

.pagination .page-numbers.dots {
	border-color: transparent;
}

/* Empty results + 404 */
.ns-empty {
	max-width: 760px;
	margin: 0 auto;
	text-align: center;
}

.ns-empty .search-form,
.ns-404 .search-form {
	margin: 32px auto 0;
}

.ns-404 {
	max-width: 1344px;
	margin: 0 auto;
	padding: 88px 64px;
	border-radius: 48px;
	background: #E5F8F2;
	text-align: center;
}

.ns-404__code {
	margin: 0;
	font-family: "Quicksand", "Nunito", "Avenir Next", "Segoe UI", sans-serif;
	font-size: 120px;
	font-weight: 700;
	line-height: 1;
}

.ns-404__text {
	max-width: 520px;
	margin: 16px auto 32px;
	color: #4A4B57;
}

.ns-404 .wp-block-buttons {
	justify-content: center;
}

/* Comments */
.ns-comments {
	max-width: 760px;
	margin: 64px auto 0;
	padding-top: 40px;
	border-top: 1px solid #D9E3E0;
}

.ns-comments__title,
.comment-reply-title {
	margin: 0 0 24px;
	font-size: 28px;
	line-height: 1.2;
}

.comment-list,
.comment-list .children {
	margin: 0;
	padding: 0;
	list-style: none;
}

.comment-list .children {
	padding-left: 32px;
}

.comment-body {
	margin-bottom: 24px;
	padding-bottom: 24px;
	border-bottom: 1px solid #D9E3E0;
}

.comment-meta {
	margin-bottom: 8px;
	font-size: 15px;
}

.comment-author .avatar {
	float: left;
	margin-right: 12px;
	border-radius: 50%;
}

.comment-metadata {
	color: #4A4B57;
	font-size: 14px;
}

.comment-metadata a {
	color: inherit;
}

.comment-form label {
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
	font-weight: 600;
}

.comment-form .comment-form-cookies-consent label {
	display: inline;
	font-weight: 400;
}

.ns-comments__closed {
	color: #4A4B57;
}

/* 8. Responsive ------------------------------------------------------------ */
@media (max-width: 1080px) {
	.ns-posts {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.ns-page-title,
	.ns-entry__title {
		font-size: 44px;
	}
}

@media (max-width: 960px) {
	.ns-nav--primary {
		font-size: 15px;
	}

	.ns-nav--primary .ns-nav__link {
		padding: 8px 10px;
	}
}

@media (max-width: 860px) {
	/* backdrop-filter makes the header the containing block for fixed
	   children, which would squash the full-screen menu into the header bar,
	   so it is switched off where the mobile menu is used. */
	.ns-header {
		padding: 0 24px;
		background: #fff;
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
	}

	.ns-nav--primary {
		flex: none;
		order: 3;
	}

	.ns-header__cta {
		margin-left: auto;
	}

	.ns-nav__toggle {
		display: flex;
	}

	.ns-nav__panel:not(.is-menu-open) {
		display: none;
	}

	.ns-nav__panel.is-menu-open {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 1000;
		display: block;
		padding: 80px 24px 32px;
		overflow-y: auto;
		background: #fff;
	}

	.admin-bar .ns-nav__panel.is-menu-open {
		top: 32px;
	}

	.ns-nav__panel.is-menu-open .ns-nav__close {
		display: flex;
		position: absolute;
		top: 16px;
		right: 24px;
	}

	.ns-nav__panel.is-menu-open .ns-nav__list {
		flex-direction: column;
		align-items: stretch;
		gap: 4px;
	}

	.ns-nav__panel.is-menu-open .ns-nav__link {
		padding: 10px 0;
		border-radius: 0;
		background: none;
		font-family: "Quicksand", "Nunito", "Avenir Next", "Segoe UI", sans-serif;
		font-size: 20px;
		font-weight: 600;
		line-height: 1.3;
	}

	.ns-footer {
		padding: 48px 24px;
	}

	.ns-main {
		padding: 48px 24px 64px;
	}

	.ns-entry-content > .alignfull {
		margin-left: -24px;
		margin-right: -24px;
	}

	.ns-404 {
		padding: 64px 40px;
	}
}

@media (max-width: 782px) {
	.admin-bar .ns-header,
	.admin-bar .ns-nav__panel.is-menu-open {
		top: 46px;
	}
}

@media (max-width: 600px) {
	/* The admin bar scrolls away on small screens, so the header sits at 0 */
	.admin-bar .ns-header {
		top: 0;
	}

	.ns-header {
		padding: 0 20px;
	}

	.ns-header__inner {
		gap: 12px;
		min-height: 64px;
	}

	.ns-header__cta .wp-block-button__link {
		padding: 10px 16px;
		font-size: 14px;
	}

	.ns-nav__panel.is-menu-open {
		padding: 80px 20px 32px;
	}

	.ns-nav__panel.is-menu-open .ns-nav__close {
		top: 10px;
		right: 20px;
	}

	/* Logged-in users: keep the close button clear of the 46px admin bar */
	.admin-bar .ns-nav__panel.is-menu-open {
		top: 0;
		padding-top: 126px;
	}

	.admin-bar .ns-nav__panel.is-menu-open .ns-nav__close {
		top: 56px;
	}

	.ns-footer {
		padding: 40px 20px;
	}

	.ns-footer__inner {
		flex-direction: column;
		align-items: flex-start;
	}

	.ns-main {
		padding: 40px 20px 56px;
	}

	.ns-page-title,
	.ns-entry__title {
		font-size: 34px;
	}

	.ns-page-header {
		margin-bottom: 32px;
	}

	.ns-entry-content > .alignfull {
		margin-left: -20px;
		margin-right: -20px;
	}

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

	.ns-posts {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}

	.post-navigation .nav-links {
		flex-direction: column;
	}

	.post-navigation .nav-next {
		text-align: left;
	}

	.search-form {
		flex-direction: column;
	}

	.ns-404 {
		padding: 44px 20px;
		border-radius: 28px;
	}

	.ns-404__code {
		font-size: 88px;
	}
}

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

