/* ============================================
   derlocke.net Blog Theme
   Based on Kiwi Blog
   ============================================ */


:root {
  --color-intensity: 50; /* 0-100 slider value */
  --dark-mode: 1; /* Dark mode ON by default */
  
  /* Three main accent colors - ashy/muted tones */
  --color-red: hsl(0, calc(35% + (var(--color-intensity) * 0.3%)), calc(45% + (var(--dark-mode) * 15%)));
  --color-blue: hsl(210, calc(35% + (var(--color-intensity) * 0.3%)), calc(45% + (var(--dark-mode) * 15%)));
  --color-yellow: hsl(45, calc(35% + (var(--color-intensity) * 0.3%)), calc(50% + (var(--dark-mode) * 10%)));
  
  /* Grays */
  --gray-dark: hsl(0, 0%, 12%);
  --gray-medium: hsl(0, 0%, 25%);
  --gray-light: hsl(0, 0%, 75%);
  --gray-lighter: hsl(0, 0%, 90%);
  
  /* Muted text - adapts to light/dark mode */
  --muted-text: hsl(0, 0%, calc(35% + (var(--dark-mode) * 40%)));
  
  /* Content colors based on mode */
  --content-text: hsl(0, 0%, calc(15% + (var(--dark-mode) * 70%)));
  --content-link: var(--color-blue);
  --content-link-hover: hsl(210, 50%, calc(55% + (var(--dark-mode) * 15%)));
  
  /* Header/Footer - always gray */
  --header-bg: hsl(0, 0%, calc(18% - (var(--dark-mode) * 8%)));
  --header-border: hsl(0, 0%, calc(12% - (var(--dark-mode) * 5%)));
  --header-text: hsl(0, 0%, calc(75% + (var(--dark-mode) * 15%)));
  
  /* Background - NOT opaque */
  --bg-color: hsl(0, 0%, calc(95% - (var(--dark-mode) * 85%)));
  
  /* Post/Box styling - opaque backgrounds */
  --box-bg: hsla(0, 0%, calc(98% - (var(--dark-mode) * 88%)), calc(0.75 + (var(--dark-mode) * 0.13)));
  --box-border: hsla(0, 0%, calc(30% + (var(--dark-mode) * 20%)), 0.7);
  --box-shadow: hsla(0, 0%, 0%, calc(0.15 + (var(--dark-mode) * 0.25)));
  
  /* Entry specific - thicker border matching bg */
  --entry-border: hsla(0, 0%, calc(40% + (var(--dark-mode) * 10%)), 0.5);
  --entry-border-width: 4px;
}

/* Light mode (toggled from the menu, remembered in localStorage) */
:root.light {
  --dark-mode: 0;
}

/* ============================================
   Base & Background
   ============================================ */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 70px; /* Account for sticky header */
}

body {
  margin: 0;
  font-family: 'Cantarell', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-color);
  color: var(--content-text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

/* Background image - NOT opaque, normal display */
.background-layer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom:  0;
  background-image: url('../bg.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  z-index: -1;
  pointer-events: none;
}

/* ============================================
   Header / Taskbar - STICKY
   ============================================ */

.taskbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0 1.5rem;
  height: 52px;
  box-shadow: 0 2px 12px var(--box-shadow);
  border-bottom: 1px solid var(--header-border);
}

