/* ===== Component Styles ===== */
/* 타이포그래피(heading, paragraph, inline)는 design-system.css에서 관리 */

.paragraph a {
    color: var(--color-link);
    text-decoration: underline;
    transition: color var(--transition-fast);
}

.paragraph a:hover {
    color: var(--color-primary-hover);
}

/* ===== Callout Component ===== */
.callout-box {
    background-color: var(--color-info-bg);
    color: var(--color-text-primary);
    padding: 25px 25px 25px 30px;
    border-radius: 13px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: var(--spacing-lg) 0;
}

/* Callout 타입별 배경색 */
.callout-box.callout-info { background-color: var(--color-info-bg); }
.callout-box.callout-warning { background-color: var(--color-warning-bg); }
.callout-box.callout-error { background-color: var(--color-error-bg); }
.callout-box.callout-success { background-color: var(--color-success-bg); }

.callout-header {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 0;
}

.callout-icon {
    font-size: var(--font-size-base);
    line-height: 1;
}

.callout-title {
    color: var(--color-text-primary);
    font-size: 16px;
    font-weight: 700;
    line-height: 117%;
    letter-spacing: 0.01em;
}

.callout-content {
    font-size: 16px;
    font-weight: 500;
    line-height: 155%;
    letter-spacing: 0.01em;
    color: var(--color-text-primary);
    margin: 0;
}

.callout-box strong,
.callout-content strong,
.prose .callout-box strong {
    color: var(--color-primary);
    font-weight: var(--font-weight-extrabold);
}

/* Callout 텍스트 색상 */
.prose .callout-content,
.prose .callout-box p {
    color: var(--color-text-primary);
}

/* Callout Variants - Currently all use same dark style */
/* Uncomment below to use different colors for each type
.callout-info {
    background-color: var(--color-info-bg);
    border-left: 4px solid var(--color-info-border);
}

.callout-warning {
    background-color: var(--color-warning-bg);
    border-left: 4px solid var(--color-warning-border);
}

.callout-error {
    background-color: var(--color-error-bg);
    border-left: 4px solid var(--color-error-border);
}

.callout-success {
    background-color: var(--color-success-bg);
    border-left: 4px solid var(--color-success-border);
}
*/

/* ===== Code Block Component ===== */
.code-block-wrapper {
    position: relative;
    background: #333333;
    border-radius: 13px;
    border: none;
    margin: var(--spacing-lg) 0;
    overflow: hidden;
    box-shadow: none;
}

.code-block-wrapper::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.04);
    pointer-events: none;
}

.code-block-wrapper pre,
.code-block-wrapper pre[class*="language-"],
.code-block-wrapper pre.line-numbers {
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
    padding: 45px 30px;
    font-family: var(--font-code);
    font-size: 20px;
    font-weight: 700;
    line-height: 155%;
    letter-spacing: 0.01em;
    color: #FFFFFF;
    overflow: auto;
    tab-size: 2;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.code-block-wrapper pre.line-numbers {
    padding-left: 3.75rem;
}

.code-block-wrapper pre::-webkit-scrollbar {
    height: 8px;
}

.code-block-wrapper pre::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
}

.code-block-wrapper code {
    display: block;
    background: transparent;
    padding: 0;
    color: inherit;
    font-family: var(--font-code);
    font-size: 20px;
    font-weight: 700;
}

.code-block-wrapper .line-numbers-rows {
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding-right: 0.9rem !important;
    margin-right: 1rem !important;
}

.code-block-wrapper .line-numbers-rows > span {
    color: rgba(255, 255, 255, 0.25) !important;
    font-size: 0.75rem !important;
}

.copy-code-btn {
    position: absolute;
    top: 14px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(10, 12, 18, 0.82);
    color: #f1f5f9;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 180ms ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    z-index: 20;
    backdrop-filter: blur(12px);
}

.copy-code-btn:hover,
.copy-code-btn:focus-visible {
    border-color: rgba(255, 255, 255, 0.45);
    color: #fff;
    background: rgba(15, 19, 28, 0.92);
}

