:root {
  /* Color options */
  --bg-bright: white;
  --bg-dark: black;
  --bg-blue: #012fa7;
  --bg-pink: #dedaff;
  --bg-green: #adf0c7;
  --text-on-dark-and-blue: white;
  --text-on-bright: black;
  --text-on-pink-and-green: #012fa7;
  --link-on-dark: #abc8ff;
  --link-on-bright: blue; /*#012fa7;*/
  --link-on-blue: #fff6b6;
  --link-on-pink: #7342dd;
  --link-on-green: #6631d7;
  --text-footer: #727272;
  --dividers: black;
  /* Font & text options */
  --font-size: 16px;
  --line-height: normal;
  --indentation: 2rem; /* For lists, blockquotes, etc. */
  /* Layout options */
  --margin-top: 1.5rem;
  --margin-bottom: 1rem;
  --margin-sides: 2rem;
  /* Other options */
  --img-radius: 0px;
}

/* ------------------------------------------------------------------------------------------------------------------------------------ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  min-height: 100%;
}
body {
  display: flex;
  flex-direction: column;
  scrollbar-gutter: stable; /* Prevents layout shift when scrollbar appears */

  min-height: 100svh;
  padding-left: var(--margin-sides);
  padding-right: var(--margin-sides);
  padding-top: var(--margin-top);
  padding-bottom: var(--margin-top);

  background-color: var(--bg-bright);
  font-family: 'Times New Roman', Times, serif;
  font-size: var(--font-size);
  color: var(--text-on-bright);
  line-height: var(--line-height);
}

main {
  flex: 1;
}
.page {
  display: flex;
  flex-direction: column;
  margin-bottom: 3rem;
}

.grid-layout-biased {
  display: grid;
  grid-template-columns: 2fr 5fr 5fr;
}
.grid-layout-centered {
  display: grid;
  grid-template-columns: 3fr 4fr 3fr;
}

/* GENERAL ---------------------------------------------------------------------------------------------------------------------------- */

/* Header */
header {
  position: absolute;
  width: 100%;
  top: 0;
  left: 0;
  right: 0;
  padding-top: var(--margin-top);
  padding-left: var(--margin-sides);
  padding-right: var(--margin-sides);
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  pointer-events: none;
}
.header-left {
  grid-column: 1;
  height: fit-content;
  pointer-events: auto;
}
/*.header-left > a::before {
  content: "↜ ";
  line-height: 0;
}*/
.header-middle {
  grid-column: 2;
  height: fit-content;
}
.header-middle > p {
  text-indent: var(--indentation);
}
.header-right {
  grid-column: 3;
  height: fit-content;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  gap: 1.5rem;
  pointer-events: auto;
}

/* Footer */
footer {
  padding-top: 0.5rem;
  margin-top: 1rem;
  vertical-align: bottom;
  color: var(--text-on-bright);
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}
footer > div {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
}
footer > div:last-of-type > span {
  opacity: 60%;
  color: var(--text-on-bright);
}

/* Content */
h1 {
  text-align: left;
  font-size: 1.8rem;
  line-height: 2rem;
  margin-top: 0.8rem;
  margin-bottom: 1.4rem;
}
h2 {
  margin-top: 0.8rem;
  margin-bottom: 0.6rem;
}

p {
  margin-bottom: 1lh;
}
p:last-child {
  margin-bottom: 0;
}

blockquote {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  margin-bottom: 1lh;
  border-left: 1px solid color-mix(in srgb, var(--dividers) 25%, transparent);
  opacity: 90%;
}

ul, ol { /* Lists */
  list-style-position: outside;  /* Bullet/number outside, text aligns with grid */
  padding-left: var(--indentation);  /* Indent by multiple of character widths */
  margin-bottom: 1lh;
}
ul:last-child, ol:last-child {
  margin-bottom: 0;
}
/*
li {
  text-indent: 0; / No extra indent on wrapped lines /
  margin-bottom: 0.5lh; / Space between list items /
}*/
li ul, li ol { /* Nested lists */
  /*margin-top: 0.5lh;
  margin-bottom: 0;*/
  list-style: disc;
}

