/* ============================================================
   MyWellnessCalc — Global Stylesheet
   assets/css/style.css
   ============================================================ */

:root {
  --sage: #7a9e7e;
  --sage-light: #a8c5ac;
  --sage-dark: #4a6b4e;
  --cream: #f7f3ee;
  --warm-white: #fdfaf6;
  --charcoal: #2a2a2a;
  --mid: #5a5a5a;
  --light: #9a9a9a;
  --border: #e8e2da;
  --accent: #d4845a;
  --accent-light: #f0c5a8;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--warm-white);
  color: var(--charcoal);
  line-height: 1.6;
}

/* ── NAV ── */
nav {
  position: sticky; top: 0; z-index: 200;
  background: rgba(253,250,246,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo {
  font-family: 'Fraunces', serif;
  font-size: 1.25rem; font-weight: 600;
  color: var(--sage-dark);
  text-decoration: none;
  flex-shrink: 0;
}
.logo span { color: var(--accent); }

/* ── TOP-LEVEL NAV ── */
.nav-links {
  display: flex; gap: 0; list-style: none; align-items: center; height: 64px;
}
.nav-links > li {
  position: relative; height: 100%;
  display: flex; align-items: center;
}
.nav-links > li > a,
.nav-links > li > button {
  font-size: 0.875rem; font-weight: 500;
  color: var(--mid); text-decoration: none;
  background: none; border: none; cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  padding: 0 1rem; height: 100%;
  display: flex; align-items: center; gap: 0.3rem;
  transition: color 0.2s;
  white-space: nowrap;
}
.nav-links > li > a:hover,
.nav-links > li > button:hover,
.nav-links > li > a.active { color: var(--sage-dark); }

.nav-links > li > button::after {
  content: '▾';
  font-size: 0.7rem;
  transition: transform 0.2s;
}
.nav-links > li.open > button::after { transform: rotate(180deg); }

/* ── DROPDOWN ── */
.nav-dropdown {
  display: none;
  position: absolute; top: 100%;
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  min-width: 240px;
  padding: 0.75rem 0;
  z-index: 300;
  white-space: nowrap;
}
/* Calculators: 왼쪽 정렬 */
.nav-has-dropdown:nth-child(1) .nav-dropdown { left: 0; }
/* Blog: 오른쪽 정렬 — 화면 밖으로 안 나가게 */
.nav-has-dropdown:nth-child(2) .nav-dropdown { right: -80px; left: auto; }

.nav-links > li.open .nav-dropdown { display: block; }

.nav-dropdown-section {
  padding: 0.25rem 0;
}
.nav-dropdown-section + .nav-dropdown-section {
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
  padding-top: 0.5rem;
}
.nav-dropdown-label {
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--light);
  padding: 0.25rem 1rem 0.4rem;
}
.nav-dropdown a {
  display: block;
  padding: 0.45rem 1.25rem;
  font-size: 0.85rem; color: var(--mid);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-dropdown a:hover {
  background: var(--cream);
  color: var(--sage-dark);
}

/* ── BACK LINK ── */
.nav-back {
  font-size: 0.875rem; color: var(--mid); text-decoration: none;
  display: flex; align-items: center; gap: 0.4rem;
}
.nav-back:hover { color: var(--sage-dark); }

/* ── FOOTER ── */
footer {
  background: var(--charcoal); color: rgba(255,255,255,0.6);
  padding: 2rem; margin-top: 4rem;
}
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem;
}
.footer-logo { font-family: 'Fraunces', serif; font-size: 1.1rem; color: white; text-decoration: none; }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: rgba(255,255,255,0.5); text-decoration: none; font-size: 0.85rem; transition: color 0.2s; }
.footer-links a:hover { color: white; }
.footer-copy { font-size: 0.8rem; }

/* ── HAMBURGER ── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px; height: 36px;
  background: none; border: none; cursor: pointer; padding: 4px;
  flex-shrink: 0;
}
.nav-hamburger span {
  display: block;
  height: 2px; width: 100%;
  background: var(--charcoal);
  border-radius: 2px;
  transition: all 0.25s;
  transform-origin: center;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── MOBILE ── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--warm-white);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0 1rem;
    gap: 0;
    z-index: 199;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    height: auto;
    align-items: stretch;
  }
  .nav-links > li {
    height: auto;
    flex-direction: column;
    align-items: stretch;
    border-bottom: 1px solid var(--border);
  }
  .nav-links > li:last-child { border-bottom: none; }
  .nav-links > li > a,
  .nav-links > li > button {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    height: auto;
    justify-content: space-between;
    width: 100%;
  }

  /* 모바일 드롭다운 */
  .nav-dropdown {
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    border-top: 1px solid var(--border);
    padding: 0;
    background: var(--cream);
    white-space: normal;
    min-width: unset;
    width: 100%;
  }
  /* 모바일에선 left/right 오버라이드 */
  .nav-has-dropdown:nth-child(1) .nav-dropdown,
  .nav-has-dropdown:nth-child(2) .nav-dropdown {
    left: auto; right: auto;
  }
  .nav-links > li.open .nav-dropdown { display: block; }
  .nav-dropdown-label { padding: 0.625rem 1.5rem 0.25rem; }
  .nav-dropdown a {
    padding: 0.6rem 2rem;
    font-size: 0.9rem;
    white-space: normal;
  }
  .nav-dropdown-section + .nav-dropdown-section {
    border-top: 1px solid var(--border);
  }
}
