/*
Theme Name: Typewriter
Theme URI: https://webmatze.de
Author: webmatze
Description: Minimales klassisches Theme im Schreibmaschinen-Look (weiß, Zweifarbband). Voller Effekt zusammen mit dem Typewriter-Design-Plugin.
Version: 0.1.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: typewriter
*/

@font-face {
  font-family: 'TTBody';
  src: url('fonts/TTBody.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'TTHead';
  src: url('fonts/TTHead.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

html, body { margin: 0; padding: 0; }

:root {
  --ink-black: #1c1a17;
  --ink-red: #b23a2e;
  --paper: #ffffff;
}

body {
  background-color: var(--paper);
  /* barely-visible paper grain */
  background-image: radial-gradient(rgba(0, 0, 0, 0.015) 1px, transparent 1px);
  background-size: 3px 3px;
  color: var(--ink-black);
  font-family: 'TTBody', 'Courier New', monospace;
  font-size: 1.125rem;
  line-height: 1.7;
}

.tw-wrap {
  max-width: 40rem; /* ~62–66 monospace chars */
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* headings & post titles: red, heavier TTHead */
.tw-post-title,
.tw-index-title,
.tw-content h1, .tw-content h2, .tw-content h3,
.tw-content h4, .tw-content h5, .tw-content h6 {
  font-family: 'TTHead', 'Courier New', monospace;
  color: var(--ink-red);
  font-weight: normal;
  line-height: 1.3;
}
.tw-post-title { font-size: 1.9rem; margin: 0 0 0.4rem; }
.tw-meta { font-size: 0.85rem; color: var(--ink-black); opacity: 0.75; margin: 0 0 2.4rem; }

.tw-content blockquote {
  margin: 1.6rem 0;
  padding-left: 1.2rem;
  border-left: 2px solid var(--ink-black);
}
.tw-content ul { padding-left: 1.4rem; }

/* Links: black text, red underline (as if underlined in red afterwards). */
.tw-content a,
.tw-nav a,
.tw-footer a,
.tw-postnav a,
.tw-pagination a,
.tw-meta a,
.tw-backlink {
  color: var(--ink-black);
  text-decoration: underline;
  text-decoration-color: var(--ink-red);
  text-underline-offset: 2px;
}

/* Post-list titles are red (a title) AND links -> red text + red underline. */
.tw-index-title a {
  color: var(--ink-red);
  text-decoration: underline;
  text-decoration-color: var(--ink-red);
  text-underline-offset: 2px;
}

/* Masthead site title: black, no underline (brand, not an inline link). */
.tw-site-title {
  color: var(--ink-black);
  text-decoration: none;
  font-weight: normal;
}

/* Emphasis: bold, black (no red, no italics). */
.tw-content strong,
.tw-content em {
  font-weight: bold;
  font-style: normal;
  color: var(--ink-black);
}

.tw-masthead { margin: 1rem 0 3rem; }
.tw-site-title { font-family: 'TTBody', monospace; font-size: 1.1rem; }
.tw-nav { margin-top: 0.4rem; font-size: 0.95rem; }
.tw-nav a { margin-right: 1rem; display: inline-block; }
.tw-nav ul { list-style: none; margin: 0; padding: 0; }
.tw-nav > .tw-nav-menu > li,
.tw-nav > ul > li { display: inline-block; margin-right: 1rem; position: relative; }

/* Sub-menus: a minimal drop panel shown on hover/focus (keyboard-accessible). */
.tw-nav .sub-menu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 10;
  min-width: 11rem;
  margin: 0;
  padding: 0.5rem 0.9rem;
  background: var(--paper);
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.tw-nav .sub-menu li { display: block; margin: 0.25rem 0; }
.tw-nav .sub-menu a { margin-right: 0; }
.tw-nav li:hover > .sub-menu,
.tw-nav li:focus-within > .sub-menu { display: block; }
/* small red marker that an item has a submenu */
.tw-nav .menu-item-has-children > a::after { content: ' \25be'; color: var(--ink-red); }

.tw-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.85rem;
  opacity: 0.8;
}
.tw-footer p { margin: 0; }

/* Inside the transformed content the plugin wraps every glyph in an
   inline-block span, and text-decoration: underline does NOT paint under
   inline-block descendants (only the plain spaces get a line). Use a
   border-bottom instead: it draws one continuous straight red line under the
   whole link line-box, regardless of the wobbling inline-block glyphs. */
.tw-content a {
  text-decoration: none;
  border-bottom: 1px solid var(--ink-red);
  /* Draw the underline on every line fragment when the link wraps.
     Without this, WebKit/Safari only underlines the last line. */
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Correction gag: the plugin renders the spans; the theme sets the colours.
   Wrong word stays black with a RED strike line; corrected word is black. */
.tw-content .tw-correction .tw-wrong {
  color: var(--ink-black);
  text-decoration: line-through;
  text-decoration-color: var(--ink-red);
}
.tw-content .tw-correction .tw-right {
  color: var(--ink-black);
}

.tw-postnav {
  margin-top: 2.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
}

.tw-index-item { margin: 0 0 1.8rem; }
.tw-index-title { font-size: 1.3rem; margin: 0 0 0.2rem; }
.tw-index-meta { font-size: 0.8rem; opacity: 0.7; margin: 0; }
.tw-index-excerpt { margin: 0.4rem 0 0; }
.tw-pagination { margin-top: 2.5rem; font-size: 0.95rem; }
.tw-pagination .page-numbers { margin-right: 0.6rem; }
