/* ===============================
   기본 리셋 및 변수 설정
================================= */
:root {
  --primary-color: #0073E6;
  --text-color: #222;
  --bg-color: #F5F6F7;
  --border-color: #0073E6;
  --gray-light: #f0f4f9;
  --gray-medium: #666;
  --gray-dark: #333;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* ===============================
   다크모드
================================= */
body.dark-mode {
  --bg-color: #1a1a1a;
  --text-color: #fff;
  --border-color: #444;
  --gray-light: #2a2a2a;
  --gray-medium: #aaa;
  --gray-dark: #ddd;
}

/* ===============================
   헤더
================================= */
header {
  border-bottom: 1px solid var(--border-color);
  padding: 20px 0;
  position: sticky;
  top: 0;
  background: var(--bg-color);
  z-index: 1000;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.logo {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -1px;
  text-decoration: none;
  color: var(--text-color);
}

.logo span {
  color: var(--primary-color);
}

/* ===============================
   네비게이션 메뉴
================================= */
.nav-menu {
  display: flex;
  justify-content: flex-end;   /* PC: 오른쪽 정렬 */
  align-items: center;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 100%;
}

.nav-menu li {
  flex: 0 0 auto;
}

.nav-menu li a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  font-size: 16px;
  text-decoration: none;
  color: #111827;
  transition: color 0.3s;
}

.nav-menu li a:hover {
  color: var(--primary-color);
}

/* 📱 모바일 전용 메뉴 */
@media (max-width: 768px) {
  .nav-menu {
    justify-content: center !important; /* 가운데 정렬 */
    flex-wrap: wrap !important;         /* 줄바꿈 허용 */
    width: 100% !important;
  }

  .nav-menu li {
    flex: 1 1 45% !important;           /* 2개씩 배치 */
    text-align: center !important;
    margin: 5px 0 !important;
  }

  .nav-menu li a {
    display: block !important;
    font-size: 15px !important;
    padding: 10px !important;
    white-space: normal !important;     /* 긴 텍스트 줄바꿈 */
  }
}

/* ===============================
   버튼
================================= */
.nav-button {
  padding: 8px 20px;
  background: var(--primary-color);
  color: white;
  border: none;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.3s;
}

.nav-button:hover {
  background: #e55a2b;
}

/* ===============================
   히어로 섹션
================================= */
.hero {
  max-width: 800px;
  margin: 80px auto;
  padding: 0 20px;
  text-align: center;
}

.hero h1 {
  font-size: 48px;
  font-weight: 900;
  margin-bottom: 20px;
  line-height: 1.2;
}

.hero p {
  font-size: 20px;
  color: var(--gray-medium);
  margin-bottom: 40px;
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 36px;
  }
}

/* ===============================
   구독 폼
================================= */
.subscribe-form {
  display: flex;
  max-width: 500px;
  margin: 0 auto;
  gap: 10px;
}

.subscribe-form input {
  flex: 1;
  padding: 15px 20px;
  border: 2px solid var(--border-color);
  font-size: 16px;
  outline: none;
  background: var(--bg-color);
  color: var(--text-color);
}

.subscribe-form button {
  padding: 15px 30px;
  background: var(--primary-color);
  color: white;
  border: none;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}

.subscribe-form button:hover {
  background: #e55a2b;
}

@media (max-width: 768px) {
  .subscribe-form {
    flex-direction: column;
  }
}

/* ===============================
   카테고리 탭
================================= */
.category-tabs {
  display: flex;
  gap: 30px;
  margin-bottom: 40px;
  border-bottom: 2px solid var(--border-color);
}

.category-tab {
  padding: 10px 0;
  font-weight: bold;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.3s;
  color: var(--text-color);
  text-decoration: none;
}

.category-tab.active,
.category-tab:hover {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

/* ===============================
   콘텐츠 카드 그리드
================================= */
.content-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin-bottom: 60px;
}

@media (max-width: 800px) {
  .content-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

.content-card {
  border: 1px solid var(--border-color);
  transition: all 0.3s;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-color);
  display: block;
  overflow: hidden;
}

.content-card:hover {
  transform: translateY(-5px);
  box-shadow: 5px 5px 0 var(--primary-color);
}

.content-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.content-card-body {
  padding: 30px;
}

.content-category {
  color: var(--primary-color);
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 10px;
}

.content-title {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 15px;
  line-height: 1.3;
}

.content-excerpt {
  color: var(--gray-medium);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 15px;
}

.content-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--gray-medium);
  font-size: 14px;
}

.read-time {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ===============================
   글 상세 페이지
================================= */
.article-container {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 20px;
}

.article-header {
  margin-bottom: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border-color);
}

.article-category {
  color: var(--primary-color);
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 15px;
}

.article-title {
  font-size: 42px;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 20px;
}

.article-meta {
  display: flex;
  gap: 20px;
  color: var(--gray-medium);
}

.article-content {
  font-size: 18px;
  line-height: 1.8;
}

.article-content img {
  max-width: 100%;
  height: auto;
  margin: 30px 0;
}

.article-content h2 {
  font-size: 32px;
  margin: 40px 0 20px;
}

