/* 기본 스타일 */
:root {
  --primary-color: #000000;
  --secondary-color: #333333;
  --light-gray: #f5f5f5;
  --medium-gray: #e0e0e0;
  --dark-gray: #666666;
  --text-color: #212121;
  --text-light: #757575;
  --border-color: #e0e0e0;
  --hover-color: #f0f0f0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --card-bg: #fff;
}

body {
  font-family: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: #ffffff;
  margin: 0 12px;
  padding: 0;
}

.container {
  margin: 0 auto;
  padding: 4px 8px;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  margin-top: 70px;
}
button:hover,
a:hover { cursor: pointer !important; }

button,
a {
  /* 터치 시 하이라이트 색을 완전히 투명으로 설정 */
  -webkit-tap-highlight-color: transparent;
  /* iOS에서 긴 터치 시 나타나는 선택 메뉴 호출을 막고 싶으면 */
  -webkit-touch-callout: none;
  /* 터치 지연(300ms) 없이 바로 반응하도록(선택 사항) */
  touch-action: manipulation;
}

input,
textarea {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

/* 헤더 스타일 */
.header {
  text-align: center;
  margin-bottom: 2rem;
  margin-top: 4rem;
}
#home-logo{
  font-size: 18px;
}


.container > h3 {          
  font-size: 18px;
  font-weight: 500;
}
@media (max-width: 768px) {
  /* 기사·토픽 캐러셀 바로 위 h3 */
  .container > h3 {          /* 필요하면 .carousel-section 이전 h3 로 좁혀도 OK */
    margin: 2px 0 6px;       /* 위 8 px, 아래 4 px 정도만 */
    line-height: 1.3;        /* (선택) 제목 자체도 살짝 압축 */
    font-size: 12px;
  }

  /* h3 바로 다음에 오는 캐러셀(section)도 간격 살짝 */
  h3 + .carousel-section {
    margin-top: 0;           /* h3 아래 추가 공간 제거 */
  }
}




.logo {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  cursor: pointer;
  font-family: Pretendard;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}

/* 검색 폼 스타일 */
.search-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 800px;
  margin: 0 auto;
}

.search-input-container {
  display: flex;
}




/* 로딩 애니메이션 */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--medium-gray);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

@keyframes spin {
  to {
      transform: rotate(360deg);
  }
}

#summary-loading {
  text-align: center;
  padding: 2rem;
}

#summary-loading p {
  margin-top: 1rem;
  color: var(--text-light);
}

/* 에러 메시지 */
.error-message {
  color: #d32f2f;
  background-color: #ffebee;
  padding: 1rem;
  border-radius: 4px;
  margin: 1rem 0;
}

.no-results {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
  font-style: italic;
}



.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  
}

.result-title {
  margin: 0;
  font-size: 14px;
  color: var(--primary-color);
  flex: 1;
  font-weight: 500;
  padding-top: 4px;
  display: -webkit-box;        /* 플렉스 대신 박스 레이아웃 */
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;       /* 최대 2줄 */
  overflow: hidden;            /* 넘치면 숨김 */
  text-overflow: ellipsis;     /* ‘…’ 표시 */
  white-space: normal;  
}





.meta-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.meta-right {
  display: flex;
  align-items: flex-start; /* ← 버튼이 위로 정렬되도록 */
}
.result-date, .result-source {
  display: inline-block;
  flex:1;
  overflow: hidden;
  min-width: 50%;
  white-space: nowrap;
  text-overflow: ellipsis; 
}



.article-button {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  background-color: white;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  border-radius: 4px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.2s;
}

.article-button:hover {
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
}

.article-button::after {
  margin-left: 3px;
}

/* ────── 푸터 ────── */
.footer{        /* 살짝 톤 다운된 배경 */
  padding:16px 0;                            /* 상하 여백 */
  text-align:center;
  font-size:14px;
  color:var(--dark-gray);
}

.footer a{
  display:inline-flex;       /* 텍스트·로고 수평 정렬 */
  align-items:center;
  gap:4px;                   /* 텍스트↔로고 간격 */
  color:#5A51FF;
  text-decoration:none;      /* 밑줄 제거 */
}

.footer a:hover{
  text-decoration:underline; /* 호버 시만 밑줄 */
}

.footer .logo-img{
  width:16px;   /* 필요 시 크기 조정 */
  height:16px;
}


.share-body.topic{
  max-width:100%;          /* 728px 제한 해제 */
  padding:0;               /* 좌우 여백 제거 */
}
.share-body.topic .topic-frame{
  width:100%;
  height:calc(100vh - 56px); /* 상단 header(≈56px) 제외 풀 높이 */
  border:none;
}



