/* ============================================================
 * g-page v2 base.css
 * SEO・速度・可読性重視のシンプルブログテーマ
 * ============================================================ */

:root {
    --color-bg: #0e1014;
    --color-bg-elevated: #161a21;
    --color-bg-card: rgba(255, 255, 255, 0.04);
    --color-bg-card-hover: rgba(255, 255, 255, 0.08);
    --color-text: #e6e6e6;
    --color-text-muted: rgba(230, 230, 230, 0.65);
    --color-text-subtle: rgba(230, 230, 230, 0.45);
    --color-accent: #4dabf7;
    --color-accent-hover: #74c0fc;
    --color-border: rgba(255, 255, 255, 0.1);

    --font-sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;

    --max-width: 1100px;
    --max-width-article: 760px;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --space-1: 0.5rem;
    --space-2: 1rem;
    --space-3: 1.5rem;
    --space-4: 2rem;
    --space-5: 3rem;
    --space-6: 4rem;
}

/* ----------------------------------------------------------
 * Reset / Base
 * ---------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.75;
    color: var(--color-text);
    background-color: var(--color-bg);
    word-break: break-word;
    overflow-wrap: anywhere;
}

img, svg, video {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.4;
    font-weight: 700;
    margin: 0 0 var(--space-2);
}

p {
    margin: 0 0 var(--space-2);
}

ul, ol {
    margin: 0 0 var(--space-2);
    padding-left: 1.5em;
}

.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-accent);
    color: #fff;
    padding: 8px;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* ----------------------------------------------------------
 * Layout
 * ---------------------------------------------------------- */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-3) var(--space-2);
}

.container-article {
    max-width: var(--max-width-article);
}

.site-main {
    min-height: 60vh;
}

/* ----------------------------------------------------------
 * Header
 * ---------------------------------------------------------- */
.site-header {
    background-color: var(--color-bg-elevated);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
}

.site-header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-2);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.site-branding {
    margin: 0;
}