/* Shell prompt logo */
.taskbar .logo {
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Consolas', monospace;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.taskbar .logo a {
  color: var(--header-text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.prompt-arrow {
  color: var(--color-blue);
  font-weight: 900;
  font-size: 1.1em;
}

.prompt-cmd {
  color: var(--color-yellow);
  font-weight: 500;
}

.prompt-path {
  color: var(--gray-light);
}

/* Blinking cursor - cycles through 3 colors */
.cursor-blink {
  animation: cursor-color-cycle 3s step-end infinite;
  font-weight: bold;
  margin-left: 2px;
}

@keyframes cursor-color-cycle {
  0%, 100% { 
    color: var(--color-red);
    opacity: 1;
  }
  16.66% { opacity: 0; }
  33.33% { 
    color: var(--color-blue);
    opacity: 1;
  }
  50% { opacity: 0; }
  66.66% { 
    color: var(--color-yellow);
    opacity: 1;
  }
  83.33% { opacity: 0; }
}

/* Menu container - right aligned */
.menu-container {
  position: relative;
  margin-left: auto;
}

.menu-toggle {
  background: transparent;
  border: 1px solid var(--gray-medium);
  color: var(--header-text);
  font-size: 1.4rem;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.menu-toggle:hover {
  background: var(--gray-medium);
}

/* Dropdown menu */
.menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--header-bg);
  border: 1px solid var(--header-border);
  border-radius: 8px;
  padding: 0.8rem;
  min-width: 200px;
  box-shadow: 0 8px 24px var(--box-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1001;
}

.menu-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Navigation menu */
.taskbar .menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.taskbar .menu li a {
  color: var(--header-text);
  text-decoration: none;
  padding: 0.6em 0.9em;
  border-radius: 6px;
  transition: all 0.2s;
  font-size: 0.95rem;
  display: block;
  font-family: 'Cantarell', sans-serif;
}

.taskbar .menu li a:hover {
  background: var(--gray-medium);
  color: var(--gray-lighter);
}

/* Theme controls in dropdown */
.theme-controls {
  border-top: 1px solid var(--header-border);
  margin-top: 0.8rem;
  padding-top: 0.8rem;
}

.theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
}

.theme-label {
  font-size: 0.85rem;
  color: var(--gray-light);
  font-family: 'Cantarell', sans-serif;
}

.dark-mode-toggle {
  background: transparent;
  border: 1px solid var(--gray-medium);
  color: var(--header-text);
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.dark-mode-toggle:hover {
  background: var(--gray-medium);
}

/* Hide old mobile toggle */
.mobile-menu-toggle {
  display: none;
}

/* ============================================
   Main Content Area
   ============================================ */

.main-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
  padding-bottom: calc(70px + 2rem); /* Space for service dock */
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  position: relative;
}

/* ============================================
   Post Navigation Sidebar
   ============================================ */

.post-nav {
  /* Desktop: a sticky column next to the content */
  position: sticky;
  top: 76px;
  flex: 0 0 250px;
  align-self: flex-start;
  margin-right: 1.5rem;
  max-height: min(70vh, calc(100vh - 160px));
  background: var(--box-bg);
  border-radius: 12px;
  border: var(--entry-border-width) solid var(--entry-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

main {
  min-width: 0;
}

.post-nav-header {
  padding: 0.8rem 1rem;
  border-bottom: 2px solid var(--entry-border);
  background: hsla(0, 0%, 50%, 0.1);
}

.post-nav-title {
  font-family: 'Cantarell', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--content-text);
}

.post-nav-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--entry-border) transparent;
}

.post-nav-list::-webkit-scrollbar {
  width: 6px;
}

.post-nav-list::-webkit-scrollbar-track {
  background: transparent;
}

.post-nav-list::-webkit-scrollbar-thumb {
  background: var(--entry-border);
  border-radius: 3px;
}

.post-nav-item {
  display: block;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.25rem;
  font-family: 'Cantarell', sans-serif;
  font-size: 0.85rem;
  color: var(--content-text);
  opacity: 0.7;
  text-decoration: none;
  border-radius: 6px;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-nav-item:hover {
  background: hsla(210, 35%, 50%, 0.15);
  color: var(--content-text);
  opacity: 1;
  border-left-color: var(--color-blue);
  text-decoration: none;
}

.post-nav-item.active {
  background: hsla(210, 35%, 50%, 0.2);
  color: var(--color-blue);
  opacity: 1;
  border-left-color: var(--color-blue);
  font-weight: 600;
}

/* Mobile toggle button */
.post-nav-toggle {
  display: none;
  position: fixed;
  left: 1rem;
  bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  z-index: 101;
  background: var(--header-bg);
  border: 2px solid var(--entry-border);
  color: var(--header-text);
  width: 44px;
  height: 44px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s;
  box-shadow: 0 4px 12px var(--box-shadow);
}

.post-nav-toggle:hover {
  background: var(--gray-medium);
  transform: scale(1.05);
}

/* Mobile styles */
@media (max-width: 1200px) {
  .post-nav {
    position: fixed;
    left: 1rem;
    top: auto;
    bottom: calc(124px + env(safe-area-inset-bottom, 0px));
    width: min(300px, calc(100vw - 2rem));
    max-height: min(420px, calc(100vh - 200px));
    margin: 0;
    transform: translateX(-120%);
    opacity: 0;
    pointer-events: none;
  }
  
  .post-nav.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }
  
  .post-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .main-wrapper {
    max-width: none;
  }
}

