/* ===================================
   CSS VARIABLES
   =================================== */
:root {
  --background: #F8F7F9;
  --foreground: #171717;
  --text-color: #2B2D42;
  --text-color-light: #F8F7F9;
  --theme-color: #8e7471;
  --hover-color: #e7e7e7d7;
}

/* ===================================
   GOOGLE FONTS
   =================================== */
@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@900&family=Open+Sans:ital,wght@0,400;0,600;0,700;1,400&display=swap');

/* ===================================
   GLOBAL RESET & BASE STYLES
   =================================== */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  color: var(--foreground);
  background: var(--background);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ===================================
   HEADER & NAVIGATION
   =================================== */
header {
  width: 100vw;
  height: 70px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background-color: var(--theme-color);
  color: var(--text-color-light);
}

.home-title {
  font-family: 'Barlow', sans-serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 70px;
  color: #2B2D42;
  text-shadow: 1px 1px 0 #F8F7F9, -1px 1px 0 #F8F7F9,
               1px -1px 0 #F8F7F9, -1px -1px 0 #F8F7F9;
  user-select: none;
}

.nav-links ul {
  width: 100%;
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 1.4rem;
  align-items: baseline;
}

.nav-links ul li {
  min-width: 60px;
  text-align: center;
}

.nav-links ul li:hover {
  color: #8e7471;
  border-radius: 0.4rem;
  background-color: #e7e7e7d7;
}

.nav-links ul li a {
  display: block;
  padding: 0.4rem 0.5rem;
}

/* ===================================
   MAIN CONTENT AREA & FOOTER
   =================================== */
main {
  max-width: 1200px;
  width: 70%;
  margin: 0 auto;
  min-height: calc(100vh - 95px);
}

h1 {
  margin: 20px 0;
}

footer {
  text-align: center;
  width: 100vw;
  color: var(--text-color);
  opacity: 0.7;
  line-height: 25px;
}

/* ===================================
   HOME PAGE STYLES
   =================================== */
.top-img-wrap {
  position: relative;
}

.top-img-wrap img {
  width: 100%;
  opacity: 0.7;
}

.top-img-wrap p {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0;
  font-family: 'Barlow', sans-serif;
  font-weight: 700;
  color: #2B2D42;
  font-size: 50px;
  text-shadow: 1px 1px 0 #F8F7F9, -1px 1px 0 #F8F7F9,
               1px -1px 0 #F8F7F9, -1px -1px 0 #F8F7F9;
  user-select: none;
}

/* ===================================
   BLOG PAGE STYLES
   =================================== */
.article-list {
  margin: 30px 50px;
}

.article-list li {
  padding: 20px 0;
  width: 100%;
  list-style-type: none;
}

.article-list li:hover {
  background-color: var(--hover-color);
  border-radius: 10px;
}

.prod-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
}

.prod-main {
  margin-left: 0;
}

.right-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 7px;
}

.tag {
  font-size: 0.8rem;
  border: 2px solid lightgray;
  border-radius: 5px;
  padding: 3px 10px;
  line-height: 1.2rem;
  margin: 0;
}

.date-section {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-end;
  gap: 2px;
}

.release-date, .update-date {
  height: 1.2rem;
  line-height: 1.2rem;
}

.release-date::before {
  content: "🚀";
  margin-right: 4px;
}

.update-date::before {
  content: "⚡";
  margin-right: 4px;
}

/* ===================================
   MARKDOWN BLOG CONTENT STYLES
   =================================== */
.markdown-body {
  font-family: sans-serif;
  line-height: 1.6;
  margin: 0 auto;
  padding: 1rem;
}

.markdown-body h1 {
  font-size: 2rem;
  margin: 0.3em 0;
  font-weight: bold;
}

.markdown-body h2 {
  font-size: 1.6rem;
  margin: 0.3em 0;
  font-weight: bold;
}

.markdown-body h3 {
  font-size: 1.2rem;
  margin: 0.3em 0;
  font-weight: bold;
}

.markdown-body h4 {
  font-size: 1rem;
  margin: 0.3em 0;
  font-weight: bold;
}

.markdown-body h1::before, .markdown-body h2::before, .markdown-body h3::before,
.markdown-body h4::before, .markdown-body h5::before, .markdown-body h6::before {
  margin-right: 8px;
  color: #c8c8c9;
}

.markdown-body h1::before {
  content: "#";
}

.markdown-body h2::before {
  content: "##";
}

.markdown-body h3::before {
  content: "###";
}

.markdown-body h4::before {
  content: "####";
}

.markdown-body h5::before {
  content: "#####";
}

.markdown-body h6::before {
  content: "######";
}

.markdown-body p {
  margin: 1em 0;
}

.markdown-body pre {
  background: #f0f0f0;
  padding: 1em;
  overflow: auto;
  border-radius: 0.7rem;
  scrollbar-width: thin;
  font-family: "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", "Courier New", monospace;
}

