/* =========================================================
   Lunar Soopoolleaf — 타로 카드 백과
   tarot.css 뒤에 얹습니다. 색은 전부 tarot.css 의 변수를 씁니다.
   ========================================================= */


/* ---------- 세로 스크롤 되살리기 ----------
   tarot.css 의 "COMPACT FULL VIEW" 가 html · body · .fortune-page 에
   overflow: hidden 을 걸어 둡니다(메뉴 20개를 한 화면에 넣으려고).
   메뉴 페이지는 body.tarot-menu-page-v42 로 풀고 있는데,
   백과 페이지는 내용이 길어 반드시 문서가 늘어나야 하므로 같은 식으로 풉니다. */

html:has(body.tarot-cards-page) {
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

body.tarot-cards-page {
    width: 100% !important;
    height: auto !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    margin: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

body.tarot-cards-page .fortune-page {
    width: 100% !important;
    height: auto !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    max-height: none !important;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
}

/* tarot.css 의 COMPACT 구간이 .tarot-main 높이를 100dvh 로 고정해 두어
   긴 내용이 main 밖으로 넘치고 푸터가 화면 중간에 겹쳐 보였음 → 높이 자동으로 */
body.tarot-cards-page .tarot-main {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    flex: 0 0 auto;
}

.tarot-cards-page .tarot-main.tc-main {
    max-width: 900px;
    padding: 18px 24px 70px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.tc-main-index {
    gap: 18px !important;
}


/* ---------- 현재 위치 ---------- */

.tc-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    padding: 0 2px;
    font-size: 12px;
    color: var(--text-soft);
}

.tc-crumbs a {
    color: var(--text-soft);
    text-decoration: none;
}

.tc-crumbs a:hover {
    color: var(--text);
}

.tc-crumbs-here {
    color: var(--text);
    font-weight: 600;
}

.tc-fallback-note,
.tc-not-ready {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.6;
}


/* ---------- 머리 ---------- */

.tc-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: flex-start;
}

.tc-figure {
    margin: 0 auto;
    flex: 0 0 auto;
    width: 260px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.tc-card-frame {
    width: 260px;
    max-width: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 18px 40px rgba(46, 78, 63, .14);
    transition: transform .45s cubic-bezier(.2, .8, .2, 1);
}

html[data-theme="dark"] .tc-card-frame {
    box-shadow: 0 18px 40px rgba(0, 0, 0, .34);
}

.tc-card-frame.is-reversed {
    transform: rotate(180deg);
}

.tc-card-img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 300 / 510;
    object-fit: cover;
}

/* 카드 이름 툴팁(.spread-card-name-tooltip)과 같은 모양 */
.tc-direction {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border: 1px solid var(--tarot-accent-border, rgba(82, 183, 136, .55));
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: 0 9px 26px rgba(24, 39, 31, .16);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text);
}

.tc-direction-mark {
    color: var(--tarot-accent, var(--primary));
    font-size: 11px;
}

.tc-direction.is-reversed .tc-direction-mark {
    color: var(--tree);
}

.tc-direction-sep {
    width: 1px;
    height: 12px;
    background: var(--border);
}

.tc-direction-switch {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-soft);
    font: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
}

.tc-direction-switch:hover {
    color: var(--text);
}