.site-title-link {
    color: var(--color-text);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.site-title-link:hover {
    color: var(--color-text);
    text-decoration: none;
}

.site-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.site-tagline {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.2em;
}

.primary-nav .primary-menu {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: var(--space-2);
}

.primary-menu li {
    list-style: none;
}

.primary-menu a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.primary-menu a:hover {
    color: var(--color-accent);
    text-decoration: none;
}

/* ----------------------------------------------------------
 * Hero (top page)
 * ---------------------------------------------------------- */
.hero {
    text-align: center;
    padding: var(--space-5) var(--space-2);
    background: linear-gradient(135deg, rgba(77, 171, 247, 0.1), rgba(77, 171, 247, 0.02));
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
}

.hero-title {
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    margin: 0 0 var(--space-2);
}

.hero-lead {
    color: var(--color-text-muted);
    font-size: clamp(0.9rem, 1.5vw, 1.05rem);
    max-width: 600px;
    margin: 0 auto;
}

/* ----------------------------------------------------------
 * Page Header (archive)
 * ---------------------------------------------------------- */
.page-header {
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.page-eyebrow {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin: 0 0 0.4em;
    letter-spacing: 0.1em;
}

.page-title {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    margin: 0 0 var(--space-2);
}

.page-description {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

/* ----------------------------------------------------------
 * Post Grid (index / archive)
 * ---------------------------------------------------------- */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.post-card {
    background-color: var(--color-bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s, background-color 0.2s;
}

.post-card:hover {
    transform: translateY(-2px);
    background-color: var(--color-bg-card-hover);
}

.post-card-link {
    color: inherit;
    text-decoration: none;
    display: block;
}

.post-card-link:hover {
    color: inherit;
    text-decoration: none;
}

.post-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.3);
}

.post-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-card-thumb-empty {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

.post-card-body {
    padding: var(--space-2);
}

.post-card-category {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--color-accent);
    margin-bottom: 0.4em;
    letter-spacing: 0.05em;
}

.post-card-title {
    font-size: 1.05rem;
    margin: 0 0 0.5em;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-excerpt {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin: 0 0 0.6em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-date {
    font-size: 0.75rem;
    color: var(--color-text-subtle);
}

.no-posts {
    text-align: center;
    color: var(--color-text-muted);
    padding: var(--space-5);
}

/* ----------------------------------------------------------
 * Pagination
 * ---------------------------------------------------------- */
.pagination {
    margin-top: var(--space-4);
}

.pagination .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    justify-content: center;
}

.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5em;
    height: 2.5em;
    padding: 0 0.8em;
    border-radius: var(--radius-sm);
    background-color: var(--color-bg-card);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
}

.pagination .page-numbers.current {
    background-color: var(--color-accent);
    color: #fff;
}

.pagination .page-numbers:hover:not(.current) {
    background-color: var(--color-bg-card-hover);
    text-decoration: none;
}

/* ----------------------------------------------------------
 * Breadcrumb
 * ---------------------------------------------------------- */
.breadcrumb {
    font-size: 0.85rem;
    margin-bottom: var(--space-3);
    color: var(--color-text-muted);
}

.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin: 0;
    padding: 0;
    list-style: none;
}

.breadcrumb li {
    display: inline-flex;
    align-items: center;
}

.breadcrumb li + li::before {
    content: "›";
    margin-right: 0.5em;
    color: var(--color-text-subtle);
}

.breadcrumb a {
    color: var(--color-text-muted);
}

.breadcrumb li[aria-current="page"] {
    color: var(--color-text-subtle);
}

/* ----------------------------------------------------------
 * Article (single.php)
 * ---------------------------------------------------------- */
.article {
    margin-bottom: var(--space-5);
}

.article-header {
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.article-category {
    margin: 0 0 0.5em;
    font-size: 0.85rem;
}

.article-category a {
    color: var(--color-accent);
    text-decoration: none;
    letter-spacing: 0.05em;
}

.article-title {
    font-size: clamp(1.5rem, 3.5vw, 2.2rem);
    line-height: 1.4;
    margin: 0 0 var(--space-2);
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.article-hero {
    margin: var(--space-3) calc(-1 * var(--space-2));
    border-radius: var(--radius-md);
    overflow: hidden;
}

.article-hero img {
    width: 100%;
    height: auto;
    display: block;
}

.article-body {
    font-size: 1rem;
    line-height: 1.85;
}

.article-body h2 {
    font-size: 1.5rem;
    margin: var(--space-4) 0 var(--space-2);
    padding-bottom: 0.4em;
    border-bottom: 1px solid var(--color-border);
}

.article-body h3 {
    font-size: 1.2rem;
    margin: var(--space-3) 0 var(--space-2);
}

.article-body p {
    margin: 0 0 var(--space-2);
}

.article-body img {
    border-radius: var(--radius-md);
    margin: var(--space-2) 0;
}

.article-body blockquote {
    border-left: 3px solid var(--color-accent);
    padding: 0.5em 1em;
    margin: var(--space-2) 0;
    background-color: var(--color-bg-card);
    color: var(--color-text-muted);
    font-style: italic;
}

.article-body code {
    background-color: var(--color-bg-card);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
}

.article-body pre {
    background-color: var(--color-bg-elevated);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: var(--space-2) 0;
}

.article-body pre code {
    background: none;
    padding: 0;
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-2) 0;
    font-size: 0.95rem;
}

.article-body th,
.article-body td {
    border: 1px solid var(--color-border);
    padding: 0.6em 0.8em;
    text-align: left;
}

.article-body th {
    background-color: var(--color-bg-card);
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
}

.article-tag {
    display: inline-block;
    padding: 0.3em 0.8em;
    border-radius: var(--radius-sm);
    background-color: var(--color-bg-card);
    color: var(--color-text-muted);
    font-size: 0.8rem;
    text-decoration: none;
}

.article-tag:hover {
    background-color: var(--color-bg-card-hover);
    color: var(--color-accent);
    text-decoration: none;
}

/* ----------------------------------------------------------
 * Related Posts
 * ---------------------------------------------------------- */
.related {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.related-heading {
    font-size: 1.3rem;
    margin: 0 0 var(--space-3);
}

.related-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-2);
    list-style: none;
    padding: 0;
    margin: 0;
}

.related-item {
    background-color: var(--color-bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s, background-color 0.2s;
}

.related-item:hover {
    transform: translateY(-2px);
    background-color: var(--color-bg-card-hover);
}

.related-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.related-link:hover {
    color: inherit;
    text-decoration: none;
}

.related-thumb {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.3);
}

.related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-thumb-empty {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

.related-info {
    padding: 0.8em 1em;
}

.related-title {
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0 0 0.4em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-date {
    font-size: 0.75rem;
    color: var(--color-text-subtle);
}

/* ----------------------------------------------------------
 * Footer
 * ---------------------------------------------------------- */
.site-footer {
    margin-top: var(--space-6);
    padding: var(--space-4) var(--space-2);
    background-color: var(--color-bg-elevated);
    border-top: 1px solid var(--color-border);
}

.site-footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    text-align: center;
}

.footer-nav {
    margin-bottom: var(--space-2);
}

.footer-menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-menu a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.85rem;
}

.footer-menu a:hover {
    color: var(--color-accent);
}

.site-info .copyright {
    color: var(--color-text-subtle);
    font-size: 0.8rem;
    margin: 0;
}

/* ----------------------------------------------------------
 * Search Form
 * ---------------------------------------------------------- */
.search-form {
    display: flex;
    align-items: stretch;
    max-width: 480px;
    margin: var(--space-2) 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-bg-card);
    overflow: hidden;
    transition: border-color 0.2s;
}

