/* =====================================================================
   Anthropic Engineering 日本語版 - site.css
   Inspired by the official Anthropic engineering blog design.
   ===================================================================== */

/* ---- Reset / base -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0;
    background: #faf9f5;
    color: #141413;
    font-family:
        "Source Serif 4", "Noto Serif JP", "Yu Mincho", "Hiragino Mincho ProN",
        "Times New Roman", serif;
    font-size: 17px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "palt" 1;
    text-rendering: optimizeLegibility;
}

/* Variables */
:root {
    --bg: #faf9f5;
    --bg-soft: #f4f1ea;
    --text: #141413;
    --text-muted: #6b6b68;
    --text-subtle: #8a8a85;
    --rule: #e6e3d9;
    --rule-soft: #efebe0;
    --accent: #c9681f;          /* warm orange-brown, close to Anthropic tones */
    --accent-dark: #8a4a14;
    --link: #b7541a;
    --link-hover: #8a4a14;
    --code-bg: #f1ede2;
    --code-border: #e0dbcc;
    --blockquote-bg: #f5f1e4;

    --font-sans: "Inter", "Noto Sans JP", "Yu Gothic", "YuGothic", "Hiragino Sans",
                 "Hiragino Kaku Gothic ProN", -apple-system, system-ui, sans-serif;
    --font-serif: "Source Serif 4", "Noto Serif JP", "Yu Mincho",
                  "Hiragino Mincho ProN", "Times New Roman", serif;
    --font-mono: "JetBrains Mono", "Menlo", "Consolas", monospace;

    /* PDF と同じフォントスタック。記事ページの本文・見出しで使う。
       Yu Gothic を最優先にすることで macOS/Windows の PDF と視覚的に一致させる。 */
    --font-pdf: "Yu Gothic", "YuGothic", "游ゴシック", "Hiragino Sans",
                "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Inter", sans-serif;
    /* PDF カバーの原題表記 ".original" と同じ Times New Roman italic */
    --font-pdf-original: "Times New Roman", "Source Serif 4", "Noto Serif JP", serif;
}

/* ---- Layout -------------------------------------------------------- */
.container {
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    padding: 0 24px;
}

.site-main { padding-top: 48px; padding-bottom: 96px; }

/* ---- Header -------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(250, 249, 245, 0.92);
    backdrop-filter: saturate(140%) blur(8px);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    border-bottom: 1px solid var(--rule);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 18px;
    padding-bottom: 18px;
    gap: 24px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.01em;
}
.brand-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1.5px solid var(--text);
    border-radius: 4px;
    font-size: 14px;
    transform: rotate(0deg);
}
.brand-text em { font-style: italic; font-weight: 500; color: var(--text-muted); }

.site-nav { display: flex; gap: 20px; }
.site-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    transition: color 120ms ease;
}
.site-nav a:hover { color: var(--text); }

/* ---- Page intro ---------------------------------------------------- */
.page-intro { padding: 32px 0 24px; }
.page-title {
    font-family: var(--font-sans);
    font-size: clamp(32px, 5vw, 48px);
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 0 0 16px;
    font-weight: 600;
    color: var(--text);
}
.page-title em { font-style: normal; color: var(--text-muted); font-weight: 500; }
.page-lead {
    font-family: var(--font-serif);
    font-size: 18px;
    line-height: 1.7;
    color: var(--text-muted);
    max-width: 680px;
    margin: 0 0 20px;
}
.page-lead a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.page-lead a:hover { color: var(--link-hover); }
.page-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-muted);
}
.page-stats .stat strong {
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ---- Rule ---------------------------------------------------------- */
.rule {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 40px 0;
}

/* ---- Featured ------------------------------------------------------ */
.featured { margin: 0 0 64px; }
.featured-label {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.featured-card {
    display: block;
    text-decoration: none;
    color: var(--text);
    padding: 32px 0;
    transition: transform 200ms ease;
}
.featured-card:hover .featured-title { color: var(--accent-dark); }
.featured-title {
    font-family: var(--font-sans);
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0 0 12px;
    color: var(--text);
    transition: color 160ms ease;
}
.featured-subtitle {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 16px;
    color: var(--text-muted);
    margin: 0 0 14px;
}
.featured-summary {
    font-family: var(--font-serif);
    font-size: 17px;
    line-height: 1.7;
    margin: 0 0 18px;
    color: #2f2f2d;
    max-width: 680px;
}
.featured-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 680px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text-muted);
}
.featured-meta time { font-variant-numeric: tabular-nums; }
.read-more { font-weight: 500; color: var(--text); }

