/* ==========================================================================
   Wpis i zwykłe strony
   1. Pasek postępu  2. Nagłówek wpisu  3. Układ  4. Treść (entry-content)
   5. Kolumna boczna  6. Lightbox
   ========================================================================== */

/* 1. Pasek postępu czytania (przykleja się pod paskiem admina, gdy jest) */

.reading-progress {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0);
	z-index: 40;
	height: 3px;
	background: #1f1f1f;
}

.reading-progress__bar {
	height: 100%;
	background: var(--brand-gradient);
	transform: scaleX(0);
	transform-origin: left center;
}

/* 2. Nagłówek wpisu */

.post-header {
	padding-top: 28px;
	padding-bottom: 24px;
}

@media (min-width: 1100px) {
	.post-header {
		padding-top: 56px;
		padding-bottom: 40px;
	}
}

.breadcrumbs {
	margin-bottom: 18px;
	font-family: var(--font-mono);
	font-size: 12px;
	text-transform: uppercase;
	color: var(--text-3);
}

.breadcrumbs__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
}

.breadcrumbs__list li + li::before {
	content: "/";
	margin-inline: 8px;
}

.breadcrumbs a {
	display: inline-flex;
	align-items: center;
	min-width: var(--tap);
	min-height: var(--tap);
	padding-inline: 8px;
	color: var(--text-3);
	text-decoration: none;
}

.breadcrumbs__list li:first-child a {
	margin-left: -8px;
}

.breadcrumbs a:hover {
	text-decoration: underline;
}

.breadcrumbs .breadcrumbs__current {
	color: var(--teal);
}

.post-title {
	max-width: 1000px;
	font-size: clamp(32px, 5vw + 8px, 64px);
	line-height: 1;
	overflow-wrap: break-word;
	hyphens: auto;
}

.post-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 12px;
	margin-top: 20px;
	font-family: var(--font-mono);
	font-size: 13px;
	text-transform: uppercase;
	color: var(--text-2);
}

.post-meta li + li::before {
	content: "\00b7";
	margin-right: 12px;
}

.post-hero {
	margin-block: 0;
}

.post-hero__img {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	border: 2px solid var(--line);
	background: #161616;
}

@media (min-width: 1100px) {
	.post-hero__img {
		aspect-ratio: 1280 / 460;
	}
}

/* 3. Układ: treść + kolumna boczna */

.post-layout {
	padding-top: 32px;
	padding-bottom: 48px;
}

.post-main {
	min-width: 0;
	max-width: 720px;
}

.post-aside {
	display: flex;
	flex-direction: column;
	gap: 24px;
	max-width: 720px;
	margin-top: 40px;
}

/* Na telefonie i tablecie udostępnianie jest tuż pod treścią, potem autor i stream. */
.post-aside__share {
	order: -1;
}

@media (min-width: 1100px) {
	.post-layout {
		padding-top: 64px;
		padding-bottom: 72px;
	}

	.post-layout:not(.post-layout--single) {
		display: grid;
		/* 720 px tekstu od ok. 1360 px; na węższych ekranach kolumna tekstu się zwęża, a boczna zostaje czytelna. */
		grid-template-columns: minmax(0, 720px) minmax(280px, 1fr);
		gap: clamp(40px, 6.7vw, 96px);
		align-items: start;
	}

	.post-aside {
		position: sticky;
		top: 32px;
		max-width: none;
		margin-top: 0;
	}

	.post-aside__share {
		order: 0;
	}
}

.post-tags {
	margin-top: 40px;
}

.page-links {
	margin-top: 24px;
	font-family: var(--font-mono);
	font-size: 13px;
}

.related-grid {
	display: grid;
	gap: 16px;
}

@media (min-width: 1100px) {
	.related-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 24px;
	}
}

/* 4. Treść wpisu: 18 px na telefonie, 19 px od tabletu, interlinia 1.75, kolumna 720 px */

.entry-content {
	color: var(--text-post);
	font-size: 18px;
	line-height: 1.75;
	overflow-wrap: break-word;
}

@media (min-width: 768px) {
	.entry-content {
		font-size: 19px;
	}
}

.entry-content > :first-child {
	margin-top: 0;
}

.entry-content > p:first-child {
	color: var(--text);
	font-size: 20px;
	font-weight: 500;
	line-height: 1.6;
}

@media (min-width: 768px) {
	.entry-content > p:first-child {
		font-size: 23px;
	}
}

.entry-content p {
	margin: 0 0 24px;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
	color: var(--text);
	scroll-margin-top: 24px;
}

.entry-content h2 {
	margin: 48px 0 16px;
	font-size: 24px;
}

.entry-content h3 {
	margin: 36px 0 12px;
	font-size: 20px;
}

.entry-content h4 {
	margin: 28px 0 10px;
	font-size: 17px;
}

@media (min-width: 768px) {
	.entry-content h2 {
		font-size: 28px;
	}

	.entry-content h3 {
		font-size: 22px;
	}
}

.entry-content a {
	border-bottom: 1px solid var(--teal);
	color: var(--teal);
	text-decoration: none;
}

.entry-content a:hover {
	background: rgba(45, 212, 191, 0.12);
}

.entry-content strong {
	color: var(--text);
}

.entry-content ul,
.entry-content ol {
	margin: 0 0 24px;
	padding-left: 1.4em;
}

.entry-content ul {
	list-style: disc;
}

.entry-content ol {
	list-style: decimal;
}

.entry-content li {
	margin-bottom: 0.4em;
}

.entry-content li::marker {
	color: var(--teal);
}

