/* Base Reset and Variables */
:root {
    --bg-color: #f8f9fa;
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --accent-blue: #0f52ba; /* Sapphire Blue accent */
    --accent-blue-hover: #0b3d8c;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --font-heading: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Hiragino Sans', 'Noto Sans CJK JP', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Hiragino Kaku Gothic ProN', 'Noto Sans CJK JP', sans-serif;
}
p {
    margin: 0;
}
p + p {
    margin-top: 2rem;
}

h1 {
    margin-bottom: 0;
}

a:link,a:visited {
	text-decoration: none;
	color: var(--accent-blue);
}
a:hover,a:active {
	text-decoration: underline;
	color: var(--accent-blue-hover);
}

h1 a:link, h1 a:visited {
    color: var(--text-primary);

}
body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Header Masthead */
#blog-title {
    background: var(--card-bg);
    border-bottom: 4px solid var(--accent-blue);
    padding: 3.5rem 0;
    text-align: center;
    box-shadow: 0 4px 30px rgba(0,0,0,0.03);
}

@media (max-width: 1024px) {
    #blog-title {
        padding: 2rem 0;
    }
}

#blog-title-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

#title {
    margin: 0;
}

#title a {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 3.5rem;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -2px;
    text-transform: uppercase;
}

#blog-description {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Layout Core */
#content {
    max-width: 1240px;
    margin: 48px auto;
    padding: 0 24px;
}

/* --- Top Page Magazine Layout --- */
.page-index .archive-entries {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 32px;
}
@media (max-width: 600px) {
    .page-index .archive-entries {
        gap: 32px 16px;
    }
}

.page-index .archive-entry {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.page-index .archive-entry:hover {
    box-shadow: 0 16px 32px rgba(15, 82, 186, 0.1);
}

/* 1st Article: Hero Layout (Spans all columns) */
.page-index .archive-entry:nth-child(1) {
    grid-column: span 12;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3,min-content);
    /* flex-direction: row; */
    align-items: stretch;
    /* min-height: 480px; */
}
.page-index .archive-entry:nth-child(1) .entry-thumb-link {
    flex: 0 0 60%;
    /* order: 1; */ /* Image on right, text on left for visual interest */
    grid-row: 1 / 5;
    grid-column: 1 / 2;
}
.page-index .archive-entry:nth-child(1) .entry-thumb {
    height: 100%;
    background-size: contain;
    background-position: center;
}
.page-index .archive-entry:nth-child(1) .archive-entry-header,
.page-index .archive-entry:nth-child(1) .archive-entry-body,
.page-index .archive-entry:nth-child(1) .categories {
    order: 1;
    padding: 32px 24px;
}
.page-index .archive-entry:nth-child(1) .archive-entry-header {
    padding-bottom: 0;
}
.page-index .archive-entry:nth-child(1) .entry-title {
    font-size: 2.2rem;
    line-height: 1.35;
    margin-top: 16px;
}
.page-index .archive-entry:nth-child(1) .entry-description {
    font-size: 1.1rem;
    -webkit-line-clamp: 4;
}

/* 2nd & 3rd Articles: Half width */
.page-index .archive-entry:nth-child(2),
.page-index .archive-entry:nth-child(3) {
    grid-column: span 6;
}
.page-index .archive-entry:nth-child(2) .entry-thumb-link,
.page-index .archive-entry:nth-child(3) .entry-thumb-link {
    order: 1;
}
.page-index .archive-entry:nth-child(2) .entry-thumb,
.page-index .archive-entry:nth-child(3) .entry-thumb {
    height: 300px;
}
.page-index .archive-entry:nth-child(2) .archive-entry-header,
.page-index .archive-entry:nth-child(3) .archive-entry-header {
    order: 2;
}
.page-index .archive-entry:nth-child(2) .categories,
.page-index .archive-entry:nth-child(3) .categories {
    order: 3;
}
.page-index .archive-entry:nth-child(2) .archive-entry-body,
.page-index .archive-entry:nth-child(3) .archive-entry-body {
    order: 4;
}
.page-index .archive-entry:nth-child(2) .entry-title,
.page-index .archive-entry:nth-child(3) .entry-title {
    font-size: 1.6rem;
}

