/* ══════════════════════════════════
   weekly (/weekly) — "Pearl" skin on the blueprint skeleton (decision M5, docs/weekly.md §6)
   Rail of issues · main column (issue head · 내부 · 외부 as rows) · side column (지난 회차 확인 · 다음에 볼 일정 as cards).
   Frame (grid, brackets, borders) is achromatic pearl (tier-minor); the only azure is the section
   label; the only other color on the page is P&L tone in table cells. Chrome comes from common.css.
   ══════════════════════════════════ */

.wk-page { position: relative; z-index: 1; --shell: 1400px; padding: 8px 30px 90px; }

/* full-viewport grid, pearl and faint */
.wk-grid { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(rgba(var(--tier-minor-rgb), .045) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(var(--tier-minor-rgb), .045) 1px, transparent 1px);
  background-size: 40px 40px; }

/* system line */
.wk-sys { display: flex; align-items: center; gap: 10px; font-family: 'JetBrains Mono'; font-weight: 500; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); margin: 16px 0 14px; }
.wk-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tier-minor); box-shadow: 0 0 9px rgba(var(--tier-minor-rgb), .6); }
/* sample badge — the one place the page is allowed to shout: these numbers are made up */
.wk-badge { display: inline-flex; align-items: center; padding: 2px 8px; font-family: 'JetBrains Mono'; font-weight: 700; font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--negative); border: 1px solid rgba(var(--negative-rgb), .5); background: rgba(var(--negative-rgb), .12); }
.wk-badge[hidden] { display: none; }

