/*
Theme Name: nani
Theme URI: https://nani.example
Author: Patryk Chilewicz
Description: Strona z jednym guzikiem. Kliknij, a wydarzy się coś miłego. Motyw zawiera typ treści „nani” (fraszki, obrazy, wideo, gify, piosenki), losowanie z pamięcią w przeglądarce i udostępnianie.
Version: 1.0.0
Requires at least: 6.3
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: nani
*/

/* ------------------------------------------------------------------
   Kolory z hibiskusa i podstawy
------------------------------------------------------------------ */
:root {
	--cream: #FFF8EC;
	--sand: #F5E8D2;
	--sand-2: #EFE3CE;
	--ink: #5C1A07;
	--muted: #8A5A3C;
	--heart: #B81C07;
	--coral: #DD380A;
	--honey: #E89B12;
	--sun: #F4C21F;
	--night: #2A0E05;
	--serif: 'Fraunces', Georgia, 'Times New Roman', serif;
	--sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
	--pad-x: 48px;
}

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

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

body {
	margin: 0;
	background: var(--cream);
	color: var(--ink);
	font-family: var(--sans);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

a { color: var(--ink); }
a:hover { color: var(--heart); }
img, svg, video, iframe { max-width: 100%; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; border-radius: 6px; }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0; border: 0;
	overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
	white-space: nowrap;
}
.skip-link:focus {
	position: fixed !important; top: 12px; left: 12px; z-index: 100;
	width: auto; height: auto; margin: 0; padding: 12px 18px;
	clip: auto; clip-path: none;
	background: var(--ink); color: var(--cream); border-radius: 999px; text-decoration: none;
}

/* ------------------------------------------------------------------
   Szkielet strony
------------------------------------------------------------------ */
.site {
	min-height: 100vh;
	min-height: 100svh;
	display: flex;
	flex-direction: column;
}

.site-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 32px var(--pad-x);
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
}
.brand__word,
.nani-wordmark {
	font-family: var(--serif);
	font-weight: 600;
	font-size: 28px;
	line-height: 1;
	letter-spacing: -0.02em;
	font-variation-settings: 'SOFT' 100, 'WONK' 0, 'opsz' 144;
	color: var(--ink);
}

.site-header__link {
	font-size: 15px;
	font-weight: 500;
	text-decoration: none;
	padding: 10px 0;
}
.site-header__link:hover { text-decoration: underline; text-underline-offset: 4px; }

.site-main {
	flex-grow: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px var(--pad-x) 40px;
	outline: none;
}

.site-footer {
	display: flex;
	justify-content: center;
	padding: 24px var(--pad-x) 32px;
	font-size: 14px;
	color: var(--muted);
}
.nani-count { margin: 0; }

/* ------------------------------------------------------------------
   Start: kwiat-guzik
------------------------------------------------------------------ */
.nani-start {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 36px;
	text-align: center;
}

.nani-bloom {
	display: block;
	width: min(320px, 64vw);
	aspect-ratio: 1;
	border-radius: 50%;
	transition: transform .35s cubic-bezier(.3, 1.4, .5, 1);
	-webkit-tap-highlight-color: transparent;
}
.nani-bloom svg { width: 100%; height: 100%; display: block; }
.nani-bloom:hover { transform: scale(1.04) rotate(8deg); }
.nani-bloom:active { transform: scale(.96) rotate(14deg); }
.nani-bloom:focus-visible { outline-offset: 10px; border-radius: 50%; }
.nani-bloom.is-blooming { animation: nani-bloom .7s cubic-bezier(.3, 1.2, .5, 1) forwards; }

@keyframes nani-bloom {
	0%   { transform: scale(1) rotate(0); opacity: 1; }
	45%  { transform: scale(1.14) rotate(60deg); opacity: 1; }
	100% { transform: scale(.2) rotate(144deg); opacity: 0; }
}