main {
  max-width: 1000px;
  width: 100%;
  background: var(--box-bg);
  border-radius: 16px;
  box-shadow: 0 8px 32px var(--box-shadow);
  padding: 2.5rem;
  border: var(--entry-border-width) solid var(--entry-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Wider on large screens */
@media (min-width: 1400px) {
  main {
    max-width: 1100px;
    padding: 3rem;
  }
}

@media (min-width: 1800px) {
  main {
    max-width: 1300px;
    padding: 3.5rem;
  }
}

/* ============================================
   Typography & Content
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: 'Cantarell', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.3;
  color: var(--content-text);
}

h1 {
  font-size: 2rem;
  border-bottom: 3px solid var(--color-blue);
  padding-bottom: 0.5em;
  margin-top: 0;
}

h2 {
  font-size: 1.5rem;
  margin-top: 2em;
  color: var(--content-text);
}

h3 {
  font-size: 1.25rem;
  margin-top: 1.5em;
}

p {
  margin: 1em 0;
  font-family: 'Cantarell', sans-serif;
}

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

a:hover {
  color: var(--content-link-hover);
  text-decoration: underline;
}

/* Code blocks - terminal style */
code {
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Consolas', monospace;
  background: hsla(0, 0%, calc(15% + (var(--dark-mode) * 5%)), 0.9);
  color: hsl(120, 50%, calc(55% + (var(--dark-mode) * 15%)));
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

pre {
  background: hsla(0, 0%, calc(10% + (var(--dark-mode) * 2%)), 0.95);
  border-radius: 8px;
  padding: 1.2em;
  overflow-x: auto;
  border: 2px solid var(--entry-border);
}

pre code {
  background: transparent;
  padding: 0;
  color: hsl(120, 45%, 60%);
}

blockquote {
  border-left: 4px solid var(--color-yellow);
  background: hsla(45, 20%, calc(50% - (var(--dark-mode) * 35%)), 0.15);
  margin: 1.5em 0;
  padding: 1em 1.5em;
  border-radius: 0 8px 8px 0;
  font-family: 'Cantarell', sans-serif;
}

blockquote p:first-child {
  margin-top: 0;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Lists */
ul, ol {
  padding-left: 1.5em;
  font-family: 'Cantarell', sans-serif;
}

li {
  margin: 0.5em 0;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

hr {
  border: none;
  border-top: 2px solid var(--entry-border);
  margin: 2em 0;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-family: 'Cantarell', sans-serif;
}

th, td {
  padding: 0.75em 1em;
  border: 2px solid var(--entry-border);
  text-align: left;
}

th {
  background: hsla(210, 20%, 50%, 0.2);
  font-weight: 700;
}

tr:nth-child(even) {
  background: hsla(0, 0%, 50%, 0.08);
}

/* ============================================
   Blog Entry Cards - THICK BORDERS
   ============================================ */

.blogentry {
  background: var(--box-bg);
  border: var(--entry-border-width) solid var(--entry-border);
  border-radius: 12px;
  padding: 1.8em;
  margin: 2em 0;
  transition: transform 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  scroll-margin-top: 70px; /* Account for sticky header when jumping to anchor */
}

.blogentry:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px var(--box-shadow);
}

.blogentry h1 {
  font-size: 1.4rem;
  margin-bottom: 0.5em;
  border-bottom-color: var(--color-red);
}

.blogentry h2 {
  font-size: 1.2rem;
}

/* Pinned post */
.pinned-post {
  background: var(--box-bg);
  border-left: 6px solid var(--color-yellow);
  border-radius: 12px;
  margin: 2em 0;
  padding: 1.5em;
  box-shadow: 0 4px 16px var(--box-shadow);
  border: var(--entry-border-width) solid var(--entry-border);
  border-left-width: 6px;
  border-left-color: var(--color-yellow);
}

.pinned-post strong {
  color: var(--content-text);
  font-size: 1.1em;
}

/* Date styling */
.date {
  color: var(--gray-light);
  font-size: 0.9em;
  font-style: italic;
}

/* ============================================
   Archive Page - Kiwi-blog style
   ============================================ */

.archive-header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding: 2rem;
  background: var(--box-bg);
  border-radius: 12px;
  border: var(--entry-border-width) solid var(--entry-border);
}

.archive-header h1 {
  border: none;
  margin: 0 0 0.8rem 0;
  font-size: 2rem;
}

.archive-description {
  color: var(--muted-text);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto;
  font-family: 'Cantarell', sans-serif;
}

.archive-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.archive-year {
  background: var(--box-bg);
  border-radius: 12px;
  padding: 1.5rem;
  border: var(--entry-border-width) solid var(--entry-border);
}

.year-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 2px solid var(--entry-border);
}

.year-title {
  margin: 0;
  font-size: 1.5rem;
  color: var(--color-blue);
  font-weight: 700;
}

.post-count {
  background: var(--color-blue);
  color: var(--gray-lighter);
  padding: 0.25em 0.7em;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: 'Cantarell', sans-serif;
}

.posts-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Archive post link wrapper - makes entire card clickable */
.archive-post-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.archive-post {
  display: block;
  padding: 1rem 1.2rem;
  border-radius: 8px;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
  background: transparent;
}

.archive-post:hover {
  background: hsla(var(--color-blue), 0.1);
  background: hsla(210, 35%, 50%, 0.12);
  border-left-color: var(--color-blue);
  transform: translateX(4px);
}

.archive-post .post-meta {
  margin-bottom: 0.3rem;
}

.archive-post .post-date {
  color: var(--muted-text);
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
}

.archive-post .post-title {
  margin: 0 0 0.4rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  font-family: 'Cantarell', sans-serif;
  color: var(--content-text);
  transition: color 0.2s;
}

.archive-post:hover .post-title {
  color: var(--color-blue);
}

.archive-post .post-preview {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted-text);
  font-family: 'Cantarell', sans-serif;
  line-height: 1.5;
  opacity: 0.85;
}

/* ============================================
   Service Dock - Sticky Bottom Bar
   ============================================ */

.service-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: var(--header-bg);
  border-top: 1px solid var(--header-border);
  padding: 0.6rem 1rem;
}

