/*
 * Sawa Kutschenbau — the whole stylesheet.
 *
 * Replaces the Pixelarity "Editorial" theme (59 KB of CSS that needed jQuery and
 * skel.js just to place the sidebar). Same identity — the green, Roboto Slab over
 * Open Sans, sidebar beside the content — laid out with Grid and sticky
 * positioning instead.
 *
 * Contents
 *   1. tokens
 *   2. reset and base
 *   3. typography
 *   4. layout: page, sidebar, nav
 *   5. content blocks
 *   6. image galleries          <- the 1/2/3 column grids
 *   7. tables and lists
 *   8. forms
 *   9. guestbook
 *  10. lightbox
 *  11. print
 */

/* ---------------------------------------------------------------- 1. tokens */

:root {
	--green:        #455646;
	--green-dark:   #33402f;
	--green-light:  #eef1ee;
	--ink:          #2f3437;
	--ink-soft:     #5d666b;
	--ink-faint:    #8b9399;
	--rule:         #dde1e3;
	--page:         #ffffff;
	--panel:        #f6f7f6;
	--claim:        #b3261e;

	--font-body:    "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-display: "Roboto Slab", Georgia, serif;

	--sidebar:      21rem;
	--gutter:       clamp(1.5rem, 4vw, 4rem);
	--measure:      78rem;

	--radius:       6px;
	--shadow:       0 1px 2px rgba(47, 52, 55, .06), 0 6px 20px rgba(47, 52, 55, .07);
	--shadow-lift:  0 2px 6px rgba(47, 52, 55, .10), 0 14px 40px rgba(47, 52, 55, .14);

	--speed:        .18s;
}

/* ------------------------------------------------------- 2. reset and base */

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

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

body {
	margin: 0;
	background: var(--page);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 1.0625rem;      /* 17px — the old theme ran small */
	line-height: 1.7;
	-webkit-font-smoothing: antialiased;
}

img, svg, video {
	display: block;
	max-width: 100%;
	height: auto;
}

a {
	color: var(--green);
	text-decoration-thickness: 1px;
	text-underline-offset: .18em;
	transition: color var(--speed) ease;
}

a:hover { color: var(--claim); }

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

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		animation-duration: .01ms !important;
		transition-duration: .01ms !important;
	}
}

/* ------------------------------------------------------------ 3. typography */

h1, h2, h3, h4 {
	font-family: var(--font-display);
	font-weight: 700;
	line-height: 1.2;
	color: var(--green-dark);
	margin: 0 0 .6em;
	text-wrap: balance;
}

h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); }
h2 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.6rem); }
h3 { font-size: clamp(1.2rem, 1.05rem + .7vw, 1.5rem); }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

strong, b { font-weight: 600; }

/*
 * The marketing claims. These were hardcoded red Arial in the old content; the
 * emphasis is deliberate, so it survives — just as classes, and in the site's
 * own typeface.
 */
.claim {
	display: block;
	font-family: var(--font-display);
	font-size: clamp(1.25rem, 1rem + 1.2vw, 1.75rem);
	font-weight: 700;
	line-height: 1.25;
	color: var(--claim);
}

.claim-sub {
	display: inline-block;
	font-family: var(--font-display);
	font-size: 1.0625rem;
	font-weight: 700;
	color: var(--claim);
	border-bottom: 2px solid currentColor;
	padding-bottom: 1px;
}

.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-lg     { font-size: 1.25em; }

/* -------------------------------------------------- 4. layout: page, sidebar */

.page {
	display: grid;
	grid-template-columns: var(--sidebar) minmax(0, 1fr);
	align-items: start;
	min-height: 100vh;
}

/* Content comes first in the markup, for readers and crawlers; Grid puts the
   sidebar back on the left visually. */
.content { grid-column: 2; }
.sidebar  { grid-column: 1; grid-row: 1; }

.content-inner {
	max-width: var(--measure);
	padding: clamp(1.75rem, 3vw, 3.5rem) var(--gutter) 5rem;
}

/* ---- masthead ---- */

.masthead {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	padding-bottom: 1.25rem;
	margin-bottom: clamp(1.5rem, 3vw, 2.75rem);
	border-bottom: 3px solid var(--green);
}