.nani-tagline {
	margin: 0;
	font-family: var(--serif);
	font-style: italic;
	font-size: 30px;
	line-height: 1.3;
	font-variation-settings: 'SOFT' 100;
}

/* ------------------------------------------------------------------
   Karta nani – wspólne elementy
------------------------------------------------------------------ */
.nani {
	width: 100%;
	max-width: 980px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 24px;
	text-align: center;
	animation: nani-in .55s cubic-bezier(.2, .8, .3, 1) both;
}
.site-main.is-leaving .nani,
.site-main.is-leaving .nani-start { opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; }

@keyframes nani-in {
	from { opacity: 0; transform: translateY(14px); }
	to   { opacity: 1; transform: none; }
}

.nani-label {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--heart);
}

.nani-title {
	margin: 0;
	font-family: var(--serif);
	font-weight: 600;
	font-size: clamp(38px, 4.4vw, 60px);
	line-height: 1.08;
	font-variation-settings: 'SOFT' 100, 'opsz' 144;
	text-wrap: balance;
}
.nani-title--small { font-size: clamp(24px, 2.2vw, 30px); line-height: 1.2; }

.nani-credit {
	margin: 0;
	font-size: 17px;
	color: var(--muted);
}

.nani-poem {
	font-family: var(--serif);
	font-style: italic;
	font-size: clamp(32px, 4vw, 56px);
	line-height: 1.25;
	font-variation-settings: 'SOFT' 100, 'opsz' 144;
	text-wrap: balance;
}
.nani-poem p { margin: 0; }
.nani-poem p + p { margin-top: .7em; }

.nani-text {
	max-width: 620px;
	font-family: var(--serif);
	font-size: 22px;
	line-height: 1.5;
	font-variation-settings: 'SOFT' 100;
}
.nani-text p { margin: 0; }
.nani-text p + p { margin-top: .6em; }
.nani-text--italic { font-style: italic; }
.nani-text--quiet { font-size: 19px; }

/* Źródło */
.nani-source {
	display: inline-flex;
	align-items: center;
	gap: 14px;
	max-width: 100%;
	padding: 8px 8px 8px 18px;
	border-radius: 999px;
	background: var(--sand);
	text-align: left;
}
.nani-source__label {
	display: block;
	padding-top: 2px;
	font-size: 11px;
	line-height: 1;
	font-weight: 600;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--muted);
	flex-shrink: 0;
}
.nani-source__text { display: block; font-size: 14px; line-height: 1.3; }
.nani-source__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 36px;
	padding: 0 14px;
	border-radius: 999px;
	background: var(--cream);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: background .2s ease, color .2s ease;
}
.nani-source__link:hover { background: var(--ink); color: var(--cream); }
.nani-source:not(:has(.nani-source__link)) { padding-right: 18px; min-height: 52px; }

/* Działania: jeszcze jedno + wyślij komuś */
.nani-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 24px 48px;
	margin-top: 8px;
}

