:root {
  --duration: 1s;
  --nav-duration: calc(var(--duration) / 4);
  --ease: cubic-bezier(0.215, 0.61, 0.355, 1);
  --space: 1rem;
  --font-size: 1em;
  --line-height: 1.5;
  --inputicon: hsla(0, 0%, 0%, 0.87);
  --toggledinputicon: white;
  --formbg: hsla(0, 0%, 0%, 0.25);
  --formhover: hsla(0, 0%, 0%, 0.32);
  --toggledform: hsla(0, 0%, 100%, 0.12);
  --toggledformhover: hsla(0, 0%, 100%, 0.3);
  --avatar: url("../../assets/images/index/avatardark.svg");
  --articlebg: hsla(0, 0%, 0%, 0.04);
  --content1-height: 190px;
  --content6-height: 383px;
  --filter-active: var(--md-default-fg-color);
  --filter-inactive: var(--md-default-fg-color);
}

[data-md-color-scheme="slate"] {
  --inputicon: white;
  --toggledinputicon: hsla(0, 0%, 0%, 0.87);
  --formhover: hsla(0, 0%, 100%, 0.3);
  --toggledform: hsla(0, 0%, 0%, 0.2);
  --toggledformhover: hsla(0, 0%, 0%, 0.32);
  --avatar: url("../../assets/images/index/avatarlight.svg");
  --articlebg: hsla(234, 76%, 95%, 0.04);
}

.logo {
  content: var(--avatar);
}

@media screen and (min-width: 76.25em) {
  .md-sidebar--primary {
      display: none;
  }
}

.md-sidebar {
  width: 0px;
}

.md-main__inner {
  margin: 0;
  height: calc(var(--content1-height) + var(--content6-height));
}

.md-source {
  color: var(--md-default-fg-color);  
}

.toggle .socialsparent {
  display: none;
}

.close {
  display: none;
}

.toggle .close {
  display: flex;
}

.toggle .menu {
  display: none;
}

.md-header__button.md-icon[for="__search"] {
  color: var(--md-default-fg-color); 
}

.toggle .md-header__button.md-icon[for="__search"] {
  color: var(--md-default-bg-color);
}

.md-search__input + .md-search__icon {
  color: var(--inputicon);
}

.toggle .md-search__input + .md-search__icon {
  color: var(--toggledinputicon);
}

.md-search__form {
  background-color: var(--formbg);
}

.md-search__form:hover {
  background-color: var(--formhover);
}

.toggle .md-search__form {
  background-color: var(--toggledform);
}

.toggle .md-search__form:hover {
  background-color: var(--toggledformhover);
}

.menu {
  color: var(--md-default-fg-color);
}

.close {
  color: var(--md-default-bg-color);
}

.md-header__option {
  color: var(--md-default-fg-color);
}

.toggle .md-header__option {
  color: var(--md-default-bg-color);
}

.md-header[data-md-state=shadow] {
  box-shadow: 0 0 0 rgba(0, 0, 0, 0), 0 0 0 rgba(0, 0, 0, 0);
}

.md-header {
  background: none;
  box-shadow: 0 0 0 transparent, 0 0 0 transparent;
}

.md-header p {
  display: none;
}

.md-tabs {
  display: none;
}

.logo {
  padding-left: 0;
}

.blur-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100px;
  pointer-events: none;
  z-index: 2;
  backdrop-filter: blur(48px);
  -webkit-backdrop-filter: blur(48px);
  mask-image: linear-gradient(
    to bottom,
    black 0%,
    rgba(0, 0, 0, 0.9) 20%,
    rgba(0, 0, 0, 0.6) 45%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    black 0%,
    rgba(0, 0, 0, 0.9) 20%,
    rgba(0, 0, 0, 0.6) 45%,
    transparent 100%
  );
}

.main-navigation {
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  transform: translateX(-100%);
  transition: transform var(--nav-duration);
  background-color: var(--md-default-fg-color);
  z-index: 3;
}

.main-navigation:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: inherit;
  transform-origin: 0 50%;
  z-index: 3;
}

.main-navigation ul {
  font-size: 9vmin;
  width: 100%;
  height: auto;
  z-index: 4;
}

.main-navigation li {
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  z-index: 4;
  margin-top: -0.3em;
  margin-bottom: -0.3em;
}

.main-navigation li:after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: auto;
  background-color: inherit;
  transform-origin: 0 50%;
  transform: translateX(-100%) skew(15deg);
  z-index: 4;
}

.main-navigation a {
  display: inline-block;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  color: var(--md-default-bg-color);
  font-family: "Crimson Pro";
  font-size: 1.2em;
  line-height: 1.2;
  text-decoration: none;
  user-select: none;
  padding: auto;
  transform: translateY(100%);
  z-index: 4;
}

.main-navigation a:hover {
  cursor: pointer;
  color: var(--md-default-bg-color);
}

