/* ========================================
   Default Styles - Reset & Base
   ======================================== */

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

html {
  font-size: var(--font-size-base);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-4) 0;
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p {
  margin: 0 0 var(--space-4) 0;
}

/* Links */
a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-secondary-dark);
  text-decoration: underline;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* Lists */
ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

li {
  list-style: none;
}

/* Tables */
table {
  border-collapse: collapse;
  width: 100%;
}

/* Forms */
input, button, textarea, select {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="search"],
textarea,
select {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  transition: border-color var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: 500;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

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

.btn-secondary {
  background: var(--color-secondary);
  color: white;
}

.btn-secondary:hover {
  background: var(--color-secondary-dark);
  color: white;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.btn-outline:hover {
  background: var(--color-bg-gray);
  text-decoration: none;
}

/* Utilities */
.sound_only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

/* Skip Navigation */
#skip_to_container a {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: 9999;
  padding: var(--space-3) var(--space-4);
  background: var(--color-primary);
  color: white;
}

#skip_to_container a:focus {
  top: 0;
}

/* Login Message */
#hd_login_msg {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 9999;
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: white;
  font-size: var(--font-size-sm);
  border-radius: 0 0 0 var(--radius-md);
}

#hd_login_msg a {
  color: white;
  margin-left: var(--space-2);
}

/* ========================================
   팝업 레이어 숨김 (기본 상태)
   ======================================== */
#hd_pop {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

#hd_pop h2,
#hd_pop noscript,
#hd_pop > .sound_only {
  display: none !important;
}

/* 팝업이 있을 때만 표시 (:has 지원 브라우저) */
#hd_pop:has(.hd_pops),
#hd_pop.has_popup {
  display: block !important;
  visibility: visible !important;
  position: relative !important;
  left: auto !important;
  width: auto !important;
  height: 0 !important;
  overflow: visible !important;
  z-index: 1000;
  margin: 0 auto;
}

#hd_pop:has(.hd_pops) h2,
#hd_pop.has_popup h2 {
  display: block !important;
  position: absolute;
  font-size: 0;
  line-height: 0;
  overflow: hidden;
}

/* 팝업 스타일 */
.hd_pops {
  position: absolute;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
}

.hd_pops img {
  max-width: 100%;
}

.hd_pops_footer {
  padding: 0;
  background: var(--color-text);
  color: white;
  text-align: left;
  position: relative;
  display: flex;
}

.hd_pops_footer::after {
  display: block;
  visibility: hidden;
  clear: both;
  content: "";
}

.hd_pops_footer button {
  padding: var(--space-2) var(--space-3);
  border: 0;
  color: white;
  cursor: pointer;
  font-size: var(--font-size-sm);
}

.hd_pops_footer .hd_pops_reject {
  background: var(--color-text);
  text-align: left;
  flex: 1;
}

.hd_pops_footer .hd_pops_close {
  background: var(--color-text-light);
}
