@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --text: #17202a;
  --text-secondary: #5d6673;
  --bg: #ffffff;
  --surface: #f6f7f8;
  --border: #d8dee4;
  --accent: #17202a;
  --accent-hover: #000000;
  --link: #1f5f99;
  --link-hover: #0b3f6f;
}

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

::selection {
  background: rgba(31, 95, 153, 0.15);
  color: var(--text);
}

::-webkit-scrollbar {
  width: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
  background: #a8b2bd;
}

body {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: rgba(104, 151, 187, 0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

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

/* Nav */
nav {
  margin-bottom: 2rem;
  font-size: 14px;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
}

nav a {
  margin-right: 1.25rem;
  color: var(--text);
  font-weight: 600;
  position: relative;
  text-decoration: none;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.2s ease;
}

nav a:hover {
  color: var(--text);
}

nav a:hover::after {
  width: 100%;
}

/* Intro */
.intro {
  margin-bottom: 1.5rem;
}

.intro-header {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}

.photo {
  width: 110px;
  height: 110px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.intro-header h1 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.intro-header p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 0.6rem 0;
}

.intro-header p:last-child {
  margin-bottom: 0;
}

.photo:hover {
  border-color: #a8b2bd;
  box-shadow: 0 4px 16px rgba(23, 32, 42, 0.08);
}

.intro-header .tagline {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
}

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* Sections */
.section {
  margin-bottom: 1.75rem;
}

.section h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.section h2 {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.section h2::before {
  content: '// ';
  opacity: 0.5;
  color: var(--text-secondary);
}

.section a {
  margin-right: 0;
  white-space: nowrap;
}

.section p {
  margin-bottom: 0.9rem;
}

.section p:last-child {
  margin-bottom: 0;
}

/* Collapsible highlight blocks */
.section details {
  margin-bottom: 0.35rem;
}

.section details summary {
  cursor: pointer;
  list-style: none;
  padding: 0.2rem 0;
  color: var(--text);
  transition: color 0.15s ease;
}

.section details summary::-webkit-details-marker {
  display: none;
}

.section details summary::before {
  content: '[+] ';
  color: var(--text-secondary);
  margin-right: 0.15rem;
}

.section details[open] summary::before {
  content: '[-] ';
  color: var(--link);
}

.section details summary:hover {
  color: var(--link-hover);
}

.section details summary:hover::before {
  color: var(--link-hover);
}

.section details > p {
  margin: 0.4rem 0 0.6rem 1.75rem;
  padding-left: 0.85rem;
  border-left: 1px solid var(--border);
  color: var(--text-secondary);
}

/* Projects (open source page) */
.project {
  margin-bottom: 0.5rem;
  font-size: 14px;
}

.project a {
  font-weight: 500;
  color: var(--link);
}

.project span {
  color: var(--text-secondary);
  margin-left: 0.25rem;
}

.project span::before {
  content: ": ";
}

/* Builds */
.craft-stream {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.craft-entry {
  position: relative;
  width: 100%;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}

.craft-entry:nth-child(4n),
.craft-entry:nth-child(4n + 1) {
  transform: translateY(0.65rem);
}

.craft-entry img,
.craft-entry video {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  transition: filter 0.16s ease, transform 0.16s ease;
}

.craft-entry:hover img,
.craft-entry:hover video {
  filter: brightness(0.72);
  transform: scale(1.01);
}

.craft-caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.65rem 0.75rem;
  color: #ffffff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.74), rgba(0, 0, 0, 0));
  opacity: 0;
  transition: opacity 0.16s ease;
  font-size: 12px;
  line-height: 1.45;
}

.craft-entry:hover .craft-caption {
  opacity: 1;
}

.craft-caption a,
.craft-caption span {
  display: block;
  color: #ffffff;
  font-weight: 500;
  text-decoration: none;
}

.craft-caption small {
  display: block;
  margin-top: 0.15rem;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 400;
}

.craft-caption a:hover {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Links section */
.links {
  font-size: 14px;
}

.links a {
  margin-right: 1rem;
}

/* Blog */
h2 {
  color: var(--text);
}

.post-list {
  list-style: none;
}

.post-list li {
  margin-bottom: 0.75rem;
  font-size: 14px;
}

.post-list time {
  color: var(--text-secondary);
  font-size: 13px;
}

/* Post */
.post header {
  margin-bottom: 1.5rem;
}

.post h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.post time {
  font-size: 13px;
  color: var(--text-secondary);
}

.post footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

/* Research */
.research-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* Post content styling */
.post h2 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.post h3 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.post h4 {
  font-size: 14px;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.post p {
  margin-bottom: 1rem;
}

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

.post li {
  margin-bottom: 0.25rem;
}

/* Images in posts */
.post img {
  max-width: 600px;
  width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem auto;
  border-radius: 4px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(23, 32, 42, 0.08);
}

/* Figure captions - italic paragraph after image */
.post img + p em,
.post p > em:only-child {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: -1rem;
  margin-bottom: 1.5rem;
}

/* Tables in posts */
.post table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 13px;
}

.post th {
  background: var(--surface);
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  color: var(--text);
}

.post td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  vertical-align: top;
}

.post tr:nth-child(even) {
  background: var(--surface);
}

/* Strong text in posts */
.post strong {
  font-weight: 600;
  color: var(--text);
}

/* Blockquotes */
.post blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  font-style: italic;
  color: var(--text-secondary);
}

.post blockquote p {
  margin: 0;
}

/* Code */
code {
  font-family: 'JetBrains Mono', "SF Mono", Menlo, monospace;
  font-size: 0.9em;
  background: var(--surface);
  padding: 0.15em 0.3em;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--text);
}

pre {
  background: var(--surface);
  padding: 0.875rem;
  overflow-x: auto;
  border-radius: 3px;
  font-size: 13px;
  border: 1px solid var(--border);
}

pre code {
  background: none;
  padding: 0;
  border: none;
  color: var(--text);
}

/* Work list (homepage) */
.work-list {
  list-style: none;
  padding: 0;
}

.work-list li {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  line-height: 1.55;
}

.work-list li strong {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  color: var(--text);
}

.work-list .lang {
  font-size: 11px;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  color: var(--text-secondary);
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
  margin: 0 2px;
}

.view-all {
  margin-top: 0.75rem;
}

.view-all a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
}

