/* ==========================================================================
   valmis.net - Cybersecurity & UNIX Geek Stylesheet
   Pure Vanilla CSS, Zero External Network Requests, < 15KB
   Theme: High-Contrast Dark Terminal / OpenBSD Sobriety
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-main: #0f141c;
  --bg-card: #151b24;
  --bg-card-hover: #1c2430;
  --bg-code: #0b0e14;
  --bg-badge: #1a222e;
  --border-color: #222b38;
  --border-muted: #1a222d;
  --border-highlight: #00ff66;
  
  /* Text & Foreground */
  --text-main: #e0e0e0;
  --text-bright: #f0f6fc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  /* Hacker Terminal Accents */
  --accent-green: #00ff66;
  --accent-green-dim: rgba(0, 255, 102, 0.15);
  --accent-amber: #ffb454;
  --accent-amber-dim: rgba(255, 180, 84, 0.15);
  --accent-cyan: #59c2ff;
  --accent-blue: #79c0ff;
  --accent-red: #ff5370;
  
  /* Typography Stacks */
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  
  /* Layout Dimensions */
  --max-width: 860px;
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
}

/* ==========================================================================
   Base Reset & Global Typography
   ========================================================================== */

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

html {
  font-size: 15px;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.68;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 2rem 1.25rem;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ==========================================================================
   Headings & Monospace Elements
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-mono);
  color: var(--text-bright);
  font-weight: 600;
  line-height: 1.35;
  margin-top: 2rem;
  margin-bottom: 0.85rem;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.85rem;
  color: var(--text-bright);
}

h2 {
  font-size: 1.35rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.45rem;
  color: var(--accent-cyan);
}

h3 {
  font-size: 1.15rem;
  color: var(--accent-green);
}

h4 {
  font-size: 1.02rem;
  color: var(--accent-amber);
}

p {
  margin-bottom: 1.2rem;
  color: var(--text-main);
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
  border-bottom: 1px dotted rgba(89, 194, 255, 0.4);
}

a:hover, a:focus-visible {
  color: var(--accent-green);
  border-bottom: 1px solid var(--accent-green);
  outline: none;
}

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

em, i {
  font-style: italic;
  color: var(--text-muted);
}

ul, ol {
  margin-left: 1.65rem;
  margin-bottom: 1.35rem;
}

li {
  margin-bottom: 0.45rem;
}

li::marker {
  color: var(--accent-green);
}

hr {
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: 2.25rem 0;
}

/* ==========================================================================
   Header & Interactive Terminal Navigation
   ========================================================================== */

.site-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.15rem;
  margin-bottom: 2.25rem;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.terminal-prompt {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.08rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  user-select: none;
}

.prompt-user { color: var(--accent-green); }
.prompt-sep  { color: var(--text-dim); }
.prompt-host { color: var(--accent-cyan); }
.prompt-path { color: var(--accent-amber); }
.prompt-char { color: var(--text-bright); }

.prompt-cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background-color: var(--accent-green);
  margin-left: 2px;
  animation: terminal-blink 1.2s infinite;
}

@keyframes terminal-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.lang-switch {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
}

.lang-switch a {
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: none;
}

.lang-switch a.active {
  color: var(--accent-green);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.92rem;
}

.site-nav a {
  color: var(--text-muted);
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.site-nav a:hover {
  color: var(--text-bright);
  border-bottom: 2px solid var(--accent-green);
}

.site-nav a.active {
  color: var(--text-bright);
  border-bottom: 2px solid var(--accent-green);
  font-weight: 600;
}

.site-nav a.active::before {
  content: "> ";
  color: var(--accent-green);
}

/* ==========================================================================
   Hero & Profile Section (UNIX / Cyber Style)
   ========================================================================== */

.hero-profile {
  display: flex;
  gap: 1.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-green);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  margin-bottom: 2.25rem;
  align-items: flex-start;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  position: relative;
}

.hero-avatar {
  flex-shrink: 0;
}

.hero-avatar img {
  width: 135px;
  height: 135px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-code);
  display: block;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  cursor: zoom-in;
}

.hero-avatar img:hover {
  border-color: var(--accent-green);
  box-shadow: 0 0 14px rgba(0, 255, 102, 0.3);
  transform: scale(1.02);
}

.hero-content {
  flex: 1;
  min-width: 0;
}

