/* =====================
   Header Component Styles
   ===================== */
:root {
  --border: #e6e7ea;
}
.header-wrap{background: white; 
  align-items:center;}
.site-header{
  display:grid;
  grid-template-columns:240px 1fr 240px;   /* PC 기본 */
  grid-template-areas:"brand search quick";
  padding:16px 16px;                          /* 얕은 상하 여백 */
  background: white;
  max-width: 1200px;
  margin: 0 auto;        
}
.brand{ grid-area:brand; display:flex; align-items:center; gap:.5rem; }
.brand picture{ display:flex; align-items:center; }
.brand .logo{ height:100%; width:auto; max-height:none; }

.search{
  grid-area:search; justify-self:center; position:relative;
  width:100%; max-width:47.5rem; height:2.625rem;
  display:flex; align-items:center; background:var(--card);
  border:3px solid var(--primary); border-radius:999px;
  padding:0 16px;
  margin-inline: auto;
  box-sizing: border-box;
  width: min(48rem, 92vw);
}
.search .search-icon{
  position:absolute; left:14px; top:50%; transform:translateY(-50%);
  pointer-events:none; display:flex; align-items:center;
}
.search .search-icon img{ width:18px; height:18px; object-fit:contain; display:block; }
.search input{
  flex:1; height:100%; border:0; outline:0; background:transparent;
  color:var(--text); font-size:.95rem; padding:0 0 0 1.5rem;
}
.search input::placeholder{ color:#31527e; opacity: 1;}
.search input[type="search"]::-webkit-search-cancel-button{
  -webkit-appearance:none; appearance:none; width:20px; height:20px; background-color:var(--primary);
  -webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M6 6 L14 14 M14 6 L6 14' stroke='white' stroke-width='2' stroke-linecap='round'/></svg>");
          mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M6 6 L14 14 M14 6 L6 14' stroke='white' stroke-width='2' stroke-linecap='round'/></svg>");
  -webkit-mask-repeat:no-repeat; mask-repeat:no-repeat;
  -webkit-mask-position:center;  mask-position:center;
  -webkit-mask-size:contain;     mask-size:contain;
}

.quick{ grid-area:quick; justify-self:end; display:flex; gap:.75rem; align-items:center; }
.btn{ padding:.5rem .9rem; border-radius:999px; border:1px solid var(--border); background:var(--card); cursor:pointer; }
.btn.ghost{ background:transparent; border:1px solid var(--border); }
#langBtn { border:1px solid var(--border); cursor:pointer; }
/* #langBtn:hover { background-color:rgba(206, 136, 146, 0.1); } */
.link{ text-decoration:none; color:var(--text); }

/* --- Header responsive --- */
@media (max-width:1024px){
  .site-header{
    grid-template-columns:1fr 1fr;
    grid-template-areas:"brand quick" "search search";
    padding:20px 16px;
  }
  .search{ width: 80%; height:40px; border-width:3px;}
}
@media (max-width:768px){
  .search{ height:38px;}
  .search .search-icon img{ width:16px; height:16px; }
  .search input{ font-size:.9rem; padding-left:26px; }
  .site-header .quick .btn{
    display:inline-flex; align-items:center; justify-content:center;
    min-height:32px; padding:6px 10px; border:1px solid #e6e6e6; border-radius:999px;
    font-size:12px; line-height:1; background:#fff; white-space:nowrap;
  }
}
@media (max-width:480px){
  .site-header{
    grid-template-columns:1fr auto;
    grid-template-areas:"brand quick" "search search";
    padding:16px 16px 14px;
  }
  .brand .logo{ max-height:18px !important; height:auto; width:auto; }
  .search{ height:36px; border-width:2px; padding:0 14px;}
  .search .search-icon{ left:12px; }
  .search input{ font-size:.9rem; padding-left:24px; }
  .quick{ gap:.5rem; }
  .quick .btn{ display:none; }
}
/* 데스크톱 보강 */
@media (min-width:1025px){
  .site-header{ grid-template-columns:1fr 2fr 1fr; }
  .site-header .brand .logo{ max-height:56px; }
  .site-header .search{
    max-width:700px; height:46px; border-width:2px; padding:0 18px 0 42px;
  }
  .site-header .search .search-icon{ left:16px; }
  .site-header .search .search-icon img{ width:20px; height:20px; }
  .site-header .search input{ line-height:46px; padding:0; font-size:16px; }
}
@media (min-width:481px){ .site-header .search{ border-width:3px !important; } }
@media (max-width:480px){ .site-header .search{ border-width:2px !important; } }
@media (min-width: 480px) and (max-width: 1024px){
  .site-header .brand { min-width: 0; }
  .site-header .brand picture { display:flex; align-items:center; }
  .site-header .brand .logo{
    height: auto !important;
    width:  auto !important;
    max-height: 24px;
    object-fit: contain;
    display: block;
  }
}

/* ===== Language Popover Styles ===== */
.lang-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 2000;
  display: none;
}
.lang-overlay.is-open { display: block; }

.lang-popover {
  position: fixed;
  min-width: 220px;
  max-height: 60vh;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.95);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 50px rgba(0,0,0,.15);
  animation: lang-pop-in .16s ease-out;
}

@keyframes lang-pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.lang-popover::after {
  content: "";
  position: absolute;
  top: -6px;
  right: 18px;
  width: 12px; height: 12px; transform: rotate(45deg);
  background: inherit;
  border-left: 1px solid rgba(0,0,0,.08);
  border-top: 1px solid rgba(0,0,0,.08);
  -webkit-backdrop-filter: inherit; backdrop-filter: inherit;
}

.lang-list {
  margin: 6px;
  padding: 6px;
  list-style: none;
}
.lang-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 12px 14px;
  border: 0; background: transparent;
  border-radius: 10px; cursor: pointer;
  font: inherit; color: #111;
}
.lang-item:hover { background: rgba(0,0,0,.06); }
.lang-item[aria-checked="true"] {
  background: transparent;
  font-weight: 700;
}

.lang-flag { font-size: 18px; line-height: 1; }

#langBtn{
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.langbtn-label { display: inline-block; }

/* ===== 반응형 ===== */
@media (min-width: 641px) and (max-width: 1023px) {
  .lang-popover { min-width: 320px; }
}

@media (max-width: 640px) {
  .lang-overlay.is-open { background: rgba(0,0,0,.35); }

  .lang-popover {
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    display: flex; flex-direction: column;
    animation: none;
  }
  .lang-popover::after { display: none; }

  .lang-header {
    position: sticky; top: 0;
    display: flex; align-items: center; justify-content: center;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    background: #fff; z-index: 1;
  }
  .lang-header .title { font-weight: 700; font-size: 16px; }
  .lang-header .close {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px; border: 0;
    border-radius: 10px; background: #f4f4f4;
    font-size: 20px; line-height: 36px;
    cursor: pointer;
  }

  .lang-list {
    margin: 0; padding: 10px 12px 20px;
    overflow: auto; flex: 1;
  }

  #langBtn{
    padding: 6px 10px;
    gap: 4px;
  }
  .langbtn-label{ font-size: .72rem; }
}

@media (min-width: 641px) {
  .lang-header { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .lang-popover { animation: none; }
}