.main-content {
  z-index: 1;
}

.home, .proj, .writ {
  transition: all 0.3s ease;
}

.home:hover, .proj:hover, .writ:hover {
  font-style: italic;
}

.navnum {
  font-size: 0.35em;
  font-weight: lighter;
  font-style: italic;
}

.content1 {
  position: absolute;
  width: 100%;
  max-width: 1350px;
  height: 100px;
  top: 24em;
  left: 50%;
  transform: translateX(-50%);
  margin-top: -100px;
  margin-bottom: 0;
  padding-left: 7em;
  padding-right: 7em;
}

.introabt {
  margin-top: -5em;
}

.introabt h2 {
  color: var(--md-default-fg-color);
  font-family: "Crimson Pro";
  font-size: 2.8125em;
  font-style: normal;
  font-weight: 400;
  line-height: normal;
  margin-bottom: 0em;
}

.introabt h2 a{
  color: var(--md-default-fg-color);
}

.introabt h2 a:hover {
  color: var(--md-default-fg-color);
}

.introabt h2 span {
  font-style: italic;
}

.introabt h3 {
  color: var(--md-default-fg-color);
  font-family: "JetBrains Mono";
  font-size: 1.1875em;
  font-style: normal;
  font-weight: 400;
  line-height: 109.588%;
}

.intro-section {
  margin-top: 14em;
}

/* Filter Controls */
.filter-controls {
  margin-top: 1em;
  margin-left: -0.5em;
  display: flex;
  align-items: center;
  gap: 0.25em;
  font-family: "JetBrains Mono";
  font-size: 0.95em;
  font-weight: 300;
}

.filter-btn {
  background: none;
  border: none;
  color: var(--md-default-fg-color);
  opacity: 0.45;
  font-family: "JetBrains Mono";
  font-size: 1em;
  font-weight: 300;
  cursor: pointer;
  padding: 0.25em 0.5em;
  transition: all 0.2s ease;
  position: relative;
}

.filter-btn:hover {
  opacity: 0.7;
}

.filter-btn.active {
  opacity: 0.85;
}

.filter-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0.5em;
  right: 0.5em;
  height: 1px;
  background: var(--md-default-fg-color);
  opacity: 0.5;
}

/* Books Grid Section */
.content6 {
  position: absolute;
  width: 100%;
  height: auto;
  left: 50%;
  max-width: 1350px;
  transform: translateX(-50%);
  padding-left: 7em;
  padding-right: 7em;
  top: calc(var(--content1-height) + 22em + 60px);
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 2em;
  width: 100%;
}

.book-item {
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  transform-origin: center;
  opacity: 0;
}

.book-item.visible {
  animation: fadeIn 0.5s ease-out forwards;
}

.book-item:hover {
  transform: scale(0.97);
  cursor: pointer;
}

.book-item a {
  text-decoration: none;
  color: inherit;
}

.book-cover {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--md-default-fg-color--lightest);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.3s ease;
}

.book-item:hover .book-cover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Article/Paper items - landscape orientation */
.book-item.article .book-cover {
  aspect-ratio: 4/3;
}

.book-title {
  margin-top: 0.5em;
  margin-bottom: 0;
  color: var(--md-default-fg-color);
  opacity: 0.75;
  font-family: "JetBrains Mono";
  font-size: 0.9em;
  font-weight: 300;
  line-height: 1.25;
}

.book-author {
  margin-top: 0.2em;
  margin-bottom: 0;
  color: var(--md-default-fg-color);
  opacity: 0.45;
  font-family: "JetBrains Mono";
  font-size: 0.75em;
  font-weight: 300;
  line-height: 1.2;
}

.book-date {
  margin-top: 0.2em;
  margin-bottom: 0;
  color: var(--md-default-fg-color);
  opacity: 0.3;
  font-family: "JetBrains Mono";
  font-size: 0.7em;
  font-weight: 300;
  line-height: 1.2;
}

