/*
Theme Name: Decibels & Dragons
Theme URI: https://wm3j.example
Author: WM3J
Author URI: https://wm3j.example
Description: A playful personal theme for WM3J — amateur radio, software, and projects. Where signal meets sorcery.
Version: 1.2.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: decibels-and-dragons
Tags: blog, one-column, custom-colors, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ============================================================
   DESIGN TOKENS
   ============================================================ */

:root {
  --parchment:      #f4ead5;
  --parchment-dark: #e9dcb8;
  --ink:            #1f1a17;
  --ink-soft:       #3a2f28;
  --ember:          #c8472b;
  --ember-bright:   #e85d2f;
  --moss:           #2f6b4f;
  --moss-deep:      #1d4632;
  --gold:           #c9a14a;
  --signal-blue:    #2a6f97;
  --paper-shadow:   rgba(31, 26, 23, 0.12);

  --font-display: "IM Fell English SC", "Cormorant Garamond", Georgia, serif;
  --font-body:    "Lora", "Iowan Old Style", Georgia, serif;
  --font-mono:    "JetBrains Mono", "Fira Code", "Courier New", monospace;

  --container: 1100px;
  --pad: clamp(1rem, 3vw, 2rem);
  --radius: 6px;
  --radius-lg: 14px;
}

/* ============================================================
   RESET / BASE
   ============================================================ */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--parchment);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 0.12  0 0 0 0 0.10  0 0 0 0 0.08  0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"),
    radial-gradient(ellipse at top left, rgba(200,71,43,0.06), transparent 60%),
    radial-gradient(ellipse at bottom right, rgba(47,107,79,0.07), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
}

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

a {
  color: var(--ember);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.2s, color 0.2s;
}
a:hover, a:focus {
  color: var(--ember-bright);
  border-bottom-color: currentColor;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 0.5em;
  letter-spacing: 0.01em;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); }
h3 { font-size: 1.4rem; }

p { margin: 0 0 1.1em; }

code, pre, .mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
pre {
  background: var(--ink);
  color: var(--parchment);
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  overflow-x: auto;
  border-left: 4px solid var(--ember);
}
:not(pre) > code {
  background: var(--parchment-dark);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  color: var(--moss-deep);
}

blockquote {
  border-left: 4px solid var(--gold);
  margin: 1.5em 0;
  padding: 0.5em 1.2em;
  font-style: italic;
  color: var(--ink-soft);
  background: rgba(201, 161, 74, 0.08);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.site-main {
  padding: 3rem 0 5rem;
}

/* ============================================================
   HEADER + MASTHEAD
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1.2rem 0 0.5rem;
  border-bottom: 2px solid var(--ink);
  background: linear-gradient(to bottom, rgba(244,234,213,0.95), rgba(244,234,213,0.85));
  backdrop-filter: blur(4px);
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
  border: none;
}
.brand:hover .dragon-mark { transform: rotate(-8deg) scale(1.05); }

.dragon-mark {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  filter: drop-shadow(2px 2px 0 var(--paper-shadow));
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.brand-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.2vw, 2rem);
  color: var(--ink);
  letter-spacing: 0.02em;
}
.brand-amp {
  color: var(--ember);
  font-style: italic;
  margin: 0 0.1em;
}
.brand-callsign {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--moss-deep);
  margin-top: 4px;
  letter-spacing: 0.15em;
}

/* Main nav */
.main-nav ul {
  list-style: none;
  display: flex;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.main-nav a {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ink);
  border: none;
  border-radius: var(--radius);
  position: relative;
  transition: color 0.2s, background 0.2s;
}
.main-nav a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 0;
  height: 2px;
  background: var(--ember);
  transition: width 0.25s, left 0.25s;
}
.main-nav a:hover, .main-nav a:focus,
.main-nav .current-menu-item a {
  color: var(--ember);
  background: rgba(200, 71, 43, 0.06);
}
.main-nav a:hover::after,
.main-nav .current-menu-item a::after {
  width: 70%;
  left: 15%;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.4rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--ink);
}

@media (max-width: 720px) {
  .nav-toggle { display: inline-block; }
  .main-nav {
    display: none;
    width: 100%;
    margin-top: 1rem;
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; }
  .main-nav a { display: block; }
}

/* ============================================================
   HERO (home page)
   ============================================================ */

.hero {
  position: relative;
  padding: 4rem 0 3rem;
  overflow: hidden;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 3rem;
  align-items: center;
}
@media (max-width: 800px) {
  .hero-inner { grid-template-columns: 1fr; }
}

.hero-title {
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.05;
  margin-bottom: 0.5em;
}
.hero-title .accent { color: var(--ember); font-style: italic; }
.hero-tagline {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--moss-deep);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
}
.hero-lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 38ch;
}

.hero-art {
  position: relative;
  max-width: 100%;
  margin: 0 auto;
}

/* ============================================================
   SECTION CARDS (homepage section grid)
   ============================================================ */

.section-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.5rem;
  margin: 3rem 0;
}