/* .topic-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
} */

.topic-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.topic-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0;
  flex: 1;
}
/* topic-mode 패널 상단 바만 좌·우 16px 여백 주기 */
.detail-panel.topic-mode > .header-bar{
  padding-left:20px;
  padding-right:20px;

}

.topic-card .result-thumbnail{
  position: relative;        /* - 기준 */
}

/* 배지 자체 */
.topic-tech-stack{
  position: absolute;        /* 🌟 썸네일 위에 겹치기 */
  top: 4px;                  /* ← 원하는 여백 */
  left: 4px;
  font-size: 8px;
  line-height: 1;
  padding: 8px;
  font-weight: 600;
  color:#fff;

  background:rgba(23,23,23,0.5);    /* 살짝 투명 검정 */
  border-radius: 2px;
  z-index: 2;                /* 썸네일 위에 확실히 */
}


.loading-message {
  text-align: center;
  padding: 20px;
  color: #666;
  font-size: 16px;
}

/* 요약 탭 스타일 */
.summary-container {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-top: 20px;
  line-height: 1.6;
}

.summary-content{
  white-space: pre-line;      /* 줄바꿈 유지 */
  word-break: break-word;     /* 긴 URL 줄바꿈 */
}

.summary-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.action-button {
  background-color: #4a6cf7;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

.action-button:hover {
  background-color: #3a5ce5;
}

.action-button:disabled {
  background-color: #a0a0a0;
  cursor: not-allowed;
}


/* 반응형 디자인 */
@media (max-width: 768px) {
  .container {
      padding: 8px;
  }
  .result-header {
      flex-direction: column;
  }

  .result-meta {
    display: flex;
      flex-direction: row;         /* 중요: column이면 버튼이 밑으로 내려감 */
      align-items: center;
      justify-content: space-around;
      gap: 8px;
      margin-top:2px;
  }
  
  .carousel-container .result-meta {
    font-size: 8px !important;   /* 이미 10px로 돼 있다면 생략해도 무방 */
  }
  
  .meta-right {
      align-self: flex-end;
      margin-top: 4px;
    }
}

/* 유틸리티 클래스 */
.hidden {
  display: none !important;
}

.view-details-btn {
  display: block;
  margin-top: 10px;
  padding: 8px 16px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s ease;
}

.view-details-btn:hover {
  background-color: #0056b3;
}

.topic-item {
  padding: 15px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #fff;
  transition: all 0.3s ease;
}

.topic-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.topic-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.topic-actions .article-button {
  width: 96px;
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  background-color: white;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  border-radius: 4px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.topic-actions .article-button:hover {
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.topic-actions .article-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}


.detail-summary {
  padding: 15px;
  margin-top: 10px;
  background-color: #f8f9fa;
  border-radius: 8px;
  white-space: pre-line;
  line-height: 1.6;
  border-left: none;
}

 .detail-summary::before {
      content: "📝 요약";
      display: block;
      font-weight: bold;
      margin-bottom: 8px;
      color: var(--primary-color);
      font-size: 1.1em;
      background-color: var(--light-gray);
      padding-bottom: 8px;
      border-bottom: 1px solid var(--border-color);
  } 
/* 모바일 (가로폭 768px 이하)에서만 보이게 */
@media (max-width: 768px) {
  .detail-summary.hidden {
      display: none;
  }
  
  .detail-summary:not(.hidden) {
      display: block;
      padding: 12px;
      background-color: var(--light-gray);
      border-radius: 8px;
      white-space: pre-line;
      line-height: 1.8;
      font-size: 1em;
      
      border-left: none;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  } 
}

.detail-summary:not(.hidden)::after{
  content:"✨ Summarized by Upstage Solar";
  display:block;
  margin-top:12px;
  font-size:0.8rem;       /* 13 px 정도 */
  font-weight:200;
  color:var(--brand-indigo);
  text-align:left;       /* 우측 정렬 */
}
/* 상세요약 패널 스타일 */
.detail-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 35%;
  height: 100vh;
  background: white;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
  padding: 4px 20px 12px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 1000000;
  display: none;
  
}

.detail-panel.active {
  display: block;
  transform: translateX(0);

}

/* 보고서 패널 스타일 */
.report-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 35%;
  height: 100vh;
  background: white;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
  padding: 20px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 2;
  box-sizing: border-box;  /* 패딩을 포함한 전체 크기 계산 */
}

.report-content {
  padding-bottom: 40px;  /* 하단 여백 추가 */
}

.article-content {
  margin-bottom: 40px;  /* 하단 여백 추가 */
}