/* layout — main column reads like a page, side column holds the two cards */
.wk-layout { display: grid; grid-template-columns: 172px minmax(0, 3fr) minmax(0, 2fr); gap: 26px; margin-top: 18px; align-items: start; }
.wk-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* rail */
.wk-rail { position: sticky; top: 64px; min-width: 0; }   /* min-width: the scroll strip must not widen the grid column */
.wk-now { position: relative; padding: 16px 18px; border: 1px solid rgba(var(--tier-minor-rgb), .25); background: rgba(var(--tier-minor-rgb), .03); margin-bottom: 14px; }
.wk-now::after { content: ""; position: absolute; bottom: -1px; right: -1px; width: 13px; height: 13px; border: 2px solid var(--tier-minor); border-left: 0; border-top: 0; }
.wk-now .k { font-family: 'JetBrains Mono'; font-weight: 700; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-dim); }
.wk-now .k::before { content: "// "; }
.wk-now .big { font-family: Sora; font-weight: 800; font-size: 30px; letter-spacing: -.02em; color: #fff; line-height: 1; margin: 6px 0 8px; font-variant-numeric: tabular-nums; }
.wk-now .row { font-family: 'JetBrains Mono'; font-size: 10.5px; color: var(--text-muted); margin: 3px 0; }
.wk-issues { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgba(var(--tier-minor-rgb), .16);
  max-height: 188px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(var(--tier-minor-rgb), .25) transparent; }   /* ≈ 4 rows; the archive is the scroll */
/* scroll hint — weekly.js fades only the side that actually hides rows, so a list that fits gets no
   fade and the active issue (kept centered, clamped at the ends) never sits under one */
.wk-issues.fade-bottom { -webkit-mask-image: linear-gradient(#000 calc(100% - 44px), transparent); mask-image: linear-gradient(#000 calc(100% - 44px), transparent); }
.wk-issues.fade-top { -webkit-mask-image: linear-gradient(transparent, #000 44px); mask-image: linear-gradient(transparent, #000 44px); }
.wk-issues.fade-top.fade-bottom { -webkit-mask-image: linear-gradient(transparent, #000 44px, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(transparent, #000 44px, #000 calc(100% - 44px), transparent); }
.wk-month { padding: 12px 12px 4px; font-family: 'JetBrains Mono'; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); }
.wk-month::before { content: "// "; }
.wk-issues a { display: flex; flex-direction: column; gap: 2px; padding: 9px 10px 9px 12px; border-left: 2px solid transparent; text-decoration: none; color: var(--text-muted); font-family: 'JetBrains Mono'; font-size: 12px; border-bottom: 1px solid rgba(255,255,255,.05); }
.wk-issues a small { font-size: 10px; color: var(--text-dim); }
.wk-issues a.active { color: var(--text-primary); border-left-color: var(--tier-minor); background: var(--bg-surface); }
.wk-issues a:hover { color: var(--text-primary); }

/* cards (side column) */
.wk-card { position: relative; padding: 20px 24px; border: 1px solid rgba(var(--tier-minor-rgb), .16); background: rgba(var(--tier-minor-rgb), .025); min-width: 0; }
.wk-card::before { content: ""; position: absolute; top: -1px; left: -1px; width: 15px; height: 15px; border: 2px solid var(--tier-minor); border-right: 0; border-bottom: 0; }

/* section label — the one azure element. Labels are the manuscript's Hangul, so the tracking is tighter than the EN mono chrome */
.wk-label { font-family: 'JetBrains Mono', 'Pretendard Variable', monospace; font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--b2); margin-bottom: 12px; }
.wk-label::before { content: "// "; }

/* issue head — the manuscript's title and its 집계 기간 line, top of the main column */
.wk-head { padding: 4px 0 18px; border-bottom: 1px solid rgba(var(--tier-minor-rgb), .16); }
.wk-head h1 { font-family: Sora, 'Pretendard Variable', sans-serif; font-weight: 800; font-size: 26px; letter-spacing: -.02em; line-height: 1.25; color: #fff; margin: 0 0 8px; word-break: keep-all; }
.wk-head p { margin: 0; font-family: 'JetBrains Mono'; font-size: 11.5px; letter-spacing: .04em; color: var(--text-dim); }
.wk-head em { font-style: normal; }

/* article headline — 내부 소제목, 외부 기사. White on a faint azure band with a left rule: the claim stays in the body's
   own tone for readability, the band and rule do the pointing (시안 D; B = bar only, no band, is the fallback) */
.wk-body h3 { font-family: Sora, 'Pretendard Variable', sans-serif; font-weight: 700; font-size: 17px; line-height: 1.45; color: #fff; margin: 26px 0 10px;
  padding: 8px 12px; background: rgba(var(--b2-rgb), .08); border-left: 2px solid var(--b2); }
.wk-body h3:first-child { margin-top: 0; }
/* a paragraph that is only emphasis = the writer's 기준·단서·출처 line: quieter, not italic */
.wk-body p > em:only-child { display: block; font-style: normal; font-size: 12.5px; line-height: 1.6; color: var(--text-dim); }
.wk-body a { color: var(--text-primary); text-decoration: none; border-bottom: 1px dotted rgba(var(--tier-minor-rgb), .6); }
.wk-body a:hover { border-bottom-style: solid; }
/* 다음에 볼 일정 — each paragraph is one card (시각·분류 / 제목 / 왜 / 확인 / 출처), line breaks kept by the build */
.wk-card[data-kind="upcoming"] .wk-body p { padding: 10px 0; margin: 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.wk-card[data-kind="upcoming"] .wk-body p:last-child { border-bottom: 0; }
.wk-card[data-kind="upcoming"] .wk-body p > strong:first-child { font-family: 'JetBrains Mono', 'Pretendard Variable', monospace; font-weight: 700; font-size: 12px; color: var(--tier-minor); }
.wk-card[data-kind="upcoming"] .wk-body p > em { font-size: 12px; color: var(--text-dim); font-style: normal; }

/* body (rendered markdown) — Hangul breaks between words only; long URLs still wrap.
   Fonts: Latin faces first, Pretendard Variable catches every Hangul glyph (Inter·Sora·JetBrains Mono have none) */
.wk-body { font-family: 'Inter', 'Pretendard Variable', system-ui, sans-serif; color: var(--text-muted); font-size: 14px; line-height: 1.7; word-break: keep-all; overflow-wrap: break-word; }
.wk-body p { margin: 8px 0; }
/* main column reads like a page: a step larger and looser than the side cards */
.wk-main .wk-body { font-size: 15px; line-height: 1.8; }
.wk-main .wk-body p { margin: 12px 0; }
.wk-body strong { color: var(--text-primary); font-weight: 600; }
.wk-body code { font-family: 'JetBrains Mono', 'Pretendard Variable', monospace; font-size: .88em; color: var(--text-primary); background: rgba(var(--tier-minor-rgb), .1); padding: 1px 5px; border-radius: 3px; }
.wk-body ul, .wk-body ol { margin: 6px 0; padding-left: 1.2em; }
.wk-body li { margin: 5px 0; }
.wk-body table { border-collapse: collapse; width: 100%; margin: 4px 0; font-size: 13px; display: block; overflow-x: auto; }
.wk-body th { font-family: 'JetBrains Mono'; font-weight: 500; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); text-align: left; padding: 6px 8px; border-bottom: 1px solid rgba(var(--tier-minor-rgb), .25); white-space: nowrap; }
.wk-body td { padding: 9px 8px; border-bottom: 1px solid rgba(255,255,255,.05); font-family: 'JetBrains Mono'; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-primary); }
.wk-body td:first-child { font-family: Sora, 'Pretendard Variable', sans-serif; font-weight: 700; font-size: 14px; }
.wk-body tr:last-child td { border-bottom: 0; }
.wk-body td.tone-pos { color: var(--positive); background: rgba(var(--positive-rgb), .08); }
.wk-body td.tone-neg { color: var(--negative); background: rgba(var(--negative-rgb), .08); }

/* language — prose comes as ko/en pairs; weekly.js sets <html data-locale> to a language the issue has */
html[data-locale="en"] .wk-page [lang="ko"], html[data-locale="ko"] .wk-page [lang="en"] { display: none; }

/* main column — rows */
.wk-main { gap: 0; }
.wk-main .wk-sec { padding: 18px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.wk-main .wk-label { margin-bottom: 8px; }

/* 보관 (1~3호 후 정리) — 이전 8섹션 계약의 lead(Three Lines)·스파크라인·[A#] 표식 스타일. 현재 빌드는 만들지 않는다.
.wk-lead ol { list-style: none; margin: 0; padding: 0; counter-reset: k; }
.wk-lead li { counter-increment: k; position: relative; padding: 9px 0 9px 40px; font-size: 15px; line-height: 1.55; color: var(--text-primary); border-bottom: 1px solid rgba(255,255,255,.05); }
.wk-lead li:last-child { border-bottom: 0; }
.wk-lead li::before { content: counter(k, decimal-leading-zero); position: absolute; left: 0; top: 10px; font-family: 'JetBrains Mono'; font-weight: 700; font-size: 14px; color: var(--tier-minor); }
.wk-lead strong { color: var(--positive); font-family: 'JetBrains Mono'; font-weight: 700; }
.wk-lead code { font-family: 'JetBrains Mono'; font-size: .9em; color: var(--text-primary); background: none; padding: 0; }
.wk-body td:has(> .wk-spark) { padding: 4px 8px; line-height: 0; }
.wk-spark { display: block; }
.wk-ref { font-family: 'JetBrains Mono'; font-size: 10px; color: var(--text-dim); }
*/
.wk-status { color: var(--text-muted); margin: 18px 0; font-size: 14px; }

/* figure — a developer-made chart inlined by the build (`<!-- FIGURE: … -->`, docs/weekly.md §4). Achromatic like the
   frame: pearl marks, text tokens for every label, hairline grid; the only emphasis is form (a surface wash on one day).
   Fonts and colors live here so the SVG stays semantic (classes only). Text scales with the viewBox — keep it ≤ 620px wide. */
.wk-fig { margin: 18px 0 6px; max-width: 620px; }
.wk-fig svg { display: block; width: 100%; height: auto; }
.wk-fig .ttl { fill: var(--text-muted); font: 600 12px 'Inter', 'Pretendard Variable', sans-serif; }
.wk-fig .ax { fill: var(--text-dim); font: 500 10.5px 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
.wk-fig .lbl { fill: var(--text-primary); font: 500 11px 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
.wk-fig .grid { stroke: rgba(var(--tier-minor-rgb), .12); stroke-width: 1; }
.wk-fig .axis { stroke: rgba(var(--tier-minor-rgb), .3); stroke-width: 1; }
.wk-fig .band { fill: rgba(var(--tier-minor-rgb), .06); }
.wk-fig .ln { fill: none; stroke: var(--tier-minor); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.wk-fig .dot { fill: var(--tier-minor); stroke: var(--bg-dark); stroke-width: 2; }   /* 2px surface ring where the dot sits on the line */
.wk-fig .hit { fill: transparent; }                                                  /* ≥24px hover target carrying the <title> tooltip */
.wk-fig figcaption { margin-top: 6px; font-size: 12px; line-height: 1.6; color: var(--text-dim); }
.wk-fig-table { margin-top: 6px; }
.wk-fig-table summary { cursor: pointer; font-family: 'JetBrains Mono', 'Pretendard Variable', monospace; font-size: 11px; letter-spacing: .06em; color: var(--text-dim); }
.wk-fig-table summary:hover { color: var(--text-muted); }
.wk-fig-table table { margin-top: 6px; }
/* the figure's table twin is a reading aid, not a P&L board — compact rows, mono first column */
.wk-fig-table td { padding: 5px 8px; font-size: 12px; color: var(--text-muted); }
.wk-fig-table td:first-child { font-family: 'JetBrains Mono', monospace; font-weight: 500; font-size: 12px; color: var(--text-dim); }

/* narrow screens: SVG text scales with the viewBox, so below 480px the figure keeps a readable minimum width and
   scrolls sideways like a wide table does — the clipped edge is the hint (no fade, no nudge) */
@media (max-width: 480px) {
    .wk-fig { overflow-x: auto; }
    .wk-fig svg { min-width: 480px; }
}

@media (max-width: 1024px) {
    .wk-layout { grid-template-columns: minmax(0, 1fr); }
    .wk-rail { position: static; }
    .wk-issues { display: flex; flex-wrap: nowrap; align-items: flex-end; border-top: 0; max-height: none; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
    .wk-issues.fade-right { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
    .wk-issues.fade-left { -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px); mask-image: linear-gradient(90deg, transparent, #000 40px); }
    .wk-issues.fade-left.fade-right { -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
    .wk-issues::-webkit-scrollbar { display: none; }
    .wk-issues li { flex: 0 0 auto; }
    .wk-issues a { border-left: 0; border-bottom: 2px solid transparent; padding: 8px 10px; }
    .wk-issues a.active { border-bottom-color: var(--tier-minor); }
    .wk-month { padding: 0 6px 12px 10px; }
}
