:root {
  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --text-primary: #222;
  --text-secondary: #555;
  --border: #e0e0e0;
  --purple: #7c4dff;
  --green: #43a047;
  --shadow: rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --border: #30363d;
    --purple: #c2a0ff;
    --green: #7ee787;
    --shadow: rgba(0, 0, 0, 0.3);
  }
}

/* Base */
html {
  box-sizing: border-box;
  scroll-behavior: smooth;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, "JetBrains Mono", "SF Mono", Consolas, monospace;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-primary);
}

/* Content */
#content {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  background: var(--bg-secondary);
  box-shadow: 0 4px 20px var(--shadow);
  border-radius: 12px;
  margin-bottom: 2rem;
}

/* Header */
#preamble {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.site-name {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  background: linear-gradient(135deg, var(--purple), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-affiliation {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 0 0 1rem 0;
}

.navbar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.navbar a {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.navbar a:hover {
  background: var(--purple);
  color: white;
}

/* Headings */
h1.title, h2 {
  color: var(--text-primary);
  border-bottom-color: var(--purple);
}

h2 {
  font-size: 1.6rem;
  margin-top: 2.5rem;
  padding-bottom: 0.5rem;
  position: relative;
}

h2::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, var(--purple), var(--green));
}

/* Links */
a {
  color: var(--purple);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--green);
}

/* Code */
pre.src, code {
  font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
  font-size: 0.95rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
}

pre.src {
  padding: 1rem 1.25rem;
  overflow-x: auto;
  box-shadow: inset 0 2px 8px var(--shadow);
}

/* Footer */
#postamble {
  text-align: center;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 3rem;
}

#postamble p.validation,
#postamble p.author {  /* Hide author/validation */
  display: none;
}

#postamble p.date {
  margin: 0;
}

#postamble p.date::after {  /* Versions + License (simulate %c) */
  content: " • Licensed under CC BY-NC-SA 4.0";
  font-weight: 500;
  margin-left: 0.25rem;
}

@media (prefers-color-scheme: dark) {
  #postamble p.date::before {
    filter: brightness(1.2);
  }
}

/* Responsive */
@media (max-width: 768px) {
  #content {
    padding: 2rem 1.25rem;
    margin: 1rem;
    border-radius: 8px;
  }
  
  .navbar {
    gap: 1rem;
  }
}

/* Image Profile Picture */
div.figure {
  float: left;
  margin: 0 2rem 1rem 0; /* Reduced right margin for better text wrap */
  width: 220px; /* Matches your :width */
}

div.figure img {
  border-radius: 50%; /* Perfect circle for profile photo */
  width: 220px;
  height: 220px;
  object-fit: cover; /* Handles non-square images gracefully */
  box-shadow: 0 4px 12px var(--shadow);
  display: block; /* Removes inline gaps */
  margin: 0 auto;
}

/* mobile: stack image and text */
@media (max-width: 600px) {
  div.figure {
    float: none;           /* cancel float so text won't flow beside image */
    display: block;
    width: 100%;           /* full width on mobile */
    margin: 0 0 1rem 0;    /* spacing under image */
    text-align: center;    /* optional: center image/caption */
  }
  div.figure img {
    width: 140px;          /* keep a reasonable image size */
    max-width: 100%;
    height: auto;
    margin: 0 auto;        /* center */
    border-radius: 50%;
  }
  /* ensure parent contains flow and text stacks under image */
  .section, #content { overflow: visible; } /* usually not required but safe */
}

/* Org bullets/discs green site-wide */
ul { list-style-type: disc; }
ul > li::marker { 
  color: #43a047; 
}
li { 
  color: inherit; 
  margin-bottom: 0.5rem; 
}

/* Nested */
ul ul > li::marker { color: #7c4dff; }
