@font-face {
  font-family: IranSans;
  src: url("../fonts/Iransans/IRANSansWeb.woff") format("woff");
}

@font-face {
  font-family: SourceCodePro;
  src: url("../fonts/SourceCodePro/SourceCodePro-Regular.ttf") format("truetype");
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* outline: 1px solid green; */
}

:root {
  --bg-color: #080808;
  --black-color: hsl(0, 0%, 13%);
  --text-color: #cdcdcd;
  --primary-color: #708090;
  --secondary-color: #b6927b;
  --gray-color: #909090;
  --mobile-gap: 2rem;
  --mobile-margin: 1rem;
  --font: IranSans;
  --monospace: SourceCodePro;
}


body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font);
}

.container {
  min-height: 100vh;
  max-width: 40em;
  margin: 3em auto;
  display: flex;
  flex-direction: column;
  direction: rtl;
  text-align: right;
}

/* ------------- */
/* global */
/* ------------- */
p {
  line-height: 1.7;
}

ul {
  list-style-type: none;
}

a {
  text-decoration: none;
  color: var(--primary-color);
}

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

img {
  display: block;
}

article {
  max-width: 80ch;
}

main {
  flex: 1;
}

header {
  margin-bottom: 3em;
}

.post blockquote {
  border-right: 5px solid var(--gray-color);
  background-color: var(--black-color);
  padding: 0.5em 1em;
  border-radius: 5px;
  margin-block: 1em;

  >p {
    margin: 0;
  }
}

code, pre {
  font-family: var(--monospace), monospace;
  line-height: 1.5;
  font-size: 14px;
}
.codehilite {
  direction: ltr;
  text-align: left;
  padding: .5em 1em;
  border-radius: 5px;
  margin-bottom: 1em;
}

/* ------------ */
/* Dark mode    */
/* ------------ */
.dark {
  color: var(--text-color);
  background: var(--bg-color);
}

/* Light theme */
.light {
  color: var(--bg-color);
  background: var(--text-color);

  blockquote {
    background-color: var(--gray-color);
    border-right: 5px solid var(--black-color);
  }
}

.switcher i {
  cursor: pointer;
  color: var(--secondary-color);
}


nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav .logo {
  margin-left: auto;
  font-size: 1.5rem;
  font-weight: bold;
}

.menu ul {
  display: flex;
  gap: 1rem;
}

.ham {
  display: none;
  /* Hidden by default (for desktop) */
  cursor: pointer;
  font-size: 24px;
}

/* Intro (me) section */
.intro {
  margin-top: 3em;
  margin-bottom: 6em;
  display: flex;
}

.slogan {
  margin: 0 auto;
}

.me img {
  width: 142px;
  height: 142px;
  border-radius: 50%;
  border: 5px solid transparent;
  background: linear-gradient(to top,
      var(--primary-color),
      var(--secondary-color)) border-box;
  animation: fadeIn 3s;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

.slogan h1 {
  font-size: 2rem;
  /* For animation */
  overflow: hidden;
  white-space: nowrap;
  animation: typing 2.5s steps(40, end);
}

.slogan h2,
.social-links {
  animation: fadeIn 5s;
}

@keyframes typing {
  from {
    width: 0;
  }

  to {
    width: 100%;
  }
}

.slogan h2 {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--gray-color);
  margin-top: 0.5em;
}

.social-links ul {
  display: flex;
  gap: 2em;
  /* gap between social links */
  margin-top: 1em;
  /* margin between social links and slogan */
}

/* Reading progressbar */
.progress-container {
  width: 100%;
  height: 5px;
  background: var(--bg-color);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99;
}

.progress-bar {
  height: 100%;
  background: var(--secondary-color);
  width: 0%;
}

.recent-posts-header,
.blog-header {
  margin-bottom: .5em;
}

.post p {
  margin-block: 0.2em 1em;
  text-align: justify;

}

.post ul {
  list-style-type: disc;
  margin-block: 0.2em 1em;
  margin-right: 2em;
}

/* p that has a ul after */
.post p:has(+ ul) {
  margin-bottom: 0;
  font-weight: bold;
}

.post img {
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  margin-block: 2em 1em;
  border-radius: 5px;
}

/* img caption */
.post p:has(img)+p {
  color: var(--gray-color);
  text-align: center;
  font-size: 0.9rem;
}

.post-info {
  font-size: 0.9rem;
}

.post-info ul {
  margin-right: 0;
}

.post-info ul li {
  color: var(--gray-color);
  display: inline;
  padding-left: 1em;
}

.post-info ul li i {
  padding-left: 5px;
}

/* footer */
footer {
  display: flex;
  justify-content: space-between;
  flex-direction: row-reverse;
  align-items: center;
  margin-top: 3em;
}

footer h3 {
  color: var(--gray-color);
  font-size: 0.85rem;
}

/* links in footer */
footer div ul {
  display: flex;
  flex-direction: row-reverse;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

/* responsive */
@media (max-width: 768px) {
  .container {
    margin: 1.6em;
  }

  nav ul li a {
    font-size: 0.75rem;
  }

  .logo a {
    font-size: 1.3rem;
    font-weight: bold;
  }

  .menu ul {
    display: none;
    flex-direction: column;
    background-color: var(--bg-color);
    border: 2px solid var(--text-color);
    position: absolute;
    top: 3rem;
    left: 50px;
    min-width: 150px;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.4s ease;
    opacity: 0.85;
  }

  .menu ul.active {
    display: block;
    height: 150px;
  }

  .menu ul.active li {
    padding: 0.5rem 0;
  }

  .menu ul.active li a {
    font-size: 1rem;
    font-weight: bold;
  }

  .ham {
    display: block;
    cursor: pointer;
  }

  .ham i {
    transition:
      transform 0.4s ease,
      opacity 0.4s ease;
  }

  /* Rotate and fade effect for icons */
  .rotate-in {
    transform: rotate(90deg);
    /* Rotating 90 degrees when cross icon shows */
    opacity: 0;
    /* Initial fade-out */
  }

  .rotate-out {
    transform: rotate(0deg);
    /* Reset rotation to original */
    opacity: 1;
    /* Fade-in the bars icon */
  }

  .intro {
    flex-direction: column;
    /* gap between img and slogan */
    gap: .5em;
    margin-bottom: 3em;
  }

  .intro .me {
    display: flex;
    justify-content: center;
  }

  .slogan h1 {
    font-size: 1.5rem;
  }

  .slogan h1 span {
    font-size: 0.75rem;
  }

  .social-links ul {
    flex-direction: column;
    gap: 0.5rem;
  }

  .post-title {
    font-size: 1.4rem;
  }

  .post-info {
    font-size: .9rem;
  }

}
