/* JPNote custom styles */

.markdown-editor {
    border: 1px solid #d1d5db;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: #f7faf7;
    border-bottom: 1px solid #d1d5db;
}

.editor-tool {
    border: 1px solid #cdd5cf;
    background: #fff;
    color: #1f2937;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    padding: 8px 12px;
    cursor: pointer;
}

.editor-tool:hover {
    background: #ecfdf3;
    border-color: #86efac;
}

.markdown-editor textarea {
    border: 0 !important;
    border-radius: 0 !important;
    min-height: 320px;
    resize: vertical;
}

.editor-help {
    padding: 0 16px 12px;
}

.editor-cheatsheet {
    white-space: pre-wrap;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    margin-top: 8px;
}

.editor-preview-wrap {
    border-top: 1px solid #e5e7eb;
    background: #fcfcfb;
}

.editor-preview-header {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #4b5563;
    text-transform: uppercase;
    border-bottom: 1px solid #e5e7eb;
}

.editor-preview {
    padding: 16px;
    min-height: 120px;
}

.article-body,
.editor-preview {
    color: #1f2937;
    font-size: 17px;
    line-height: 1.95;
    word-break: break-word;
}

.article-body > *:first-child,
.editor-preview > *:first-child {
    margin-top: 0;
}

.article-body > *:last-child,
.editor-preview > *:last-child {
    margin-bottom: 0;
}

.article-body p,
.editor-preview p {
    margin: 0 0 1.5em;
}

.article-body h1,
.editor-preview h1,
.article-body h2,
.editor-preview h2,
.article-body h3,
.editor-preview h3,
.article-body h4,
.editor-preview h4 {
    color: #111827;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: -0.02em;
    margin: 2.2em 0 0.8em;
}

.article-body h1,
.editor-preview h1 {
    font-size: 2rem;
}

.article-body h2,
.editor-preview h2 {
    font-size: 1.55rem;
    padding-bottom: 0.35em;
    border-bottom: 1px solid #d1d5db;
}

.article-body h3,
.editor-preview h3 {
    font-size: 1.25rem;
}

.article-body h4,
.editor-preview h4 {
    font-size: 1.05rem;
}

.article-body strong,
.editor-preview strong {
    color: #111827;
    font-weight: 800;
}

.article-body em,
.editor-preview em {
    font-style: italic;
}

.article-body ul,
.editor-preview ul,
.article-body ol,
.editor-preview ol {
    margin: 0;
    padding: 0 0 0 1.2em;
}

.article-body ul,
.editor-preview ul {
    list-style: disc outside;
}

.article-body ol,
.editor-preview ol {
    list-style: decimal outside;
}

.article-body li,
.editor-preview li {
    margin-bottom: 0.55em;
    padding-left: 0.25em;
}

.article-body li::marker,
.editor-preview li::marker {
    color: #64748b;
}

.article-body li > ul,
.editor-preview li > ul {
    list-style: circle outside;
}

/* 固定ページ (.prose) のリストも Tailwind preflight でリセットされるので復活 */
.prose ul {
    list-style: disc outside;
    padding-left: 1.5em;
    margin: 0;
}

.prose ol {
    list-style: decimal outside;
    padding-left: 1.5em;
    margin: 0;
}

.prose li {
    margin-bottom: 0.4em;
}

.prose li::marker {
    color: #64748b;
}

.article-body li > ul,
.editor-preview li > ul,
.article-body li > ol,
.editor-preview li > ol {
    margin-top: 0.6em;
    margin-bottom: 0.6em;
}

.article-body blockquote,
.editor-preview blockquote {
    margin: 1.8em 0;
    padding: 0.25em 0 0.25em 1.1em;
    border-left: 4px solid #86efac;
    color: #374151;
    background: linear-gradient(90deg, rgba(236, 253, 243, 0.9), rgba(236, 253, 243, 0));
}

.article-body hr,
.editor-preview hr {
    border: 0;
    border-top: 1px solid #d1d5db;
    margin: 2.2em 0;
}

