/*
Theme Name: QP001 Child (Cocoon)
Theme URI: https://qp001.blog
Description: QP001 BLOG のポートフォリオ風デザイン。Cocoon の子テーマ。Home / Blog / About を固定ページで運用します。
Author: QP001
Template: cocoon-master
Version: 1.0.0
Text Domain: qp001-child
*/

/* =========================================================
   Design tokens
   ========================================================= */
:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #151b2b;
    --bg-card: #1e2538;
    --text-primary: #f0f4f8;
    --text-secondary: #94a3b8;
    --accent: #5eead4;
    --accent-dark: #2dd4bf;
    --on-accent: #0b0f19;
    --border: rgba(148, 163, 184, 0.1);
    --border-strong: rgba(148, 163, 184, 0.25);
    --shadow: rgba(0, 0, 0, 0.4);
    --header-bg: rgba(11, 15, 25, 0.8);
    --glow: rgba(94, 234, 212, 0.08);
    --inline-code-bg: rgba(148, 163, 184, 0.15);
    /* コードウィンドウは常にダーク */
    --code-bg: #151b2b;
    --code-head: rgba(0, 0, 0, 0.2);
    --code-border: rgba(148, 163, 184, 0.1);
    --code-text: #94a3b8;
    --code-body-bg: #0b0f19;
}

:root[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #eef2f7;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent: #0f766e;
    --accent-dark: #115e59;
    --on-accent: #ffffff;
    --border: rgba(15, 23, 42, 0.1);
    --border-strong: rgba(15, 23, 42, 0.25);
    --shadow: rgba(15, 23, 42, 0.12);
    --header-bg: rgba(248, 250, 252, 0.85);
    --glow: rgba(15, 118, 110, 0.08);
    --inline-code-bg: rgba(15, 23, 42, 0.07);
}

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

html { scroll-behavior: smooth; }

body.qp-body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Noto Sans JP', sans-serif !important;
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.qp-body a { color: inherit; text-decoration: none; }
.qp-body img { max-width: 100%; height: auto; }
:where(.qp-body) :where(h1, h2, h3, h4, p, ul, ol, figure) { margin: 0; padding: 0; }
:where(.qp-body) :where(ul, ol) { list-style: none; }

.qp-body :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

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

.bg-glow {
    position: fixed;
    top: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--glow) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* =========================================================
   Header
   ========================================================= */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 4rem;
    background: var(--header-bg);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

body.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { body.admin-bar .site-header { top: 46px; } }

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent) !important;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.site-nav a.nav-link {
    position: relative;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.3s;
}

.site-nav a.nav-link:hover { color: var(--accent); }

.site-nav a.nav-link.active { color: var(--accent); }
.site-nav a.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -6px; left: 0;
    width: 100%; height: 2px;
    background: var(--accent);
}

