body {
  font-family:
    "JetBrains Mono", "Fira Code", "Source Code Pro", "Courier New", monospace;
  font-size: 1rem;
  line-height: 1.4;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  letter-spacing: -0.02em;
  background-color: #121212;
  color: #e0e0e0;
}

header {
  text-align: center;
  margin-bottom: 40px;
}

nav {
  font-size: 0.8rem;
  margin-bottom: 30px;
  text-align: center;
}

nav a {
  margin-right: 1.5rem;
  text-decoration: none;
  color: #e0e0e0;
}

nav a:hover {
  text-decoration: underline;
  color: #ffa500;
}

nav a.active {
  color: #90ee90;
  opacity: 0.8;
}

.content {
  margin-bottom: 30px;
}

h1 {
  color: #44ff44;
  opacity: 0.9;
}

h2 {
  color: #90ee90;
  opacity: 0.8;
}

h3 {
  color: #ffffff;
  opacity: 0.95;
}
/* Only apply orange color to non-nav links */
.content a {
  text-decoration: none;
  color: #ffa500; /* Orange color for unvisited links */
}

.content a:visited {
  color: #ffa500; /* Same orange color for visited links */
}

.link-container p {
  margin: 0.25rem 0;
}

.content ul {
  padding-left: 0;
  list-style-position: inside;
}

.content ol {
  padding-left: 0;
  list-style: none;
  counter-reset: list-counter;
}

.content ol > li {
  counter-increment: list-counter;
}

.content ol > li::before {
  content: counter(list-counter) ".";
  margin-right: 0;
}

/* Nested letter-based ordered lists */
.content ol ol[type="a"] {
  margin-left: 3rem;
  padding-left: 0;
  list-style: none;
  counter-reset: letter-counter;
}

.content ol ol[type="a"] > li {
  counter-increment: letter-counter;
}

.content ol ol[type="a"] > li::before {
  content: counter(letter-counter, lower-alpha) ".";
  margin-right: 0;
}

.content ul li,
.content ol li {
  margin-bottom: 0.25rem;
}

.content ul li:last-child {
  margin-bottom: 0;
}

.info-box {
  border: 1px solid #90ee90;
  padding: 20px;
  padding-top: 0px;
  padding-bottom: 0px;
  margin: 20px 0;
  margin-bottom: 3.5rem;
  padding-bottom: 0.75rem;
}

.sub-list {
  list-style-type: none;
  margin-left: 3rem;
}

.sub-list li::before {
  content: "- ";
  margin-left: -15px;
  padding-right: 5px;
}

.radio-dialogue {
  margin-bottom: 20px;
  font-style: italic;
}

.radio-dialogue p {
  margin: 0.25rem 0;
}

.radio-dialogue p:first-child {
  margin-top: 0;
}

.radio-dialogue p:last-child {
  margin-bottom: 0;
}

/* Dropdown styles */
.dropdown {
  position: relative;
  display: inline-block;
  margin-right: 1.5rem;
}

.dropdown-trigger {
  cursor: pointer;
  margin-right: 0;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #1a1a1a;
  min-width: 134px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 100;
  padding: 8px 0;
  left: 50%;
  transform: translateX(-50%);
}

.dropdown-content a {
  color: #e0e0e0;
  padding: 8px 16px;
  text-decoration: none;
  display: block;
  margin: 0;
}

.dropdown-content a:hover {
  background-color: #2a2a2a;
  text-decoration: none;
}

/* Desktop hover behavior */
@media (hover: hover) {
  .dropdown:hover .dropdown-content {
    display: block;
  }

  .dropdown:hover .dropdown-trigger {
    text-decoration: underline;
    color: #ffa500;
  }
}

/* Mobile styles */
@media (max-width: 768px) {
  body {
    padding: 15px;
  }

  header {
    margin-bottom: 10px;
  }

  /* Increase nav font size and touch targets */
  nav {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1rem;
    font-size: 0.9rem;
    margin-bottom: 5px;
  }

  nav a {
    margin-right: 0;
    padding: 8px 4px;
    min-height: 44px;
    display: flex;
    align-items: center;
    touch-action: manipulation;
  }

  .dropdown {
    position: relative;
  }

  .dropdown-trigger {
    padding: 8px 4px;
    min-height: 44px;
    display: flex;
    align-items: center;
    touch-action: manipulation;
  }

  .dropdown-content {
    position: absolute;
    width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.4);
    margin-top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
  }

  /* Prevent dropdown from going off-screen on left edge */
  .dropdown:first-of-type .dropdown-content {
    left: 0;
    transform: none;
  }

  /* Prevent dropdown from going off-screen on right edge */
  .dropdown:last-of-type .dropdown-content {
    left: auto;
    right: 0;
    transform: none;
  }

  .dropdown-content a {
    padding: 14px 16px;
    min-height: 44px;
    touch-action: manipulation;
  }

  /* Show dropdown when parent has active class */
  .dropdown.active .dropdown-content {
    display: block;
  }

  /* Reduce info box padding */
  .info-box {
    padding: 12px;
    padding-top: 0;
    padding-bottom: 0.75rem;
    margin: 15px 0;
    margin-bottom: 2.5rem;
  }

  /* Reduce nested list indentation */
  .sub-list {
    margin-left: 1.5rem;
  }

  .content ol ol[type="a"] {
    margin-left: 1.5rem;
  }

  /* Make tables horizontally scrollable */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1rem -15px;
    padding: 0 15px;
  }

  .two-column-table {
    min-width: 400px;
  }

  .two-column-table th,
  .two-column-table td {
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
  }

  /* Prevent long links from breaking layout */
  .content a {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Reduce heading sizes slightly */
  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  h3 {
    font-size: 1.1rem;
  }
}