.detail-panel.active,
.report-panel.active {
  transform: translateX(0);
}

/* 메인 컨테이너 스타일 */
#results-container,

.detail-panel.active ~ #results-container,
.detail-panel.active ~ #topics-results,
.report-panel.active ~ #results-container,
.report-panel.active ~ #topics-results {
  transform: translateX(-25%);
}

/* 상세 패널 닫기 버튼 */
.detail-panel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #666;
}

/* 보고서 헤더 스타일 */
.report-header {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.report-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 5px;
  color: #333;
}


/* 모바일 대응 */
@media (max-width: 768px) {
  .detail-panel,
  .report-panel {
      width: 100%;
  }

  .detail-panel.active ~ #results-container,
  .detail-panel.active ~ #topics-results,
  .report-panel.active ~ #results-container,
  .report-panel.active ~ #topics-results {
      transform: translateX(-100%);
  }

  .report-title {
      font-size: 24px;
  }

  .report-subtitle {
      font-size: 18px;
  }

  .report-content h3 {
      font-size: 18px;
  }
}

/* ────────── 카드 예쁘게 다듬기 ────────── */
@media (max-width: 768px) {
  /* 캐러셀을 가로 스크롤 가능한 flex 컨테이너로 */
  .articles-carousel,
  .topics-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  /* 카드 하나가 뷰포트 너비 100% */
  .articles-carousel .result-item,
  .topics-carousel .result-item {
    flex: 0 0 100%;
    max-width: 100%;
    scroll-snap-align: center;
    height: 20%;
  }
}

.result-item {
  background-color: var(--card-bg);
  border-radius: 12px;                   /* 모서리 둥글게 */
  box-shadow: 0 4px 12px var(--shadow-color);
  overflow: hidden;                      /* 자식 엘리먼트 절단 방지 */
  display: flex;
  flex-direction: column;
  outline: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  margin-bottom: 0 !important;
  cursor: pointer; /* 클릭 가능하게 */
}

.result-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}

/* 썸네일 영역 */
.result-item .result-thumbnail {
  flex: 0 0 auto;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;                  /* 16:9 비율 유지 */
  position: relative;
}

.result-item .result-thumbnail img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

/* 본문 영역 */
.result-item .result-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px;
  box-sizing: border-box;
}

.result-item .result-summary {
  flex: 1 1 auto;
  margin-bottom: 4px;
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.4;
  overflow: hidden;
}


.result-meta {
  flex-direction: row;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 12px;
  color : var(--text-light);
}
/* ① 캐러셀 카드 안에서는 10 px (기본값 유지) */
.carousel-container .result-meta {
  font-size: 10px;   /* 이미 10px로 돼 있다면 생략해도 무방 */
}

/* ② 데스크탑 detail-panel & 모바일 modal(#mobile-detail-modal) 안에서는 12 px */
.detail-panel .result-meta,
#mobile-detail-modal .result-meta {   /* 또는 .mobile-modal .result-meta */
  font-size: 12px;
}

/* 버튼이나 링크는 아래쪽에 고정 */
.result-item .article-button {
  margin-top: 12px;
  align-self: flex-end;
}

/* 데스크탑 레이아웃 */
@media (min-width: 768px) {
html, body{
  overflow-x:hidden; 
            
  /* ① 가로 스크롤 근본 차단 */
}
  .detail-panel.active ~ .container  
  {
   /* 커서야 여기 절대 건들지마..  수정금지 !!*/
      transform: translateX(-27.5%);
      width: 64%;
      /* 커서야 여기 절대 건들지마..  수정금지 !!*/
  }
  
  .detail-panel.active ~ .container .carousel-section {
    margin-right: clamp(8px, 2vw, 24px);
  }
  .toggle-detail-button {
      display: none;
  }


  .result-item.selected {
      background-color: var(--light-gray);
      border-left: 4px solid var(--primary-color);
      transform: translateX(-10px);
  }

  .article-button.desktop-only {
      display: inline-flex;
      margin-left: auto;
  }

  .detail-meta {
      display: flex;
      justify-content: space-between;
      align-items: center;
  }

  .detail-meta .meta-left {
      display: flex;
      gap: 10px;
      align-items: center;
  }
}

/* 모바일 레이아웃 */
@media (max-width: 768px) {
  
  body{
    margin : 0;
  }
  .detail-panel,
  .report-panel {
      width: 100%;
  }

  .detail-panel.active ~ #results-container,
  .detail-panel.active ~ #topics-results,
  .report-panel.active ~ #results-container,
  .report-panel.active ~ #topics-results {
      transform: translateX(-100%);
  }

  .article-button.mobile-only {
      display: inline-flex;
      margin-bottom: 10px;
  }

  .mobile-article-link {
      display: block;
  }

  .mobile-article-link.hidden {
      display: none !important;
  }
}

