/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    background: #f8f6f0;
    color: #2c2c2c;
    line-height: 1.7;
    min-height: 100vh;
}

/* === Layout === */
.page-wrapper {
    max-width: 880px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    background: #fffcf8;
    padding: 2.5rem 2.8rem;
    border-radius: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.03);
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
    color: #2a2520;
    font-weight: 600;
    line-height: 1.3;
    margin-top: 1.8em;
    margin-bottom: 0.6em;
}

h1 { font-size: 1.8rem; border-bottom: 2px solid #e8e2d8; padding-bottom: 0.4em; margin-top: 0.2em; }
h2 { font-size: 1.4rem; border-bottom: 1px solid #ece7e0; padding-bottom: 0.3em; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.1rem; font-weight: 500; }
h5, h6 { font-size: 1rem; font-weight: 500; color: #6b5e53; }

p {
    margin-bottom: 1.2em;
    color: #3a3530;
}

a {
    color: #7ba4a8;
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: #5a8a8f;
    text-decoration: underline;
}

/* === Code === */
code {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.88em;
    background: #f0ede8;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    color: #4a3f38;
}

pre {
    background: #f0ede8;
    padding: 1.2rem;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 1.2em;
    border: 1px solid #e6dfd6;
}

pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

/* === Blockquotes === */
blockquote {
    border-left: 3px solid #d4a373;
    padding: 0.6em 1em;
    margin: 1em 0;
    background: #faf6f0;
    border-radius: 0 8px 8px 0;
    color: #5a4f45;
}

blockquote p {
    margin-bottom: 0.3em;
}

/* === Lists === */
ul, ol {
    margin: 0.6em 0 1.2em 1.8em;
}

li {
    margin-bottom: 0.3em;
}

/* === Images === */
img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 1.2em auto;
    border: 1px solid #ece7e0;
}

/* Adjacent images - stacked vertically, same size, seamless */
p img:has(+ img) {
    margin-bottom: 0;
}
p img + img {
    display: block;
    margin-top: 0;
}

.image-group {
    margin: 1.2em 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ece7e0;
}

.image-group img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    border: none;
    border-radius: 0;
}

.image-group img + img {
    border-top: none;
}

/* === Tables === */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
    font-size: 0.92rem;
}

th, td {
    padding: 0.55em 0.8em;
    border: 1px solid #e6dfd6;
    text-align: left;
}

th {
    background: #f5f0ea;
    font-weight: 600;
    color: #3a3530;
}

tr:nth-child(even) td {
    background: #faf8f5;
}

/* === Horizontal rule === */
hr {
    border: none;
    border-top: 1px solid #e6dfd6;
    margin: 2em 0;
}

/* === "Click here" detail links === */
.content p a[href$=".html"] {
    font-weight: 600;
    color: #5a8a8f;
}

p a[href$=".html"]:hover {
    color: #3d6b70;
}

/* === Navigation === */
.top-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
    padding: 0.6rem 0;
}

.back-link {
    font-size: 0.92rem;
    color: #8a7a6a;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.back-link:hover {
    color: #7ba4a8;
}

.nav-title {
    font-size: 0.92rem;
    color: #8a7a6a;
    margin-left: auto;
    font-weight: 500;
}

.bottom-nav {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #ece7e0;
}

/* === Footer === */
.page-footer {
    text-align: center;
    padding: 1.5rem 0 0.5rem;
    font-size: 0.82rem;
    color: #a89a8a;
}

.page-footer p {
    color: #a89a8a;
    margin-bottom: 0;
}

/* === Disclaimer banner === */
.disclaimer {
    background: #faf6f0;
    border: 1px solid #e6dfd6;
    border-radius: 10px;
    padding: 0.8rem 1.2rem;
    font-size: 0.88rem;
    color: #6b5e53;
    margin-bottom: 2rem;
    text-align: center;
}

/* === TOC === */
.toc {
    background: #faf8f5;
    border: 1px solid #ece7e0;
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 2rem;
}

.toc h2 {
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 0.6em;
    border: none;
    color: #5a4f45;
}

.toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc li {
    margin-bottom: 0.25em;
    font-size: 0.92rem;
}

.toc a {
    color: #6b5e53;
    display: inline-block;
    padding: 0.15em 0;
}

.toc a:hover {
    color: #7ba4a8;
    text-decoration: none;
}

.toc .toc-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toc .toc-num {
    color: #b5a798;
    font-weight: 500;
    min-width: 1.8em;
}

.toc .external-link {
    font-size: 0.75rem;
    color: #b5a798;
    margin-left: auto;
}

/* === Detail link === */
.detail-link {
    display: inline-block;
    margin: 1em 0 1.5em;
    font-size: 0.92rem;
}

.detail-link a {
    color: #8a7a6a;
    background: #faf8f5;
    padding: 0.3em 0.8em;
    border-radius: 6px;
    border: 1px solid #ece7e0;
    transition: all 0.15s;
}

.detail-link a:hover {
    color: #5a8a8f;
    border-color: #7ba4a8;
    background: #f0f5f5;
    text-decoration: none;
}

/* === Strong emphasis === */
strong {
    font-weight: 600;
    color: #2a2520;
}

/* === Small text === */
small, .small {
    font-size: 0.85rem;
    color: #8a7a6a;
}

/* === Animations === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.content {
    animation: fadeIn 0.35s ease-out;
}

/* === Responsive === */
@media (max-width: 640px) {
    .page-wrapper {
        padding: 1rem 0.8rem;
    }
    .content {
        padding: 1.5rem 1.2rem;
        border-radius: 10px;
    }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.2rem; }
    .image-group {
        flex-direction: column;
    }
}

/* === Print === */
@media print {
    body { background: white; }
    .content { box-shadow: none; padding: 0; }
    .top-nav, .bottom-nav, .page-footer { display: none; }
}