.article-content h3 {
  font-size: 24px;
  margin: 30px 0 15px;
}

.article-content p {
  margin-bottom: 20px;
}

/* ===============================
   블러 효과 (구독 유도)
================================= */
.article-blur {
  position: relative;
}

.blur-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 400px;
  background: linear-gradient(to bottom, 
      rgba(255,255,255,0) 0%,
      rgba(255,255,255,0.8) 50%,
      rgba(255,255,255,1) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dark-mode .blur-overlay {
  background: linear-gradient(to bottom, 
      rgba(26,26,26,0) 0%,
      rgba(26,26,26,0.8) 50%,
      rgba(26,26,26,1) 100%);
}

.subscribe-prompt {
  text-align: center;
  padding: 40px;
  background: var(--bg-color);
  border: 2px solid var(--primary-color);
  max-width: 500px;
}

.subscribe-prompt h3 {
  font-size: 24px;
  margin-bottom: 15px;
}

.subscribe-prompt p {
  margin-bottom: 25px;
  color: var(--gray-medium);
}

/* ===============================
   북마크 버튼
================================= */
.bookmark-btn {
  background: none;
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.3s;
}

.bookmark-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.bookmark-btn.bookmarked {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* ===============================
   푸터
================================= */
footer {
  background: var(--text-color);
  color: var(--bg-color);
  padding: 60px 0;
  margin-top: 100px;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
}

.footer-section h3 {
  margin-bottom: 20px;
  color: var(--primary-color);
}

.footer-section ul {
  list-style: none;
}

.footer-section a {
  color: var(--bg-color);
  text-decoration: none;
  line-height: 2;
}

.footer-section a:hover {
  color: var(--primary-color);
}

/* ===============================
   로그인/회원가입 폼
================================= */
.auth-container {
  max-width: 400px;
  margin: 80px auto;
  padding: 40px;
  border: 1px solid var(--border-color);
}

.auth-container h2 {
  text-align: center;
  margin-bottom: 30px;
  font-size: 32px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  font-size: 16px;
  background: var(--bg-color);
  color: var(--text-color);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--primary-color);
  color: white;
  border: none;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}

.btn-primary:hover {
  background: #e55a2b;
}

/* ===============================
   기타
================================= */
.divider {
  text-align: center;
  margin: 30px 0;
  position: relative;
}

.divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-color);
}

.divider span {
  background: var(--bg-color);
  padding: 0 15px;
  position: relative;
  color: var(--gray-medium);
}

.google-login {
  width: 100%;
  padding: 14px;
  background: white;
  color: #333;
  border: 1px solid #ddd;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s;
}

.google-login:hover {
  background: #f5f5f5;
}

/* ===============================
   로딩 스피너
================================= */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===============================
   토스트 메시지
================================= */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--text-color);
  color: var(--bg-color);
  padding: 16px 24px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  background: #4caf50;
}

.toast.error {
  background: #f44336;
}

/* ===============================
   Premium Badge
================================= */
.premium-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
  line-height:1;
  margin-left:6px;
  background: linear-gradient(135deg,#ffd54f,#ffb300);
  color:#3b2a00;
  border-radius:999px;
  padding:4px 8px;
  font-weight:700;
  box-shadow:0 1px 2px rgba(0,0,0,.12);
}
.premium-badge .crown{ margin-right:4px }

/* ===== 네비게이션 메뉴 (기본 PC용) ===== */
.nav-menu {
  display: flex;
  flex-wrap: nowrap;        /* PC에서는 줄바꿈 금지 */
  justify-content: center;  /* 중앙 정렬 */
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-menu li {
  flex: 0 0 auto;           /* 아이템 크기 고정 */
}

.nav-menu li a {
  display: block;
  padding: 8px 12px;
  font-size: 16px;
  text-decoration: none;
  color: var(--text-color);
  transition: color 0.3s;
}

.nav-menu li a:hover {
  color: var(--primary-color);
}

/* 📱 모바일 줄바꿈 (768px 이하에서만 적용) */
@media (max-width: 768px) {
  .nav-menu {
    flex-wrap: wrap;         /* 줄바꿈 허용 */
    justify-content: center; /* 가운데 정렬 */
    width: 100%;
  }
  .nav-menu li {
    flex: 1 1 45%;           /* 한 줄에 2개씩 */
    text-align: center;
    margin: 5px 0;
  }
  .nav-menu li a {
    font-size: 15px;
    padding: 10px;
    white-space: normal;     /* 줄바꿈 허용 */
  }
}

.mypage-item {
  display: flex;
  align-items: center;
  gap: 6px;   /* 링크와 뱃지 간격 */
}

.mypage-item .premium-badge {
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg,#ffd54f,#ffb300);
  color: #3b2a00;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
}

/* PC에서만 프리미엄 배지를 마이페이지 위로 */
.mypage-item {
  text-align: center;
}

.mypage-item .premium-badge {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg,#ffd54f,#ffb300);
  color: #3b2a00;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
}

/* 모바일에서는 기본 inline (변경 없음) */
@media (max-width: 768px) {
  .mypage-item .premium-badge {
    display: inline-block;
    margin-bottom: 0;
    margin-right: 6px;
  }
}

