/* 파일 경로: /theme/smartcompanytheme/css/app_style.css */
@charset "utf-8";

/* =======================================================
   [글가게 절대 헌법] 디자인 토큰 강제 주입
======================================================= */
:root {
    --ar-paper: #FDFCF9;       /* Soft Paper */
    --ar-ivory: #F4F3EF;       /* Main Paper */
    --ar-board: #F4F3EF;       /* Main Paper */
    --ar-ink: #1C1A17;         /* Ink */
    --ar-ink-deep: #181A20;    /* Deep Ink */
    --ar-red: #C95043;         /* Accent Red */
    --ar-red-deep: #A83F34;
    
    /* 묵향을 머금은 파생 투명도 */
    --ar-mist: rgba(28, 26, 23, 0.6);
    --ar-mist-soft: rgba(28, 26, 23, 0.4);
    --ar-line: rgba(28, 26, 23, 0.15);

    --app-header-height: calc(64px + env(safe-area-inset-top, 0px));
    --app-bottom-nav-height: calc(60px + env(safe-area-inset-bottom, 0px));

    /* Editorial Type System v1 */
    --guel-type-display: clamp(28px, 8.2vw, 36px);
    --guel-type-page-title: clamp(25px, 6.8vw, 30px);
    --guel-type-feature-title: clamp(22px, 6.1vw, 28px);
    --guel-type-section-title: clamp(18px, 5.4vw, 21px);
    --guel-type-card-title: clamp(15px, 4.4vw, 16px);
    --guel-type-small-title: clamp(14px, 4vw, 15px);

    --guel-type-body: clamp(14.2px, 3.85vw, 14.6px);
    --guel-type-body-large: clamp(14.2px, 4vw, 15.2px);
    --guel-type-ui-body: 13px;
    --guel-type-caption: 11.5px;
    --guel-type-meta: 10.5px;
    --guel-type-label: 9.5px;
    --guel-type-micro: 8.5px;

    --guel-line-display: 1.08;
    --guel-line-title: 1.24;
    --guel-line-section: 1.28;
    --guel-line-card: 1.42;
    --guel-line-body: 1.92;
    --guel-line-ui: 1.68;
    --guel-line-label: 1.2;

    --guel-letter-display: -0.065em;
    --guel-letter-title: -0.05em;
    --guel-letter-card: -0.035em;
    --guel-letter-body: -0.032em;
    --guel-letter-ui: -0.015em;
    --guel-letter-label: 0.14em;
    --guel-letter-kicker: 0.20em;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    background-color: var(--ar-paper);
    color: var(--ar-ink);
    font-family: 'Pretendard', sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
}

body.hub-open {
    overflow: hidden !important;
}

* {
    box-sizing: border-box;
}

a {
    text-decoration: none;
    color: inherit;
}

ul, li {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 기존 PC 껍데기 박멸 */
#hd, #ft, #footer, #aside, .gnb, .tnb, #to_top, .btn_top, .snb, .sub_bnnr, .title_wrap, #m_hd, .mobile_menu {
    display: none !important;
}

#wrapper, #container, .sub_content, #content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: none !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    min-height: 0 !important;
}

#app-wrapper {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    background-color: var(--ar-paper);
    position: relative;
    overflow-x: hidden;
    padding-bottom: var(--app-bottom-nav-height);
}

body.is-main-page #app-wrapper {
    padding-bottom: var(--app-bottom-nav-height) !important;
}

/* =======================================================
   상단 헤더
======================================================= */
.app-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    z-index: 10001;
    padding: env(safe-area-inset-top, 0px) 16px 0;
    height: var(--app-header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--ar-paper);
    transition: background-color 0.25s ease, border-color 0.25s ease;
    pointer-events: auto;
    color: var(--ar-ink-deep) !important;
    border-bottom: 1px solid transparent;
}

.app-header.scrolled {
    background: var(--ar-paper);
    backdrop-filter: none;
    border-bottom: 1px solid var(--ar-line);
}

.app-header.sub-mode {
    background: var(--ar-paper);
    border-bottom: 1px solid var(--ar-line);
}

