/* ============================================================
   Censys Blog Mirror — style.css
   Aesthetic: Intelligence Brief — editorial meets security.
   Typography: Fraunces (display) · DM Sans (body) · JetBrains Mono (code)
   Themes: light · censys (dark teal) · terminal (black/green)
   Theme applied via [data-theme] on <html>; set by theme.js.
   ============================================================ */

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

/* --- Design tokens ---------------------------------------- */
:root {
  /* Brand */
  --orange:   #FFAD5B;
  --teal:     #1E3C41;
  --aqua:     #2D7E81;
  --gold:     #BCB480;
  --sage:     #B6D5D4;
  --blue:     #3BBFDE;
  --offwhite: #FBFAF6;

  /* Typography */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-sans:    'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, sans-serif;
  --font-mono:    'JetBrains Mono', 'Cascadia Mono', 'SF Mono', Consolas, monospace;

  /* Spacing */
  --space-1: 0.25rem;  --space-2: 0.5rem;   --space-3: 0.75rem;
  --space-4: 1rem;     --space-5: 1.25rem;  --space-6: 1.5rem;
  --space-8: 2rem;     --space-10: 2.5rem;  --space-12: 3rem;
  --space-16: 4rem;    --space-20: 5rem;

  /* Layout */
  --max-width:        1120px;
  --max-width-narrow: 740px;
  --header-height:    62px;

  /* Radius */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;

  /* ---- Light mode ---------------------------------------- */
  --bg:             var(--offwhite);
  --bg-subtle:      #F0EDE5;
  --bg-card:        #FFFFFF;
  --bg-code:        #F4F1EC;

  --border:         #E0DAD0;
  --border-strong:  #C4BEB3;

  --text:           #18120E;
  --text-secondary: #4A4540;
  --text-tertiary:  #9A948A;

  --link:           var(--accent);
  --link-hover:     #9A4E0A;

  /* Header: matches body */
  --header-bg:      var(--bg);
  --header-border:  var(--border);
  --header-text:    var(--text);
  --header-text-dim: var(--text-secondary);
  --header-active:  var(--accent);

  /* Accent — darker orange for legibility on white */
  --accent:         #C8700E;
  --accent-dim:     rgba(200,112,14,0.12);

  /* Tags */
  --tag-bg:         #E8F4F4;
  --tag-text:       #1E5055;
  --tag-hover-bg:   #C8700E;
  --tag-hover-text: #18120E;

  /* Sidebar title */
  --label-color:    #C8700E;

  /* Shadow */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.05);
}

/* ---- Censys theme (dark teal) ---------------------------- */
[data-theme="censys"] {
  --bg:             #0C1A1C;
  --bg-subtle:      #111F22;
  --bg-card:        #142024;
  --bg-code:        #0F1D20;

  --border:         #1E3338;
  --border-strong:  #2A454A;

  --text:           #EDE9E2;
  --text-secondary: #A09A92;
  --text-tertiary:  #526468;

  --link:           var(--orange);
  --link-hover:     #FFD4A0;

  --header-bg:      var(--bg);
  --header-border:  var(--border);
  --header-text:    var(--text);
  --header-text-dim: var(--text-secondary);
  --header-active:  var(--accent);

  --accent:         var(--orange);
  --accent-dim:     rgba(255,173,91,0.12);

  --tag-bg:         #0F2428;
  --tag-text:       var(--sage);
  --tag-hover-bg:   var(--orange);
  --tag-hover-text: #0C1A1C;

  --label-color:    var(--orange);

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.5);
}

/* ---- Newspaper theme (cream / sepia) --------------------- */
[data-theme="newspaper"] {
  --bg:             #FFFFFF;
  --bg-subtle:      #FFFFFF;
  --bg-card:        #FFFFFF;
  --bg-code:        #F2F2F2;

  --border:         #CCCCCC;
  --border-strong:  #999999;

  --text:           #111111;
  --text-secondary: #444444;
  --text-tertiary:  #888888;

  --link:           #111111;
  --link-hover:     #000000;

  --header-bg:      var(--bg);
  --header-border:  var(--border);
  --header-text:    var(--text);
  --header-text-dim: var(--text-secondary);
  --header-active:  var(--accent);

  --accent:         #111111;
  --accent-dim:     rgba(0,0,0,0.07);

  --tag-bg:         #FFFFFF;
  --tag-text:       #000000;
  --tag-hover-bg:   #111111;
  --tag-hover-text: #FFFFFF;

  --label-color:    #444444;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.1),  0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.07);

  /* Serif body for the editorial broadsheet feel */
  --font-sans: Georgia, 'Times New Roman', serif;
}