.copy-code-btn__icon {
    width: 1rem;
    height: 1rem;
}

.copy-code-btn__label {
    font-family: var(--font-main);
}

.dark .copy-code-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    border-color: rgba(255, 255, 255, 0.25);
}

.dark .copy-code-btn:hover,
.dark .copy-code-btn:focus-visible {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.14);
}

@media (max-width: 768px) {
    .copy-code-btn {
        top: 10px;
        right: 10px;
        padding: 0.35rem 0.75rem;
        font-size: 0.7rem;
    }
    
    .copy-code-btn__label {
        display: none;
    }
    
    .code-block-wrapper pre,
    .code-block-wrapper pre[class*="language-"],
    .code-block-wrapper pre.line-numbers {
        padding: 1.25rem;
    }
}

/* Prism token overrides for better contrast */
.code-block-wrapper .token.comment,
.code-block-wrapper .token.prolog,
.code-block-wrapper .token.doctype,
.code-block-wrapper .token.cdata {
    color: #6e7681;
}

.code-block-wrapper .token.punctuation {
    color: #a0a8b3;
}

.code-block-wrapper .token.property,
.code-block-wrapper .token.tag,
.code-block-wrapper .token.constant,
.code-block-wrapper .token.symbol,
.code-block-wrapper .token.deleted {
    color: #ff7b72;
}

.code-block-wrapper .token.boolean,
.code-block-wrapper .token.number {
    color: #79c0ff;
}

.code-block-wrapper .token.selector,
.code-block-wrapper .token.attr-name,
.code-block-wrapper .token.string,
.code-block-wrapper .token.char,
.code-block-wrapper .token.builtin,
.code-block-wrapper .token.inserted {
    color: #7ee787;
}

.code-block-wrapper .token.operator,
.code-block-wrapper .token.entity,
.code-block-wrapper .token.url,
.code-block-wrapper .token.variable {
    color: #f2cc60;
}

.code-block-wrapper .token.atrule,
.code-block-wrapper .token.attr-value,
.code-block-wrapper .token.keyword {
    color: #ffab70;
}

.code-block-wrapper .token.function,
.code-block-wrapper .token.class-name {
    color: #d2a8ff;
}

.code-block-wrapper .token.regex,
.code-block-wrapper .token.important {
    color: #ffdd8a;
}

.code-block-wrapper .token.bold {
    font-weight: 600;
}

.code-block-wrapper .token.italic {
    font-style: italic;
}

.code-block-wrapper ::selection {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* --- 코드 블록 접기/펼치기 --- */
.code-block-wrapper.is-collapsible pre {
    max-height: calc(1.5em * 10 + 2rem);  /* 약 10줄 */
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.code-block-wrapper.is-collapsible.is-expanded pre {
    max-height: none;
}

/* 접힌 상태에서 하단 그라데이션 오버레이 */
.code-block-wrapper.is-collapsible:not(.is-expanded)::before {
    content: "";
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, rgba(5, 6, 9, 0.95));
    z-index: 2;
    border-radius: 0 0 16px 16px;
    pointer-events: none;
}

.code-expand-btn {
    display: block;
    width: 100%;
    padding: 8px 0;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 0 16px 16px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.code-expand-btn:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
}

/* ===== Quote Component ===== */
.blog-quote {
    position: relative;
    padding-left: 25px;
    margin: var(--spacing-xl) 0;
}

.quote-decoration {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background-color: #FF7900;
    border-radius: 0;
}

.quote-text {
    font-family: var(--font-main);
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--color-text-primary);
    line-height: 1.75;
    margin: 0;
    flex: 1;
}

.quote-author {
    display: block;
    margin-top: var(--spacing-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    font-style: normal;
    color: var(--color-text-secondary);
}

/* Legacy support for old quote class */
.custom-quote {
    border-left: 5px solid #FF7900;
    padding-left: 25px;
    margin: 0;
    font-style: normal;
}

.custom-quote p {
    font-family: var(--font-main);
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--color-text-primary);
    line-height: 1.75;
    margin: 0;
}