@media (max-width: 900px) {
  .section-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

.section-card {
  background: rgba(255, 252, 244, 0.7);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--ink);
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 3px 3px 0 var(--ink);
}
.section-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ember);
  color: var(--ink);
}
.section-card h3 {
  margin-top: 0.4rem;
  margin-bottom: 0.3rem;
}
.section-card .icon {
  width: 42px;
  height: 42px;
  color: var(--ember);
}
.section-card p {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 0;
}

/* ============================================================
   POST / ARTICLE
   ============================================================ */

.entry {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px dashed var(--paper-shadow);
}
.entry:last-child { border-bottom: none; }

.entry-meta {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--moss-deep);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  align-items: center;
}
.entry-meta .cat-pill {
  background: var(--ink);
  color: var(--parchment);
  padding: 0.15rem 0.6rem;
  border-radius: 100px;
  font-size: 0.72rem;
}
.cat-pill.cat-software { background: var(--signal-blue); }
.cat-pill.cat-radio    { background: var(--moss); }
.cat-pill.cat-projects { background: var(--gold); color: var(--ink); }
.cat-pill.cat-thoughts { background: var(--ember); }
.cat-pill.cat-games    { background: #6b4cab; }

.entry-title {
  margin: 0.2rem 0 0.4rem;
}
.entry-title a {
  color: var(--ink);
  border: none;
}
.entry-title a:hover { color: var(--ember); }

.entry-excerpt {
  color: var(--ink-soft);
}

.read-more {
  display: inline-block;
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.read-more::after { content: " →"; }

/* Single post */
.post-content {
  max-width: 70ch;
  margin: 0 auto;
}
.post-content h2, .post-content h3 { margin-top: 2em; }
.post-content img {
  border-radius: var(--radius);
  margin: 1.5em auto;
  box-shadow: 0 4px 18px var(--paper-shadow);
}

/* ============================================================
   PAGE HEADERS
   ============================================================ */

.page-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--ink);
  position: relative;
}
.page-header::after {
  content: "◆";
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--parchment);
  padding: 0 0.6rem;
  color: var(--ember);
}
.page-title {
  font-size: clamp(2rem, 5vw, 3rem);
}
.page-subtitle {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.85rem;
  color: var(--moss-deep);
  margin-top: 0.4rem;
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  background: var(--ink);
  color: var(--parchment);
  padding: 3rem 0 2rem;
  margin-top: 4rem;
  position: relative;
}
.site-footer::before {
  content: "";
  display: block;
  height: 8px;
  background: repeating-linear-gradient(
    90deg,
    var(--ember) 0 18px,
    var(--gold) 18px 36px,
    var(--moss) 36px 54px
  );
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}
.site-footer a { color: var(--gold); }
.site-footer a:hover { color: var(--ember-bright); }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-grid h4 {
  color: var(--gold);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}
.footer-bottom {
  border-top: 1px solid rgba(244, 234, 213, 0.2);
  padding-top: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-align: center;
  color: rgba(244, 234, 213, 0.7);
}

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin: 3rem 0 1rem;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  font-family: var(--font-mono);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: rgba(255, 252, 244, 0.6);
}
.pagination a:hover {
  background: var(--ember);
  color: var(--parchment);
  border-color: var(--ember);
}
.pagination .current {
  background: var(--ink);
  color: var(--parchment);
}

/* ============================================================
   COMMENTS
   ============================================================ */

.comments-area {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--ink);
}
.comment-list {
  list-style: none;
  padding: 0;
}
.comment {
  background: rgba(255, 252, 244, 0.6);
  border: 1.5px solid var(--paper-shadow);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}
.comment-meta {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--moss-deep);
  margin-bottom: 0.5rem;
}
.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-family: var(--font-body);
  font-size: 1rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: rgba(255, 252, 244, 0.8);
  margin-bottom: 1rem;
}
.comment-form input[type="submit"],
button[type="submit"],
.button {
  width: auto;
  background: var(--ink);
  color: var(--parchment);
  cursor: pointer;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  padding: 0.6rem 1.4rem;
  transition: background 0.2s;
}
.comment-form input[type="submit"]:hover,
button[type="submit"]:hover,
.button:hover {
  background: var(--ember);
}

/* ============================================================
   PROJECT / FEATURE TILES
   ============================================================ */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.tile {
  background: rgba(255, 252, 244, 0.85);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: 3px 3px 0 var(--ink);
  position: relative;
}
.tile h3 { margin-top: 0; }
.tile .tile-tag {
  position: absolute;
  top: -10px;
  right: 14px;
  background: var(--ember);
  color: var(--parchment);
  padding: 0.2rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 100px;
}

/* ============================================================
   UTILITIES
   ============================================================ */

.text-center { text-align: center; }
.hidden { display: none; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
  color: var(--moss-deep);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--paper-shadow);
}

@keyframes pulse-wave {
  0%, 100% { transform: scaleX(1); opacity: 0.6; }
  50%      { transform: scaleX(1.04); opacity: 1; }
}
.wave-bar {
  animation: pulse-wave 2.4s ease-in-out infinite;
  transform-origin: left center;
}
.wave-bar:nth-child(2) { animation-delay: 0.2s; }
.wave-bar:nth-child(3) { animation-delay: 0.4s; }
.wave-bar:nth-child(4) { animation-delay: 0.6s; }