/* ---- Article list (index) ----------------------------------------- */
/* 負の水平マージン + 同量の row padding で、ホバー時の背景に息継ぎの
   余白を持たせつつ、テキストの視覚的な位置は container 端に揃える。 */
.article-list {
    border-top: 1px solid var(--rule);
    margin-left: -20px;
    margin-right: -20px;
}
.article-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 20px;
    border-bottom: 1px solid var(--rule);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text);
    transition: background 140ms ease;
}
.article-row:hover { background: var(--bg-soft); }
.article-row:hover .article-title { color: var(--accent-dark); }
.article-text { flex: 1; min-width: 0; }
.article-title {
    font-family: var(--font-sans);
    font-size: 19px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 4px;
    color: var(--text);
    transition: color 160ms ease;
    letter-spacing: -0.005em;
}
.article-subtitle {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14px;
    color: var(--text-subtle);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.article-date {
    flex: 0 0 auto;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---- Breadcrumb ---------------------------------------------------- */
.breadcrumb {
    margin: 0 0 24px;
    font-family: var(--font-sans);
    font-size: 14px;
}
.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 120ms ease;
}
.breadcrumb a:hover { color: var(--text); }

/* ---- Article page (PDF-matching) ---------------------------------- */
/* 記事ページ全体は PDF 版と同じ配色・フォント・装飾にする。
   scripts/style.css の色変数・スタイルをそのまま移植。 */
.article-page {
    max-width: 780px;
    margin: 0 auto;

    --pdf-accent: #c9a961;       /* PDF の --color-accent */
    --pdf-accent-dark: #8a6f3d;  /* PDF の --color-accent-dark */
    --pdf-code-bg: #f4f1ea;      /* PDF の --color-code-bg */
    --pdf-code-border: #e5dcc3;
    --pdf-quote-bg: #faf7f0;
}

/* ---- Article cover (PDF の .cover ページに相当) ------------------- */
.article-cover {
    position: relative;
    padding: 56px 48px 48px;
    margin: 0 0 48px;
    background: linear-gradient(180deg, #f4ede1 0%, #efe6d3 100%);
    border-radius: 6px;
    overflow: hidden;
}
.article-cover::before,
.article-cover::after {
    content: "";
    position: absolute;
    left: 48px;
    right: 48px;
    height: 1px;
    background: var(--pdf-accent-dark);
}
.article-cover::before { top: 22px; }
.article-cover::after  { bottom: 22px; }

.cover-series {
    font-family: var(--font-pdf-original);
    font-size: 11px;
    letter-spacing: 0.25em;
    color: var(--pdf-accent-dark);
    text-transform: uppercase;
    margin: 0 0 18px;
}
.cover-number {
    font-family: "Times New Roman", "Yu Mincho", "Noto Serif JP", serif;
    font-size: 72px;
    line-height: 1;
    color: var(--pdf-accent-dark);
    font-weight: 400;
    margin: 0 0 18px;
}
.cover-title {
    font-family: var(--font-pdf);
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0.02em;
    color: #1a1a1a;
    margin: 0 0 10px;
}
.cover-original {
    font-family: "Times New Roman", "Source Serif 4", "Noto Serif JP", serif;
    font-style: italic;
    font-size: 16px;
    color: #5a5a5a;
    line-height: 1.45;
    margin: 0 0 28px;
}

.cover-meta {
    font-family: var(--font-pdf);
    font-size: 13px;
    color: #5a5a5a;
    line-height: 1.95;
    margin: 0 0 28px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 18px;
}
.cover-meta dt {
    font-weight: 500;
    color: var(--pdf-accent-dark);
}
.cover-meta dd {
    margin: 0;
    word-break: break-word;
}
.cover-meta a {
    color: #5a5a5a;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 140ms ease;
}
.cover-meta a:hover { color: var(--pdf-accent-dark); }

.cover-publisher {
    text-align: center;
    font-family: "Times New Roman", serif;
    font-size: 11px;
    letter-spacing: 0.25em;
    color: var(--pdf-accent-dark);
    margin: 0;
    text-transform: uppercase;
}

/* ---- Article body prose (PDF と同じ見た目) ------------------------ */
/* フォントスタック・色・装飾はすべて PDF 版 (scripts/style.css) と同じ。 */
.article-body {
    font-family: var(--font-pdf);
    font-size: 17px;
    line-height: 1.9;
    color: #1a1a1a;
    font-feature-settings: "palt" 1;
    text-align: justify;
    hanging-punctuation: allow-end;
    word-break: normal;
    overflow-wrap: anywhere;
    line-break: strict;
}
.article-body > :first-child { margin-top: 0; }
.article-body > :last-child { margin-bottom: 0; }

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
    font-family: var(--font-pdf);
    color: #1a1a1a;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0.01em;
    text-align: left;
}

/* h1: PDF の本文先頭 h1 と同じ。gold 下線。 */
.article-body h1 {
    font-size: 28px;
    margin: 0 0 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--pdf-accent);
}
/* h2: PDF と同じ gold 左縦罫 */
.article-body h2 {
    font-size: 22px;
    margin: 40px 0 14px;
    padding-left: 12px;
    border-left: 4px solid var(--pdf-accent);
}
.article-body h3 {
    font-size: 19px;
    margin: 28px 0 10px;
    color: #2a2a2a;
}
.article-body h4 {
    font-size: 17px;
    margin: 20px 0 8px;
    font-weight: 500;
}