.custom-quote cite {
    display: block;
    margin-top: var(--spacing-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    font-style: normal;
    color: var(--color-text-secondary);
}

/* ===== List Components ===== */
.custom-list-bullet {
    list-style: none;
    padding: 20px 0 20px var(--spacing-lg);
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.custom-list-bullet li {
    position: relative;
    padding-left: var(--spacing-md);
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    line-height: 117%;
    letter-spacing: 0.01em;
    color: var(--color-text-primary);
}

.custom-list-bullet li::before {
    content: "●";
    position: absolute;
    left: 0;
    color: var(--color-text-primary);
    font-size: 8px;
    top: 0.4em;
}

.custom-list-ordered {
    counter-reset: list-counter;
    list-style: none;
    padding: 20px 0 20px var(--spacing-xl);
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.custom-list-ordered li {
    counter-increment: list-counter;
    position: relative;
    padding-left: var(--spacing-xs);
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    line-height: 117%;
    letter-spacing: 0.01em;
    color: var(--color-text-primary);
}

.custom-list-ordered li::before {
    content: counter(list-counter) ".";
    position: absolute;
    left: calc(-1 * var(--spacing-lg));
    color: var(--color-primary);
    font-weight: var(--font-weight-bold);
}

/* ===== Image Component ===== */
.image-block {
    margin: var(--spacing-xl) 0;
    text-align: center;
}

.image-block img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: none;
}

.image-block figcaption {
    margin-top: var(--spacing-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    color: #E3E3E3;
    font-style: normal;
}

/* ===== Divider Component ===== */
.divider {
    width: 100%;
    height: 0;
    background-color: transparent;
    border: none;
    border-top: 2px solid rgba(51, 51, 51, 0.1);
    margin: var(--spacing-lg) 0;
}

/* ===== File Block Component ===== */
.file-block {
    margin: var(--spacing-lg) 0;
}

.file-block .file-link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: var(--font-size-base);
    color: var(--color-text-primary);
    text-decoration: none;
    transition: background-color 0.2s;
}

.file-block .file-link:hover {
    background-color: var(--color-bg-secondary, rgba(0, 0, 0, 0.05));
}

/* ===== Blog Table Component (Notion-style) ===== */
/* 피그마: 외곽 테두리 없음, 헤더 bg #FF7900 20%, 헤더 라운딩 13px */
.blog-table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    border: none;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    background-color: var(--color-white);
    table-layout: auto;
}

.blog-table thead tr.header {
    background: rgba(255, 121, 0, 0.2);
}

.blog-table th.table-cell-header {
    padding: 15px 10px 15px 20px;
    font-family: "Pretendard", var(--font-main);
    font-weight: 700;
    font-size: 16px;
    line-height: 155%;
    letter-spacing: 0.01em;
    color: #FF522C;
    text-align: left;
    border-bottom: 2px solid #FF7900;
    min-height: 50px;
}

/* 빈 셀도 최소 높이 보장 */
.blog-table th:empty,
.blog-table td:empty {
    min-height: 24px;
    height: 24px;
}

.blog-table th.table-cell-header:first-child {
    border-radius: 13px 0 0 0;
}

.blog-table th.table-cell-header:last-child {
    border-radius: 0 13px 0 0;
}

.blog-table td.table-cell-key,
.blog-table td.table-cell-value {
    padding: 15px 10px 15px 20px;
    font-family: "Pretendard", var(--font-main);
    font-size: 16px;
    font-weight: 500;
    line-height: 155%;
    letter-spacing: 0.01em;
    color: var(--color-text-primary);
    border-bottom: 1px solid rgba(51, 51, 51, 0.1);
}

.blog-table tbody tr:last-child td.table-cell-value,
.blog-table tbody tr:last-child td.table-cell-key {
    border-bottom: none;
}

/* Table container for scrolling */
.overflow-x-auto {
    overflow-x: auto;
}




/* ===== Table Component ===== */
.table-wrapper {
    overflow-x: auto;
    margin: var(--spacing-xl) 0;
    border-radius: 13px;
    border: none;
    background-color: transparent;
    box-shadow: none;
}

.custom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-family: "Pretendard", var(--font-main);
    font-size: 16px;
    background-color: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
}

