/*
Theme Name: MojaAlfunia
Description: Tabloid-style blog about owning too many Alfa Romeos.
Version: 2.2.0
Requires PHP: 8.2
Text Domain: mojaalffunia
*/

:root {
	--red: #1fa84f;
	--ink: #141212;
	--paper: #f4f1ec;
	--yellow: #f6e84a;
	--red-dark: #157a38;
	--muted: #5d5853;
	--muted-2: #3d3936;
	--muted-dark: #bdb7b0;
	--rule-dark: #3a3634;
	--display: 'Anton', 'Impact', sans-serif;
	--body: 'Work Sans', system-ui, sans-serif;
	--pad: clamp(16px, 3.2vw, 40px);
	--max: 1440px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.5 var(--body); }
a { color: inherit; }
a:hover { opacity: .85; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { margin: 0; font-weight: 400; }

.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: fixed; z-index: 10; left: 8px; top: 8px; width: auto; height: auto; clip: auto; padding: 8px 12px; background: var(--yellow); color: var(--ink); }

/* ---------- Primitives ---------- */

.band { padding: clamp(36px, 5vw, 56px) var(--pad) clamp(40px, 5.5vw, 64px); }
.band > * { max-width: var(--max); margin-inline: auto; }
.band--red { background: var(--red); color: #fff; }
.band--tight-top { padding-top: 0; }

.display { font-family: var(--display); text-transform: uppercase; line-height: .84; overflow-wrap: anywhere; }
.display a { text-decoration: none; }
.display--xl { font-size: clamp(64px, 15.3vw, 196px); }
.display--lg { font-size: clamp(52px, 9vw, 120px); }

.meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font: 700 12px var(--body); text-transform: uppercase; letter-spacing: .04em; }
.meta--lg { font-size: 13px; }
.meta--lg > span:not(.chip) { padding: 6px 0; }
.meta__muted { color: var(--muted); }

