/* Minimal Org-mode Blog CSS - Legacy Browser Compatible */
/* Fixed menu, floating images, footnote hover support */

/* Reset and base styles */
* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  line-height: 1.6;
}

body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: #2e3440;
  background-color: #ffffff;
  min-height: 100vh;
}

/* Main content container */
.content, #content, main {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Fixed Preamble Header Navigation */
#preamble {
  background-color: #f8f9fa;
  border-bottom: 1px solid #e5e9f0;
  position: relative;
  z-index: 100;
  width: 100%;
}

#preamble nav {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
  text-align: center;
}

#preamble nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: inline-block;
}

#preamble nav li {
  margin: 0;
  display: inline-block;
  margin-right: 1.5rem;
}

#preamble nav li:last-child {
  margin-right: 0;
}

#preamble nav a {
  color: #2e3440;
  text-decoration: none;
  font-weight: bold;
  padding: 0.5rem 0.75rem;
  display: inline-block;
  -webkit-border-radius: 0.25rem;
  -moz-border-radius: 0.25rem;
  border-radius: 0.25rem;
  -webkit-transition: all 0.2s ease;
  -moz-transition: all 0.2s ease;
  -o-transition: all 0.2s ease;
  transition: all 0.2s ease;
}

#preamble nav a:hover {
  color: #88c0d0;
  background-color: #e5e9f0;
}

#preamble nav a.active {
  color: #eee;
  background-color: #666;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: bold;
  line-height: 1.3;
  margin: 2rem 0 1rem 0;
  color: #2e3440;
  clear: both;
}

h1 { font-size: 2.25rem; margin-top: 1rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  margin: 1rem 0;
  text-align: justify;
}

/* Links */
a {
  color: #5e81ac;
  text-decoration: none;
}

a:hover {
  color: #81a1c1;
  text-decoration: underline;
}

/* Lists */
ul, ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

li {
  margin: 0.25rem 0;
}

/* Code and preformatted text */
code, kbd, samp {
  font-family: monospace, 'Courier New', Courier;
  font-size: 0.875em;
  background-color: #eeeeee;
  color: #000000;
  padding: 0.125rem 0.25rem;
  -webkit-border-radius: 0.25rem;
  -moz-border-radius: 0.25rem;
  border-radius: 0.25rem;
}

pre {
  font-family: monospace, 'Courier New', Courier;
  font-size: 0.875rem;
  line-height: 1.5;
  background-color: #eeeeee;
  color: #000000;
  padding: 1rem;
  -webkit-border-radius: 0.5rem;
  -moz-border-radius: 0.5rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  clear: both;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* Org-mode specific elements */
.org-src-container {
  margin: 1.5rem 0;
  clear: both;
}

.src {
    position: relative;
}

pre.src, pre.src code{
    background-color: #2e2e2e;
    color: #d6d6d6;
}

.org-src-name {
  font-family: monospace, 'Courier New', Courier;
  font-size: 0.875rem;
  color: #4c566a;
  margin-bottom: 0.5rem;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  clear: both;
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e5e9f0;
}

th {
  font-weight: bold;
  background-color: #f8f9fa;
}

/* Blockquotes */
blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid #88c0d0;
  background-color: #f8f9fa;
  font-style: italic;
  clear: both;
}

/* Images and figures - Standard */
img {
  max-width: 100%;
  height: auto;
  -webkit-border-radius: 0.5rem;
  -moz-border-radius: 0.5rem;
  border-radius: 0.5rem;
}

figure {
  margin: 1.5rem 0;
  text-align: center;
}

figcaption {
  font-size: 0.875rem;
  color: #4c566a;
  margin-top: 0.5rem;
  font-style: italic;
}

/* Floating Images - Left */
.float-left, .figure-left {
  float: left;
  margin: 0 1.5rem 1rem 0;
  max-width: 45%;
}

.float-left img, .figure-left img {
  width: 100%;
  margin: 0;
}

.float-left figcaption, .figure-left figcaption {
  text-align: left;
  margin-top: 0.5rem;
}