.dock-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  max-width: 900px;
  margin: 0 auto;
}

.dock-label {
  color: var(--header-text);
  font-size: 0.85rem;
  opacity: 0.7;
  margin-right: 0.5rem;
  font-family: 'Cantarell', sans-serif;
}

.dock-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.8rem;
  background: hsla(0, 0%, 50%, 0.15);
  color: var(--header-text);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: all 0.2s;
  border: 1px solid transparent;
  font-family: 'Cantarell', sans-serif;
}

.dock-item:hover {
  background: var(--color-blue);
  color: var(--gray-lighter);
  transform: translateY(-2px);
  text-decoration: none;
}

/* ============================================
   Footer - Above Service Dock
   ============================================ */

footer {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 1.5rem 1rem;
  margin-bottom: 52px; /* Height of service dock */
  border-top: 1px solid var(--header-border);
}

.footer-content {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  font-family: 'Cantarell', sans-serif;
}

.footer-links {
  margin-bottom: 1rem;
}

.footer-links a {
  color: var(--header-text);
  text-decoration: none;
  transition: color 0.2s;
}

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

.footer-info {
  font-size: 0.9rem;
  opacity: 0.8;
}

.footer-info a {
  color: var(--color-blue);
}

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

@media (max-width: 768px) {
  .taskbar {
    padding: 0 1rem;
  }

  .taskbar .logo {
    font-size: 0.85rem;
  }

  main {
    padding: 1.5rem;
    border-radius: 12px;
  }

  .main-wrapper {
    padding: 1rem 0.5rem;
    padding-bottom: calc(60px + 1rem);
  }

  h1 {
    font-size: 1.6rem;
  }

  .blogentry {
    padding: 1.2rem;
  }

  .dock-content {
    gap: 0.3rem;
  }

  .dock-item {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
  }

  .dock-label {
    display: none;
  }
}

