/*
Theme Name: Paper Terminal
Theme URI: https://example.com
Description: Warm, cremefarbenes Papier-Design mit handschriftlichen Headlines und Skizzenbuch-Ästhetik. Ein untypischer Gegenentwurf für KI-Coding-Blogs.
Version: 1.0.0
Author: Du
Text Domain: paper-terminal-theme
*/

/* ======================================================
   FONTS
====================================================== */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;700&family=Crimson+Pro:ital,wght@0,400;0,600;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --paper:        #f5efe0;
  --paper-dark:   #ede4cf;
  --paper-deep:   #e4d7b5;
  --ink:          #2b2416;
  --ink-soft:     #4a3f28;
  --ink-fade:     #7a6f55;
  --grid:         rgba(43,36,22,0.08);
  --accent:       #c94a1d;
  --accent-soft:  #e56a3e;
  --highlight:    #f2c94c;
  --mint:         #6b8e65;
  --blue-ink:     #2d5a87;

  --hand:         'Caveat', cursive;
  --serif:        'Crimson Pro', Georgia, serif;
  --mono:         'JetBrains Mono', monospace;

  --r:            3px;
}

/* ======================================================
   RESET
====================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.75;
  position: relative;
  overflow-x: hidden;
}

/* Paper grain texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at 20% 30%, rgba(139,107,64,0.04) 0%, transparent 40%),
                    radial-gradient(circle at 80% 70%, rgba(139,107,64,0.04) 0%, transparent 40%);
  pointer-events: none;
  z-index: 1;
}

/* Coffee stain decoration */
body::after {
  content: '';
  position: fixed;
  top: 15%;
  right: -80px;
  width: 260px;
  height: 260px;
  background: radial-gradient(ellipse at center,
    rgba(139,90,43,0.08) 0%,
    rgba(139,90,43,0.05) 30%,
    rgba(139,90,43,0.02) 50%,
    transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  transform: rotate(-15deg);
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent-soft);
  transition: background 0.2s, color 0.2s;
}
a:hover {
  background: var(--highlight);
  color: var(--ink);
  border-bottom-color: transparent;
}

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

/* ======================================================
   LAYOUT
====================================================== */
.site-wrapper,
.content-area,
.site-header-inner,
.footer-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 2;
}

/* ======================================================
   HEADER
====================================================== */
#masthead {
  position: relative;
  z-index: 10;
  padding-top: 32px;
  padding-bottom: 20px;
}

.site-header-inner {
  display: flex;
  align-items: baseline;
  gap: 24px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 20px;
  position: relative;
}

/* Little ink sketch under header */
.site-header-inner::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 32px;
  right: 32px;
  height: 1px;
  background: var(--ink-soft);
  opacity: 0.4;
}

.site-title {
  font-family: var(--hand);
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
  transform: rotate(-1.5deg);
  transform-origin: left center;
  position: relative;
}

/* Underline sketch */
.site-title::after {
  content: '';
  position: absolute;
  left: -4px;
  right: -4px;
  bottom: -6px;
  height: 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8'%3E%3Cpath d='M2 5 Q 25 1, 50 4 T 98 3' stroke='%23c94a1d' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  opacity: 0.85;
}

.site-title a { color: inherit; border: none; }
.site-title a:hover { background: transparent; color: var(--accent); }

.site-description {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-fade);
  flex: 1;
}

/* ======================================================
   NAVIGATION
====================================================== */
#site-navigation ul {
  list-style: none;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

#site-navigation ul li a {
  font-family: var(--hand);
  font-size: 21px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 2px 10px;
  border: none;
  display: inline-block;
  transform: rotate(-0.5deg);
  transition: all 0.15s;
  position: relative;
}
#site-navigation ul li:nth-child(even) a { transform: rotate(0.8deg); }
#site-navigation ul li:nth-child(3n) a   { transform: rotate(-1.2deg); }