.favorite-indicator {
  display: none;
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  width: 1.5em;
  height: 1.5em;
  background: var(--md-default-bg-color);
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.book-item[data-favorite="true"] .favorite-indicator {
  display: flex;
}

.favorite-indicator::after {
  content: '★';
  font-size: 0.85em;
  color: #d4a017;
}

.book-cover-wrapper {
  position: relative;
}

/* Currently Reading Badge */
.reading-badge {
  position: absolute;
  bottom: 0.5em;
  left: 0.5em;
  background: var(--md-default-fg-color);
  color: var(--md-default-bg-color);
  font-family: "JetBrains Mono";
  font-size: 0.6em;
  font-weight: 500;
  padding: 0.25em 0.5em;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.book-item[data-reading="true"] .book-date {
  font-style: italic;
}

/* Footer */
.content8 {
  position: absolute;
  width: 100%;
  height: auto;
  left: 50%;
  max-width: 1350px;
  transform: translateX(-50%);
  padding-left: 7em;
  padding-right: 7em;
  top: calc(var(--content1-height) + var(--content6-height) + 28em);
}

.socialpar {
  display: inline-block;
  margin-left: -7.5px;
  width: 32px;
  height: 32px;
  padding: 8.39px 8.25px 7.61px 8.25px;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.fa-github, .fa-x-twitter, .fa-paper-plane {
  width: 15.5px;
  height: 16px;
  flex-shrink: 0;
  color: var(--md-default-fg-color);
  opacity: 0.9;
  transition: all 0.3s ease;
}

.fa-github:hover, .fa-x-twitter:hover, .fa-paper-plane:hover {
  scale: 0.92;
  opacity: 0.8;
}

.copyright {
  margin-top: 0.5em;
  margin-bottom: 10em;
  color: var(--md-default-fg-color);
  opacity: 0.9;
  font-family: "JetBrains Mono";
  font-size: 0.8em;
  font-style: normal;
  font-weight: 400;
  line-height: 20.48px;
}

.toggle .main-navigation {
  transition-duration: 0.35;
  transform: translateX(0);
}

.toggle .main-navigation a {
  animation: link-appear calc(var(--duration) * 1.5) var(--ease) forwards;
}

@keyframes link-appear {
  0%, 25% {
      transform: translateY(100%);
  }
  50%, 100% {
      transform: translateY(0);
  }
}

@media (max-width: 59.892857142857146em) {
  .toggle .md-search__icon.md-icon:first-of-type {
      color: var(--md-default-fg-color);
  }
}

@media screen and (min-width: 2000px) {
  :root {
    --font-size: 1em;
  }
  .introabt h2 {
    font-size: 2.5em;
  }
  .introabt h3 {
    font-size: 0.98em;
  }
  .filter-controls {
    font-size: 0.85em;
  }
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  .book-title {
    font-size: 0.8em;
  }
  .book-author {
    font-size: 0.65em;
  }
  .book-date {
    font-size: 0.6em;
  }
  .copyright {
    font-size: 0.8em;
  }
}

@media (max-width: 1200px) {
  .main-navigation a {
    font-size: 1.1em;
  }
  body {
    font-size: 0.9em;
  }
  .content1 {
    padding-left: 1em;
    padding-right: 1em;
  }
  .content6, .content8 {
    padding-left: 1em;
    padding-right: 1em;
  }
  .introabt h2 {
    font-size: 2.5em;
  }
  .introabt h3 {
    font-size: 1em;
  }
  .filter-controls {
    font-size: 0.85em;
  }
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5em;
  }
  .content6 {
    top: calc(var(--content1-height) + 22em + 20px);
  }
  .content8 {
    top: calc(var(--content1-height) + var(--content6-height) + 25em);
  }
}

@media (max-width: 860px) {
  .content1 {
    padding-left: 1em;
    padding-right: 1em;
  }
  .content6, .content8 {
    padding-left: 1em;
    padding-right: 1em;
  }
  .introabt h2 {
    font-size: 2.5em;
  }
  .introabt h3 {
    font-size: 1em;
  }
  .filter-controls {
    font-size: 0.8em;
    flex-wrap: wrap;
  }
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.25em;
  }
}

@media (max-width: 695px) {
  :root{
    --content6-height: 700px;
  }
  .main-navigation a {
    font-size: 1.5em;
  }
  body {
    font-size: 0.8em;
  }
  .content1 {
    padding-left: 1em;
    padding-right: 1em;
  }
  .content6, .content8 {
    padding-left: 1em;
    padding-right: 1em;
  }
  .introabt h2 {
    font-size: 1.9em;
  }
  .introabt h3 {
    font-size: 0.8em;
  }
  .filter-controls {
    font-size: 0.75em;
    gap: 0.3em;
  }
  .filter-btn {
    padding: 0.2em 0.35em;
  }
  .filter-btn-toggle {
    padding: 0.15em 0.45em;
  }
  .content6 {
    top: calc(var(--content1-height) + 21em);
  }
  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1em;
  }
  .book-title {
    font-size: 0.8em;
  }
  .book-author {
    font-size: 0.65em;
  }
  .book-date {
    font-size: 0.6em;
  }
  .content8 {
    top: calc(var(--content1-height) + var(--content6-height) + 22em);
  }
  .copyright {
    font-size: 0.6em;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.intro-section,
.bookshelf,
.footer {
  opacity: 0;
  transition: none;
}

.intro-section.visible,
.bookshelf.visible,
.footer.visible {
  animation: fadeIn 0.6s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
  .intro-section,
  .bookshelf,
  .footer,
  .book-item {
    opacity: 1 !important;
  }
  .intro-section.visible,
  .bookshelf.visible,
  .footer.visible,
  .book-item.visible {
    animation: none !important;
  }
}