@media (max-width: 480px) {
  .taskbar .logo {
    font-size: 0.75rem;
  }

  .prompt-cmd,
  .prompt-path {
    display: inline; /* Keep full logo visible */
  }

  main {
    padding: 1rem;
  }

  .archive-header {
    padding: 1.2rem;
  }

  .year-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .archive-post {
    flex-direction: column;
    gap: 0.3rem;
  }

  .post-date {
    min-width: auto;
  }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
  .taskbar, .service-dock, footer, .theme-controls, .menu-container {
    display: none;
  }

  .background-layer {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  main {
    box-shadow: none;
    border: none;
    max-width: none;
  }

  a {
    color: black;
    text-decoration: underline;
  }
}

/* ============================================
   Utility Classes
   ============================================ */

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Category tags (optional) */
.tag {
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-right: 0.3rem;
  font-family: 'Cantarell', sans-serif;
}

.tag-linux { background: hsla(0, 35%, 45%, 0.25); color: var(--color-red); }
.tag-personal { background: hsla(280, 35%, 45%, 0.25); color: hsl(280, 40%, 55%); }
.tag-networking { background: hsla(210, 35%, 45%, 0.25); color: var(--color-blue); }

/* ============================================
   Tag Filter System
   ============================================ */

.tag-filter {
  background: var(--box-bg);
  border-radius: 12px;
  border: var(--entry-border-width) solid var(--entry-border);
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.tag-filter-header {
  margin-bottom: 0.8rem;
}

.tag-filter-title {
  font-family: 'Cantarell', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--content-text);
}

.tag-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  padding: 0.4rem 0.9rem;
  border: 2px solid var(--entry-border);
  border-radius: 20px;
  background: transparent;
  color: var(--content-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tag-btn:hover {
  background: hsla(210, 35%, 50%, 0.15);
  border-color: var(--color-blue);
  color: var(--color-blue);
}

.tag-btn.active {
  background: var(--color-blue);
  border-color: var(--color-blue);
  color: white;
}

/* Filtered state for posts */
.blogentry.tag-hidden {
  display: none !important;
}

.post-nav-item.tag-hidden {
  display: none !important;
}

.archive-post-link.tag-hidden {
  display: none !important;
}

/* Hide year sections with no visible posts */
.archive-year.tag-hidden {
  display: none !important;
}

/* Tag display in posts (rendered from markdown) */
.blogentry p strong:first-child {
  font-family: 'Cantarell', sans-serif;
}

/* Archive post tags */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-left: auto;
}

.archive-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background: hsla(210, 35%, 50%, 0.15);
  border: 1px solid var(--entry-border);
  border-radius: 12px;
  color: var(--color-blue);
}

/* Mobile adjustments for tag filter */
@media (max-width: 768px) {
  .tag-filter {
    padding: 0.8rem 1rem;
    margin-bottom: 1.5rem;
  }
  
  .tag-filter-buttons {
    gap: 0.4rem;
  }
  
  .tag-btn {
    font-size: 0.75rem;
    padding: 0.35rem 0.7rem;
  }
}

/* ============================================
   Kiwi Blog 2 additions
   ============================================ */

/* Accessibility */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 2000;
  background: var(--color-blue);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 6px;
}

.skip-link:focus {
  top: 0.5rem;
}

:focus-visible {
  outline: 2px solid var(--color-yellow);
  outline-offset: 2px;
}

/* Long prompt paths are truncated instead of breaking the header */
.taskbar .logo {
  min-width: 0;
  flex-shrink: 1;
  margin-right: 1rem;
}

.taskbar .logo a {
  min-width: 0;
}

.prompt-path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.taskbar .menu li a.active {
  background: hsla(210, 35%, 50%, 0.25);
  color: var(--gray-lighter);
}

/* Reading progress bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 1100;
  background: linear-gradient(90deg, var(--color-red), var(--color-blue), var(--color-yellow));
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* Home */
.intro > :first-child {
  margin-top: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2.5rem 0 1rem;
}

.section-head h2 {
  margin: 0;
}

.section-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
}

.post-list {
  display: grid;
  gap: 1.2rem;
}

.post-card {
  background: var(--box-bg);
  border: var(--entry-border-width) solid var(--entry-border);
  border-radius: 12px;
  padding: 1.3rem 1.6rem;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  scroll-margin-top: 80px;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px var(--box-shadow);
  border-color: hsla(210, 35%, 55%, 0.6);
}

.post-card-title {
  margin: 0.3rem 0 0.5rem;
  font-size: 1.3rem;
}

.post-card-title a {
  color: var(--content-text);
}

.post-card-title a:hover {
  color: var(--color-blue);
  text-decoration: none;
}

.post-card-excerpt {
  margin: 0 0 0.8rem;
  color: var(--muted-text);
}

.post-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--muted-text);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  padding: 0.15rem 0.6rem;
  border-radius: 12px;
  border: 1px solid var(--entry-border);
  background: hsla(210, 35%, 50%, 0.12);
  color: var(--color-blue);
}

