/*
Theme Name: Rooksack
Theme URI: https://rooksack.de/
Author: Peter Althaus
Description: Eigenes Block-Theme für den Reiseblog Rooksack – Postkarten-Look in Gelb und Schwarz.
Version: 1.4.3
Requires at least: 6.6
Requires PHP: 7.4
Text Domain: rooksack
WPVibe: yes
Update URI: false
*/

/* ---------- Seitenränder: Kopfzeile bekommt denselben Abstand wie der Inhalt ---------- */
.wp-site-blocks > header,
.wp-site-blocks > .wp-block-template-part:first-child {
	padding-left: var(--wp--style--root--padding-left);
	padding-right: var(--wp--style--root--padding-right);
}
.rk-header { max-width: var(--wp--style--global--wide-size); margin-left: auto !important; margin-right: auto !important; }

/* ---------- Kopfzeile / Logo ---------- */
.rk-logo { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--wp--preset--color--contrast); }
.rk-logo__badge { width: 56px; height: 56px; border-radius: 50%; background: var(--wp--preset--color--accent); border: 2.5px solid var(--wp--preset--color--contrast); display: grid; place-items: center; flex: 0 0 auto; }
.rk-logo__text { display: flex; flex-direction: column; line-height: 1; }
.rk-logo__name { font-weight: 700; font-size: 1.85rem; letter-spacing: -0.03em; }
.rk-logo__tag { font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; margin-top: 5px; color: var(--wp--preset--color--muted); }
.rk-header .wp-block-navigation a { text-decoration: none; }
.rk-header .wp-block-navigation a:hover { text-decoration: underline; text-decoration-color: var(--wp--preset--color--accent); text-decoration-thickness: 3px; }
.rk-footer .wp-block-navigation a { text-decoration: none; }
@media (max-width: 600px) {
	.rk-logo__badge { width: 46px; height: 46px; }
	.rk-logo__name { font-size: 1.5rem; }
}

/* ---------- Links im Fließtext ---------- */
.rk-prose a { text-decoration-color: var(--wp--preset--color--accent); text-decoration-thickness: 3px; text-underline-offset: 3px; }

/* ---------- Lange Wörter sauber trennen ---------- */
h1, h2, h3, .wp-block-post-title { hyphens: auto; overflow-wrap: break-word; }

/* ---------- Kleine Elemente ---------- */
.rk-kicker, .rk-kicker a { font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--wp--preset--color--muted); text-decoration: none; }
.rk-pill { display: inline-block; background: var(--wp--preset--color--accent); padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 0.875rem; margin: 0; }
.rk-hero-title { font-size: clamp(2.3rem, 4.4vw, 4.4rem); letter-spacing: -0.035em; line-height: 1.04; }
.rk-hero-title a { text-decoration: none; }
.rk-button { display: inline-block; background: var(--wp--preset--color--accent); border: 2px solid var(--wp--preset--color--contrast); padding: 0.9rem 1.5rem; border-radius: 999px; font-weight: 700; text-decoration: none; }
.rk-button:hover { background: var(--wp--preset--color--contrast); color: var(--wp--preset--color--accent); }

/* ---------- Startseite mobil: Bild vor Überschrift ---------- */
@media (max-width: 781px) {
	.rk-hero .wp-block-columns { flex-direction: column-reverse; }
}

/* =========================================================
   Sofortbild-Look – EIN Stil für alle Fotos:
   gleichmäßiger weißer Rand, weicher Schatten, leichte Neigung,
   handschriftliche Bildunterschrift unter dem Foto.
   ========================================================= */
