@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Lora:ital,wght@0,400..700;1,400..700&display=swap');

/* --------------------------------------------------
   Root Variables
-------------------------------------------------- */
:root {
  /* Fonts */
  --main-font: 'Lato', sans-serif;
  --heading-font: 'Lora', serif;
  --print-font: 'Times New Roman', Times, serif;

  /* Light Theme Colors */
  --html-color: #e3e8e1;
  --heading-color: #2f3e2e;
  --pre-color: #ffffff;
  --search-box-color: #f0f8e0;
  --back-top-color: #2a4d3c;

  --accent-green: #4c6b4f;
  --link-color: #2e7d32;
  --warning-color: #a2c858;
  --danger-color: #d32f2f;

  /* Print Optimization */
  --print-bg: #ffffff;
  --print-text: #000000;
}

/* --------------------------------------------------
   Base Layout
-------------------------------------------------- */
html {
  box-sizing: border-box;
  font-size: 16px;
  font-family: var(--main-font);
  scroll-behavior: smooth;
  background-color: var(--html-color);
}

body {
  margin: 0;
  padding: 16px;
  font-size: 18px;
  line-height: 1.6;
  color: #252525;
}

.back-button {
  display: block;
  margin: 20px auto;
  padding: 8px 24px;
  font-size: 11pt;
  font-family: var(--main-font);
  background-color: var(--back-top-color);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
}

.back-button:hover {
  background-color: var(--warning-color);
}

/* --------------------------------------------------
   Typography
-------------------------------------------------- */
h1,
h2,
h3 {
  margin-top: 0;
  font-weight: 600;
  text-transform: capitalize;
  text-align: center;
  color: var(--heading-color);
  font-family: var(--heading-font);
}

p,
.overview li {
  line-height: 1.8;
  font-size: 1.05rem;
  margin: 20px;
}

.navigation {
  text-transform: capitalize;
}

/* --------------------------------------------------
   Components
-------------------------------------------------- */
pre {
  font-family: var(--main-font);
  white-space: pre-wrap;
  overflow: auto;
  background-color: var(--pre-color);
  border: 1px solid #cce5e0;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem auto;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.036);
}

details {
  padding: 1rem;
  border-radius: 8px;
  font-family: var(--main-font);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  background-color: #f7e018;
  color: #000;
  margin: 1rem 0;
  transition: background-color 0.3s ease-in-out;
}

details[open] {
  background-color: #eee;
}

summary {
  font-weight: bold;
  cursor: pointer;
}

summary:focus {
  outline: 2px dashed #000;
  outline-offset: 4px;
}

/* --------------------------------------------------
   Sample Search
-------------------------------------------------- */
#filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 1rem 0;
}

#sample-search,
#sample-filter {
  padding: 0.8rem;
  font-size: 1rem;
  border-radius: 8px;
  font-family: var(--main-font);
  border: 1px solid #ccc;
  background: var(--search-box-color);
  color: #000;
  box-sizing: border-box;
  width: 100%;
  max-width: 400px;
}

#sample-search:focus,
#sample-filter:focus {
  outline: none;
  border-color: #e5c2e5;
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

/* --------------------------------------------------
   Sample Container
-------------------------------------------------- */
#samples {
  padding: 1rem;
  margin: 1rem auto;
  max-width: 850px;
  color: #3a3a3a;
  word-break: break-word;
  overflow-wrap: anywhere;
}

#samples h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: #2a7f62;
  border-bottom: 2px solid #2a7f62;
  padding-bottom: 0.25rem;
}

#samples p,
#samples li {
  font-size: 1rem;
  line-height: 1.6;
}

#samples .warning {
  background-color: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 0.5rem;
  margin: 0.5rem 0;
  font-weight: bold;
}

#samples .ok {
  background-color: #e2f7e1;
  border-left: 4px solid #28a745;
  padding: 0.5rem;
  margin: 0.5rem 0;
}

#no-results-message {
  text-align: center;
  background-color: var(--warning-color);
  color: var(--print-text);
  padding: 15px;
  font-weight: 900;
  font-size: 1.4rem;
  margin-top: 1rem;
}

/* --------------------------------------------------
   Back to Top Button
-------------------------------------------------- */
#back-to-top,
#backToTop {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--back-top-color);
  color: #fff;
  border: none;
  border-radius: 50px;
  width: 55px;
  height: 55px;
  font-size: 1.5rem;
  cursor: pointer;
  display: none;
  z-index: 1000;
  opacity: 85%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: background 0.2s;
}