.tag-chip:hover {
  background: var(--color-blue);
  color: #fff;
  text-decoration: none;
}

.badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  padding: 0.05rem 0.5rem;
  border-radius: 10px;
  vertical-align: middle;
}

.badge-draft {
  background: hsla(45, 60%, 50%, 0.2);
  color: var(--color-yellow);
  border: 1px solid var(--color-yellow);
}

.empty {
  color: var(--muted-text);
  text-align: center;
  font-style: italic;
}

/* Single post */
.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.2rem;
  border-bottom: 3px solid var(--color-red);
}

.post-header .post-title {
  border: none;
  padding: 0;
  margin: 0 0 0.6rem;
  font-size: 2.1rem;
}

.post-header .post-meta {
  margin-bottom: 0.8rem;
}

.post-body > :first-child {
  margin-top: 0;
}

.post-body h2,
.post-body h3,
.page h2,
.page h3 {
  scroll-margin-top: 80px;
}

.heading-anchor {
  margin-left: 0.4em;
  opacity: 0;
  color: var(--muted-text);
  font-weight: 400;
  transition: opacity 0.2s;
}

:is(h2, h3, h4):hover > .heading-anchor,
.heading-anchor:focus {
  opacity: 1;
  text-decoration: none;
}

@media (hover: none) {
  .heading-anchor {
    display: none;
  }
}

.post-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--entry-border);
}

.post-pager a {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 1.2rem;
  border: 2px solid var(--entry-border);
  border-radius: 10px;
  color: var(--content-text);
  transition: border-color 0.2s, background 0.2s;
}

.post-pager a:hover {
  border-color: var(--color-blue);
  background: hsla(210, 35%, 50%, 0.1);
  text-decoration: none;
}

.post-pager span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--muted-text);
}

.post-pager .pager-next {
  text-align: right;
}

.toc-depth-3 {
  padding-left: 1.6rem;
  font-size: 0.8rem;
}

/* Tables scroll sideways on small screens */
.table-wrap {
  overflow-x: auto;
  margin: 1.5em 0;
}

.table-wrap table {
  margin: 0;
}

/* Code blocks: language label, copy button, syntax colours */
pre {
  position: relative;
}

pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  right: 4.2rem;
  padding: 0.15rem 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: hsl(0, 0%, 55%);
  text-transform: lowercase;
}

.copy-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid hsl(0, 0%, 30%);
  background: hsl(0, 0%, 16%);
  color: hsl(0, 0%, 75%);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

pre:hover .copy-btn,
.copy-btn:focus {
  opacity: 1;
}

.hljs-comment, .hljs-quote { color: hsl(0, 0%, 50%); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-literal { color: hsl(210, 60%, 68%); }
.hljs-string, .hljs-regexp, .hljs-addition { color: hsl(45, 65%, 62%); }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-variable, .hljs-template-variable { color: hsl(0, 55%, 68%); }
.hljs-title, .hljs-section, .hljs-function .hljs-title { color: hsl(120, 45%, 65%); font-weight: 700; }
.hljs-attr, .hljs-attribute, .hljs-name, .hljs-type, .hljs-params { color: hsl(180, 40%, 62%); }
.hljs-meta, .hljs-deletion { color: hsl(0, 45%, 60%); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* Archive search */
.search-box {
  max-width: 420px;
  margin: 1.2rem auto 0;
}

.search-box input {
  width: 100%;
  font: inherit;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
  border-radius: 20px;
  border: 2px solid var(--entry-border);
  background: hsla(0, 0%, calc(100% - (var(--dark-mode) * 90%)), 0.6);
  color: var(--content-text);
}

.search-box input:focus {
  outline: none;
  border-color: var(--color-blue);
}

.tag-count {
  opacity: 0.6;
  font-size: 0.7rem;
}

.archive-post .post-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* 404 */
.not-found {
  text-align: center;
  padding: 2rem 0;
}

.not-found .terminal {
  text-align: left;
  max-width: 520px;
  margin: 0 auto 2rem;
}

.not-found h1 {
  border: none;
}

@media (max-width: 768px) {
  .post-header .post-title {
    font-size: 1.6rem;
  }

  .post-card {
    padding: 1.1rem 1.2rem;
  }

  .post-pager {
    grid-template-columns: 1fr;
  }

  .post-pager .pager-next {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