/* 기사 링크 공통 스타일 */
.mobile-article-link {
  display: block;
}

.mobile-article-link.hidden {
  display: none !important;
}

@media (min-width: 769px) {
  .mobile-article-link {
      display: none !important;
  }
}

.result-thumbnail {
  width: 100%;
  max-height: 200px;
  overflow: hidden;
  margin: 10px 0;
  border-radius: 8px;
}

.result-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

/* 데스크탑 레이아웃 */
@media (min-width: 769px) {
  .result-item {
      display: flex;
      flex-direction: row;
      padding: 8px;
      background-color: white;
      border-radius: 8px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      margin-bottom: 8px;
  }

  .result-thumbnail {
      width: 180px;
      
      margin: 0;
      border-radius: 8px;
      flex-shrink: 0;
      overflow: hidden;
  }

  .result-thumbnail img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 8px;
  }

  .result-content {
      padding: 15px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      min-width: 0;
  }

  .result-header {
      margin-bottom: 8px;
  }

  .result-summary {
      margin-bottom: 4px;
      font-size: 0.9rem;
      line-height: 1.4;
      overflow: hidden;
      min-height: 4.2em; /* 3줄 * 1.4(line-height) */
      
  }

}

/* 모바일 레이아웃 */
@media (max-width: 768px) {
  .result-item {
      display: flex;
      flex-direction: column;
      margin-left: 0;
      margin-right: 0;
      
  }

  .result-thumbnail {
      width: 100%;
      height: 120px;  /* 높이 감소 */
      margin: 0 0 4px 0;
      border-radius: 8px;
  }

  .result-thumbnail img {
      border-radius: 8px;
  }

  .result-content {
      display: flex;
      flex-direction: column;
      height: 100%;
      
  }

}

/* 데스크탑 레이아웃 */
@media (min-width: 769px) {

  .topic-card.selected {
      background-color: var(--light-gray);
      border-left: 4px solid var(--primary-color);
      transform: translateX(-10px);
  }

  .topic-actions {
      display: none;
  }
}

/* 모바일 레이아웃 */
@media (max-width: 768px) {
  .topic-card {
      cursor: default;
  }

  .topic-actions {
      display: flex;
      justify-content: flex-end;
      margin-top: 10px;
  }

  .topic-actions .article-button {
      width: 96px;
      display: inline-flex;
      align-items: center;
      padding: 5px 10px;
      background-color: white;
      color: var(--primary-color);
      border: 1px solid var(--primary-color);
      border-radius: 4px;
      font-size: 0.85rem;
      text-decoration: none;
      transition: all 0.2s ease;
      cursor: pointer;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  }

  .topic-actions .article-button:hover {
      background-color: var(--primary-color);
      color: white;
      text-decoration: none;
      transform: translateY(-1px);
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  }
}

/* 로고-텍스트 수평 정렬 */
.logo-wrap {
  display: flex;
  align-items: center;   /* 수직 중앙 */
  gap: 8px;              /* 로고-텍스트 간격 */
}

/* 로고 아이콘 크기 조정 – 필요에 따라 값만 바꾸면 됨 */
.logo-img {
  width: 36px;           /* 모바일 기준 */
  height: 36px;
  margin-bottom: 2px;
  object-fit: contain;
  cursor: pointer;
}

/* 데스크탑에서 조금 크게 보이고 싶다면 */
@media (min-width: 768px) {
  .header .logo-img {
    width: 32px;
    height: 32px;
    padding : 0;
    margin: 0;
  }
}


.topic-detail {
  min-height: 120px; /* 로딩 중일 때 충분히 공간 확보 */
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}
.topic-detail.open {
  max-height: 2000px;
}


.top-right-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 50;
}
.top-right-button.push-left {
  right: 48px;
}

.share-button {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background-color: #f4f4f5; /* ChatGPT 계열 회색 */
  color: #111;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid #d4d4d8;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  text-decoration: none; 
}

.share-button:hover {
  background-color: #e4e4e7;
  border-color: #c7c7cb;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  transform: scale(1.03);
}

.link-button {
  display: inline-block;
  background-color: #eef1f4;
  color: #1f2937;
  font-size: 0.8rem;           /* 글자 크기 더 줄임 */
  font-weight: 500;             /* 약간 더 가볍게 */
  padding: 2px 8px;             /* 패딩 확 줄임 */
  border-radius: 6px;           /* 둥글기는 살짝만 */
  text-decoration: none;
  transition: background-color 0.2s;
  margin: 0 2px;                /* 좌우 여백도 줄임 */
  vertical-align: baseline;     /* 문장 줄과 잘 맞추기 */
}

