/* styling.css stylesheet */
/* Marius Montebaur, 20.06.2020 */
/* Cameron Brooks, 12.06.2025 */

/* ─── Theme variables ─────────────────────────────────────────────────── */
:root {
  /* Dark (default) */
  --body_background_color: #0f0f11;
  --content_background_color: #242424;
  --header_background_color: #2b2d35;

  --text_color: #c4c4c4;
  --heading_color: #b5cea8;
  --link_color: lightcoral;
  --border_color: #979797;

  --toc_background_color: black;
  --toc_border_color: #c4c4c4;
  --toc_link_color: #98e2ff;

  --code_bg_color: #002b36;
  --code_text_color: #dfd3d3;
  --inline_code_bg_color: #0a0a0a;
}

@media (prefers-color-scheme: light) {
  :root {
    /* Light */
    --body_background_color: #f5f5f5;
    --content_background_color: #ffffff;
    --header_background_color: #e6e6e6;

    --text_color: #333333;
    --heading_color: #556b2f;
    --link_color: #d14;
    --border_color: #cccccc;

    --toc_background_color: #f0f0f0;
    --toc_border_color: #666666;
    --toc_link_color: #0066cc;

    --code_bg_color: #f5f5f5;
    --code_text_color: #111111;
    --inline_code_bg_color: #eeeeee;
  }
}

/* ─────────────────────────────────────────────────────────────────────── */

html {
  height: 100%;
  scroll-padding-top: 160px; /* Increase to account for larger header + more margin */
}

body {
  margin: 0;
  padding: 0;
  color: var(--text_color);
  font-family: sans-serif;
  font-size: 100%;
  line-height: 140%;
  background-color: var(--body_background_color);
  min-width: 320px;
  height: 100%;
}

/* =========
Main content layout
=== */

.main-content {
  margin: 0 auto;
  max-width: 900px;
  color: var(--text_color);
  border-left: 1px solid var(--border_color);
  border-right: 1px solid var(--border_color);
  background-color: var(--content_background_color);
  padding: 40px 60px 60px 60px; /* More generous side padding */
  /* Add top padding to account for fixed header + extra space */
  padding-top: 180px; /* Increase to give more space below header */
  /* page_height - header_height - footer_height - content_margin */
  min-height: calc(100vh - 180px - 71px - 120px);
}

.page-content {
  clear: both;
  margin-top: 20px;
}

/* Legacy support for old content class */
.content {
  margin: 0 auto;
  max-width: 900px;
  color: var(--text_color);
  border-left: 1px solid var(--border_color);
  border-right: 1px solid var(--border_color);
  background-color: var(--content_background_color);
  padding: 40px 60px 60px 60px; /* More generous side padding */
  /* Add top padding to account for fixed header + extra space */
  padding-top: 180px; /* Increase to give more space below header */
  /* page_height - header_height - footer_height - content_margin */
  min-height: calc(100vh - 180px - 71px - 120px);
}

.content-title-n-toc {
  float: left;
  display: block;
}

.content-title {
  font-size: 150%;
  margin-bottom: 20px;
  color: var(--heading_color);
}

/* =========
Header styling
=== */

header,
.site-header {
  border-bottom: 1px solid var(--border_color);
  background-color: var(--header_background_color);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header_content,
.header-content {
  margin: 0 auto;
  padding: 20px 60px; /* Increase side padding for more breathing room */
  max-width: 900px;
  margin-bottom: -1px;
}

.site-title h1 {
  margin: 0;
  font-weight: lighter;
  padding-top: 0.4em;
  padding-bottom: 0.2em;
  text-align: left;
  border: none;
  color: var(--heading_color);
  height: 30px;
  font-size: 32px;
  /* min of (12% of the view port width - 16px) and (32px).
  chose larger Xvw for font to shrink faster. */
  font-size: min(12vw - 16px, 32px);
}

.site-title h1 a {
  text-decoration: none;
  color: var(--heading_color);
}

/* =========
Site Navigation
=== */

.site-nav {
  margin-top: 10px;
}

.site-nav .nav-link {
  color: var(--text_color);
  text-decoration: none;
  margin-right: 20px;
  padding: 5px 10px;
  border-radius: 3px;
  transition: background-color 0.3s ease;
}

.site-nav .nav-link:hover,
.site-nav .nav-link.active {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--heading_color);
}

/* =========
Page Header
=== */

.page-header {
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border_color);
  padding-bottom: 20px;
}

.page-title {
  font-size: 150%;
  margin-bottom: 10px;
  margin-left: 0; /* Ensure no negative margin */
  color: var(--heading_color);
  border: none !important; /* Override default h1 styling */
}

