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

:root {
    --paper: #f7f3eb;
    --ink: #11100f;
    --blue: #2f4059;
    --muted: #5f5a50;
    --line: rgba(17, 16, 15, 0.36);
    --soft-line: rgba(17, 16, 15, 0.13);
    --sage: #61705e;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--ink);
    font-family: "Cormorant Garamond", Georgia, serif;
    background:
        repeating-linear-gradient(0deg, rgba(17, 16, 15, 0.02) 0 1px, transparent 1px 12px),
        radial-gradient(circle at 82% 12%, rgba(97, 112, 94, 0.12), transparent 30%),
        var(--paper);
}

a {
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

.article-page {
    width: min(1440px, calc(100% - 40px));
    margin: 0 auto;
    padding: 18px 0 36px;
}

.paper-header {
    position: relative;
    padding: 12px 0 30px;
    text-align: center;
    border-bottom: 4px double var(--ink);
}

.back-btn {
    position: absolute;
    left: 0;
    top: 14px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    padding: 0 16px;
    color: var(--ink);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--ink);
    font-family: "Cinzel", serif;
    font-size: 0.82rem;
    font-weight: 900;
    box-shadow: 5px 5px 0 rgba(17, 16, 15, 0.16);
}

.paper-kicker,
.section-label,
.toc,
.related-posts,
.article-note,
.detail-footer,
.detail-code-strip {
    font-family: "Cinzel", serif;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.paper-kicker {
    display: inline-block;
    padding: 4px 18px;
    color: var(--muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.paper-header h1 {
    margin-top: 20px;
    font-family: "Playfair Display", Didot, Georgia, serif;
    font-size: clamp(3.9rem, 3vw, 8.6rem);
    font-weight: 900;
    line-height: 0.9;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.i-star {
    position: relative;
    display: inline-block;
}

.i-star::after {
    content: "*";
    position: absolute;
    left: 50%;
    top: -0.54em;
    transform: translateX(-50%);
    font-family: "Playfair Display", Georgia, serif;
    font-size: 0.5em;
    line-height: 1;
}

.paper-rule {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    width: min(900px, 80%);
    margin: 5px auto 5px;
}

.paper-rule span {
    height: 1px;
    background: var(--ink);
}

.paper-rule i {
    font-family: Georgia, serif;
    font-size: 1.45rem;
    font-style: normal;
}

.paper-header p {
    color: var(--ink);
    font-size: clamp(1.35rem, 1.3vw, 1.35rem);
    font-style: italic;
    font-weight: 700;
}

.article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 28px;
    padding: 34px 0 30px;
    border-bottom: 4px double var(--ink);
    min-width: 0;
}

.article-card,
.sidebar-card {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.38);
    box-shadow: 7px 7px 0 rgba(17, 16, 15, 0.08);
    min-width: 0;
}

.article-card {
    padding: clamp(20px, 2.7vw, 34px);
}

.intro-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: 24px;
    align-items: stretch;
}

.article-cover {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.42);
    box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.24);
}

.article-cover img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 250px;
    padding: clamp(8px, 1.4vw, 14px);
    object-fit: contain;
}

.lead-column {
    display: grid;
    align-content: center;
    gap: 18px;
}

.drop-lead {
    font-size: clamp(1.2rem, 1.55vw, 1.42rem);
    font-weight: 700;
    line-height: 1.38;
}

.drop-lead::first-letter {
    float: left;
    margin: 0 12px 0 0;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 5.6rem;
    font-weight: 900;
    line-height: 0.76;
}

blockquote {
    padding: 18px 20px;
    border-top: 1px dashed var(--line);
    border-bottom: 1px dashed var(--line);
    font-size: 1.28rem;
    font-style: italic;
    font-weight: 700;
}

blockquote span::before,
blockquote span::after {
    color: var(--blue);
    font-family: Georgia, serif;
    font-size: 2rem;
    line-height: 0;
}

blockquote span::before {
    content: "“";
    margin-right: 8px;
}

blockquote span::after {
    content: "”";
    margin-left: 8px;
}

.note-image-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0 28px;
}