.theme-toggle {
    width: 36px; height: 36px;
    padding: 0;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* =========================================================
   Shared components
   ========================================================= */
.tag {
    display: inline-block;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 2rem;
    min-height: 44px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-primary { background: var(--accent); color: var(--on-accent) !important; }
.btn-primary:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px var(--glow);
}

.btn-secondary { background: transparent; border-color: var(--border-strong); color: var(--text-primary); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.arrow { transition: transform 0.3s; }
.btn-primary:hover .arrow { transform: translateX(4px); }

/* Code window */
.code-window {
    background: var(--code-bg);
    border-radius: 12px;
    border: 1px solid var(--code-border);
    overflow: hidden;
    box-shadow: 0 20px 60px var(--shadow);
}

.code-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.2rem;
    background: var(--code-head);
    border-bottom: 1px solid var(--code-border);
}

.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.code-body {
    padding: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #e5e9f0;
    overflow-x: auto;
    white-space: pre;
}

.code-body .const { color: #c678dd; }
.code-body .variable { color: #e06c75; }
.code-body .string { color: #98c379; }
.code-body .property { color: #e5c07b; }
.code-body .comment { color: #5c6370; font-style: italic; }

/* Page container (Blog / About / Single) */
.site-main {
    max-width: 1272px;
    margin: 0 auto;
    padding: 9rem 2rem 2.5rem;
}

.page-head {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 48px;
}

.page-head .tag { margin-bottom: 0; }

.page-head h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -1px;
}

.page-head h1 .accent, .hero h1 .accent { color: var(--accent); }

.page-head .lead {
    max-width: 560px;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.section-title .tag { display: block; margin-bottom: 0.4rem; font-weight: 400; }

/* =========================================================
   Home (Hero)
   ========================================================= */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8rem 4rem 4rem;
    max-width: 1400px;
    margin: 0 auto;
    gap: 4rem;
}

.hero-content { flex: 1; max-width: 600px; }

.hero h1 {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2.5rem;
    max-width: 480px;
}

.hero-buttons { display: flex; flex-wrap: wrap; gap: 1rem; }
.hero-visual { flex: 1; max-width: 560px; width: 100%; }

/* =========================================================
   Blog list
   ========================================================= */
.featured {
    display: flex;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px var(--shadow);
    margin-bottom: 64px;
    transition: border-color 0.3s;
}

.featured:hover { border-color: var(--accent); }

.featured-visual {
    flex: 1 1 min(420px, 100%);
    min-width: 0;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    padding: 32px;
}

.featured-visual img {
    width: 100%;
    border-radius: 10px;
    display: block;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.terminal {
    width: 100%;
    background: var(--code-body-bg);
    border: 1px solid var(--code-border);
    border-radius: 10px;
    overflow: hidden;
}

.terminal .code-header { padding: 12px 16px; }

.terminal-body {
    padding: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.8;
    color: var(--code-text);
    overflow-x: auto;
    white-space: pre;
}

.terminal-body .prompt { color: #5eead4; }
.terminal-body .hl { color: #98c379; }
.terminal-body .rm { color: #e06c75; }

.featured-body {
    flex: 1 1 min(420px, 100%);
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    padding: 40px;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
}

.meta .badge {
    color: var(--on-accent);
    background: var(--accent);
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: 500;
}

.meta .cat { color: var(--accent); letter-spacing: 1px; text-transform: uppercase; }
.meta .date { color: var(--text-secondary); }

.featured-body h2 { font-size: 1.75rem; font-weight: 700; line-height: 1.35; }
.featured-body p { font-size: 0.95rem; line-height: 1.8; color: var(--text-secondary); }

.more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
}

.list-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
}

.list-bar h2 { font-size: 1.4rem; font-weight: 700; }

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

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s;
}

.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
    gap: 24px;
    margin-bottom: 64px;
}

.post-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.post-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 16px 40px var(--shadow);
}

.post-card .thumb { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.post-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 28px;
    flex: 1;
}

.post-card .meta { justify-content: space-between; }

.post-card h3 { font-size: 1.15rem; font-weight: 700; line-height: 1.5; }
.post-card p { font-size: 0.875rem; line-height: 1.8; color: var(--text-secondary); }
.post-card .more { margin-top: auto; padding-top: 8px; }

.empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    margin-bottom: 64px;
}

/* Pagination */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 40px;
}

.pagination .page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-weight: 500;
    transition: all 0.3s;
}

.pagination a.page-numbers:hover { border-color: var(--accent); color: var(--accent); }
.pagination .page-numbers.current { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.pagination .page-numbers.dots { border: none; }
.pagination .prev, .pagination .next { color: var(--text-secondary); }

/* =========================================================
   Article (single / page)
   ========================================================= */
.article { max-width: 760px; margin: 0 auto; }

.article-head { display: flex; flex-direction: column; gap: 16px; margin-bottom: 32px; }
.article-head .tag { margin-bottom: 0; }

.back {
    align-self: flex-start;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.back:hover { color: var(--accent); }

.article-head h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 700; line-height: 1.35; letter-spacing: -0.5px; }

.article-thumb { width: 100%; border-radius: 12px; margin-bottom: 40px; border: 1px solid var(--border); }

.entry-content { font-size: 1rem; line-height: 2; word-wrap: break-word; overflow-wrap: anywhere; }
.entry-content > * + * { margin-top: 1.5em; }

.entry-content h2 {
    font-size: 1.5rem; font-weight: 700; line-height: 1.5;
    margin-top: 2.5em;
    padding-left: 14px;
    border-left: 3px solid var(--accent);
}

.entry-content h3 { font-size: 1.2rem; font-weight: 700; line-height: 1.5; margin-top: 2em; }
.entry-content h4 { font-size: 1.05rem; font-weight: 700; margin-top: 1.8em; }

.entry-content p, .entry-content li { color: var(--text-primary); }
.entry-content ul, .entry-content ol { padding-left: 1.5em; }
.entry-content ul { list-style: disc; }
.entry-content ol { list-style: decimal; }
.entry-content li + li { margin-top: 0.4em; }
.entry-content li::marker { color: var(--accent); }

.entry-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.entry-content a:hover { color: var(--accent-dark); }

.entry-content blockquote {
    margin-left: 0; margin-right: 0;
    padding: 4px 0 4px 20px;
    border-left: 3px solid var(--border-strong);
    color: var(--text-secondary);
}

.entry-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88em;
    background: var(--inline-code-bg);
    padding: 0.15em 0.45em;
    border-radius: 4px;
}

.entry-content pre {
    background: var(--code-body-bg);
    color: #e5e9f0;
    border: 1px solid var(--code-border);
    border-radius: 10px;
    padding: 20px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.8;
}

.entry-content pre code { background: none; padding: 0; font-size: inherit; color: inherit; }

.entry-content img { border-radius: 8px; }
.entry-content figure { max-width: 100%; }
.entry-content figcaption { margin-top: 8px; font-size: 0.85rem; color: var(--text-secondary); text-align: center; }

.entry-content table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; font-size: 0.95rem; }
.entry-content th, .entry-content td { padding: 10px 14px; border: 1px solid var(--border-strong); text-align: left; }
.entry-content th { background: var(--bg-card); }

