:root {
  /* Kanagawa Dragon (Dark Mode) */
  --background-color: #181816; /* dragonBlack3 */
  --foreground-color: #c5c9c5; /* dragonWhite */
  --border-color: #282727; /* dragonBlack4 */
  --special-color: #e6c384; /* carpYellow */
}

body.light {
  /* Kanagawa Lotus (Light Mode) */
  --background-color: #f2ecbc; /* lotusWhite3 */
  --foreground-color: #545464; /* lotusInk1 */
  --border-color: #e7dba0; /* lotusWhite4 */
  --special-color: #9fb5c9; /* lotusBlue3 */
}

body {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-weight: normal;
  font-style: normal;
  font-size: 1rem; /* Set base font size for rem calculations */
  background: var(--background-color);
  transition: background 0.2s;
}

p,
h1,
h2,
h3,
a,
ul li::marker {
  color: var(--foreground-color);
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 64rem;
  margin: 0 auto;
}

.sticky-header {
  position: sticky;
  top: 0;
  z-index: 100;
}

.header {
  display: flex;
  justify-content: space-between;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.5rem 0;
  background: var(--background-color);
  color: var(--foreground-color);
  border-bottom: 1px solid var(--border-color);
}

.menu-home-group {
  position: relative;
  display: flex;
  gap: 0.75rem;
}

.menu {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
}

#sections-menu {
  a {
    text-decoration: none;
    transition:
      color 0.18s cubic-bezier(0.4, 0, 0.2, 1),
      font-size 0.18s cubic-bezier(0.4, 0, 0.2, 1),
      transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  }
  a:hover,
  a:focus {
    color: var(--special-color);
    font-size: 1.17rem;
    transform: scale(1.05);
  }
}

#hamburger-menu {
  display: none;
}

.menu-icon-wrapper {
  background: var(--background-color);
  border: none;
  display: flex;
  padding: 0;
}

.menu-icon {
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--foreground-color);
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}

#home-icon {
  mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 12L12 5l9 7'/><path d='M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-7'/></svg>");
  -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 12L12 5l9 7'/><path d='M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-7'/></svg>");
}

#hamburger-menu-icon {
  mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2'><line x1='4' y1='6' x2='20' y2='6'/><line x1='4' y1='12' x2='20' y2='12'/><line x1='4' y1='18' x2='20' y2='18'/></svg>");
  -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2'><line x1='4' y1='6' x2='20' y2='6'/><line x1='4' y1='12' x2='20' y2='12'/><line x1='4' y1='18' x2='20' y2='18'/></svg>");
}

#light-mode-icon {
  background-color: var(--special-color);
  mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='5'/><line x1='12' y1='1' x2='12' y2='3'/><line x1='12' y1='21' x2='12' y2='23'/><line x1='4.22' y1='4.22' x2='5.64' y2='5.64'/><line x1='18.36' y1='18.36' x2='19.78' y2='19.78'/><line x1='1' y1='12' x2='3' y2='12'/><line x1='21' y1='12' x2='23' y2='12'/><line x1='4.22' y1='19.78' x2='5.64' y2='18.36'/><line x1='18.36' y1='5.64' x2='19.78' y2='4.22'/></svg>");
  -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='5'/><line x1='12' y1='1' x2='12' y2='3'/><line x1='12' y1='21' x2='12' y2='23'/><line x1='4.22' y1='4.22' x2='5.64' y2='5.64'/><line x1='18.36' y1='18.36' x2='19.78' y2='19.78'/><line x1='1' y1='12' x2='3' y2='12'/><line x1='21' y1='12' x2='23' y2='12'/><line x1='4.22' y1='19.78' x2='5.64' y2='18.36'/><line x1='18.36' y1='5.64' x2='19.78' y2='4.22'/></svg>");
}

#dark-mode-icon {
  background-color: var(--special-color);
  mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/></svg>");
  -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/></svg>");
}

#youtube-icon {
  mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M21.582,6.186c-0.23-0.86-0.908-1.538-1.768-1.768C18.254,4,12,4,12,4S5.746,4,4.186,4.418 c-0.86,0.23-1.538,0.908-1.768,1.768C2,7.746,2,12,2,12s0,4.254,0.418,5.814c0.23,0.86,0.908,1.538,1.768,1.768 C5.746,20,12,20,12,20s6.254,0,7.814-0.418c0.86-0.23,1.538-0.908,1.768-1.768C22,16.254,22,12,22,12S22,7.746,21.582,6.186z M9.545,15.568V8.432L15.818,12L9.545,15.568z' fill='%23000000'/></svg>");
  -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M21.582,6.186c-0.23-0.86-0.908-1.538-1.768-1.768C18.254,4,12,4,12,4S5.746,4,4.186,4.418 c-0.86,0.23-1.538,0.908-1.768,1.768C2,7.746,2,12,2,12s0,4.254,0.418,5.814c0.23,0.86,0.908,1.538,1.768,1.768 C5.746,20,12,20,12,20s6.254,0,7.814-0.418c0.86-0.23,1.538-0.908,1.768-1.768C22,16.254,22,12,22,12S22,7.746,21.582,6.186z M9.545,15.568V8.432L15.818,12L9.545,15.568z' fill='%23000000'/></svg>");
}