.note-image-grid img {
    display: block;
    width: 100%;
    aspect-ratio: 315 / 112;
    object-fit: contain;
    border: 1px solid var(--soft-line);
    box-shadow: 5px 5px 0 rgba(17, 16, 15, 0.08);
}

.article-card h2 {
    margin: 32px 0 14px;
    padding-bottom: 6px;
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(2rem, 3vw, 3.25rem);
    line-height: 0.98;
    text-transform: uppercase;
    border-bottom: 2px solid var(--ink);
    overflow-wrap: anywhere;
}

.article-card h3 {
    margin-bottom: 7px;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.48rem;
    line-height: 1;
}

.article-card p,
.article-card li {
    font-size: clamp(1.08rem, 1.32vw, 1.2rem);
    line-height: 1.48;
}

.article-card p + p {
    margin-top: 12px;
}

.article-list {
    margin: 0 0 24px 24px;
}

.article-list li {
    margin-bottom: 10px;
}

code {
    padding: 1px 5px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.86em;
    background: rgba(47, 64, 89, 0.08);
    border: 1px solid var(--soft-line);
    overflow-wrap: anywhere;
    word-break: break-word;
}

pre {
    margin: 18px 0 24px;
    padding: 16px 18px;
    max-width: 100%;
    overflow-x: auto;
    color: #f7f3eb;
    background: #11100f;
    border: 1px solid #11100f;
    box-shadow: 5px 5px 0 rgba(17, 16, 15, 0.12);
}

pre code {
    display: block;
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-wrap: normal;
    word-break: normal;
}

.concept-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 20px 0 28px;
}

.concept-list section {
    min-height: 150px;
    padding: 18px;
    border: 1px solid var(--soft-line);
    border-top: 8px solid var(--sage);
    background: rgba(255, 255, 255, 0.52);
}

.archive-section {
    margin-top: 34px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.archive-grid img {
    display: block;
    width: 100%;
    aspect-ratio: 306 / 160;
    object-fit: contain;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.62);
    box-shadow: 4px 4px 0 rgba(17, 16, 15, 0.07);
}

.method-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0 26px;
}

.method-grid section {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--soft-line);
    border-top: 8px solid var(--blue);
    background: rgba(255, 255, 255, 0.52);
}

.method-grid strong {
    font-family: "Cinzel", serif;
    font-size: 1.1rem;
    letter-spacing: 0.08em;
}

.method-grid span {
    font-size: 1.04rem;
    line-height: 1.4;
}

.service-strip {
    margin: 22px 0 30px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.58);
    box-shadow: 4px 4px 0 rgba(17, 16, 15, 0.07);
}

.service-strip img {
    display: block;
    width: 100%;
    max-width: 100%;
    object-fit: contain;
}

.article-note {
    margin-top: 32px;
    padding: 18px;
    color: var(--blue);
    border: 1px dashed var(--line);
    background: rgba(255, 255, 255, 0.36);
    font-family: "Cinzel", serif;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1.65;
    text-transform: uppercase;
}

.article-sidebar {
    display: grid;
    align-content: start;
    gap: 18px;
    position: sticky;
    top: 20px;
}

.sidebar-card {
    padding: 20px;
}

.section-label {
    display: block;
    margin-bottom: 12px;
    color: var(--blue);
    font-size: 0.78rem;
}

.toc {
    display: grid;
    gap: 7px;
    font-size: 0.75rem;
}

.toc a {
    padding: 9px 0;
    color: var(--ink);
    text-decoration: none;
    border-top: 1px solid var(--soft-line);
}

.toc a:hover {
    color: var(--blue);
}

