/*
Theme Name:  kstudio-melon
Theme URI:   https://github.com/your-org/kstudio-melon
Author:      Szymon Baczyński
Author URI:  https://szymonbaczynski.pl
Description: A custom WordPress theme for the KStudio Melon project.
Version:     1.0.2
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 8.1
License:     GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: kstudio-melon
*/

/*
 * Base header styles — always loaded (before/without Vite build).
 * Compiled SCSS in assets/css/main.css overrides these when the build runs.
 */

*, *::before, *::after { box-sizing: border-box; }

body {
	margin: 0;
	font-family: 'Montserrat', sans-serif;
	font-weight: 300;
	color: #1a1a1a;
	background: #ffffff;
}

.site { display: flex; flex-direction: column; min-height: 100dvh; }

/* Fixed header shell — opaque white by default on all pages */
.site-header {
	position: fixed;
	top: 0; left: 0; right: 0;
	z-index: 100;
	height: 80px;
	padding: 0 3rem;
	background: rgba(255,255,255,0.97);
	box-shadow: 0 1px 0 rgba(0,0,0,0.08);
	transition: background 0.4s ease, box-shadow 0.4s ease;
}

/* Use #masthead for higher specificity so this beats the compiled SCSS version */
#masthead .site-header__inner {
	display: grid;
	grid-template-columns: 1fr auto 1fr auto;
	align-items: center;
	height: 100%;
	gap: 2rem;
}

/* Transparent state — hero pages only (front page, single project) */
.site-header--transparent {
	background: transparent;
	box-shadow: none;
}
.site-header--transparent .site-title,
.site-header--transparent .nav-menu a { color: rgba(255,255,255,0.9); }
.site-header--transparent .menu-toggle__bar { background: rgba(255,255,255,0.9); }

/* Opaque state — after scroll (JS adds .is-scrolled to transparent headers) */
.site-header.is-scrolled {
	background: rgba(255,255,255,0.97);
	box-shadow: 0 1px 0 rgba(0,0,0,0.08);
}
.site-header.is-scrolled .site-title,
.site-header.is-scrolled .nav-menu a { color: #1a1a1a; }
.site-header.is-scrolled .menu-toggle__bar { background: #1a1a1a; }

/* Site title / logo */
.site-branding { text-align: center; }
.site-title {
	font-family: 'Montserrat', sans-serif;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: #1a1a1a;
	text-decoration: none;
	white-space: nowrap;
	transition: color 0.3s ease, opacity 0.3s ease;
}
.site-title:hover { opacity: 0.65; }
.custom-logo-link img { height: 48px; width: auto; display: block; margin: 0 auto; }

/* Desktop nav */
.site-nav { display: flex; align-items: center; }
.site-nav--left { justify-content: flex-end; }
.site-nav--right { justify-content: flex-start; }
.nav-menu {
	display: flex; align-items: center; gap: 2rem;
	margin: 0; padding: 0; list-style: none;
}
.nav-menu a {
	font-size: 0.68rem; font-weight: 400;
	letter-spacing: 0.14em; text-transform: uppercase;
	color: #1a1a1a;
	text-decoration: none;
	transition: opacity 0.2s ease;
}
.nav-menu a:hover { opacity: 0.65; }

/* Language switcher */
.lang-switcher {
	display: flex; align-items: center; gap: 0.5rem;
	grid-column: 4; grid-row: 1; /* stay in the header row regardless of grid column count */
}
.lang-switcher__item {
	font-size: 0.6rem; font-weight: 400;
	letter-spacing: 0.14em; text-transform: uppercase;
	color: #1a1a1a; text-decoration: none;
	transition: opacity 0.2s ease;
}
.lang-switcher__item.is-active { font-weight: 600; }
.lang-switcher__item:not(.is-active) { opacity: 0.4; }
.lang-switcher__item:not(.is-active):hover { opacity: 0.9; }
.lang-switcher__item + .lang-switcher__item::before {
	content: '/'; margin-right: 0.5rem; opacity: 0.25;
}
/* Transparent header */
.site-header--transparent .lang-switcher__item { color: rgba(255,255,255,0.8); }
.site-header--transparent .lang-switcher__item.is-active { color: #ffffff; }
/* Scrolled / opaque header */
.site-header.is-scrolled .lang-switcher__item { color: #1a1a1a; }
.site-header.is-scrolled .lang-switcher__item.is-active { color: #1a1a1a; opacity: 1; }
/* Footer */
.site-footer .lang-switcher { gap: 0.4rem; }
.site-footer .lang-switcher__item { color: rgba(255,255,255,0.35); }
.site-footer .lang-switcher__item.is-active { color: rgba(255,255,255,0.7); font-weight: 600; opacity: 1; }
.site-footer .lang-switcher__item:not(.is-active):hover { color: rgba(255,255,255,0.7); opacity: 1; }

/* Hamburger */
.menu-toggle {
	display: none; flex-direction: column; justify-content: center;
	gap: 6px; background: none; border: none; cursor: pointer;
	padding: 8px; grid-column: 4; justify-self: end;
}
.menu-toggle__bar {
	display: block; width: 22px; height: 1px;
	background: #1a1a1a;
	transition: transform 0.3s ease, opacity 0.2s ease;
}
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav */
.mobile-nav {
	position: fixed; top: 80px; left: 0; right: 0; bottom: 0;
	background: rgba(26,26,26,0.97);
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	z-index: 99; overflow-y: auto;
}
.mobile-nav[hidden] { display: none; }
.mobile-nav__list { margin: 0; padding: 0; list-style: none; text-align: center; }
.mobile-nav__list li { padding: 0.75rem 0; }
.mobile-nav__list a {
	font-size: 0.78rem; font-weight: 300;
	letter-spacing: 0.2em; text-transform: uppercase;
	color: rgba(255,255,255,0.7); text-decoration: none;
}
.mobile-nav__list a:hover { color: #ffffff; }
.nav-is-open { overflow: hidden; }

/* Skip link */
.skip-link.screen-reader-text {
	position: absolute; width: 1px; height: 1px;
	padding: 0; margin: -1px; overflow: hidden;
	clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link:focus {
	width: auto; height: auto; clip: auto;
	padding: 0.5rem 1rem; background: #1a1a1a; color: #fff;
	z-index: 200; top: 0; left: 0;
}

/* Footer base */
.site-footer {
	padding: 3rem;
	background: #1a1a1a;
}
.site-footer__inner {
	display: flex; flex-wrap: wrap; align-items: center;
	justify-content: space-between; gap: 1.5rem;
	max-width: 1200px; margin: 0 auto;
}
.site-info {
	font-size: 0.65rem; font-weight: 300;
	letter-spacing: 0.1em; color: rgba(255,255,255,0.35);
}
.site-info a { color: rgba(255,255,255,0.35); text-decoration: none; }

@media (max-width: 767px) {
	.site-nav { display: none; }
	.menu-toggle { display: flex; grid-column: 3; grid-row: 1; }
	#masthead .site-header__inner { grid-template-columns: 1fr auto auto; }
	.site-branding { justify-self: start; }
	.lang-switcher { grid-column: 2; grid-row: 1; }
}
