/* homes/index.html 일반 사용자 파트 전용 스타일 */
/* ===== member-home =====
   배경 이미지는 index.html에서 <link rel="preload">로 LCP 최적화.

   외부 CSS 오버라이드 (이 파일이 로드될 때 같이 로드되는 전역 CSS):
   - material-kit.css .page-header { height: 100vh } → height: auto
   - site-kit.css .full-height { height: 100vh; align-items: center } → height: auto + safe center
   - site-kit.css .button-wrapper { margin-top: 150px } → 모바일에서 90px
   - material-kit.css .page-header .container { padding-top: 160px } → .full-height padding-top: 90px
*/
#main-page-header {
    /* background-image는 템플릿 인라인 스타일로 url_for() 통해 주입 —
       preload URL과 일치시켜 브라우저 "preloaded but not used" 경고 방지. */
    background-position: top center;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
    position: relative;
    box-sizing: border-box;  /* padding이 min-height에 포함되게 — 스크롤 없이 footer 분리 */
    height: auto;  /* material-kit.css .page-header { height: 100vh } 오버라이드 */
    min-height: calc(100vh - 62px);
    padding-bottom: 80px;  /* footer와 분리 — 콘텐츠 아래 여백 */
}
@supports (height: 100dvh) {
    #main-page-header {
        min-height: calc(100dvh - 62px);
    }
}

#main-page-header-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(255,248,235,0.50) 0%, rgba(250,240,210,0.30) 50%, rgba(60,40,10,0.15) 100%);
    pointer-events: none;
    z-index: 1;
}

/* 터치 기기/모바일에서 background-attachment:fixed 깨짐 방지
   (components.css의 .ml-main 등 공통 패턴과 동일하게 처리) */
@media (hover: none) and (pointer: coarse) {
    #main-page-header {
        background-attachment: scroll;
    }
}
@media (max-width: 767px) {
    #main-page-header {
        background-attachment: scroll;
    }
}

#main-page-header .container-fluid.full-height {
    position: relative;
    z-index: 2;
    box-sizing: border-box;  /* padding-top이 min-height에 포함되게 — 스크롤 방지 */
    height: auto;  /* site-kit.css .full-height { height: 100vh } 오버라이드 */
    min-height: calc(100vh - 62px - 80px);  /* navbar(62px) + footer 여백(80px) 제외 */
    padding-top: 90px;  /* navbar(62px) + 여백 */
    align-items: safe center;  /* 콘텐츠가 화면 초과해도 위로 밀어 올리지 않음 */
}

/* ---- 타이틀 진입 연출: fade-in + 미세 위로 올라옴 ----
   브랜드 카드 순차 등장과 오케스트레이션. 타이틀이 먼저, 카드가 뒤따름.
   transform/opacity만 애니메이션 (compositor-friendly). */
#main-title-img {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
#main-title-img.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* 오늘의 학습 카드 */
#today-study-card {
    display: none;
    margin: 16px auto;
    max-width: 360px;
    background: rgba(255,255,255,0.95);
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.05);
    border: none;
    overflow: hidden;
    position: relative;
    opacity: 0;
    transition: opacity 0.6s ease;
}
#today-study-card.is-visible {
    opacity: 1;
}

#today-study-card .stat-details {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 22px;
}

.today-study-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F5A623 0%, #F97316 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(245, 166, 35, 0.3);
    flex-shrink: 0;
}

.today-study-icon .material-icons {
    font-size: 26px;
    color: #fff;
}

#today-study-card .today-study-text {
    text-align: left;
}

#today-study-card .stat-label {
    font-size: 13px;
    color: #888;
    font-weight: 600;
    letter-spacing: -0.3px;
}

#today-study-card .stat-value {
    font-size: 24px;
    font-weight: 800;
    color: #333;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-top: 2px;
}

/* 마지막 학습 교재 영역 (latest가 있을 때) — 교재 중심, 시간은 보조 */
#today-study-card.has-latest {
    max-width: 420px;
}
.today-study-last {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    padding: 14px 16px;
    border-radius: 12px;
    transition: background-color 0.15s ease;
}
.today-study-last:hover {
    background: rgba(250, 167, 22, 0.08);
}
.today-study-last:focus-visible {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}
.today-study-last-thumb {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f8f3e9;
    display: flex;
    align-items: center;
    justify-content: center;
}
.today-study-last-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.today-study-last-text {
    text-align: left;
    min-width: 0;
    flex: 1;
}
.today-study-last-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    line-height: 1.3;
    letter-spacing: -0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.today-study-last-sub {
    font-size: 12px;
    color: #888;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
    padding-left: 12px;
    line-height: 1.4;
}
.today-study-last-cta {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #faa716;
    letter-spacing: -0.2px;
}
.today-study-last-cta .material-icons {
    font-size: 16px;
    transition: transform 0.15s ease;
}
.today-study-last:hover .today-study-last-cta .material-icons {
    transform: translateX(2px);
}

