/* Portbuster Security Research
   Black and white. System fonts only. No external assets. */

:root {
  color-scheme: light;
  --paper: #ffffff;
  --ink: #111111;
  --body: #222222;
  --muted: #5c5c5c;
  --faint: #858585;
  --line: #d8d8d8;
  --line-strong: #111111;
  --wash: #f6f6f6;
  --wash-2: #fafafa;
  --code: #f4f4f4;
  --measure: 44rem;
  --wide: 68rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 18px;
  line-height: 1.67;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

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

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--paper);
  color: var(--ink);
  padding: 0.75rem 1rem;
  border: 2px solid var(--ink);
  z-index: 100;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
}

.wrap {
  width: min(100% - 2.5rem, var(--wide));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
}

@supports (backdrop-filter: blur(8px)) {
  .site-header {
    backdrop-filter: blur(8px);
  }
}

.header-inner {
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

.brand-text strong {
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-text span {
  margin-top: 0.28rem;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.86rem;
  letter-spacing: 0.01em;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

main {
  display: block;
}

.home-intro {
  padding: 5.5rem 0 3.5rem;
  border-bottom: 1px solid var(--line);
}

.kicker {
  margin: 0 0 1rem;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-intro h1 {
  margin: 0;
  max-width: 15ch;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.lede {
  max-width: 38rem;
  margin: 1.6rem 0 0;
  font-size: 1.22rem;
  line-height: 1.55;
  color: var(--body);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.6rem 0 0.4rem;
  border-bottom: 1px solid var(--line-strong);
}

.section-head h2,
.tooling h2 {
  margin: 0 0 0.7rem;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
}

.section-head span {
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--faint);
}

.post-list {
  display: block;
}

.post-item {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 2rem;
  padding: 2.1rem 0 2.3rem;
  border-bottom: 1px solid var(--line);
}

.post-date {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
}

.post-date time {
  color: var(--ink);
  font-weight: 600;
}

.tag {
  display: inline-block;
  width: fit-content;
  padding: 0.18rem 0.42rem;
  border: 1px solid var(--line);
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.post-item h2 {
  margin: 0 0 0.55rem;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.post-item h2 a {
  text-decoration: none;
}

.post-item h2 a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.post-item p {
  max-width: 42rem;
  margin: 0;
  color: var(--body);
}

.post-item .read {
  margin-top: 0.8rem;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.tooling {
  padding: 3rem 0 1rem;
  max-width: 46rem;
}

.tooling p {
  margin: 0;
  color: var(--body);
}

.site-footer {
  margin-top: 5rem;
  border-top: 1px solid var(--line);
  padding: 2rem 0 3rem;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.footer-inner p {
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 1.1rem;
}

.footer-links a {
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.footer-links a:hover {
  border-bottom-color: var(--ink);
}

/* Article */

.article {
  width: min(100% - 2.5rem, var(--measure));
  max-width: var(--measure);
  margin: 0 auto;
  padding: 4.5rem 0 0;
}

.post-header {
  max-width: 52rem;
  margin: 0 auto 2.5rem;
  padding: 0 0 2rem;
  border-bottom: 1px solid var(--line-strong);
}

.post-header h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.dek {
  max-width: 48rem;
  margin: 1.3rem 0 0;
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--muted);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.1rem;
  margin-top: 1.6rem;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.post-meta > * + *::before {
  content: "/";
  margin-right: 1.1rem;
  color: var(--faint);
}

.article h2 {
  margin: 3.4rem 0 1rem;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 1.5rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.article h3 {
  margin: 2.2rem 0 0.7rem;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--ink);
}

.article p {
  margin: 0 0 1.15rem;
}

.article ul,
.article ol {
  margin: 0 0 1.4rem;
  padding-left: 1.4rem;
}

.article li {
  margin: 0.35rem 0;
}

.article li > ul,
.article li > ol {
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

.article strong {
  color: var(--ink);
  font-weight: 700;
}

.article em {
  font-style: italic;
}

.lead {
  font-size: 1.12rem;
  line-height: 1.6;
}

.article code {
  padding: 0.08em 0.28em;
  background: var(--code);
  border: 1px solid #e5e5e5;
  border-radius: 2px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.82em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.article pre {
  margin: 0;
  padding: 1.05rem 1.15rem;
  overflow-x: auto;
  background: var(--code);
  border: 1px solid var(--line);
  line-height: 1.5;
  tab-size: 4;
  -webkit-overflow-scrolling: touch;
}

.article pre code {
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  font-size: 0.76rem;
  line-height: inherit;
  color: var(--ink);
  overflow-wrap: normal;
  white-space: pre;
}

.article figure {
  margin: 2rem 0;
}

.article figure.code {
  margin: 2rem 0 2.2rem;
}

.article figure.code figcaption {
  margin-bottom: 0.55rem;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.article figcaption {
  margin-top: 0.7rem;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}

.article figure.shot {
  width: min(calc(100vw - 2.5rem), 60rem);
  max-width: none;
  margin: 2.4rem 0 2.6rem 50%;
  padding: 0.6rem;
  border: 1px solid var(--line);
  background: var(--paper);
  transform: translateX(-50%);
}

.article figure.shot a {
  display: block;
}

.article figure.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: #111111;
}

.article figure.shot figcaption {
  margin-top: 0.7rem;
}

.figure {
  margin: 2.2rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--paper);
}

.figure svg {
  display: block;
  width: 100%;
  height: auto;
}

.article figure.diagram {
  width: max-content;
  max-width: min(calc(100vw - 2.5rem), 60rem);
  margin: 2.4rem 0 2.6rem 50%;
  padding: 0.8rem;
  border: 1px solid var(--line);
  background: var(--paper);
  transform: translateX(-50%);
}

.article figure.diagram-wide {
  max-width: min(calc(100vw - 2.5rem), 68rem);
}

.article figure.diagram a {
  display: block;
  text-decoration: none;
  cursor: zoom-in;
}

.article figure.diagram img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  background: #ffffff;
}

.article figure.diagram figcaption {
  max-width: 46rem;
  margin: 0.7rem auto 0;
}

.table-wrap {
  margin: 1.6rem 0 2.2rem;
  overflow-x: auto;
  border-top: 1.5px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}

.article table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--body);
}

.article th {
  padding: 0.65rem 0.7rem;
  text-align: left;
  vertical-align: bottom;
  border-bottom: 1px solid var(--line-strong);
  font-weight: 650;
  color: var(--ink);
  white-space: nowrap;
}

.article td {
  padding: 0.65rem 0.7rem;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.article tr:last-child td {
  border-bottom: 0;
}

.article td code,
.article th code {
  font-size: 0.78em;
}

.hash {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.68rem !important;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.callout {
  margin: 2.2rem 0;
  padding: 1.2rem 1.35rem;
  border: 1px solid var(--line-strong);
  background: var(--wash-2);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--body);
}

.callout strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.69rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

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

.toc {
  margin: 0 0 3rem;
  padding: 1.2rem 1.4rem;
  border: 1px solid var(--line);
  background: var(--wash);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  line-height: 1.55;
}

.toc h2 {
  margin: 0 0 0.8rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ol {
  margin: 0;
  padding-left: 1.2rem;
  columns: 2;
  column-gap: 2rem;
}

.toc li {
  margin: 0.18rem 0;
  break-inside: avoid;
}

.toc a {
  text-decoration: none;
  color: var(--body);
}

.toc a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.post-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-strong);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.88rem;
  color: var(--muted);
}

.post-footer p {
  margin: 0 0 0.75rem;
}

.refs {
  padding-left: 1.2rem;
  font-size: 0.92rem;
}

.refs li {
  margin: 0.55rem 0;
}

.simple-page {
  width: min(100% - 2.5rem, var(--measure));
  max-width: var(--measure);
  margin: 0 auto;
  padding: 4.5rem 0 0;
}

.simple-page h1 {
  margin: 0 0 1.5rem;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.simple-page h2 {
  margin: 2.6rem 0 0.8rem;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 1.1rem;
  font-weight: 650;
  color: var(--ink);
}

.simple-page p {
  margin: 0 0 1.1rem;
}

.simple-page a {
  overflow-wrap: anywhere;
}

.simple-page ul {
  margin: 0 0 1.4rem;
  padding-left: 1.3rem;
}

.error-page {
  min-height: 54vh;
  display: grid;
  align-content: center;
  width: min(100% - 2.5rem, 36rem);
  max-width: 36rem;
  margin: 0 auto;
  padding: 5rem 0;
}

.error-page .code {
  margin: 0 0 0.5rem;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.error-page h1 {
  margin: 0 0 1rem;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: clamp(2.6rem, 7vw, 4rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--ink);
}

@media (max-width: 760px) {
  body {
    font-size: 17px;
  }

  .header-inner {
    min-height: 4rem;
    gap: 1rem;
  }

  .brand-text span {
    display: none;
  }

  .nav {
    gap: 1rem;
    font-size: 0.8rem;
  }

  .home-intro {
    padding: 3.5rem 0 2.5rem;
  }

  .post-item {
    grid-template-columns: 1fr;
    gap: 0.8rem;
    padding: 1.7rem 0;
  }

  .post-date {
    flex-direction: row;
    align-items: center;
    gap: 0.8rem;
  }

  .article {
    padding-top: 3rem;
  }

  .post-header {
    margin-bottom: 2rem;
  }

  .toc ol {
    columns: 1;
  }

  .post-meta > * + *::before {
    content: "";
    margin-right: 0;
  }

  .post-meta {
    gap: 0.4rem 1rem;
  }

  .footer-inner {
    flex-direction: column;
    gap: 1rem;
  }

  .article pre code {
    font-size: 0.72rem;
  }

  .article figure.shot {
    width: 100%;
    margin: 2rem 0;
    padding: 0.4rem;
    transform: none;
  }

  .article figure.diagram {
    padding: 0.4rem;
  }

  .article figure.diagram a {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.3rem;
  }

  .article figure.diagram img {
    min-width: 680px;
    max-width: none;
  }

  .article figure.diagram.diagram-wide img {
    min-width: 900px;
  }

  .table-wrap table {
    min-width: 40rem;
  }

  .article table {
    font-size: 0.78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media print {
  .site-header,
  .site-footer,
  .toc,
  .post-footer {
    display: none;
  }

  body {
    font-size: 11pt;
    color: #000;
    background: #fff;
  }

  .article {
    max-width: none;
    padding: 0;
  }

  a {
    text-decoration: none;
  }

  .article pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .article figure.shot {
    width: 100%;
    margin: 1.5rem 0;
    padding: 0;
    border: 0;
    transform: none;
  }

  .article figure.shot a {
    display: block;
  }

  .article figure.diagram {
    width: 100%;
    max-width: 100%;
    margin: 1.5rem 0;
    padding: 0;
    border: 0;
    transform: none;
    break-inside: avoid;
  }

  .article figure.diagram a {
    display: block;
  }
}