/* 4th+ Articles: One-Third width */
.page-index .archive-entry:nth-child(n+4) {
    grid-column: span 4;
}
.page-index .archive-entry:nth-child(n+4) .entry-thumb {
    height: 180px;
}

/* Thumbnails */
.entry-thumb.entry-thumb.entry-thumb {
    background-size: contain;
    background-position: center;
    width: 100%;
    background-color: #f1f5f9;
}

/* Typography & Spacing inside Cards */
.archive-entry-header {
    padding: 24px 24px 0;
}

.archive-date time {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.entry-title {
    margin: 12px 0;
    font-size: 1.4rem;
    font-family: var(--font-heading);
    font-weight: 800;
    line-height: 1.4;
}

.entry-title-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.entry-title-link:hover {
    color: var(--accent-blue);
}

.categories.categories.categories.categories.categories {
    padding: 0 24px;
    margin: 8px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.archive-category-link, .entry-category-link {
    background: #eff6ff;
    color: var(--accent-blue);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
}

.archive-category-link:hover, .entry-category-link:hover {
    background: var(--accent-blue);
    color: #fff;
    box-shadow: 0 2px 6px rgba(15, 82, 186, 0.3);
}

.archive-entry-body.archive-entry-body.archive-entry-body.archive-entry-body.archive-entry-body {
    padding: 0 24px 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.entry-description {
    color: var(--text-muted);
    /* display: -webkit-box; */
    /* -webkit-box-orient: vertical; */
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 16px;
    margin-top: 16px;
    /* flex-grow: 1; */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3; /* Ã¢â€ Â Ã¨Â¡Å’Ã¦â€¢Â° */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tags */
.archive-entry-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    /* margin-bottom: 20px; */
}

.archive-entry-tag-link.archive-entry-tag-link {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    background: #f1f5f9;
    padding: 4px 16px;
    margin: 0;
    border-radius: 50px;
    transition: background 0.2s, color 0.2s;
}

.archive-entry-tag-link:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

/* Social Buttons */
.social-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

/* --- Detail Page Styling --- */
.page-entry #content {
    max-width: 900px;
}

.breadcrumb {
    max-width: 900px;
    margin: 32px auto 0;
    padding: 0 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}
.breadcrumb a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s;
}
.breadcrumb a:hover {
    text-decoration: underline;
}
.breadcrumb-gt {
    margin: 0 10px;
    color: #cbd5e1;
}

.entry-inner {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 40px 60px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.02);
    margin-top: 24px;
    border: 1px solid var(--border-color);
}

@media (max-width: 600px) {

.entry-inner {
    padding: 30px 30px;
}
}

.page-entry .entry-header {
    margin-bottom: 48px;
    text-align: center;
}

.page-entry .entry-date {
    display: inline-block;
    background: var(--accent-blue);
    color: #fff;
    padding: 6px 20px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(15, 82, 186, 0.2);
}
.page-entry .entry-date a {
    color: #fff;
    text-decoration: none;
}

.page-entry .entry-title {
    font-size: 2.2rem;
    font-family: var(--font-heading);
    font-weight: 900;
    line-height: 1.35;
    margin-bottom: 24px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-entry .entry-categories {
    justify-content: center;
}

/* Detail Content Typography */
.entry-content {
    font-size: 1.1rem;
    line-height: 1.85;
    color: #334155;
    letter-spacing: 0.02em;
}

.entry-content h2 {
    font-size: 1.75rem;
    font-family: var(--font-heading);
    font-weight: 800;
    color: var(--text-primary);
    margin: 56px 0 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    position: relative;
    letter-spacing: -0.5px;
}

.entry-content h2::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--accent-blue);
}

.entry-content h3 {
    font-size: 1.35rem;
    font-family: var(--font-heading);
    font-weight: 800;
    margin: 48px 0 20px;
    color: var(--text-primary);
    padding-left: 16px;
    border-left: 5px solid var(--accent-blue);
}

