/* Design System & Base Styles */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&family=Roboto:wght@300;400;500;700&display=swap');


:root {
    --primary-color: #000000;
    --secondary-color: #666666;
    --bg-light: #ffffff;
    --border-color: #333333;
    --text-main: #000000;
    --text-muted: #666666;
    --year-color: #D9D9D9;
    --font-family: 'Roboto', 'Noto Sans KR', sans-serif;
    --transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    max-width: 100%;
    /* hidden은 스크롤포트가 바뀌어 타임라인 맵(position:sticky)이 뷰포트에 고정되지 않음. clip은 가로만 막고 sticky 호환에 유리 */
    overflow-x: clip;
    overflow-y: visible;
}

body {
    font-family: var(--font-family);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: visible;
    max-width: 100%;
    -webkit-font-smoothing: antialiased;
}

body > main {
    min-width: 0;
    max-width: 100%;
    /* index.css와 동일: main에 overflow를 두면 WebKit 등에서 sticky·푸터 스크롤이 꼬일 수 있음. 가로는 html overflow-x로만 처리 */
    overflow-x: visible;
    overflow-y: visible;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Hero Section */
.history-hero {
    height: 50vh;
    background: url('../public/images/Rectangle 148.png') center/cover no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    text-align: center;
    padding: 0 20px;
}

.history-hero h1 {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 65px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.history-hero p {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 0;
}

/* Brands Slide Section */
.brands-slide-section {
    padding: 120px 0 100px;
    max-width: 1440px;
    margin: 0 auto;
}

.brands-swiper {
    position: relative;
    padding: 10px 48px 40px;
}

.brands-swiper .swiper-slide {
    height: auto;
}

.brand-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.brand-card__img {
    width: 100%;
    aspect-ratio: 106 / 163;
    border-radius: 4px;
    background: #f5f5f5;
    overflow: hidden;
}

.brand-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

.brand-card:hover .brand-card__img img {
    transform: scale(1.05);
}

.brand-card__logo {
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
}

.brand-card__logo img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    object-fit: contain;
}

/* 히스토리 슬라이드 로고 — 디자인 스펙(px), 좁은 화면에서는 폭 기준 축소 */
.brand-card__logo--clio img {
    width: min(137.82px, 100%);
    aspect-ratio: 137.82 / 33.69;
    height: auto;
}
.brand-card__logo--peripera img {
    width: min(180.7px, 100%);
    aspect-ratio: 180.7 / 41.35;
    height: auto;
}
.brand-card__logo--goodal img {
    width: min(136.29px, 100%);
    aspect-ratio: 136.29 / 52.07;
    height: auto;
}
.brand-card__logo--dermatory img {
    width: min(226.64px, 100%);
    aspect-ratio: 226.64 / 27.56;
    height: auto;
}
.brand-card__logo--healingbird img {
    width: min(209.19px, 100%);
    aspect-ratio: 209.19 / 34.37;
    height: auto;
}
.brand-card__logo--typenumber img {
    width: min(261.35px, 100%);
    aspect-ratio: 261.35 / 26.23;
    height: auto;
}
.brand-card__logo--truerx img {
    width: min(155px, 100%);
    aspect-ratio: 155 / 28.01;
    height: auto;
}

/* Swiper navigation overrides */
.brands-swiper .swiper-button-prev,
.brands-swiper .swiper-button-next {
    color: #111;
    width: 40px;
    height: 40px;
    top: 45%;
}

.brands-swiper .swiper-button-prev::after,
.brands-swiper .swiper-button-next::after {
    font-size: 22px;
    font-weight: 700;
}

.brands-swiper .swiper-button-prev { left: 12px; }
.brands-swiper .swiper-button-next { right: 12px; }

/* Timeline Section (Figma Exact Values) */
.timeline-section {
    padding: 150px 0 250px;
    background: #fff;
    position: relative;
    isolation: isolate;
}

/*
  맵을 섹션 전체 높이 한가운데만 두면 스크롤 상·하단에서는 뷰포트에 맵이 안 보임.
  sticky + 음수 마진으로 뷰포트에 고정된 배경처럼 타임라인 스크롤 내내 뒤에 보이게 함.
*/
.timeline-map-bg {
    position: sticky;
    top: 0;
    z-index: 0;
    height: 100vh;
    width: 100%;
    max-width: 100%;
    margin-bottom: -100vh;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.timeline-map-bg__img {
    max-width: min(100%, 1400px);
    max-height: min(100%, 88vh);
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    display: block;
    opacity: 0.52;
    filter: grayscale(1) brightness(0.92) contrast(1.15);
    -webkit-user-select: none;
    user-select: none;
}

/* iOS·iPadOS: 터치 보고가 pointer:fine인 경우도 있어, 맵 img에서는 filter 합성을 끔 */
@supports (-webkit-touch-callout: none) {
    .timeline-map-bg__img {
        filter: none;
        opacity: 0.48;
    }
}

.timeline-container {
    max-width: 1440px;
    margin: 0 auto;
    position: relative;
    padding: 0 60px;
    z-index: 1;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #666666;
    transform: translateX(-50%);
}

.timeline-item {
    display: flex;
    margin-bottom: 250px;
    position: relative;
    width: 100%;
    align-items: flex-start;
}

.timeline-year {
    width: 50%;
    text-align: right;
    padding-right: 110px;
    font-size: 130px;
    font-weight: 300;
    color: #666666;
    line-height: 1;
    margin-top: -10px;
}

.timeline-dot {
    position: absolute;
    left: 50%;
    top: 35px;
    width: 20px;
    height: 20px;
    background: #666666;
    border-radius: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.timeline-content {
    width: 50%;
    padding-left: 100px;
}

.timeline-summary {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 40px;
    word-break: keep-all;
    color: #000;
    line-height: 1.3;
}

.timeline-events {
    display: flex;
    flex-direction: column;
    gap: 35px;
}

.event-item {
    display: flex;
    gap: 40px;
    font-size: 18px;
    align-items: flex-start;
}

.event-month {
    font-weight: 700;
    min-width: 60px;
    color: #000;
}

.event-desc {
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.7;
    flex: 1;
}

/* --- Mobile / Responsive Optimization --- */
@media (max-width: 1200px) {
    .timeline-year { font-size: 100px; padding-right: 60px; }
    .timeline-content { padding-left: 60px; }
}

/* 터치: img에 filter를 쓰면 스크롤 합성 시 깜빡임·누락이 남는 경우가 있어 톤만 opacity로 */
@media (hover: none), (pointer: coarse) {
    .timeline-map-bg__img {
        filter: none;
        opacity: 0.48;
    }
}

@media (max-width: 991px) {
    .history-hero h1 { font-size: 44px; letter-spacing: -0.02em; }
    .history-hero p { font-size: 22px; letter-spacing: 0; }

    .brands-slide-section { padding: 80px 0 60px; }
    .brands-swiper { padding: 10px 6px 28px; }
    .brand-card { gap: 12px; }
    .brand-card__logo {
        max-width: 100%;
    }
    /* 모바일: 슬라이드 로고 데스크 대비 축소 (비율 유지) */
    .brand-card__logo--clio img {
        width: min(68px, 66%);
        aspect-ratio: 137.82 / 33.69;
        height: auto;
    }
    .brand-card__logo--peripera img {
        width: min(92px, 70%);
        aspect-ratio: 180.7 / 41.35;
        height: auto;
    }
    .brand-card__logo--goodal img {
        width: min(73px, 61%);
        aspect-ratio: 136.29 / 52.07;
        height: auto;
    }
    .brand-card__logo--truerx img {
        width: min(76px, 66%);
        aspect-ratio: 155 / 28.01;
        height: auto;
    }
    .brand-card__logo--dermatory img {
        width: min(106px, 81%);
        aspect-ratio: 226.64 / 27.56;
        height: auto;
    }
    .brand-card__logo--healingbird img {
        width: min(99px, 79%);
        aspect-ratio: 209.19 / 34.37;
        height: auto;
    }
    .brand-card__logo--typenumber img {
        width: min(114px, 84%);
        aspect-ratio: 261.35 / 26.23;
        height: auto;
    }
    .brands-swiper .swiper-button-prev,
    .brands-swiper .swiper-button-next { display: none; }

    .timeline-section { padding: 80px 0; }

    .timeline-container { padding: 0 30px; }
    .timeline-line { left: 40px; }
    .timeline-dot { left: 40px; top: 18px; width: 16px; height: 16px; }
    
    .timeline-item {
        flex-direction: column;
        padding-left: 80px;
        margin-bottom: 120px;
    }
    
    .timeline-year {
        width: 100%;
        text-align: left;
        padding: 0;
        font-size: 70px;
        position: relative;
        top: 0;
        margin-bottom: 15px;
    }
    
    .timeline-content {
        width: 100%;
        padding: 0;
    }

    .timeline-summary {
        font-size: 24px;
        margin-bottom: 30px;
        line-height: 1.4;
    }
    
    .event-item { gap: 20px; font-size: 16px; }
    .event-month { min-width: 50px; }
}

/* 작은 스마트폰 ~ 갤럭시 Z Fold 펼침 ~ iPad Pro 13" 세로(~1024px) — 모바일 fluid scaling
   위 991px 블록을 덮어쓰며 모바일 디자인을 768px까지 확장 */
@media (max-width: 1024px) and (orientation: portrait) {
    .history-hero h1 { font-size: clamp(28px, 6.4vw, 52px); letter-spacing: -0.02em; }
    .history-hero p { font-size: clamp(15px, 3.6vw, 26px); letter-spacing: 0; }
    .brands-swiper { padding: 10px clamp(4px, 1vw, 8px) clamp(20px, 4vw, 32px); }
    .brand-card { gap: clamp(8px, 1.8vw, 14px); }
    .brand-card__logo--clio img { width: min(clamp(58px, 12.4vw, 96px), 66%); }
    .brand-card__logo--peripera img { width: min(clamp(78px, 16.6vw, 130px), 70%); }
    .brand-card__logo--goodal img { width: min(clamp(62px, 13.2vw, 102px), 61%); }
    .brand-card__logo--truerx img { width: min(clamp(64px, 13.6vw, 106px), 66%); }
    .brand-card__logo--dermatory img { width: min(clamp(90px, 19.2vw, 150px), 81%); }
    .brand-card__logo--healingbird img { width: min(clamp(84px, 17.8vw, 140px), 79%); }
    .brand-card__logo--typenumber img { width: min(clamp(96px, 20.4vw, 160px), 84%); }

    .timeline-container { padding: 0 clamp(18px, 4vw, 36px); }
    .timeline-line { left: clamp(28px, 6vw, 50px); }
    .timeline-dot { left: clamp(28px, 6vw, 50px); top: 18px; width: clamp(14px, 3vw, 20px); height: clamp(14px, 3vw, 20px); }

    .timeline-item {
        flex-direction: column;
        padding-left: clamp(56px, 11vw, 90px);
        margin-bottom: clamp(64px, 13vw, 130px);
    }

    .timeline-year {
        width: 100%;
        text-align: left;
        padding: 0;
        font-size: clamp(48px, 11vw, 90px);
        position: relative;
        top: 0;
        margin-bottom: clamp(12px, 2.4vw, 22px);
    }

    .timeline-content {
        width: 100%;
        padding: 0;
    }

    .timeline-summary {
        font-size: clamp(18px, 4.2vw, 30px);
        margin-bottom: clamp(20px, 4.4vw, 40px);
        line-height: 1.4;
    }

    .event-item {
        gap: clamp(12px, 2.6vw, 22px);
        font-size: clamp(14px, 3.2vw, 22px);
        flex-direction: column;
    }
    .event-month { min-width: clamp(46px, 10vw, 78px); }
}

/* 전체 브랜드 로고를 사각형(.brand-card__img) 가로폭에 맞춤 */
.brand-card__logo {
    width: 100%;
    max-width: 100%;
}

.brand-card__logo img {
    width: 50%;
    max-width: 50%;
    height: auto;
    aspect-ratio: auto;
    object-fit: contain;
}