/* Very small screens */
@media (max-width: 400px) {
  body {
    padding: 12px;
  }

  nav {
    gap: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  .info-box {
    padding: 10px;
    padding-top: 0;
    padding-bottom: 0.5rem;
  }

  .sub-list {
    margin-left: 1rem;
  }

  .content ol ol[type="a"] {
    margin-left: 1rem;
  }

  h1 {
    font-size: 1.4rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  .two-column-table th,
  .two-column-table td {
    padding: 0.5rem;
    font-size: 0.85rem;
  }
}

/* Back to top button */
.back-to-top {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background-color: #1a1a1a;
  border: 1px solid #90ee90;
  border-radius: 50%;
  color: #90ee90;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 100;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition:
    opacity 0.3s,
    background-color 0.2s;
}

.back-to-top:hover {
  background-color: #2a2a2a;
}

.back-to-top.visible {
  display: flex;
}

@media (min-width: 769px) {
  .back-to-top {
    display: none !important;
  }
}

/* Two-column table styles */
.two-column-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.two-column-table th,
.two-column-table td {
  border: 1px solid #444;
  padding: 0.75rem 1rem;
  text-align: left;
  vertical-align: top;
}

.two-column-table th {
  background-color: #1a1a1a;
  color: #90ee90;
  font-weight: bold;
}

.two-column-table td {
  background-color: #181818;
}

.two-column-table tr:hover td {
  background-color: #222;
}

/* External link indicator (only for actual external links, not downloads) */
.content a[target="_blank"][href^="http"]::after {
  content: "↗";
  font-size: 1.2em;
  margin-left: 0.15em;
  opacity: 0.7;
}

/* Scroll margin for anchor links */
[id] {
  scroll-margin-top: 1rem;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Fluid typography with clamp */
h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
}

h2 {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
}

h3 {
  font-size: clamp(1rem, 2.5vw, 1.17rem);
}

/* Collapsible FAQ sections */
.faq-section {
  margin-bottom: 1.5rem;
}

.faq-section-header {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.faq-section-header::after {
  content: "−";
  font-size: 1.2rem;
  font-weight: bold;
  color: #90ee90;
  margin-left: 0.5rem;
}

.faq-section.collapsed .faq-section-header::after {
  content: "+";
}

.faq-section-content {
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.faq-section.collapsed .faq-section-content {
  max-height: 0 !important;
}

.faq-controls {
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
}

.faq-controls button {
  background: transparent;
  border: 1px solid #90ee90;
  color: #90ee90;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
}

.faq-controls button:hover {
  background: #1a1a1a;
}

/* Glossary alphabet navigation */
.glossary-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background: #1a1a1a;
  border-radius: 4px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.glossary-nav a {
  padding: 0.25rem 0.5rem;
  text-decoration: none;
  color: #90ee90;
  font-size: 0.9rem;
}

.glossary-nav a:visited {
  color: #90ee90;
}

.glossary-nav a:hover {
  background: #2a2a2a;
  border-radius: 2px;
}

/* Offset anchor scroll position to account for sticky nav */
.content [id] {
  scroll-margin-top: 100px;
}

/* Highlight the targeted term */
.content p:target,
.content p.highlighted {
  background: rgba(144, 238, 144, 0.15);
  border-left: 3px solid #90ee90;
  padding-left: 0.75rem;
  margin-left: -0.75rem;
  border-radius: 0 4px 4px 0;
}

/* Sticky nav on mobile */
@media (max-width: 768px) {
  header {
    position: sticky;
    top: 0;
    background: #121212;
    z-index: 50;
    padding-top: 10px;
    margin-top: -10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #333;
  }

  header {
    transition: margin-bottom 0.3s ease;
  }

  header h1 {
    transition:
      max-height 0.3s ease,
      opacity 0.2s ease,
      margin 0.3s ease;
    max-height: 100px;
    overflow: hidden;
  }

  body.scrolled header {
    margin-bottom: 10px;
  }

  body.scrolled header h1 {
    max-height: 0;
    opacity: 0;
    margin: 0;
  }

  /* Increase line-height on mobile */
  body {
    line-height: 1.6;
  }

  /* Increase paragraph spacing on mobile */
  .content p {
    margin-bottom: 1rem;
  }

  .content p:last-child {
    margin-bottom: 0;
  }

  /* Adjust scroll margin for sticky header */
  [id] {
    scroll-margin-top: 120px;
  }

  /* Glossary nav adjustments for mobile */
  .glossary-nav {
    top: 0;
    margin-left: -15px;
    margin-right: -15px;
    border-radius: 0;
    padding: 0.5rem;
  }

  .glossary-nav a {
    padding: 0.4rem 0.6rem;
    min-height: 36px;
    display: flex;
    align-items: center;
  }

  /* FAQ controls on mobile */
  .faq-controls {
    position: sticky;
    top: 0;
    background: #121212;
    padding: 0.5rem 0;
    z-index: 5;
    margin-left: -15px;
    margin-right: -15px;
    padding-left: 15px;
    padding-right: 15px;
    border-bottom: 1px solid #333;
  }
}

@media (max-width: 400px) {
  .glossary-nav a {
    padding: 0.3rem 0.4rem;
    font-size: 0.85rem;
  }

  [id] {
    scroll-margin-top: 100px;
  }
}

/* Subtitle link (e.g., PDF download under title) */
.subtitle-link {
  text-align: center;
  opacity: 0.6;
  margin-top: -2rem;
}

@media (max-width: 768px) {
  .subtitle-link {
    margin-top: -0.5rem;
  }
}

/* Footer */
footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #333;
  text-align: center;
  font-size: 0.8rem;
  color: #90ee90;
  opacity: 0.8;
}
