:root {
  --main-font-family: Georgia, "Times New Roman", serif;
  --link-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Light mode variables */
  --background-color: #fff;
  --background-secondary: #f8f9fa;
  --text-color: #212529;
  --text-secondary: #6c757d;
  --border-color: #dee2e6;
  --shadow-color: rgba(0, 0, 0, 0.15);
  --primary-text: #58151c;
  --secondary-text: #052c65;
  --link-hover-color: #555;
  --link-hover-color-rgb: 85, 85, 85;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark mode variables */
    --background-color: #161618;
    --background-secondary: #343a40;
    --text-color: #f8f9fa;
    --text-secondary: #adb5bd;
    --border-color: #495057;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --primary-text: #ffddb3;
    --secondary-text: #c6e2ff;
    --link-hover-color: #ddd;
    --link-hover-color-rgb: 221, 221, 221;
  }
}

/* ===== BASE STYLES ===== */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--main-font-family);
  background-color: var(--background-color);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: inherit;
}

img {
  vertical-align: middle;
  max-width: 100%;
  height: auto;
}

ul, ol {
  padding-left: 2rem;
  margin-top: 0;
  margin-bottom: 1rem;
}

/* ===== GRID SYSTEM ===== */
.container {
  --bs-gutter-x: 1.5rem;
  width: 100%;
  padding-right: calc(var(--bs-gutter-x) * 0.5);
  padding-left: calc(var(--bs-gutter-x) * 0.5);
  margin-right: auto;
  margin-left: auto;
  flex: 1 0 auto;
}