.article-body a,
.editor-preview a {
    color: #0f766e;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.article-body img,
.editor-preview img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.8em auto;
    border-radius: 16px;
}

.article-body code,
.editor-preview code {
    background: #f3f4f6;
    border-radius: 6px;
    padding: 0.15em 0.4em;
    font-size: 0.92em;
}

.article-body pre,
.editor-preview pre {
    overflow-x: auto;
    background: #111827;
    color: #f9fafb;
    border-radius: 16px;
    padding: 16px 18px;
    margin: 1.8em 0;
    line-height: 1.7;
}

.article-body pre code,
.editor-preview pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.article-page {
    background: #f9fafb;
}

.article-page__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 16px 24px;
}

.article-main {
    min-width: 0;
}

.article-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    color: #6b7280;
    font-size: 13px;
}

.article-breadcrumb a {
    color: #0f766e;
}

.article-hero {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
}

.article-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

.article-meta-row span,
.article-category {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    background: #f1f5f9;
    padding: 5px 10px;
    color: #475569;
}

.article-category {
    background: #ecfdf5;
    color: #047857;
}

.article-hero h1 {
    margin: 0 0 16px;
    color: #111827;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 850;
    line-height: 1.25;
}

.article-byline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    color: #6b7280;
    font-size: 13px;
}

.article-lead {
    margin: 24px 0 0;
    color: #374151;
    font-size: 17px;
    line-height: 1.9;
}

.article-eyecatch {
    display: block;
    width: 100%;
    max-height: 440px;
    object-fit: cover;
    margin-top: 24px;
    border-radius: 8px;
}

.article-editor-actions {
    display: flex;
    gap: 12px;
    margin: 18px 0;
    color: #2563eb;
    font-size: 14px;
}

.article-editor-actions a:last-of-type {
    color: #dc2626;
}

.article-editor-actions span {
    color: #92400e;
}

.article-brief {
    margin-top: 20px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #eff6ff;
    padding: 20px;
}

.article-brief h2 {
    margin: 0 0 12px;
    color: #1e3a8a;
    font-size: 18px;
    font-weight: 800;
}

.article-brief ul {
    margin: 0;
    padding-left: 1.2em;
    color: #1f2937;
    line-height: 1.8;
}

.article-toc {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    padding: 18px;
}

.article-toc--mobile {
    margin-top: 20px;
}

.article-toc p,
.sidebar-related h2 {
    margin: 0 0 12px;
    color: #111827;
    font-size: 15px;
    font-weight: 800;
}

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

.article-toc li + li {
    margin-top: 10px;
}

.article-toc a {
    color: #475569;
    font-size: 13px;
    line-height: 1.5;
}

.article-toc a:hover {
    color: #0f766e;
}

.article-toc__child {
    padding-left: 14px;
}

.article-body {
    margin-top: 28px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    padding: 24px;
}

.article-body h2 {
    scroll-margin-top: 24px;
}

.article-body h3 {
    scroll-margin-top: 24px;
}

.article-body table,
.editor-preview table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 1.8em 0;
}

.article-body th,
.article-body td,
.editor-preview th,
.editor-preview td {
    border: 1px solid #d1d5db;
    padding: 10px 12px;
    vertical-align: top;
}

.article-body th,
.editor-preview th {
    background: #f8fafc;
    color: #111827;
    font-weight: 800;
}

.article-body img {
    border: 1px solid #e5e7eb;
}

.affiliate-cta {
    display: grid;
    gap: 16px;
    margin-top: 28px;
    border: 1px solid #99f6e4;
    border-radius: 8px;
    background: #f0fdfa;
    padding: 24px;
    box-shadow: inset 4px 0 0 #14b8a6;
}