.link-button:hover {
  background-color: #d6dae0;
  color: #000;
}
.callout {
  background-color: #f9fafb;
  border-left: 4px solid #60a5fa;
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 8px;
  font-size: 0.95rem;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 8px;
}
.h1-like {
  font-size: 2rem;
  font-weight: 700;
}
.h2-like {
  font-size: 1.5rem;
  font-weight: 700;
}
.h3-like {
  font-size: 1.25rem;
  font-weight: 600;
}

.detail-panel.topic-mode {
  padding: 0px;
  margin: 0px;
  width: 50%;
  /* width: 37.5%; */
}
.container {
  /* 부모의 overflow-x:hidden 이 내부 스크롤을 막아서 visible 로 바꿔야 함 */
  overflow-x: visible;
}




/* mobile: 한 장씩 중앙 정렬 스크롤 */
@media (max-width: 768px) {
/* 캐러셀 컨테이너 */
#articles-carousel,
#topics-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory; /* 스크롤 스냅 활성화 */
  -webkit-overflow-scrolling: touch;
  
}

/* 각 카드: 100% 너비, 스냅 포인트는 센터 */
.result-item {
  flex: 0 0 auto;
  width: 100vw; /* 뷰포트 너비 100% */
  scroll-snap-align: center;
  box-sizing: border-box;
  padding: 0;
}
/* ── 모바일 캐러셀 좌/우 버튼 (세로형 네모 + 투명도 ↓) ──────────────── */
@media (max-width: 768px) {
  .carousel-prev,
  .carousel-next {
    width: 24px !important;        /* 가로 ↓  */
    height: 32px !important;       /* 세로 ↑  */
    border-radius: 6px !important; /* 둥근 네모 */
    background: rgba(0, 0, 0, 0.25) !important;  /* 더 투명 */

    font-size: 1.4rem !important;  /* 화살표 크기 ↓ */
    line-height: 1;
    display: flex;                 /* 중앙 정렬 유지 */
    justify-content: center;
    align-items: center;
  }

  .carousel-prev:hover,
  .carousel-next:hover {
    background: rgba(0, 0, 0, 0.4) !important;   /* 호버 시만 살짝 진하게 */
  }
}

/* 좌/우 버튼: 공중부양 */
}

/* Carousel 섹션 전체를 flex 컨테이너로 */
.carousel-section {
  display: flex;
  align-items: center;       /* 버튼·카드 수직 중앙 정렬 */
  gap: 0px;                  /* 버튼 ↔ 카드 사이 여유 */
  position: relative;         /* prev/next 버튼의 절대 위치 기준 */
  margin: 4px 0 8px;
  padding: 0;            /* 좌우 여백: 카드가 버튼에 붙지 않도록 */
}

/* 섹션 제목은 절대 위치로 옮기고, flex 흐름에서 뺍니다 */
.carousel-section > .carousel-title {
  position: absolute;
  top: -32px;
  left: 40px;
  font-size: 1.5rem;
  color: var(--primary-color);
}

/* 카드 컨테이너 */
.carousel-container {
  flex: 1;                    /* 버튼 사이를 꽉 채움 */
  display: flex;
  gap: 14px;                  /* 카드 간격 */
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 2px;                 /* 위아래 여백은 제거 */
  box-sizing: border-box;
}

/* 스크롤바 숨김 */
.carousel-container::-webkit-scrollbar {
  display: none;
}
.result-item {
  background-color: white;
  border-radius: 8px;
  padding: 4px 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
  display : flex;
  flex-direction: column;
}
/* 카드(결과) */
.carousel-container .result-item {
  flex: 0 0 auto;             /* 고정 폭 */
  width: clamp(210px, 20vw, 240px);
  margin: 2px;                  /* 세로 마진 제거 */
  box-sizing: border-box;     /* padding 포함 너비 계산 */
}




.carousel-prev,
.carousel-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;              /* 가로 폭  */
  height: 144px;             /* 세로 길이 */
  border: none;
  border-radius: 6px;       /* 살짝 둥글게 */
  background: rgba(0, 0, 0, 0.25); /* 반투명 검정 */
  color: #fff;
  font-size: 1.6rem;        /* 화살표 크기 */
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;               /* 기본은 숨김 */
  transition: opacity .25s, background .25s;
  z-index: 2;
  margin-top : 2px
}

/* 좌·우 위치 */
.carousel-prev { left: 0px;  }
.carousel-next { right: 0px; }