#github-icon {
  mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M10.9,2.1c-4.6,0.5-8.3,4.2-8.8,8.7c-0.5,4.7,2.2,8.9,6.3,10.5C8.7,21.4,9,21.2,9,20.8v-1.6c0,0-0.4,0.1-0.9,0.1 c-1.4,0-2-1.2-2.1-1.9c-0.1-0.4-0.3-0.7-0.6-1C5.1,16.3,5,16.3,5,16.2C5,16,5.3,16,5.4,16c0.6,0,1.1,0.7,1.3,1c0.5,0.8,1.1,1,1.4,1 c0.4,0,0.7-0.1,0.9-0.2c0.1-0.7,0.4-1.4,1-1.8c-2.3-0.5-4-1.8-4-4c0-1.1,0.5-2.2,1.2-3C7.1,8.8,7,8.3,7,7.6c0-0.4,0-0.9,0.2-1.3 C7.2,6.1,7.4,6,7.5,6c0,0,0.1,0,0.1,0C8.1,6.1,9.1,6.4,10,7.3C10.6,7.1,11.3,7,12,7s1.4,0.1,2,0.3c0.9-0.9,2-1.2,2.5-1.3 c0,0,0.1,0,0.1,0c0.2,0,0.3,0.1,0.4,0.3C17,6.7,17,7.2,17,7.6c0,0.8-0.1,1.2-0.2,1.4c0.7,0.8,1.2,1.8,1.2,3c0,2.2-1.7,3.5-4,4 c0.6,0.5,1,1.4,1,2.3v2.6c0,0.3,0.3,0.6,0.7,0.5c3.7-1.5,6.3-5.1,6.3-9.3C22,6.1,16.9,1.4,10.9,2.1z'/></svg>");
  -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M10.9,2.1c-4.6,0.5-8.3,4.2-8.8,8.7c-0.5,4.7,2.2,8.9,6.3,10.5C8.7,21.4,9,21.2,9,20.8v-1.6c0,0-0.4,0.1-0.9,0.1 c-1.4,0-2-1.2-2.1-1.9c-0.1-0.4-0.3-0.7-0.6-1C5.1,16.3,5,16.3,5,16.2C5,16,5.3,16,5.4,16c0.6,0,1.1,0.7,1.3,1c0.5,0.8,1.1,1,1.4,1 c0.4,0,0.7-0.1,0.9-0.2c0.1-0.7,0.4-1.4,1-1.8c-2.3-0.5-4-1.8-4-4c0-1.1,0.5-2.2,1.2-3C7.1,8.8,7,8.3,7,7.6c0-0.4,0-0.9,0.2-1.3 C7.2,6.1,7.4,6,7.5,6c0,0,0.1,0,0.1,0C8.1,6.1,9.1,6.4,10,7.3C10.6,7.1,11.3,7,12,7s1.4,0.1,2,0.3c0.9-0.9,2-1.2,2.5-1.3 c0,0,0.1,0,0.1,0c0.2,0,0.3,0.1,0.4,0.3C17,6.7,17,7.2,17,7.6c0,0.8-0.1,1.2-0.2,1.4c0.7,0.8,1.2,1.8,1.2,3c0,2.2-1.7,3.5-4,4 c0.6,0.5,1,1.4,1,2.3v2.6c0,0.3,0.3,0.6,0.7,0.5c3.7-1.5,6.3-5.1,6.3-9.3C22,6.1,16.9,1.4,10.9,2.1z'/></svg>");
}

.menu-dropdown {
  display: none;
  flex-direction: column;
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  background: var(--background-color, #fff);
  border: 1px solid var(--border-color, #ccc);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
  min-width: 160px;
  padding: 0.5rem 0;
}
.menu-dropdown.open {
  display: flex;
}

.dropdown-item {
  padding: 0.5rem 1rem;
  color: var(--foreground-color);
  text-decoration: none;
  transition: background 0.15s;
  font-size: 1rem;
}
.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--border-color);
  outline: none;
}

.profile {
  display: flex;
  padding: 1rem;
  gap: 1rem;
  align-items: center;
  justify-content: center;
}

.avatar {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
}

.post-list {
  display: flex;
  flex-direction: column;

  ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
  }

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

  li:last-child {
    border-bottom: none;
  }

  h3 {
    margin-top: 0;
  }

  a {
    cursor: pointer;
    text-decoration: none;
    display: block; /* make the whole list item clickable */
    padding: 0.5rem 0;
  }
}

.read-more-button {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--special-color);
  text-decoration: none;
}

.youtube-wrapper {
  max-width: 800px;
  margin: 2rem auto;
}

.youtube-embed-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding-top: 56.25%; /* 16:9 aspect ratio */
}

.youtube-embed-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 900px) {
  .header {
    padding: 1rem 2rem;
  }

  .menu-home-group {
    gap: 0.5rem;
  }

  .menu {
    gap: 0.5rem;
  }
}

@media (max-width: 700px) {
  body {
    font-size: 0.98rem;
  }

  .header {
    padding: 1rem 0.5rem;
  }

  #home {
    display: none;
  }

  #hamburger-menu {
    display: flex;
  }

  #sections-menu {
    display: none;
  }

  .menu {
    gap: 1rem;
  }

  .page-content {
    margin: 0;
  }

  .profile {
    flex-direction: column;
    gap: 0;
  }

  .avatar {
    width: 75px;
    height: 75px;
  }

  .post-list {
    padding: 0 1rem;
  }

  .article {
    padding: 0 1rem;
  }
}