.related-posts {
    display: grid;
    gap: 12px;
    font-family: "Cinzel", serif;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.related-posts a {
    display: grid;
    grid-template-columns: 102px 1fr;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
}

.related-posts img {
    display: block;
    width: 102px;
    height: 74px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid var(--line);
}

.related-posts span {
    padding-top: 8px;
    border-top: 1px solid var(--soft-line);
}

.sidebar-letter p {
    font-size: 1.06rem;
    font-weight: 700;
    line-height: 1.35;
}

.mail-link {
    display: inline-block;
    margin-top: 12px;
    color: var(--blue);
    font-family: "Cinzel", serif;
    font-size: 0.78rem;
    font-weight: 900;
    word-break: break-word;
}

.detail-code-strip {
    display: grid;
    grid-template-columns: 150px 1fr 246px 220px;
    align-items: center;
    gap: 20px;
    margin-top: 28px;
    padding: 16px 20px;
    color: #f7f3eb;
    background: #11100f;
    border: 1px solid #11100f;
    font-family: "Cinzel", serif;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.detail-code-strip img {
    display: block;
    width: 100%;
    object-fit: contain;
    border: 1px solid #ddd1bd;
    border-radius: 5px;
}

.detail-code-strip div {
    display: grid;
    gap: 6px;
    font-size: 0.72rem;
    text-align: left;
}

.detail-code-strip span {
    border-bottom: 1px solid rgba(247, 243, 235, 0.32);
}

.detail-footer {
    padding-top: 22px;
    text-align: center;
    color: rgba(17, 16, 15, 0.58);
    font-family: "Cinzel", serif;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

@media (max-width: 1120px) {
    .article-page {
        width: min(100% - 28px, 940px);
        padding-top: 58px;
    }

    .article-layout {
        grid-template-columns: 1fr;
    }

    .article-sidebar {
        position: static;
        grid-template-columns: 1fr;
    }

    .intro-grid {
        grid-template-columns: 1fr;
    }

    .concept-list,
    .method-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-code-strip {
        grid-template-columns: 140px 1fr 220px;
    }

    .detail-code-strip img:last-child {
        display: none;
    }
}

@media (max-width: 900px) {
    .paper-header h1 {
        font-size: clamp(3.2rem, 10vw, 5.8rem);
    }

    .concept-list,
    .method-grid,
    .archive-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .related-posts {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .related-posts a {
        grid-template-columns: 1fr;
        align-content: start;
    }

    .related-posts img {
        width: 100%;
        height: auto;
        aspect-ratio: 102 / 74;
    }
}

@media (max-width: 760px) {
    .article-page {
        width: min(100% - 22px, 480px);
        padding-top: 62px;
    }

    .paper-header {
        padding-top: 42px;
    }

    .back-btn {
        top: 0;
    }

    .paper-kicker {
        max-width: 260px;
        line-height: 1.5;
    }

    .paper-header h1 {
        font-size: clamp(2.85rem, 13vw, 5rem);
        line-height: 0.9;
    }

    .paper-header p {
        font-size: 1.55rem;
        line-height: 1.1;
    }

    .paper-rule {
        width: 92%;
        gap: 12px;
        margin: 20px auto 18px;
    }

    .article-layout {
        padding: 24px 0;
    }

    .note-image-grid,
    .concept-list,
    .method-grid,
    .article-sidebar,
    .archive-grid,
    .detail-code-strip {
        grid-template-columns: 1fr;
    }

    .article-cover img {
        min-height: 0;
    }

    .detail-code-strip {
        justify-items: center;
        text-align: center;
    }

    .detail-code-strip div {
        text-align: center;
    }

    .detail-code-strip img {
        max-width: 240px;
    }

    .article-card h2 {
        font-size: clamp(1.78rem, 10vw, 2.25rem);
        line-height: 1.04;
    }

    .article-card p,
    .article-card li {
        font-size: 1.02rem;
        line-height: 1.52;
    }

    .related-posts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 540px) {
    .archive-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 430px) {
    .article-page {
        width: calc(100% - 18px);
    }

    .paper-header h1 {
        font-size: clamp(2.45rem, 12vw, 3.25rem);
    }

    .paper-header p {
        font-size: 1.18rem;
    }

    .article-card,
    .sidebar-card {
        box-shadow: 4px 4px 0 rgba(17, 16, 15, 0.08);
    }

    .article-card {
        padding: 16px;
    }

    .article-card h2 {
        font-size: 1.72rem;
    }

    .article-card p,
    .article-card li {
        font-size: 1.04rem;
    }

    .related-posts a {
        grid-template-columns: 76px 1fr;
        gap: 10px;
    }

    .related-posts img {
        width: 76px;
        height: 58px;
    }
}
