/*
Theme Name: Sogand Desktop
Theme URI: https://sogandganj.com/
Author: Sogand Ganj
Description: Portfolio : quatre objets détourés (About me, CV, Selected Works, Experiments) sur un fond uni, qui ouvrent des fenêtres simples. Trilingue anglais / français / persan (RTL), projets et expérimentations gérés depuis l'administration.
Version: 1.3.0
Requires at least: 6.4
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: sogand-desktop
*/

/* ---------- Fonts (self-hosted, SIL Open Font License) ---------- */
@font-face {
	font-family: "Instrument Sans";
	src: url("assets/fonts/instrument-sans-latin-wght-normal.woff2") format("woff2-variations");
	font-weight: 400 700;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Instrument Sans";
	src: url("assets/fonts/instrument-sans-latin-ext-wght-normal.woff2") format("woff2-variations");
	font-weight: 400 700;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: "Instrument Sans";
	src: url("assets/fonts/instrument-sans-latin-wght-italic.woff2") format("woff2-variations");
	font-weight: 400 700;
	font-style: italic;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Instrument Sans";
	src: url("assets/fonts/instrument-sans-latin-ext-wght-italic.woff2") format("woff2-variations");
	font-weight: 400 700;
	font-style: italic;
	font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: "Vazirmatn";
	src: url("assets/fonts/vazirmatn-arabic-wght-normal.woff2") format("woff2-variations");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
	font-family: "Instrument Serif";
	src: url("assets/fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Instrument Serif";
	src: url("assets/fonts/instrument-serif-latin-ext-400-normal.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: "Instrument Serif";
	src: url("assets/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
	font-weight: 400;
	font-style: italic;
	font-display: swap;
}

/* ---------- Tokens (palette from the moodboard) ---------- */
:root {
	--bg: #41451d;          /* dark green from the palette (Customizer → Couleurs) */
	--on-bg: #f4eedf;       /* text on the green */
	--wine: #6e1f2b;
	--rust: #8d3e1e;
	--olive: #3d4724;
	--mauve: #7e4c62;
	--slate: #5d7695;
	--sage: #8fa27a;
	--ochre: #c39b42;
	--cream: #f4eedf;

	--ink: #2b2717;
	--muted: #7b735d;
	--line: #e2d8c3;
	--paper: #fbf8f1;
	--tile: #eee6d3;

	--radius: 6px;
	--bar: 48px;
	--pad: clamp(16px, 2.2vw, 30px);
	--font: "Instrument Sans", "Vazirmatn", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--serif: "Instrument Serif", "Vazirmatn", Georgia, "Times New Roman", serif;
	--shadow: 0 1px 2px rgba(40, 20, 10, 0.1), 0 22px 60px rgba(40, 20, 10, 0.28);
	--grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .2 0 0 0 0 .15 0 0 0 0 .05 0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.45;
	color: var(--ink);
	background-color: var(--bg);
	-webkit-font-smoothing: antialiased;
	overflow: hidden;
}
body::before {
	content: "";
	position: fixed;
	inset: 0;
	background-image: var(--grain);
	opacity: 0.22;
	mix-blend-mode: multiply;
	pointer-events: none;
}
body.custom-background::before { opacity: 0; }
html[lang="fa"] body { line-height: 1.85; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0 0 0.9em; }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--ochre); outline-offset: 3px; }

/* ---------- Top bar and footer (plain text on the green) ---------- */
.sg-top {
	position: fixed;
	inset: 0 0 auto 0;
	z-index: 3;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 22px;
	color: var(--on-bg);
	pointer-events: none;
}
.sg-top > * { pointer-events: auto; }
.sg-name {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--serif);
	font-size: 22px;
	line-height: 1.2;
	color: var(--on-bg);
	text-decoration: none;
}
.sg-logo { width: 22px; height: 22px; object-fit: contain; }
.sg-langs { display: flex; gap: 14px; font-size: 13px; }
.sg-lang {
	color: var(--on-bg);
	opacity: 0.6;
	text-decoration: none;
	padding-bottom: 1px;
	border-bottom: 1px solid transparent;
}
.sg-lang:hover { opacity: 1; }
.sg-lang.is-current { opacity: 1; border-bottom-color: currentColor; }