/* 하단 학습 시간 보조 행 — 교재 아래 한 줄.
   시간이 있을 때만 표시 (JS가 display 제어). */
.today-study-time-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 14px;
    color: #888;
}
.today-study-time-row .material-icons {
    font-size: 18px;
    color: #F5A623;
}
.today-study-time-row .stat-label {
    font-size: 14px;
    color: #888;
    font-weight: 600;
    letter-spacing: -0.3px;
    margin: 0;
}
.today-study-time-row .stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    letter-spacing: -0.3px;
    line-height: 1.2;
    margin: 0;
    font-variant-numeric: tabular-nums;  /* 카운트업 중 숫자 너비 변동 방지 */
}

/* 브랜드 카드 묶음 */
#member-brand-cards {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

#member-brand-cards .button-wrapper {
    width: 25%;
    max-width: 220px;
    min-width: 160px;
    padding: 0 10px;
    box-sizing: border-box;
}

#member-brand-cards .CD-image {
    max-width: 100%;
    height: auto;
}

#member-brand-cards .button-content img.brand-logo {
    height: 50px;
    max-width: 100%;
}

#member-brand-cards .button-content p {
    word-break: keep-all;
}

/* ============================================================
   회원 파트 인터랙션 (index.html 전용, scoped)
   시그니처: CD hover 회전 (site-kit.css .button-wrapper:hover .CD-image)
   그 외 hover 위로 떠오름/scale/패럴랙스/무한 펄스는 제거.
   진입 연출: 카드 순차 fade-in 1회만.
   ============================================================ */

/* ---- 카드 hover: CD 회전이 시그니처이므로 카드 본체는 정지 + 미세 그림자 ----
   기본 btnPush의 translateY(10px) 아래 눌림도 CD 메타포와 충돌하므로 neutralize.
   브랜드 배경색 전환(site-kit.css)은 그대로 유지. */
#member-home .btnPush,
#member-home .btnPush:hover,
#member-home .btnPush:active {
    transform: translateY(0);
    box-shadow: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
#member-home .button-content {
    transition: background 0.3s ease, box-shadow 0.25s ease;
}
#member-home .button-wrapper:hover .button-content {
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12), 0 4px 10px rgba(0, 0, 0, 0.06);
}

/* ---- 진입 연출: 순차 fade-in (위치 이동 없이 opacity만, 시간차) ----
   시그니처는 CD hover 회전. 카드 본체는 올라가지 않고 제자리에서 서서히 나타남. */
#member-home .button-wrapper {
    opacity: 0;
    transition: opacity 0.6s ease;
}
#member-home .button-wrapper.is-visible {
    opacity: 1;
}
#member-home .button-wrapper:nth-child(1).is-visible { transition-delay: 0.05s; }
#member-home .button-wrapper:nth-child(2).is-visible { transition-delay: 0.18s; }
#member-home .button-wrapper:nth-child(3).is-visible { transition-delay: 0.31s; }
#member-home .button-wrapper:nth-child(4).is-visible { transition-delay: 0.44s; }

/* ---- CD 진입 연출: 위에서 미세하게 떨어지며 등장 ----
   CD 시그니처 강화. 카드 본체 fade-in과 동시에 CD가 "올려지는" 느낌.
   cubic-bezier overshoot으로 약간 튀는 물리감.
   주의: site-kit.css에서 CD-image가 translateX(-50%)로 가로 중앙 정렬되어 있으므로
   translateY를 추가할 때 translateX(-50%)를 반드시 함께 유지해야 함.
   hover 시 rotateCD animation이 transform을 덮어쓰므로 충돌 없음. */
#member-home .button-wrapper .CD-image {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#member-home .button-wrapper.is-visible .CD-image {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
#member-home .button-wrapper:nth-child(1).is-visible .CD-image { transition-delay: 0.05s; }
#member-home .button-wrapper:nth-child(2).is-visible .CD-image { transition-delay: 0.18s; }
#member-home .button-wrapper:nth-child(3).is-visible .CD-image { transition-delay: 0.31s; }
#member-home .button-wrapper:nth-child(4).is-visible .CD-image { transition-delay: 0.44s; }