#site-navigation ul li a:hover {
  color: var(--accent);
  background: var(--highlight);
  transform: rotate(0deg) scale(1.06);
}

#site-navigation ul li.current-menu-item a {
  background: var(--ink);
  color: var(--paper);
}
#site-navigation ul li.current-menu-item a::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -4px;
  height: 3px;
  background: var(--accent);
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 2px solid var(--ink);
  color: var(--ink);
  font-family: var(--hand);
  font-size: 20px;
  padding: 2px 14px;
  cursor: pointer;
  border-radius: var(--r);
  transform: rotate(-1deg);
}

/* ======================================================
   HERO / FRONT PAGE
====================================================== */
.hero {
  padding: 64px 32px 48px;
  max-width: 880px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--ink-fade);
  margin-bottom: 18px;
  display: inline-block;
  padding: 3px 10px;
  border: 1px dashed var(--ink-fade);
  border-radius: var(--r);
  transform: rotate(-0.7deg);
}

.hero-title {
  font-family: var(--hand);
  font-size: clamp(46px, 7vw, 88px);
  font-weight: 700;
  line-height: 1.05;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
  position: relative;
  display: inline-block;
}

/* Word highlight - like marker */
.hero-title .highlighted {
  position: relative;
  display: inline-block;
  padding: 0 4px;
}
.hero-title .highlighted::before {
  content: '';
  position: absolute;
  inset: 10% -4px 0 -4px;
  background: var(--highlight);
  z-index: -1;
  transform: skew(-2deg) rotate(-0.5deg);
  opacity: 0.75;
}

.hero-scribble {
  font-family: var(--hand);
  font-size: 28px;
  color: var(--accent);
  transform: rotate(-2deg);
  display: inline-block;
  margin-left: 12px;
  position: relative;
}

.hero-sub {
  font-family: var(--serif);
  font-size: 20px;
  font-style: italic;
  color: var(--ink-soft);
  max-width: 560px;
  line-height: 1.6;
  margin: 32px 0 40px;
}

/* Hero stats as handwritten notes */
.hero-stats {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
  padding-top: 24px;
  border-top: 1px solid var(--ink-fade);
  position: relative;
}

.hero-stats::before {
  content: '→';
  position: absolute;
  top: -14px;
  left: -8px;
  font-size: 24px;
  color: var(--accent);
  background: var(--paper);
  padding: 0 6px;
}

.stat-block {
  position: relative;
}
.stat-block:nth-child(1) { transform: rotate(-1deg); }
.stat-block:nth-child(2) { transform: rotate(0.5deg); }
.stat-block:nth-child(3) { transform: rotate(-0.3deg); }

.stat-val {
  font-family: var(--hand);
  font-size: 56px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  display: block;
}

.stat-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-fade);
  text-transform: uppercase;
  margin-top: 4px;
}

/* ======================================================
   SECTION HEADERS
====================================================== */
.section-header {
  margin: 72px 0 32px;
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.section-num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-fade);
}

.section-title {
  font-family: var(--hand);
  font-size: 36px;
  font-weight: 700;
  color: var(--ink);
  transform: rotate(-1deg);
  padding: 0 8px;
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  height: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 6'%3E%3Cpath d='M2 4 Q 20 1, 40 3 T 98 3' stroke='%23c94a1d' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  opacity: 0.7;
}

/* ======================================================
   POST CARDS - like index cards
====================================================== */
.post-card {
  position: relative;
  background: var(--paper-dark);
  border: 1px solid rgba(43,36,22,0.15);
  padding: 24px 28px 22px;
  margin-bottom: 28px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 2px 2px 0 rgba(43,36,22,0.1);
}

/* Slight random rotation per card */
.post-card:nth-child(odd)  { transform: rotate(-0.4deg); }
.post-card:nth-child(even) { transform: rotate(0.3deg); }

.post-card:hover {
  transform: rotate(0deg) translateY(-2px);
  box-shadow: 4px 4px 0 rgba(43,36,22,0.15);
}