.sg-foot {
	position: fixed;
	inset: auto 0 0 0;
	z-index: 2;
	display: flex;
	justify-content: center;
	padding: 16px 22px;
	text-align: center;
	color: var(--on-bg);
	pointer-events: none;
}
.sg-foot__line {
	display: inline-flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5em;
	font-size: 12.5px;
	pointer-events: auto;
}
.sg-foot a { text-underline-offset: 3px; text-decoration-color: rgba(244, 238, 223, 0.5); }
.sg-foot a:hover { text-decoration-color: currentColor; }
.sg-sep { opacity: 0.5; }

/* ---------- Home ---------- */
.sg-desktop {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 70px 16px;
}

/* ---------- Garden objects (the four icons) ---------- */
.sg-icons {
	position: relative;
	z-index: 2;
	list-style: none;
	margin: 0;
	padding: 0 20px;
	display: flex;
	justify-content: center;
	align-items: flex-end;
	gap: clamp(12px, 3.2vw, 46px);
}
.sg-icons__item { --h: 160px; display: flex; }
.sg-icons__item--about { --h: min(178px, 21dvh); }
.sg-icons__item--cv { --h: min(198px, 23.5dvh); }
.sg-icons__item--works { --h: min(340px, 40dvh); }
.sg-icons__item--experiments { --h: min(138px, 16.5dvh); }

.sg-icon {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	min-width: 118px;
	text-decoration: none;
	color: var(--on-bg);
	-webkit-tap-highlight-color: transparent;
}
.sg-icon__img {
	position: relative;
	display: block;
	height: var(--h);
}
.sg-icon__img img {
	position: relative;
	z-index: 1;
	display: block;
	height: 100%;
	width: auto;
	max-width: none;
	transform-origin: 50% 100%;
	filter: drop-shadow(0 3px 3px rgba(40, 40, 10, 0.18));
}
/* soft shadow on the grass */
.sg-icon__img::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: -7px;
	width: 92%;
	height: 16px;
	transform: translateX(-50%);
	background: radial-gradient(closest-side, rgba(15, 18, 5, 0.45), rgba(15, 18, 5, 0));
}
.sg-icon__label {
	font-size: 14px;
	line-height: 1.5;
	white-space: nowrap;
	text-decoration: underline;
	text-decoration-color: transparent;
	text-underline-offset: 4px;
	transition: text-decoration-color 0.2s ease;
}
.sg-ext { opacity: 0.6; }
.sg-icon:hover .sg-icon__label,
.sg-icon:focus-visible .sg-icon__label { text-decoration-color: currentColor; }
.sg-icon:focus-visible { outline: none; }

/* little garden movements on hover */
.sg-icon--about:hover img { animation: sg-hop 0.9s ease-in-out; }
.sg-icon--cv:hover img { animation: sg-wiggle 0.8s ease-in-out; }
.sg-icon--works:hover img { animation: sg-sway 2.6s ease-in-out infinite; }
.sg-icon--experiments img { transition: transform 0.6s ease; transform-origin: 50% 50%; }
.sg-icon--experiments:hover img { transform: rotate(14deg) scale(1.06); }

@keyframes sg-hop {
	0%, 100% { transform: translateY(0); }
	30% { transform: translateY(-16px); }
	55% { transform: translateY(0); }
	72% { transform: translateY(-5px); }
}
@keyframes sg-wiggle {
	0%, 100% { transform: rotate(0); }
	25% { transform: rotate(-4deg); }
	50% { transform: rotate(3deg); }
	75% { transform: rotate(-1.5deg); }
}
@keyframes sg-sway {
	0%, 100% { transform: rotate(0); }
	30% { transform: rotate(1.4deg); }
	70% { transform: rotate(-1.2deg); }
}

