/*
Theme Name: Nocturne
Description: A dark, bold child theme for Twenty Twenty-Five with a dark/light toggle in the header and products on the front page. Everything else comes from the parent theme. Fonts: Bricolage Grotesque and Instrument Sans (SIL Open Font License, bundled locally).
Author: Morten
Template: twentytwentyfive
Version: 1.1.0
Requires at least: 6.7
Tested up to: 7.1
Requires PHP: 7.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tt5-nocturne
*/

/* ------------------------------------------------------------------
   Tokens
   ------------------------------------------------------------------ */
:root {
	color-scheme: dark;
	--nocturne-radius: 18px;
	--nocturne-radius-sm: 12px;
	--nocturne-line: rgba(244, 242, 236, 0.10);
	--nocturne-line-strong: rgba(244, 242, 236, 0.22);
	--nocturne-glow: rgba(212, 255, 63, 0.35);
	--nocturne-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	--nocturne-accent-ink: #D4FF3F;
	--nocturne-on-accent: #0C0D10;
}

::selection {
	background: var(--wp--preset--color--accent-1);
	color: var(--nocturne-on-accent);
}

/* ------------------------------------------------------------------
   Atmosphere: soft colored glows at the top of the page
   ------------------------------------------------------------------ */
body {
	background-color: var(--wp--preset--color--base);
	background-image:
		radial-gradient(1100px 520px at 88% -8%, rgba(212, 255, 63, 0.07), transparent 62%),
		radial-gradient(900px 520px at -8% 4%, rgba(157, 140, 255, 0.09), transparent 60%);
	background-repeat: no-repeat;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

.wp-site-blocks > main {
	animation: nocturne-fade 0.5s var(--nocturne-ease) both;
}

@keyframes nocturne-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* ------------------------------------------------------------------
   Glassy sticky header
   (blur lives on a pseudo-element so the mobile menu overlay and the
   mini-cart drawer keep covering the full screen)
   ------------------------------------------------------------------ */
.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 100;
	isolation: isolate;
	border-bottom: 1px solid var(--nocturne-line);
}

.wp-site-blocks > header.wp-block-template-part::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: color-mix(in srgb, var(--wp--preset--color--base) 72%, transparent);
	-webkit-backdrop-filter: blur(16px) saturate(150%);
	backdrop-filter: blur(16px) saturate(150%);
	pointer-events: none;
}

@media (max-width: 600px) {
	.wp-site-blocks > header.wp-block-template-part {
		top: 0;
	}
}

.wp-block-site-title a:hover {
	color: var(--nocturne-accent-ink);
	text-decoration: none;
}

.wp-block-navigation .wp-block-navigation-item__content {
	transition: color 0.2s var(--nocturne-ease);
}

.wp-block-navigation .wp-block-navigation-item__content:hover {
	color: var(--nocturne-accent-ink);
	text-decoration: none;
}

.wc-block-mini-cart__badge {
	background: var(--wp--preset--color--accent-1) !important;
	color: var(--nocturne-on-accent) !important;
	font-weight: 700;
}

/* ------------------------------------------------------------------
   Typography details
   ------------------------------------------------------------------ */
h1, h2, h3, h4, h5, h6,
.wp-block-post-title {
	text-wrap: balance;
}

p {
	text-wrap: pretty;
}

.wp-block-post-content a:not(.wp-element-button),
.entry-content a:not(.wp-element-button) {
	text-decoration-color: var(--nocturne-accent-ink);
	text-decoration-thickness: 1.5px;
	text-underline-offset: 0.2em;
}

/* Accent backgrounds are bright, so text on them stays dark */
.has-accent-1-background-color:not(.has-text-color),
.has-accent-2-background-color:not(.has-text-color),
.has-accent-3-background-color:not(.has-text-color) {
	color: var(--nocturne-on-accent);
}

/* ------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------ */
.wp-element-button,
.wp-block-button__link,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit {
	transition:
		background-color 0.2s var(--nocturne-ease),
		color 0.2s var(--nocturne-ease),
		box-shadow 0.25s var(--nocturne-ease),
		transform 0.2s var(--nocturne-ease);
}