.page-subtitle {
  font-size: 110%;
  color: var(--text_color);
  margin-bottom: 10px;
  font-style: italic;
}

.page-author {
  font-size: 90%;
  color: var(--text_color);
  margin-bottom: 0;
}

/* =========
Footer styling
=== */

footer,
.site-footer {
  width: 100%;
  height: 70px;
  border-top: 1px solid var(--border_color);
  background-color: var(--header_background_color);
}

.footer_content,
.footer-content {
  margin: 0 auto;
  padding: 20px 60px; /* Match header padding */
  max-width: 900px;
}

.footer_site_link {
  float: left;
  color: var(--text_color);
}

.footer_email {
  float: left;
  margin-left: 20px;
  color: var(--text_color);
}

.footer_scroll_up {
  text-align: right;
  float: right;
  visibility: hidden;
  cursor: pointer;
  color: var(--text_color);
}

/* =========
Heading styling
=== */

h1 a,
h2 a,
h3 a,
h4 a,
h5 a {
  text-decoration: none;
  color: var(--heading_color);
}
h1,
h2,
h3,
h4,
h5 {
  font-weight: lighter;
  border-bottom: 1px dotted var(--border_color);
  float: none;
  color: var(--heading_color);
  clear: both;
}
h2,
h3,
h4,
h5 {
  padding-left: 10px;
}

h1 {
  font-size: 130%;
  margin-top: 75px;
}

h2 {
  font-size: 110%;
  margin-top: 50px;
}

h3 {
  font-size: 95%;
  margin-top: 20px;
}

h4 {
  font-size: 90%;
  font-style: italic;
}

h5 {
  font-size: 90%;
  font-style: italic;
}

span.header-section-number {
  display: none;
  visibility: hidden;
}

h1.title {
  margin: 0;
  font-weight: lighter;
  padding-top: 0.4em;
  padding-bottom: 0.2em;
  text-align: left;
  border: none;
  color: var(--heading_color);
  height: 30px;
  font-size: 32px;
  /* min of (12% of the view port width - 16px) and (32px).
  chose larger Xvw for font to shrink faster. */
  font-size: min(12vw - 16px, 32px);
}

hr {
  margin-top: 30px;
  margin-bottom: 30px;
}

.main-content > ol > li::marker,
.main-content > ul > li::marker,
.content > ol > li::marker,
.content > ul > li::marker,
.page-content > ol > li::marker,
.page-content > ul > li::marker {
  color: var(--text_color);
}

/* should not affect the table of contents */
.main-content > ol > li,
.main-content > ul > li,
.content > ol > li,
.content > ul > li,
.page-content > ol > li,
.page-content > ul > li {
  padding-left: 10px;
}

/* =========
Paragraph styling
=== */

p {
  clear: left;
  line-height: 165%;
}

/* acts as a breaker before the p element */
p:before {
  content: "";
  width: 10em;
  display: block;
  overflow: hidden;
  /* For demonstration */
  /* border: 1px solid green; */
}

p.title {
  font-size: 90%;
  width: 50%;
  margin-top: 0px;
  margin-bottom: 20px;
}

p.date {
  margin-top: -6px;
  margin-bottom: -6px;
  font-size: 80%;
}

/* List styling which only acts on list in content div, not on TOC */
div.main-content > ol > li,
div.content > ol > li,
div.page-content > ol > li {
  padding-bottom: 6px;
}

div.main-content > ul > li,
div.content > ul > li,
div.page-content > ul > li {
  padding-bottom: 3px;
}

/* dt code {
  font-weight: bold;
} */

dd p {
  margin-top: 0;
}

.image_row {
  display: flex;
}

.image_column {
  flex: 33.33%;
  padding: 15px;
}

/* =========
Image styling
=== */

img {
  max-width: 100%;
}