/* ---------- Windows ---------- */
.sg-win {
	--dx: 0px;
	--dy: 0px;
	position: fixed;
	z-index: 10;
	inset: clamp(10px, 6.5vh, 60px) clamp(10px, 4vw, 72px);
	display: none;
	flex-direction: column;
	background: var(--paper);
	border: 1px solid rgba(60, 40, 15, 0.2);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	transform: translate(var(--dx), var(--dy));
	outline: none;
}
.sg-win--small {
	inset: auto;
	top: 50%;
	left: 50%;
	width: min(700px, calc(100vw - 24px));
	max-height: min(640px, calc(100dvh - 120px));
	transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)));
}
.sg-win--medium {
	inset: auto;
	top: 50%;
	left: 50%;
	width: min(820px, calc(100vw - 24px));
	max-height: calc(100dvh - 120px);
	transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)));
}
html:not(.js) .sg-win:target,
.sg-win.is-open { display: flex; }
.sg-win.is-open { animation: sg-pop 0.18s ease-out; }
@keyframes sg-pop {
	from { opacity: 0; }
	to { opacity: 1; }
}

.sg-win__bar {
	flex: none;
	height: var(--bar);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-inline: var(--pad) 8px;
	border-bottom: 1px solid var(--line);
	user-select: none;
	touch-action: none;
}
.js .sg-win__bar { cursor: grab; }
.sg-win.is-dragging .sg-win__bar { cursor: grabbing; }
.sg-win__title {
	margin: 0;
	font-family: var(--serif);
	font-size: 21px;
	font-weight: 400;
	line-height: 1;
	color: var(--ink);
}
html[lang="fa"] .sg-win__title { font-size: 16px; font-weight: 500; }
.sg-win__close {
	width: 34px;
	height: 34px;
	display: grid;
	place-items: center;
	border-radius: 3px;
	color: var(--ink);
	cursor: pointer;
}
.sg-win__close svg { width: 16px; height: 16px; }
.sg-win__close:hover { background: var(--tile); }

.sg-win__body {
	flex: 1;
	overflow: auto;
	overscroll-behavior: contain;
	padding: clamp(28px, 4vw, 56px) var(--pad) 96px;
	font-size: 14px;
}
.sg-win--small .sg-win__body { padding: 28px var(--pad) 30px; font-size: 16px; }
.sg-win a { text-decoration-color: color-mix(in srgb, var(--wine) 55%, transparent); text-underline-offset: 2px; }
.sg-win a:hover { color: var(--wine); }