/* ---- 학습시간 카드: site-kit.css의 .stat-card:hover 효과(scale/text-shadow/밑줄)는
   어두운 배경 카드용이라 흰 카드에선 "클릭되는 것 같은" 느낌을 줌.
   학습 시간 카드는 클릭 요소가 아니므로 hover 효과 무효화. ---- */
#today-study-card:hover .stat-value,
#today-study-card .stat-value {
    transform: none;
    text-shadow: none;
}
#today-study-card:hover .stat-value::after,
#today-study-card .stat-value::after {
    content: none;
}
#today-study-card:hover .stat-label {
    opacity: 0.9;
    color: #888;
}
/* 시간 없을 때: 아이콘/라벨 숨기고 안내 메시지만 가운데 정렬 */
#today-study-card.is-empty .today-study-time-row {
    justify-content: center;
}
#today-study-card.is-empty .today-study-time-row .material-icons,
#today-study-card.is-empty .today-study-time-row .stat-label {
    display: none;
}
#today-study-card.is-empty .today-study-time-row .stat-value {
    font-size: 14px;
    font-weight: 600;
    color: #8d6e63;
}

/* ---- 접근성: 사용자가 동작 감소를 선호하면 CD 회전·타이틀 진입·카드 등장 축소 ---- */
@media (prefers-reduced-motion: reduce) {
    #member-home .button-wrapper:hover .CD-image {
        animation: none;
    }
    #member-home .btnPush,
    #member-home .btnPush:hover,
    #member-home .btnPush:active {
        transform: none;
    }
    #main-title-img {
        opacity: 1;
        transform: none;
        transition: none;
    }
    #member-home .button-wrapper .CD-image {
        opacity: 1;
        transform: translateX(-50%);
        transition: none;
    }
}

/* 짧은 화면/가로 비율 화면: navbar 아래에서 콘텐츠 시작 */
@media (min-width: 768px) and (max-height: 700px) {
    #main-page-header .container-fluid.full-height {
        min-height: calc(100vh - 62px);
        align-items: flex-start;
        justify-content: flex-start;
        padding-top: 80px;
        padding-bottom: 60px;
    }
}

/* ---- 모바일: 페이지 헤더 + 학습 카드 + 브랜드 카드 ---- */
@media (max-width: 767px) {
    /* full-height의 align-items: center가 모바일에서 콘텐츠를 위로 밀어 올려
       로고가 navbar 영역으로 겹치는 문제 해결. 모바일은 위에서부터 순서대로. */
    #main-page-header .container-fluid.full-height {
        align-items: flex-start;
        padding-bottom: 80px;  /* footer와 분리 */
    }
    /* 타이틀 이미지가 navbar에 겹치지 않게 */
    #main-title-img {
        margin-top: 10px;
        max-width: 240px;
        width: 70%;
        height: auto;
    }
    /* 학습 카드 */
    #today-study-card.has-latest {
        max-width: 320px;
        margin: 14px auto 0;
    }
    .today-study-last {
        padding: 12px 14px;
        gap: 12px;
    }
    .today-study-last-thumb {
        width: 56px;
        height: 56px;
    }
    .today-study-last-title {
        font-size: 15px;
    }
    /* 브랜드 카드: site-kit.css의 margin-top: 150px / 82px는 모바일에서 너무 큼.
       CD 이미지가 top: -46px로 위로 튀어나오므로, 실제 여백 = margin-top - 46px.
       60px면 14px만 남아 너무 붙음 → 90px로 여유 확보. */
    #member-brand-cards .button-wrapper {
        margin-top: 90px;
    }
    /* 모바일에서 브랜드 카드 2x2 그리드 유지 (site-kit.css 46% 폭) */
    #member-brand-cards {
        gap: 10px 0;
    }
}

/* ---- 작은 모바일 (480px 이하): 더 콤팩트하게 ---- */
@media (max-width: 480px) {
    #main-page-header .container-fluid.full-height {
        padding-top: 80px;
        padding-bottom: 60px;  /* footer와 분리 */
    }
    #main-title-img {
        max-width: 200px;
        width: 65%;
    }
    #today-study-card.has-latest {
        max-width: 280px;
        margin-top: 12px;
    }
    #member-brand-cards .button-wrapper {
        margin-top: 80px;  /* CD -46px 고려, 실제 여백 34px */
    }
}

/* 공지 모달 이미지 */
.notice-modal-img {
    max-width: 500px;
    height: auto;
}