.entry-content hr { border: none; border-top: 1px solid var(--border-strong); margin: 3em 0; }

.post-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 16px;
    margin-top: 64px;
}

.post-nav a {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.3s;
}

.post-nav a:hover { border-color: var(--accent); }
.post-nav .label { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--accent); }
.post-nav .title { font-size: 0.95rem; font-weight: 600; line-height: 1.5; }
.post-nav .next { text-align: right; }

/* =========================================================
   About
   ========================================================= */
.about-intro {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: stretch;
    margin-bottom: 72px;
}

.about-text {
    flex: 1 1 min(420px, 100%);
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1.2em;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    line-height: 2;
}

.about-text p { color: var(--text-primary); }
.about-text .entry-content { font-size: inherit; }

.about-visual { flex: 1 1 min(360px, 100%); min-width: 0; max-width: 520px; display: flex; align-items: center; }
.about-visual .code-window { width: 100%; }

.about-section { margin-bottom: 72px; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 24px;
}

.card-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }

.info-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.3s, transform 0.3s;
}

.info-card:hover { border-color: var(--accent); transform: translateY(-3px); }

.info-card .label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent);
}

.info-card h3 { font-size: 1.2rem; font-weight: 700; line-height: 1.5; }
.info-card p { font-size: 0.9rem; line-height: 1.8; color: var(--text-secondary); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }

.chip {
    padding: 3px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.callout {
    padding: 28px 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 12px;
    font-size: 1.05rem;
    line-height: 1.9;
}

.cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 40px;
}

.cta h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.4; }
.cta p { margin-top: 6px; color: var(--text-secondary); font-size: 0.95rem; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 2rem 4rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.site-footer .brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 20px; }
.site-footer .brand strong { font-size: 1.25rem; font-weight: 700; color: var(--accent); }
.site-footer .brand span { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; color: var(--text-secondary); }
.site-footer small { font-size: 0.8rem; color: var(--text-secondary); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1024px) {
    .hero { flex-direction: column; padding: 7rem 2rem 3rem; text-align: center; min-height: auto; }
    .hero-content { max-width: 100%; }
    .hero h1 { font-size: 3rem; }
    .hero p { margin-left: auto; margin-right: auto; }
    .hero-buttons { justify-content: center; }
    .hero-visual { max-width: 100%; }
    .hero .code-body { text-align: left; }
    .site-header { padding: 1rem 2rem; }
    .site-nav { gap: 1.2rem; }
    .site-footer { padding: 2rem; }
}

@media (max-width: 640px) {
    .hero h1 { font-size: 2.2rem; }
    .site-header { padding: 0.9rem 1rem; }
    .logo { font-size: 1.5rem; }
    .site-nav { gap: 1rem; }
    .site-nav a.nav-link { font-size: 0.85rem; }
    .hero { padding: 6.5rem 1.25rem 3rem; }
    .hero-buttons { flex-direction: column; }
    .btn { width: 100%; justify-content: center; }
    .site-main { padding: 7rem 1rem 2rem; }
    .featured-body, .about-text, .cta { padding: 24px; }
    .featured-visual { padding: 20px; }
    .featured-body h2 { font-size: 1.4rem; }
    .post-card .card-body { padding: 22px; }
    .callout { padding: 22px; }
    .site-footer { padding: 1.5rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; }
}