.masthead-title {
	margin: 0;
	font-size: clamp(1.15rem, .9rem + 1.1vw, 1.75rem);
}

.masthead-title a { color: inherit; text-decoration: none; }
.masthead-title a:hover { color: var(--green); }

.masthead-logo { flex: 0 0 auto; width: 120px; }

/* ---- sidebar ---- */

.sidebar {
	position: sticky;
	top: 0;
	align-self: start;
	max-height: 100vh;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--panel);
	border-right: 1px solid var(--rule);
	padding: clamp(1.75rem, 3vw, 3rem) 0 3rem;
}

.nav-heading {
	font-family: var(--font-display);
	font-size: .8rem;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--ink-faint);
	margin: 2.25rem 0 .5rem;
	padding: 0 1.75rem;
}

.nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.nav a {
	display: block;
	padding: .6rem 1.75rem;
	font-size: .95rem;
	font-weight: 600;
	color: var(--ink-soft);
	text-decoration: none;
	border-left: 3px solid transparent;
	transition: background var(--speed) ease, color var(--speed) ease,
	            border-color var(--speed) ease;
}

.nav a:hover {
	background: var(--green-light);
	color: var(--green-dark);
}

.nav a[aria-current="page"] {
	color: var(--green-dark);
	background: var(--green-light);
	border-left-color: var(--green);
}

.sidebar-footer {
	margin-top: 2.5rem;
	padding: 1.25rem 1.75rem 0;
	border-top: 1px solid var(--rule);
	font-size: .8rem;
	color: var(--ink-faint);
}

.sidebar-footer p { margin: 0; }

/* ---- the mobile drawer ---- */

.nav-toggle {
	display: none;
	align-items: center;
	gap: .5rem;
	background: none;
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	color: var(--green-dark);
	font: inherit;
	font-size: .9rem;
	font-weight: 600;
	padding: .5rem .8rem;
	cursor: pointer;
}

.nav-toggle svg { width: 1.25rem; height: 1.25rem; }

.nav-scrim {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 40;
	background: rgba(47, 52, 55, .5);
}

@media (max-width: 60rem) {
	.page { grid-template-columns: minmax(0, 1fr); }
	.content, .sidebar { grid-column: 1; }

	.nav-toggle { display: inline-flex; }

	.sidebar {
		position: fixed;
		inset: 0 auto 0 0;
		z-index: 50;
		width: min(20rem, 84vw);
		max-height: none;
		border-right: 1px solid var(--rule);
		box-shadow: var(--shadow-lift);
		transform: translateX(-100%);
		transition: transform .22s ease;
	}

	body.nav-open .sidebar   { transform: translateX(0); }
	body.nav-open .nav-scrim { display: block; }
	body.nav-open            { overflow: hidden; }

	.masthead { flex-wrap: wrap; }
}

/* ------------------------------------------------------- 5. content blocks */

.block {
	margin: 0 0 clamp(2rem, 4vw, 3.5rem);
}

.block:last-child { margin-bottom: 0; }

.block > h3 { margin-top: 0; }

/*
 * One item for sale on the Gebrauchtmarkt. The green rule closes each entry off,
 * so several listings underneath each other stay readable as separate adverts.
 */
.listing {
	padding-bottom: clamp(1.5rem, 3vw, 2.5rem);
	border-bottom: 3px solid var(--green);
}

.listing h4 {
	margin-top: 1.75rem;
	margin-bottom: .35em;
}

/*
 * Text with an image floated alongside it (the old ce-textpic).
 *
 * A floated gallery shrink-wraps to its image's natural width — 600px, the
 * thumbnail size — which is the right weight for a hero shot next to a short
 * list. Where that is too dominant for the amount of text, add `is-narrow` to
 * the gallery.
 */
.textpic { display: block; }

.textpic .gallery { margin: 0 0 1.25rem; }

@media (min-width: 45rem) {
	.textpic-right .gallery { float: right; margin: .25rem 0 1.25rem 2rem; }
	.textpic-left  .gallery { float: left;  margin: .25rem 2rem 1.25rem 0; }
	.textpic::after { content: ""; display: table; clear: both; }
}

/* --------------------------------------------------- 6. image galleries */