.wp-element-button:hover,
.wp-block-button__link:hover {
	box-shadow: 0 10px 30px -10px var(--nocturne-glow);
	transform: translateY(-1px);
}

.wp-element-button:active,
.wp-block-button__link:active {
	transform: translateY(0);
}

.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce a.button.alt,
.woocommerce button.button.alt {
	background-color: var(--wp--preset--color--accent-1);
	color: var(--wp--preset--color--base);
	border-radius: 999px;
	font-weight: 600;
}

.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover {
	background-color: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
}

/* ------------------------------------------------------------------
   Forms (WordPress, WooCommerce classic + block checkout)
   ------------------------------------------------------------------ */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="date"],
select,
textarea,
.wc-block-components-text-input input,
.wc-block-components-textarea,
.wc-blocks-components-select .wc-blocks-components-select__select,
.wc-block-components-combobox .wc-block-components-combobox-control input,
.woocommerce form .form-row .input-text,
.woocommerce form .form-row select {
	background-color: var(--wp--preset--color--accent-5) !important;
	color: var(--wp--preset--color--contrast) !important;
	border: 1px solid var(--nocturne-line-strong) !important;
	border-radius: var(--nocturne-radius-sm) !important;
	transition: border-color 0.2s var(--nocturne-ease), box-shadow 0.2s var(--nocturne-ease);
}

input:focus,
select:focus,
textarea:focus,
.wc-block-components-text-input input:focus,
.wc-blocks-components-select .wc-blocks-components-select__select:focus {
	border-color: var(--nocturne-accent-ink) !important;
	box-shadow: 0 0 0 3px rgba(212, 255, 63, 0.18) !important;
	outline: none;
}

select option {
	background-color: var(--wp--preset--color--accent-5);
	color: var(--wp--preset--color--contrast);
}

::placeholder {
	color: var(--wp--preset--color--accent-4);
	opacity: 1;
}

.wc-block-components-text-input label,
.wc-block-components-textarea + label,
.wc-blocks-components-select .wc-blocks-components-select__label,
.wc-block-components-combobox .wc-block-components-combobox-control label {
	color: var(--wp--preset--color--accent-4) !important;
}

.wc-blocks-components-select .wc-blocks-components-select__expand {
	fill: var(--wp--preset--color--contrast);
}

input[type="checkbox"],
input[type="radio"] {
	accent-color: var(--nocturne-accent-ink);
}

/* ------------------------------------------------------------------
   WooCommerce: products
   ------------------------------------------------------------------ */
.wc-block-product,
.wc-block-grid__product,
.woocommerce ul.products li.product {
	background: var(--wp--preset--color--accent-5);
	border: 1px solid var(--nocturne-line);
	border-radius: var(--nocturne-radius);
	padding: 14px 14px 20px;
	transition:
		transform 0.3s var(--nocturne-ease),
		border-color 0.3s var(--nocturne-ease),
		box-shadow 0.3s var(--nocturne-ease);
}

.wc-block-product:hover,
.wc-block-grid__product:hover,
.woocommerce ul.products li.product:hover {
	transform: translateY(-4px);
	border-color: rgba(212, 255, 63, 0.45);
	box-shadow: 0 24px 50px -24px rgba(0, 0, 0, 0.8);
}

.wc-block-components-product-image img,
.wc-block-grid__product-image img,
.woocommerce ul.products li.product a img,
.woocommerce div.product div.images img,
.wc-block-components-product-image {
	border-radius: var(--nocturne-radius-sm);
}

.wc-block-components-product-price,
.wc-block-grid__product-price,
.woocommerce .price {
	color: var(--wp--preset--color--contrast);
	font-weight: 600;
}

.wc-block-components-product-price ins,
.woocommerce .price ins {
	color: var(--nocturne-accent-ink);
	text-decoration: none;
}

.wc-block-components-product-price del,
.woocommerce .price del {
	color: var(--wp--preset--color--accent-4);
}