.search-form:focus-within {
    border-color: var(--color-accent);
}

.search-form-input {
    flex: 1;
    padding: 0.6em 0.9em;
    border: none;
    background: transparent;
    color: var(--color-text);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
}

.search-form-input::placeholder {
    color: var(--color-text-subtle);
}

.search-form-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 1em;
    border: none;
    background-color: var(--color-accent);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-form-button:hover {
    background-color: var(--color-accent-hover);
}

/* ----------------------------------------------------------
 * 404 Page
 * ---------------------------------------------------------- */
.error-404 {
    text-align: center;
    padding: var(--space-5) 0;
}

.error-404-code {
    font-size: clamp(4rem, 12vw, 8rem);
    font-weight: 700;
    margin: 0 0 var(--space-2);
    color: var(--color-accent);
    line-height: 1;
    letter-spacing: 0.05em;
}

.error-404-title {
    font-size: clamp(1.4rem, 3vw, 2rem);
    margin: 0 0 var(--space-2);
}

.error-404-message {
    color: var(--color-text-muted);
    margin: 0 0 var(--space-4);
}

.error-404-search {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-5);
}

.error-404-search .search-form {
    margin: 0 auto;
    width: 100%;
}

.error-404-suggestions {
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.error-404-suggestions h2 {
    font-size: 1.2rem;
    margin: 0 0 var(--space-2);
}

.error-404-posts {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-3);
}

.error-404-posts li {
    padding: 0.6em 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
}

.error-404-posts li:last-child {
    border-bottom: none;
}

.error-404-posts a {
    flex: 1;
}

.error-404-posts time {
    font-size: 0.8rem;
    color: var(--color-text-subtle);
    white-space: nowrap;
}

.error-404-back {
    text-align: center;
    margin-top: var(--space-3);
}

/* ----------------------------------------------------------
 * Search Page
 * ---------------------------------------------------------- */
.search-rerun {
    margin-top: var(--space-2);
}

.search-rerun .search-form {
    margin: 0;
}

.no-results {
    text-align: center;
    padding: var(--space-4) 0;
    color: var(--color-text-muted);
}

.no-results h2 {
    margin-top: var(--space-4);
    font-size: 1.2rem;
    color: var(--color-text);
}

.recent-posts-list {
    list-style: none;
    padding: 0;
    margin: var(--space-2) auto;
    max-width: 500px;
    text-align: left;
}

.recent-posts-list li {
    padding: 0.6em 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
}

.recent-posts-list li:last-child {
    border-bottom: none;
}

.recent-posts-list a {
    flex: 1;
}

.recent-posts-list time {
    font-size: 0.8rem;
    color: var(--color-text-subtle);
    white-space: nowrap;
}

/* ----------------------------------------------------------
 * Mobile adjustments
 * ---------------------------------------------------------- */
@media (max-width: 600px) {
    .site-header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .primary-menu {
        font-size: 0.85rem;
        gap: 0.75em !important;
    }

    .article-hero {
        margin: var(--space-2) 0;
    }

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