.custom-table thead {
    background: rgba(255, 121, 0, 0.2);
}

.custom-table th {
    padding: 15px 10px 15px 20px;
    text-align: left;
    font-weight: 700;
    font-size: 16px;
    line-height: 155%;
    letter-spacing: 0.01em;
    color: #FF522C;
    background-color: transparent;
    border-bottom: 2px solid #FF7900;
}

.custom-table th:first-child {
    border-radius: 13px 0 0 0;
}

.custom-table th:last-child {
    border-radius: 0 13px 0 0;
}

.custom-table tbody tr {
    background-color: var(--color-white);
}

.custom-table tbody tr:not(:last-child) td {
    border-bottom: 1px solid rgba(51, 51, 51, 0.1);
}

.custom-table td {
    padding: 15px 10px 15px 20px;
    color: var(--color-text-primary);
    font-family: "Pretendard", var(--font-main);
    font-size: 16px;
    font-weight: 500;
    line-height: 155%;
    letter-spacing: 0.01em;
}

/* Responsive table */
@media (max-width: 768px) {
    .table-wrapper {
        border-radius: 0;
        margin-left: calc(-1 * var(--spacing-md));
        margin-right: calc(-1 * var(--spacing-md));
        width: calc(100% + 2 * var(--spacing-md));
        border-left: none;
        border-right: none;
    }
    
    .custom-table th {
        padding: 12px 16px;
        font-size: 14px;
    }

    .custom-table td {
        padding: 10px 16px;
        font-size: 14px;
    }
}

/* ===== Notion 색상 클래스 ===== */
/* Notion API가 내려주는 텍스트/배경 색상을 1:1 매핑 */