.wc-block-components-product-sale-badge,
.woocommerce span.onsale {
	background: var(--wp--preset--color--accent-2) !important;
	color: var(--nocturne-on-accent) !important;
	border: 0 !important;
	border-radius: 999px !important;
	font-weight: 700;
	letter-spacing: 0.04em;
}

/* ------------------------------------------------------------------
   WooCommerce: cart, checkout, account, mini-cart
   ------------------------------------------------------------------ */
.wc-block-components-sidebar .wc-block-components-panel,
.wc-block-components-totals-wrapper,
.wp-block-woocommerce-checkout-order-summary-block,
.wc-block-cart .wc-block-cart__totals-title {
	border-color: var(--nocturne-line) !important;
}

.wp-block-woocommerce-checkout-order-summary-block,
.wc-block-components-radio-control-accordion-option,
.wc-block-components-radio-control__option {
	border-radius: var(--nocturne-radius-sm);
}

.wc-block-checkout__payment-method .wc-block-components-radio-control-accordion-option,
.wc-block-checkout__shipping-option .wc-block-components-radio-control__option {
	border-color: var(--nocturne-line-strong) !important;
}

.wc-block-components-radio-control--highlight-checked .wc-block-components-radio-control-accordion-option--checked-option-highlighted,
.wc-block-components-radio-control--highlight-checked label.wc-block-components-radio-control__option--checked-option-highlighted {
	box-shadow: inset 0 0 0 2px var(--nocturne-accent-ink) !important;
}

.wc-block-mini-cart__drawer .components-modal__content,
.wc-block-components-drawer {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

.wc-block-components-drawer__screen-overlay {
	background-color: rgba(0, 0, 0, 0.6);
}

.woocommerce table.shop_table,
.woocommerce table.shop_table td,
.woocommerce table.shop_table th,
.woocommerce-cart table.cart td.actions .coupon .input-text {
	border-color: var(--nocturne-line) !important;
}

.woocommerce table.shop_table {
	border-radius: var(--nocturne-radius);
	overflow: hidden;
}

.woocommerce-MyAccount-navigation ul {
	list-style: none;
	padding: 0;
}

.woocommerce-MyAccount-navigation li a {
	display: block;
	padding: 0.55rem 0.9rem;
	border-radius: 999px;
	text-decoration: none;
}

.woocommerce-MyAccount-navigation li.is-active a,
.woocommerce-MyAccount-navigation li a:hover {
	background: var(--wp--preset--color--accent-5);
	color: var(--nocturne-accent-ink);
}

/* ------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------ */
.wp-site-blocks > footer.wp-block-template-part {
	border-top: 1px solid var(--nocturne-line);
	margin-block-start: var(--wp--preset--spacing--60);
}

/* ------------------------------------------------------------------
   Accessibility: keyboard focus and reduced motion
   ------------------------------------------------------------------ */
:where(a, button, [role="button"], summary):focus-visible {
	outline: 2px solid var(--nocturne-accent-ink);
	outline-offset: 3px;
	border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}

	.wc-block-product:hover,
	.wc-block-grid__product:hover,
	.woocommerce ul.products li.product:hover,
	.wp-element-button:hover,
	.wp-block-button__link:hover {
		transform: none;
	}
}

/* ------------------------------------------------------------------
   Theme toggle button (header)
   ------------------------------------------------------------------ */
.nocturne-theme-toggle {
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 40px;
	height: 40px;
	padding: 0;
	margin: 0;
	border: 1px solid var(--nocturne-line-strong);
	border-radius: 999px;
	background: transparent;
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
	transition:
		color 0.2s var(--nocturne-ease),
		border-color 0.2s var(--nocturne-ease),
		background-color 0.2s var(--nocturne-ease);
}

.nocturne-theme-toggle:hover {
	color: var(--nocturne-accent-ink);
	border-color: var(--nocturne-accent-ink);
}

.nocturne-theme-toggle svg {
	grid-area: 1 / 1;
	transition: opacity 0.25s var(--nocturne-ease), transform 0.35s var(--nocturne-ease);
}

