/*
 * Small tweaks for things Beautiful Jekyll has no _config.yml setting for.
 * Dark mode (the default) colours come from _config.yml (var(--page-col), var(--text-col), ...),
 * so change those there. Light mode colours are below.
 */

:root {
  --body-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --header-font: var(--body-font);
  --line-col: #30363D;   /* borders, table stripes */
  --switch-col: #30363D; /* navbar separator bar and slider track */
  --code-bg: #30363D;    /* inline `code` background */
}

/* --- Light mode colours (dark mode colours are set in _config.yml) --- */
:root[data-theme="light"] {
  --page-col: #FFFFFF;
  --text-col: #1F2328;
  --link-col: #1A7F37;   /* darker green, readable on white */
  --hover-col: #116329;
  --navbar-col: #F6F8FA;
  --navbar-text-col: #1F2328;
  --navbar-border-col: #D0D7DE;
  --footer-col: #F6F8FA;
  --footer-text-col: #656D76;
  --footer-link-col: #1F2328;
  --footer-hover-col: #1A7F37;
  --line-col: #D0D7DE;
  --switch-col: #D0D7DE;
  --code-bg: #EFF1F3;
}

body {
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

/* --- Navbar --- */
@media (min-width: 1200px) {
  /* line the logo and links up with the post column */
  .navbar-custom {
    padding-left: max(1rem, calc((100% - 730px) / 2));
    padding-right: max(1rem, calc((100% - 730px) / 2));
  }
}

/* terminal-style title "$ duartecsantos▌" */
.navbar-custom .navbar-brand {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-weight: bold;
}
.navbar-custom .navbar-brand::before {
  content: "$ ";
}
.navbar-custom .navbar-brand::after {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 1em;
  margin-left: 0.3em;
  vertical-align: -0.1em;
  background: var(--link-col);
  animation: cursor-blink 1s steps(1) infinite;
}
@keyframes cursor-blink { 50% { opacity: 0; } }

.navbar-custom .navbar-nav .nav-item {
  text-transform: none;
  font-size: 1rem;
  letter-spacing: normal;
}
.navbar-custom .navbar-nav .nav-link { font-weight: normal; }
.navbar-light .navbar-toggler-icon { filter: invert(0.7); }  /* hamburger icon visible on dark */
[data-theme="light"] .navbar-light .navbar-toggler-icon { filter: none; }

/* right side of the navbar (from _includes/navbar-actions.html): sponsor heart + light/dark slider */
#navbar-actions {
  display: flex;
  align-items: center;
  border-left: 1px solid var(--switch-col);  /* vertical bar separating it from the links */
  margin-left: 1.875rem;                     /* same 30px gap as between the navbar links... */
  padding-left: 1.875rem;                    /* ...on both sides of the bar */
}
#navbar-sponsor {
  color: #DB61A2;                            /* pink heart */
  font-size: 1.125rem;
  margin-right: 1.875rem;
}
#navbar-sponsor:hover .fa-heart { font-weight: 900; }  /* filled heart on hover */

#theme-toggle {
  background: none;
  border: none;
  padding: 0.25rem 0;
  cursor: pointer;
}
#theme-toggle:focus { outline: none; }                                   /* no box after a mouse click... */
#theme-toggle:focus-visible { outline: 2px solid var(--link-col); }      /* ...but keep it for keyboard users */
.theme-switch-track {
  display: block;
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  border-radius: 0.75rem;
  background: var(--switch-col);
}
.theme-switch-knob {
  position: absolute;
  top: 0.1875rem;
  left: 0.1875rem;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: var(--navbar-text-col);
  color: var(--navbar-col);
  font-size: 0.625rem;
  line-height: 1.125rem;
  text-align: center;
  transition: transform 0.2s ease-in-out;
}
[data-theme="light"] .theme-switch-knob { transform: translateX(1.25rem); }
#theme-toggle:hover .theme-switch-knob { background: var(--hover-col); }
.theme-icon-light,
[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: inline; }

@media (max-width: 1199.98px) {
  /* on small screens: heart + slider stay in the top bar, next to the hamburger menu */
  #navbar-actions { margin-left: auto; padding-left: 0; border-left: none; margin-right: 1rem; }
  #navbar-sponsor { margin-right: 1.25rem; }
  .navbar-custom .navbar-toggler { order: 2; }
  .navbar-custom .navbar-collapse { order: 3; }
}

/* --- Footer: plain icons (no circles), less padding --- */
footer {
  padding: 1rem 0;
  margin-top: 2rem;
}
footer .list-inline { margin-bottom: 0.5rem; }
footer .footer-links .fa-stack-2x { display: none; }
footer .footer-links .fa-stack {
  width: auto;
  height: auto;
  line-height: 1;
}
footer .footer-links .fa-stack-1x {
  position: static;
  font-size: 1.25rem;
  color: var(--footer-link-col);
}
footer .footer-links a:hover .fa-stack-1x { color: var(--footer-hover-col); }

/* --- Theme spots that use hard-coded light colours --- */
.post-preview,
table tr { border-color: var(--line-col); }
table tr:nth-child(2n) { background-color: var(--navbar-col); }
.blog-post blockquote { border-left-color: var(--line-col); }
.box-note, .box-warning, .box-error, .box-success {  /* keep the coloured left border */
  background-color: var(--navbar-col);
  border-top-color: var(--line-col);
  border-right-color: var(--line-col);
  border-bottom-color: var(--line-col);
}

code {
  color: var(--text-col);
  background-color: var(--code-bg);
}
pre code, .highlight code { background: none; }
.highlight > pre {
  background-image: none;
  border: none;
  border-radius: 0.25rem;
}

.pagination .page-item .page-link {
  color: var(--text-col);
  background-color: transparent;
  border-color: var(--line-col);
}

/* --- CVSS severity badges (cves.md) --- */
/* CVSS severity colours */
.cvss {
  display: inline-block;
  padding: 0 0.5em;
  border-radius: 0.25rem;
  font-size: 0.85em;
  font-weight: 600;
  white-space: nowrap;
  color: #000000;
}
.cvss-critical { background-color: #000000; color: #A9A9A9; border: 1px solid var(--line-col); }  /* border so it shows on the dark background */
.cvss-high     { background-color: #DC3545; }
.cvss-medium   { background-color: #EC971F; }
.cvss-low      { background-color: #F2CC0C; }