/* 글가게 SVG 로고 */
.guel-wongo-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding-top: 10px;
    transition: transform 0.2s ease, opacity 0.2s ease;
    text-decoration: none !important;
}

.guel-wongo-logo:hover {
    transform: translateY(-1px);
    opacity: .82;
}

.guel-wongo-logo svg,
.guel-wongo-logo img {
    display: block;
    height: 44px;
}

.app-header-tools {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 2;
    color: inherit;
}

.app-header-tools > a,
.app-header-tools > button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    border: 0 !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.hamburger-btn {
    background: transparent !important;
    border: 0 !important;
    outline: none !important;
    padding: 0;
    margin-left: 4px;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    appearance: none !important;
    -webkit-appearance: none !important;
    box-shadow: none !important;
}

/* 절대 헌법 수호: 1.25px 먹선과 직각(Square) 마감 강제 적용 */
.guel-svg,
.app-tool-icon {
    width: 24px;
    height: 24px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.25 !important;
    stroke-linecap: square !important;
    stroke-linejoin: miter !important;
    vector-effect: non-scaling-stroke;
    transition: color 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
}

.app-header-tools .guel-svg,
.app-header-tools .app-tool-icon {
    color: var(--ar-ink-deep);
}

.accent-fill {
    fill: var(--ar-red) !important;
    stroke: none !important;
}

.accent-stroke {
    stroke: var(--ar-red) !important;
    fill: none !important;
}

.guel-sleeve {
    fill: var(--ar-ink-deep) !important;
    stroke: none !important;
}

.guel-seal {
    fill: var(--ar-red) !important;
    stroke: none !important;
}

/* =======================================================
   서브 콘텐츠 및 서브 네비게이션
======================================================= */
.app-sub-content {
    padding-top: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--ar-paper);
    position: relative;
    z-index: 1;
}

.guel-global-subnav {
    position: relative;
    z-index: 20;
    background: var(--ar-paper);
    border-bottom: 1px solid var(--ar-line);
    margin-top: var(--app-header-height);
    transition: opacity 0.2s ease;
}

.guel-subnav-track {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    align-items: center;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 0.65rem;
}

.guel-subnav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.32rem;
    min-width: 0;
    height: 38px;
    padding: 0 0.15rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--ar-mist);
    text-decoration: none;
    font-size: var(--guel-type-ui-body);
    font-weight: 700;
    letter-spacing: var(--guel-letter-ui);
    transition: color 0.2s ease, opacity 0.2s ease;
    opacity: 0.88;
}

.guel-subnav-link:hover {
    color: var(--ar-ink-deep);
    opacity: 1;
}

.guel-subnav-link.is-active {
    color: var(--ar-red);
    font-weight: 800;
    opacity: 1;
}

.guel-subnav-ai-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    stroke-width: 1.25 !important;
    stroke-linecap: square !important;
    stroke-linejoin: miter !important;
}

.guel-subnav-link.is-active .guel-subnav-ai-icon {
    color: var(--ar-red);
}

/* =======================================================
   하단 네비게이션
======================================================= */
.app-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: var(--app-bottom-nav-height);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    justify-items: stretch;
    background: rgba(253, 252, 249, 0.98);
    backdrop-filter: blur(15px);
    border-top: 1px solid var(--ar-ink-deep);
    z-index: 9999;
}

.app-bottom-nav .nav-tab {
    width: 100%;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    color: var(--ar-mist);
    opacity: 0.5;
    position: relative;
    appearance: none;
    -webkit-appearance: none;
}

.app-bottom-nav .nav-tab:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 15px;
    bottom: 15px;
    border-right: 1px dashed var(--ar-line);
}

.app-bottom-nav .nav-tab.active {
    color: var(--ar-ink-deep);
    background: var(--ar-ivory);
    opacity: 1;
}

.app-bottom-nav .nav-tab .guel-svg,
.app-bottom-nav .nav-tab svg {
    width: 24px;
    height: 24px;
    display: block;
    flex: 0 0 auto;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.25 !important;
    stroke-linecap: square !important;
    stroke-linejoin: miter !important;
    transition: transform 0.2s, color 0.2s;
}

