/* ═══════════════════════════════════════════════════════
   Medical Design Forum — Ghost theme
   Ported from preview/01_초음파_프로브_GUI_디자인_light.html
   ═══════════════════════════════════════════════════════ */

:root {
    --bg: #FFFFFF;
    --bg-secondary: #F7F7F8;
    --bg-hover: #F3F3F5;
    --text: #1A1A1A;
    --text-secondary: #555555;
    --text-muted: #999999;
    --text-light: #BBBBBB;
    --accent: #7C5CFC;
    --accent-light: rgba(124, 92, 252, 0.08);
    --accent-border: rgba(124, 92, 252, 0.25);
    --border: #EAEAEC;
    --border-light: #F0F0F2;
    --sidebar-w: 248px;
    --toc-w: 200px;
    --radius: 10px;
    --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    font-family: 'Pretendard', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 15.5px;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* ═══════════════════════════════════
   LEFT SIDEBAR
═══════════════════════════════════ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg);
    border-right: 1px solid var(--border);
    padding: 20px 12px;
    overflow-y: auto;
    z-index: 50;
}

/* Logo area */
.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px 20px;
}
.sidebar-logo a {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
}
.logo-icon {
    width: 26px;
    height: 26px;
    background: var(--accent);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
}
.logo-icon img { width: 26px; height: 26px; border-radius: 7px; }
.logo-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

/* Contact link at sidebar bottom */
.sidebar-bottom {
    position: absolute;
    bottom: 16px;
    left: 12px;
    right: 12px;
}
.sidebar-bottom .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    transition: all 0.12s;
    cursor: pointer;
}
.sidebar-bottom .nav-item:hover {
    background: var(--bg-hover);
}

/* Sidebar section labels */
.sidebar-section {
    padding: 18px 8px 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* Sidebar nav items */
.sidebar-nav { list-style: none; }
.sidebar-nav li { margin-bottom: 1px; }
.sidebar-nav > li > a,
.sidebar-nav > li > .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    transition: all 0.12s;
    cursor: pointer;
    justify-content: space-between;
}
.sidebar-nav > li > a:hover,
.sidebar-nav > li > .nav-item:hover {
    background: var(--bg-hover);
}
.nav-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nav-icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-muted);
    fill: none;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.nav-item.active .nav-icon svg {
    stroke: rgba(255,255,255,0.8);
}
.nav-chevron {
    font-size: 11px;
    color: var(--text-light);
    transition: transform 0.2s;
}
.nav-chevron.open { transform: rotate(90deg); }

/* Dropdown chevron (up/down) for Archive items */
.nav-dropdown-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.nav-dropdown-chevron svg {
    width: 14px;
    height: 14px;
    stroke: var(--text-light);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.nav-dropdown-chevron.open svg { transform: rotate(180deg); }
.nav-item.active .nav-dropdown-chevron svg { stroke: rgba(255,255,255,0.5); }

/* Sub menu */
.sub-nav {
    list-style: none;
    padding: 2px 0 4px 0;
}
.sub-nav li a {
    display: block;
    padding: 6px 12px 6px 44px;
    font-size: 13.5px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.12s;
    font-weight: 400;
}
.sub-nav li a:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* ═══════════════════════════════════
   TOP BAR (breadcrumb)
═══════════════════════════════════ */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: 52px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 40;
}
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
}
.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { color: var(--text-light); font-size: 11px; }
.breadcrumb .current { color: var(--text-secondary); font-weight: 500; }
.breadcrumb-logo {
    width: 22px;
    height: 22px;
    background: var(--accent);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    text-decoration: none;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar-search {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}
.topbar-search:hover {
    background: var(--bg-hover);
}
.topbar-search svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-muted);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.topbar-search:hover svg {
    stroke: var(--text-secondary);
}
.lang-switch {
    display: flex;
    gap: 2px;
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 2px;
}
.lang-switch a {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 5px;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.12s;
}
.lang-switch a.active {
    background: var(--bg);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* ═══════════════════════════════════
   MAIN CONTENT AREA
═══════════════════════════════════ */
.main {
    margin-left: var(--sidebar-w);
    padding-top: 52px;
    min-height: 100vh;
}
.content-wrapper {
    display: flex;
    max-width: 1060px;
    margin: 0 auto;
}

/* ── Article Content ── */
.article-area {
    flex: 1;
    min-width: 0;
    padding: 48px 48px 80px;
    max-width: 740px;
}

/* Hero */
.article-hero {
    margin-bottom: 36px;
}
.article-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.article-tag {
    background: var(--accent-light);
    color: var(--accent);
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}
a.article-tag:hover { background: rgba(124, 92, 252, 0.15); }

/* Multiple badges side-by-side (in hero meta, listing cards, related cards) */
.article-meta .article-tag + .article-tag {
    margin-left: 4px;
}
.article-card-badges,
.related-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}
.related-card-badges .article-tag {
    font-size: 11px;
    padding: 2px 8px;
}
.article-date {
    color: var(--text-muted);
    font-size: 13px;
}
.article-read-time {
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.article-hero h1 {
    font-size: 34px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -1px;
    color: var(--text);
    margin-bottom: 12px;
}
.article-hero .subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.65;
    font-weight: 400;
}