.entry-content p {
    margin-bottom: 28px;
}

.entry-content ul, .entry-content ol {
    margin-bottom: 28px;
    padding-left: 24px;
}
.entry-content li {
    margin-bottom: 10px;
}

.entry-content pre.code {
    background: #0f172a;
    color: #f8fafc;
    padding: 24px;
    border-radius: 12px;
    overflow-x: auto;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 32px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    position: relative;
}

.entry-content pre.code::before {
    content: '';
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 20px 0 0 #f59e0b, 40px 0 0 #10b981;
    margin-bottom: 16px;
}

.entry-content blockquote {
    margin: 0 0 32px;
    padding: 20px 32px;
    border-left: 4px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    font-style: italic;
    border-radius: 0 12px 12px 0;
}

.entry-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}
.entry-content th, .entry-content td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    text-align: left;
}
.entry-content th:last-child, .entry-content td:last-child {
    border-right: none;
}
.entry-content tr:last-child td {
    border-bottom: none;
}
.entry-content th {
    background: #f8fafc;
    font-weight: 800;
    color: var(--text-primary);
}

.entry-content a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
    background: linear-gradient(transparent 85%, rgba(15, 82, 186, 0.2) 85%);
    transition: background 0.2s;
}

.entry-content a:hover {
    background: linear-gradient(transparent 85%, rgba(15, 82, 186, 0.4) 85%);
}

.entry-content strong {
    color: var(--text-primary);
    font-weight: 800;
    background: linear-gradient(transparent 70%, rgba(15, 82, 186, 0.15) 70%);
}

.entry-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 32px 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    display: block;
}

/* Scrollbar Enhancement */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Sidebar Hub (Box2) Styling --- */
#box2 {
    max-width: 1240px;
    margin: 64px auto 80px;
    padding: 0 24px;
    position: relative;
    z-index: 10;
}
@media (max-width: 600px) {
#box2 {

    padding: 0;


}}



.page-entry #box2 {
    max-width: 900px; /* Match detail page width */
}

#box2::before {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color) 20%, var(--border-color) 80%, transparent);
    margin-bottom: 64px;
}

#box2-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
}

/* Individual Sidebar Modules */
.hatena-module {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.03);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hatena-module:hover {
    box-shadow: 0 16px 32px rgba(15, 82, 186, 0.1);
}

.hatena-module-title {
    font-size: 1.15rem;
    font-family: var(--font-heading);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    position: relative;
    letter-spacing: 0.5px;
}

.hatena-module-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--accent-blue);
}

.hatena-module-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.hatena-module-title a:hover {
    color: var(--accent-blue);
}

/* Module Body General */
.hatena-module-body ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Recent Entries Module */
.recent-entries-item {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border-color);
}
.recent-entries-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.recent-entries-title-link {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.5;
    text-decoration: none;
    display: block;
    transition: color 0.2s;
}
.recent-entries-title-link:hover {
    color: var(--accent-blue);
}

