/* ============================================================
   quill.seedofchaos.com — Writing portfolio
   Palette: deep indigo / ink / vellum
   ============================================================ */

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

:root {
  --bg:           #08070f;
  --bg-surface:   #0e0c1a;
  --bg-raised:    #151128;
  --border:       #2a2145;
  --border-soft:  #1a1530;
  --text:         #e3dfee;
  --text-muted:   #a89cc7;
  --text-dim:     #5e5280;
  --accent:       #b896ff;
  --accent-soft:  #d4beff;
  --ink:          #8c6cff;
  --link:         #c9b0ff;
  --link-hover:   #e8dcff;

  --font-display: 'Cormorant Garamond', 'EB Garamond', Georgia, 'Times New Roman', serif;
  --font-body:    Georgia, 'Times New Roman', serif;
  --font-ui:      system-ui, -apple-system, 'Segoe UI', sans-serif;

  --measure:      62ch;
  --line-height:  1.75;
  --space:        1rem;
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: var(--line-height);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(ellipse at top, rgba(140, 108, 255, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse at bottom, rgba(184, 150, 255, 0.04) 0%, transparent 60%);
  background-attachment: fixed;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--link-hover);
}

/* ============================================================
   Header / Masthead
   ============================================================ */

.site-header {
  width: 100%;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(180deg, var(--bg) 0%, var(--bg-surface) 100%);
  padding: 0 0 2.8rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Subtle textured noise overlay — parchment/ink grain */
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 0.72  0 0 0 0 0.58  0 0 0 0 1  0 0 0 0.28 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 180px 180px;
  mix-blend-mode: overlay;
  z-index: 0;
}

/* Bottom accent glow */
.site-header::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translateX(-50%);
  width: 220px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  z-index: 2;
}

/* The illustrated SVG banner across the top of the header */
.masthead-art {
  display: block;
  width: 100%;
  height: auto;
  max-height: 180px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 0 18px rgba(140, 108, 255, 0.12));
}

.masthead {
  max-width: 820px;
  margin: 1.4rem auto 0;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

.wordmark {
  display: inline-block;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7vw, 4.2rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.02em;
  line-height: 1;
  text-decoration: none;
}

.wordmark:hover {
  color: var(--accent-soft);
}

.wordmark-text {
  background: linear-gradient(180deg, var(--text) 0%, var(--accent-soft) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* Ornamental horizontal rule under the wordmark */
.masthead-rule {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  margin: 0.9rem auto 0.6rem;
  opacity: 0.9;
}

.tagline {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 0.4rem;
}

/* ============================================================
   Navigation / Category Filter
   ============================================================ */

.site-nav {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-soft);
  padding: 0.6rem 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background-color: rgba(14, 12, 26, 0.85);
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem;
  max-width: 820px;
  margin: 0 auto;
}

.filter {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 2px;
}

.filter:hover {
  color: var(--text);
  border-color: var(--border);
}

.filter.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

/* ============================================================
   Main
   ============================================================ */

main {
  flex: 1;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: 4rem var(--space) 5rem;
}

.intro {
  margin-bottom: 3.5rem;
  text-align: center;
}

.intro h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 400;
  font-style: italic;
  color: var(--text);
  letter-spacing: 0.01em;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.intro .lede {
  max-width: var(--measure);
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
}

/* ============================================================
   Pieces list
   ============================================================ */

.piece-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.piece {
  border-top: 1px solid var(--border-soft);
}

.piece:last-child {
  border-bottom: 1px solid var(--border-soft);
}

.piece-link {
  display: block;
  padding: 2rem 0.5rem;
  color: var(--text);
  transition: background 0.25s ease, padding 0.25s ease;
  position: relative;
}

.piece-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.3s ease;
}

.piece-link:hover {
  background: var(--bg-surface);
  padding-left: 1.5rem;
  color: var(--text);
}

.piece-link:hover::before {
  transform: scaleY(1);
}

.piece-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.7rem;
}

.piece-cat {
  color: var(--accent);
  font-weight: 600;
}

.piece-sep {
  color: var(--text-dim);
  opacity: 0.6;
}

.piece-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 400;
  font-style: italic;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: 0.005em;
  margin-bottom: 0.6rem;
}

.piece-link:hover .piece-title {
  color: var(--accent-soft);
}

.piece-excerpt {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.65;
  max-width: var(--measure);
}

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-dim);
  font-style: italic;
  font-size: 1rem;
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--border-soft);
  background: var(--bg-surface);
  padding: 2.5rem 1rem;
  text-align: center;
}

.footer-inner {
  max-width: 820px;
  margin: 0 auto;
}

.footer-line {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.footer-dim {
  color: var(--text-dim);
}

.footer-dim a {
  color: var(--text-muted);
}

.footer-dim a:hover {
  color: var(--accent);
}

/* ============================================================
   Article / Piece page styles (used by pieces/*.html)
   ============================================================ */

.article-header {
  max-width: var(--measure);
  margin: 0 auto 3rem;
  text-align: center;
  padding-top: 2rem;
}

.article-back {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border-soft);
  border-radius: 2px;
  transition: all 0.2s;
}

.article-back:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.article-category {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.article-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  font-style: italic;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: 0.005em;
}

.article-date {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.article-body {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 0.5rem;
}

.article-body p {
  margin-bottom: 1.4rem;
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text);
}

.article-body p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 3.6rem;
  font-style: italic;
  float: left;
  line-height: 0.9;
  padding: 0.4rem 0.6rem 0 0;
  color: var(--accent);
}

.article-body h2,
.article-body h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  color: var(--text);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.article-body h2 {
  font-size: 1.6rem;
}

.article-body h3 {
  font-size: 1.3rem;
  color: var(--accent-soft);
}

.article-body blockquote {
  border-left: 2px solid var(--accent);
  padding: 0.4rem 1.4rem;
  margin: 1.8rem 0;
  font-style: italic;
  color: var(--text-muted);
}

.article-body em {
  color: var(--accent-soft);
}

.article-body hr {
  border: none;
  text-align: center;
  margin: 2.4rem 0;
}

.article-body hr::before {
  content: '\2766';
  color: var(--accent);
  font-size: 1.1rem;
  letter-spacing: 0.5em;
}

.article-body a {
  border-bottom: 1px solid var(--border);
}

.article-body a:hover {
  border-bottom-color: var(--accent);
}

.article-footer {
  max-width: var(--measure);
  margin: 3rem auto 0;
  padding: 2rem 0.5rem 0;
  border-top: 1px solid var(--border-soft);
  text-align: center;
}

.article-footer .article-back {
  margin-bottom: 0;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 640px) {
  html { font-size: 16px; }

  .site-header {
    padding: 0 0 2rem;
  }

  .masthead-art {
    max-height: 130px;
  }

  .masthead {
    padding: 0 1rem;
  }

  .masthead-rule {
    max-width: 240px;
    margin-top: 0.7rem;
  }

  main {
    padding: 2.5rem var(--space) 3.5rem;
  }

  .piece-link {
    padding: 1.5rem 0.25rem;
  }

  .piece-link:hover {
    padding-left: 1rem;
  }

  .site-nav {
    padding: 0.5rem 0.5rem;
  }

  .filter {
    padding: 0.5rem 0.8rem;
    font-size: 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