/* 캐러셀에 마우스 오버 시 나타남 */
.carousel-section:hover .carousel-prev,
.carousel-section:hover .carousel-next {
  opacity: 1;
}

/* 호버 시 더 진하게 */
.carousel-prev:hover,
.carousel-next:hover {
  background: rgba(0, 0, 0, 0.35);
}

/* 모바일(≤768px)에서는 항상 보이게 + 크기 축소 */
@media (max-width: 768px) {
  .carousel-prev,
  .carousel-next {
    display: hidden; /* 기본은 숨김 */
    /* opacity: 1;
    width: 20px;
    height: 64px;
    font-size: 1.4rem;
    background: rgba(0, 0, 0, 0.25); */
  }
  .carousel-prev:hover,
  .carousel-next:hover {
    background: rgba(0, 0, 0, 0.45);
  }
}

@media (max-width: 768px) {
  .carousel-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 2px;
    width: 100vw; 
  }

  .carousel-container::-webkit-scrollbar {
    display: none;
  }

  /* .carousel-container .result-item {
    flex: 0 0 100%;
    scroll-snap-align: center;
    box-sizing: border-box;
    padding: 2px;
    margin: 0;
    width: 100vw;
  } */

  .carousel-section {
    position: relative;
  }

}

/* ──────────────────────────────────────────────
 모바일 모달 공통
 ───────────────────────────────────────────── */
 .mobile-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #fff;
  z-index: 9999;
}
.is-hidden {
  display: none !important;
}

/* 모달 헤더: 제목 영역 확보 + 닫기 버튼만 */
.mobile-modal__header {
  flex: 0 0 48px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end; /* 닫기 버튼 오른쪽 정렬 */
  margin: 8px 14px 0px;
  
}

/* 버튼 기본 공통 */
.modal-btn {
  all: unset;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: background 0.15s;
}
.modal-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

/* 닫기(X) 버튼: 헤더 내부 */
.modal-btn--close {
  width: 28px;
  height: 28px;
  font-size: 1.3rem;
  margin-left: auto;
}

/* 좌/우 버튼: 모달 기준 세로 중앙 */
.modal-btn--prev,
.modal-btn--next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10000;
}
.modal-btn--prev {
  left: 8px;
}
.modal-btn--next {
  right: 8px;
}

.modal-thumb{
  width:100%;
  height:auto;
  max-height: 512px ;
  display:block;
  object-fit:cover;
  margin-bottom:8px;
  border-radius:8px;
}



/* ── 모바일 모달 좌/우 네비 버튼 : 더 투명 + 세로형 네모 ─────────── */
@media (max-width: 768px) {
  .modal-btn.modal-btn--prev,
  .modal-btn.modal-btn--next {
    /* ➊ 모양 - 길쭉한 네모 */
    width: 16px !important;
    height: 48px !important;
    border-radius: 6px !important;

    /* ➋ 투명도 더 낮춤 */
    background: rgba(0, 0, 0, 0.1) !important;

    /* ➌ 아이콘 크기 ↓ */
    font-size: 1.4rem !important;
  }

  .modal-btn.modal-btn--prev:hover,
  .modal-btn.modal-btn--next:hover {
    background: rgba(0, 0, 0, 0.4) !important;
  }
}


/* 모달 본문 */
.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 12px;
  -webkit-overflow-scrolling: touch;
}
/* 모바일 모달이 topic-mode 클래스가 붙어 있을 때만 적용 */
#mobile-detail-modal.topic-mode .modal-body{
  padding:0 !important;   /* 좌우 여백 제거 */
}

/* 모바일 모달 내부로 들어온 desktop 전용 close 버튼 숨기기 */
.mobile-modal .detail-panel-close {
  display: none !important;
}

/* 데스크탑에서는 모바일 모달 표시 X */
@media (min-width: 769px) {
  .mobile-modal {
    display: none !important;
  }
}

/* 썸네일을 기준점으로 */
.youtube-card .result-thumbnail{
position:relative;
}

/* 조회수 뱃지 */
.views-badge{
position:absolute;
top:4px; left:4px;
padding: 8px;
font-size:10px;
line-height:1;
font-weight: 600;
color:#fff;
background:rgba(23,23,23,0.5); 
border-radius:4px;
pointer-events:none;     /* 클릭 막지 않기 */
z-index:2;
}