@media (min-width: 576px) {
  .container {
    max-width: 540px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 720px;
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
}

.row {
  --bs-gutter-x: 1.5rem;
  --bs-gutter-y: 0;
  display: flex;
  flex-wrap: wrap;
  margin-top: calc(-1 * var(--bs-gutter-y));
  margin-right: calc(-0.5 * var(--bs-gutter-x));
  margin-left: calc(-0.5 * var(--bs-gutter-x));
}

.row > * {
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  padding-right: calc(var(--bs-gutter-x) * 0.5);
  padding-left: calc(var(--bs-gutter-x) * 0.5);
  margin-top: var(--bs-gutter-y);
}

.row.g-0 {
  --bs-gutter-x: 0;
  --bs-gutter-y: 0;
}

.col {
  flex: 1 0 0%;
}

.col-2 {
  flex: 0 0 auto;
  width: 16.66666667%;
}

.col-5 {
  flex: 0 0 auto;
  width: 41.66666667%;
}

.col-8 {
  flex: 0 0 auto;
  width: 66.66666667%;
}

@media (min-width: 1200px) {
  .col-xl-4 {
    flex: 0 0 auto;
    width: 33.33333333%;
  }
}

@media (min-width: 1400px) {
  .col-xxl-3 {
    flex: 0 0 auto;
    width: 25%;
  }
}

/* ===== SPACING UTILITIES ===== */
.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-auto { margin-bottom: auto !important; }
.my-2 { margin-top: 0.5rem !important; margin-bottom: 0.5rem !important; }
.my-4 { margin-top: 1.5rem !important; margin-bottom: 1.5rem !important; }
.mx-2 { margin-left: 0.5rem !important; margin-right: 0.5rem !important; }
.mx-3 { margin-left: 1rem !important; margin-right: 1rem !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }

.p-4 { padding: 1.5rem !important; }
.px-0 { padding-left: 0 !important; padding-right: 0 !important; }
.py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.pt-3 { padding-top: 1rem !important; }
.pb-0 { padding-bottom: 0 !important; }
.ps-3 { padding-left: 1rem !important; }

/* ===== DISPLAY UTILITIES ===== */
.d-none { display: none !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }

@media (min-width: 768px) {
  .d-md-none { display: none !important; }
  .d-md-inline { display: inline !important; }
  .d-md-block { display: block !important; }
}

@media (min-width: 992px) {
  .d-lg-none { display: none !important; }
  .d-lg-inline { display: inline !important; }
  .d-lg-inline-block { display: inline-block !important; }
  .d-lg-block { display: block !important; }
  .d-lg-flex { display: flex !important; }
}

/* ===== FLEXBOX UTILITIES ===== */
.flex-column { flex-direction: column !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-evenly { justify-content: space-evenly !important; }
.align-items-center { align-items: center !important; }

@media (min-width: 768px) {
  .flex-md-row { flex-direction: row !important; }
}

/* ===== GAP UTILITIES ===== */
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }

@media (min-width: 576px) {
  .gap-sm-5 { gap: 3rem !important; }
}

/* ===== TYPOGRAPHY ===== */
h3 {
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.2;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.h2 {
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.2;
  margin: 0;
}

.h4 {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
  margin: 0;
}

.h5 {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.2;
  margin: 0;
}

h5 {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.2;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.text-center { text-align: center !important; }
.text-start { text-align: left !important; }
.fst-italic { font-style: italic !important; }
.lh-1 { line-height: 1 !important; }

small {
  font-size: 0.875em;
}

/* ===== COLOR UTILITIES ===== */
.text-secondary {
  color: var(--text-secondary) !important;
}

.text-muted {
  color: var(--text-secondary) !important;
}

.text-body-emphasis {
  color: var(--text-color) !important;
}

.bg-body-secondary {
  background-color: var(--background-secondary) !important;
}

.link-secondary {
  color: var(--text-secondary) !important;
  text-decoration: none;
}

.link-secondary:hover {
  color: var(--link-hover-color) !important;
}

.border-secondary {
  border-color: var(--border-color) !important;
}

/* ===== BORDERS ===== */
.border {
  border: 1px solid var(--border-color) !important;
}

.border-bottom {
  border-bottom: 1px solid var(--border-color) !important;
}

.rounded {
  border-radius: 0.375rem !important;
}

/* ===== SHADOWS ===== */
.shadow-sm {
  box-shadow: 0 0.125rem 0.25rem var(--shadow-color) !important;
}

.shadow {
  box-shadow: 0 0.5rem 1rem var(--shadow-color) !important;
}

/* ===== POSITIONING ===== */
.position-relative { position: relative !important; }
.position-static { position: static !important; }

/* ===== SIZING ===== */
.w-100 { width: 100% !important; }

/* ===== NAVIGATION ===== */
.navbar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.navbar-expand {
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.navbar-nav {
  display: flex;
  flex-direction: row;
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}

.nav-item {
  display: list-item;
}

.nav-link {
  display: block;
  padding: 0.5rem 0;
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}

.nav-link:hover {
  color: var(--link-hover-color);
}

/* ===== LIST GROUPS ===== */
.list-group {
  display: flex;
  flex-direction: column;
  padding-left: 0;
  margin-bottom: 0;
}

.list-group-flush {
  border-radius: 0;
}

.list-group-flush .list-group-item {
  border-width: 0 0 1px;
}

.list-group-flush .list-group-item:last-child {
  border-bottom-width: 0;
}

.list-group-item {
  position: relative;
  display: block;
  padding: 0.5rem 1rem;
  background-color: transparent;
  border: 1px solid var(--border-color);
}

/* ===== HR ===== */
hr {
  margin: 1rem 0;
  color: var(--border-color);
  border: 0;
  border-top: 1px solid;
  opacity: 0.25;
}

/* ===== LINKS ===== */
.link {
  font-family: var(--link-font-family);
  color: var(--link-color);
  text-decoration: none;
}

.link:hover {
  color: var(--link-hover-color);
}

.link-underline-opacity-0 {
  text-decoration: none;
}

.icon-link {
  text-decoration: none;
}

.icon-link-hover:hover {
  text-decoration: underline;
}

/* ===== UL/LIST ===== */
.list {
  margin-top: 0;
  margin-bottom: 1rem;
}

/* ===== CUSTOM COMPONENT STYLES ===== */
.header-icon svg {
  display: block;
}

.section {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.paper-container {
  padding: 0.8rem;
}

.paper-title {
  font-size: calc(1.0rem + 0.1vw);
  font-weight: 500;
}

.paper-link {
  font-size: calc(0.7rem + 0.1vw);
}

.venue-name {
  font-size: calc(0.85rem + 0.1vw);
  font-weight: 500;
}

.author-name, .project-desc, .tldr {
  font-size: calc(0.7rem + 0.1vw);
}

.card-text {
  margin-top: 0;
  margin-bottom: 0;
}

.primary-text {
  color: var(--primary-text);
}

.secondary-text {
  color: var(--secondary-text);
}

blockquote {
  border-left: 4px solid var(--border-color);
  margin: 1.5em 0;
  padding: 0.5em 1em;
  background-color: var(--background-secondary);
}

blockquote p {
  margin: 0;
}

footer {
  margin-top: 0rem;
  padding: 1rem 0;
  width: 100%;
  flex-shrink: 0;
}

.footer-text {
  font-size: 0.8rem;
  font-family: var(--link-font-family);
}

.dark-mode-text {
  display: none;
}

.light-mode-text {
  display: inline;
}

@media (prefers-color-scheme: dark) {
  .dark-mode-text {
    display: inline;
  }

  .light-mode-text {
    display: none;
  }
}

/* ===== TRANSITIONS ===== */
.transition-shadow {
  transition: box-shadow 0.2s ease-in-out;
}
