: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;
}

small {
  font-size: 0.875em;
}

hr {
  margin: 1rem 0;
  color: var(--text-secondary);
  border: 0;
  border-top: 1px solid;
  opacity: 0.7;
}

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;
}

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

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

/* ===== GRID SYSTEM ===== */
.container {
  --bs-gutter-x: 1.5rem;
  width: 100%;
  max-width: 1320px;
  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: 800px) {
  .container {
    padding-right: 4rem;
    padding-left: 4rem;
  }
}

.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%;
  }
}

/* ===== 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);
}

/* ===== LINKS ===== */
.link {
  font-family: var(--link-font-family);
  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);
}

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;
  }
}

.transition-shadow {
  transition: box-shadow 0.2s ease-in-out;
}

/* ===== UTILITIES (must be last to override component styles) ===== */

/* Typography utilities */
.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;
}

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

/* Color utilities */
.text-secondary {
  color: var(--text-secondary);
}

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

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

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

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

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

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

/* Border utilities */
.border {
  border: 1px solid var(--border-color);
}

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

header.border-bottom {
  border-bottom: 4px double var(--text-secondary);
}

.rounded {
  border-radius: 0.375rem;
}

/* Shadow utilities */
.shadow-sm {
  box-shadow: 0 0.125rem 0.25rem var(--shadow-color);
}

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

/* Positioning utilities */
.position-relative { position: relative; }
.position-static { position: static; }

/* Sizing utilities */
.w-100 { width: 100%; }

/* Display utilities */
.d-none { display: none; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-block { display: block; }
.d-flex { display: flex; }

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

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

/* Flexbox utilities */
.flex-column { flex-direction: column; }
.flex-nowrap { flex-wrap: nowrap; }
.flex-grow-1 { flex-grow: 1; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.justify-content-evenly { justify-content: space-evenly; }
.align-items-center { align-items: center; }

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

/* Gap utilities */
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

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

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

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