/* Layout for martin-kumm.de, loosely following the old DokuWiki "pluto_new" template:
   Lora serif font, quiet colours, adder-graph background pattern, horizontal menu
   with grey drop-down panels. */

:root {
  --text: #1f2b24;
  --muted: #5d6862;
  --link: #436976;
  --link-hover: #2b4a54;
  --line: #dfe3e0;
  --menu-panel: #6b716d;
  --header-bg: rgba(255, 255, 255, 0.92);
  --content-width: 960px;
  --gutter: 16px;
}

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

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

body {
  margin: 0;
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: #fff url("../images/pattern.png") center top / cover no-repeat fixed;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

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

/* ---------- header and menu ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.header-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}

.site-name {
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.site-name:hover { color: var(--text); text-decoration: none; }

.menu, .submenu { list-style: none; margin: 0; padding: 0; }

.menu { display: flex; align-items: center; gap: 0.25rem; }

.menu-item { position: relative; }

.menu-item > a {
  display: block;
  padding: 0.45rem 0.7rem;
  font-size: 15px;
  color: var(--text);
  border-radius: 4px;
}
.menu-item > a:hover { color: var(--muted); text-decoration: underline; }
.menu-item.current > a { color: var(--link); font-weight: 600; }

.has-children > a::after {
  content: "";
  display: inline-block;
  margin-left: 0.4em;
  vertical-align: 0.2em;
  border: 4px solid transparent;
  border-top-color: currentColor;
  border-bottom-width: 0;
}

/* drop-down panel, shown on hover or keyboard focus */
.submenu {
  position: absolute;
  top: 100%;
  left: 50%;
  min-width: 15rem;
  padding: 0.5rem 0;
  background: var(--menu-panel);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
/* invisible bridge so the panel does not close while the mouse moves down to it */
.submenu::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -10px;
  height: 10px;
}
.has-children:hover > .submenu,
.has-children:focus-within > .submenu {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 2px);
}

.submenu a {
  display: block;
  padding: 0.4rem 1.1rem;
  font-size: 14px;
  color: #fff;
  white-space: nowrap;
}
.submenu a:hover,
.submenu a[aria-current="page"] { color: #fff; background: rgba(0, 0, 0, 0.18); text-decoration: none; }

/* hamburger button, only visible on small screens */
.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 10px 9px;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

@media (max-width: 860px) {
  .header-inner { flex-wrap: wrap; }
  .nav-toggle { display: flex; }

  .site-nav { display: none; width: 100%; padding-bottom: 0.75rem; }
  .nav-open .site-nav { display: block; }

  .menu { flex-direction: column; align-items: stretch; gap: 0; }
  .menu-item > a { padding: 0.55rem 0.25rem; border-top: 1px solid var(--line); border-radius: 0; }
  .has-children > a::after { display: none; }

  /* sub pages are listed directly below their section */
  .submenu,
  .has-children:hover > .submenu,
  .has-children:focus-within > .submenu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    min-width: 0;
    padding: 0 0 0.4rem 1rem;
    background: none;
    box-shadow: none;
    transition: none;
  }
  .submenu::before { display: none; }
  .submenu a { color: var(--muted); padding: 0.3rem 0.25rem; white-space: normal; }
  .submenu a:hover,
  .submenu a[aria-current="page"] { color: var(--link); background: none; }
}

/* ---------- content ---------- */

.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2rem var(--gutter) 3rem;
}

.page {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 8px;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; margin: 1.8em 0 0.6em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.15rem; }
h5, h6 { font-size: 1rem; }
.page-title { margin-top: 0; }

p, ul, ol, table, pre { margin: 0 0 1em; }

table { border-collapse: collapse; }
td, th { vertical-align: top; padding: 0.3em 0.6em; }
th { text-align: left; }
td { overflow-wrap: anywhere; }
/* images with an explicit width (e.g. the portrait) keep it inside auto-sized table cells */
td img[width] { max-width: none; }
/* tables written in Markdown get light rules; HTML layout tables stay borderless */
table:not([width]) td, table:not([width]) th { border-bottom: 1px solid var(--line); }

/* on small screens the HTML layout tables (image | text) are stacked */
@media (max-width: 860px) {
  table[width], table[width] tbody, table[width] tr, table[width] td { display: block; width: auto !important; }
  table[width] td { padding: 0.2em 0; }
  table[width] td:empty, table[width] td[width] { display: none; }
  td img[width] { max-width: 100%; }
}

pre, code { font-family: Menlo, Consolas, 'DejaVu Sans Mono', monospace; font-size: 0.85em; }
pre {
  padding: 0.8em 1em;
  overflow-x: auto;
  background: #f5f7f6;
  border: 1px solid var(--line);
  border-radius: 6px;
  line-height: 1.45;
}
:not(pre) > code { background: #f0f2f1; padding: 0.1em 0.3em; border-radius: 3px; }

blockquote { margin: 0 0 1em; padding-left: 1em; border-left: 3px solid var(--line); color: var(--muted); }

hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

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

.site-footer { border-top: 1px solid var(--line); background: var(--header-bg); font-size: 13px; color: var(--muted); }
.footer-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
}
.footer-inner a { color: var(--muted); }