/* 라이트 모드 — 텍스트 색상 */
.notion-text-gray { color: #9B9B9B; }
.notion-text-brown { color: #976D57; }
.notion-text-orange { color: #CC782F; }
.notion-text-yellow { color: #C29343; }
.notion-text-green { color: #548164; }
.notion-text-blue { color: #2F94FF; }
.notion-text-purple { color: #8A67AB; }
.notion-text-pink { color: #B35488; }
.notion-text-red { color: #FE4545; }

/* 라이트 모드 — 배경 색상 */
.notion-bg-gray {
    background-color: #F1F1EF;
    color: #787774;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    display: inline;
    line-height: 1.5;
}
.notion-bg-brown {
    background-color: #F3EEEE;
    color: #976D57;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    display: inline;
    line-height: 1.5;
}
.notion-bg-orange {
    background-color: #F8ECDF;
    color: #CC782F;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    display: inline;
    line-height: 1.5;
}
.notion-bg-yellow {
    background-color: rgba(255, 121, 0, 0.2);
    color: #333333;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    display: inline;
    line-height: 1.5;
}
.notion-bg-green {
    background-color: #EEF3ED;
    color: #548164;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    display: inline;
    line-height: 1.5;
}
.notion-bg-blue {
    background-color: rgba(47, 148, 255, 0.2);
    color: #333333;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    display: inline;
    line-height: 1.5;
}
.notion-bg-purple {
    background-color: #F6F3F8;
    color: #8A67AB;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    display: inline;
    line-height: 1.5;
}
.notion-bg-pink {
    background-color: #F9F2F5;
    color: #B35488;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    display: inline;
    line-height: 1.5;
}
.notion-bg-red {
    background-color: #FAECEC;
    color: #C4554D;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    display: inline;
    line-height: 1.5;
}

/* 다크 모드 — 텍스트 색상 */
.dark .notion-text-gray { color: #9B9B9B; }
.dark .notion-text-brown { color: #A27763; }
.dark .notion-text-orange { color: #CB7B37; }
.dark .notion-text-yellow { color: #C19138; }
.dark .notion-text-green { color: #4F9768; }
.dark .notion-text-blue { color: #447ACB; }
.dark .notion-text-purple { color: #865DBB; }
.dark .notion-text-pink { color: #BA4A78; }
.dark .notion-text-red { color: #BE524B; }

/* 다크 모드 — 배경 색상 */
.dark .notion-bg-gray {
    background-color: #252525;
    color: #9B9B9B;
}
.dark .notion-bg-brown {
    background-color: #2E2724;
    color: #A27763;
}
.dark .notion-bg-orange {
    background-color: #36291F;
    color: #CB7B37;
}
.dark .notion-bg-yellow {
    background-color: #372E20;
    color: #C19138;
}
.dark .notion-bg-green {
    background-color: #242B26;
    color: #4F9768;
}
.dark .notion-bg-blue {
    background-color: #1F282D;
    color: #447ACB;
}
.dark .notion-bg-purple {
    background-color: #2A2430;
    color: #865DBB;
}
.dark .notion-bg-pink {
    background-color: #2E2328;
    color: #BA4A78;
}
.dark .notion-bg-red {
    background-color: #332523;
    color: #BE524B;
}

/* ===== Small Mobile Adjustments ===== */
@media (max-width: 480px) {
    .blog-quote {
        padding-left: 12px;
        margin: var(--spacing-md) 0;
    }
    
    .quote-decoration {
        width: 2px;
    }
    
    .quote-text {
        font-size: 1rem;
        line-height: 1.5;
        font-weight: 700;
    }
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 768px) {
    .heading-1 {
        font-size: var(--font-size-4xl);
    }
    
    .heading-2 {
        font-size: var(--font-size-3xl);
    }
    
    .heading-3 {
        font-size: var(--font-size-2xl);
    }
    
    .heading-4 {
        font-size: var(--font-size-xl);
    }
    
    .callout-box {
        padding: var(--spacing-md);
    }
    
    .code-block-wrapper pre {
        padding: var(--spacing-sm);
    }
    
    .blog-quote {
        padding-left: 16px;
        margin: var(--spacing-lg) 0;
    }
    
    .quote-decoration {
        width: 3px;
    }
    
    .quote-text {
        font-size: 1rem;
        line-height: 1.75;
    }
    
    .quote-author {
        font-size: var(--font-size-xs);
        margin-top: var(--spacing-xs);
    }
    
    .custom-quote {
        padding-left: 15px;
    }
    
    .custom-quote p {
        font-size: 1rem;
    }
}

/* ===== Dark Mode Support ===== */
@media (prefers-color-scheme: dark) {
    .table-wrapper {
        background-color: rgba(255, 121, 0, 0.03);
        border-color: rgba(255, 121, 0, 0.2);
    }
    
    .custom-table thead {
        background: linear-gradient(135deg, rgba(255, 121, 0, 0.12) 0%, rgba(255, 121, 0, 0.06) 100%);
    }
    
    .custom-table tbody tr {
        background-color: rgba(0, 0, 0, 0.2);
    }
    
    .custom-table tbody tr:nth-child(even) {
        background-color: rgba(255, 121, 0, 0.02);
    }
    
    .custom-table tbody tr:hover {
        background-color: rgba(255, 121, 0, 0.06);
    }
    
    .custom-table td {
        color: #e0e0e0;
    }
    
    .custom-table td:first-child {
        color: #f0f0f0;
    }
}

/* ===== Notion Column Layout ===== */
.notion-column-list {
    display: flex;
    gap: var(--spacing-xl);
    margin: var(--spacing-xl) 0;
    width: 100%;
}

.notion-column {
    flex: 1;
    min-width: 0; /* Prevent overflow */
    display: flex;
    flex-direction: column;
}

/* Add spacing between blocks inside columns */
.notion-column > * {
    margin-bottom: var(--spacing-md);
}

.notion-column > *:last-child {
    margin-bottom: 0;
}

/* Responsive: Stack columns on mobile */
@media (max-width: 768px) {
    .notion-column-list {
        flex-direction: column;
        gap: var(--spacing-lg);
    }
}
