/*
 * "Fuck the critics" — minimal personal site
 * No frameworks, no tracking, just HTML + CSS.
 */

:root {
  --bg: #0f0f0f;
  --bg-soft: #161618;
  --bg-code: #1c1c20;
  --fg: #b8b8b8;
  --fg-dim: #636363;
  --fg-bright: #e8e8e8;
  --accent: #8a8a8a;
  --accent-subtle: rgba(138, 138, 138, 0.12);
  --line: #232326;
  --line-hover: #333338;
  --max-width: 720px;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", "Courier New", Courier, monospace;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --transition-fast: 0.15s ease;
  --transition-med: 0.25s ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background-color: var(--accent);
  color: var(--bg);
}

body {
  margin: 0;
  padding: 4.5rem 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

a {
  color: var(--fg-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--fg-dim);
  transition:
    color var(--transition-fast),
    text-decoration-color var(--transition-fast);
}

a:hover,
a:focus {
  color: var(--fg-bright);
  text-decoration-color: var(--fg-bright);
}

a:focus-visible {
  outline: 1px dashed var(--accent);
  outline-offset: 3px;
}

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

/* Header — monospace for the hacker identity */

.site-header {
  margin-bottom: 3.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  margin: 0 0 1.25rem 0;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--fg-bright);
  letter-spacing: 0.02em;
}

.brand a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition-fast);
}

.brand a:hover,
.brand a:focus {
  color: var(--accent);
}

.brand::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 1px;
  background-color: var(--line);
  margin-top: 1rem;
}

/* Navigation — monospace, terminal-like */

.nav-main ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
}

.nav-main a {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--fg-dim);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color var(--transition-fast);
}

.nav-main a:hover,
.nav-main a:focus,
.nav-main a[aria-current="page"] {
  color: var(--fg-bright);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--accent);
}

/* Main content */

main {
  flex: 1;
}

section {
  margin-bottom: 3rem;
}

h1, h2, h3 {
  font-weight: 600;
  color: var(--fg-bright);
  margin-top: 0;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.6rem;
  margin-bottom: 1.25rem;
}

h2 {
  font-size: 1.1rem;
  font-family: var(--font-mono);
  font-weight: 500;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

p {
  margin: 0 0 1.25rem 0;
}

ul, ol {
  margin: 0 0 1.25rem 0;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.45rem;
}

/* Intro / landing */

.landing-intro {
  color: var(--fg-dim);
  margin-bottom: 2.5rem;
  font-size: 1rem;
  line-height: 1.8;
}

.landing-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.landing-list li {
  margin-bottom: 0.85rem;
}

.landing-list a {
  color: var(--fg-bright);
  font-weight: 500;
}

/* Lists for blog and talks — with subtle hover interaction */

.item-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.item-list li {
  margin-bottom: 0;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--line);
  border-radius: 4px;
  transition:
    background-color var(--transition-med),
    border-color var(--transition-med);
}

.item-list li:first-child {
  border-top: 1px solid var(--line);
}

.item-list li:hover {
  background-color: var(--accent-subtle);
  border-color: var(--line-hover);
}

.item-list li:last-child {
  border-bottom: 1px solid var(--line);
}

.item-list h3 {
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
  font-weight: 500;
}

.item-list h3 a {
  text-decoration: none;
  transition: color var(--transition-fast);
}

.item-list h3 a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent);
}

.item-meta {
  display: block;
  font-family: var(--font-mono);
  color: var(--fg-dim);
  font-size: 0.75rem;
  margin-top: 0.1rem;
  letter-spacing: 0.03em;
}

.item-summary {
  margin: 0.5rem 0 0 0;
  color: var(--fg);
  font-size: 0.92rem;
  line-height: 1.65;
}

/* whoami */

.whoami-text p {
  text-align: left;
}

.external-links {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0 0;
}

.external-links li {
  margin-bottom: 0.5rem;
}