.result-channel{
white-space: nowrap;        /* 줄바꿈 금지 */
overflow: hidden;           /* 넘치는 글자 감추기 */
text-overflow: ellipsis;    /* … 표시 */
max-width: 120px;           /* ✨ 필요하면 폭 제한 (flex 줄바꿈 방지) */
display: inline-block;      /* flex-item 축소 허용 */
}
/* ── 모바일 카드 slim 모드 (≤ 768 px) ───────────────── */
@media (max-width: 768px) {


  /* 1. 카드 자체 padding ↓ */
  .result-item,
  .article-card,
  .topic-card,
  .youtube-card {
    padding: 8px;
  }

  /* 2. 썸네일 높이만 고정하고 16:9 강제 비율 제거 */
  .result-thumbnail,
  .topic-card .result-thumbnail,
  .youtube-card .result-thumbnail {
    height: 96px !important;               /* 원하는 높이 */
    padding-bottom: 0 !important;/* ← 기존 56.25% 비율 무효화 */
  }

  /* 3. 제목·요약 줄수 제한 & 폰트↓ */
  .result-title {
    font-size: 12px;
    line-height: 1.35;
    margin: 0 ;
    display: -webkit-box;
    padding : 1px 1px;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 100%;
  }

  .result-title-modal{
    margin : 4px 0 8px 0;
  }

  /* 4. 메타·버튼 사이즈 ↓ */

  .toggle-detail-button,
  .article-button   { padding: 4px 8px; font-size: .7rem!important; }

  /* 5. 유튜브 카드는 썸네일 살짝 크게 & 요약 숨김 */
  .youtube-card .result-thumbnail { height: 130px; }
  .youtube-card .result-summary   { display: none; }
  


  .topic-tech-stack {
      font-size: 8px;
  }
  .carousel-container {
      gap: 12px;             /* 카드 사이 살짝 좁힘 */
      padding: 2px;       /* 양옆 여백 */
    }
  
    /* 카드 하나가 뷰포트의 80% 차지 = 2장 살짝 겹쳐 보임 */
    .carousel-container .result-item,
    .carousel-container .article-card,
    .carousel-container .topic-card,
    .carousel-container .youtube-card {
      flex: 0 0 80%;         /* **핵심** — 80% */
      max-width: 40%;
      scroll-snap-align: start; /* 다음 카드가 왼쪽에 슬쩍 보여요 */    
      box-sizing: border-box;
      padding: 2px;
      margin: 0;
      width: 100vw;
      cursor: pointer; /* 클릭 가능하게 */
    }
  
}
.result-views {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: .78rem;
  font-weight: 600;
  padding: 4px 8px;
  background: #f5f5f5;
  border-radius: 9999px;
  white-space: nowrap;
}
.result-views .eye { font-size: .9rem; }


@media (max-width: 768px) {
  /* 전체 카드 공통으로 줄이고 싶다면 .result-views 만 지정 */
  .youtube-card .result-views {
    font-size: 0.75rem;     /* 필요에 따라 0.8rem~0.9rem 사이로 조정 */
    line-height: 1.2;
  }
}

/* ─────────────────  공통 헤더 바  ───────────────── */
.header-bar{
  display:flex;align-items:center;
  height:48px;padding:0 0;
  background:#fff;
}

