/*
Theme Name: Maschinenraum
Theme URI: https://fynfyn.com/maschinenraum
Author: Fyn Tilicke
Author URI: https://fynfyn.de
Description: Modernes, minimalistisches Tech-Journal mit kühler Paper/Graphite/Blau-Palette, Inter Tight + JetBrains Mono. Kontrastreiche Typo, generative Beitrags-Cover, eingebettete Newsletter-Karte und drei Listen-/Single-Varianten als Designsystem-Grundlage.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: maschinenraum
Tags: blog, minimalist, custom-menu, custom-header, threaded-comments, translation-ready, two-columns, full-width-template
*/

/* The visual styles live in assets/css/styles.css.
   This file holds only the theme metadata required by WordPress
   plus a handful of WP-specific overrides and Gutenberg block mappings. */

/* === WP admin bar offset for sticky topbar === */
html[lang] .topbar { top: var(--wp-admin--admin-bar--height, 0); }

/* === Stretched link — make the entire post card clickable ===
   The h2's <a>::after expands to fill the article, so any click on dead
   space (post-meta, dek, surrounding padding) navigates to the post.
   Cover / preview anchors get z-index: 2 so right-click context menus on
   the image still target the cover anchor; everything else falls through
   to the title link via the stretched ::after layer. */
.post-row,
.post-feature,
.post-card-b,
.post-line { position: relative; }

.post-row .cover-wrap,
.post-feature .cover-wrap,
.post-card-b .cover-wrap,
.post-line .preview { position: relative; z-index: 2; }

.post-row h2 a::after,
.post-feature h2 a::after,
.post-card-b h2 a::after,
.post-line h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* Make sure inner anchors that should remain individually targetable
   (read-more, future inline links) sit above the stretched layer. */
.post-feature .read-more,
.post-row .read-more {
  position: relative;
  z-index: 2;
}

/* === Map Gutenberg blocks onto the design's body styles === */
.single-body > .wp-block-heading {
  max-width: 680px;
  margin: 56px auto 20px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}
.single-body > .wp-block-heading + p::first-letter { all: unset; }

.single-body > .wp-block-quote {
  max-width: 680px;
  margin: 40px auto;
  padding: 4px 0 4px 28px;
  border-left: 2px solid var(--accent);
}
.single-body > .wp-block-quote p {
  font-size: 22px;
  line-height: 1.4;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 12px;
  font-style: italic;
}
.single-body > .wp-block-quote p::first-letter { all: unset; }
.single-body > .wp-block-quote cite,
.single-body > .wp-block-quote .wp-block-quote__citation {
  display: block;
  font-style: normal;
  font-size: 13px;
  color: var(--text-muted);
  font-family: ui-monospace, "JetBrains Mono", monospace;
  letter-spacing: 0.01em;
}

.single-body > .wp-block-image {
  max-width: 920px;
  margin: 48px auto;
}
.single-body > .wp-block-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  background: oklch(0.18 0.02 250);
}
.single-body > .wp-block-image figcaption {
  max-width: 680px;
  margin: 14px auto 0;
  font-size: 13px;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.5;
  text-align: center;
}
.single-body > .wp-block-image + p::first-letter { all: unset; }

.single-body > .wp-block-gallery {
  max-width: 920px;
  margin: 48px auto;
}
.single-body > .wp-block-gallery .wp-block-image img {
  border-radius: 10px;
}
.single-body > .wp-block-gallery figcaption {
  max-width: 680px;
  margin: 14px auto 0;
  font-size: 13px;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.5;
  text-align: center;
}
.single-body > .wp-block-gallery + p::first-letter { all: unset; }

.single-body > .wp-block-code,
.single-body > pre.wp-block-code {
  max-width: 880px;
  margin: 36px auto;
  background: oklch(0.18 0.02 250);
  border-radius: 10px;
  border: 1px solid oklch(0.30 0.02 250);
  overflow: hidden;
  font-family: ui-monospace, "JetBrains Mono", "Söhne Mono", monospace;
  padding: 0;
  position: relative;
}
.single-body > .wp-block-code code,
.single-body > pre.wp-block-code code {
  display: block;
  font: inherit;
  padding: 18px 20px;
  font-size: 13.5px;
  line-height: 1.65;
  color: oklch(0.92 0.01 250);
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}
.single-body > .wp-block-code + p::first-letter { all: unset; }

/* Native search-form override — ensure WP's get_search_form() output is a flex pill */
.search-form { display: flex; }

/* Make linked nav items render like the design's button-style nav */
.nav a {
  background: none;
  border: 0;
  font: inherit;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--t-fast), background var(--t-fast);
}
.nav a:hover,
.nav a.active,
.nav a[aria-current="page"] {
  color: var(--text);
  background: var(--paper-2);
}

/* Footer menu links — small reset */
.footer ul li { list-style: none; }
.footer ul a { font-size: 14px; color: var(--text-muted); cursor: pointer; text-decoration: none; }
.footer ul a:hover { color: var(--text); }

