:root {
  --black: #111111;
  --baby-blue: #6666ff;
  --peach: #f99a9a;
  --pale-yellow: #efefaa;
  --dark-yellow: #efd8aa;
  --gray-light: #434343;
  --gray: #ddd;
  --gray-dark: #555;
  --white: #efefef;
}

.container-dark {
  --font-color: var(--black);
  --inv-font-color: var(--white);
  --highlight: var(--baby-blue);
  --highlight-font-color: var(--white);
  --highlight-inv-font-color: var(--black);
  --hover-color: oklch(from var(--highlight-color) calc(l + .2) c h);
  --bg-color: var(--dark-yellow);
  --code-color: var(--white);
  --font-color-light: var(--gray-light);
  background-color: var(--bg-color);
}

/* Define colors for the dark mode */
.darkmodeinput:checked+.darkmodelabel+.container-dark {
  --highlight: var(--baby-blue);
  --highlight-font-color: var(--black);
  --highlight-inv-font-color: var(--white);
  --bg-color: var(--dark-yellow);
  --code-color: var(--black);
  --font-color-light: var(--gray-light);
}

/* reset box‑sizing so padding & borders stay inside width/height */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/*  Fonts    */
html {
  font-family: "Adwaita Sans", sans-serif;
  font-weight: 400;
  font-style: normal;
  /* TODO: Remove once the white stripe on About page is gone */
  background-color: var(--dark-yellow);
}

code,
pre,
.token {
  font-family: "Adwaita Mono", monospace;
  font-weight: 400;
  font-style: normal;
}


html {
  margin: 0;
  height: 100%;
  color: var(--font-color);
  text-wrap: pretty
}

body {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0;
  padding: 0;
  font-weight: 400;
  font-style: normal;
}

.container-dark {
  flex: 1;
  display: flex;
  flex-direction: column;
}

img {
  width: 100%;
  border-radius: 10px;
}

figure {
  margin-right: 0;
  margin-left: 0
}

video {
  margin-top: 20px;
  margin-bottom: 20px;
  width: 100%;
  height: auto;
}

p {
  margin: 0;
  padding: 0;
  font-size: 19px;
  line-height: 1.6;
}

p+p {
  margin-top: 20px;
}

strong {
  font-weight: 600;
  font-style: normal;
}

a {
  color: var(--font-color);
  text-decoration: none;
}

p a::after {
  content: "°";
  color: var(--highlight);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  padding: 0;
  margin: 0;
  font-weight: 600;
  font-style: normal;
}


h1 {
  font-size: 30px;
  margin-top: 40px;
  margin-bottom: 30px;
}

h2 {
  margin-top: 30px;
  margin-bottom: 10px;
}

h3 {
  margin-top: 20px;
  margin-bottom: 10px;
}


code {
  font-weight: 400;
  font-size: 16px;
  display: inline-block;
  padding: 1px 10px;
}

blockquote {
  margin: 0;
  margin-top: 10px;
  margin-bottom: 20px;
  padding-left: 20px;
  border-left: 5px solid var(--gray-dark);
}

blockquote p {
  font-size: 17px;
  font-style: italic;
  color: var(--gray-dark);
}

blockquote code {
  font-size: 15px;
  background-color: var(--code-color);
  padding: 3px;
}

ul {
  padding: 20px;
}

li {
  font-size: 19px;
}

li+li {
  margin-top: 20px;
}

/* Layout */

main,
footer {
  margin-top: 40px;
  margin-left: 20px;
  margin-right: 20px;
}

.container {
  margin: 0 auto;
  max-width: 950px;
}

.grid {
  display: grid;
  gap: 30px;
}

.rotate-3 {
  transform: rotate(-3deg);
}

.rotate-2 {
  transform: rotate(-2deg);
}

.rotate-1 {
  transform: rotate(-1deg);
}

.rotate1 {
  transform: rotate(1deg);
}

.rotate2 {
  transform: rotate(2deg);
}

.rotate3 {
  transform: rotate(3deg);
}

.note {
  font-size: 19px;
  margin-bottom: 40px;
  margin-top: 20px;
  padding-left: 10px;
  color: var(--gray-light);
  border-left: 5px solid var(--peach);
}

.two_images {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 30px;
  margin-bottom: 30px;
}

.two_images figure {
  width: 45%;
  text-align: center;
}