/* ─────────────────  공유 버튼  ───────────────── */
/* 클래스 이름이 `__share-btn` 으로 끝나는 모든 버튼 */
[class$="__share-btn"]{
  all:unset;
  display:inline-flex;align-items:center;gap:4px;
  padding:6px 12px;border-radius:8px;
  background:#f4f4f5;border:1px solid #d4d4d8;
  color:#111;font-weight:500;cursor:pointer;
  box-shadow:0 1px 2px rgba(0,0,0,.05);
  transition:background .15s;
}
[class$="__share-btn"]:hover{background:#e4e4e7}

/* 아이콘 크기(기본 14px) */
[class$="__share-btn"] .icon{font-size:14px;}

/* 모바일(모달)·데스크탑(패널) 글꼴 크기 분리 */
.mobile-modal__share-btn .label {font-size:12px;}
.detail-bar__share-btn  .label {font-size:14px;}

/* ─────────────────  닫기(X) 버튼  ───────────────── */
[class$="__close-btn"]{
  all:unset;
  cursor:pointer;
  font-size:24px;line-height:1;
  color:#222;
}
[class$="__close-btn"]:hover{color:#000}

/* ─────────────────  유틸  ───────────────── */
.spacer{flex:1;}   /* 가운데 여백용 */

/* 클릭 가능한 헤더 로고 (h1.logo-text) */
.logo-text{
  cursor: pointer;            /* 마우스를 손가락 아이콘으로 */
  transition: color .15s;     /* 색 변화 부드럽게 */
}
/* ────── 상단바 레이아웃 ────── */
/* 상단바 ---------------------------------------------------- */


/* 로고 그룹 */
.logo-wrap{display:flex;align-items:center;gap:8px}
.logo{margin:0;font-size:20px;font-weight:600;cursor:pointer}


/* ───── 버튼 — input 위에 겹치기 ───── */
#search-button{
position: absolute;
top: 50%; left: 8px;               /* 박스 안 오른쪽 끝 */
transform: translateY(-50%);
width: 24px; height: 24px;
border: none;
background: transparent;
color: var(--primary-color);
font-size: 18px;
display: flex; justify-content: center; align-items: center;
cursor: pointer;
border-radius: 50%;
transition: background .15s;
}

#search-button:hover   { background: rgba(0,0,0,.05); }




.menu-btn{
  font-size:32px;
  background:none;
  border:none;
  cursor:pointer;
  padding:4px 16px;
  font-weight: 100;
  color: var(--text-light);
}

.menu-dropdown{
  position:absolute;
  right:20px;
  top:56px;
  z-index:1000;

  background:#fff;
  border:1px solid #e5e5e5;
  border-radius:16px;              /* 둥글게 */
  box-shadow:0 6px 24px rgba(0,0,0,.08);
  padding:8px 0;                   /* 위·아래 여백 */
  
  opacity:0;
  transform:translateY(-12px);
  pointer-events:none;
  transition:opacity .25s ease, transform .25s ease;
  text-decoration: none;
}
.menu-dropdown.active{
  opacity:1;
  transform:translateY(0);
  pointer-events:auto;
}

/* ─── 리스트 & 아이템 ─── */
.menu-list{list-style:none;margin:0;padding:0;width:210px;}

.menu-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 16px;
  font-size:15px;
  cursor:pointer;
  user-select:none;
  color:#111;              /* 원하는 글자색 */
  text-decoration:none;
 
}
.menu-item:hover{background:#f6f6f6}

/* 아이콘 & 화살표 */
.menu-item .icon{font-size:20px;line-height:1}
.menu-item .arrow{margin-left:auto;font-size:18px;line-height:1}

/* 구분선 */
.divider{
  height:1px;
  margin:4px 0 4px 16px;
  background:#e5e5e5;
}

/* 삭제(위험) 항목 */
.menu-item.danger{
  color:#d32f2f;
}
.menu-item.danger:hover{
  background:rgba(211,47,47,0.1);
}

/* 새 래퍼: .container 와 동일한 폭·여백 */

/* 반응형(모바일) ------------------------------------------------ */
@media (max-width:768px){
#home-logo{
display: none !important;
}

.menu-btn{
padding : 0px 12px 0 18px;
}
.container{
margin-top: 56px;
}
.logo{font-size:16px}


}

h3 {
  margin: 4px 0 0;   /* 위 8 px, 아래 4 px 정도로 압축 */
  line-height: 1.2;     /* 필요하면 줄 간격도 살짝 */
}




#selection-search-button {
  position: fixed;
  display: none;
  z-index: 2147483647;

  /* btn-small */
  min-height: 30px;
  padding-block: 0.5rem;    /* 원래 calc(var(--spacing)*1) */
  padding-inline: 1rem;     /* 원래 calc(var(--spacing)*3) */

  /* btn-secondary (변수 대신 실제 값) */
  background-color: #ffffff;    /* var(--main-surface-primary) 대신 흰색 */
  border: 1px solid #d1d5db;    /* var(--border-medium) 대신 Tailwind gray-300 */
  color: #000000;               /* var(--text-primary) 대신 검은색 */
  font-size: 0.875rem;          /* var(--text-sm) */
  line-height: 1.25rem;         /* var(--text-sm--line-height) */
  font-weight: 500;

 /* 공통 스타일 */
  border-radius: 9999px;
  cursor: pointer;

  /* shadow-lg */
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1);
}
/* 섹션 헤더: 제목 ↔ 버튼 배치 */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
}


/* Netflix 스타일 “더보기” 버튼 */
.btn-more {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-light);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  text-decoration: none;
  transition: background-color 0.2s;
}

.section-header > h3 {          
  font-size: 18px;
  font-weight: 500;
}
@media (max-width: 768px) {
  /* 기사·토픽 캐러셀 바로 위 h3 */
  .section-header > h3 {          /* 필요하면 .carousel-section 이전 h3 로 좁혀도 OK */
    margin: 2px 0 6px;       /* 위 8 px, 아래 4 px 정도만 */
    line-height: 1.3;        /* (선택) 제목 자체도 살짝 압축 */
    font-size: 12px;
  }
  .btn-more {
  font-size: 12px;
  font-weight: 500;
}
}