/* Pagination — minimal, design-aligned */
.mr-pagination {
  display: flex; gap: 8px; justify-content: center;
  padding: 32px 0 80px;
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 13px;
}
.mr-pagination a,
.mr-pagination span.current {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--t-fast);
}
.mr-pagination a:hover { color: var(--text); border-color: var(--border-strong); }
.mr-pagination span.current {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* === Comments === */
.mr-comments {
  max-width: 680px;
  margin: 64px auto 0;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.mr-comments > h3,
.mr-comments .comment-reply-title {
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  margin: 0 0 24px;
  font-family: ui-monospace, "JetBrains Mono", monospace;
}
.mr-comment-list,
.mr-comment-list ol.children {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mr-comment-list ol.children {
  margin-left: 24px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
  margin-top: 16px;
}
.mr-comments .comment {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  list-style: none;
}
.mr-comments .comment:last-child { border-bottom: 0; }
.mr-comments .comment-header {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 13px;
}
.mr-comments .comment-author {
  font-weight: 600;
  color: var(--text);
}
.mr-comments .comment-date {
  color: var(--text-muted);
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 12px;
}
.mr-comments .comment-body {
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.6;
}
.mr-comments .comment-body p { margin: 0 0 0.8em; }
.mr-comments .comment-body p:last-child { margin-bottom: 0; }
.mr-comments .comment-reply { margin-top: 12px; }
.mr-comments .comment-reply a {
  display: inline-block;
  font-size: 11px;
  font-family: ui-monospace, "JetBrains Mono", monospace;
  color: var(--accent-ink);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
}
.mr-comments .comment-reply a:hover { text-decoration: underline; }

/* Comment form — reuses .contact-form base styles for inputs/buttons */
.mr-comment-form-wrap { margin-top: 32px; }
.mr-comment-form .comment-notes,
.mr-comment-form .logged-in-as {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 16px;
  font-family: ui-monospace, "JetBrains Mono", monospace;
  text-transform: none;
  letter-spacing: 0;
}
.mr-comment-form .comment-form-cookies-consent {
  flex-direction: row;
  gap: 8px;
  align-items: center;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.mr-comment-form .comment-form-cookies-consent input { width: auto; }
.mr-comments-closed {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 24px;
  padding: 16px 0;
  text-align: center;
}

/* === Code block (Gutenberg core/code mapped to design's .post-code chrome) === */
.single-body .wp-block-code {
  position: relative;
  padding: 0;
}
.single-body .wp-block-code .post-code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: oklch(0.22 0.02 250);
  border-bottom: 1px solid oklch(0.30 0.02 250);
  font-family: ui-monospace, "JetBrains Mono", monospace;
}
.single-body .wp-block-code .post-code-lang {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: oklch(0.78 0.06 240);
  font-weight: 500;
}
.single-body .wp-block-code .post-code-copy {
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.06em;
  background: transparent;
  border: 1px solid oklch(0.40 0.02 250);
  color: oklch(0.85 0.02 250);
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 160ms, border-color 160ms;
}
.single-body .wp-block-code .post-code-copy:hover {
  background: oklch(0.30 0.02 250);
  border-color: oklch(0.50 0.04 250);
}
.single-body .wp-block-code code {
  display: block;
  font: inherit;
  padding: 18px 20px;
  font-size: 13.5px;
  line-height: 1.65;
  color: oklch(0.92 0.01 250);
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}

/* Cover image (when a real Featured Image is set, not a generative SVG) */
.cover-wrap .post-cover-img,
.single-cover .post-cover-img,
.single-cover-thumb .post-cover-img,
.single-cover-aside .post-cover-img,
.preview .post-cover-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* Hide search keyboard hint when input has content (toggled via JS) */
.search-form.has-value .search-kbd { display: none; }

/* Newsletter widget visibility (toggled via JS / localStorage) */
.index-head[data-newsletter="hidden"] {
  display: block;
}
.index-head[data-newsletter="hidden"] .index-head-aside { display: none; }

/* Accessibility helpers */
.screen-reader-text {
  border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
  height: 1px; margin: -1px; overflow: hidden; padding: 0;
  position: absolute; width: 1px; word-wrap: normal !important;
}

/* Skip-link: invisible until keyboard-focused, then becomes a visible
   pill at top-left. Anchor for users navigating by Tab who want to jump
   past the topbar straight to <main id="main">. */
.skip-link:focus,
.skip-link:focus-visible {
  position: fixed;
  top: 16px;
  left: 16px;
  width: auto;
  height: auto;
  margin: 0;
  padding: 12px 22px;
  clip: auto;
  clip-path: none;
  overflow: visible;
  white-space: nowrap;
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  z-index: 10000;
  box-shadow: 0 8px 24px rgba(15, 30, 60, 0.18);
}

/* Search-match highlight — keep the accent fill, but add an underline so
   the highlight isn't conveyed by color alone (WCAG 1.4.1). */
mark {
  text-decoration: underline;
  text-decoration-color: var(--accent-ink);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

/* Touch-target: bump theme-switch buttons above WCAG 2.5.8 (24×24 AA)
   with margin to spare. The visual icon stays at 14×14, the hit area
   grows. */
.theme-switch-btn {
  width: 32px;
  height: 30px;
}

/* Generic focus-visible default for interactive elements that didn't
   get a custom outline yet (links, buttons that aren't otherwise styled). */
.cat-pill:focus-visible,
.read-more:focus-visible,
.single-tag:focus-visible,
.archive-year li a:focus-visible,
.related-card a:focus-visible,
.post-row h2 a:focus-visible,
.post-feature h2 a:focus-visible,
.post-card-b h2 a:focus-visible,
.post-line h2 a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ============== Theme switch (footer, segmented) ============== */
.theme-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  background: var(--paper-2);
  border: 1px solid var(--border);
}
.theme-switch-btn {
  appearance: none;
  border: 0;
  background: transparent;
  width: 30px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font: inherit;
  transition: color var(--t-fast), background var(--t-fast),
              box-shadow var(--t-fast);
}
.theme-switch-btn:hover { color: var(--text); }
.theme-switch-btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.10),
              0 0 0 0.5px rgba(0, 0, 0, 0.04);
}
.theme-switch-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.theme-switch-btn svg { display: block; width: 14px; height: 14px; }