.markdown-body code {
  background: #f0f0f0;
  padding: 0.2em 0.4em;
}

.markdown-body pre code {
  background: none;
  padding: 0;
}

.markdown-body ul {
  margin-left: 1.2rem;
  padding-left: 0.3rem;
}

.markdown-body li {
  list-style: disc;
}

.markdown-body img {
  width: 100%;
  margin: 0 auto;
}

.markdown-body a {
  color: #659AD2;
}

/* ===================================
   KATEX MATH FORMULA STYLES
   =================================== */
.katex {
  font-size: 1.15em;
}

.katex-display {
  margin: 1.5em 0;
}

/* Apply serif font to all math elements */
.katex .mord,
.katex .mop,
.katex .mrel,
.katex .mopen,
.katex .mclose,
.katex .mpunct,
.katex .minner,
.katex .mbin {
  font-family: 'KaTeX_Main', 'Times New Roman', 'Georgia', serif !important;
}

/* Math variables should be italic serif */
.katex .mord.mathnormal,
.katex .mord.mathit {
  font-family: 'KaTeX_Math', 'Times New Roman', 'Georgia', serif !important;
  font-style: italic;
}

/* Operators and functions should be upright serif */
.katex .mop,
.katex .mathrm {
  font-family: 'KaTeX_Main', 'Times New Roman', 'Georgia', serif !important;
  font-style: normal;
}

/* Greek letters should be italic serif */
.katex .mord.mathnormal[style*="margin-right"] {
  font-family: 'KaTeX_Math', 'Times New Roman', 'Georgia', serif !important;
  font-style: italic;
}

/* ===================================
   GALLERY LIST STYLES
   =================================== */
.album-head {
  background-color: rgb(229, 229, 229);
  border-radius: 1rem;
  padding: 1.2rem;
  margin: 0.8rem;
}

.album-head > h1 {
  margin: 0;
}

.gallery-photos {
  display: flex;
  flex-wrap: wrap;
  margin-top: 0.8rem;
  margin-bottom: 2rem;
}

.gallery-photos img {
  flex-grow: 1;
  object-fit: cover;
  height: 120px;
  width: 120px;
  margin: 0.2rem;
  border-radius: 4px;
}

.link-blue {
  color: #2563eb;
}

.link-blue:hover {
  text-decoration: underline;
}

/* ===================================
   GALLERY IMAGE DETAIL STYLES
   =================================== */
.container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.title {
  margin: 10px;
}

.img-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 20px 0;
}

.img-container a {
  display: block;
  width: 50px;
  height: 500px;
  z-index: 100;
}

.next {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 76px;
}

.next::before, .next::after {
  content: "";
  position: absolute;
  top: calc(50% - 2.5px);
  right: 0;
  width: 49.6px;
  height: 5px;
  border-radius: 9999px;
  background-color: #c2c1c1;
  transform-origin: calc(100% - 2.5px) 50%;
}

.next::before {
  transform: rotate(52.15deg);
}

.next::after {
  transform: rotate(-52.15deg);
}

.prev {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 76px;
}

.prev::before, .prev::after {
  content: "";
  position: absolute;
  top: calc(50% - 2.5px);
  left: 0;
  width: 49.6px;
  height: 5px;
  border-radius: 9999px;
  background-color: #c2c1c1;
  transform-origin: 2.5px 50%;
}

.prev::before {
  transform: rotate(52.15deg);
}

.prev::after {
  transform: rotate(-52.15deg);
}

.img-wrapper {
  width: calc(500px * 4/3);
  height: 500px;
  margin: 0;
  position: relative;
}

.img-wrapper img {
  object-fit: contain;
  width: 100%;
  height: 100%;
}

.img-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 3rem;
  margin-top: 2rem;
}

.map-container {
  width: 500px;
  height: 400px;
}

.exif-table {
  border-collapse: collapse;
}

.exif-table th {
  text-align: left;
  padding-right: 1rem;
  vertical-align: top;
}

.breadcrumb {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 20px;
}

.breadcrumb li {
  position: relative;
}

.breadcrumb li::after {
  content: "";
  position: absolute;
  bottom: 2px;
  right: -34px;
  width: 20px;
  height: 0.8px;
  margin: 0 10px;
  border-radius: 9999px;
  background-color: black;
  transform-origin: 2.5px 50%;
  transform: rotate(290deg);
}

.breadcrumb li:last-child::after {
  content: none;
}

/* ===================================
   PROFILE PAGE STYLES
   =================================== */
