*, *::after, *::before {
  box-sizing: border-box;
}

/* ensure percentage heights work */
html, body {
  height: 100%;
  margin: 0;
}

body {
  background-color: #ffefdf;
  /* keep full viewport but allow consistent percentage children */
  min-height: 100vh;
  width: 100%;
  position: relative;
  overflow: hidden;
}

#rectangles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.rectangle {
  position: absolute;
  background-color: rgba(255, 0, 0, 0.25);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  will-change: transform;
  transform-origin: left center;
  z-index: 1;
}

.wrapper {
  display: flex;
  flex-direction: column;
  /* ensure children (header/main) stretch full width */
  align-items: stretch;
  height: 100%;
  width: 100%;
  z-index: 2;
}

header {
  background-color: rgba(255, 255, 255, 0);
  color: #1f0000;
  display: flex;
  flex-shrink: none;
  min-height: 100px;
  width: 100%;
  padding: 0 40px;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.5s ease;
  z-index: 10;
}

.scrolled {
  background-color: rgba(255, 255, 255, 1);
}

.logo {
  font-family: "Roboto", sans-serif;
  font-optical-sizing: auto;
  font-weight: 900;
  font-style: normal;
  font-variation-settings: "wdth" 100;
  font-size: 30px;
}

/* Desktop nav placeholder */
.nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.nav-item {
  color: #1f0000;
  cursor: pointer;
  text-decoration: none;
  font-size: 20px;
  padding: 8px 12px;
  border-radius: 6px;
  z-index: 1000;
}

#hamburger-btn {
  display: none;
}

#side-nav {
  display: none;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  height: auto;
  width: 100%;
  min-width: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  padding-bottom: 100px;
}

main::-webkit-scrollbar {
  width: 6px;
}

main::-webkit-scrollbar-track {
  background-color: transparent;
}

main::-webkit-scrollbar-thumb {
  background-color: #bfbfbf;
  border-radius: 6px;
}

h1 {
  font-size: 50px;
  text-align: center;
}

.title {
  display: block;
}

.mobile-title {
  display: none;
}

h2 {
  font-size: 25px;
  text-align: center;
}

.articles-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 80%;
}

.article {
  border-top: 1px solid #000000;
  border-bottom: 1px solid #000000;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 800px;
}

.article-btn {
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 20px 0;
  transition: padding-bottom 0.1s ease-in-out;
}

.article-btn:hover {
  padding-bottom: 40px;
}

.article-btn.open:hover {
  padding-bottom: 20px;
}

.article-icon {
  font-size: 15px;
}

.article-title {
  font-size: 20px;
  font-weight: bold;
  margin: 0;
  padding: 0;
}

.article-date {
  margin-left: auto;
}

section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
}

.article-content {
  background-color: #ffffff;
  border-radius: 10px;  
  width: 100%;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 20px;
  margin: 0;
  transition: max-height 2s ease, opacity 1s cubic-bezier(0.5, 0, 1, 0.5);
  z-index: 10;
}

.article-content.open {
  max-height: 5000px;
  margin-bottom: 20px;
  opacity: 1;
}

.article-content img {
  max-width: 100%;
  height: auto;
}

.article-more-btn {
  color: #3f3f3f;
  cursor: pointer;
  font-size: 20px;
  margin: 20px 0;
}

.sns-icons {
  display: flex;
  gap: 60px;
  margin: 10px 0;
}

.sns-icon {
  height: 40px;
  width: auto;
}

/* Mobile styles */
@media (max-width: 768px) {
  body {
    font-size: 12px;
    overflow: hidden;
  }

  header {
    min-height: 60px;
    padding: 0 20px;
  }

  .logo {
    font-size: 20px;
  }

  .nav {
    display: none; /* hide desktop nav */
  }

  .nav-item {
    font-size: 15px;
  }

  /* hamburger button */
  #hamburger-btn {
    display: inline-flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
  }

  #hamburger-btn img {
    width: 24px;
    height: 24px;
  }

  #side-nav-curtain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0);
    transition: background-color 0.5s, visibility 0.5s ease;
    visibility: hidden;
    z-index: 15;
  }

  #side-nav-curtain.open {
    background-color: rgba(0,0,0,0.5);
    visibility: visible;
  }

  #side-nav {
    position: fixed;
    top: 0;
    right: -250px; /* hidden by default */
    width: 250px;
    height: 100%;
    background-color: #ffffff;
    box-shadow: -2px 0 5px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
    transition: right 0.5s ease;
    z-index: 20;
  }

  #side-nav.open {
    right: 0; /* slide in when open */
  }

  main {
    padding: 0 10px;
    padding-bottom: 60px;
  }

  h1 {
    font-size: 30px;
    text-align: center;
  }

  .title {
    display: none;
  }

  .mobile-title {
    display: block;
  }

  h2 {
    font-size: 20px;
  }

  .articles-container {
    width: 100%;
  }

  #articles{
    width: 100%;
  }

  .article-title {
    font-size: 15px;
  }

  .article-btn {
    padding: 15px 0;
  }

  .article-btn:hover {
    padding-bottom: 15px;
  }

  .article-btn.open:hover {
    padding-bottom: 15px;
  }

  h3 {
    font-size: 15px;
  }

  .article-more-btn {
    font-size: 15px;
  }

  .sns-icon {
    height: 30px;
  }
}

