/* Cypherpunk School 101 - Custom Styles */
/* Pure CSS - No JavaScript - Secure */

/* ========================================
   SIMPLE STICKY TOC (IN-FLOW)
   ======================================== */

/* Desktop: Make ToC sticky */
@media screen and (min-width: 768px) {
  .toc {
    position: -webkit-sticky;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    margin-bottom: 2rem;
    z-index: 100;
  }

  /* Scrollbar (Webkit) */
  .toc::-webkit-scrollbar {
    width: 6px;
  }

  .toc::-webkit-scrollbar-track {
    background: var(--theme);
  }

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

/* Mobile: Collapsible */
@media screen and (max-width: 767px) {
  .toc {
    margin-bottom: 2rem;
  }

  .toc details:not([open]) summary::after {
    content: " (tap to expand)";
    font-size: 0.85em;
    color: var(--secondary);
  }
}

/* ========================================
   TOC STYLING
   ======================================== */

.toc details {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.toc summary {
  cursor: pointer;
  font-weight: 600;
  user-select: none;
  margin-bottom: 0.5rem;
}

.toc ul {
  margin: 0.5rem 0 0 0;
  padding-left: 1.2rem;
  list-style: none;
}

.toc li {
  margin: 0.4rem 0;
  line-height: 1.6;
}

.toc a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-block;
  font-size: 0.95em;
}

.toc a:hover {
  color: #88c0d0;
  padding-left: 0.25rem;
  font-weight: 500;
}

/* Nested lists */
.toc ul ul {
  padding-left: 1rem;
  border-left: 2px solid var(--border);
  margin-left: 0.5rem;
}

.toc ul ul a {
  font-size: 0.9em;
  color: var(--secondary);
}

/* ========================================
   BETTER READABILITY
   ======================================== */

.post-content h2 {
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  padding-top: 1rem;
  border-top: 2px solid var(--border);
}

.post-content h2:first-child {
  border-top: none;
  margin-top: 0;
}

.post-content h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

/* ========================================
   CODE BLOCKS - TERMINAL STYLE
   ======================================== */

/* Code blocks - clean terminal look */
.post-content pre,
.highlight pre {
  background: #0d1117 !important;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  font-size: 0.9em;
  line-height: 1.5;
  position: relative;
}

/* Remove any colored left border */
.post-content pre,
.highlight pre,
.highlight {
  border-left: none !important;
}

.post-content pre code,
.highlight pre code {
  background: transparent !important;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  color: #c9d1d9;
}

/* Syntax highlighting - muted terminal colors */
.highlight .c, .highlight .c1, .highlight .cm { color: #8b949e; } /* comments */
.highlight .k, .highlight .kd, .highlight .kn { color: #ff7b72; } /* keywords */
.highlight .s, .highlight .s1, .highlight .s2 { color: #a5d6ff; } /* strings */
.highlight .nf, .highlight .nb { color: #d2a8ff; } /* functions */
.highlight .nv, .highlight .vi { color: #ffa657; } /* variables */
.highlight .mi, .highlight .mf { color: #79c0ff; } /* numbers */

/* Inline code - subtle highlight */
.post-content code:not(pre code) {
  background: #21262d;
  color: #c9d1d9;
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.88em;
}

/* Copy code button - ensure it shows */
.copy-code {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #30363d;
  color: #8b949e;
  border: 1px solid #484f58;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.highlight:hover .copy-code,
pre:hover .copy-code {
  opacity: 1;
}

.copy-code:hover {
  background: #484f58;
  color: #c9d1d9;
}

/* ========================================
   BLOCKQUOTES
   ======================================== */

.post-content blockquote {
  border-left: 3px solid #58a6ff;
  background: rgba(56, 139, 253, 0.1);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 6px 6px 0;
  font-style: italic;
}

.post-content blockquote p {
  margin: 0;
}

/* ========================================
   LINKS - MORE VISIBLE
   ======================================== */

/* Content links - cyan/teal color to stand out */
.post-content a {
  color: #58a6ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-content a:hover {
  color: #79c0ff;
}

/* General page links */
.page-content a,
article a:not(.post-entry a) {
  color: #58a6ff;
}

/* ========================================
   FOOTER - CLEAN STYLE
   ======================================== */

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

.footer a:hover {
  color: #58a6ff;
}

/* ========================================
   POST ENTRY CARDS (LIST VIEW)
   ======================================== */

/* Ensure all post entries have consistent card styling */
.post-entry {
  background: var(--entry);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.post-entry:first-child {
  background: var(--entry);
  border: 1px solid var(--border);
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

html {
  scroll-behavior: smooth;
}

/* Only show focus outlines for keyboard navigation, not mouse clicks */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Remove focus outline on mouse click */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
summary:focus:not(:focus-visible) {
  outline: none;
}
