/*
Theme Name: Naturphoto
Theme URI: https://n-dib.net/wplug
Author: N-dib
Author URI: https://n-dib.net/wplug
Description: A theme for photographers: header with a photo that changes by category, a left column with search and navigation, colors selectable in the Customizer, ready for Polylang.
Version: 1.0.0
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: naturphoto
*/

/*
Naturphoto WordPress Theme, (C) 2026 N-dib (https://n-dib.net/wplug)
Naturphoto is distributed under the terms of the GNU General Public License v2 or later.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Bundled resource: the font Inter, (c) 2016 The Inter Project Authors, SIL Open Font License 1.1 (assets/fonts/Inter-LICENSE.txt).
*/

/* ---------- Fonts (local, no connection to Google) ---------- */
@font-face {
	font-family: "Inter";
	src: url("assets/fonts/InterVariable.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Inter";
	src: url("assets/fonts/Inter-Italic.woff2") format("woff2");
	font-weight: 400;
	font-style: italic;
	font-display: swap;
}

/* ---------- Colors: the defaults; the Customizer overrides them (inline style in the head) ---------- */
:root {
	--np-header-bg: #50635c;
	--np-header-title: #ffa31a;
	--np-header-text: #cfe9dd;
	--np-page-bg: #c0c9c6;
	--np-side-bg: #a0a9a6;
	--np-nav-text: #25292a;
	--np-nav-active: #632b00;
	--np-nav-line: #808986;
	--np-content-bg: #282828;
	--np-content-text: #c4c4c4;
	--np-content-heading: #d8d8d8;
	--np-link: #ffb340;
	--np-button-bg: #1c1c1c;
	--np-button-text: #e6e6e6;
	--np-footer-bg: #3a4742;
	--np-footer-text: #c9d3cf;

	--np-accent: var(--np-header-title); /* used by the owl mark */
	--np-surface: var(--np-header-bg);
	--np-side-w: 360px;
	--np-header-h: 165px;
}

/* ---------- Basics ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--np-content-bg);
	color: var(--np-content-text);
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 1.0625rem;
	line-height: 1.65;
}
img { max-width: 100%; height: auto; }
a { color: var(--np-link); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--np-header-text); outline-offset: 2px; }
.np-side :focus-visible { outline-color: var(--np-nav-text); }
.screen-reader-text {
	border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%); height: 1px; margin: -1px;
	overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal;
}
.skip-link:focus {
	clip: auto; clip-path: none; height: auto; width: auto; margin: 0; padding: 0.8rem 1.2rem; z-index: 100;
	left: 0.5rem; top: 0.5rem; background: var(--np-button-bg); color: var(--np-button-text); text-decoration: none;
}

.np-shell { display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- Header: [photo 360px] [title + breadcrumbs] ---------- */
.np-header {
	display: grid;
	background: var(--np-header-bg);
	min-height: var(--np-header-h);
}
/* The photo is scaled down proportionally to fit into the cell (header height x width of the left column).
   It is never cropped and never enlarged beyond its own size. */
.np-header__image {
	display: flex; align-items: center; justify-content: center;
	width: var(--np-side-w); min-width: var(--np-side-w); height: var(--np-header-h); overflow: hidden;
}
.np-header__image a { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.np-header__image img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 0; transition: opacity 0.4s; }
.np-header__mark { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--np-header-text); }
.np-header__mark svg { width: 6rem; height: 6rem; }

.np-header__main {
	display: flex; flex-direction: column; justify-content: space-between;
	padding: 1rem clamp(1rem, 3vw, 2rem) 1.6rem clamp(1rem, 3vw, 2.8rem);
	min-width: 0;
}
.np-header__row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.5rem 1.5rem; }
.np-site-title { margin: 0; font-size: clamp(1.6rem, 2.6vw, 2.3rem); font-weight: 300; letter-spacing: 0.08em; line-height: 1.2; }
.np-site-title a { color: var(--np-header-title); text-decoration: none; }
.np-site-title img { max-height: 5rem; width: auto; }

.np-lang { list-style: none; display: flex; gap: 0.9rem; margin: 0.4rem 0 0; padding: 0; font-size: 0.95rem; }
.np-lang a { color: var(--np-header-text); text-decoration: none; }
.np-lang a:hover { text-decoration: underline; }
.np-lang .current-lang a { font-weight: 700; text-decoration: underline; text-underline-offset: 0.3em; }