[data-theme="newspaper"] .post-body thead th { background: #111111; color: #FFFFFF; }
[data-theme="newspaper"] .post-body code { color: #333333; }
[data-theme="newspaper"] .post-author,
[data-theme="newspaper"] .byline-name a { color: #111111; }
[data-theme="newspaper"] .post-author:hover,
[data-theme="newspaper"] .byline-name a:hover { color: #555555; }
/* Keep pill/tag labels in sans-serif even though body uses Georgia */
[data-theme="newspaper"] .tag { font-family: 'DM Sans', system-ui, sans-serif; border: 1px solid #111111; }
[data-theme="newspaper"] .tag:hover { border-color: #111111; }
[data-theme="newspaper"] .tag-active { color: #FFFFFF !important; border-color: #111111; }

/* ---- Monochrome theme (dark: black / white / brand blue) - */
[data-theme="dark"] {
  --bg:             #0A0A0A;
  --bg-subtle:      #111111;
  --bg-card:        #111111;
  --bg-code:        #161616;

  --border:         #2A2A2A;
  --border-strong:  #444444;

  --text:           #FFFFFF;
  --text-secondary: #BBBBBB;
  --text-tertiary:  #777777;

  --link:           #3BBFDE;
  --link-hover:     #7DD9EE;

  --header-bg:      var(--bg);
  --header-border:  var(--border);
  --header-text:    var(--text);
  --header-text-dim: var(--text-secondary);
  --header-active:  #3BBFDE;

  --accent:         #3BBFDE;
  --accent-dim:     rgba(59,191,222,0.15);

  --tag-bg:         #3BBFDE;
  --tag-text:       #000000;
  --tag-hover-bg:   #7DD9EE;
  --tag-hover-text: #000000;

  --label-color:    #3BBFDE;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.6);
}

[data-theme="dark"] .post-body thead th { background: #3BBFDE; color: #000000; }
[data-theme="dark"] .post-body code { color: #3BBFDE; }
[data-theme="dark"] .post-author,
[data-theme="dark"] .byline-name a { color: #3BBFDE; }
[data-theme="dark"] .post-author:hover,
[data-theme="dark"] .byline-name a:hover { color: #7DD9EE; }

/* ---- Terminal theme (black / green) ---------------------- */
[data-theme="terminal"] {
  /* Override brand accent colors → terminal green */
  --orange: #00ff41;
  --aqua:   #00ff41;
  --blue:   #00ff41;
  --gold:   #00cc33;
  --sage:   #00cc33;

  --bg:             #000000;
  --bg-subtle:      #060606;
  --bg-card:        #0a0a0a;
  --bg-code:        #060606;

  --border:         #0d2b0d;
  --border-strong:  #1a4a1a;

  --text:           #00ff41;
  --text-secondary: #00cc33;
  --text-tertiary:  #006620;

  --link:           #00ff41;
  --link-hover:     #66ff88;

  --header-bg:      var(--bg);
  --header-border:  var(--border);
  --header-text:    var(--text);
  --header-text-dim: var(--text-secondary);
  --header-active:  var(--accent);

  --accent:         #00ff41;
  --accent-dim:     rgba(0,255,65,0.08);

  --tag-bg:         #001800;
  --tag-text:       #00ff41;
  --tag-hover-bg:   #00ff41;
  --tag-hover-text: #000000;

  --label-color:    #00ff41;

  --shadow-sm:  0 1px 3px rgba(0,255,65,0.12);
  --shadow-md:  0 4px 12px rgba(0,255,65,0.08);
  --shadow-lg:  0 8px 24px rgba(0,255,65,0.06);

  /* Full monospace for the authentic terminal feel */
  --font-sans: var(--font-mono);
}

/* ---- System preference fallback (no explicit theme set) -- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg:             #0C1A1C;
    --bg-subtle:      #111F22;
    --bg-card:        #142024;
    --bg-code:        #0F1D20;
    --border:         #1E3338;
    --border-strong:  #2A454A;
    --text:           #EDE9E2;
    --text-secondary: #A09A92;
    --text-tertiary:  #526468;
    --link:           var(--orange);
    --link-hover:     #FFD4A0;
    --header-bg:      #0C1A1C;
    --header-border:  #1E3338;
    --header-text:    #EDE9E2;
    --header-text-dim: #A09A92;
    --header-active:  var(--orange);
    --accent:         var(--orange);
    --accent-dim:     rgba(255,173,91,0.12);
    --tag-bg:         #0F2428;
    --tag-text:       var(--sage);
    --tag-hover-bg:   var(--orange);
    --tag-hover-text: #0C1A1C;
    --label-color:    var(--orange);
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:  0 8px 24px rgba(0,0,0,0.5);
  }
}

/* --- Base -------------------------------------------------- */
html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Subtle warm noise texture */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}

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

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

/* --- Layout ------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-narrow { max-width: var(--max-width-narrow); }

.layout-two-col {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-12);
  padding: var(--space-10) 0;
}

@media (max-width: 860px) {
  .layout-two-col {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
  .col-sidebar { order: -1; }
}

main { flex: 1; }

/* --- Header ----------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  height: var(--header-height);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--header-text);
  transition: opacity 0.2s;
}

.site-logo:hover { opacity: 0.85; text-decoration: none; color: var(--header-text); }

.logo-mark {
  /* Crop window: show only the icon portion of the logo PNG.
     The icon occupies ~24% of the image width.
     At display height 36px, full image ~144px wide → icon ~34px.  */
  width: 42px;
  height: 36px;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.logo-img {
  position: absolute;
  top: 0;
  left: 0;
  height: 36px;
  width: auto;
  max-width: none;
  display: block;
}

/* logo-img-dark = light-colored logo for dark backgrounds (default) */
/* logo-img-light = dark-colored logo for light backgrounds          */
.logo-img-light { display: none; }
.logo-img-dark  { display: block; }

/* Light-background themes: swap to dark logo */
[data-theme="light"] .logo-img-light,
[data-theme="newspaper"] .logo-img-light { display: block; }
[data-theme="light"] .logo-img-dark,
[data-theme="newspaper"] .logo-img-dark  { display: none; }

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
  gap: 1px;
}

.logo-name {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--header-text);
}

.logo-sub {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--header-text-dim);
}

/* Nav */
.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  font-size: 0.82rem;
}

.site-nav a {
  color: var(--header-text-dim);
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: var(--space-1) 0;
  position: relative;
  transition: color 0.15s;
}

.site-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--header-active);
  border-radius: 1px;
  transform: scaleX(0);
  transition: transform 0.2s ease;
  transform-origin: left;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--header-text);
  text-decoration: none;
}

.site-nav a:hover::after,
.site-nav a.active::after {
  transform: scaleX(1);
}

.rss-link {
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase;
  color: var(--header-text-dim) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-sm) !important;
  padding: 3px 10px !important;
  transition: color 0.15s, border-color 0.15s !important;
}

.rss-link::after { display: none !important; }

.rss-link:hover {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}

/* --- Theme switcher --------------------------------------- */
.theme-select {
  position: relative;
}

.theme-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--header-text-dim);
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 9px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.theme-btn:hover {
  color: var(--header-text);
  border-color: var(--accent);
}

.theme-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  list-style: none;
  background: var(--header-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 130px;
  overflow: hidden;
  z-index: 200;
}

.theme-option {
  display: block;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--header-text-dim);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.theme-option:last-child { border-bottom: none; }

.theme-option:hover,
.theme-option[aria-selected="true"] {
  background: var(--accent-dim);
  color: var(--header-text);
}

.theme-option[aria-selected="true"] { font-weight: 700; }

/* Terminal mode: extra monospace flavour on the switcher itself */
[data-theme="terminal"] .theme-btn,
[data-theme="terminal"] .theme-option { letter-spacing: 0.08em; }

/* --- List controls (search + date filter) ----------------- */
.list-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  position: relative;
}