.view-all a:hover {
  color: var(--link-hover);
}

/* Fade-in animation */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  opacity: 0;
  animation: fadeUp 0.5s ease forwards;
}

/* Callouts */
.callout {
  margin: 1.25rem 0;
  padding: 0.65rem 0.9rem;
  border-left: 3px solid var(--link);
  background: rgba(104, 151, 187, 0.06);
  font-size: 13px;
  border-radius: 0 3px 3px 0;
}

.callout p { margin: 0; }
.callout p + p { margin-top: 0.5rem; }

.callout.defender {
  border-left-color: #7ee787;
  background: rgba(126, 231, 135, 0.05);
}

.callout.defender strong {
  color: #7ee787;
}

.callout.note {
  border-left-color: #ffa657;
  background: rgba(255, 166, 87, 0.05);
}

.callout.note strong {
  color: #ffa657;
}

/* Kill-chain figure */
.post .kill-chain {
  margin: 1.5rem 0 2rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.post .kill-chain img,
.post .kill-chain svg {
  max-width: 100%;
  width: 100%;
  height: auto;
  display: block;
  border: none;
  box-shadow: none;
  margin: 0;
  border-radius: 0;
}

/* Footnotes */
.post .footnotes {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.post .footnotes ol {
  padding-left: 1.25rem;
}

.post .footnotes li {
  margin-bottom: 0.35rem;
}

.post sup a,
.post a.footnote {
  font-size: 0.75em;
  text-decoration: none;
  padding: 0 0.15em;
}

/* Anchored headings */
.post h2, .post h3 {
  scroll-margin-top: 1rem;
}

/* Syntax highlighting (Rouge, light) */
.highlight, .highlight .w {
  color: #24292f;
  background-color: transparent;
}
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kv,
.highlight .kt, .highlight .kc { color: #cf222e; }
.highlight .o, .highlight .ow { color: #cf222e; }
.highlight .sa, .highlight .nd, .highlight .ni, .highlight .ne { color: #8250df; }
.highlight .s, .highlight .sb, .highlight .sc, .highlight .dl, .highlight .sd, .highlight .s2,
.highlight .se, .highlight .sh, .highlight .si, .highlight .sx, .highlight .s1, .highlight .ss,
.highlight .sr { color: #0a3069; }
.highlight .na { color: #0550ae; }
.highlight .nl { color: #0550ae; font-weight: bold; }
.highlight .no, .highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi { color: #0550ae; }
.highlight .mh, .highlight .mf, .highlight .mb, .highlight .mi, .highlight .il,
.highlight .mo, .highlight .mx, .highlight .m { color: #0550ae; }
.highlight .nt { color: #116329; }
.highlight .nb { color: #953800; }
.highlight .nc { color: #953800; font-weight: 600; }
.highlight .nn { color: #cf222e; font-weight: 600; }
.highlight .nf { color: #8250df; }
.highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cp, .highlight .cpf,
.highlight .c1, .highlight .cs { color: #6e7781; font-style: italic; }
.highlight .gr { color: #cf222e; }
.highlight .gd { color: #82071e; background-color: #ffebe9; }
.highlight .gi { color: #116329; background-color: #dafbe1; }
.highlight .gh { color: #0550ae; font-weight: bold; }
.highlight .gu { color: #0550ae; }
.highlight .gs { font-weight: bold; }
.highlight .ge { font-style: italic; }
.highlight .err { color: #ffffff; background-color: #cf222e; }
.highlight .p { color: #24292f; }

/* Mobile */
@media (max-width: 480px) {
  body {
    padding: 2rem 1rem;
  }

  .craft-stream {
    grid-template-columns: 1fr;
  }

  .craft-entry:nth-child(4n),
  .craft-entry:nth-child(4n + 1) {
    transform: none;
  }

  .craft-caption {
    position: static;
    opacity: 1;
    color: var(--text-secondary);
    background: transparent;
    font-size: 12.5px;
  }

  .craft-caption a,
  .craft-caption span {
    color: var(--text);
  }

  .craft-caption small {
    color: var(--text-secondary);
  }

  .craft-entry:hover img,
  .craft-entry:hover video {
    filter: none;
    transform: none;
  }

}