.nani-again {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	min-height: 56px;
	padding: 6px 24px 6px 8px;
	border-radius: 999px;
	background: var(--ink);
	color: var(--cream);
	font-size: 16px;
	font-weight: 600;
	text-decoration: none;
	flex-shrink: 0;
}
.nani-again:hover { color: var(--cream); background: #461304; }
.nani-again svg { transition: transform .35s ease; }
.nani-again:hover svg { transform: rotate(36deg); }

.nani-share {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
}
.nani-share__title { font-size: 14px; font-weight: 500; }
.nani-share__row { display: flex; align-items: flex-start; gap: 14px; }
.nani-share__item { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.nani-share__btn {
	width: 48px;
	height: 48px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1.5px solid var(--ink);
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	transition: background .2s ease, color .2s ease;
}
.nani-share__btn:hover { background: var(--ink); color: var(--cream); }
.nani-share__btn:focus-visible { border-radius: 50%; }
.nani-share__cap { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------------
   Układy według rodzaju
------------------------------------------------------------------ */

/* obraz / fotografia: obraz z lewej, opis z prawej */
.nani--image {
	display: grid;
	grid-template-columns: minmax(0, 500px) minmax(0, 580px);
	justify-content: center;
	align-items: center;
	gap: 40px 80px;
	max-width: 1180px;
	text-align: left;
}
.nani-visual { margin: 0; display: flex; justify-content: center; }
.nani-image {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: min(640px, 72vh);
	border-radius: 6px;
	box-shadow: 0 1px 2px rgba(92, 26, 7, .08), 0 18px 40px -18px rgba(92, 26, 7, .35);
}
.nani-image--empty {
	width: 100%; aspect-ratio: 5 / 6;
	display: flex; align-items: center; justify-content: center;
	padding: 32px; background: var(--sand-2); color: var(--muted); text-align: center;
	box-shadow: none;
}
.nani-body {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 20px;
}
.nani-body .nani-actions,
.nani-body .nani-share { justify-content: flex-start; align-items: flex-start; }
.nani-body .nani-actions { align-items: center; }

/* ------------------------------------------------------------------
   Osadzenia (włączają się po kliknięciu)
------------------------------------------------------------------ */
.nani-embed {
	position: relative;
	width: min(760px, 100%, calc(56vh * 16 / 9));
	aspect-ratio: 16 / 9;
	border-radius: 20px;
	overflow: hidden;
	background: var(--night);
}
.nani-embed--tall      { width: min(315px, 100%); aspect-ratio: 9 / 16; }
.nani-embed--tiktok    { width: min(325px, 100%); aspect-ratio: auto; height: 740px; }
.nani-embed--instagram { width: min(400px, 100%); aspect-ratio: auto; height: 720px; }
.nani-embed--gif       { width: min(520px, 100%); aspect-ratio: 4 / 3; background: var(--sand); }
.nani-embed--square    { width: min(460px, 100%); aspect-ratio: 1; background: var(--sand); }
.nani-embed--audio     { width: min(640px, 100%); aspect-ratio: auto; height: var(--embed-h, 152px); border-radius: 16px; }

.nani-embed iframe {
	position: absolute; inset: 0;
	width: 100%; height: 100%;
	border: 0;
}

.nani-embed__play {
	position: absolute; inset: 0;
	width: 100%; height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 24px;
	border: 0;
	background: transparent;
	color: var(--sand);
	cursor: pointer;
	text-align: center;
}
.nani-embed--gif .nani-embed__play,
.nani-embed--square .nani-embed__play { color: var(--ink); }
.nani-embed__icon {
	width: 72px; height: 72px;
	display: flex; align-items: center; justify-content: center;
	border-radius: 50%;
	background: var(--cream);
	fill: var(--heart);
	transition: transform .25s ease;
}
.nani-embed--gif .nani-embed__icon,
.nani-embed--square .nani-embed__icon { background: var(--ink); fill: var(--cream); }
.nani-embed__play:hover .nani-embed__icon { transform: scale(1.08); }
.nani-embed__main { font-family: var(--serif); font-size: 22px; font-weight: 600; font-variation-settings: 'SOFT' 100; }
.nani-embed__sub { font-size: 13px; letter-spacing: .03em; opacity: .8; }
.nani-embed__play:focus-visible { outline-color: var(--sun); outline-offset: -6px; border-radius: 20px; }

/* odtwarzacz audio w wersji „przed kliknięciem” */
.nani-embed--audio .nani-embed__play {
	flex-direction: row;
	justify-content: flex-start;
	gap: 18px;
	padding: 16px;
	text-align: left;
}
.nani-embed__cover {
	width: calc(var(--embed-h, 152px) - 32px);
	height: calc(var(--embed-h, 152px) - 32px);
	flex-shrink: 0;
	display: flex; align-items: center; justify-content: center;
	border-radius: 8px;
	background: var(--ink);
}
.nani-embed__text { flex-grow: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.nani-embed--audio .nani-embed__icon { width: 52px; height: 52px; flex-shrink: 0; }

.nani-media { margin: 0; }
.nani-media img,
.nani-media video {
	display: block;
	max-width: min(560px, 100%);
	max-height: 60vh;
	width: auto; height: auto;
	border-radius: 20px;
}

/* ------------------------------------------------------------------
   Strony (np. „o nani”)
------------------------------------------------------------------ */
.site-main--page { align-items: flex-start; padding-top: 56px; padding-bottom: 64px; }
.nani-page {
	width: 100%;
	max-width: 680px;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 24px;
}
.nani-page__title {
	margin: 0;
	font-family: var(--serif);
	font-weight: 600;
	font-size: clamp(44px, 5vw, 72px);
	line-height: 1.05;
	font-variation-settings: 'SOFT' 100, 'opsz' 144;
}
.nani-page__content {
	font-family: var(--serif);
	font-size: 21px;
	line-height: 1.6;
	font-variation-settings: 'SOFT' 100;
}
.nani-page__content > * { margin: 0 0 16px; }
.nani-page__content .nani-lead { font-size: 28px; line-height: 1.45; }
.nani-page__content h2 {
	margin: 40px 0 12px;
	font-size: 30px;
	line-height: 1.2;
	font-weight: 600;
	font-variation-settings: 'SOFT' 100, 'opsz' 144;
}
.nani-page__content .nani-podpis {
	margin-top: 40px;
	font-family: var(--sans);
	font-size: 15px;
	color: var(--muted);
}
.nani-page .nani-again { margin-top: 16px; }

/* ------------------------------------------------------------------
   Komunikat (toast)
------------------------------------------------------------------ */
.nani-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 50;
	max-width: calc(100% - 32px);
	padding: 12px 20px;
	border-radius: 999px;
	background: var(--ink);
	color: var(--cream);
	font-size: 15px;
	text-align: center;
	transform: translate(-50%, 20px);
	opacity: 0;
	pointer-events: none;
	transition: opacity .25s ease, transform .25s ease;
}
.nani-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------
   Telefon
------------------------------------------------------------------ */
@media (max-width: 900px) {
	.nani--image {
		grid-template-columns: minmax(0, 1fr);
		justify-items: center;
		text-align: center;
	}
	.nani-body { align-items: center; }
	.nani-body .nani-actions,
	.nani-body .nani-share { justify-content: center; align-items: center; }
}

@media (max-width: 700px) {
	:root { --pad-x: 20px; }
	.site-header { padding-top: 24px; padding-bottom: 24px; }
	.site-main { padding-top: 8px; }
	.site-footer { padding-bottom: 40px; font-size: 13px; }
	.nani-start { gap: 28px; }
	.nani-tagline { font-size: 22px; }
	.nani { gap: 20px; }
	.nani-credit { font-size: 15px; }
	.nani-text { font-size: 18px; }
	.nani-actions { flex-direction: column; gap: 20px; }

	.nani-source {
		flex-direction: column;
		gap: 10px;
		width: 100%;
		padding: 14px 16px;
		border-radius: 20px;
		text-align: center;
	}
	.nani-source__label { padding-top: 0; }
	.nani-source__text { text-wrap: balance; }

	.nani-embed--tall { width: min(252px, 100%); }
	.nani-embed { width: 100%; }
	.nani-embed--tall, .nani-embed--tiktok, .nani-embed--instagram { width: min(340px, 100%); }
	.nani-image { max-height: 52vh; }
	.nani-embed__cover { display: none; }

	.site-main--page { padding-top: 24px; }
	.nani-page__content { font-size: 18px; }
	.nani-page__content .nani-lead { font-size: 22px; }
	.nani-page__content h2 { font-size: 24px; margin-top: 32px; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
	.nani-bloom:hover, .nani-again:hover svg { transform: none; }
}
