:root {
  --view-height: 100vh;
}

@supports (height: 100svh) {
  :root {
    --view-height: 100svh;
  }
}

@supports (height: 100dvh) {
  :root {
    --view-height: 100dvh;
  }
}

@font-face {
  font-family: "DalseoHealing";
  src: url("../fonts/DalseoHealingMedium.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "DalseoHealing";
  src: url("../fonts/DalseoHealingBold.ttf") format("truetype");
  font-weight: bold;
  font-style: normal;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "DalseoHealing", -apple-system, BlinkMacSystemFont, system-ui,
    Roboto, sans-serif;
  background-color: #f6f6f6;
  line-height: 1.6;
}

/* 로딩 화면 */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease-out;
}

.loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.logo-container {
  margin-bottom: 20px;
}

.dalseo-logo {
  width: 150px;
  height: auto;
  animation: logoAnimation 2s ease infinite;
}

@keyframes logoAnimation {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 상단 바 */
.top-bar {
  background-color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.top-bar-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 15px 60px;
  display: flex;
  align-items: center;
  gap: 40px;
}

.dalseo-link {
  flex-shrink: 0;
}

.top-bar-logo {
  height: 35px;
  width: auto;
  transition: opacity 0.2s ease;
}

.top-bar-title {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

@media (max-width: 768px) {
  .top-bar-container {
    padding: 12px 20px;
    gap: 20px;
  }

  .top-bar-logo {
    height: 30px;
  }

  .top-bar-title {
    font-size: 16px;
  }
}
@media screen and (max-width: 768px) {
  .top-bar {
    padding: 10px;
  }

  .top-bar-title {
    font-size: 18px;
  }
}

/* 헤더 배너 */
.header-banner {
  position: relative;
  width: 100%;
  height: 400px;
  margin-bottom: -120px;
  overflow: hidden;
}

.header-banner:after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 150px;
  background: linear-gradient(
    to bottom,
    transparent,
    #f4f4f4
  );
}

.header-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes floating {
  0% {
    transform: translate(-50%, -50%);
  }
  50% {
    transform: translate(-50%, -53%);
  }
  100% {
    transform: translate(-50%, -50%);
  }
}

.banner-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  animation: floating 3s ease-in-out infinite;
}

.banner-logo img {
  max-width: 300px;
  height: auto;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.mascot-overlay {
  position: absolute;
  top: -80px;
  left: 60px;
  width: 150px;
  height: 150px;
  z-index: 3;
  transition: transform 0.3s ease;
  pointer-events: none;
}

.mascot-overlay img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mascot-overlay:hover {
  transform: translateY(-5px);
}

.featured-newsletter {
  max-width: 1200px;
  margin: 80px auto 50px;
  padding: 20px;
  position: relative;
  z-index: 2;
}

.featured-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.featured-content {
  position: relative;
  background: white;
  border-radius: 5px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: visible;
  transition: transform 0.3s ease;
}

.featured-content:hover {
  transform: translateY(-5px);
}

.featured-info {
  flex: 1;
  padding-right: 30px;
}

.featured-content:hover .mascot-overlay {
  transform: translateY(-5px);
}

.featured-info h2 {
  font-size: 28px;
  margin-bottom: 10px;
  font-weight: 600;
}

.featured-info p {
  color: #666;
  font-size: 16px;
}

.featured-image {
  width: 50%;
  height: 200px;
  border-radius: 5px;
  overflow: hidden;
}

.featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (min-width: 768px) {
  .featured-info {
    padding-left: 50px;
  }
}

@media (max-width: 768px) {
  .featured-content {
    flex-direction: column;
    padding: 20px;
    overflow: visible;
    text-align: center;
  }

  .mascot-overlay {
    position: relative;
    top: 0;
    left: 0;
    width: 130px;
    height: 100px;
    margin: -50px auto 20px;
  }

  .featured-info {
    padding-right: 0;
    padding-bottom: 20px;
    text-align: center;
  }

  .featured-image {
    width: 100%;
    height: 150px;
  }
}

/* 메인 컨테이너 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* 뉴스레터 그리드 */
.newsletter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  padding-top: 30px;
}

