/* ============================================================
   TimeNest — 사이트 액자 (헤더·푸터)
   ------------------------------------------------------------
   **모든 페이지가 이 파일을 읽는다.** 예전에는 헤더 규칙이 두 군데 있었다 —
   홈·가이드는 `site.css`, changelog·blog·약관은 `css/style.css`. 그래서
   같은 `header.js` 가 그린 헤더인데 페이지마다 다르게 보였고, 특히
   `.header-cta` 는 `site.css` 에만 있어서 나머지 페이지에서는 스타일 없는
   맨 링크로 떨어졌다.

   `js/header.js` 와 `js/footer.js` 가 마크업과 색을 인라인으로 들고 있으므로
   여기에는 **그것으로 안 되는 것만** 둔다: 고정 위치, 스크롤 상태, 좁은
   화면 조정, CTA 버튼.

   토큰은 `site.css` 에 있지만 그 파일을 안 읽는 페이지도 있으므로
   `var(--x, 기본값)` 으로 받는다.
   ============================================================ */

:root { --header-h: 84px; }

#main-header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    width: 100%;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* main.js 가 스크롤에 따라 붙인다 */
#main-header.scrolled {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

/* 헤더의 다운로드 버튼. 인라인으로 칠해진 nav 안에 서지만 이것만은
   클래스로 둔다 — 전 페이지에 붙는 결정 지점이라 한 곳에서 다뤄야 한다. */
.header-cta {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: var(--gold-fill, #CBA135);
    color: #1A1408 !important;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 0 !important;
    white-space: nowrap;
    transition: filter 0.15s ease;
}
.header-cta:hover { filter: brightness(1.07); }

@media (max-width: 480px) {
    .header-cta { padding: 0.4rem 0.7rem; font-size: var(--fs-xs, 0.8125rem); }
}

/* 헤더가 떠 있으므로 본문이 그만큼 내려가야 한다 */
main { padding-top: var(--header-h); }

@media (max-width: 900px) {
    #main-header nav { gap: 20px !important; }
    #main-header nav a { font-size: 0.85rem !important; }
}

@media (max-width: 768px) {
    :root { --header-h: 64px; }
    #main-header { padding: 12px 0 !important; }
    #main-header .container { flex-wrap: nowrap; gap: 12px; padding: 0 12px !important; }
    /* 좁은 화면에서는 로고 글자를 접고 그림만 남긴다 */
    #main-header .logo span { display: none !important; }
    #main-header .logo img { width: 32px !important; height: 32px !important; }
    #main-header nav { gap: 12px !important; }
    #main-header nav a { font-size: 0.8rem !important; }
}

@media (max-width: 480px) {
    :root { --header-h: 58px; }
    #main-header .container { padding: 0 10px !important; gap: 8px; }
    #main-header .logo img { width: 30px !important; height: 30px !important; }
    #main-header nav { gap: 8px !important; }
    #main-header nav a { font-size: 0.7rem !important; }
}

/* 푸터 링크 팜이 좁은 화면에서 3단을 고집하지 않게 */
@media (max-width: 780px) {
    #main-footer .container > div:first-child {
        grid-template-columns: 1fr !important;
        gap: var(--s-5, 2rem) !important;
    }
}