/* Floating Images - Right */
.float-right, .figure-right {
  float: right;
  margin: 0 0 1rem 1.5rem;
  max-width: 45%;
}

.float-right img, .figure-right img {
  width: 100%;
  margin: 0;
}

.float-right figcaption, .figure-right figcaption {
  text-align: right;
  margin-top: 0.5rem;
}

/* Clear floats utility */
.clear, .clearfix {
  clear: both;
}

.clearfix:after {
  content: "";
  display: table;
  clear: both;
}

/* Footnote Links */
a.footnote {
  position: relative;
  text-decoration: none;
  color: #5e81ac;
  font-size: 0.875em;
  vertical-align: super;
  padding: 0 0.125rem;
}

a.footnote:hover {
  color: #81a1c1;
  text-decoration: none;
}

/* Footnote Tooltip */
.footnote-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  -webkit-transform: translateX(-50%);
  -moz-transform: translateX(-50%);
  -ms-transform: translateX(-50%);
  -o-transform: translateX(-50%);
  transform: translateX(-50%);
  background-color: #2e3440;
  color: #d8dee9;
  padding: 0.75rem 1rem;
  -webkit-border-radius: 0.5rem;
  -moz-border-radius: 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.4;
  width: 300px;
  max-width: 600px;
  white-space: normal;
  text-align: left;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
  margin-bottom: 0.5rem;
  -webkit-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  -moz-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.footnote-tooltip:after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #2e3440 transparent transparent transparent;
}

a.footnote:hover .footnote-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Footnote Definition Section */
.footnotes {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e9f0;
  font-size: 0.875rem;
  clear: both;
}

.footnotes h2 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.footnotes ol {
  padding-left: 1.5rem;
}

.footnotes li {
  margin: 0.75rem 0;
  line-height: 1.5;
}

/* Horizontal rules */
hr {
  border: none;
  height: 1px;
  background-color: #e5e9f0;
  margin: 2rem 0;
  clear: both;
}

/* Postamble Footer */
#postamble {
  background-color: #f8f9fa;
  border-top: 1px solid #e5e9f0;
  margin-top: 3rem;
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: #4c566a;
  clear: both;
}

#postamble p {
  margin: 0.5rem 0;
  text-align: center;
}

/* Tag styling for technical content */
.tag {
  display: inline-block;
  background-color: #88c0d0;
  color: white;
  padding: 0.125rem 0.5rem;
  -webkit-border-radius: 1rem;
  -moz-border-radius: 1rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: bold;
  margin: 0.125rem;
}

/* Responsive design for tablets */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  #preamble nav {
    padding: 0.75rem;
  }

  #preamble nav li {
    margin-right: 1rem;
  }

  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  .content, #content, main {
    padding: 0 0.75rem;
  }

  /* Stack floating images on tablets */
  .float-left, .float-right, .figure-left, .figure-right {
    float: none;
    max-width: 100%;
    margin: 1rem 0;
  }

  .float-left figcaption, .float-right figcaption,
  .figure-left figcaption, .figure-right figcaption {
    text-align: center;
  }

  table {
    font-size: 0.875rem;
  }

  th, td {
    padding: 0.5rem;
  }

  .footnote-tooltip {
    max-width: 250px;
  }
}

/* Responsive design for mobile phones */
@media (max-width: 480px) {
  #preamble nav li {
    margin-right: 0.75rem;
    margin-bottom: 0.25rem;
  }

  #preamble nav a {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
  }

  blockquote {
    padding: 0.75rem 1rem;
  }

  .content, #content, main {
    padding: 0 0.5rem;
  }

  .footnote-tooltip {
    max-width: 200px;
    font-size: 0.8rem;
  }
}

/* Print styles */
@media print {
  #preamble, #postamble {
    display: none;
  }

  body {
    font-size: 12pt;
    line-height: 1.4;
  }

  h1, h2, h3 {
    page-break-after: avoid;
  }

  pre, blockquote {
    page-break-inside: avoid;
  }

  .float-left, .float-right, .figure-left, .figure-right {
    float: none;
    max-width: 100%;
    margin: 1rem 0;
  }

  .footnote-tooltip {
    display: none;
  }
}