.list-search-inner {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.list-search-inner:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.search-bar-icon {
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  padding: 0;
}

.search-input::placeholder { color: var(--text-tertiary); }
.search-input::-webkit-search-cancel-button { display: none; }

/* Date filter select */
.date-filter-select {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.date-filter-select:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.date-filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Search results dropdown */
.search-results {
  display: none;
  list-style: none;
  position: absolute;
  left: 0;
  top: calc(100% + var(--space-2));
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
}

.search-result a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3) var(--space-4);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.search-result:last-child a { border-bottom: none; }

.search-result a:hover,
.search-result a:focus {
  background: var(--accent-dim);
  outline: none;
}

.sr-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.sr-meta {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.search-empty {
  padding: var(--space-4);
  font-size: 0.82rem;
  color: var(--text-tertiary);
}

/* --- Post list -------------------------------------------- */
.post-list {
  display: flex;
  flex-direction: column;
}

.post-card {
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--border);
  transition: all 0.2s ease;
  /* Staggered fade-up on load */
  animation: fadeUp 0.4s ease both;
}

.post-card:nth-child(1)  { animation-delay: 0.05s; }
.post-card:nth-child(2)  { animation-delay: 0.1s; }
.post-card:nth-child(3)  { animation-delay: 0.15s; }
.post-card:nth-child(4)  { animation-delay: 0.2s; }
.post-card:nth-child(5)  { animation-delay: 0.25s; }
.post-card:nth-child(6)  { animation-delay: 0.3s; }
.post-card:nth-child(7)  { animation-delay: 0.35s; }
.post-card:nth-child(8)  { animation-delay: 0.4s; }
.post-card:nth-child(9)  { animation-delay: 0.45s; }
.post-card:nth-child(10) { animation-delay: 0.5s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.post-card:first-child { padding-top: 0; }
.post-card:last-child  { border-bottom: none; }

/* Featured first post */
.post-card-featured {
  padding-top: 0;
}

.post-card-featured .post-card-image-link {
  margin-bottom: var(--space-5);
}

.post-card-featured .post-card-image {
  height: 340px;
  border-radius: var(--radius-lg);
}

.post-card-featured .post-card-title {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  margin-bottom: var(--space-3);
  letter-spacing: -0.025em;
}

.post-card-featured .post-card-excerpt {
  -webkit-line-clamp: 3;
  font-size: 0.95rem;
}

/* Post image */
.post-card-image-link {
  display: block;
  margin-bottom: var(--space-4);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.post-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.post-card-image-link:hover .post-card-image {
  transform: scale(1.03);
}

/* Post meta (now below title) */
.post-meta {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-3);
}

.post-author {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s;
}

.post-author:hover {
  color: #9A4E0A;
  text-decoration: none;
}

[data-theme="censys"] .post-author,
[data-theme="terminal"] .post-author { color: var(--orange); }
[data-theme="censys"] .post-author:hover,
[data-theme="terminal"] .post-author:hover { color: #FFD4A0; }

.post-sep { color: var(--border-strong); }

/* Tags above title */
.post-tags-top {
  margin-bottom: var(--space-2);
  margin-left: -3px;
}

/* Post card title */
.post-card-title {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2);
}

.post-card-title a {
  color: var(--text);
  text-decoration: none;
  background-image: linear-gradient(var(--orange), var(--orange));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 2px;
  transition: background-size 0.3s ease, color 0.15s;
  padding-bottom: 1px;
}

.post-card-title a:hover {
  color: var(--text);
  background-size: 100% 2px;
  text-decoration: none;
}

.post-card-excerpt {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-3);
}

/* --- Post card body layout (excerpt 70% + thumbnail 30%) --- */
.post-card-body {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  margin-top: var(--space-2);
}

.post-card-content {
  flex: 7;
  min-width: 0;
}

.post-card-thumb-link {
  flex: 3;
  max-width: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: block;
  flex-shrink: 0;
}

.post-card-thumb {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.post-card-thumb-link:hover .post-card-thumb {
  transform: scale(1.04);
}

/* --- Tags -------------------------------------------------- */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}

.tag:hover {
  background: var(--tag-hover-bg);
  color: var(--tag-hover-text);
  text-decoration: none;
  transform: translateY(-1px);
}

.tag-active {
  background: var(--accent) !important;
  color: #18120E !important;
}

/* --- Pagination ------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-8) 0;
  border-top: 1px solid var(--border);
  margin-top: var(--space-4);
}

.pag-link {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-5);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}

.pag-link:not(.pag-disabled):hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

[data-theme="censys"] .pag-link,
[data-theme="terminal"] .pag-link { color: var(--text-secondary); }

.pag-disabled {
  color: var(--text-tertiary);
  border-color: var(--border);
  cursor: default;
  opacity: 0.5;
}

.pag-info {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* --- Sidebar ---------------------------------------------- */
.sidebar-section {
  position: sticky;
  top: calc(var(--header-height) + var(--space-8));
}

.sidebar-title {
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label-color);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sidebar-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-cloud-item {
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.tag-count {
  font-size: 0.6rem;
  opacity: 0.55;
  margin-left: 2px;
  font-variant-numeric: tabular-nums;
}

/* --- Archive header --------------------------------------- */
.archive-header {
  padding: var(--space-8) 0 var(--space-5);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-2);
}

.archive-label {
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label-color);
  margin-bottom: var(--space-2);
}

