/* ==========================================================================
   blog.rpix.dk — "Fjord"
   Palette taken from images/hav1.jpg: misty sky, slate water, warm sand.
   ========================================================================== */

:root {
	--bg:          #f3f5f7;
	--surface:     #ffffff;
	--surface-2:   #eef2f5;
	--text:        #1b2631;
	--muted:       #627180;
	--border:      #dbe2e8;
	--accent:      #23688c;   /* fjord blue */
	--accent-hover:#17506d;
	--accent-soft: #e3eff5;
	--sand:        #c49a52;   /* beach */
	--sand-soft:   #f6efe2;
	--code-bg:     #edf1f4;
	--pre-bg:      #14202b;
	--error:       #a23b2a;
	--error-bg:    #fbeeea;

	--radius:      14px;
	--radius-sm:   8px;
	--shadow-sm:   0 1px 2px rgba(20,40,60,.06);
	--shadow:      0 1px 2px rgba(20,40,60,.05), 0 10px 30px -12px rgba(20,40,60,.18);
	--shadow-lg:   0 2px 4px rgba(20,40,60,.06), 0 24px 48px -16px rgba(20,40,60,.28);

	--font:        system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-serif:  "Iowan Old Style", "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
	--font-mono:   ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, Consolas, monospace;

	--measure:     62rem;   /* samme bredde som /assets/site.css */
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg:          #0e151c;
		--surface:     #151f29;
		--surface-2:   #1b2733;
		--text:        #e3e9ee;
		--muted:       #93a3b2;
		--border:      #263544;
		--accent:      #7cbbd9;
		--accent-hover:#a5d3e8;
		--accent-soft: #1a3140;
		--sand:        #dcbc82;
		--sand-soft:   #2a2519;
		--code-bg:     #1c2934;
		--pre-bg:      #0a1016;
		--error:       #f19a8a;
		--error-bg:    #3a201c;
		--shadow-sm:   0 1px 2px rgba(0,0,0,.3);
		--shadow:      0 1px 2px rgba(0,0,0,.3), 0 10px 30px -12px rgba(0,0,0,.6);
		--shadow-lg:   0 2px 4px rgba(0,0,0,.3), 0 24px 48px -16px rgba(0,0,0,.7);
	}
}

/* --- Base ---------------------------------------------------------------- */

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

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

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	font-size: 17px;
	line-height: 1.7;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
	font-family: var(--font-serif);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -.01em;
	color: var(--text);
	margin: 1.8em 0 .5em;
	text-wrap: balance;
}

h1 { font-size: clamp(2rem, 4.5vw, 2.75rem); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

a {
	color: var(--accent);
	text-decoration: none;
	transition: color .15s, background-color .15s, box-shadow .15s, transform .15s;
}
a:hover { color: var(--accent-hover); }

hr {
	border: 0;
	height: 1px;
	background: var(--border);
	margin: 2rem 0;
}

img { max-width: 100%; height: auto; }

::selection { background: var(--accent-soft); color: var(--text); }

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-radius: 4px;
}