/* Punch holes on left side - like notebook page */
.post-card::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 22px;
  width: 10px;
  height: 10px;
  background: var(--paper);
  border: 1px solid rgba(43,36,22,0.2);
  border-radius: 50%;
}
.post-card::after {
  content: '';
  position: absolute;
  left: -10px;
  bottom: 22px;
  width: 10px;
  height: 10px;
  background: var(--paper);
  border: 1px solid rgba(43,36,22,0.2);
  border-radius: 50%;
}

/* Red margin line like school notebook */
.post-card-inner {
  padding-left: 20px;
  border-left: 1.5px solid rgba(201,74,29,0.3);
}

.post-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-fade);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.post-tag {
  display: inline-block;
  font-family: var(--hand);
  font-size: 16px;
  padding: 0 8px;
  background: var(--highlight);
  color: var(--ink);
  transform: rotate(-1deg);
  border: none;
}
.post-tag.news     { background: #9ec4e8; }
.post-tag.projekt  { background: #f2c94c; }
.post-tag.tutorial { background: #a8d9a0; }

.post-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 10px;
}
.post-title a {
  color: var(--ink);
  border: none;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-size: 0% 1.5px;
  background-position: 0 95%;
  background-repeat: no-repeat;
  transition: background-size 0.25s;
}
.post-title a:hover {
  background-size: 100% 1.5px;
  color: var(--ink);
}

.post-excerpt {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.read-more {
  display: inline-block;
  font-family: var(--hand);
  font-size: 18px;
  color: var(--accent);
  margin-top: 10px;
  border: none;
  padding: 0;
}
.read-more::after {
  content: ' →';
  transition: margin-left 0.2s;
  display: inline-block;
}
.read-more:hover { background: transparent; }
.read-more:hover::after { margin-left: 6px; }

/* ======================================================
   SINGLE POST
====================================================== */
#primary { position: relative; z-index: 2; padding-bottom: 80px; }

.single-header {
  padding: 56px 32px 24px;
  max-width: 880px;
  margin: 0 auto;
}

.single-header .post-meta {
  margin-bottom: 16px;
}

.single-header .post-title {
  font-family: var(--hand);
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 20px;
  font-weight: 700;
}
.single-header .post-title a {
  color: inherit;
  background: none;
  border: none;
}
.single-header .post-title a:hover { background: transparent; }

.entry-content {
  max-width: 680px;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.85;
  color: var(--ink);
}

.entry-content h2 {
  font-family: var(--hand);
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  margin: 48px 0 16px;
  transform: rotate(-0.5deg);
  display: inline-block;
  position: relative;
  padding: 0 6px;
}
.entry-content h2::before {
  content: '';
  position: absolute;
  inset: 25% -6px 5% -6px;
  background: var(--highlight);
  z-index: -1;
  transform: skew(-2deg);
  opacity: 0.6;
}

.entry-content h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  font-style: italic;
  color: var(--ink);
  margin: 32px 0 12px;
}
.entry-content h3::before {
  content: '§ ';
  color: var(--accent);
  font-style: normal;
}

.entry-content p {
  margin-bottom: 22px;
}

/* Drop cap on first paragraph */
.entry-content > p:first-of-type::first-letter {
  font-family: var(--hand);
  font-size: 72px;
  font-weight: 700;
  float: left;
  line-height: 0.8;
  margin: 8px 10px 0 0;
  color: var(--accent);
}

.entry-content strong {
  background: linear-gradient(transparent 60%, var(--highlight) 60%);
  color: var(--ink);
  font-weight: 600;
  padding: 0 2px;
}

.entry-content em {
  font-style: italic;
  color: var(--accent);
}

.entry-content a {
  color: var(--accent);
  border-bottom: 1px dashed var(--accent-soft);
}

.entry-content ul,
.entry-content ol {
  margin: 0 0 22px 0;
  padding: 0;
  list-style: none;
}

.entry-content ul li,
.entry-content ol li {
  position: relative;
  padding: 4px 0 4px 32px;
}

.entry-content ul li::before {
  content: '✦';
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-size: 14px;
  top: 8px;
}

.entry-content ol {
  counter-reset: custom-counter;
}
.entry-content ol li {
  counter-increment: custom-counter;
}
.entry-content ol li::before {
  content: counter(custom-counter);
  position: absolute;
  left: 0;
  top: 4px;
  font-family: var(--hand);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.entry-content code {
  background: var(--paper-deep);
  border: 1px solid rgba(43,36,22,0.15);
  border-radius: var(--r);
  padding: 1px 7px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
}

.entry-content pre {
  background: var(--paper-deep);
  border: 1px solid rgba(43,36,22,0.2);
  border-radius: var(--r);
  padding: 18px 22px;
  margin-bottom: 24px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  line-height: 1.6;
  position: relative;
  box-shadow: 2px 2px 0 rgba(43,36,22,0.08);
}

.entry-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 14px;
}

blockquote {
  margin: 32px 0;
  padding: 14px 24px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--ink-soft);
  border-left: 4px solid var(--accent);
  background: var(--paper-dark);
  transform: rotate(-0.3deg);
  line-height: 1.5;
  position: relative;
}
blockquote::before {
  content: '"';
  position: absolute;
  left: 8px;
  top: -8px;
  font-family: var(--hand);
  font-size: 72px;
  color: var(--accent);
  line-height: 1;
  opacity: 0.4;
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--hand);
  font-size: 22px;
  color: var(--accent);
  margin-top: 48px;
  border: none;
  background: none;
  transform: rotate(-1deg);
  padding: 4px 12px;
  transition: all 0.2s;
}
.back-link:hover {
  background: var(--highlight);
  color: var(--ink);
  transform: rotate(0deg) translateX(-4px);
}