.tc-head {
    flex: 1 1 400px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.tc-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tc-kicker {
    color: var(--tree);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 4px;
}

.tc-title {
    margin: 0;
    color: var(--text);
    font-size: clamp(31px, 4.6vw, 41px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -1.7px;
}

.tc-subtitle {
    margin: 0;
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.7;
}

.tc-summary {
    margin: 0;
    font-size: 15.5px;
    line-height: 1.8;
}


/* ---------- 공통 상자 (.tarot-item 과 같은 값) ---------- */

.tc-box {
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.tc-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tc-keyword-box {
    flex: 1 1 220px;
    min-width: 0;
    padding: 15px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color .2s ease;
}

.tc-keyword-box.is-on {
    border-color: var(--tarot-accent-border, rgba(82, 183, 136, .55));
}

.tc-box-kicker {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .12em;
}

.tc-box-kicker span {
    font-size: 11px;
}

.tc-box-kicker-upright {
    color: var(--tarot-accent-strong, var(--primary));
}

.tc-box-kicker-reversed {
    color: var(--tree);
}

.tc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tc-chip {
    padding: 6px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-hover);
    font-size: 13px;
    font-weight: 600;
}

.tc-box-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.75;
}

.tc-positions {
    border-radius: 16px;
    padding: 4px 16px;
}

.tc-position-row {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.tc-position-row:last-child {
    border-bottom: 0;
}

.tc-position-label {
    flex: 0 0 52px;
    padding-top: 2px;
    color: var(--tarot-accent-strong, var(--primary));
    font-size: 12px;
    font-weight: 800;
}

.tc-position-text {
    font-size: 14px;
    line-height: 1.7;
}


/* ---------- 단추 ---------- */

.tc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tc-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 12px 16px;
    border-radius: 999px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform .16s ease, background-color .2s ease, border-color .2s ease;
}

.tc-button svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tc-button:hover {
    transform: translateY(-1px);
}

.tc-button-primary {
    border: 0;
    background: var(--tarot-accent, var(--primary));
    color: #fff;
    box-shadow: 0 8px 20px var(--tarot-accent-shadow, rgba(82, 183, 136, .15));
}

.tc-button-soft {
    border: 1px solid var(--tarot-accent-border, rgba(82, 183, 136, .55));
    background: var(--tarot-accent-soft, rgba(82, 183, 136, .11));
    color: var(--text);
}

.tc-button-soft.is-done {
    border-color: var(--tarot-accent, var(--primary));
}


/* ---------- 상징 · 함께 나오면 ---------- */

.tc-two {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.tc-article {
    flex: 1 1 340px;
    min-width: 0;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tc-h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.5px;
}

.tc-h2 span {
    color: var(--tarot-accent, var(--primary));
    font-size: 11px;
}

.tc-symbols {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tc-symbols li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 14px;
    line-height: 1.7;
}

.tc-symbols b {
    font-weight: 700;
}

.tc-dot {
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    margin-top: 8px;
    border-radius: 50%;
    background: var(--tarot-accent, var(--primary));
}

.tc-combos {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tc-combo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-hover);
    color: var(--text);
    text-decoration: none;
    transition: border-color .2s ease, transform .16s ease;
}

.tc-combo:hover {
    transform: translateY(-1px);
    border-color: var(--tc-suit, var(--tarot-accent-border));
}

.tc-combo-thumb {
    flex: 0 0 30px;
    width: 30px;
    height: 50px;
    border-radius: 5px;
    overflow: hidden;
    border: 1.4px solid var(--tc-suit, var(--border));
    background: var(--surface);
}

.tc-combo-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tc-combo-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.tc-combo-copy b {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -.3px;
}

.tc-combo-copy span {
    font-size: 12px;
    color: var(--text-soft);
}


/* ---------- 이전 · 다음 (.tarot-item 틀) ---------- */

.tc-pager {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.tc-pager-item {
    min-height: 70px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 20px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
    transition: transform .16s ease, border-color .2s ease, background-color .2s ease;
}

.tc-pager-item.is-empty {
    visibility: hidden;
}

.tc-pager-item:hover {
    transform: translateY(-2px);
    border-color: var(--tarot-accent-border, rgba(82, 183, 136, .55));
    background: var(--surface-hover);
}

.tc-pager-next {
    justify-content: flex-end;
    text-align: right;
}

.tc-pager-arrow {
    color: var(--text-soft);
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
}

.tc-pager-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tc-pager-kicker {
    color: var(--text-soft);
    font-size: 10px;
    letter-spacing: .06em;
}

.tc-pager-copy b {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 17px;
    font-weight: 500;
    letter-spacing: -.6px;
}

.tc-all-link {
    margin: 0;
    text-align: center;
    font-size: 13px;
}

.tc-all-link a {
    color: var(--text-soft);
    text-decoration: none;
    border-bottom: 1px solid currentColor;
}

.tc-all-link a:hover {
    color: var(--text);
}

.tc-footer {
    margin-top: auto;
    padding: 0 0 28px;
    text-align: center;
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 600;
}


/* ---------- 78장 목록 ---------- */

.tc-index-head {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tc-index-title {
    margin: 0;
    font-size: clamp(26px, 4vw, 34px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -1.4px;
}

.tc-index-lead {
    margin: 0;
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.7;
}

.tc-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tc-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
    transition: border-color .2s ease, transform .16s ease;
}

.tc-tab:hover {
    transform: translateY(-1px);
    border-color: var(--tc-suit, var(--tarot-accent-border));
}

.tc-tab small {
    color: var(--text-soft);
    font-weight: 600;
}

.tc-tab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tc-suit, var(--primary));
}

.tc-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-margin-top: 80px;
}

.tc-group-title {
    margin: 10px 0 0;
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.5px;
}

.tc-group-title small {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 600;
}

.tc-grid {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 12px;
}

.tc-tile {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
    transition: transform .16s ease, border-color .2s ease;
}

.tc-tile:hover {
    transform: translateY(-2px);
    border-color: var(--tc-suit, var(--tarot-accent-border));
}

.tc-tile-img {
    display: block;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface-hover);
}

.tc-tile-img img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 300 / 510;
    object-fit: cover;
}

.tc-tile-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 2px 2px;
}

.tc-tile-mark {
    color: var(--tc-suit, var(--text-soft));
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
}

.tc-tile-name {
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: -.2px;
    line-height: 1.3;
}

.tc-tile-en {
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 600;
}


/* ---------- 타로 메뉴에 놓는 입구 ---------- */

.tc-entry {
    width: min(100%, 860px);
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
    transition: transform .16s ease, border-color .2s ease;
}

.tc-entry:hover {
    transform: translateY(-1px);
    border-color: var(--tarot-accent-border, rgba(82, 183, 136, .55));
}

.tc-entry-icon {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--tarot-accent-soft, rgba(82, 183, 136, .13));
    color: var(--tarot-accent, var(--primary));
}

.tc-entry-icon svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tc-entry-copy {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tc-entry-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -.2px;
}

.tc-entry-sub {
    color: var(--text-soft);
    font-size: 11.5px;
}

.tc-entry-arrow {
    color: var(--text-soft);
    font-size: 18px;
    font-weight: 300;
}


/* ---------- 좁은 화면 ---------- */

@media (max-width: 760px) {

    .tarot-cards-page .tarot-main.tc-main {
        padding: 14px 16px 56px;
        gap: 18px;
    }

    .tc-hero {
        gap: 20px;
    }

    .tc-figure,
    .tc-card-frame {
        width: 220px;
    }

    .tc-head {
        flex-basis: 100%;
    }

    .tc-pager-copy b {
        font-size: 15px;
    }

    .tc-grid {
        grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
        gap: 9px;
    }

    .tc-tile {
        padding: 7px;
        border-radius: 13px;
    }

    .tc-tile-name {
        font-size: 12px;
    }

    .tc-entry-sub {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tc-card-frame,
    .tc-button,
    .tc-tile,
    .tc-pager-item,
    .tc-combo,
    .tc-tab,
    .tc-entry {
        transition: none;
    }
}