a {
  color: var(--link-on-bright);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  opacity: 1;
}
/*a:hover {
  color: var(--link-hover);
}
a.wikilink {
  color: var(--link-hover);
}  
*/
a.wikilink-missing {
  text-decoration: underline dotted 1px;
  opacity: 0.7;
}
a.external::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;

  transform: translateY(-1px) translateX(1px);
  padding-right: 1px;

  background-image: url("/assets/icons/iconoir/arrow-up-right.svg");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: left;
}
a.external:has(img)::after,
a.external:has(video)::after,
a.external:has(svg)::after {
  display: none;
}

/* Misc. */
section {
  width: 100%;
}

hr {
  height: 1px;
  margin-top: 2rem;
  margin-bottom: 1lh;
  opacity: 60%;
}

img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0; /* Remove default margin */
  object-fit: cover; /* Cover the entire area */
  object-position: center; /* Center the image */
}

embed {
  width: 100%;
  height: 800px;
}

pre {
  padding-top: 1lh;
  padding-bottom: 1lh;
  padding-left: 1ch;
  padding-right: 1ch;
  margin-bottom: 1lh;

  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}
pre code {
  font-size: 14px;

  white-space: pre; /* preserve formatting */
}

.arrow-icon {
  display: inline-block;
  vertical-align: middle;
  width: 18px;
  height: 18px;
  transform: translateY(-2px) translateX(-2px);
}

/* CUSTOM ELEMENTS -------------------------------------------------------------------------------------------------------------------- */

/*.sitemap {
  margin-top: 2lh;
}*/
.sitemap > a {
  margin-left: 0;
}
.sitemap > p:not(:first-child) {
  margin-bottom: 0;
  margin-left: var(--indentation);
}
.sitemap > h2 {
  font-size: var(--font-size);
  font-weight: normal;
  font-style: italic;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}
.sitemap > hr {
  margin-top: 1rem;
  margin-bottom: 1rem;
  opacity: 35%;
}

.support-link::before {
  content: "⋆ ⁺₊✧";
  position: absolute;
  margin-left: -2.4rem;
  font-size: 14px;
}

.frontmatter {
  display: flex;
  flex-direction: column;
  opacity: 90%;
}

/*
.backlinks {
  display: none;
  grid-column: 2;
  margin-top: 2lh;
  padding-left: 0;
  padding-right: 0;
}
.backlinks > h2 {
  font-size: var(--font-size);
  font-weight: normal;
  margin-bottom: 0.5rem;
}
/.backlinks > ul, ol {
  margin-left: 0;
}/
*/

.feed {
  grid-column: 2;
}
.feed > ul {
  padding-left: 0;
}
.feed > ul > li {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 4fr;
}

