/* components/site-shell.css — shared site shell + footer + scroll-top (SSOT) */

:root {
  --site-header-content: 1200px;
  --site-nav-desktop-width: 470px;
  --site-header-bg: rgba(244, 247, 246, 0.86);
  --site-header-border: var(--pn-border-main);
  --site-heading-color: var(--pn-card-heading);
  --site-muted-color: var(--pn-text-muted);
  --site-surface-soft: var(--pn-pill-bg);
  --site-nav-gap: 0.75rem;
  --site-nav-item-padding: 0.56rem 0.84rem;
  --site-nav-button-border: var(--pn-border-main);
  --site-nav-panel-bg: var(--pn-bg-container);
  --site-shell-shadow: var(--pn-shadow-brand);
  --site-footer-padding: 30px 20px;
  --site-footer-bg: var(--pn-footer-bg);
  --site-footer-text: var(--pn-footer-text);
  --site-footer-border: var(--pn-border-light);
}

[data-theme="dark"] {
  --site-header-bg: rgba(11, 21, 32, 0.86);
}

html {
  scrollbar-gutter: stable;
}

.page-shell,
.site-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: clip;
}


.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: var(--site-header-bg);
  border-bottom: 1px solid var(--site-header-border);
}

.site-header .container {
  width: min(calc(100% - 2rem), var(--site-header-content));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 78px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  transform: translateY(1.5px);
  color: inherit;
  text-decoration: none;
}

.brand:visited {
  color: inherit;
  text-decoration: none;
}

.brand-copy {
  line-height: normal;
}

.brand-mark {
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 3rem;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.brand-copy small {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--site-muted-color);
}

.brand-copy strong {
  display: block;
  font-size: 1.05rem;
  color: var(--site-heading-color);
}

.nav-toggle {
  display: none;
  border: 0;
  background: transparent;
  padding: 0.5rem;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 1.4rem;
  height: 2px;
  margin: 0.26rem 0;
  border-radius: var(--pn-radius-pill);
  background: var(--site-heading-color);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--site-nav-gap);
  width: min(100%, var(--site-nav-desktop-width));
}

.site-nav a,
.site-nav [data-theme-toggle] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--site-nav-item-padding);
  border-radius: var(--pn-radius-pill);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
}

.site-nav a,
.site-nav a:visited {
  color: var(--site-heading-color);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a.active,
.site-nav [data-theme-toggle]:hover {
  background: var(--site-surface-soft);
}

.site-nav [data-theme-toggle] {
  border: 1px solid var(--site-nav-button-border);
  background: transparent;
  color: var(--site-heading-color);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  line-height: normal;
  cursor: pointer;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 960px) {
  .site-nav {
    position: absolute;
    inset: calc(100% + 0.7rem) 1rem auto 1rem;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    border-radius: var(--pn-radius-lg);
    border: 1px solid var(--site-nav-button-border);
    background: var(--site-nav-panel-bg);
    box-shadow: var(--site-shell-shadow);
    width: auto;
  }

  .site-nav.is-open {
    display: flex;
  }

  .nav-toggle {
    display: inline-block;
  }
}

@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: start;
  }

  .nav-toggle {
    align-self: flex-end;
  }
}

/* Site Footer */
.site-footer {
  text-align: center;
  padding: var(--site-footer-padding);
  background-color: var(--site-footer-bg);
  color: var(--site-footer-text);
  font-size: 0.9em;
  border-top: 1px solid var(--site-footer-border);
  width: 100%;
  box-sizing: border-box;
}

.site-footer p {
  margin: 10px 0 0;
  font-size: 0.8em;
  color: var(--site-footer-text);
}

.footer-links {
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
}

.footer-link {
  display: inline-block;
  line-height: 1.35;
  text-align: center;
  color: var(--pn-btn-primary-bg);
  text-decoration: none;
  margin: 0;
  transition: color 0.3s ease;
}

.footer-link:hover {
  color: var(--pn-btn-primary-hover-bg);
}

.separator {
  display: none;
}

.footer-links-collapsible {
  margin: 0 auto 10px;
}

.footer-links-summary {
  display: none;
}

.footer-links-collapsible > .footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin-bottom: 0;
}

/* Scroll FAB buttons (↑ / ↓) */
.scroll-top-button,
.scroll-bottom-button {
  position: fixed;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: var(--pn-radius-pill);
  border: 1px solid var(--pn-btn-primary-bg);
  background: var(--pn-btn-primary-bg);
  color: var(--pn-btn-primary-text);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.26);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
  z-index: 900;
}

.scroll-bottom-button {
  bottom: calc(16px + env(safe-area-inset-bottom));
}

.scroll-top-button {
  bottom: calc(68px + env(safe-area-inset-bottom));
}

.scroll-top-button.is-visible,
.scroll-bottom-button.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top-button:hover,
.scroll-bottom-button:hover {
  background: var(--pn-btn-primary-hover-bg);
}

/* 모바일 터치: 스크롤 중 버튼 페이드 */
@media (hover: none) and (pointer: coarse) {
  .is-fab-scrolling .scroll-top-button.is-visible,
  .is-fab-scrolling .scroll-bottom-button.is-visible {
    opacity: 0.15;
    pointer-events: none;
  }
}

/* 모바일: FAB 버튼 위치 조정 (겹침 방지) */
@media (max-width: 768px) {
  .scroll-bottom-button {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .scroll-top-button {
    right: 12px;
    bottom: calc(64px + env(safe-area-inset-bottom));
  }
}

/* 모바일: 푸터 링크 접기/펼치기 */
@media (max-width: 768px) {
  .footer-links-collapsible {
    margin-top: 12px;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
  }

  .footer-links-summary {
    display: block;
    cursor: pointer;
    color: var(--pn-btn-primary-bg);
    font-size: 0.9rem;
    font-weight: 700;
    list-style: none;
  }

  .footer-links-summary::-webkit-details-marker {
    display: none;
  }

  .footer-links-summary::after {
    content: " ▾";
  }

  .footer-links-collapsible[open] .footer-links-summary::after {
    content: " ▴";
  }

  .footer-links-collapsible > .footer-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: center;
    gap: 6px 10px;
    margin-top: 8px;
    margin-bottom: 0;
    max-height: 36px;
    overflow: hidden;
    transition: max-height 0.2s ease;
  }

  .footer-links-collapsible[open] > .footer-links {
    max-height: 240px;
  }
}