/* Feature image */
.feature-image {
    margin-bottom: 40px;
}
.feature-image img {
    width: 100%;
    height: auto;
    max-height: 480px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.feature-image .img-placeholder {
    width: 100%;
    height: 360px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    border: 1px solid var(--border);
    text-align: center;
    padding: 24px;
}

/* Article body */
.article-body h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 52px 0 16px;
    letter-spacing: -0.4px;
    color: var(--text);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}
.article-body h2:first-child { margin-top: 0; }

.article-body h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 32px 0 10px;
    color: var(--text);
}

.article-body p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    line-height: 1.85;
}

.article-body strong {
    color: var(--text);
    font-weight: 600;
}
.article-body em { font-style: italic; }

.article-body a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
.article-body a:hover { text-decoration-thickness: 2px; }

.article-body ul, .article-body ol {
    margin: 12px 0 20px 20px;
    color: var(--text-secondary);
}
.article-body li {
    margin-bottom: 7px;
    line-height: 1.7;
}

.article-body hr {
    border: none;
    height: 1px;
    background: var(--border-light);
    margin: 44px 0;
}

.article-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 12px 18px;
    margin: 22px 0;
    background: var(--accent-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.article-body blockquote p {
    color: var(--text-secondary);
    margin-bottom: 0;
    font-style: italic;
    font-size: 14.5px;
}

.article-body img {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin: 24px auto;
    display: block;
    max-width: 100%;
}

.article-body figure {
    margin: 24px 0;
}
.article-body figure img {
    margin: 0;
}
.article-body figcaption {
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--text-muted);
    text-align: center;
}

.article-body .img-placeholder {
    width: 100%;
    height: 260px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    margin: 24px 0;
    border: 1px solid var(--border);
    text-align: center;
    padding: 24px;
}

/* Table */
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    font-size: 14px;
}
.article-body th, .article-body td {
    padding: 10px 14px;
    text-align: left;
}
.article-body th {
    color: var(--text);
    font-weight: 600;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}
.article-body td {
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}
.article-body tr:last-child td { border-bottom: none; }

/* Callout */
.callout, .article-body .kg-callout-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    margin: 22px 0;
}
.callout-title {
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 5px;
    font-size: 13.5px;
}
.callout p {
    margin-bottom: 5px;
    font-size: 14px;
    line-height: 1.7;
}
.callout p:last-child { margin-bottom: 0; }

/* Summary box */
.summary-box {
    background: var(--accent-light);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius);
    padding: 24px;
    margin: 32px 0;
}
.summary-box h3 {
    color: var(--accent);
    margin: 0 0 10px;
    font-size: 17px;
}

/* Code blocks (added for Ghost) */
.article-body code {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 13.5px;
    font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
    color: var(--text);
}
.article-body pre {
    background: #1a1a1a;
    color: #f0f0f0;
    padding: 16px 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 20px 0;
    font-size: 13px;
    line-height: 1.6;
}
.article-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* Ghost Koenig editor card overrides */
.article-body .kg-card { margin: 24px 0; }
.article-body .kg-image-card img { margin: 0 auto; }
.article-body .kg-bookmark-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

/* Required by Ghost Koenig editor — wide and full-width image cards */
.article-body .kg-width-wide img {
    max-width: 92vw;
    width: calc(100% + 100px);
    margin-left: -50px;
    margin-right: -50px;
}
.article-body .kg-width-full img {
    max-width: 100vw;
    width: calc(100vw - 32px);
    margin-left: calc(50% - 50vw + 16px);
    margin-right: calc(50% - 50vw + 16px);
    border-radius: 0;
    border-left: none;
    border-right: none;
}
.article-body .kg-width-full figcaption,
.article-body .kg-width-wide figcaption {
    max-width: 740px;
    margin-left: auto;
    margin-right: auto;
}
@media (max-width: 1100px) {
    .article-body .kg-width-wide img {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    .article-body .kg-width-full img {
        width: calc(100vw - 16px);
        margin-left: calc(50% - 50vw + 8px);
    }
}

/* ═══════════════════════════════════
   RIGHT TOC SIDEBAR
═══════════════════════════════════ */
.toc-sidebar {
    width: var(--toc-w);
    flex-shrink: 0;
    padding: 48px 16px 48px 0;
}
.toc {
    position: sticky;
    top: 72px;
}
.toc-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 14px;
    padding-left: 14px;
}
.toc a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    padding: 7px 14px;
    border-left: 2.5px solid transparent;
    transition: all 0.15s;
    line-height: 1.4;
    font-weight: 400;
}
.toc a:hover {
    color: var(--text-secondary);
}
.toc a.active {
    color: var(--text);
    font-weight: 600;
    border-left-color: var(--accent);
}