/*.guestbook-container {
  margin-top: -10.2rem;
  margin-left: -1.55rem;
}*/
.chat-container {
  height: 80dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* HOME ------------------------------------------------------------------------------------------------------------------------------- */

.home-image-row {
  display: flex;
  gap: 1.5rem;

  margin-left: calc(-1 * var(--margin-sides));
  margin-right: calc(-1 * var(--margin-sides));
  padding-left: var(--margin-sides);
  padding-right: var(--margin-sides);

  overflow-x: auto;
  overflow-y: hidden;

  scrollbar-width: none;
  -ms-overflow-style: none;
}
.home-image-row::-webkit-scrollbar {
  display: none;
}
.home-image-row > img {
  flex: 0 0 auto;
  width: 240px;
}

/* PORTFOLIO -------------------------------------------------------------------------------------------------------------------------- */

/* Intro */
.portfolio-intro {
  grid-column: 2;
  margin-bottom: 2rem;
}

/* Grid */
.portfolio-grid-big,
.portfolio-grid-small {
  grid-column: 1;
  display: grid;
  gap: 2rem;
  max-width: 100%;
  min-width: 0;
}
.portfolio-grid-big {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 2rem;
}
.portfolio-grid-small {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 2rem;
}
.portfolio-item-big,
.portfolio-item-small {
  width: 100%;
  min-width: 0;
  margin: 0;
}
.thumb {
  position: relative;
  overflow: hidden;
  background-color: #f0f0f0; /* Placeholder background */
  width: 100%;
}
.portfolio-item-big .thumb img {
  aspect-ratio: 1140 / 750;
}
.portfolio-item-small .thumb img {
  aspect-ratio: 630 / 500;
}

/* Bottom/links */
.portfolio-links {
  display: flex;
  flex-direction: row;
  margin-top: 2lh;
  margin-bottom: 1lh;
}
.portfolio-links > a {
  margin-right: 2rem;
}

/* LIST NARROW (FEED) ----------------------------------------------------------------------------------------------------------------- */

.list-narrow {
  grid-column: 2;
  padding-left: var(--margin-sides);
  padding-right: var(--margin-sides);
}

/* SINGLE NARROW ---------------------------------------------------------------------------------------------------------------------- */

.single-narrow {
  grid-column: 2;
  padding-left: var(--margin-sides);
  padding-right: var(--margin-sides);
}
.single-narrow > p > img, video {
  width: 100%;
}

/* STANDALONE (LIST/SINGLE) ----------------------------------------------------------------------------------------------------------- */

.standalone-wide {
  margin-top: 3rem;
}
.standalone-wide > h1 {
  font-size: 2em;
}

.standalone-narrow {
  grid-column: 2;
}

/* ------------------------------------------------------------------------------------------------------------------------------------ */

/* Transition layouts */
@media (max-width: 1600px) {
  
}

@media (max-width: 1200px) {
  .grid-layout-centered {
    grid-template-columns: 2fr 4fr 2fr;
  }
}
/*@media (max-width: 1000px) {
  .grid-layout-centered {
    grid-template-columns: 1fr 4fr 1fr;
  }
}*/

/* MAIN MOBILE LAYOUT */
@media (max-width: 1120px) { /*940px*/
  .grid-layout-centered {
    display: flex;
    flex-direction: column;
  }
  .grid-layout-biased {
    display: flex;
    flex-direction: column;
  }

  header {
    flex-direction: row !important;
    position: relative;
    padding: 0;
    margin-bottom: 1lh;
  }

  footer {
    flex-direction: column;
  }
  footer > div:first-of-type {
    border-bottom: 1px solid color-mix(in srgb, var(--dividers) 30%, transparent);
    padding-bottom: 1lh;
    margin-bottom: 0.4rem;
  }

  .list-narrow {
    margin-top: 1lh;
  }
  .single-narrow {
    padding: 0;
  }

  .portfolio-grid-big {
    grid-template-columns: 1fr;
  }
  .portfolio-grid-small {
    grid-template-columns: repeat(2, minmax(0, 1fr))
  }

  .feed > ul > li {
    grid-template-columns: 1fr 2fr;
  }

  .sitemap {
    border-top: 1px solid color-mix(in srgb, var(--dividers) 30%, transparent);
    padding-top: 1lh;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 13px;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  header {
    margin-bottom: 2lh;
  }

  footer > div {
    gap: 1rem;
  }
  footer > div:last-child {
    font-size: 11px;
  }

  h1 {
    font-size: 1.6rem;
    line-height: 1.8rem;
    margin-bottom: 1rem;
  }

  pre code {
  font-size: 11px;
}

  .home-image-row > img:not(:first-of-type) {
    display: none;
  }

  .portfolio-intro {
    margin-bottom: 2lh;
  }
  .portfolio-grid-big,
  .portfolio-grid-small {
    gap: 1rem;
  }
  .portfolio-grid-big {
    margin-bottom: 1rem;
  }
  .portfolio-grid-small {
    margin-top: 1rem;
  }
}