/**
 * By Oskar Wickström (The Monospace Web)
 * Licensed under the MIT License
 * Customized for ldiazn-mono theme
 */
@import url('https://fonts.cdnfonts.com/css/jetbrains-mono-2');

:root {
  --font-family: "JetBrains Mono", monospace;
  --line-height: 1.5rem;
  --border-thickness: 2px;
  /* Dark theme – softer white for comfortable reading */
  --text-color: #c4c8cc;
  --text-color-alt: #8b92a0;
  --background-color:  #13101b;
  --background-color-alt: #18181c;
  /* Neon palette – lime/yellow-green (primary), orange (highlight) */
  --neon-green: #7dd605;
  --neon-green-dim: #5c9c00;
  --neon-orange: #fb923c;
  --neon-orange-dim: #ea580c;
  --neon-muted: #9ee635;
  --color-bold: #ee4c67;
  /* Inline code (single-backtick): dark orange bg, light orange text */
  --code-bg: #7c2c1256;
  --code-color: #d3a069;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 700;
  --font-weight-heading: 800;
  /* Blog list: padding around the title row of each entry */
  --blog-list-title-padding: 0.75rem;
  /* Blog list: padding inside the date row (top and bottom) for all entries */
  --blog-list-date-row-padding: calc(0.25rem);
  /* Subtle background behind images (tied to text color feel) */
  --img-bg: rgba(177, 192, 207, 0.216);

  font-family: var(--font-family);
  font-optical-sizing: auto;
  font-weight: var(--font-weight-normal);
  font-style: normal;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 16px;
}

@media (prefers-color-scheme: light) {
  :root {
    --text-color: #0f172a;
    --text-color-alt: #475569;
    --background-color: #fff;
    --background-color-alt: #f8fafc;
    --img-bg: rgba(15, 23, 42, 0.05);
    --neon-green: #5c8a0d;
    --neon-green-dim: #4a7010;
    --neon-orange: #ea580c;
    --neon-orange-dim: #c2410c;
    --neon-muted: #6b9c15;
    --color-bold: #c41e3a;
    --code-bg: #fed7aa;
    --code-color: #9a3412;
  }
  mark {
    background: rgba(251, 146, 60, 0.15);
    color: var(--neon-orange-dim);
  }
}

* {
  box-sizing: border-box;
}

* + * {
  margin-top: var(--line-height);
}

html {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 0;
  flex-direction: column;
  align-items: center;
  background: var(--background-color);
  background-image: url("/assets/images/dither_cat.png");
  background-repeat: no-repeat;
  background-position: bottom left;
  background-size: 10% auto;
  color: var(--text-color);
}

body {
  position: relative;
  width: 100%;
  margin: 0;
  padding: var(--line-height) 2ch;
  max-width: calc(min(80ch, round(down, 100%, 1ch)));
  line-height: var(--line-height);
  overflow-x: hidden;
  text-align: justify;
}

@media screen and (max-width: 480px) {
  :root {
    font-size: 14px;
  }
  body {
    padding: var(--line-height) 1ch;
  }
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-heading);
  margin: calc(var(--line-height) * 2) 0 var(--line-height);
  line-height: var(--line-height);
}

h1 {
  font-size: 2rem;
  line-height: calc(2 * var(--line-height));
  margin-bottom: calc(var(--line-height) * 2);
  text-transform: uppercase;
}

h2 {
  font-size: 1.25rem;
  text-transform: uppercase;
}

hr {
  position: relative;
  display: block;
  height: var(--line-height);
  margin: calc(var(--line-height) * 1.5) 0;
  border: none;
  color: var(--text-color);
}
hr:after {
  display: block;
  content: "";
  position: absolute;
  top: calc(var(--line-height) / 2 - var(--border-thickness));
  left: 0;
  width: 100%;
  border-top: calc(var(--border-thickness) * 3) double var(--neon-green);
  height: 0;
}

a {
  text-decoration-thickness: var(--border-thickness);
  color: var(--neon-green);
}
a:hover, a:focus {
  color: var(--neon-muted);
}

a:link, a:visited {
  color: var(--neon-green);
}

p {
  margin-bottom: var(--line-height);
  text-indent: 2ch;
}

strong, b {
  font-weight: var(--font-weight-bold);
  color: var(--color-bold);
}
em {
  font-style: italic;
}

table {
  position: relative;
  top: calc(var(--line-height) / 2);
  width: calc(round(down, 100%, 1ch));
  border-collapse: collapse;
  margin: 0 0 calc(var(--line-height) * 2);
}

