/* =====================
   Variables
   ===================== */
:root {
    --bg:           #ffffff;
    --text:         #111827;
    --text-muted:   #6b7280;
    --border:       #e5e7eb;
    --border-light: #f3f4f6;
    --accent:       #1d4ed8;
    --tag-bg:       #f3f4f6;
    --tag-text:     #374151;
    --code-bg:      #f9fafb;
    --max-width:    720px;
}

/* =====================
   Reset
   ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
img, video, svg { max-width: 100%; display: block; }

/* =====================
   Base
   ===================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

/* =====================
   Layout
   ===================== */
.site-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
.site-main    { flex: 1; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* =====================
   Header
   ===================== */
.site-header {
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

.site-header .container {
    /* leave space for fixed lang-switcher (top-right) */
    padding-right: 180px;
}

.site-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.3px;
}

.site-title:hover { color: var(--accent); }

/* Kill Ghost membership portal button */
#ghost-portal-root { display: none !important; }

/* =====================
   Post Feed (index / tag)
   ===================== */
.post-feed {
    padding: 48px 0 16px;
}

.post-card {
    padding-bottom: 64px;
    margin-bottom: 64px;
    border-bottom: 2px solid var(--border-light);
}

.post-card:last-child { border-bottom: none; }

.post-card-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.post-card-meta time {
    font-size: 13px;
    color: var(--text-muted);
}

.post-card-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.3px;
    margin-bottom: 0;
}

.post-card-title a {
    color: var(--text);
    text-decoration: none;
}

.post-card-title a:hover { color: var(--accent); }

/* =====================
   Tags
   ===================== */
.tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    background: var(--tag-bg);
    color: var(--tag-text);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

/* Hide internal tags (Ghost slugifies # → hash-) */
.tag[data-slug^="hash-"] { display: none; }

/* =====================
   Single Post
   ===================== */
.post-full { padding: 48px 0 64px; }

.post-header {
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.post-meta time { font-size: 14px; color: var(--text-muted); }

.post-title {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.5px;
}

/* =====================
   Post Content
   ===================== */
.post-content { font-size: 16px; line-height: 1.8; }

.post-content h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 48px 0 14px;
    letter-spacing: -0.4px;
    line-height: 1.3;
    padding-top: 32px;
    border-top: 2px solid var(--border-light);
}

.post-content h1:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.post-content h2 {
    font-size: 19px;
    font-weight: 700;
    margin: 36px 0 12px;
    letter-spacing: -0.2px;
}

.post-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 28px 0 10px;
    line-height: 1.5;
}

.post-content p  { margin-bottom: 20px; }

.post-content ul,
.post-content ol { margin: 0 0 20px 22px; }

.post-content li { margin-bottom: 6px; }

.post-content strong { font-weight: 600; }

.post-content a { color: var(--accent); }

.post-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 40px 0;
}

.post-content code {
    font-family: ui-monospace, "SF Mono", Menlo, "Cascadia Code", monospace;
    font-size: 0.875em;
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.post-content pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    padding: 20px 24px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0 0 24px;
}

.post-content pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 14px;
}

.post-content blockquote {
    border-left: 3px solid var(--border);
    padding: 4px 0 4px 20px;
    color: var(--text-muted);
    margin: 0 0 20px;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-size: 14px;
}

.post-content th,
.post-content td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.post-content th { font-weight: 600; color: var(--text-muted); }

/* =====================
   Digest Visual Elements
   ===================== */

/* 一言サマリーボックス */
.news-summary {
    background: #eff6ff;
    border-left: 4px solid var(--accent);
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
    margin: 16px 0;
    font-size: 15px;
    line-height: 1.7;
}

/* 攻撃フロー図 */
.attack-flow {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 18px;
    margin: 14px 0;
    font-size: 13px;
    font-weight: 500;
}

.attack-flow .node {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 12px;
    white-space: nowrap;
}

.attack-flow .node.danger {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.attack-flow .arrow {
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
}

/* 今すぐやることボックス */
.action-box {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 14px 18px;
    margin: 14px 0;
    line-height: 1.9;
}

.action-box .action-title {
    font-weight: 700;
    color: #15803d;
    margin-bottom: 6px;
    display: block;
}

/* その他ニューステーブル */
.other-news-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
}

.other-news-table th {
    background: var(--border-light);
    font-weight: 600;
    padding: 8px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border);
}

.other-news-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.other-news-table tr:last-child td { border-bottom: none; }

/* =====================
   Post Footer
   ===================== */
.post-footer {
    margin-top: 48px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.back-link {
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
}

.back-link:hover { color: var(--text); }

/* =====================
   Pagination
   ===================== */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0 48px;
    font-size: 14px;
}

.pagination a    { color: var(--accent); text-decoration: none; font-weight: 500; }
.pagination .page-number { color: var(--text-muted); }

/* =====================
   Footer
   ===================== */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 20px 0;
}

.footer-copy { font-size: 13px; color: var(--text-muted); }

/* =====================
   Error page
   ===================== */
.error-page   { padding: 80px 0; text-align: center; }
.error-code   { font-size: 72px; font-weight: 800; color: var(--border-light); margin-bottom: 12px; }
.error-message { color: var(--text-muted); margin-bottom: 32px; }

/* =====================
   Ghost Koenig card widths (required by GScan)
   ===================== */
.kg-width-wide {
    margin-left:  min(-10vw, -60px);
    margin-right: min(-10vw, -60px);
}

.kg-width-full {
    margin-left:  calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    width: 100vw;
}

/* =====================
   Responsive
   ===================== */
@media (max-width: 640px) {
    .site-header .container { padding-right: 24px; }
    .post-title             { font-size: 24px; }
    .post-card-title        { font-size: 18px; }
    .post-content h1        { font-size: 20px; }
    .post-content h2        { font-size: 17px; }
}