.external-links li::before {
  content: "-> ";
  font-family: var(--font-mono);
  color: var(--fg-dim);
  font-size: 0.85rem;
}

/* Footer */

.site-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-align: left;
  width: 100%;
  letter-spacing: 0.02em;
}

.site-footer a {
  color: var(--fg-dim);
}

.site-footer a:hover,
.site-footer a:focus {
  color: var(--fg-bright);
}

/* Helper text for templates */

.template-note {
  color: var(--fg-dim);
  font-size: 0.85rem;
  border-left: 2px solid var(--line);
  padding-left: 1rem;
  margin: 1.5rem 0;
}

.template-note code {
  color: var(--fg-bright);
  background-color: var(--bg-code);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

/* ─── Posts ─── */

.post {
  min-width: 0;
  width: 100%;
}

.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.post-header h1 {
  margin-bottom: 0.5rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.post-body {
  margin-bottom: 2.5rem;
}

/* Post typography — optimised for long-form reading */

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4,
.post-body h5,
.post-body h6 {
  color: var(--fg-bright);
  margin-top: 2.5rem;
  margin-bottom: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.post-body h2 {
  font-size: 1.3rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line);
}

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

.post-body h4 {
  font-size: 1rem;
}

.post-body p {
  margin-bottom: 1.3rem;
  line-height: 1.8;
}

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

.post-body li {
  margin-bottom: 0.4rem;
  line-height: 1.75;
}

/* Blockquotes — refined with a subtle left accent */

.post-body blockquote {
  margin: 1.75rem 0;
  padding: 0.85rem 1.25rem;
  border-left: 3px solid var(--accent);
  background-color: var(--accent-subtle);
  border-radius: 0 4px 4px 0;
  color: var(--fg);
  font-style: italic;
}

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

/* Inline code */

.post-body code {
  color: var(--fg-bright);
  background-color: var(--bg-code);
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  font-size: 0.85em;
  font-family: var(--font-mono);
}

/* Code blocks */

.post-body pre {
  background-color: var(--bg-code);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.15rem 1.25rem;
  overflow-x: auto;
  white-space: pre;
  max-width: 100%;
  min-width: 0;
  margin: 1.75rem 0;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.4; /* Slightly tighter for ASCII art support */
  tab-size: 4;
}

.post-body pre code {
  background-color: transparent;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
  white-space: pre;
  border-radius: 0;
  color: var(--fg-bright);
}

.cert-map {
  background-color: var(--bg-code);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.15rem 1.25rem;
  overflow-x: auto;
  white-space: pre;
  max-width: 100%;
  margin: 1.5rem auto;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  box-sizing: border-box;
}

.post-body .diagram-img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.75rem auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-sizing: border-box;
}

.post-body .table-wrapper {
  overflow-x: auto;
  max-width: 100%;
  margin: 1.75rem 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: var(--bg-soft);
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 0;
}

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

.post-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.75rem 0;
  border-radius: 4px;
}

.post-body th,
.post-body td {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  text-align: left;
  word-break: break-word;
}

.post-body th {
  color: var(--fg-bright);
  background-color: var(--bg-soft);
  font-weight: 500;
  white-space: nowrap;
}

.post-body strong {
  color: var(--fg-bright);
  font-weight: 600;
}

/* Back link */
.post + p a,
article > p:last-child a {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--fg-dim);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.post + p a:hover,
article > p:last-child a:hover {
  color: var(--fg-bright);
}

/* Responsive */

@media (max-width: 480px) {
  body {
    padding: 2.5rem 1rem;
  }

  .brand {
    font-size: 1.1rem;
  }

  h1 {
    font-size: 1.3rem;
  }

  .post-header h1 {
    font-size: 1.4rem;
  }

  .item-list li {
    padding: 1rem 0.75rem;
  }

  .post-body pre {
    padding: 0.85rem 1rem;
    font-size: 0.78rem;
    border-radius: 4px;
  }
}