/* ======================================================
   PAGE
====================================================== */
.page-header {
  padding: 56px 32px 32px;
  max-width: 880px;
  margin: 0 auto;
  position: relative;
}

.page-header h1 {
  font-family: var(--hand);
  font-size: clamp(44px, 6vw, 72px);
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  transform: rotate(-1.5deg);
  display: inline-block;
  position: relative;
  padding: 0 8px;
}

.page-header h1::before {
  content: '';
  position: absolute;
  inset: 30% -8px 8% -8px;
  background: var(--highlight);
  z-index: -1;
  transform: skew(-3deg);
  opacity: 0.55;
}

/* ======================================================
   WIDGETS
====================================================== */
.widget {
  background: var(--paper-dark);
  border: 1px solid rgba(43,36,22,0.15);
  padding: 20px 24px;
  margin-bottom: 28px;
  box-shadow: 2px 2px 0 rgba(43,36,22,0.08);
  transform: rotate(0.3deg);
}
.widget:nth-of-type(even) { transform: rotate(-0.4deg); }

.widget-title {
  font-family: var(--hand);
  font-size: 24px;
  color: var(--ink);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1.5px dashed var(--ink-fade);
}

.widget ul { list-style: none; }
.widget ul li {
  padding: 6px 0;
  font-family: var(--serif);
  font-size: 15px;
}
.widget ul li a { color: var(--ink-soft); border: none; }
.widget ul li a::before { content: '· '; color: var(--accent); font-weight: bold; }
.widget ul li a:hover { background: var(--highlight); color: var(--ink); }

/* ======================================================
   PAGINATION
====================================================== */
.nav-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 48px; }
.page-numbers {
  display: inline-block;
  font-family: var(--hand);
  font-size: 22px;
  padding: 2px 14px;
  border: 2px solid var(--ink);
  color: var(--ink);
  background: var(--paper);
  transition: all 0.15s;
  transform: rotate(-1deg);
}
.page-numbers:nth-child(even) { transform: rotate(1deg); }
.page-numbers:hover, .page-numbers.current {
  background: var(--ink);
  color: var(--paper);
  transform: rotate(0deg) scale(1.05);
}