.rk-polaroid img,
.rk-collage__card img,
.rk-prose .wp-block-image img,
.wp-block-gallery.is-style-postkarten img,
.wp-block-gallery.is-style-postkarten .blocks-gallery-item img {
	background: #fff;
	padding: 12px;
	box-sizing: border-box;
	box-shadow: 0 18px 40px rgba(0,0,0,.16);
	border-radius: 0 !important;
}
.rk-prose .wp-block-image figcaption,
.wp-block-gallery.is-style-postkarten figcaption,
.rk-collage__card figcaption {
	position: static !important;
	background: none !important;
	color: var(--wp--preset--color--contrast) !important;
	font-family: var(--wp--preset--font-family--hand);
	font-size: 1.35rem;
	line-height: 1.15;
	padding: 0 !important;
	margin: 14px 4px 0 !important;
	text-align: left;
	max-height: none !important;
	overflow: visible !important;
}

/* Einzelbilder im Beitrag */
.rk-prose > .wp-block-image { transform: rotate(-0.8deg); margin-top: 2.5rem; margin-bottom: 2.5rem; }
.rk-prose > .wp-block-image:nth-of-type(even) { transform: rotate(0.8deg); }

/* Titelbild (Fallback, falls zu wenige Fotos für die Collage) */
.rk-tilt-left { transform: rotate(-2.5deg); }

/* ---------- Collage auf der Startseite ---------- */
.rk-collage { position: relative; height: clamp(440px, 40vw, 580px); }
.rk-collage__card { position: absolute; margin: 0; transition: transform .3s ease; }
.rk-collage__card img { display: block; width: 100%; height: auto; object-fit: cover; }
.rk-collage__card--1 { left: 0; top: 8%; width: 60%; transform: rotate(-4deg); z-index: 1; }
.rk-collage__card--1 img { aspect-ratio: 4 / 3; }
.rk-collage__card--2 { right: 0; top: 0; width: 44%; transform: rotate(4.5deg); z-index: 2; }
.rk-collage__card--2 img { aspect-ratio: 1 / 1; }
.rk-collage__card--3 { right: 6%; bottom: 0; width: 50%; transform: rotate(-1.5deg); z-index: 3; }
.rk-collage__card--3 img { aspect-ratio: 3 / 2; }
.rk-collage__card:hover { transform: rotate(0deg) translateY(-4px); z-index: 4; }
@media (max-width: 781px) {
	.rk-collage { height: auto; }
	.rk-collage__card { position: static; width: auto; }
	.rk-collage__card--1 { transform: rotate(-1.5deg); }
	.rk-collage__card--2, .rk-collage__card--3 { display: none; }
}

/* ---------- Gelbe Reiseziel-Leiste ---------- */
.rk-index__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); row-gap: 1.25rem; }
.rk-index__list a { border-left: 2px solid var(--wp--preset--color--contrast); padding: 4px 20px; display: flex; flex-direction: column; gap: 4px; font-size: 1.6rem; font-weight: 700; text-decoration: none; color: var(--wp--preset--color--contrast); }
.rk-index__list a span { font-size: 0.8rem; font-weight: 400; letter-spacing: 0.14em; text-transform: uppercase; }
.rk-index__list a:hover { text-decoration: underline; }

/* ---------- Beitragskarten im versetzten Raster ---------- */
.rk-masonry { display: block !important; column-count: 3; column-gap: 24px; list-style: none; padding: 0; }
.rk-masonry > li { break-inside: avoid; margin: 0 0 32px; display: inline-block; width: 100%; }
.rk-masonry .wp-block-post-featured-image { margin-bottom: 14px; }
.rk-masonry .rk-kicker { margin: 0 0 4px; }
.rk-card-title { margin: 0; font-size: 1.6rem; line-height: 1.15; letter-spacing: -0.02em; }
.rk-card-title a, .rk-related .wp-block-post-title a { text-decoration: none; }
.rk-card-title a:hover, .rk-related .wp-block-post-title a:hover { text-decoration: underline; text-decoration-color: var(--wp--preset--color--accent); text-decoration-thickness: 3px; }
.rk-related-card { border-radius: 14px; overflow: hidden; height: 100%; }
@media (max-width: 900px) { .rk-masonry { column-count: 2; } }
@media (max-width: 600px) { .rk-masonry { column-count: 1; } }