th, td {
  border: var(--border-thickness) solid var(--neon-green-dim);
  padding:
    calc((var(--line-height) / 2))
    calc(1ch - var(--border-thickness) / 2)
    calc((var(--line-height) / 2) - (var(--border-thickness)));
  line-height: var(--line-height);
  vertical-align: top;
  text-align: left;
}

th {
  font-weight: 700;
}

/* Header table */
.header {
  margin-bottom: calc(var(--line-height) * 2);
}
.header h1 {
  margin: 0;
  font-weight: var(--font-weight-heading);
}
.header .header-title {
  text-align: left;
}
.header .header-subtitle {
  margin: 0;
  margin-top: 0.25em;
  font-size: 1rem;
  font-weight: var(--font-weight-heading);
  text-transform: uppercase;
  color: var(--neon-orange);
  text-indent: 0;
}
.header tr td:last-child {
  text-align: right;
}
.header tr td.header-title,
.header td.header-title[colspan="2"] {
  text-align: left !important;
}
.header-nav-row td.header-nav-cell {
  text-align: left;
}
.header-nav-row td.header-nav-cell:last-child {
  text-align: left;
}
.header-nav-cell--active,
.header-nav-cell--active a {
  background: var(--neon-green) !important;
  color: var(--background-color) !important;
}
.header-nav-cell--active a:hover,
.header-nav-cell--active a:focus {
  color: var(--background-color) !important;
  opacity: 0.9;
}
.header * + * {
  margin-top: 0;
}
.header td {
  vertical-align: top;
}

/* Header contact icons column – stacked, fixed width so nav cells keep size */
.header-icons {
  width: 0;
  white-space: nowrap;
  vertical-align: top;
  padding-left: 1ch;
}
.header-icons-spacer {
  width: 0;
  padding: 0;
  border: none;
  vertical-align: top;
}
.header-icons-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}
.header-icon {
  display: inline-block;
  color: var(--text-color-alt);
  transition: color 0.15s ease;
}
.header-icon:hover,
.header-icon:focus {
  color: var(--neon-green);
}
.header-icon-svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
}

/* Page title – first content below the header, on every page */
.page-title {
  margin: var(--line-height) 0 var(--line-height);
  font-size: 2rem;
  font-weight: var(--font-weight-heading);
  text-transform: uppercase;
}
.language-links {
  margin-top: calc(var(--line-height) * 0.5);
  margin-bottom: var(--line-height);
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}
.language-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  vertical-align: baseline;
}
.language-link-current {
  cursor: default;
}
.language-link-current .flag-icon {
  font-size: 2rem;
  opacity: 1;
  filter: none;
  line-height: 1;
}
.language-link-alt {
  opacity: 0.5;
}
.language-link-alt:hover,
.language-link-alt:focus {
  opacity: 0.8;
  transform: scale(1.1);
}
.language-link-alt .flag-icon {
  font-size: 1.5rem;
  line-height: 1;
}
.flag-icon {
  font-size: 1.5rem;
  line-height: 1;
  display: inline-block;
  vertical-align: baseline;
}

footer {
  margin-top: calc(var(--line-height) * 2);
}
.footer-credit {
  color: var(--text-color-alt);
  opacity: 0.6;
  font-size: 0.875rem;
  margin-top: var(--line-height);
  text-indent: 0;
  text-align: center;
}
.footer-credit a {
  color: var(--text-color-alt);
  opacity: 0.6;
  text-decoration: underline;
}
.footer-credit a:hover,
.footer-credit a:focus {
  color: var(--neon-green);
  opacity: 1;
}

.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  background: var(--neon-green);
  color: var(--background-color);
  border: var(--border-thickness) solid var(--neon-green);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease, background-color 0.2s ease;
  z-index: 1000;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}
.scroll-to-top:hover,
.scroll-to-top:focus {
  background: var(--neon-green-dim);
  border-color: var(--neon-green-dim);
  transform: scale(1.1);
  outline: none;
}
.scroll-to-top svg {
  width: 1.5rem;
  height: 1.5rem;
}

.width-min {
  width: 0%;
  white-space: nowrap;
  text-transform: uppercase;
  font-weight: var(--font-weight-bold);
  color: var(--neon-green-dim);
}
.width-auto {
  width: 100%;
}