.chip { display: inline-block; padding: 4px 8px; text-decoration: none; }
.meta--lg .chip { padding: 6px 10px; }
.chip--red { background: var(--red); color: #fff; }
.chip--black { background: var(--ink); color: #fff; }

.btn { display: inline-block; padding: 8px 14px; font: 700 13px var(--body); text-transform: uppercase; letter-spacing: .06em; text-decoration: none; white-space: nowrap; }
.btn--lg { padding: 14px 20px; font-size: 14px; letter-spacing: 0; }
.btn--yellow { background: var(--yellow); color: var(--ink); }
.btn--black { background: var(--ink); color: #fff; }

.link-caps { font: 700 13px var(--body); text-transform: uppercase; letter-spacing: .04em; text-decoration: none; white-space: nowrap; }

.section-head { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; align-items: baseline; border-bottom: 6px solid var(--ink); padding-bottom: 10px; margin-bottom: 28px; }
.section-head--plain { border: 0; padding: 0; margin-bottom: 24px; }
.section-title { font: 400 clamp(36px, 4.5vw, 52px)/1.1 var(--display); text-transform: uppercase; }
.section-title--sm { font-size: clamp(32px, 3.8vw, 44px); }

.ma-img { display: block; width: 100%; object-fit: cover; }
.ma-img--empty { background: var(--ink); }

/* ---------- Header / footer ---------- */

.site-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 18px var(--pad); background: var(--ink); color: #fff; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; padding: 0; list-style: none; font: 700 13px var(--body); text-transform: uppercase; letter-spacing: .06em; }
.site-nav a { text-decoration: none; }
.site-nav .current-menu-item a, .site-nav .current-cat a { color: var(--yellow); }
.logo { font: 400 34px/1 var(--display); letter-spacing: .01em; text-decoration: none; white-space: nowrap; }
.logo span { color: var(--red); }
.logo--plain { font-size: 28px; }
.site-header__cta { display: flex; justify-content: flex-end; }

.site-footer { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center; padding: 28px var(--pad); background: var(--red); color: #fff; font: 500 14px var(--body); }
.site-footer a { text-decoration: none; }

@media (max-width: 760px) {
	.site-header { grid-template-columns: 1fr auto; }
	.logo { grid-row: 1; grid-column: 1; font-size: 28px; }
	.site-header__cta { grid-row: 1; grid-column: 2; }
	.site-nav { grid-row: 2; grid-column: 1 / -1; }
}
@media (max-width: 420px) {
	.site-header__cta .btn { padding: 6px 10px; font-size: 11px; }
}

/* ---------- Home: hero ---------- */

.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 40px; align-items: end; padding-top: 40px; padding-bottom: 48px; }
.hero > * { margin: 0; max-width: none; }
.hero__text { display: flex; flex-direction: column; gap: 28px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.hero__lede { margin: 0; max-width: 380px; font-size: 17px; line-height: 1.45; }
.hero__photo { position: relative; display: block; padding-bottom: 12px; text-decoration: none; }
.hero__photo:hover { opacity: 1; }
.polaroid { display: block; padding: 12px; background: #fff; transform: rotate(2.5deg); box-shadow: 0 18px 36px rgba(0, 0, 0, .25); transition: transform .3s ease; }
.hero__photo:hover .polaroid { transform: rotate(0); }
.hero__img { aspect-ratio: 496 / 290; height: auto; }
.sticker { position: absolute; left: -28px; bottom: -4px; padding: 8px 16px; background: var(--yellow); color: var(--ink); font: 400 26px/1.2 var(--display); text-transform: uppercase; transform: rotate(-5deg); }

@media (max-width: 900px) {
	.hero { grid-template-columns: 1fr; gap: 48px; }
	.hero__photo { max-width: 520px; margin-inline: 12px; }
	.sticker { left: -8px; font-size: 22px; }
}

/* ---------- Cards ---------- */

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 28px; }
.card { display: flex; flex-direction: column; gap: 14px; text-decoration: none; transition: transform .2s ease; }
.card:hover { transform: translateY(-4px); }
.card__media { position: relative; display: block; }
.card__img { aspect-ratio: 9 / 5; height: auto; }
.card__n { position: absolute; left: 0; top: 0; padding: 4px 12px; background: var(--ink); color: #fff; font: 400 28px/1.2 var(--display); }
.card__title { font: 400 clamp(30px, 3vw, 38px)/.95 var(--display); text-transform: uppercase; }
.card__excerpt { font-size: 15px; line-height: 1.5; color: var(--muted-2); }

@media (max-width: 1000px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .cards { grid-template-columns: 1fr; } }

.pagination { margin-top: 48px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; font: 700 13px var(--body); text-transform: uppercase; }
.pagination .page-numbers { padding: 8px 12px; background: var(--ink); color: #fff; text-decoration: none; }
.pagination .current { background: var(--red); }

/* ---------- Garage ---------- */

.garage { background: var(--ink); color: #fff; padding-top: 48px; padding-bottom: 56px; }
.garage__count { font: 700 13px var(--body); text-transform: uppercase; letter-spacing: .04em; color: var(--yellow); }
.garage__grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; margin: 0 auto; padding: 0; list-style: none; background: var(--rule-dark); }
.garage__car { display: flex; flex-direction: column; gap: 6px; padding: 20px 18px; background: var(--ink); }
.garage__model { font: 400 72px/.9 var(--display); }
.garage__spec { font-size: 14px; color: var(--muted-dark); }
.status { align-self: flex-start; margin-top: auto; padding: 4px 8px; font: 700 11px var(--body); text-transform: uppercase; letter-spacing: .06em; }
.garage__spec + .status { margin-top: 10px; }
.status--jezdzi { background: var(--yellow); color: var(--ink); }
.status--dawca { background: var(--rule-dark); color: #fff; }
.status--naprawa { background: var(--red); color: #fff; }
.status--projekt { background: #fff; color: var(--ink); }

@media (max-width: 1000px) {
	.garage__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.garage__car:last-child:nth-child(3n+2) { grid-column: span 2; }
}
@media (max-width: 560px) {
	.garage__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.garage__model { font-size: 56px; }
	.garage__car:last-child:nth-child(3n+2) { grid-column: auto; }
	.garage__car:last-child:nth-child(odd) { grid-column: span 2; }
}

/* ---------- Article ---------- */

.article__head { padding-bottom: 0; }
.article__head .display { margin-top: 20px; }
.article__head--plain { padding-bottom: clamp(36px, 5vw, 56px); }
.article__head--plain .display { margin-top: 0; }
.article__photo { margin-top: 32px; padding: 14px; background: #fff; box-shadow: 0 20px 40px rgba(0, 0, 0, .2); transform: translateY(72px); }
.article__img { height: auto; max-height: none; object-fit: contain; }

.article__body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 680px) minmax(0, 1fr); gap: 40px; max-width: var(--max); margin: 0 auto; padding: 56px var(--pad) 64px; }
.article__body--photo { padding-top: calc(72px + 40px); }
.article__caption { grid-column: 1; align-self: start; margin: 0; padding-top: 6px; font: 500 13px var(--body); color: var(--muted); }
.article__text { grid-column: 2; }

@media (max-width: 1000px) {
	.article__body { grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 760px; }
	.article__caption, .article__text { grid-column: 1; }
	.article__caption { padding-top: 0; }
	.article__photo { padding: 8px; transform: translateY(48px); }
	.article__body--photo { padding-top: calc(48px + 20px); }
}

/* Entry content */
.entry { display: flex; flex-direction: column; gap: 22px; font-size: clamp(17px, 1.6vw, 19px); line-height: 1.65; }
.entry > * { margin: 0; }
.entry p { text-wrap: pretty; }
.entry a { color: var(--red-dark); }
.entry h2, .entry h3 { font-family: var(--display); text-transform: uppercase; line-height: 1; }
.entry h2 { font-size: clamp(32px, 3.5vw, 44px); margin-top: 16px; }
.entry h3 { font-size: clamp(26px, 2.6vw, 32px); margin-top: 8px; }
.entry img { display: block; }
.entry figcaption { margin-top: 8px; font: 500 13px var(--body); color: var(--muted); }
.lede { font: 700 clamp(20px, 2vw, 24px)/1.45 var(--body); text-wrap: pretty; }

.entry .wp-block-pullquote, .entry blockquote { margin: 0; padding: 20px 0; border: 0; border-top: 6px solid var(--ink); border-bottom: 6px solid var(--ink); text-align: left; }
.entry .wp-block-pullquote blockquote { margin: 0; padding: 0; border: 0; }
.entry .wp-block-pullquote p, .entry blockquote p { margin: 0; font: 400 clamp(40px, 5vw, 64px)/.95 var(--display); text-transform: uppercase; color: var(--red); }
.entry .wp-block-pullquote cite, .entry blockquote cite { display: block; margin-top: 12px; font: 700 13px var(--body); text-transform: uppercase; font-style: normal; color: var(--ink); }

.bilans { margin-top: 8px; padding: 24px 28px; background: var(--yellow); }
.bilans__title { font: 400 32px var(--display); text-transform: uppercase; }
.bilans dl { margin: 12px 0 0; }
.bilans__row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid rgba(20, 18, 18, .3); font-size: 16px; line-height: 1.4; }
.bilans__row:first-child { border-top: 2px solid var(--ink); }
.bilans__row:last-child { padding-bottom: 0; }
.bilans dd { margin: 0; font-weight: 700; text-align: right; }
.bilans dd.is-bad { color: var(--red-dark); }

/* Read more */
.more { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.more__item { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: center; text-decoration: none; }
.more__img { width: 240px; height: 150px; }
.more__title { font: 400 clamp(28px, 2.8vw, 36px)/.95 var(--display); text-transform: uppercase; }

@media (max-width: 1000px) { .more { grid-template-columns: 1fr; } }
@media (max-width: 520px) {
	.more__item { grid-template-columns: 120px 1fr; gap: 14px; }
	.more__img { width: 120px; height: 90px; }
	.more__title { font-size: 24px; }
}

/* Lists */
.list-head { padding-bottom: clamp(36px, 5vw, 56px); }
.list-head__desc { margin-top: 16px; font-size: 17px; }
.list-head__desc p { margin: 0; max-width: 640px; }

/* Comments */
.comments { margin-top: 24px; padding-top: 24px; border-top: 6px solid var(--ink); font-size: 16px; }
.comments h2, .comments .comment-reply-title { font: 400 32px var(--display); text-transform: uppercase; }
.comment-list { padding-left: 20px; }
.comment-form input:not([type="submit"]):not([type="checkbox"]), .comment-form textarea { width: 100%; padding: 10px; border: 2px solid var(--ink); border-radius: 0; background: #fff; font: inherit; }
.comment-form .submit, .search-submit { padding: 12px 18px; border: 0; border-radius: 0; background: var(--ink); color: #fff; font: 700 14px var(--body); text-transform: uppercase; cursor: pointer; }
.search-field { padding: 10px; border: 2px solid var(--ink); border-radius: 0; font: inherit; }

/* ---------- Motion ---------- */

@keyframes ma-slam { from { opacity: 0; transform: scale(1.25) rotate(-2deg); } 60% { opacity: 1; transform: scale(.97) rotate(.5deg); } to { transform: none; } }
@keyframes ma-rise { from { opacity: 0; translate: 0 24px; } to { opacity: 1; translate: none; } }
@keyframes ma-drop { from { opacity: 0; translate: 0 -40px; rotate: -8.5deg; } to { opacity: 1; translate: none; rotate: none; } }
@keyframes ma-pop { from { opacity: 0; scale: 0; rotate: -20deg; } 70% { opacity: 1; scale: 1.15; rotate: 2deg; } to { scale: none; rotate: none; } }
@keyframes ma-wobble { 0%, 100% { rotate: none; } 25% { rotate: -4deg; scale: 1.06; } 75% { rotate: 4deg; scale: 1.06; } }
@keyframes ma-reveal { from { opacity: 0; translate: 0 40px; } to { opacity: 1; translate: none; } }
@keyframes ma-swipe { from { opacity: 0; translate: -48px 0; } to { opacity: 1; translate: none; } }

@media (prefers-reduced-motion: no-preference) {
	/* Page-load entrance: hero and red page headers. */
	.band--red .display { animation: ma-slam .6s cubic-bezier(.2, .9, .3, 1.2) both; }
	.band--red .meta { animation: ma-rise .5s ease-out both; }
	.hero__cta, .list-head__desc { animation: ma-rise .5s .35s ease-out both; }
	.hero__photo .polaroid { animation: ma-drop .7s .2s cubic-bezier(.2, .9, .3, 1.1) both; }
	.sticker { animation: ma-pop .5s .75s cubic-bezier(.3, 1.4, .5, 1) both; }
	.hero__photo:hover .sticker { animation: ma-wobble .5s ease-in-out; }
	.article__photo { animation: ma-rise .7s .25s ease-out both; }

	/* Hover. */
	.card__media { overflow: hidden; }
	.card__img { transition: transform .4s ease; }
	.card:hover .card__img { transform: scale(1.06); }
	.card__n { transition: background .2s; }
	.card:hover .card__n { background: var(--red); }
	.btn { transition: transform .15s ease, box-shadow .15s ease; }
	.btn:hover { opacity: 1; transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink); }
	.btn--black:hover { box-shadow: 4px 4px 0 var(--yellow); }
	.btn:active { transform: none; box-shadow: none; }
	.garage__car { transition: background .2s; }
	.garage__car:hover { background: #221f1e; }
	.garage__model { transition: color .2s, transform .2s; transform-origin: left bottom; }
	.garage__car:hover .garage__model { color: var(--yellow); transform: scale(1.06); }
	.more__img { transition: transform .3s ease; }
	.more__item:hover .more__img { transform: rotate(-2deg) scale(1.04); }

	/* Scroll reveals (browsers without scroll-driven animations just show everything). */
	@supports (animation-timeline: view()) {
		.card, .garage__car, .more__item, .bilans, .section-head, .entry .wp-block-pullquote, .entry blockquote {
			animation: ma-reveal linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 60%;
		}
		.cards > :nth-child(3n+2), .garage__car:nth-child(5n+2) { animation-range: entry 8% entry 68%; }
		.cards > :nth-child(3n), .garage__car:nth-child(5n+3) { animation-range: entry 16% entry 76%; }
		.garage__car:nth-child(5n+4) { animation-range: entry 24% entry 84%; }
		.garage__car:nth-child(5n) { animation-range: entry 32% entry 92%; }
		.section-head, .entry .wp-block-pullquote, .entry blockquote { animation-name: ma-swipe; }
	}
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.card, .polaroid { transition: none; }
	.card:hover { transform: none; }
}