/* ---------- About me ---------- */
.sg-about {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 22px 30px;
	align-items: start;
}
.sg-about.has-photo { grid-template-columns: minmax(0, 1fr) 160px; }
.sg-about__photo {
	grid-column: 2;
	grid-row: 1 / span 2;
	margin: 0;
	padding: 6px 6px 8px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(40, 20, 10, 0.1), 0 10px 22px rgba(40, 20, 10, 0.14);
	transform: rotate(1.5deg);
}
[dir="rtl"] .sg-about__photo { transform: rotate(-1.5deg); }
.sg-about__photo img {
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 4;
	object-fit: cover;
	background: var(--tile);
}
.sg-about__text { grid-column: 1; grid-row: 1; }
.sg-about__links {
	grid-column: 1;
	grid-row: 2;
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.sg-about__links { gap: 6px 20px; }
.sg-about__links a { font-size: 15px; }

.sg-prose { max-width: 62ch; }
.sg-prose > *:last-child { margin-bottom: 0; }
.sg-prose img { height: auto; }
.sg-prose h2, .sg-prose h3 { font-size: 1em; font-weight: 600; margin: 1.4em 0 0.4em; }

/* ---------- CV ---------- */
.sg-win--medium .sg-win__body { padding: 30px var(--pad) 48px; font-size: 15px; }
.sg-cv { max-width: none; }
.sg-cv > p:first-child { color: var(--muted); }
.sg-cv h2 {
	margin: 34px 0 16px;
	padding-top: 10px;
	border-top: 1px solid var(--line);
	font-family: var(--serif);
	font-size: 21px;
	font-weight: 400;
}
html[lang="fa"] .sg-cv h2 { font-size: 16px; font-weight: 600; }
.sg-cv h2:first-child { margin-top: 0; }
.sg-cv p { margin: 0 0 16px; line-height: 1.5; }
.sg-cv p > strong:first-child { font-weight: 500; color: var(--wine); }

/* ---------- Project header: title | place + date | text ---------- */
.sg-head {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px clamp(20px, 3vw, 48px);
	padding-top: 12px;
	border-top: 1px solid var(--line);
	margin-bottom: clamp(32px, 4vw, 52px);
}
.sg-head__title {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
}
.sg-num { display: inline-block; min-width: 2.2em; color: var(--wine); font-variant-numeric: tabular-nums; }
.sg-head__meta { margin: 0; display: flex; flex-direction: column; }
.sg-head__meta em { font-style: italic; color: var(--muted); }
html[lang="fa"] .sg-head__meta em { font-style: normal; }
.sg-head__text { max-width: 60ch; }
.sg-head__text > *:last-child { margin-bottom: 0; }
.sg-head--intro .sg-head__text { grid-column: 2 / 4; }
.sg-head--intro .sg-head__title { font-family: var(--serif); font-size: 22px; font-weight: 400; line-height: 1.1; }
html[lang="fa"] .sg-head--intro .sg-head__title { font-size: 16px; font-weight: 600; }

.sg-project { scroll-margin-top: 24px; }
.sg-project + .sg-project { margin-top: clamp(80px, 12vw, 170px); }

/* ---------- Image grid (bottom-aligned rows) ---------- */
.sg-grid {
	display: grid;
	grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
	gap: clamp(28px, 3.5vw, 46px) clamp(14px, 2vw, 28px);
	align-items: end;
}
.sg-fig { margin: 0; }
.sg-fig__link { display: block; cursor: zoom-in; }
.sg-fig img {
	width: 100%;
	height: auto;
	background: var(--tile);
}
.sg-fig figcaption {
	margin-top: 8px;
	font-size: 13px;
	color: var(--muted);
	text-align: center;
	line-height: 1.4;
}
.sg-empty { color: var(--muted); }

/* ---------- Lightbox ---------- */
.sg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 50;
	display: grid;
	grid-template-columns: 64px 1fr 64px;
	align-items: center;
	background: rgba(244, 238, 223, 0.97);
}
.sg-lightbox[hidden] { display: none; }
.sg-lightbox__fig {
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	min-width: 0;
}
.sg-lightbox__fig img {
	max-width: 100%;
	max-height: calc(100dvh - 120px);
	width: auto;
	height: auto;
	object-fit: contain;
}
.sg-lightbox__fig figcaption { font-size: 13px; color: var(--muted); min-height: 1.4em; }
.sg-lightbox button {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--ink);
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	border-radius: 3px;
	cursor: pointer;
	justify-self: center;
}
.sg-lightbox button:hover { background: var(--tile); }
.sg-lightbox button svg { width: 18px; height: 18px; }
.sg-lightbox__close { position: absolute; top: 12px; inset-inline-end: 12px; }
[dir="rtl"] .sg-lightbox__nav svg { transform: scaleX(-1); }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
	.sg-grid { --cols: 4 !important; }
}
@media (max-width: 900px) {
	.sg-grid { --cols: 3 !important; }
	.sg-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
	.sg-head__text,
	.sg-head--intro .sg-head__text { grid-column: 1 / -1; margin-top: 8px; }
	.sg-head--intro .sg-head__title { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
	body { font-size: 14px; }
	.sg-win,
	.sg-win--small,
	.sg-win--medium {
		inset: 0;
		top: 0;
		left: 0;
		width: auto;
		max-height: none;
		border-radius: 0;
		border: 0;
		transform: none;
	}
	.sg-grid { --cols: 2 !important; }
	.sg-head { grid-template-columns: 1fr; }
	.sg-icons {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		justify-items: center;
		align-items: end;
		gap: 34px 8px;
		padding: 0 8px;
	}
	.sg-icons__item--about { --h: min(124px, 15dvh); }
	.sg-icons__item--cv { --h: min(140px, 17dvh); }
	.sg-icons__item--works { --h: min(205px, 25dvh); }
	.sg-icons__item--experiments { --h: min(100px, 12dvh); }
	.sg-icon { min-width: 0; }
	.sg-about.has-photo { grid-template-columns: minmax(0, 1fr) 112px; }
	.sg-lightbox { grid-template-columns: 44px 1fr 44px; }
	.sg-foot__line { font-size: 11.5px; }
	.sg-name { font-size: 19px; }
	.sg-top { padding: 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.sg-win.is-open { animation: none; }
	.sg-icon img { animation: none !important; transition: none !important; }
}