.hero-title {
  margin-top: 0;
  margin-bottom: 0.25rem;
  font-size: 1.75rem;
  color: var(--text-bright);
  font-family: var(--font-mono);
}

.hero-badges-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  margin-bottom: 0.95rem;
}

.hero-badge {
  font-family: var(--font-mono);
  display: inline-block;
  font-size: 0.82rem;
  color: var(--accent-cyan);
  background: var(--bg-badge);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-muted);
  word-break: break-word;
}

.hero-bio {
  color: var(--text-main);
  font-size: 0.96rem;
  margin-bottom: 0.95rem;
  line-height: 1.6;
}

.hero-specialties {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.hero-specialties strong {
  color: var(--text-bright);
  font-family: var(--font-mono);
}

.specialties-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.specialty-pill {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--accent-green);
  background: var(--bg-code);
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-xs);
}

.hero-philosophy {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-code);
  border-left: 3px solid var(--accent-amber);
  color: var(--accent-amber);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.5;
}

/* ==========================================================================
   Pure CSS Lightbox Modal (Zero JavaScript, 100% CSP Compliant)
   ========================================================================== */

.lightbox-wrapper {
  display: inline-block;
  max-width: 100%;
}

.lightbox-trigger {
  cursor: zoom-in;
  display: inline-block;
  border-bottom: none !important;
}

.lightbox-modal {
  display: none !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(8, 12, 18, 0.95) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999999 !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 2rem !important;
  box-sizing: border-box !important;
}

.lightbox-modal:target {
  display: flex !important;
}

.lightbox-backdrop {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  cursor: zoom-out !important;
  border-bottom: none !important;
  z-index: 1000000 !important;
  background: transparent !important;
}

.lightbox-figure {
  position: relative !important;
  max-width: 90vw !important;
  max-height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  z-index: 1000001 !important;
  pointer-events: none !important;
}

.lightbox-figure img {
  max-width: 88vw !important;
  max-height: 80vh !important;
  object-fit: contain !important;
  border: 2px solid var(--accent-green) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 0 40px rgba(0, 255, 102, 0.3), 0 20px 60px rgba(0, 0, 0, 0.9) !important;
  background: var(--bg-code) !important;
  pointer-events: auto !important;
}

.lightbox-caption {
  margin-top: 0.95rem !important;
  font-family: var(--font-mono) !important;
  font-size: 0.9rem !important;
  color: var(--accent-cyan) !important;
  text-align: center !important;
  pointer-events: auto !important;
  background: var(--bg-card);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.lightbox-close {
  position: absolute !important;
  top: 1.5rem !important;
  right: 2rem !important;
  font-family: var(--font-mono) !important;
  font-size: 2rem !important;
  line-height: 1 !important;
  color: var(--text-bright) !important;
  border: 1px solid var(--border-color) !important;
  background: var(--bg-card) !important;
  padding: 0.35rem 0.85rem !important;
  border-radius: var(--radius-sm) !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
  z-index: 1000002 !important;
  cursor: pointer !important;
}

.lightbox-close:hover {
  color: var(--accent-green) !important;
  border-color: var(--accent-green) !important;
  box-shadow: 0 0 14px rgba(0, 255, 102, 0.4) !important;
}

/* ==========================================================================
   Cryptographic Identity & Security Box
   ========================================================================== */

.crypto-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  margin-bottom: 2.25rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.crypto-header {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--accent-green);
  margin-bottom: 0.95rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-muted);
  padding-bottom: 0.4rem;
}

.crypto-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.86rem;
  margin-bottom: 0.75rem;
}

.crypto-row:last-child {
  margin-bottom: 0;
}

.crypto-label {
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.crypto-val {
  font-family: var(--font-mono);
  color: var(--text-bright);
  background: var(--bg-code);
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  word-break: break-all;
  font-size: 0.83rem;
}

/* ==========================================================================
   Section Headers & Posts List
   ========================================================================== */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 2.25rem;
  margin-bottom: 1.15rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.section-header h2 {
  border-bottom: none;
  padding-bottom: 0;
  margin: 0;
}

.section-header a {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--accent-green);
  border-bottom: none;
}

.section-header a:hover {
  text-decoration: underline;
}

.post-list {
  list-style: none;
  margin-left: 0;
}

.post-item {
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--border-muted);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: background-color 0.15s ease;
}

.post-item:last-child {
  border-bottom: none;
}