.np-breadcrumbs { color: var(--np-header-text); font-size: 0.95rem; display: flex; flex-wrap: wrap; gap: 0 0.7rem; align-items: baseline; }
.np-breadcrumbs__label { font-weight: 700; }
.np-breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; margin: 0; padding: 0; }
.np-breadcrumbs li + li::before { content: ">"; margin: 0 0.4rem; }
.np-breadcrumbs a { color: var(--np-header-text); text-decoration: none; }
.np-breadcrumbs a:hover { text-decoration: underline; }

/* ---------- Columns: [sidebar 360px] [content] ---------- */
.np-columns {
	flex: 1;
	display: grid;
}
.np-side { align-self: start; width: var(--np-side-w); min-width: var(--np-side-w); max-width: var(--np-side-w); }
.np-side__panel { overflow-wrap: anywhere; }
.np-side img, .np-side select, .np-side input, .np-side textarea, .np-side iframe, .np-side table { max-width: 100%; }
.np-side__panel { background: var(--np-side-bg); padding: 2rem 1.5rem 2.5rem; color: var(--np-nav-text); }
.np-nav-toggle { display: none; }

.np-main { min-width: 0; padding: clamp(2rem, 5vw, 4.5rem) clamp(1rem, 4vw, 3rem) 4rem clamp(1rem, 3vw, 2.8rem); }