/* sticky footer on the public pages */
body.site { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
body.site .content { flex: 1; width: 100%; }

/* --- Masthead ------------------------------------------------------------ */

.masthead {
	position: relative;
	z-index: 0;
	min-height: 15rem;
	display: flex;
	align-items: flex-end;
	overflow: hidden;
	background: #5d7488;
	color: #fff;
}

/* the photo layer is 25% taller than the banner and sticks out above it,
   so the top 20% of the picture is cut off instead of the photo shrinking */
.masthead::before {
	content: "";
	position: absolute;
	z-index: -1;
	inset: -25% 0 0 0;
	background:
		linear-gradient(180deg, rgba(14,28,40,.05) 0%, rgba(14,28,40,.6) 100%),
		url("../images/hav1.jpg") center 40% / cover no-repeat;
}


/* tablet and up: the banner becomes a rounded card the same width as the posts */
@media (min-width: 600px) {
	.masthead {
		width: calc(100% - 2.5rem);
		max-width: calc(var(--measure) - 2.5rem);
		min-height: 17rem;
		margin: 1.5rem auto 0;
		border-radius: var(--radius);
		box-shadow: var(--shadow);
	}
	.masthead .masthead__inner { padding: 2rem 2.25rem; }
	.content { padding-top: 1.25rem; }
}

.masthead__inner {
	width: 100%;
	max-width: var(--measure);
	margin: 0 auto;
	padding: 1.75rem 1.25rem;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1rem 1.5rem;
}

.masthead__title {
	font-family: var(--font-serif);
	font-size: clamp(2.4rem, 7vw, 3.6rem);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -.02em;
	color: #fff;
	text-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.masthead__title span { color: #f0d9a8; font-weight: 400; }
.masthead__title:hover { color: #fff; }

/* Kategorierne under titlen (Projekter, Rockbands, Musik, Blog), se /includes/site_header.php.
   Samme regler som i /assets/site.css. */
.masthead__sections {
	display: flex;
	flex-wrap: wrap;
	gap: .2rem 1.1rem;
	margin: .55rem 0 0;
	font-size: 1.05rem;
	text-shadow: 0 1px 8px rgba(0,0,0,.3);
}
.masthead__sections a { color: #f0d9a8; }
.masthead__sections a:hover { color: #fff; }
.masthead__sections a[aria-current] { color: #fff; font-weight: 600; }

.masthead__nav { display: flex; flex-wrap: wrap; gap: .5rem; }
.masthead__nav a {
	padding: .35em .9em;
	font-size: .9rem;
	font-weight: 500;
	color: #fff;
	background: rgba(255,255,255,.14);
	border: 1px solid rgba(255,255,255,.25);
	border-radius: 999px;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}
.masthead__nav a:hover { color: #fff; background: rgba(255,255,255,.26); }

/* --- Content ------------------------------------------------------------- */

.content {
	max-width: var(--measure);
	margin: 0 auto;
	padding: 2.5rem 1.25rem 4rem;
}

.meta {
	display: block;
	font-size: .8rem;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--sand);
}

.empty {
	padding: 3rem 1rem;
	text-align: center;
	color: var(--muted);
	background: var(--surface);
	border: 1px dashed var(--border);
	border-radius: var(--radius);
}

/* Post list */

.post-list { display: grid; gap: 1.25rem; }

.post-card {
	position: relative;
	padding: 1.75rem 2rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	transition: box-shadow .2s, transform .2s, border-color .2s;
}
.post-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--shadow);
	border-color: transparent;
}
.post-card h2 { margin: .35rem 0 .5rem; font-size: 1.55rem; }
.post-card h2 a { color: var(--text); }
/* make the whole card clickable */
.post-card h2 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.post-card p { margin: 0 0 1rem; color: var(--muted); }

.read-more {
	font-size: .9rem;
	font-weight: 600;
}
.read-more span { display: inline-block; transition: transform .2s; }
.post-card:hover .read-more span { transform: translateX(4px); }

/* Single post */

.post {
	padding: 2.5rem clamp(1.25rem, 5vw, 3.5rem) 3rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}

.post__header {
	margin-bottom: 2rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid var(--border);
}
.post__header h1 { margin: 1rem 0 .75rem; }

.back {
	font-size: .9rem;
	font-weight: 500;
	color: var(--muted);
}
.back:hover { color: var(--accent); }

/* --- Prose (rendered markdown) ------------------------------------------- */

.prose, .md-preview { font-size: 1.06rem; }
.prose > :first-child, .md-preview > :first-child { margin-top: 0; }
.prose > :last-child,  .md-preview > :last-child  { margin-bottom: 0; }

.prose p, .md-preview p { margin: 0 0 1.25em; }
.prose h2, .md-preview h2 { margin-top: 2em; }

.prose a, .md-preview a {
	text-decoration: underline;
	text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}
.prose a:hover, .md-preview a:hover { text-decoration-color: currentColor; }

.prose ul, .prose ol, .md-preview ul, .md-preview ol { padding-left: 1.4em; margin: 0 0 1.25em; }
.prose li, .md-preview li { margin: .3em 0; }
.prose li::marker, .md-preview li::marker { color: var(--sand); }

.prose img, .md-preview img {
	display: block;
	margin: 2rem auto;
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow);
}

blockquote {
	margin: 1.75em 0;
	padding: .75em 1.25em;
	font-family: var(--font-serif);
	font-size: 1.1em;
	font-style: italic;
	color: var(--text);
	background: var(--sand-soft);
	border-left: 4px solid var(--sand);
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
blockquote p:last-child { margin-bottom: 0; }

code, pre, kbd { font-family: var(--font-mono); font-size: .88em; }
code {
	padding: .15em .4em;
	background: var(--code-bg);
	border-radius: 5px;
}
pre {
	margin: 1.5em 0;
	padding: 1.1em 1.25em;
	overflow-x: auto;
	line-height: 1.55;
	background: var(--pre-bg);
	color: #dbe6ee;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
}
pre code { padding: 0; background: none; color: inherit; font-size: .9em; }

.prose table, .md-preview table { margin: 1.5em 0; }

/* --- Footer -------------------------------------------------------------- */

.site-footer {
	border-top: 1px solid var(--border);
	color: var(--muted);
	font-size: .9rem;
}
.site-footer__inner {
	max-width: var(--measure);
	margin: 0 auto;
	padding: 1.5rem 1.25rem 2.5rem;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: .5rem 1.5rem;
}

/* --- Utility colours (legacy markup) ------------------------------------- */

.purple { color: var(--accent); }
.orange { color: var(--sand); }
.green  { color: var(--accent); }
.blue   { color: var(--muted); font-size: .9rem; }
.clear  { clear: both; }

/* --- Forms --------------------------------------------------------------- */

label { font-weight: 600; font-size: .9rem; }

input[type=text],
input[type=password],
input[type=email],
textarea {
	width: 100%;
	max-width: 100%;
	padding: .65em .85em;
	margin-top: .35em;
	font: inherit;
	font-size: 1rem;
	color: var(--text);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	transition: border-color .15s, box-shadow .15s;
}

textarea { resize: vertical; line-height: 1.55; }
textarea[name=postCont] { font-family: var(--font-mono); font-size: .92rem; min-height: 22rem; }

input:focus, textarea:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 4px var(--accent-soft);
}

input[type=submit], button { font: inherit; cursor: pointer; }

input[type=submit] {
	padding: .7em 1.6em;
	font-weight: 600;
	color: #fff;
	background: var(--accent);
	border: 0;
	border-radius: 999px;
	box-shadow: var(--shadow-sm);
	transition: background-color .15s, transform .15s;
}
input[type=submit]:hover { background: var(--accent-hover); transform: translateY(-1px); }
@media (prefers-color-scheme: dark) {
	input[type=submit] { color: #0e151c; }
}

.error {
	padding: .8em 1em;
	margin: 1em 0;
	color: var(--error);
	background: var(--error-bg);
	border: 1px solid color-mix(in srgb, var(--error) 35%, transparent);
	border-radius: var(--radius-sm);
}

/* --- Admin --------------------------------------------------------------- */

#wrapper {
	max-width: 60rem;
	margin: 2rem auto;
	padding: 2rem clamp(1.25rem, 4vw, 2.75rem) 2.5rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}

#wrapper > h1:first-child {
	margin: 0 0 1rem;
	font-size: 1.6rem;
}

#wrapper > h2 { margin-top: 1rem; }
#wrapper > h3 {
	display: inline-block;
	margin: 0 0 1rem;
	padding: .4em .9em;
	font-family: var(--font);
	font-size: .95rem;
	font-weight: 600;
	color: var(--accent);
	background: var(--accent-soft);
	border-radius: 999px;
}

#adminmenu {
	display: flex;
	flex-wrap: wrap;
	gap: .4rem;
	margin: 0;
	padding: 0;
	list-style: none;
}
#adminmenu a {
	display: inline-block;
	padding: .35em .9em;
	font-size: .9rem;
	font-weight: 500;
	color: var(--text);
	background: var(--surface-2);
	border-radius: 999px;
}
#adminmenu a:hover { color: var(--accent); background: var(--accent-soft); }