.section {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.section h2 {
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
}

.icons {
  display: flex;
  justify-content: space-around;
  gap: 2rem;
}

.icon {
  width: 100px;
  mask-size: cover;
  -webkit-mask-size: cover;
  mask-image: url(/static/images/profile/profile-mask.png);
  -webkit-mask-image: url(/static/images/profile/profile-mask.png);
}

.favicon {
  font-size: 2rem;
}

.icons li {
  list-style: none;
}

.sns-icon {
  width: 40px;
}

.photo {
  width: 80%;
  margin: 0.4rem;
  border-radius: 0.8rem;
  box-shadow: 3px 3px 3px 0px rgba(0, 0, 0, 0.165);
}

/* ===================================
   WORKS PAGE STYLES
   =================================== */
/* Works page uses prod-icon, blog page does not */
.prod-inner:has(.prod-icon) {
  justify-content: flex-start;
  align-items: flex-start;
  gap: 2rem;
}

.prod-icon {
  flex-shrink: 0;
}

.prod-icon img {
  width: 240px;
  height: 150px;
  border-radius: 0.7rem;
  object-fit: cover;
}

.prod-icon + .prod-main {
  margin-left: 0;
}

.prod-main p {
  margin: 10px 0;
}

.prod-info {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 0.5px solid lightgray;
}

/* Section headers in works page */
.article-list h2 {
  margin: 30px 0 10px 0;
  font-size: 1.3rem;
  font-weight: bold;
}

/* ===================================
   UTILITY CLASSES
   =================================== */
.object-cover {
  object-fit: cover;
}

.object-contain {
  object-fit: contain;
}

/* ===================================
   MOBILE RESPONSIVE (<= 1000px)
   =================================== */
@media screen and (max-width: 1000px) {
  header {
    width: 100vw;
    height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    background-color: var(--theme-color);
    color: var(--text-color-light);
  }

  .home-title {
    font-family: 'Barlow', sans-serif;
    font-weight: 700;
    margin: 0 auto;
    font-size: 30px;
    color: #2B2D42;
    text-shadow: 1px 1px 0 #F8F7F9, -1px 1px 0 #F8F7F9,
                 1px -1px 0 #F8F7F9, -1px -1px 0 #F8F7F9;
    user-select: none;
  }

  main {
    padding: 15px;
    width: 100dvw;
  }

  /* Blog list mobile */
  .article-list {
    font-size: 14px;
    margin: 15px auto;
  }

  .article-list li {
    font-size: 14px;
    padding: 15px 0;
    width: 100%;
  }

  .prod-main h3 {
    font-size: 1.3rem;
  }

  .prod-main p {
    margin-top: 0.5rem;
  }

  .prod-inner {
    display: flex;
    flex-direction: column;
    justify-content: left;
    align-items: flex-start;
    padding: 0 1rem;
    gap: 0.5rem;
    width: 100%;
  }

  .prod-main {
    width: 100%;
  }

  .right-side {
    display: flex;
    flex-direction: column;
    justify-content: left;
    align-items: flex-start;
    gap: 7px;
  }

  /* Gallery mobile */
  .gallery-photos img {
    width: calc((100vw - 0.4rem - 44px) / 3);
    height: calc((100vw - 0.4rem - 44px) / 3);
  }

  /* Image detail mobile */
  .title {
    margin: 10px;
    font-size: 1.8rem;
  }

  .img-info {
    flex-direction: column;
  }

  .map-container {
    width: 90vw;
  }

  .img-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    width: 100%;
  }

  .prev {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    position: relative;
    display: inline-block;
    width: 33px;
    height: 62px;
  }

  .next {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    position: relative;
    display: inline-block;
    width: 33px;
    height: 62px;
  }

  .img-wrapper {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
  }

  .img-container a {
    display: block;
    height: 30px;
    width: 100%;
    z-index: 100;
  }

  .next::before, .next::after {
    content: "";
    position: absolute;
    top: calc(50% - 2px);
    right: 0;
    width: 15px;
    height: 4px;
    border-radius: 9999px;
    background-color: #e4e4e4;
    transform-origin: calc(100% - 2px) 50%;
  }

  .next::before {
    transform: rotate(45deg);
  }

  .next::after {
    transform: rotate(-45deg);
  }

  .prev::before, .prev::after {
    content: "";
    position: absolute;
    top: calc(50% - 2px);
    left: 0;
    width: 15px;
    height: 4px;
    border-radius: 9999px;
    background-color: #e4e4e4;
    transform-origin: 2px 50%;
  }

  .prev::before {
    transform: rotate(45deg);
  }

  .prev::after {
    transform: rotate(-45deg);
  }

  /* Works page mobile */
  .prod-inner:has(.prod-icon) {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .prod-icon {
    width: 240px;
    height: 150px;
  }

  .prod-icon img {
    width: 240px;
    height: 150px;
    border-radius: 0.7rem;
  }

  .prod-icon + .prod-main {
    margin-left: 0;
    margin-top: 10px;
    width: 100%;
  }

  .article-list h2 {
    margin: 20px 0 10px 0;
  }
}
