/*
Theme Name: Schrottplatz GrayNav
Theme URI: https://www.schrottplatz.biz/
Author: Christian Arrer + ChatGPT
Description: Minimal grayscale WordPress theme with a fixed vertical black/white navigation bar inspired by the old static schrottplatz.biz pages.
Version: 1.0.1
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 8.0
License: GPL-2.0-or-later
Text Domain: schrottplatz-graynav
*/

:root {
  --sp-black: #111;
  --sp-dark: #333;
  --sp-mid: #777;
  --sp-line: #ccc;
  --sp-soft: #f1f1f1;
  --sp-white: #fff;
  --sp-menu-width: 40px;
  --sp-content-max: 920px;
  --sp-font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --sp-font-mono: Consolas, Monaco, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--sp-white);
  color: var(--sp-black);
  font-family: var(--sp-font-sans);
  font-size: 16px;
  line-height: 1.55;
}

body.admin-bar .site-nav { top: 32px; height: calc(100svh - 32px); }

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  left: calc(var(--sp-menu-width) + 1rem);
  top: 1rem;
  width: auto;
  height: auto;
  padding: .5rem .75rem;
  clip: auto;
  background: var(--sp-white);
  color: var(--sp-black);
  z-index: 1000;
}

.site-layout { min-height: 100svh; }

.site-nav {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: var(--sp-menu-width);
  height: 100svh;
  background: var(--sp-dark);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.site-nav-inner { min-height: 100%; }

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

.site-menu { display: flex; flex-direction: column; align-items: stretch; }
.site-menu ul { display: none; }

.site-menu a {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 72px;
  width: var(--sp-menu-width);
  padding: .65rem .25rem;
  color: var(--sp-white);
  background: var(--sp-dark);
  text-decoration: none;
  text-align: center;
  font-family: var(--sp-font-mono);
  font-size: .88rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.site-menu a:hover,
.site-menu a:focus-visible {
  background: var(--sp-black);
  color: var(--sp-white);
  outline: none;
}

.site-menu .current-menu-item > a:hover,
.site-menu .current-menu-item > a:focus-visible,
.site-menu .current_page_item > a:hover,
.site-menu .current_page_item > a:focus-visible,
.site-menu .current-menu-ancestor > a:hover,
.site-menu .current-menu-ancestor > a:focus-visible {
  background: var(--sp-white);
  color: var(--sp-black);
}

.site-menu .current-menu-item > a,
.site-menu .current_page_item > a,
.site-menu .current-menu-ancestor > a {
  background: var(--sp-white);
  color: var(--sp-black);
}

/* Optional icon menu items.
   In WordPress: Appearance -> Menus -> Screen Options -> enable CSS Classes.
   Add classes like: sp-icon-only sp-icon-schrottplatz
*/
.site-menu .sp-icon-only > a {
  writing-mode: horizontal-tb;
  transform: none;
  min-height: 48px;
  font-size: 0;
}
.site-menu .sp-icon-only > a::before {
  display: block;
  font-family: var(--sp-font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}
.site-menu .sp-icon-schrottplatz > a::before { content: "S"; }
.site-menu .sp-icon-linux > a::before { content: "L"; }
.site-menu .sp-icon-philosophy > a::before { content: "Φ"; }
.site-menu .sp-icon-rudder > a::before { content: "R"; }
.site-menu .sp-icon-crawler > a::before { content: "C"; }
.site-menu .sp-icon-theses > a::before { content: "T"; }

.site-main {
  margin-left: var(--sp-menu-width);
  min-width: 0;
}

.content-wrap {
  width: min(100% - 2rem, var(--sp-content-max));
  margin: 0 auto 0 0;
  padding: 2rem;
}

.site-header { margin-bottom: 1rem; }
.site-title { margin: 0 0 .2rem; font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.1; }
.site-title a { color: inherit; text-decoration: none; }
.site-description { margin: 0; color: var(--sp-dark); font-size: 1.05rem; }

.entry-header { margin-bottom: 1rem; }
.entry-title { margin: 0 0 .35rem; font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.15; }
.entry-title a { color: inherit; text-decoration: none; }
.entry-meta, .site-footer { color: var(--sp-dark); font-size: .9rem; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--sp-font-sans);
  line-height: 1.2;
  margin: 1.1em 0 .45em;
  font-weight: 700;
}
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); }
h3 { font-size: 1.22rem; }
h4, h5, h6 { font-size: 1.1rem; }

p { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem 1.5rem; padding: 0; }
li + li { margin-top: .2rem; }

.wp-block-separator,
hr { border: 0; border-top: 2px solid var(--sp-black); margin: 1.5rem 0; }

a { color: var(--sp-black); text-decoration: underline; text-underline-offset: .15em; }
a:hover, a:focus-visible { color: var(--sp-mid); }

img, svg, video { max-width: 100%; height: auto; }
figure { margin: 1.25rem 0; }
figcaption, .wp-element-caption { color: var(--sp-dark); font-size: .88rem; text-align: center; }

.wp-block-image img { display: block; }
.wp-block-gallery { gap: 1rem; }

.wp-block-table,
.table-container { overflow-x: auto; margin: 1.25rem 0; }

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  background: var(--sp-white);
}
caption {
  text-align: left;
  padding: .55rem .65rem;
  font-weight: 700;
}
th, td {
  vertical-align: top;
  text-align: left;
  padding: .55rem .65rem;
  border: 1px solid var(--sp-line);
}
th { background: var(--sp-line); font-weight: 700; }
tbody tr:nth-child(even) { background: var(--sp-soft); }

pre, code, kbd, samp { font-family: var(--sp-font-mono); }
pre, .wp-block-code {
  overflow-x: auto;
  padding: .85rem 1rem;
  background: var(--sp-soft);
  border: 1px solid var(--sp-line);
  border-radius: .2rem;
}

blockquote {
  margin: 1.25rem 0;
  padding: .5rem 1rem;
  border-left: .35rem solid var(--sp-line);
  background: var(--sp-soft);
}

input, textarea, select, button {
  font: inherit;
  color: var(--sp-black);
}
input, textarea, select {
  width: 100%;
  max-width: 34rem;
  border: 1px solid var(--sp-line);
  padding: .45rem .55rem;
  background: var(--sp-white);
}
button, input[type="submit"], .wp-block-button__link {
  display: inline-block;
  border: 1px solid var(--sp-black);
  padding: .5rem .75rem;
  background: var(--sp-black);
  color: var(--sp-white);
  text-decoration: none;
  border-radius: 0;
  cursor: pointer;
}
button:hover, input[type="submit"]:hover, .wp-block-button__link:hover {
  background: var(--sp-dark);
  color: var(--sp-white);
}

.alignwide, .alignfull { max-width: 100%; }
.wp-caption { max-width: 100%; }

.nav-links, .page-links { display: flex; gap: .75rem; flex-wrap: wrap; margin: 1.5rem 0; }

.site-footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--sp-line); }

@media (max-width: 720px) {
  :root { --sp-menu-width: 100%; }

  body.admin-bar .site-nav { top: 46px; height: auto; }

  .site-nav {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    max-height: 128px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .site-menu {
    flex-direction: row;
    align-items: stretch;
    min-width: max-content;
  }

  .site-menu a {
    writing-mode: vertical-rl;
    transform: none;
    width: auto;
    min-height: 128px;
    padding: .55rem .7rem;
    white-space: nowrap;
  }

  .site-menu .sp-icon-only > a { min-width: 44px; }

  .site-main { margin-left: 0; }
  .content-wrap { width: 100%; padding: 1.1rem; }
  pre, .wp-block-code { margin-left: 0; }
}

@media print {
  .site-nav { display: none; }
  .site-main { margin-left: 0; }
  .content-wrap { width: 100%; max-width: none; padding: 0; }
}