/* Category Module */
.hatena-module-category ul {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.hatena-module-category li {
    margin: 0;
}
.hatena-module-category a {
    color: var(--accent-blue);
    background: #eff6ff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}
.hatena-module-category a:hover {
    background: var(--accent-blue);
    color: #fff;
    box-shadow: 0 2px 8px rgba(15, 82, 186, 0.3);
}

/* Archive Module */
.archive-module-year {
    position: relative;
    
}
.archive-module-button > span {
    position:absolute;
    left: 8px;
    top: 8px;
}
.hatena-module-archive .archive-module-year-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    margin-bottom: 8px;
    padding: 8px 12px 8px 30px;
    background: #f8fafc;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}
.hatena-module-archive .archive-module-year-title:hover {
    background: #f1f5f9;
    color: var(--accent-blue);
}
.archive-module-months {
    padding-left: 12px;
    margin-bottom: 16px;
}
.archive-module-month-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    display: block;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}
.archive-module-month-title:hover {
    color: var(--accent-blue);
    background: #eff6ff;
}
.archive-module-button {
    display: none;
}

/* Banners Module */
.hatena-module-html img {
    max-width: 100%;
    border-radius: 8px;
    transition: opacity 0.2s;
    display: block;
}
.hatena-module-html a:hover img {
    opacity: 0.85;
}

.permalink {
    padding: 20px 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: min-content;
    
}

.hatena-module-related-entries .related-entries-item + .related-entries-item{
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd
}
.hatena-module-related-entries .related-entries-item .related-entries-item-inner {
    display: grid;
    grid-template-columns: 100px 1fr;
    grid-template-rows: auto auto auto auto;
    gap: 0 16px;
}
.related-entries-image-link {
    grid-row: 1 / -1;
    /* grid-column: 1 / 3; */
}

.hatena-module-related-entries .related-entries-item .urllist-image {
    float: none;
    margin: 0;
}
.hatena-module-related-entries .related-entries-item .related-entries-title {
    font-weight: 700;
    line-height: 1.4;
}

@media (max-width: 600px) {
    .hatena-module-related-entries .related-entries-item .related-entries-item-inner {
            grid-template-columns: 80px 1fr;

    }
    .hatena-module {
    padding: 16px;
    }
}

.pager {
margin-top: 20px;
}
.pager > span {
    display: block;
}
.pager-next {
    grid-column: 2 / 3;
    text-align: right;
}
@media (max-width: 600px) {
    .pager {
        display: block;
    }
    .pager-next {
    
    }
}

input[type="text"] {
    padding: 2px;
    font-size: 14px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .page-index .archive-entry:nth-child(1) .archive-entry-header,
    .page-index .archive-entry:nth-child(1) .archive-entry-body {
        padding: 12px 32px;
    }    .page-index .archive-entry:nth-child(1) .categories {
        padding: 0px 32px;
    }

    .page-index .archive-entry:nth-child(1) .entry-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 900px) {
    #content {
        padding: 0 12px;
    }
    .page-index .archive-entry:nth-child(1) {
        flex-direction: column;
        min-height: auto;
        grid-template-columns: 1fr;
    }
    .page-index .archive-entry:nth-child(1) .entry-thumb-link {
        flex: auto;
        height: 200px;
        order: 1; /* Set image on top */
    }
    .page-index .archive-entry:nth-child(1) .archive-entry-header,
    .page-index .archive-entry:nth-child(1) .archive-entry-body,
    .page-index .archive-entry:nth-child(1) .categories {
        order: 2;
        padding: 16px;
    }
    
    .page-index .archive-entry:nth-child(2),
    .page-index .archive-entry:nth-child(3),
    .page-index .archive-entry:nth-child(n+4) {
        grid-column: span 12;
    }
    .page-index .archive-entry:nth-child(2) .entry-thumb,
    .page-index .archive-entry:nth-child(3) .entry-thumb,
    .page-index .archive-entry:nth-child(n+4) .entry-thumb {
        height: 240px;
    }
    .page-entry .entry-inner {
        padding: 40px 32px;
    }
    .page-entry .entry-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 600px) {
    #title a {
        font-size: 2.5rem;
    }
    .page-entry .entry-inner {
        padding: 32px 20px;
        border-radius: 8px;
        margin-top: 16px;
    }
    .page-entry .entry-title {
        font-size: 1.8rem;
    }
    .entry-content pre.code {
        padding: 16px;
        font-size: 0.85rem;
    }
    .entry-content h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 600px) {
.hatena-asin-detail {
    flex-direction: column;
    
}
.hatena-asin-detail .hatena-asin-detail-info {
    margin: 10px auto auto;
}
}


.page-entry div.hatenablog-entry {
  display: flex;
  flex-direction: column;
}

.page-entry div.hatenablog-entry p:nth-last-child(1) {
  order: -1; /* 一番上 */
  margin: 10px 0;
}

.page-entry div.hatenablog-entry p:nth-last-child(2) {
  order: -2; /* 2番目 */
  margin: 0;
}