.affiliate-cta__eyebrow {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.affiliate-cta__eyebrow span {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    background: #ccfbf1;
    padding: 4px 9px;
    color: #0f766e;
    font-size: 12px;
    font-weight: 850;
}

.affiliate-cta__body {
    min-width: 0;
}

.affiliate-cta__product {
    margin: 0 0 6px;
    color: #0f766e;
    font-size: 13px;
    font-weight: 800;
}

.affiliate-cta h2 {
    margin: 0 0 10px;
    color: #111827;
    font-size: 24px;
    font-weight: 850;
    line-height: 1.35;
}

.affiliate-cta p {
    color: #374151;
    line-height: 1.8;
}

.article-body--after-cta {
    margin-top: 0;
    border-top-color: #ccfbf1;
}

.affiliate-cta__note {
    margin: 12px 0 0;
    color: #6b7280 !important;
    font-size: 13px;
}

.affiliate-cta__button,
.sidebar-cta a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border-radius: 8px;
    background: #059669;
    padding: 12px 18px;
    color: #fff;
    font-weight: 800;
    text-align: center;
}

.affiliate-cta__button:hover,
.sidebar-cta a:hover {
    background: #047857;
}

.article-share {
    margin-top: 24px;
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
}

.article-share a {
    color: #64748b;
    font-size: 14px;
}

.article-sidebar {
    display: none;
}

.sidebar-cta,
.sidebar-related {
    margin-top: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    padding: 16px;
}

.sidebar-cta p {
    margin: 0 0 12px;
    color: #111827;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.5;
}

.sidebar-cta a {
    width: 100%;
    min-height: 42px;
    font-size: 13px;
}

.sidebar-related a {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    border-top: 1px solid #e5e7eb;
    padding: 12px 0;
}

.sidebar-related img {
    width: 72px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    background: #f1f5f9;
}

.sidebar-related span,
.related-card span {
    display: block;
    margin-bottom: 4px;
    color: #0f766e;
    font-size: 12px;
    font-weight: 800;
}

.sidebar-related strong {
    display: block;
    color: #111827;
    font-size: 13px;
    line-height: 1.55;
}

.related-section {
    background: #f9fafb;
}

.related-section__inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 12px 16px 56px;
}

.related-section h2 {
    margin: 0 0 18px;
    color: #111827;
    font-size: 22px;
    font-weight: 850;
}

.related-section__lead {
    max-width: 760px;
    margin: -6px 0 20px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.8;
}

.related-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.related-card {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 14px;
    min-height: 144px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    overflow: hidden;
}

.related-card:hover {
    border-color: #a7f3d0;
}

.related-card h3 {
    margin: 0 0 12px;
    color: #111827;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.55;
}

.related-card__thumb {
    min-height: 96px;
    overflow: hidden;
    border-radius: 8px;
    background: #f1f5f9;
}

.related-card__thumb img {
    width: 100%;
    height: 100%;
    min-height: 96px;
    object-fit: cover;
    transition: transform 0.18s ease;
}

.related-card:hover .related-card__thumb img {
    transform: scale(1.03);
}

.related-card__fallback {
    display: grid;
    min-height: 96px;
    place-items: center;
    padding: 10px;
    color: #0f766e;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.related-card__body {
    min-width: 0;
}

.related-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.related-card__meta span {
    display: inline-flex;
    margin: 0;
    border-radius: 999px;
    background: #ecfdf5;
    padding: 3px 8px;
}

.related-card__summary {
    margin: -4px 0 10px;
    color: #475569;
    font-size: 13px;
    line-height: 1.65;
}

.related-card__date {
    color: #94a3b8;
    font-size: 13px;
}

.related-section__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.related-section__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 999px;
    background: #0f766e;
    padding: 10px 16px;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
}

.related-section__button--sub {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
}

.related-section--affiliate {
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

@media (min-width: 768px) {
    .affiliate-cta {
        grid-template-columns: minmax(0, 1fr) 240px;
        align-items: center;
    }

    .affiliate-cta__eyebrow {
        grid-column: 1 / -1;
    }

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

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

    .related-grid--compact .related-card {
        display: block;
    }

    .related-grid--compact .related-card__thumb {
        margin-bottom: 12px;
    }
}

@media (min-width: 1024px) {
    .article-page__inner {
        grid-template-columns: minmax(0, 760px) 300px;
        align-items: start;
        padding-top: 44px;
    }

    .article-sidebar {
        position: sticky;
        top: 24px;
        display: block;
    }

    .article-toc--mobile {
        display: none;
    }
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