/*
 * The column count is content, not decoration: a row of three images on the old
 * site has to stay a row of three, so it comes straight from the markup as
 * cols-1 / cols-2 / cols-3 rather than being derived from available width.
 *
 * Below the breakpoints the grid steps down so the images never get too small to
 * read on a phone.
 */
.gallery {
	display: grid;
	gap: clamp(.75rem, 1.5vw, 1.5rem);
	align-items: start;
	margin: 0 0 1.5rem;
}

.gallery.cols-1 { grid-template-columns: minmax(0, 1fr); max-width: 46rem; }
.gallery.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 45rem) {
	.gallery.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 30rem) {
	.gallery.cols-2,
	.gallery.cols-3 { grid-template-columns: minmax(0, 1fr); }
}

/*
 * Half-width variant for a floated image that would otherwise crowd the text
 * beside it. Declared after the cols-* rules so it wins on equal specificity.
 */
.gallery.is-narrow { max-width: 300px; }

/*
 * Thumbnail row: several small shots of one listing, each opening full size on
 * click. Every thumbnail is the same width, capped at 200px, and as many fit per
 * row as the width allows — four stay on one line on a desktop and they wrap by
 * themselves on a phone, rather than stretching to fill the way a cols-N grid
 * would. A row that wraps keeps the same track width, so a lone last image is
 * not left larger than the ones above it.
 *
 * `minmax(140px, 1fr)` and not `minmax(140px, 200px)`: with a definite maximum
 * the browser works out how many tracks fit from that maximum, so at phone width
 * a single 200px track fits and the images end up stacked. With `1fr` the track
 * count comes from the 140px minimum and the cap moves to the figure, and
 * `auto-fit` drops the tracks nothing landed in so a short row still fills the
 * width.
 */
.gallery.is-thumbs {
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.gallery.is-thumbs figure { max-width: 200px; }

.gallery figure {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: .5rem;
}

/*
 * No image is ever rendered wider than the file behind it: `width: auto` sizes
 * it at its own pixel width, and the `max-width: 100%` from the reset shrinks it
 * again whenever the column is narrower. Stretching a 600px thumbnail to fill a
 * wider column only softens it, and there are no larger files to swap in.
 * Anything narrower than its column is centred rather than left in the corner.
 */
.gallery img {
	width: auto;
	margin-inline: auto;
	border-radius: var(--radius);
	background: var(--panel);
	box-shadow: var(--shadow);
	transition: transform var(--speed) ease, box-shadow var(--speed) ease;
}

.gallery a {
	display: block;
	border-radius: var(--radius);
}

.gallery a:hover img {
	transform: translateY(-3px);
	box-shadow: var(--shadow-lift);
}

.gallery figcaption {
	font-size: .875rem;
	line-height: 1.5;
	color: var(--ink-soft);
}

/* ------------------------------------------------------ 7. tables and lists */

.data-table {
	width: 100%;
	border-collapse: collapse;
	margin: 0 0 1.5rem;
	font-size: .95rem;
}

.data-table th,
.data-table td {
	text-align: left;
	vertical-align: top;
	padding: .6rem .85rem;
	border-bottom: 1px solid var(--rule);
}

.data-table thead th {
	font-family: var(--font-display);
	font-size: .8rem;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--page);
	background: var(--green);
	border-bottom: 0;
}

.data-table tbody tr:nth-child(even) { background: var(--panel); }
.data-table tbody tr:hover           { background: var(--green-light); }

/* Wide tables scroll rather than pushing the page sideways. */
.table-scroll {
	overflow-x: auto;
	margin: 0 0 1.5rem;
}

.block ul {
	margin: 0 0 1.1em;
	padding-left: 1.1rem;
}

.block li { margin-bottom: .35em; }
.block li::marker { color: var(--green); }

/* ---------------------------------------------------------------- 8. forms */

.form-block { max-width: 34rem; }

.form label {
	display: block;
	font-size: .9rem;
	font-weight: 600;
	color: var(--ink-soft);
	margin-bottom: .35rem;
}

.form input[type="text"],
.form input[type="email"],
.form textarea {
	display: block;
	width: 100%;
	font: inherit;
	color: inherit;
	background: var(--page);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	padding: .6rem .75rem;
	margin-bottom: 1.25rem;
	transition: border-color var(--speed) ease, box-shadow var(--speed) ease;
}