#backToTop:hover {
  background: #060606;
  color: #f7e018;
}

/* --------------------------------------------------
   Layout
-------------------------------------------------- */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.col {
  flex: 1 1 300px;
  min-width: 200px;
  background: #f1f1f1;
  padding: 16px;
  margin-bottom: 16px;
  border-radius: 6px;
  font-size: 1rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* --------------------------------------------------
   Media Queries
-------------------------------------------------- */
@media (min-width: 1024px) {
  #sample-search {
    max-width: 600px;
  }
}

@media (max-width: 600px) {
  #back-to-top {
    width: 70px;
    height: 70px;
    font-size: 1.75rem;
    bottom: 24px;
    right: 24px;
  }

  pre {
    font-size: 1.4rem;
    margin-left: -20px;
    margin-right: -20px;
  }

  .back-button #sample-search,
  ul {
    max-width: 100%;
    font-size: 1.3rem;
  }

  h3 {
    font-size: 1.6rem;
  }
}

@media screen and (max-width: 480px) {
  .back-button,
  #samples,
  ul {
    padding: 1rem;
    max-width: 100%;
    font-size: 1.3rem;
  }
}

/* --------------------------------------------------
   Dark Mode
-------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --html-color: #1b1f1d;
    --heading-color: #cddccf;
    --pre-color: #0e1712;
    --search-box-color: #2c3b2f;
    --back-top-color: #3a5f4a;

    --accent-green: #6f8f72;
    --link-color: #81c784;
    --warning-color: #d4e157;
    --danger-color: #ef5350;

    --dark-pre-text-color: #b9b9b9fe;
    --dark-pre-border-color: #3a4a3e;
  }

  body {
    background-color: var(--html-color);
    color: var(--heading-color);
  }

  #sample-search,
  #sample-filter,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    color: var(--heading-color);
  }

  pre,
  code {
    background-color: var(--pre-color);
    color: var(--dark-pre-text-color);
    border: 1px solid var(--dark-pre-border-color);
  }

  .back-button {
    display: block;
    margin: 20px auto;
    padding: 8px 24px;
    font-size: 11pt;
    font-family: var(--main-font);
    background-color: var(--accent-green);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
  }

  .back-button:hover {
    background-color: var(--warning-color);
  }
}

/* --------------------------------------------------
   Print Styles
-------------------------------------------------- */

@media print {
  html,
  body {
    font-size: 11px;
    padding: 0 !important;
    background: none;
    color: #000;
  }

  pre {
    page-break-inside: avoid;
    font-family: 'Times New Roman', Times, serif !important;
    font-size: 13pt;
    white-space: pre-wrap;
    border: none !important;
    box-shadow: none !important;
  }

  h1 {
    font-size: 15pt !important;
    margin: 0.4em 0;
    font-family: 'Times New Roman', Times, serif !important;
  }

  h2 {
    font-family: 'Times New Roman', Times, serif !important;
  }

  h3 {
    font-size: 13pt !important;
    margin: 0.4em 0;
    position: relative;
    font-family: 'Times New Roman', Times, serif !important;
  }

  h3::after {
    content: '';
    display: block;
    width: 100%;
    border-bottom: 1px solid black;
    margin-top: 0.2em;
  }

  .overview li,
  ul li,
  ol li {
    font-size: 11pt !important;
    margin-bottom: 0.3em;
  }

  .date,
  .time,
  .timestamp {
    font-size: 11pt !important;
    font-family: 'Times New Roman', Times, serif !important;
    white-space: pre-wrap;
    margin: 0.4em 0;
  }

  /* Remove layout wrappers and excess spacing */
  .container,
  .col,
  #samples,
  .wrapper,
  .content,
  div {
    background: none !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-family: 'Times New Roman', Times, serif !important;
    font-size: 13pt;
    line-height: 1.4;
  }

  /* Keep each date + data block together */
  #samples p,
  #samples div,
  #samples span,
  #samples pre {
    page-break-inside: avoid;
    margin: 0.2em 0;
    padding: 0;
  }

  .sample-block {
    page-break-inside: avoid;
    margin: 0.3em 0;
  }

  /* Hide interactive elements */
  #backToTop,
  #changeBtn,
  #filter-controls,
  nav,
  footer {
    display: none !important;
  }

  /* Page footer */
  @page {
    margin: 1in;
    @bottom-center {
      content: 'Weekly count page: ' counter(page);
      font-size: 11pt;
      font-family: 'Times New Roman', Times, serif;
      text-align: right;
    }
  }
}