/* Search */
.np-search { display: flex; gap: 0.5rem; margin: 0 0 1.8rem; }
.np-search__field {
	flex: 1; min-width: 0; font: inherit; font-size: 1rem; padding: 0.5rem 0.6rem;
	background: rgba(255, 255, 255, 0.6); color: #1b1d1e; border: 1px solid rgba(0, 0, 0, 0.35); border-radius: 2px;
}
.np-search__button, .wp-block-button__link, button.np-btn, input[type="submit"] {
	font: inherit; font-size: 1rem; cursor: pointer; padding: 0.5rem 0.9rem;
	background: var(--np-button-bg); color: var(--np-button-text); border: 1px solid var(--np-button-bg); border-radius: 2px;
}
.np-search__button:hover, .wp-block-button__link:hover, input[type="submit"]:hover { filter: brightness(1.25); }
.np-main .np-search__field { background: #fff; }

/* Navigation */
.np-menu, .np-menu ul { list-style: none; margin: 0; padding: 0; }
.np-menu > li { border-bottom: 1px solid var(--np-nav-line); }
.np-menu a { display: block; padding: 0.7rem 0; color: var(--np-nav-text); text-decoration: none; font-weight: 700; font-size: 1.2rem; }
.np-menu a:hover { text-decoration: underline; text-underline-offset: 0.3em; }
.np-menu .sub-menu, .np-menu .children { padding: 0 0 0.6rem 1rem; }
.np-menu .sub-menu a, .np-menu .children a { font-weight: 400; font-size: 1.05rem; padding: 0.3rem 0; }
.np-menu .current-menu-item > a, .np-menu .current-menu-ancestor > a,
.np-menu .current_page_item > a, .np-menu .current_page_ancestor > a { color: var(--np-nav-active); }
.np-menu .current-menu-item > a, .np-menu .current_page_item > a { text-decoration: underline; text-underline-offset: 0.3em; }

.np-nav--secondary { margin-top: 1.6rem; }
.np-menu--secondary > li { border-bottom: 0; }
.np-menu--secondary a { font-weight: 400; font-size: 1.05rem; padding: 0.3rem 0; }

.np-widgets { margin-top: 2rem; }
.np-widgets .widget { margin-bottom: 1.5rem; }
.np-widgets a { color: var(--np-nav-text); }
.widget-title { font-size: 1.1rem; margin: 0 0 0.5rem; }

/* ---------- Content ---------- */
.np-page-title, .np-main h1, .np-main h2, .np-main h3, .np-main h4 { color: var(--np-content-heading); font-weight: 300; letter-spacing: 0.04em; line-height: 1.25; }
.np-page-title, .np-main h1 { font-size: clamp(1.6rem, 2.6vw, 2.3rem); margin: 0 0 2rem; }
.np-main h2 { font-size: 1.6rem; }
.np-main h3 { font-size: 1.3rem; }
.np-meta { color: var(--np-content-text); opacity: 0.85; font-size: 0.95rem; margin: -1rem 0 1.5rem; }
.np-content > *, .np-entry .np-content { max-width: 100%; }
.np-content img { height: auto; }
.np-content .aligncenter { display: block; margin-left: auto; margin-right: auto; }
.np-content .alignleft { float: left; margin: 0 1.5rem 1rem 0; }
.np-content .alignright { float: right; margin: 0 0 1rem 1.5rem; }
.wp-caption-text, figcaption { font-size: 0.9rem; opacity: 0.85; }
.np-content::after { content: ""; display: block; clear: both; }
table { border-collapse: collapse; }
th, td { border: 1px solid var(--np-nav-line); padding: 0.4rem 0.7rem; }

/* List with thumbnails (portfolios, archives, search) */
.np-list { list-style: none; margin: 0; padding: 0; }
.np-list__item { display: flex; gap: 1.5rem; align-items: flex-start; margin: 0 0 2.2rem; }
.np-list__thumb { flex: none; width: 190px; }
.np-list__thumb img { display: block; width: 190px; height: auto; }
.np-list__title { margin: 0 0 0.3rem; font-size: 1.7rem; }
.np-list__title a { color: var(--np-content-heading); text-decoration: none; }
.np-list__title a:hover { color: var(--np-link); text-decoration: underline; }
.np-list__text p { margin: 0.3rem 0 0; }

.pagination, .post-navigation { margin-top: 2.5rem; }
.nav-links { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; justify-content: space-between; }
.pagination .nav-links { justify-content: flex-start; }
.page-numbers { padding: 0.2rem 0.6rem; }
.page-numbers.current { color: var(--np-content-heading); font-weight: 700; }

.comment-list { padding-left: 1.2rem; }

/* ---------- Footer ---------- */
.np-footer {
	display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.8rem 2rem;
	background: var(--np-footer-bg); color: var(--np-footer-text);
	font-size: 0.95rem;
}
.np-footer a { color: var(--np-footer-text); }
.np-footer__menu { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; margin: 0; padding: 0; }

/* ---------- Layout: a fixed distance to the left edge; in narrower windows the sidebar sticks to the edge ---------- */
.np-header, .np-columns { grid-template-columns: 64px 360px minmax(0, 1fr); }
.np-header__image, .np-side { grid-column: 2; }
.np-header__main, .np-main { grid-column: 3; }
.np-columns { background: linear-gradient(to right, var(--np-page-bg) 424px, var(--np-content-bg) 424px); }
.np-footer { padding: 1.6rem 3rem 1.6rem calc(424px + clamp(1rem, 3vw, 2.8rem)); }
@media (max-width: 999px) {
	.np-header, .np-columns { grid-template-columns: 360px minmax(0, 1fr); }
	.np-header__image, .np-side { grid-column: 1; }
	.np-header__main, .np-main { grid-column: 2; }
	.np-columns { background: linear-gradient(to right, var(--np-page-bg) 360px, var(--np-content-bg) 360px); }
	.np-footer { padding-left: calc(360px + clamp(1rem, 3vw, 2.8rem)); }
}

/* ---------- Lightbox: controls ABOVE the picture, text column on the right ---------- */
.np-content a[href$=".jpg"] > img, .np-content a[href$=".jpeg"] > img, .np-content a[href$=".png"] > img,
.np-content a[href$=".webp"] > img, .np-content a[href$=".gif"] > img, .np-content a[href$=".avif"] > img { cursor: zoom-in; }
.np-lb {
	--np-lb-bar: 4.5rem;
	position: fixed; inset: 0; z-index: 9999; display: flex;
	padding: 1rem; background: rgba(0, 0, 0, 0.94); overflow: auto;
}
.np-lb[hidden], .np-lb__panel[hidden], .np-lb [hidden] { display: none; }
.np-lb__dialog { display: flex; align-items: flex-start; max-width: 100%; margin: auto; }
.np-lb__main { display: flex; flex-direction: column; min-width: 0; }
.np-lb__bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: var(--np-lb-bar); }
.np-lb__group { display: flex; align-items: center; gap: 0.5rem; }
.np-lb__img {
	display: block; width: auto; height: auto; border-radius: 0; box-shadow: none;
	max-width: calc(100vw - 2rem); max-height: calc(100vh - var(--np-lb-bar) - 2rem);
}
.np-lb--info .np-lb__img { max-width: calc(100vw - 2rem - min(30rem, 36vw)); }
.np-lb__count { padding: 0.4rem 0.85rem; border-radius: 999px; background: rgba(40, 44, 50, 0.9); color: #fff; font-size: 0.95rem; line-height: 1.2; }
.np-lb__btn {
	display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; padding: 0; cursor: pointer;
	border: 0; border-radius: 50%; background: rgba(40, 44, 50, 0.9); color: #fff;
}
.np-lb__btn:hover { background: #3a3f47; }
.np-lb__btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.np-lb__panel {
	width: min(30rem, 36vw); align-self: stretch;
	max-height: calc(100vh - 2rem); overflow-y: auto; padding: 0 1.5rem 1.5rem; background: #181818; color: #fff;
}
.np-lb__panelbar { display: flex; justify-content: flex-end; align-items: center; height: var(--np-lb-bar); }
.np-lb__title { margin: 0 0 0.9rem; color: #fff; font-size: 1.2rem; font-weight: 700; letter-spacing: 0; line-height: 1.35; }
.np-lb__text { margin: 0 0 1.2rem; font-size: 1.05rem; line-height: 1.55; white-space: pre-line; color: #f0f0f0; }
.np-lb__fields { margin: 0; }
.np-lb__fields > div { margin: 0 0 0.9rem; }
.np-lb__fields dt { color: #c4c4c4; font-size: 0.9rem; }
.np-lb__fields dd { margin: 0; color: #fff; font-size: 1.05rem; }
body.np-lb-open { overflow: hidden; }

@media (max-width: 800px) {
	.np-lb__dialog { flex-direction: column; width: 100%; }
	.np-lb__main { width: 100%; }
	.np-lb--info .np-lb__img, .np-lb__img { max-width: 100%; max-height: 70vh; margin: 0 auto; }
	.np-lb__panel { width: 100%; max-height: none; min-height: 0; padding-top: 1rem; }
	.np-lb__panelbar { display: none; }
	.np-lb--info .np-lb__bar .np-lb__close { display: inline-flex; } /* narrow screens: the close button stays in the row above the picture */
}

/* ---------- Narrow screens (phones, small tablets): one column. Above 800px the sidebar is always 360px wide. ---------- */
@media (max-width: 800px) {
	:root { --np-header-h: 120px; }
	.np-header { grid-template-columns: 140px minmax(0, 1fr); min-height: var(--np-header-h); }
	.np-header__image { grid-column: 1; width: auto; min-width: 0; }
	.np-header__main { grid-column: 2; padding: 0.8rem 1rem 1rem; }
	.np-header__mark svg { width: 4rem; height: 4rem; }
	.np-site-title { font-size: 1.4rem; }
	.np-breadcrumbs { font-size: 0.85rem; }

	.np-columns { display: block; background: var(--np-content-bg); }
	.np-side { width: auto; min-width: 0; max-width: none; background: var(--np-page-bg); }
	.np-side__panel { padding: 1.2rem 1rem 1.6rem; }
	.js .np-nav-toggle {
		display: block; width: 100%; text-align: left; font: inherit; font-weight: 700; font-size: 1.1rem; cursor: pointer;
		padding: 0.9rem 1rem; background: var(--np-side-bg); color: var(--np-nav-text); border: 0; border-bottom: 1px solid var(--np-nav-line);
	}
	.js .np-side__panel { display: none; }
	.js .np-side.is-open .np-side__panel { display: block; }
	.np-main { padding: 1.8rem 1rem 3rem; }
	.np-list__item { flex-direction: column; gap: 0.7rem; }
	.np-footer { padding: 1.4rem 1rem; }
}
@media (prefers-reduced-motion: reduce) {
	.np-header__image img { transition: none; }
}
@media print {
	.np-side, .np-header__image, .np-lang, .np-footer__menu { display: none; }
	body, .np-columns { background: #fff; color: #000; }
	.np-header, .np-footer { background: none; color: #000; }
}