.form textarea {
	min-height: 12rem;
	resize: vertical;
	line-height: 1.6;
}

.form input:focus,
.form textarea:focus {
	outline: 0;
	border-color: var(--green);
	box-shadow: 0 0 0 3px rgba(69, 86, 70, .15);
}

.form input.has-error,
.form textarea.has-error { border-color: var(--claim); }

.required { color: var(--claim); padding-left: .15em; }

.field-error {
	display: block;
	margin: -1rem 0 1.25rem;
	font-size: .85rem;
	color: var(--claim);
}

.button,
.form button,
.form input[type="submit"] {
	display: inline-block;
	font-family: var(--font-display);
	font-size: .9rem;
	font-weight: 700;
	letter-spacing: .04em;
	color: var(--page);
	background: var(--green);
	border: 0;
	border-radius: var(--radius);
	padding: .7rem 1.5rem;
	cursor: pointer;
	text-decoration: none;
	transition: background var(--speed) ease, transform var(--speed) ease;
}

.button:hover,
.form button:hover,
.form input[type="submit"]:hover {
	background: var(--green-dark);
	color: var(--page);
	transform: translateY(-1px);
}

.form-note {
	font-size: .8rem;
	color: var(--ink-faint);
	margin: 1.25rem 0 0;
}

.form-message {
	border-radius: var(--radius);
	border-left: 4px solid;
	padding: 1rem 1.25rem;
	margin-bottom: 1.75rem;
}

.form-message.is-success {
	background: var(--green-light);
	border-color: var(--green);
	color: var(--green-dark);
}

.form-message.is-error {
	background: #fbeeee;
	border-color: var(--claim);
	color: #7d2222;
}

.form-message ul { margin: .5rem 0 0; padding-left: 1.15rem; }

/* The honeypot: off-screen rather than hidden, because bots skip fields that
   are explicitly display:none. */
.hp-field {
	position: absolute;
	left: -99999px;
	top: 0;
}

/* ------------------------------------------------------------ 9. guestbook */

.guestbook-list {
	margin-top: 2.5rem;
	border-top: 1px solid var(--rule);
}

.guestbook-entry {
	padding: 1.75rem 0;
	border-bottom: 1px solid var(--rule);
}

.guestbook-entry-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
}

.guestbook-entry h3 { margin: 0 0 .5rem; }

.guestbook-entry-site {
	flex: 0 0 auto;
	font-size: .85rem;
	white-space: nowrap;
}

.guestbook-empty { color: var(--ink-faint); font-style: italic; }

.pagination {
	display: flex;
	flex-wrap: wrap;
	gap: .4rem;
	list-style: none;
	margin: 2.5rem 0 0;
	padding: 0;
}

.pagination li { margin: 0; }

.pagination a,
.pagination span {
	display: block;
	min-width: 2.5rem;
	text-align: center;
	padding: .45rem .7rem;
	font-size: .9rem;
	font-weight: 600;
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	color: var(--ink-soft);
	text-decoration: none;
}

.pagination a:hover {
	border-color: var(--green);
	color: var(--green-dark);
	background: var(--green-light);
}

.pagination .is-current span {
	background: var(--green);
	border-color: var(--green);
	color: var(--page);
}

.pagination .is-disabled span {
	color: var(--ink-faint);
	opacity: .55;
}

/* ------------------------------------------------------------ 10. lightbox */

.lightbox-overlay {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: grid;
	grid-template-rows: 1fr auto;
	background: rgba(23, 26, 27, .94);
}

.lightbox-overlay[hidden] { display: none; }

.lightbox-stage {
	display: grid;
	place-items: center;
	min-height: 0;
	padding: 3.5rem 1rem 1rem;
}

.lightbox-stage img {
	max-width: min(96vw, 1400px);
	max-height: 100%;
	width: auto;
	border-radius: var(--radius);
	object-fit: contain;
}

.lightbox-caption {
	padding: 1rem 1.5rem 1.5rem;
	text-align: center;
	color: #f2f3f2;
	font-size: .95rem;
	line-height: 1.5;
}

.lightbox-caption:empty { padding: 0; }