.article-body p {
    margin: 0 0 1.1em;
    text-align: justify;
}
.article-body strong { font-weight: 700; color: #1a1a1a; }
.article-body em { font-style: italic; }

.article-body a {
    color: #4a6a9e;  /* PDF の --color-link */
    text-decoration: none;
    border-bottom: 1px dotted #a7b5cc;
    transition: color 140ms ease, border-bottom-color 140ms ease;
}
.article-body a:hover {
    color: var(--pdf-accent-dark);
    border-bottom-color: var(--pdf-accent-dark);
}

.article-body ul, .article-body ol {
    margin: 0 0 1.2em;
    padding-left: 1.8em;
    text-align: left;
}
.article-body li { margin: 0.25em 0; line-height: 1.9; }
.article-body li > p { margin: 0.25em 0; }

.article-body blockquote {
    margin: 1.2em 0;
    padding: 8px 16px 8px 20px;
    background: var(--pdf-quote-bg);
    border-left: 3px solid var(--pdf-accent);
    color: #3a3a3a;
    font-style: normal;
    border-radius: 0 2px 2px 0;
}
.article-body blockquote p { margin: 0.4em 0; text-align: left; }

/* code: PDF と同じ淡クリーム地 */
.article-body code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--pdf-code-bg);
    padding: 0.1em 0.4em;
    border-radius: 2px;
    color: #3a2a00;
}
.article-body pre {
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.55;
    background: var(--pdf-code-bg);
    border: 1px solid var(--pdf-code-border);
    border-radius: 4px;
    padding: 14px 18px;
    margin: 1.4em 0;
    overflow-x: auto;
    color: #1a1a1a;
    text-align: left;
}
.article-body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: inherit;
    border: none;
}

.article-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.4em 0;
    font-size: 14px;
    font-family: var(--font-pdf);
}
.article-body th,
.article-body td {
    border: 1px solid #d8cfb7;  /* PDF と同じ */
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}
.article-body th {
    background: #f4ede1;  /* PDF と同じ */
    font-weight: 600;
}

.article-body hr {
    border: none;
    border-top: 1px solid var(--pdf-accent);
    margin: 2em 0;
}

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

.article-body hr {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 2em 0;
}

/* ---- Article navigation (prev/next) ------------------------------- */
.article-nav {
    max-width: 720px;
    margin: 80px auto 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding-top: 32px;
    border-top: 1px solid var(--rule);
}
.nav-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--bg);
    transition: all 140ms ease;
}
.nav-link:hover {
    background: var(--bg-soft);
    border-color: var(--accent);
}
.nav-link.next { text-align: right; }
.nav-label {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.nav-title {
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
}

/* ---- Footer -------------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--rule);
    padding: 48px 0 64px;
    background: var(--bg-soft);
    margin-top: 80px;
}
.footer-inner { font-family: var(--font-sans); font-size: 14px; color: var(--text-muted); }
.footer-note { line-height: 1.7; margin: 0 0 16px; max-width: 680px; }
.footer-links { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.footer-links a { color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.footer-links span { color: var(--text-subtle); }

/* ---- Responsive ---------------------------------------------------- */
@media (max-width: 680px) {
    .container { padding: 0 20px; }
    .header-inner { padding-top: 14px; padding-bottom: 14px; }
    .brand-text em { display: none; }
    .site-nav { gap: 14px; }
    .site-nav a { font-size: 13px; }

    .site-main { padding-top: 32px; }
    .page-intro { padding: 20px 0 16px; }
    .page-stats { font-size: 12px; gap: 12px; }

    .article-list { margin-left: -16px; margin-right: -16px; }
    .article-row { flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px 16px; }
    .article-subtitle { white-space: normal; }

    .article-body { font-size: 16px; }
    .article-body h2 { font-size: 22px; }
    .article-body h3 { font-size: 18px; }

    .article-nav { grid-template-columns: 1fr; }
    .nav-link.next { text-align: left; }
}