.app-bottom-nav .nav-tab.active .guel-svg,
.app-bottom-nav .nav-tab.active svg {
    stroke-width: 1.25 !important;
    transform: scale(1.05);
}

/* =======================================================
   HUB OVERLAY
======================================================= */
#appHub.app-hub {
    position: fixed !important;
    inset: 0 !important;
    left: 50% !important;
    width: 100% !important;
    max-width: 480px !important;
    margin-left: 0 !important;
    transform: translateX(calc(-50% - 100vw)) !important;
    z-index: 10050 !important;
    visibility: hidden;
    background: var(--ar-paper) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    padding-bottom: var(--app-bottom-nav-height) !important;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.4s !important;
}

#appHub.app-hub.is-open {
    transform: translateX(-50%) !important;
    visibility: visible;
}

#appHub .hub-home-shell {
    min-height: 100dvh;
    background: var(--ar-paper);
}

#appHub .hub-topbar {
    position: sticky;
    top: 0;
    z-index: 10060 !important;
}

#appHub .hub-global-subnav {
    position: sticky;
    top: 64px;
    z-index: 10059 !important;
}

body.hub-open .app-header {
    opacity: 0 !important;
    pointer-events: none !important;
}

body.hub-open .guel-global-subnav {
    opacity: 0 !important;
    pointer-events: none !important;
}

body.hub-open .app-bottom-nav {
    z-index: 10061 !important;
}

.hub-trigger-btn {
    background: transparent !important;
    border: 0 !important;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

@media (min-width: 1024px) {
    .guel-subnav-link {
        height: 36px;
        font-size: var(--guel-type-caption);
    }
}

/* =======================================================
   이어 읽기 바
======================================================= */
.guel-bookmark-popup {
    position: fixed;
    left: 50%;
    bottom: var(--app-bottom-nav-height);
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 480px;
    z-index: 8000;
    background: var(--ar-paper);
    border-top: 1px solid var(--ar-line);
    box-shadow: 0 -4px 12px rgba(28, 26, 23, 0.06) !important;
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

.guel-bookmark-popup.is-visible {
    transform: translateX(-50%) translateY(0);
}

.guel-bookmark-inner {
    position: relative;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 10px 12px;
    align-items: start;
    padding: 14px 16px 14px;
}

.guel-bookmark-close {
    position: absolute;
    top: 10px;
    right: 14px;
    width: 20px;
    height: 20px;
    border: 0;
    background: transparent;
    color: var(--ar-mist);
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    font-family: 'Pretendard', sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.guel-bookmark-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ar-ink-deep);
    margin-top: 1px;
}

.guel-bookmark-icon .guel-svg,
.guel-bookmark-icon svg {
    width: 20px;
    height: 20px;
    display: block;
    stroke-width: 1.25 !important;
}

.guel-bookmark-body {
    min-width: 0;
    padding-right: 30px;
}

.guel-bookmark-label {
    margin: 0 0 5px;
    color: var(--ar-mist);
    font-family: 'Pretendard', sans-serif;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.02em;
}

.guel-bookmark-title {
    margin: 0 0 6px;
    color: var(--ar-ink-deep);
    font-family: 'KoPubWorldBatang', serif;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.guel-bookmark-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.guel-bookmark-time {
    margin: 0;
    min-width: 0;
    color: var(--ar-mist);
    font-family: 'Pretendard', sans-serif;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.guel-bookmark-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ar-ink-deep);
    font-family: 'Pretendard', sans-serif;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

@media (max-width: 380px) {
    .guel-bookmark-inner {
        padding: 13px 14px 13px;
        gap: 9px 10px;
    }

    .guel-bookmark-close {
        right: 12px;
    }

    .guel-bookmark-title {
        font-size: 14px;
    }

    .guel-bookmark-time,
    .guel-bookmark-btn,
    .guel-bookmark-label {
        font-size: 10px;
    }
}