/* Dark mode shows the sun (switch to light); light mode shows the moon */
.nocturne-theme-toggle .nocturne-icon-moon {
	opacity: 0;
	transform: rotate(-60deg) scale(0.6);
}

html[data-theme="light"] .nocturne-theme-toggle .nocturne-icon-sun {
	opacity: 0;
	transform: rotate(60deg) scale(0.6);
}

html[data-theme="light"] .nocturne-theme-toggle .nocturne-icon-moon {
	opacity: 1;
	transform: none;
}

/* ------------------------------------------------------------------
   Light mode
   ------------------------------------------------------------------ */
html[data-theme="light"],
html[data-theme="light"] body {
	color-scheme: light;
	--wp--preset--color--base: #F6F5F0;
	--wp--preset--color--contrast: #121316;
	--wp--preset--color--accent-2: #E2502F;
	--wp--preset--color--accent-3: #5F4FE0;
	--wp--preset--color--accent-4: #5B606B;
	--wp--preset--color--accent-5: #FFFFFF;
	--nocturne-line: rgba(18, 19, 22, 0.10);
	--nocturne-line-strong: rgba(18, 19, 22, 0.22);
	--nocturne-glow: rgba(18, 19, 22, 0.25);
	--nocturne-accent-ink: #4A6300;
}

html[data-theme="light"] body {
	background-image:
		radial-gradient(1100px 520px at 88% -8%, rgba(212, 255, 63, 0.28), transparent 62%),
		radial-gradient(900px 520px at -8% 4%, rgba(157, 140, 255, 0.16), transparent 60%);
}

html[data-theme="light"] .has-accent-3-background-color:not(.has-text-color) {
	color: #FFFFFF;
}

/* Lime on near-white has no edge, so light-mode buttons go ink-dark */
html[data-theme="light"] .wp-element-button:not(.has-background),
html[data-theme="light"] .wp-block-button:not(.is-style-outline) .wp-block-button__link:not(.has-background),
html[data-theme="light"] .woocommerce a.button,
html[data-theme="light"] .woocommerce button.button,
html[data-theme="light"] .woocommerce input.button,
html[data-theme="light"] .woocommerce #respond input#submit,
html[data-theme="light"] .woocommerce a.button.alt,
html[data-theme="light"] .woocommerce button.button.alt {
	background-color: var(--wp--preset--color--contrast);
	color: #D4FF3F;
}

html[data-theme="light"] .wp-element-button:not(.has-background):hover,
html[data-theme="light"] .wp-block-button:not(.is-style-outline) .wp-block-button__link:not(.has-background):hover,
html[data-theme="light"] .woocommerce a.button:hover,
html[data-theme="light"] .woocommerce button.button:hover,
html[data-theme="light"] .woocommerce a.button.alt:hover,
html[data-theme="light"] .woocommerce button.button.alt:hover {
	background-color: #D4FF3F;
	color: #121316;
}

html[data-theme="light"] .is-style-outline .wp-block-button__link:not(.has-background) {
	background-color: transparent;
	color: var(--wp--preset--color--contrast);
}

html[data-theme="light"] .wc-block-product:hover,
html[data-theme="light"] .wc-block-grid__product:hover,
html[data-theme="light"] .woocommerce ul.products li.product:hover {
	border-color: rgba(74, 99, 0, 0.45);
	box-shadow: 0 24px 50px -28px rgba(18, 19, 22, 0.35);
}

html[data-theme="light"] input:focus,
html[data-theme="light"] select:focus,
html[data-theme="light"] textarea:focus {
	box-shadow: 0 0 0 3px rgba(74, 99, 0, 0.18) !important;
}

/* Smooth hand-over when switching modes (not on first paint) */
html.nocturne-mode-switching body,
html.nocturne-mode-switching .wp-site-blocks * {
	transition:
		background-color 0.3s var(--nocturne-ease),
		color 0.3s var(--nocturne-ease),
		border-color 0.3s var(--nocturne-ease) !important;
}