/* ======================================================
   SEARCH
====================================================== */
.search-form { display: flex; gap: 10px; }
.search-field {
  flex: 1;
  background: var(--paper);
  border: none;
  border-bottom: 2px solid var(--ink);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  padding: 6px 4px;
  outline: none;
}
.search-field::placeholder { color: var(--ink-fade); font-style: italic; }
.search-submit {
  background: var(--ink);
  color: var(--paper);
  border: none;
  font-family: var(--hand);
  font-size: 20px;
  padding: 4px 16px;
  cursor: pointer;
  transform: rotate(-1deg);
  transition: transform 0.15s;
}
.search-submit:hover { transform: rotate(0deg) scale(1.05); }

/* ======================================================
   FOOTER
====================================================== */
#colophon {
  position: relative;
  z-index: 2;
  margin-top: 80px;
  padding: 32px 0 24px;
  border-top: 2px solid var(--ink);
}

#colophon::before {
  content: '';
  display: block;
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 14px;
  background: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 14'%3E%3Cpath d='M2 7 Q 10 2, 18 7 T 34 7 T 58 7' stroke='%23c94a1d' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-sign {
  font-family: var(--hand);
  font-size: 28px;
  color: var(--accent);
  transform: rotate(-2deg);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-soft);
  border: none;
}
.footer-links a:hover { background: var(--highlight); color: var(--ink); }

.footer-copy {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-fade);
  letter-spacing: 0.05em;
}

/* ======================================================
   COMMENTS
====================================================== */
.comments-area { margin-top: 48px; padding-top: 32px; border-top: 1.5px dashed var(--ink-fade); }
.comments-title {
  font-family: var(--hand);
  font-size: 30px;
  color: var(--ink);
  margin-bottom: 20px;
  transform: rotate(-1deg);
  display: inline-block;
}
.comment {
  background: var(--paper-dark);
  border: 1px solid rgba(43,36,22,0.15);
  padding: 16px 20px;
  margin-bottom: 14px;
  box-shadow: 2px 2px 0 rgba(43,36,22,0.08);
}
.comment:nth-child(odd)  { transform: rotate(-0.3deg); }
.comment:nth-child(even) { transform: rotate(0.3deg); }

.comment-meta { font-family: var(--hand); font-size: 16px; color: var(--accent); margin-bottom: 8px; }
.comment-body p { font-family: var(--serif); font-size: 16px; color: var(--ink); }

/* ======================================================
   SCROLL IN ANIMATION
====================================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px) rotate(var(--init-rot, 0deg)); }
  to   { opacity: 1; transform: translateY(0) rotate(var(--init-rot, 0deg)); }
}

.reveal {
  animation: fadeInUp 0.6s ease forwards;
}

/* ======================================================
   RESPONSIVE
====================================================== */
@media (max-width: 720px) {
  body { font-size: 16px; }
  body::after { display: none; }

  .site-header-inner { flex-wrap: wrap; gap: 12px; }
  .site-description { display: none; }

  #site-navigation { display: none; width: 100%; }
  #site-navigation.toggled { display: block; }
  #site-navigation.toggled ul { flex-direction: column; gap: 8px; padding-top: 12px; }
  .menu-toggle { display: block; margin-left: auto; }

  .site-title { font-size: 30px; }
  .hero { padding: 40px 20px 32px; }
  .hero-sub { font-size: 18px; }
  .hero-stats { gap: 28px; }
  .stat-val { font-size: 46px; }
  .entry-content > p:first-of-type::first-letter { font-size: 56px; }
  .site-wrapper, .content-area, .single-header, .page-header { padding: 0 20px; }
  .footer-inner { flex-direction: column; text-align: center; padding: 0 20px; }
}