.archive-title {
  font-family: var(--font-sans);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: var(--space-2);
  line-height: 1.1;
}

.archive-count {
  font-size: 0.82rem;
  color: var(--text-tertiary);
}

/* --- Individual post -------------------------------------- */
.post-single {
  padding: var(--space-10) 0 var(--space-16);
  animation: fadeUp 0.4s ease both;
}

.post-breadcrumb {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.post-breadcrumb a {
  color: var(--text-secondary);
  transition: color 0.15s;
}
.post-breadcrumb a:hover { color: var(--accent); }

.post-title {
  font-family: var(--font-sans);
  font-size: clamp(1.9rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
  color: var(--text);
  margin-bottom: var(--space-4);
}

.post-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-6);
  font-weight: 400;
}

/* Byline */
.post-byline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.byline-author {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.byline-name {
  font-weight: 700;
  font-size: 0.88rem;
}

.byline-name a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}
.byline-name a:hover { color: #9A4E0A; }

[data-theme="censys"] .byline-name a,
[data-theme="terminal"] .byline-name a { color: var(--orange); }
[data-theme="censys"] .byline-name a:hover,
[data-theme="terminal"] .byline-name a:hover { color: #FFD4A0; }

.byline-role {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.byline-meta {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  text-align: right;
  line-height: 1.6;
}

/* Hero image */
.post-hero {
  margin-bottom: var(--space-10);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.post-hero img {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
}

/* --- Post body typography --------------------------------- */
.post-body {
  font-size: 1.025rem;
  line-height: 1.82;
  color: var(--text);
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4,
.post-body h5,
.post-body h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-top: var(--space-10);
  margin-bottom: var(--space-3);
  color: var(--text);
}

.post-body h2 {
  font-size: 1.55rem;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
  position: relative;
}

/* Orange underline accent on h2 */
.post-body h2::before {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 2.5rem;
  height: 2px;
  background: var(--orange);
  border-radius: 1px;
}

.post-body h3 { font-size: 1.25rem; }
.post-body h4 { font-size: 1.08rem; }

.post-body p { margin-bottom: var(--space-4); }

.post-body a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s;
}

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

.post-body ul,
.post-body ol {
  margin: var(--space-4) 0;
  padding-left: var(--space-6);
}

.post-body li { margin-bottom: var(--space-2); }

.post-body blockquote {
  border-left: 3px solid var(--gold);
  padding: var(--space-3) var(--space-6);
  margin: var(--space-6) 0;
  color: var(--text-secondary);
  font-style: italic;
  background: var(--bg-subtle);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  background: var(--bg-code);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  color: var(--aqua);
  border: 1px solid var(--border);
}

[data-theme="censys"] .post-body code { color: var(--blue); }
[data-theme="terminal"] .post-body code { color: #FFB3D9; }

.post-body pre {
  background: var(--bg-code);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: var(--space-6) 0;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.post-body pre code {
  background: none;
  padding: 0;
  border: none;
  font-size: 0.84rem;
  line-height: 1.7;
  color: var(--text);
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-6) 0;
  font-size: 0.88rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
}

.post-body th,
.post-body td {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.post-body thead th {
  background: var(--teal);
  color: var(--offwhite);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: none;
}

[data-theme="censys"] .post-body thead th { background: #0F2428; color: var(--sage); }
[data-theme="terminal"] .post-body thead th { background: #001800; color: var(--text); }

.post-body tbody tr:nth-child(even) { background: var(--bg-subtle); }
.post-body tbody tr:last-child td  { border-bottom: none; }

.post-body img {
  border-radius: var(--radius-md);
  margin: var(--space-6) auto;
  box-shadow: var(--shadow-md);
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-10) 0;
}

/* --- Post footer ------------------------------------------ */
.post-footer {
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}

.post-tags-footer {
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* --- Author card ------------------------------------------- */
.author-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-6);
  margin-top: var(--space-8);
  padding: var(--space-5) var(--space-6);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.author-card-info {
  flex-shrink: 0;
  min-width: 140px;
}

.author-card-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.author-card-name a {
  color: var(--text);
  text-decoration: none;
}

.author-card-name a:hover {
  color: var(--accent);
}

.author-card-role {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.author-card-bio {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
  align-self: center;
}

@media (max-width: 540px) {
  .author-card { flex-direction: column; gap: var(--space-3); }
  .author-card-info { min-width: unset; }
}

/* Tags label (unchanged) */
.tags-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--label-color);
}

.post-source {
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

.post-source a {
  color: var(--text-secondary);
}

/* --- Footer ----------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-8) 0;
  margin-top: auto;
}

.site-footer p {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  text-align: center;
  letter-spacing: 0.01em;
}

.site-footer a {
  color: var(--text-secondary);
  transition: color 0.15s;
}

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

/* --- Responsive ------------------------------------------- */
@media (max-width: 600px) {
  html { font-size: 16px; }

  .site-nav { gap: var(--space-4); font-size: 0.8rem; }
  .logo-text { display: none; }

  .post-byline { flex-direction: column; gap: var(--space-2); }
  .byline-meta { text-align: left; }

  .container { padding: 0 var(--space-4); }

  .post-card-featured .post-card-image { height: 220px; }
  .post-card-featured .post-card-title { font-size: 1.4rem; }

  .post-body h2 { font-size: 1.3rem; }
  .post-body h3 { font-size: 1.1rem; }

  .layout-two-col { padding: var(--space-6) 0; }
}

/* --- Lightbox --------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lbFadeIn 0.2s ease both;
}

.lightbox[hidden] { display: none; }

@keyframes lbFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.lightbox-frame {
  position: relative;
  z-index: 1;
  max-width: 92vw;
  max-height: 92vh;
  animation: lbScaleIn 0.2s ease both;
}

@keyframes lbScaleIn {
  from { transform: scale(0.94); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.lightbox-img {
  display: block;
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  cursor: default;
  background: #fff;
}

.lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: background 0.15s, color 0.15s;
}

.lightbox-close:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

/* --- Fun stuff: comic sans --------------------------------- */
.fun-comic-sans,
.fun-comic-sans * {
  font-family: 'Comic Sans MS', 'Comic Sans', cursive !important;
}

/* --- Fun stuff: custom cursors ----------------------------- */
.fun-cursor-pink,
.fun-cursor-pink * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='48' viewBox='0 0 20 24'%3E%3Cpolygon points='0,0 0,18 4,13 9,22 12,21 7,13 14,13' fill='%23FF69B4' stroke='%23000' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E") 0 0, auto !important;
}

.fun-cursor-magnifier,
.fun-cursor-magnifier * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 28 28'%3E%3Ccircle cx='11' cy='11' r='9' fill='white' stroke='black' stroke-width='2.5'/%3E%3Ccircle cx='7.5' cy='7.5' r='2.5' fill='white' opacity='0.65'/%3E%3Cline x1='17.5' y1='17.5' x2='26' y2='26' stroke='black' stroke-width='3.5' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, zoom-in !important;
}

/* --- Fun stuff: sparkle trail ------------------------------ */
@keyframes sparkle-trail {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--sdx, 0px)), calc(-50% + var(--sdy, -20px))) scale(0.1); }
}

/* --- Fun stuff: dropdown ----------------------------------- */
.fun-option {
  display: block;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--header-text-dim);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  padding: var(--space-3) var(--space-4) var(--space-3) 2.2rem;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  position: relative;
}

.fun-option:last-child { border-bottom: none; }

.fun-option:hover {
  background: var(--accent-dim);
  color: var(--header-text);
}

.fun-option.active {
  color: var(--header-text);
  font-weight: 600;
}

.fun-option.active::before {
  content: '✓';
  position: absolute;
  left: 0.75rem;
  color: var(--accent);
  font-weight: 700;
}

/* --- Reduced motion ---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .post-card { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