.newsletter-item {
  background-color: white;
  border-radius: 5px;
  border: 2px solid white;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  overflow: visible;
  cursor: pointer;
  transition: transform 0.3s ease;
  position: relative;
  aspect-ratio: 960/1435;
  width: 100%;
  max-width: 300px;
  margin: 25px auto 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.newsletter-item:not(.unpublished):hover {
  transform: scale(1.05);
  z-index: 4;
}

.newsletter-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: 0.3s ease;
  border-radius: 5px;
}

.newsletter-item.unpublished {
  position: relative;
  pointer-events: none;
}

.folder-tab {
  position: absolute;
  top: -32px;
  left: 1px;
  z-index: 0;
  background: white;
  padding: 5px 25px 5px 15px;
  font-size: 14px;
  font-weight: bold;
  color: #333;
  border: 2px solid white;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  clip-path: polygon(0 0, 80% 0, 100% 100%, 0 100%);
  height: 30px;
  display: flex;
  align-items: center;
}

.unpublished-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
}

.unpublished-overlay span {
  color: white;
  padding: 10px 20px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* 뉴스레터 뷰어 */
.newsletter-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 20px 20px;
  position: relative;
}

.newsletter-viewer {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding-top: 20px;
}

.newsletter-slider {
  width: 100%;
  min-height: var(--view-height);
  height: var(--view-height);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
  padding-top: calc(env(safe-area-inset-top, 0px) + 20px);
  box-sizing: border-box;
}

.newsletter-slider iframe,
.newsletter-frame {
  width: 100%;
  height: var(--view-height);
  min-height: var(--view-height);
  border: none;
}

.newsletter-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
}

.slide-btn {
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  font-size: 20px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.slide-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.slide-btn:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.newsletter-error {
  color: #d9534f;
  text-align: center;
  font-size: 18px;
  margin-top: 50px;
}

@media (max-width: 768px) {
  .newsletter-slider {
    height: 80vh;
  }

  .newsletter-controls {
    top: 10px;
    right: 10px;
  }
}

/* 반응형 스타일 */
@media (max-width: 1024px) {
  .featured-newsletter {
    margin: 40px auto 40px;
  }

  .featured-content {
    flex-direction: column;
    text-align: center;
  }

  .featured-info {
    padding-right: 0;
    margin-bottom: 20px;
  }

  .featured-image {
    width: 100%;
    height: auto;
  }

  .newsletter-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 768px) {
  .featured-newsletter {
    padding: 10px;
  }

  .newsletter-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

/* 접근성 */
.newsletter-grid *:focus,
.view-btn:focus {
  outline: 3px solid #3498db;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 로딩 상태 */
.loading .newsletter-item {
  opacity: 0.6;
  pointer-events: none;
}

/* 페이지 네비게이션 */
.page-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 30px;
}

.page-number {
  font-size: 16px;
  color: #666;
}

/* 최근 기사 섹션 */
.recent-articles {
  max-width: 1200px;
  margin: 40px auto 60px;
  padding: 0 20px;
}

.recent-articles h2 {
  font-size: 24px;
  margin-bottom: 20px;
  font-weight: 600;
}

.article-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.article-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.3s ease;
}

.article-card:hover {
  transform: translateY(-4px);
}

.article-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.article-content {
  padding: 16px;
}

.article-content h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #333;
}

.article-content p {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
}

.article-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.article-tag {
  background: #f0f7ff;
  color: #1d70b8;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

/* 푸터 */
footer {
  background: #1d70b8;
  color: white;
  padding: 40px 20px;
  margin-top: 60px;
}

footer .footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

footer a {
  color: #ffeb3b;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* 모바일 최적화 */
@media (max-width: 600px) {
  .article-list {
    grid-template-columns: 1fr;
  }

  footer .footer-content {
    text-align: center;
  }
}