.entry-content blockquote {
	margin: 36px 0;
	padding: 6px 0 6px 20px;
	border-left: 4px solid var(--teal);
	color: var(--text);
	font-size: 20px;
	font-weight: 500;
	line-height: 1.5;
}

.entry-content blockquote p {
	margin-bottom: 12px;
}

.entry-content blockquote cite {
	display: block;
	font-family: var(--font-mono);
	font-size: 13px;
	font-style: normal;
	text-transform: uppercase;
	color: var(--text-3);
}

@media (min-width: 768px) {
	.entry-content blockquote {
		padding-left: 28px;
		font-size: 24px;
	}
}

.entry-content hr {
	height: 2px;
	margin: 40px 0;
	border: 0;
	background: linear-gradient(90deg, transparent, var(--teal), var(--purple), transparent);
}

.entry-content code,
.entry-content pre {
	font-family: var(--font-mono);
	font-size: 0.82em;
}

.entry-content code {
	padding: 2px 6px;
	background: var(--surface-1);
	border: 1px solid var(--line);
}

.entry-content pre {
	margin: 0 0 24px;
	padding: 16px;
	overflow-x: auto;
	background: var(--surface-1);
	border: 1px solid var(--line);
	line-height: 1.5;
}

.entry-content pre code {
	padding: 0;
	border: 0;
	background: none;
}

.entry-content table {
	display: block;
	width: 100%;
	margin: 0 0 24px;
	overflow-x: auto;
	border-collapse: collapse;
	font-size: 0.9em;
}

.entry-content th,
.entry-content td {
	padding: 10px 12px;
	border: 1px solid var(--line);
	text-align: left;
}

.entry-content th {
	background: var(--surface-1);
	color: var(--text);
}

/* Obrazki z podpisami. Na telefonie na całą szerokość ekranu. */
.entry-content figure,
.entry-content .wp-caption {
	max-width: 100%;
	margin: 32px calc(var(--gutter) * -1);
}

.entry-content figure img,
.entry-content .wp-caption img {
	display: block;
	width: 100%;
	height: auto;
	border: 2px solid var(--line);
	border-inline-width: 0;
}

.entry-content p > img {
	display: block;
	max-width: 100%;
	height: auto;
}

.entry-content figcaption,
.entry-content .wp-caption-text {
	margin: 12px 0 0;
	padding-inline: var(--gutter);
	font-family: var(--font-mono);
	font-size: 13px;
	line-height: 1.5;
	color: var(--text-3);
}

@media (min-width: 768px) {
	.entry-content figure,
	.entry-content .wp-caption {
		margin: 40px 0;
	}

	.entry-content figure img,
	.entry-content .wp-caption img {
		width: auto;
		max-width: 100%;
		border-inline-width: 2px;
	}

	.entry-content figcaption,
	.entry-content .wp-caption-text {
		padding-inline: 0;
	}

	.entry-content .alignleft {
		float: left;
		max-width: 50%;
		margin: 8px 28px 16px 0;
	}

	.entry-content .alignright {
		float: right;
		max-width: 50%;
		margin: 8px 0 16px 28px;
	}
}

.entry-content .aligncenter {
	margin-inline: auto;
}

.entry-content .aligncenter img {
	margin-inline: auto;
}

.entry-content iframe:not(.embed__frame),
.entry-content video {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	height: auto;
	margin: 32px 0;
	border: 2px solid var(--line);
}

.entry-content .is-zoomable {
	cursor: zoom-in;
}

/* 5. Kolumna boczna */

.share__title {
	margin: 0 0 10px;
	font-family: var(--font-mono);
	font-size: 12px;
	text-transform: uppercase;
	color: var(--text-3);
}

.share__buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

/* 6. Lightbox (<dialog>) */

html.lightbox-open {
	overflow: hidden;
}

.lightbox {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(10, 10, 10, 0.96);
	color: var(--text);
}

.lightbox[open] {
	display: flex;
	align-items: center;
	justify-content: center;
}

.lightbox::backdrop {
	background: rgba(0, 0, 0, 0.8);
}

.lightbox__frame {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	max-width: calc(100% - 24px);
	padding: 64px 0 72px;
}

.lightbox__img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 190px);
	max-height: calc(100dvh - 190px);
	width: auto;
	height: auto;
	border: 2px solid var(--line);
	object-fit: contain;
}

.lightbox__caption {
	max-width: 720px;
	margin: 0;
	font-family: var(--font-mono);
	font-size: 13px;
	line-height: 1.5;
	text-align: center;
	color: var(--text-2);
}

.lightbox__btn {
	position: absolute;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 2px solid var(--text);
	background: var(--surface-1);
	color: var(--text);
	font-family: var(--font-mono);
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}

.lightbox__btn:hover {
	border-color: var(--teal);
	color: var(--teal);
}

.lightbox__close {
	top: 12px;
	right: 12px;
}

.lightbox__prev,
.lightbox__next {
	bottom: 12px;
}

.lightbox__prev {
	left: 12px;
}

.lightbox__next {
	right: 12px;
}

@media (min-width: 768px) {
	.lightbox__frame {
		max-width: calc(100% - 192px);
		padding-bottom: 64px;
	}

	.lightbox__img {
		max-height: calc(100vh - 170px);
		max-height: calc(100dvh - 170px);
	}

	.lightbox__prev,
	.lightbox__next {
		top: 50%;
		bottom: auto;
		margin-top: -24px;
	}

	.lightbox__prev {
		left: 24px;
	}

	.lightbox__next {
		right: 24px;
	}
}