/* ═══════════════════════════════════
   RELATED & FOOTER
═══════════════════════════════════ */
.related {
    padding: 0;
    margin-top: 48px;
}
.related h2 {
    font-size: 18px;
    margin-bottom: 16px;
    font-weight: 700;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.related-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    transition: all 0.15s;
    color: inherit;
    display: block;
    position: relative;
}
.related-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.related-card h3 { font-size: 14px; margin: 8px 0 5px; font-weight: 600; color: var(--text); }
.related-card p { font-size: 13px; color: var(--text-muted); line-height: 1.45; margin: 0; }
.related-card-link {
    color: inherit;
    text-decoration: none;
}
.related-card-link::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}
.related-card-badges {
    position: relative;
    z-index: 2;
}

.main-footer {
    border-top: 1px solid var(--border);
    padding: 28px 0;
    margin-top: 48px;
    color: var(--text-muted);
    font-size: 12.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.main-footer a {
    color: var(--text-muted);
    text-decoration: none;
}
.main-footer a:hover { color: var(--text-secondary); }
.footer-links { display: flex; gap: 16px; }

/* ═══════════════════════════════════
   LISTING (index.hbs / tag.hbs)
═══════════════════════════════════ */
.listing-area {
    flex: 1;
    min-width: 0;
    padding: 48px 48px 80px;
    max-width: 900px;
}
.listing-header {
    margin-bottom: 36px;
}
.listing-header h1 {
    font-size: 56px;
    font-weight: 800;
    letter-spacing: -1.5px;
    color: var(--text);
    line-height: 1.05;
    margin-bottom: 12px;
}
.listing-header .listing-description {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.65;
    max-width: 640px;
}
.listing-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.article-card {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 28px;
    padding: 24px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: inherit;
    transition: all 0.15s;
    align-items: center;
    position: relative;
}
.article-card:hover {
    border-color: var(--accent-border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
    transform: translateY(-1px);
}
/* Stretched-link pattern: title link covers the whole card */
.article-card-link {
    color: inherit;
    text-decoration: none;
}
.article-card-link::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}
/* Lift badges, image, etc. above the stretched link so they remain clickable */
.article-card-image,
.article-card-badges,
.article-card-meta a {
    position: relative;
    z-index: 2;
}
.article-card-image {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}
.article-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.article-card-image.is-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 12px;
}
.article-card-content {
    min-width: 0;
}
.article-card-content .article-tag { margin-bottom: 12px; }
.article-card-content h2 {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text);
    margin: 12px 0 10px;
    letter-spacing: -0.3px;
}
.article-card-content .excerpt {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.article-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-muted);
}
.article-card-meta .author {
    display: flex;
    align-items: center;
    gap: 6px;
}
.article-card-meta .author img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

.empty-state {
    padding: 60px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* ═══════════════════════════════════
   STATIC PAGE (page.hbs)
═══════════════════════════════════ */
.page-area {
    flex: 1;
    min-width: 0;
    padding: 48px 48px 80px;
    max-width: 740px;
}
.page-area h1 {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 28px;
    color: var(--text);
}

/* ═══════════════════════════════════
   PAGINATION
═══════════════════════════════════ */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-muted);
}
.pagination a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}
.pagination a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ═══════════════════════════════════
   SIDEBAR ACTIVE STATE — disabled per founder spec.
   Sidebar items only show shading on hover (see .nav-item:hover and
   .sub-nav li a:hover above). No persistent active highlighting.
═══════════════════════════════════ */

/* ═══════════════════════════════════
   RESPONSIVE
═══════════════════════════════════ */
@media (max-width: 1100px) {
    .toc-sidebar { display: none; }
}
@media (max-width: 860px) {
    .sidebar { display: none; }
    .main { margin-left: 0; }
    .topbar { left: 0; padding: 0 16px; }
    .article-area, .listing-area, .page-area { padding: 36px 24px 64px; }
    .article-hero h1 { font-size: 26px; }
    .listing-header h1 { font-size: 36px; }
    .article-card { grid-template-columns: 1fr; gap: 16px; padding: 16px; }
    .related { padding: 0; }
    .main-footer { padding: 20px 0; }
}
