/*
Theme Name: Pedder Blog Glitch
Theme URI: https://blog.pedder.rocks
Author: OpenAI
Description: Minimal dark WordPress theme inspired by the pedder.rocks landing page aesthetic.
Version: 1.1
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Text Domain: pedder-blog-glitch
*/

:root {
  --bg: #050505;
  --panel: rgba(255,255,255,0.03);
  --panel-strong: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.14);
  --border-strong: rgba(255,255,255,0.24);
  --text: rgba(255,255,255,0.96);
  --muted: rgba(255,255,255,0.62);
  --muted-strong: rgba(255,255,255,0.82);
  --shadow: 0 18px 50px rgba(0,0,0,0.28);
  --max: 1120px;
  --header-gap: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  animation: bgFlash 6s infinite linear;
  overflow-x: clip;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image: radial-gradient(circle at center, rgba(255,255,255,0.8) 0.55px, transparent 0.85px);
  background-size: 10px 10px;
  mix-blend-mode: soft-light;
  z-index: 0;
}

body.admin-bar .motion-toggle { top: 50px; }

@keyframes bgFlash {
  0%, 100% { background-color: #050505; }
  92% { background-color: #050505; }
  94% { background-color: #1a1a1a; }
  95% { background-color: #2a2a2a; }
  96% { background-color: #0f0f0f; }
  97% { background-color: #3a3a3a; }
  98% { background-color: #ffffff; }
  99% { background-color: #050505; }
}

@keyframes heroIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes drift {
  0% { transform: translate3d(0,0,0); }
  50% { transform: translate3d(0,-10px,0); }
  100% { transform: translate3d(0,0,0); }
}

@keyframes flicker {
  0%, 18%, 22%, 25%, 53%, 57%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: 0.45; }
}

@keyframes glitchMain {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(2px, -1px); }
  40% { transform: translate(-3px, 2px); }
  60% { transform: translate(2px, 1px); }
  80% { transform: translate(-2px, -1px); }
}

@keyframes glitchBefore {
  0%,100% { clip-path: inset(0 0 70% 0); transform: translate(-2px,-2px); }
  50% { clip-path: inset(40% 0 20% 0); transform: translate(3px,1px); }
}

@keyframes glitchAfter {
  0%,100% { clip-path: inset(80% 0 5% 0); transform: translate(2px,2px); }
  50% { clip-path: inset(10% 0 60% 0); transform: translate(-3px,2px); }
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(255,255,255,0.9);
  outline-offset: 2px;
}

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

.site-shell,
.site-header,
.site-footer,
.hero,
.posts-section,
.single-shell,
.archive-shell {
  position: relative;
  z-index: 1;
}

.site-header {
  padding: 24px 16px 12px;
}

.site-footer-inner,
.posts-grid,
.single-shell,
.archive-shell,
.search-hero-panel {
  width: min(calc(100% - 32px), var(--max));
  margin: 0 auto;
}

.site-header-inner {
  width: calc(100% - 32px);
  max-width: none;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--header-gap);
  justify-content: flex-start;
}

.brand {
  display: block;
  text-transform: none;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--muted-strong);
  flex: 0 0 auto;
  line-height: 1.4;
  white-space: nowrap;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  width: 44px;
  height: 44px;
  margin-left: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
}

.header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  flex: 0 1 auto;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
}

.motion-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  font-size: 11px;
  letter-spacing: 2px;
  color: #aaa;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  padding: 6px 0;
  justify-content: flex-end;
  text-align: right;
}

.motion-toggle .switch {
  width: 38px;
  height: 20px;
  border-radius: 20px;
  border: 1px solid #333;
  position: relative;
  background: rgba(255,255,255,0.04);
}

.motion-toggle .knob {
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 1px;
  left: 2px;
  transition: 0.25s;
}

body.admin-bar .motion-toggle {
  right: 20px;
}

.hero {
  min-height: calc(100vh - 96px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
}

.hero-inner {
  width: min(100%, 1000px);
  animation: heroIn 1.2s ease forwards;
  will-change: transform, opacity;
}

.word-wrap {
  animation: drift 8s ease-in-out infinite;
}

.glitch {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  color: var(--text);
  text-transform: uppercase;
  font-weight: 900;
  font-size: clamp(1.6rem, 7.6vw, 5.6rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
  white-space: nowrap;
  overflow: visible;
  animation: glitchMain 2.5s infinite linear, flicker 5s infinite linear;
  text-shadow: 0 0 24px rgba(255,255,255,0.08);
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.glitch::before {
  color: rgba(255,255,255,0.62);
  animation: glitchBefore 1.5s infinite alternate;
}

.glitch::after {
  color: rgba(190,190,190,0.6);
  animation: glitchAfter 2s infinite alternate;
}

.hero-subtitle {
  margin-top: 22px;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: clamp(0.76rem, 2vw, 1.15rem);
  color: rgba(255,255,255,0.86);
  white-space: normal;
}

.search-page-form {
  width: 100%;
}

.hero-actions {
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
  justify-content: center;
}

.button,
.search-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  transition: transform 0.35s ease, border-color 0.35s ease, background 0.35s ease, box-shadow 0.35s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.button-secondary {
  background: transparent;
}

.button:hover,
.button:focus-visible,
.card:hover,
.card:focus-visible,
.search-submit:hover,
.search-submit:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,0.38);
  background: rgba(255,255,255,0.055);
  box-shadow: var(--shadow);
  outline: none;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.search-form-filters {
  grid-template-columns: minmax(0, 2fr) repeat(2, minmax(170px, 1fr)) auto;
}

.search-field {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 0.98rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.search-field::placeholder {
  color: var(--muted);
}

.search-hero-panel {
  padding: 18px 0 28px;
}

.search-title {
  margin: 0 0 18px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.search-summary {
  margin-top: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.posts-section,
.archive-shell,
.single-shell {
  padding: 0 0 80px;
}

.section-title {
  width: min(calc(100% - 32px), var(--max));
  margin: 0 auto 18px;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.74rem;
  color: var(--muted);
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
}

.post-card-wrap {
  grid-column: span 6;
  min-width: 0;
}

.card {
  display: block;
  height: 100%;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.45s ease, border-color 0.45s ease, background 0.45s ease, box-shadow 0.45s ease;
  box-shadow: 0 0 0 rgba(255,255,255,0);
}

.card-meta {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  color: var(--muted);
}

.card-title {
  margin-top: 16px;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.card-excerpt {
  margin-top: 16px;
  color: var(--muted);
  line-height: 1.75;
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.single-shell,
.archive-shell {
  padding-top: 24px;
}

.post-panel {
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.post-title {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.75rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
  text-transform: uppercase;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.post-meta {
  margin-top: 18px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.72rem;
  color: var(--muted);
}

.post-content {
  margin-top: 28px;
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text);
}

.post-content p,
.post-content ul,
.post-content ol,
.post-content blockquote {
  margin: 0 0 1.4em;
}

.post-content h2,
.post-content h3,
.post-content h4 {
  margin: 1.8em 0 0.6em;
  line-height: 1.05;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.post-content a {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.post-content pre,
.post-content code,
.post-content table {
  max-width: 100%;
  overflow-x: auto;
}

.site-footer {
  padding: 0 0 36px;
}

.site-footer-inner {
  text-align: center;
  font-size: 11px;
  opacity: 0.5;
}

.pagination {
  width: min(calc(100% - 32px), var(--max));
  margin: 24px auto 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  color: var(--muted-strong);
  flex-wrap: wrap;
}

.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;
}

body.motion-off,
body.motion-off .glitch,
body.motion-off .glitch::before,
body.motion-off .glitch::after,
body.motion-off .word-wrap,
body.motion-off .hero-inner {
  animation: none !important;
}

body.motion-off {
  background: var(--bg);
}

@media (max-width: 1080px) {
  .site-header-inner {
    display: flex;
    justify-content: flex-start;
  }

  .header-tools {
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  .post-card-wrap { grid-column: span 12; }
  .hero { min-height: auto; padding-top: 130px; padding-bottom: 54px; }
  .search-form { grid-template-columns: 1fr; }
  .search-submit { width: 100%; }
}

@media (max-width: 720px) {
  .site-header {
    padding-top: 72px;
  }

  .site-header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .brand {
    max-width: calc(100vw - 96px);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    white-space: normal;
  }

  .header-tools {
    display: none;
    grid-column: 1 / -1;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--panel-strong);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .header-tools.is-open {
    display: flex;
  }

  .nav-links {
    flex-direction: column;
    gap: 12px;
  }

  .nav-links a {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .nav-links a:last-child {
    border-bottom: 0;
  }

  .hero {
    padding-top: 48px;
  }
}

@media (max-width: 560px) {
  .site-header,
  .hero,
  .posts-section,
  .archive-shell,
  .single-shell {
    padding-left: 0;
    padding-right: 0;
  }

  .site-footer-inner,
  .posts-grid,
  .single-shell,
  .archive-shell,
  .search-hero-panel,
  .section-title,
  .pagination {
    width: min(calc(100% - 20px), var(--max));
  }

  .site-header-inner {
    width: calc(100% - 20px);
  }

  .hero { padding-top: 42px; padding-bottom: 44px; }
  .glitch { font-size: clamp(1.2rem, 7.8vw, 2.9rem); white-space: nowrap; }
  .post-panel { padding: 24px 18px; border-radius: 22px; }
  .post-title { font-size: clamp(1.7rem, 11vw, 3rem); }
  .motion-toggle {
    right: 14px;
    max-width: calc(100vw - 28px);
    justify-content: flex-end;
    text-align: right;
    font-size: 10px;
    letter-spacing: 1.4px;
    flex-wrap: wrap;
  }

  .card {
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body,
  .glitch,
  .glitch::before,
  .glitch::after,
  .word-wrap,
  .hero-inner {
    animation: none !important;
  }
}


.browse-panel {
  display: grid;
  gap: 16px;
}

.browse-intro {
  margin: 0;
  color: var(--muted);
  max-width: 720px;
  line-height: 1.7;
}

.filter-field {
  min-width: 0;
}

.filter-select {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 0.98rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.filter-select option {
  color: #111;
}

.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
}

.pagination .current {
  border-color: rgba(255,255,255,0.38);
  color: var(--text);
}

@media (max-width: 1080px) {
  .search-form-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-form-filters .search-field,
  .search-form-filters .search-submit {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .search-form-filters {
    grid-template-columns: 1fr;
  }

  .search-form-filters .search-field,
  .search-form-filters .search-submit {
    grid-column: auto;
  }
}