#login {
	max-width: 360px;
	margin: 12vh auto 0;
	padding: 2rem 2.25rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-lg);
}
#login::before {
	content: "blog.rpix.dk";
	display: block;
	margin-bottom: 1rem;
	font-family: var(--font-serif);
	font-size: 1.5rem;
	font-weight: 700;
}
#login label { display: block; }
#login input[type=submit] { width: 100%; }

table {
	width: 100%;
	margin-bottom: 1.25rem;
	border-collapse: collapse;
	font-size: .95rem;
	text-align: left;
}
table th, table td {
	padding: .7em .85em;
	border-bottom: 1px solid var(--border);
	vertical-align: top;
}
table th {
	font-size: .75rem;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--muted);
	background: var(--surface-2);
}
table th:first-child { border-top-left-radius: var(--radius-sm); }
table th:last-child  { border-top-right-radius: var(--radius-sm); }
table tr:hover td { background: var(--surface-2); }

form.inline { display: inline; }
button.link {
	padding: 0;
	font-weight: 500;
	color: var(--error);
	background: none;
	border: 0;
}
button.link:hover { text-decoration: underline; }

/* --- Markdown toolbar ---------------------------------------------------- */

.md-toolbar {
	position: sticky;
	top: 0;
	z-index: 1;
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
	margin-top: .35em;
	padding: 5px;
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-bottom: 0;
	border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.md-toolbar + textarea { margin-top: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

.md-toolbar button {
	min-width: 2.2em;
	height: 2.2em;
	padding: 0 .55em;
	font-size: .88rem;
	line-height: 1;
	color: var(--text);
	background: transparent;
	border: 1px solid transparent;
	border-radius: 6px;
}
.md-toolbar button:hover { background: var(--surface); border-color: var(--border); }
.md-toolbar button[aria-pressed=true] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.md-toolbar .sep { width: 1px; margin: 5px 4px; background: var(--border); }
.md-toolbar .spacer { flex: 1; }

.md-preview {
	min-height: 22rem;
	padding: 1.25em 1.5em;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* --- Small screens ------------------------------------------------------- */

@media (max-width: 600px) {
	body { font-size: 16px; }
	.masthead { min-height: 12rem; }
	.content { padding: 1.5rem 1rem 3rem; }
	.post-card { padding: 1.4rem 1.25rem; }
	.post { padding: 1.75rem 1.25rem 2rem; border-radius: var(--radius-sm); }
	#wrapper { margin: 0; border-radius: 0; border: 0; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; }
}