.post-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.post-title-link {
  font-family: var(--font-mono);
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--text-bright);
  border-bottom: 1px solid transparent;
  line-height: 1.4;
}

.post-title-link:hover {
  color: var(--accent-green);
  border-bottom: 1px solid var(--accent-green);
}

.post-desc {
  color: var(--text-muted);
  font-size: 0.94rem;
  margin-bottom: 0.35rem;
  line-height: 1.55;
}

.tags-row {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
}

.tag:hover {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* ==========================================================================
   Article / Post View (Technical Writing Polish)
   ========================================================================== */

.article-container {
  margin-top: 0.5rem;
}

.article-header {
  margin-bottom: 2.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.35rem;
}

.article-back-link {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--accent-green);
  border-bottom: none;
  display: inline-block;
  margin-bottom: 0.75rem;
}

.article-back-link:hover {
  text-decoration: underline;
}

.article-title {
  font-size: 2.1rem;
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
  color: var(--text-bright);
  font-family: var(--font-mono);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.article-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.article-content {
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--text-main);
}

.article-content p {
  margin-bottom: 1.35rem;
}

.article-footer {
  margin-top: 3.5rem;
  padding-top: 1.65rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

/* ==========================================================================
   Code Blocks, Terminal Snippets & Pre
   ========================================================================== */

pre {
  background: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 1.5rem 0;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.4);
  position: relative;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-badge);
  color: var(--accent-green);
  padding: 0.15em 0.45em;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-muted);
}

pre code {
  background: transparent;
  padding: 0;
  border: none;
  color: var(--text-main);
  font-size: 0.9em;
}

/* ==========================================================================
   Security Blockquotes & Callouts
   ========================================================================== */

blockquote {
  border-left: 3px solid var(--accent-green);
  background: var(--bg-card);
  padding: 1rem 1.35rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-muted);
  font-style: normal;
  border-top: 1px solid var(--border-muted);
  border-right: 1px solid var(--border-muted);
  border-bottom: 1px solid var(--border-muted);
}

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

blockquote code {
  color: var(--accent-amber);
}

/* ==========================================================================
   Tables & Data Presentation
   ========================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75rem 0;
  font-size: 0.9rem;
  font-family: var(--font-mono);
}

th, td {
  padding: 0.75rem 0.95rem;
  text-align: left;
  border: 1px solid var(--border-color);
}

th {
  background: var(--bg-card);
  color: var(--accent-green);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tr:nth-child(even) {
  background: rgba(21, 27, 36, 0.4);
}

tr:hover {
  background: rgba(28, 36, 48, 0.6);
}

/* ==========================================================================
   Diagrams, Images & Figures
   ========================================================================== */

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

.article-content img {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin: 1.25rem 0 0.5rem 0;
  background: var(--bg-code);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  cursor: zoom-in;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.article-content img:hover {
  border-color: var(--accent-green);
  box-shadow: 0 0 14px rgba(0, 255, 102, 0.25);
}

/* ==========================================================================
   Curated Links Cards
   ========================================================================== */

.link-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.15rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.link-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.link-title {
  font-size: 1.15rem;
  margin-top: 0;
  margin-bottom: 0.4rem;
  font-family: var(--font-mono);
}

.link-title a {
  color: var(--text-bright);
  border-bottom: 1px solid transparent;
}

.link-title a:hover {
  color: var(--accent-cyan);
  border-bottom: 1px solid var(--accent-cyan);
}

.link-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}

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

.site-footer {
  margin-top: auto;
  padding-top: 2.25rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

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

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

.footer-badge {
  color: var(--accent-green);
}

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

@media (max-width: 680px) {
  body {
    padding: 1.25rem 0.85rem;
  }

  .hero-profile {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.35rem 1rem;
  }

  .hero-avatar img {
    width: 115px;
    height: 115px;
  }

  .hero-title {
    font-size: 1.45rem;
  }

  .hero-badges-container {
    align-items: center;
  }

  .specialties-grid {
    justify-content: center;
  }

  .hero-philosophy {
    text-align: left;
  }

  .article-title {
    font-size: 1.55rem;
  }

  .site-nav {
    gap: 0.65rem 0.95rem;
  }

  .footer-grid {
    flex-direction: column;
    text-align: center;
    gap: 0.65rem;
  }

  .lightbox-close {
    top: 0.75rem;
    right: 1rem;
    font-size: 1.5rem;
    padding: 0.2rem 0.5rem;
  }
}