/* Top Navigation Bar */
.topnav {
  position: sticky;
  background-color: var(--highlight);
  box-shadow: 0 4px 0 var(--black);
  z-index: 1;
  margin: 0;
  padding: 20px 20px;
}

.topnav nav {
  margin: 0 auto;
  max-width: 800px;
}

.topnav a {
  font-weight: 600;
  font-size: 16px;
  color: var(--highlight-font-color);
  text-decoration: none;

  /* give them some breathing room */
  padding: 4px 12px;
  margin-right: 24px;

  /* underline-on-hover effect */
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.topnav a:hover {
  color: var(--highlight-inv-font-color);
  border-color: var(--highlight-inv-font-color);
}

.topnav a.active {
  color: var(--highlight-inv-font-color);
  border-color: var(--highlight-inv-font-color);
}

/* Profile image styling */
.profile {
  text-align: center;
  margin-bottom: 2rem;
}

.profile img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 50%;
  /* makes it a circle */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: inline-block;
}

/* Libraries */

.libraries {
  list-style: none;
  padding: 0;
}

.libraries li {
  display: block;
  margin-bottom: 20px;
}

.libraries code {
  border-radius: 10px;
  background-color: var(--highlight);
  letter-spacing: 0.5px;
  margin-right: 5px;
  padding: 4px 10px;
}

.libraries a code {
  color: var(--highlight-font-color);
}

.libraries a:hover code {
  color: var(--highlight-inv-font-color);
}

/* ─── POSTS ──────────────────────────────────────────────────────────────── */

.post {
  display: inline-block;
  background-color: var(--white);
  color: var(--font-color);
  border-radius: 5px;
  box-shadow: 5px 5px 0px var(--black);
  transition: background-color .2s, color .2s;
}

.post a {
  display: block;
  padding: 12px 20px;
}

.post time {
  display: block;
  font-size: 0.85rem;
  color: var(--gray-light);
  margin-bottom: 6px;
  font-style: italic;
}

.post h2 {
  font-size: 20px;
  letter-spacing: 1px;
  margin-bottom: 7px;
  margin-top: 0;
}

.post p {
  line-height: 1.3;
}

.post:hover {
  background-color: var(--highlight);
  color: contrast-color(var(--highlight));
}

.post:hover time {
  color: var(--grey);
}

/* ─── FOOTER ─────────────────────────────────────────────────────────────── */

footer {
  margin-bottom: 40px;
}

footer a {
  color: var(--black);
  border-bottom: 2px dotted var(--black);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* ─── MOBILE ADAPTIVITY ────────────────────────────────────────────────── */
@media (max-width: 800px) {

  /* reduce container side margins */
  main,
  footer {
    margin-left: 10px;
    margin-right: 10px;
  }

  .container {
    padding: 0 10px;
    max-width: 100%;
  }

  /* collapse any multi‑column grids to a single column */
  .grid {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }

  /* shrink headings */
  h1 {
    font-size: 24px;
    margin-top: 30px;
    margin-bottom: 20px;
  }

  h2 {
    font-size: 20px;
    margin-top: 20px;
    margin-bottom: 8px;
  }

  h3 {
    font-size: 18px;
    margin-top: 16px;
    margin-bottom: 8px;
  }

  /* slightly smaller body text for compact screens */
  p,
  li,
  .note {
    font-size: 16px;
    line-height: 1.5;
  }

  /* tighten top‑nav for small screens */
  .topnav {
    padding: 12px 10px;
  }

  .topnav a {
    font-size: 14px;
    padding: 4px 8px;
    margin-right: 12px;
  }

  /* make code blocks break words if needed */
  code,
  pre {
    word-break: break-word;
    font-size: 14px;
  }

  /* stack the two figures in the article vertically */
  .container-dark>div[style*="display: flex"] {
    flex-direction: column;
  }

  .container-dark>div[style*="display: flex"] figure {
    width: 100% !important;
  }

  /* TODO: Remove hack. This is only done because the sun/moon don't properly resize */
  .darkmodelabel {
    opacity: 0;
  }
}

@media (max-width: 480px) {

  /* further tweaks for very small phones */
  p,
  li {
    font-size: 15px;
  }

  figcaption {
    font-size: 12px;
  }

  h1 {
    font-size: 20px;
  }

  .topnav a {
    margin-right: 8px;
    padding: 3px 6px;
  }
}