/* ---------- Vorschaubilder: einheitlich 3:2 (Kamera-Querformat), mittig zugeschnitten ---------- */
.rk-masonry { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.5rem 1.75rem; column-count: auto; }
.rk-masonry > li { margin: 0; display: flex; flex-direction: column; }
.rk-masonry .wp-block-post-featured-image,
.rk-related .wp-block-post-featured-image { aspect-ratio: 3 / 2 !important; overflow: hidden; width: 100%; }
.rk-masonry .wp-block-post-featured-image a,
.rk-related .wp-block-post-featured-image a { display: block; height: 100%; }
.rk-masonry .wp-block-post-featured-image img,
.rk-related .wp-block-post-featured-image img { width: 100% !important; height: 100% !important; aspect-ratio: auto !important; object-fit: cover !important; object-position: center center !important; }
@media (max-width: 900px) { .rk-masonry { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .rk-masonry { grid-template-columns: 1fr; } }

/* ---------- Im Fokus ---------- */
.rk-hand { font-family: var(--wp--preset--font-family--hand); font-size: 1.75rem; line-height: 1.1; margin: 0; }
.rk-fokus-grid { gap: 2rem !important; }
.rk-fokus-grid > li { display: flex; }
.rk-fokus-card, .rk-related-card { width: 100%; box-shadow: 0 14px 34px rgba(0,0,0,.10); display: block; padding: 0 !important; }
.rk-fokus-card .wp-block-post-featured-image { aspect-ratio: 3 / 2 !important; overflow: hidden; margin: 0; width: 100%; }
.rk-fokus-card .wp-block-post-featured-image a { display: block; height: 100%; }
.rk-fokus-card .wp-block-post-featured-image img { width: 100% !important; height: 100% !important; object-fit: cover !important; object-position: center center !important; }
.rk-fokus-card .rk-card-title { font-size: 1.6rem; }
.rk-fokus-card .wp-block-post-excerpt__excerpt { margin: 0; }
@media (max-width: 900px) { .rk-fokus-grid { grid-template-columns: 1fr !important; } }

/* ---------- Reiseziel-Leiste mobil ---------- */
@media (max-width: 700px) {
	.rk-index__list { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 1rem; column-gap: .5rem; }
	.rk-index__list a { font-size: clamp(1.05rem, 4.6vw, 1.3rem); padding: 2px 12px; hyphens: none; overflow-wrap: normal; word-break: normal; }
	.rk-index__list a span { font-size: .68rem; letter-spacing: .12em; }
}
@media (max-width: 340px) {
	.rk-index__list { grid-template-columns: 1fr; }
}

/* ---------- Kästen Startseite ---------- */
.rk-box { border: 2px solid var(--wp--preset--color--contrast); border-radius: 20px; padding: clamp(1.5rem, 4vw, 2.5rem); }
.rk-box--dark a { color: inherit; }
.rk-box--dark .is-style-outline .wp-block-button__link { color: var(--wp--preset--color--base); border-color: var(--wp--preset--color--base); background: transparent; }

/* ---------- Beitrag ---------- */
.wp-block-post-content.rk-prose { max-width: none !important; }
.rk-post-title { font-size: clamp(2.4rem, 5.5vw, 5rem); }
.rk-prose > p:first-of-type::first-letter { float: left; font-weight: 700; font-size: 5.1rem; line-height: .82; padding: 6px 12px 0 0; }
/* Ältere Beiträge nutzen H1 als Zwischenüberschrift – gleiche Größe wie H2 */
.rk-prose h1 { font-size: clamp(1.6rem, 2.4vw, 2.1rem); line-height: 1.15; letter-spacing: -0.03em; margin-top: var(--wp--preset--spacing--50); }
.rk-prose .wp-block-image img, .rk-hero-image img { cursor: zoom-in; }
.rk-prose p { hyphens: auto; }
.rk-prose .wp-block-quote { border: 0; padding: 0; margin-top: 3rem; margin-bottom: 3rem; }
.rk-prose .wp-block-quote::before { content: ""; display: block; width: 64px; height: 6px; background: var(--wp--preset--color--accent); margin-bottom: 20px; }
.rk-prose .wp-block-quote cite { font-size: 1rem; font-weight: 400; color: var(--wp--preset--color--muted); }

/* ---------- Galerie: Postkarten (Raster statt Spalten = sauberer Umbruch) ---------- */
.wp-block-gallery.is-style-postkarten {
	display: grid !important;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 2.25rem 1.75rem !important;
	align-items: start;
	margin-top: 2.5rem !important;
	margin-bottom: 3rem !important;
}
.wp-block-gallery.is-style-postkarten.columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wp-block-gallery.is-style-postkarten > figure.wp-block-image {
	width: auto !important;
	margin: 0 !important;
	display: block;
	background: none !important;
	box-shadow: none !important;
	padding: 0 !important;
}
.wp-block-gallery.is-style-postkarten > figure.wp-block-image > a,
.wp-block-gallery.is-style-postkarten > figure.wp-block-image > img { display: block; }
.wp-block-gallery.is-style-postkarten img { display: block; width: 100% !important; height: auto !important; flex: none !important; }
.wp-block-gallery.is-style-postkarten > figure:nth-child(6n+1) { transform: rotate(-1.2deg); }
.wp-block-gallery.is-style-postkarten > figure:nth-child(6n+2) { transform: rotate(1deg); }
.wp-block-gallery.is-style-postkarten > figure:nth-child(6n+3) { transform: rotate(-0.5deg); }
.wp-block-gallery.is-style-postkarten > figure:nth-child(6n+4) { transform: rotate(0.8deg); }
.wp-block-gallery.is-style-postkarten > figure:nth-child(6n+5) { transform: rotate(-1deg); }
.wp-block-gallery.is-style-postkarten > figure:nth-child(6n+6) { transform: rotate(1.4deg); }
@media (max-width: 782px) { .wp-block-gallery.is-style-postkarten { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 1.5rem 1.1rem !important; } }
@media (max-width: 480px) { .wp-block-gallery.is-style-postkarten { grid-template-columns: 1fr !important; } }

/* Ältere Galerie-Blöcke (Liste statt verschachtelter Bilder) */
.wp-block-gallery.is-style-postkarten .blocks-gallery-grid { display: contents !important; }
.wp-block-gallery.is-style-postkarten .blocks-gallery-item { width: auto !important; margin: 0 !important; display: block; list-style: none; }
.wp-block-gallery.is-style-postkarten .blocks-gallery-item figure { display: block !important; height: auto !important; margin: 0; }
.wp-block-gallery.is-style-postkarten .blocks-gallery-item:nth-child(3n+1) { transform: rotate(-1deg); }
.wp-block-gallery.is-style-postkarten .blocks-gallery-item:nth-child(3n+2) { transform: rotate(0.8deg); }
.wp-block-gallery.is-style-postkarten .blocks-gallery-item:nth-child(3n) { transform: rotate(-0.4deg); }

/* =========================================================
   Galerie-Mosaik: gemischte Formate, jede Reihe gleich breit
   ========================================================= */
.rk-gallery { --gap: 10px; display: flex; flex-direction: column; gap: var(--gap); margin-top: 2.5rem !important; margin-bottom: 3rem !important; background: #fff; padding: var(--gap); box-shadow: 0 18px 40px rgba(0,0,0,.14); }
.rk-gallery__row { display: flex; gap: var(--gap); width: 100%; }
.rk-unit { min-width: 0; height: 100%; position: relative; }
.rk-unit--stack { display: grid; gap: var(--gap); }
.rk-tile { position: relative; display: block; width: 100%; height: 100%; overflow: hidden; background: #eee; cursor: zoom-in; }
.rk-tile img { display: block; width: 100% !important; height: 100% !important; object-fit: cover; padding: 0 !important; box-shadow: none !important; transition: transform .5s ease; }
.rk-tile__cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 12px 9px; background: rgba(255,255,255,.92); font-family: var(--wp--preset--font-family--hand); font-size: 1.25rem; line-height: 1.1; color: var(--wp--preset--color--contrast); transform: translateY(101%); transition: transform .25s ease; }
.rk-tile:hover img, .rk-tile:focus-visible img { transform: scale(1.03); }
.rk-tile:hover .rk-tile__cap, .rk-tile:focus-visible .rk-tile__cap { transform: none; }
.rk-tile:focus-visible { outline: 3px solid var(--wp--preset--color--accent); outline-offset: 2px; }
@media (max-width: 600px) {
	.rk-gallery { --gap: 6px; }
	.rk-gallery__row { flex-direction: column; aspect-ratio: auto !important; }
	.rk-unit { flex: none !important; width: 100%; height: auto; aspect-ratio: var(--u); }
	.rk-tile__cap { transform: none; font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) { .rk-tile img, .rk-tile__cap { transition: none; } }

/* ---------- Lightbox ---------- */
.rk-lb-open { overflow: hidden; }
.rk-lb { position: fixed; inset: 0; z-index: 100000; background: rgba(12,12,12,.94); display: flex; align-items: center; justify-content: center; padding: 64px 72px 56px; box-sizing: border-box; }
.rk-lb[hidden] { display: none; }
.rk-lb__card { margin: 0; background: #fff; padding: 12px 12px 14px; box-shadow: 0 30px 80px rgba(0,0,0,.5); max-width: 100%; max-height: 100%; display: flex; flex-direction: column; }
.rk-lb__img { display: block; max-width: min(1400px, calc(100vw - 168px)); max-height: calc(100vh - 210px); width: auto; height: auto; object-fit: contain; }
.rk-lb__cap { font-family: var(--wp--preset--font-family--hand); font-size: 1.6rem; line-height: 1.15; color: #111; padding: 10px 4px 0; max-width: 60ch; }
.rk-lb__count { position: absolute; top: 20px; left: 24px; color: #fff; font-size: .95rem; letter-spacing: .08em; }
.rk-lb button { position: absolute; border: 0; cursor: pointer; display: grid; place-items: center; border-radius: 50%; }
.rk-lb button[hidden] { display: none; }
.rk-lb__close { top: 14px; right: 16px; width: 48px; height: 48px; background: transparent; color: #fff; }
.rk-lb__nav { top: 50%; width: 52px; height: 52px; margin-top: -26px; background: var(--wp--preset--color--accent); color: #111; }
.rk-lb__prev { left: 12px; background: rgba(255,255,255,.14); color: #fff; }
.rk-lb__next { right: 12px; }
.rk-lb button:focus-visible { outline: 3px solid var(--wp--preset--color--accent); outline-offset: 3px; }
@media (max-width: 600px) {
	.rk-lb { padding: 56px 10px 80px; }
	.rk-lb__img { max-width: calc(100vw - 44px); max-height: calc(100vh - 220px); }
	.rk-lb__nav { top: auto; bottom: 14px; margin-top: 0; }
	.rk-lb__prev { left: calc(50% - 64px); }
	.rk-lb__next { right: calc(50% - 64px); }
	.rk-lb__cap { font-size: 1.3rem; }
}

/* ---------- Galerie: Filmstreifen ---------- */
.wp-block-gallery.is-style-filmstreifen { flex-wrap: nowrap !important; overflow-x: auto; gap: 12px !important; padding-bottom: 12px; scroll-snap-type: x mandatory; }
.wp-block-gallery.is-style-filmstreifen > figure.wp-block-image { flex: 0 0 min(80%, 640px) !important; width: auto !important; scroll-snap-align: start; }
.wp-block-gallery.is-style-filmstreifen > figure.wp-block-image img { height: 420px !important; object-fit: cover; }

/* ---------- Bewegung reduzieren ---------- */
@media (prefers-reduced-motion: no-preference) {
	.rk-masonry .wp-block-post-featured-image img { transition: transform .5s ease; }
	.rk-masonry .wp-block-post-featured-image:hover img { transform: scale(1.03); }
}
@media (prefers-reduced-motion: reduce) {
	.rk-collage__card { transition: none; }
}