img.centered {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

img.maxWidth150px {
  max-width: 150px;
  width: 100%;
}

img.maxWidth300px {
  max-width: 300px;
  width: 100%;
}

img.maxWidth500px {
  max-width: 500px;
  width: 100%;
}

img.maxWidth600px {
  max-width: 600px;
  width: 100%;
}

img.maxWidth700px {
  max-width: 700px;
  width: 100%;
}

img.roundedCorners30px {
  border-radius: 30px;
}

/* Was added for indoor mapping article */
/* TODO: Own css files per article? */
img.maxHeight68px {
  max-height: 68px;
  margin-bottom: 5px;
}

/* This one affects a div wrapping figure with img and caption. This is why
 * floating right can't be done by applying a class to the image itself. */
.imgFloatRightWidth400px {
  float: right;
  max-width: 400px;
  width: 100%;
}

.imgFloatRight {
  float: right;
  width: 100%;
}

img.titleicon {
  float: right;
  height: 60px; /* keep legacy browser support */
  height: min(12vw, 60px);
}

figure {
  overflow: hidden;
}

.figureMargin {
  /* Is the same as div.content > figure because images without
   * caption are img tags, not figures */
  margin-top: 35px;
  margin-bottom: 40px;
}

div.main-content > figure,
div.content > figure,
div.page-content > figure {
  /* Will not be applied to figures that are wrapped by another div, e.g. to
   * float on the right of the page. */
  margin-top: 35px;
  margin-bottom: 40px;
}

figcaption {
  text-align: center;
  margin-top: 8px;
}

/* =========
Text variants
=== */

strong {
  color: var(--text_color);
}

math {
  color: var(--text_color);
}

/* mark {
  background-color: transparent;
  color: white;
} */

/* =========
Table of contents
=== */

.table-of-contents,
.table_of_contents {
  float: left;
  border: 2px solid var(--toc_border_color);
  margin-right: 30px;
  margin-left: 20px;
  margin-bottom: 30px;
  margin-top: 30px;
  padding: 25px;
  font-family: monospace;
  font-size: 110%;
  background-color: var(--toc_background_color);
  max-width: 280px;
  clear: left;
  position: relative;
  top: 0; 
}

.table-of-contents h2,
.table_of_contents_header {
  text-align: center;
  margin-top: 0; /* Remove top margin from TOC header */
  margin-bottom: 15px; /* Add bottom margin */
  color: var(--heading_color);
}

.table-of-contents a,
.table_of_contents a {
  color: var(--toc_link_color);
}

.table-of-contents ul,
.table_of_contents ul {
  padding-left: 14px;
  padding-right: 8px;
  margin-bottom: 0px;
  margin-top: 10px; /* Add top margin to lists */
}

.table-of-contents li::marker,
.table_of_contents li::marker {
  color: transparent;
}

/* =========
Link styling
=== */

a {
  color: var(--link_color);
}

/* =========
Code layout
=== */

pre,
code,
kbd,
samp {
  font-family: monospace, monospace;
  _font-family: "courier new", monospace;
  /*font-size: 0.98em;*/
}

pre {
  border: 1px dotted var(--border_color);
  background-color: var(--code_bg_color);
  color: var(--code_text_color);
  padding: 0.5em;
  width: fit-content;
  /* make white box the fill width, even if code is shorter. */
  min-width: 100%;
  box-sizing: border-box;
}

code {
  font-family: monospace;
  white-space: pre-wrap;
}

code > span {
  /* TODO: Somehow this doesn't do anything */
  padding-bottom: 0px; /* -20px */
}

/*
Acts on code tags that are in p tags. So this acts on inline code that is not in a header.
https://www.w3schools.com/css/css_combinators.asp */
p > code,
li > code {
  background-color: var(--inline_code_bg_color);
  border-radius: 3px;
  border-color: var(--border_color);
  border-width: 1px;
  color: var(--code_text_color);
  padding: 3px;
}

/* =========
Various Stuff
=== */

span.clear {
  clear: left;
  display: block;
}

/* =========
Blockquotes
=== */

blockquote {
  border-left: 3px solid var(--border_color);
  margin-left: 5px;
  /* margin: 1.5em 10px; */
  /* padding: 0.5em 10px; */
}

blockquote p {
  display: inline-block;
  padding-left: 10px;
  margin-top: 0px;
  margin-bottom: 0px;
  color: var(--text_color);
}

/* =========
Responsive Design
=== */

@media (max-width: 768px) {
  .main-content,
  .content {
    padding: 160px 40px 60px 40px; /* Increase mobile padding, account for larger header */
    border-left: none;
    border-right: none;
  }
  
  .header_content,
  .header-content,
  .footer_content,
  .footer-content {
    padding: 20px 40px; /* Increase mobile side padding */
  }
  
  .table-of-contents,
  .table_of_contents {
    float: none;
    margin: 40px 20px; /* Increase margin and add side margins */
    max-width: none;
    width: calc(100% - 40px); /* Account for side margins */
    box-sizing: border-box;
  }
  
  h1.title {
    font-size: min(8vw, 24px); /* Smaller title on mobile */
  }
  
  .page-content {
    margin-top: 30px; /* More space on mobile */
  }
}

@media (max-width: 480px) {
  .main-content,
  .content {
    padding: 150px 30px 50px 30px; /* Adjust for very small screens */
  }
  
  .header_content,
  .header-content,
  .footer_content,
  .footer-content {
    padding: 15px 30px;
  }
  
  .table-of-contents,
  .table_of_contents {
    margin: 30px 15px; /* Smaller margins on very small screens */
    width: calc(100% - 30px);
    padding: 20px; /* Reduce padding on small screens */
  }
}