.lightbox-overlay button {
	position: absolute;
	display: grid;
	place-items: center;
	width: 3rem;
	height: 3rem;
	background: rgba(255, 255, 255, .1);
	border: 0;
	border-radius: 50%;
	color: #fff;
	font: inherit;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	transition: background var(--speed) ease;
}

.lightbox-overlay button:hover { background: rgba(255, 255, 255, .22); }

.lightbox-close { top: 1rem; right: 1rem; }
.lightbox-prev  { left: 1rem;  top: 50%; transform: translateY(-50%); }
.lightbox-next  { right: 1rem; top: 50%; transform: translateY(-50%); }

.lightbox-counter {
	position: absolute;
	top: 1.6rem;
	left: 1.5rem;
	color: #cfd3d1;
	font-size: .85rem;
	letter-spacing: .04em;
}

@media (max-width: 45rem) {
	.lightbox-overlay button { width: 2.5rem; height: 2.5rem; font-size: 1.15rem; }
	.lightbox-prev { left: .5rem; }
	.lightbox-next { right: .5rem; }
}

/* ------------------------------------------------- 11. guestbook admin */

/*
 * /admin/ — the moderation page. It reuses the site's tokens and form styles but
 * has no sidebar and no navigation: it is a tool, not a page of the website.
 */

.admin-shell {
	max-width: 60rem;
	margin: 0 auto;
	padding: clamp(1.5rem, 4vw, 3rem) var(--gutter) 5rem;
}

.admin-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding-bottom: 1rem;
	margin-bottom: 2rem;
	border-bottom: 3px solid var(--green);
}

.admin-bar h1 { margin: 0; font-size: 1.5rem; }

.admin-bar-actions {
	display: flex;
	align-items: center;
	gap: 1.25rem;
}

.admin-bar-actions form { margin: 0; }

.admin-login {
	max-width: 22rem;
	margin-top: 2rem;
}

.admin-summary {
	color: var(--ink-soft);
	margin-bottom: 2rem;
}

.admin-entry {
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	padding: 1.25rem 1.5rem;
	margin-bottom: 1.25rem;
	background: var(--page);
}

/* Anything awaiting a decision is flagged, so it cannot be scrolled past. */
.admin-entry.is-pending {
	border-color: var(--claim);
	background: #fdf7f6;
}

.admin-entry-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: .75rem;
}

.admin-entry-head h2 {
	margin: 0 0 .25em;
	font-size: 1.15rem;
}

.admin-badge {
	flex: 0 0 auto;
	font-family: var(--font-body);
	font-size: .7rem;
	font-weight: 700;
	letter-spacing: .07em;
	text-transform: uppercase;
	padding: .2rem .55rem;
	border-radius: 100px;
	background: var(--claim);
	color: #fff;
}

.admin-badge.is-live { background: var(--green); }

.admin-meta {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: .1rem .75rem;
	margin: .75rem 0 1rem;
	font-size: .82rem;
	color: var(--ink-faint);
}

.admin-meta dt { font-weight: 600; }
.admin-meta dd { margin: 0; overflow-wrap: anywhere; }

.admin-message {
	white-space: normal;
	padding: .9rem 1.1rem;
	background: var(--panel);
	border-radius: var(--radius);
	font-size: .95rem;
	line-height: 1.6;
}

.admin-entry-actions {
	display: flex;
	flex-wrap: wrap;
	gap: .6rem;
	margin-top: 1rem;
}

.admin-entry-actions form { margin: 0; }

.button-quiet {
	background: transparent;
	color: var(--green) !important;
	box-shadow: inset 0 0 0 1px var(--rule);
}

.button-quiet:hover {
	background: var(--green-light);
	color: var(--green-dark) !important;
}

.button-danger { background: var(--claim); }
.button-danger:hover { background: #8f1e17; }

.admin-footnote {
	margin-top: 2.5rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--rule);
	font-size: .85rem;
	color: var(--ink-faint);
}

.admin code {
	font-size: .9em;
	background: var(--panel);
	padding: .1em .35em;
	border-radius: 3px;
}

/* --------------------------------------------------------------- 12. print */

@media print {
	.sidebar, .nav-toggle, .nav-scrim, .lightbox-overlay { display: none !important; }
	.page { display: block; }
	body { font-size: 11pt; }
	.gallery img { box-shadow: none; }
	a { color: inherit; text-decoration: none; }
}
