/* ============================================
   soulahfate.dev — indie web stylesheet
   a cozy dark corner of the internet
   ============================================ */

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

/* --- tokens --- */
:root {
  --bg:          #0f0f13;
  --bg-soft:     #1a1a22;
  --bg-card:     #16161e;
  --text:        #c8c5be;
  --text-bright: #e8e5de;
  --text-muted:  #6b6860;
  --accent:      #5aad8a;
  --accent-dim:  #3d7a5f;
  --accent-glow: #5aad8a33;
  --link:        #5aad8a;
  --border:      #2a2a35;
  --border-dashed: #3a3a45;
  --code-bg:     #1a1a22;
  --code-text:   #c8c5be;
  --highlight:   #5aad8a22;

  --font-mono:  'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-serif: 'Lora', 'Georgia', serif;

  --max-width: 640px;
  --spacing:   1.5rem;
}

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

/* --- base --- */
html {
  font-size: 17px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* subtle noise texture */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  z-index: 9999;
}

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

/* --- typography --- */
h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-bright);
  margin-bottom: 0.75rem;
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

p {
  margin-bottom: 1rem;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

a:hover {
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent-glow);
}

strong {
  font-weight: 600;
  color: var(--text-bright);
}

/* selection */
::selection {
  background: var(--accent-dim);
  color: var(--text-bright);
}

/* --- header / nav --- */
header {
  margin-bottom: 2rem;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-name a {
  text-decoration: none;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.site-name span {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.5px;
}

.turtle-icon {
  font-size: 1.5rem;
  line-height: 1;
  transition: transform 0.3s ease;
}

.site-name a:hover .turtle-icon {
  transform: scale(1.2);
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  padding: 0.2rem 0;
  border-bottom: 1px dashed transparent;
  transition: all 0.2s ease;
}

.nav-links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent-dim);
}

/* --- dividers --- */
.divider {
  color: var(--border-dashed);
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-align: center;
  margin: 1rem 0;
  user-select: none;
  overflow: hidden;
  white-space: nowrap;
}

/* --- intro / home --- */
.intro {
  margin-bottom: 2.5rem;
}

.intro h1 {
  font-size: 1.6rem;
}

.wave {
  display: inline-block;
  animation: wave 2.5s ease-in-out infinite;
  transform-origin: 70% 70%;
}

@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  10% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  30% { transform: rotate(14deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
  60% { transform: rotate(0deg); }
}

.now-box {
  background: var(--bg-card);
  border: 1px dashed var(--border-dashed);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

.now-box h3 {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.now-box ul {
  list-style: none;
  padding: 0;
}

.now-box li {
  padding: 0.2rem 0;
}

/* --- post list --- */
.recent-posts h2,
.post-list h1 {
  margin-bottom: 1rem;
}

.post-preview {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.5rem 0;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.post-preview:last-of-type {
  border-bottom: none;
}

.post-preview time {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 7rem;
}

.post-preview a {
  font-weight: 600;
  text-decoration: none;
  color: var(--text-bright);
}

.post-preview a:hover {
  color: var(--accent);
}

.post-desc {
  width: 100%;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  padding-left: 8rem;
}

.more-link {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.empty-state {
  color: var(--text-muted);
  font-style: italic;
  padding: 1rem 0;
}

/* --- single post --- */
.post-header {
  margin-bottom: 2rem;
}

.post-header h1 {
  margin-bottom: 0.5rem;
}

.post-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
}

.post-tags a {
  color: var(--accent-dim);
  text-decoration: none;
  font-size: 0.8rem;
}

.post-tags a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.reading-time {
  color: var(--text-muted);
}

/* --- post content --- */
.post-content {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.8;
}

.post-content h2 {
  margin-top: 2rem;
}

.post-content h3 {
  margin-top: 1.5rem;
}

.post-content a {
  text-decoration-color: var(--accent-dim);
}

.post-content ul, .post-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.post-content li {
  margin-bottom: 0.3rem;
}

.post-content blockquote {
  border-left: 3px solid var(--accent-dim);
  padding: 0.5rem 1rem;
  margin: 1.5rem 0;
  background: var(--bg-card);
  font-style: italic;
  color: var(--text-muted);
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1rem 0;
  border: 1px solid var(--border);
}

/* code: inline */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-soft);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--accent);
}

/* code: blocks */
.post-content pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1rem 1.25rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.85rem;
  line-height: 1.6;
  border: 1px solid var(--border);
}

.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* horizontal rule */
.post-content hr {
  border: none;
  text-align: center;
  margin: 2rem 0;
}

.post-content hr::before {
  content: "~ ~ ~";
  color: var(--border-dashed);
  font-size: 0.9rem;
  letter-spacing: 4px;
}

/* tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.post-content th, .post-content td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.post-content th {
  font-weight: 700;
  color: var(--text-bright);
  border-bottom: 2px solid var(--border-dashed);
}

/* --- post footer / nav --- */
.post-footer {
  margin-top: 2.5rem;
  font-size: 0.9rem;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.back-link {
  margin-top: 0.5rem;
}

/* --- footer --- */
footer {
  margin-top: 3rem;
  padding-bottom: 2rem;
}

.footer-content {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-tagline {
  font-style: italic;
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

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

.badges {
  margin: 1rem 0;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badges img {
  image-rendering: pixelated;
  height: 31px;
}

.badge-text {
  font-size: 0.75rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-dashed);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
}

.footer-copy {
  margin-top: 0.5rem;
  font-size: 0.75rem;
}

/* --- scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border-dashed);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dim);
}

/* --- responsive --- */
@media (max-width: 500px) {
  html {
    font-size: 15px;
  }

  .container {
    padding: 1.5rem 1rem;
  }

  nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .post-preview {
    flex-direction: column;
    gap: 0.1rem;
  }

  .post-desc {
    padding-left: 0;
  }
}