p {
  word-break: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

img, video {
  display: block;
  width: 100%;
  object-fit: contain;
  overflow: hidden;
}
img {
  font-style: italic;
  color: var(--text-color-alt);
  background-color: var(--img-bg);
  padding: 0.25rem;
}

pre {
  white-space: pre;
  overflow-x: auto;
  margin: var(--line-height) 0;
  overflow-y: hidden;
}

pre, code {
  font-family: var(--font-family);
}

/* Inline code (e.g. `snippet` in prose) */
code {
  font-weight: var(--font-weight-medium);
  font-size: 0.9em;
  padding: 0.01em 0.1em;
  border-radius: 2px;
  background: var(--code-bg);
  color: var(--code-color);
}
/* Code inside blocks: no extra padding/background */
pre code {
  padding: 0;
  font-size: inherit;
  background: none;
  border: none;
  border-radius: 0;
}

figure {
  margin: calc(var(--line-height) * 2) 3ch;
  overflow-x: auto;
  overflow-y: hidden;
}

figcaption {
  display: block;
  font-style: italic;
  margin-top: var(--line-height);
  color: var(--text-color-alt);
}

blockquote {
  margin: var(--line-height) 0;
  padding: var(--line-height) 0 var(--line-height) calc(var(--line-height) * 1.5);
  border-left: 4px solid var(--neon-green-dim);
  background: var(--background-color-alt);
  color: var(--text-color-alt);
  font-style: italic;
}
blockquote p:first-child { margin-top: 0; }
blockquote p:last-child { margin-bottom: 0; }

/* MathJax (LaTeX) output */
.mjx-chtml {
  color: var(--text-color);
  font-size: 1.05em;
}
.mjx-container[display="true"] {
  overflow-x: auto;
  overflow-y: hidden;
  margin: var(--line-height) 0;
}

mark {
  background: rgba(251, 146, 60, 0.2);
  color: var(--neon-orange);
  padding: 0 0.25em;
}

ul, ol {
  padding: 0;
  margin: 0 0 var(--line-height);
}

ul {
  list-style-type: square;
  padding: 0 0 0 2ch;
}

li {
  margin: 0;
  padding: 0;
}

ul.nav-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1ch;
}
ul.nav-list li {
  display: inline;
}

/* Project card grid: two cards per row after the first */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: calc(var(--line-height) * 2);
  margin-bottom: calc(var(--line-height) * 2);
}
@media (max-width: 560px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}
.card-grid .card-table {
  font-size: 0.875rem;
  margin-bottom: 0;
}
.card-grid .card-table h3 {
  font-size: 1rem;
}

/* Project card table */
.card-table {
  margin-bottom: calc(var(--line-height) * 2);
}
.card-table-img {
  padding: 0 !important;
  vertical-align: top;
}
.card-table-img img {
  display: block;
  width: 100%;
}
.card-table-img a {
  text-decoration: none;
}
.card-table-title {
  text-align: center;
}
.card-table-title h3 {
  margin: 0;
  font-size: 1.25rem;
  text-transform: uppercase;
}
.card-table-title a {
  font-weight: var(--font-weight-bold);
  text-decoration-thickness: var(--border-thickness);
}
.card-table-date-value {
  color: var(--text-color-alt);
}

/* Blog list: single table, three rows per entry (title, date, description) */
.blog-list-table {
  margin-bottom: calc(var(--line-height) * 2);
  width: 100%;
}
.blog-list-table td {
  vertical-align: top;
  border: var(--border-thickness) solid var(--text-color);
}
/* Spacing between entries: only bottom padding on each entry’s last row */
/* Date row: padding controlled by --blog-list-date-row-padding */
.blog-list-table tr.blog-entry-row-last td {
  padding-top: var(--blog-list-date-row-padding);
  padding-bottom: var(--blog-list-date-row-padding);
  border-bottom-width: calc(var(--border-thickness) * 2);
}
/* Image cell: white background, content centered vertically; override .blog-list-table td */
.blog-list-table td.blog-entry-img {
  width: 1%;
  min-width: 120px;
  padding: 0 !important;
  vertical-align: middle;
  background: var(--img-bg);
}
.blog-entry-img-wrap {
  padding: calc(var(--line-height) / 2);
  background: var(--img-bg);
}
.blog-entry-img img {
  display: block;
  max-width: 160px;
  width: 100%;
  height: auto;
}
.blog-entry-img a {
  text-decoration: none;
}
.blog-entry-title {
  text-align: left;
  padding: var(--blog-list-title-padding);
}
.blog-entry-title h3 {
  margin: 0;
  font-size: 1.25rem;
  text-transform: uppercase;
}
.blog-entry-title a {
  font-weight: var(--font-weight-bold);
  text-decoration-thickness: var(--border-thickness);
}
.blog-entry-desc {
  vertical-align: top;
}
.blog-entry-date-value {
  color: var(--text-color-alt);
}
.blog-entry-tags-value {
  color: var(--text-color-alt);
}
