/*
Theme Name: DarkCode
Theme URI: https://example.com/darkcode
Author: Chappy
Author URI: https://example.com/
Description: A dark, terminal-inspired WordPress theme for programmers. Monospace accents, syntax-green highlights and a simple one-column layout keep the focus on code and words.
Version: 1.3.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: darkcode
Tags: dark, one-column, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, blog
*/

/* ---------------------------------------------------------------------------
   DarkCode — dark, simple, programmer-flavoured.
   Palette: GitHub-dark inspired. Accent = terminal green.
---------------------------------------------------------------------------- */

:root {
	--bg: #0a0c10;
	--bg-soft: #0d1117;
	--panel: #11161d;
	--panel-2: #161c24;
	--border: #232b36;
	--text: #c9d4e3;
	--text-strong: #eef3fa;
	--muted: #7d8ca3;
	--accent: #4ade80;
	--accent-dim: #2ea868;
	--link: #6ee7a0;
	--blue: #58a6ff;
	--amber: #e3b341;
	--red: #f47067;
	--mono: ui-monospace, "JetBrains Mono", "Fira Code", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
	--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
	--radius: 8px;
	--width: 780px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--sans);
	font-size: 16.5px;
	line-height: 1.85;
	word-wrap: break-word;
	-webkit-font-smoothing: antialiased;
}

::selection { background: rgba(74, 222, 128, .28); }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

img { max-width: 100%; height: auto; }

/* ---------- header: a terminal window bar ------------------------------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: rgba(13, 17, 23, .92);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--border);
}

.site-header__inner {
	max-width: 1080px;
	margin: 0 auto;
	padding: 0 20px;
	min-height: 58px;
	display: flex;
	align-items: center;
	gap: 18px;
}

.window-dots { display: flex; gap: 8px; flex: none; }
.window-dots span {
	width: 12px; height: 12px; border-radius: 50%;
	display: block;
}
.window-dots .dot-close { background: #ff5f57; }
.window-dots .dot-min { background: #febc2e; }
.window-dots .dot-max { background: #28c840; }

.site-branding { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.site-branding .custom-logo { max-height: 30px; width: auto; }

.site-title {
	font-family: var(--mono);
	font-size: 1.02rem;
	font-weight: 700;
	margin: 0;
	white-space: nowrap;
}
.site-title a { color: var(--text-strong); }
.site-title a::before { content: "~/ "; color: var(--accent); }
.site-title a:hover { text-decoration: none; color: var(--accent); }

.site-description {
	font-family: var(--mono);
	font-size: .78rem;
	color: var(--muted);
	margin: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.site-description::before { content: "# "; color: var(--accent-dim); }

.site-nav { margin-left: auto; }
.site-nav ul {
	list-style: none;
	display: flex;
	gap: 4px;
	margin: 0;
	padding: 0;
	flex-wrap: wrap;
}
.site-nav a {
	font-family: var(--mono);
	font-size: .85rem;
	color: var(--text);
	padding: 6px 10px;
	border-radius: 6px;
	display: block;
}
.site-nav a::before { content: "$ "; color: var(--accent-dim); }
.site-nav a:hover { background: var(--panel-2); color: var(--accent); text-decoration: none; }
.site-nav .current-menu-item > a { color: var(--accent); }

.nav-toggle {
	display: none;
	margin-left: auto;
	background: var(--panel);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: 6px;
	font-family: var(--mono);
	font-size: .85rem;
	padding: 6px 12px;
	cursor: pointer;
}

/* ---------- layout ------------------------------------------------------ */

.site-main {
	max-width: var(--width);
	margin: 0 auto;
	padding: 44px 20px 64px;
}

.page-header { margin: 0 0 34px; }
.page-header .archive-title,
.page-header .page-title {
	font-family: var(--mono);
	font-size: 1.45rem;
	color: var(--text-strong);
	margin: 0;
}
.page-header .archive-title::before,
.page-header .page-title::before { content: "$ ls "; color: var(--accent); }
.archive-description { color: var(--muted); margin-top: 8px; }

/* ---------- post cards --------------------------------------------------- */

.post-card {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 24px 26px;
	margin: 0 0 20px;
	transition: border-color .15s ease, transform .15s ease;
}
.post-card:hover { border-color: var(--accent-dim); }

.post-card .entry-meta,
.entry-meta {
	font-family: var(--mono);
	font-size: .78rem;
	color: var(--muted);
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
	margin: 0 0 8px;
}
.entry-meta a { color: var(--muted); }
.entry-meta a:hover { color: var(--accent); }
.entry-meta .meta-date::before { content: ""; }
.entry-meta .meta-cat::before { content: "[ "; color: var(--accent-dim); }
.entry-meta .meta-cat::after { content: " ]"; color: var(--accent-dim); }
.entry-meta .meta-tag::before { content: "#"; color: var(--accent-dim); }

.post-card .entry-title {
	font-size: 1.38rem;
	line-height: 1.45;
	margin: 0 0 8px;
	color: var(--text-strong);
}
.post-card .entry-title a { color: inherit; }
.post-card .entry-title a:hover { color: var(--accent); text-decoration: none; }

.post-card .entry-summary { color: var(--text); margin: 0; }
.post-card .entry-summary p { margin: 0; }

.read-more {
	font-family: var(--mono);
	font-size: .82rem;
	display: inline-block;
	margin-top: 12px;
}
.read-more::after { content: " →"; }

.post-card .post-thumbnail { display: block; margin: -6px 0 16px; }
.post-card .post-thumbnail img { border-radius: 6px; border: 1px solid var(--border); display: block; }

/* ---------- single article ---------------------------------------------- */

.entry-header { margin-bottom: 10px; }
.entry-header .entry-title {
	font-size: 2rem;
	line-height: 1.4;
	color: var(--text-strong);
	margin: 0 0 12px;
}
.entry-header .post-thumbnail img {
	border-radius: var(--radius);
	border: 1px solid var(--border);
	margin: 14px 0 6px;
}

.entry-content { margin-top: 22px; }
.entry-content > *:first-child { margin-top: 0; }

.entry-content h2,
.entry-content h3,
.entry-content h4 {
	font-family: var(--mono);
	color: var(--text-strong);
	line-height: 1.5;
	margin: 2em 0 .7em;
}
.entry-content h2 { font-size: 1.45rem; border-bottom: 1px solid var(--border); padding-bottom: .35em; }
.entry-content h2::before { content: "## "; color: var(--accent-dim); }
.entry-content h3 { font-size: 1.2rem; }
.entry-content h3::before { content: "### "; color: var(--accent-dim); }
.entry-content h4 { font-size: 1.05rem; }
.entry-content h4::before { content: "#### "; color: var(--accent-dim); }

.entry-content p { margin: 0 0 1.4em; }
.entry-content ul, .entry-content ol { margin: 0 0 1.4em; padding-left: 1.5em; }
.entry-content li { margin: .3em 0; }
.entry-content li::marker { color: var(--accent-dim); }

.entry-content blockquote {
	margin: 0 0 1.4em;
	padding: 4px 18px;
	border-left: 3px solid var(--accent-dim);
	background: var(--bg-soft);
	color: var(--muted);
}
.entry-content blockquote p { margin: .6em 0; }

/* code */
code, kbd, samp {
	font-family: var(--mono);
	font-size: .88em;
	background: var(--panel-2);
	border: 1px solid var(--border);
	border-radius: 5px;
	padding: .12em .42em;
	color: #a5f3c0;
}
pre {
	font-family: var(--mono);
	font-size: .875rem;
	line-height: 1.7;
	background: #07090c;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 42px 18px 16px;
	overflow-x: auto;
	margin: 0 0 1.6em;
	position: relative;
}
pre code {
	background: none;
	border: none;
	padding: 0;
	color: #d6e2f0;
	font-size: inherit;
	white-space: pre;
}
.code-copy {
	position: absolute;
	top: 8px;
	right: 8px;
	background: var(--panel-2);
	color: var(--muted);
	border: 1px solid var(--border);
	border-radius: 5px;
	font-family: var(--mono);
	font-size: .72rem;
	padding: 3px 10px;
	cursor: pointer;
}
.code-copy:hover { color: var(--accent); border-color: var(--accent-dim); }
pre::before {
	content: "● ● ●";
	position: absolute;
	top: 9px;
	left: 14px;
	font-size: .6rem;
	letter-spacing: 3px;
	color: #3a4453;
}

.entry-content table {
	border-collapse: collapse;
	width: 100%;
	margin: 0 0 1.6em;
	font-size: .92rem;
}
.entry-content th, .entry-content td {
	border: 1px solid var(--border);
	padding: 8px 12px;
	text-align: left;
}
.entry-content th { background: var(--panel-2); font-family: var(--mono); font-weight: 600; }

.entry-content hr { border: none; border-top: 1px dashed var(--border); margin: 2.4em 0; }
.entry-content figure { margin: 0 0 1.6em; }
.entry-content figcaption { font-size: .82rem; color: var(--muted); text-align: center; margin-top: 6px; }

.entry-footer {
	font-family: var(--mono);
	font-size: .8rem;
	color: var(--muted);
	border-top: 1px dashed var(--border);
	margin-top: 36px;
	padding-top: 16px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
}
.entry-footer a { color: var(--muted); }
.entry-footer a:hover { color: var(--accent); }

/* prev / next */
.post-navigation { margin-top: 40px; }
.post-navigation .nav-links { display: flex; gap: 14px; }
.post-navigation .nav-previous, .post-navigation .nav-next { flex: 1; }
.post-navigation .nav-next { text-align: right; }
.post-navigation a {
	display: block;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 14px 18px;
	font-family: var(--mono);
	font-size: .85rem;
	color: var(--text);
}
.post-navigation a:hover { border-color: var(--accent-dim); color: var(--accent); text-decoration: none; }
.post-navigation .nav-subtitle { display: block; font-size: .72rem; color: var(--muted); margin-bottom: 4px; }

/* pagination */
.pagination { margin-top: 36px; }
.pagination .nav-links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.page-numbers {
	font-family: var(--mono);
	font-size: .85rem;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 6px;
	color: var(--text);
	padding: 7px 13px;
}
a.page-numbers:hover { border-color: var(--accent-dim); color: var(--accent); text-decoration: none; }
.page-numbers.current { background: var(--accent-dim); border-color: var(--accent-dim); color: #06130b; font-weight: 700; }

/* ---------- utility bar: pages / categories / search -------------------- */

.utility-bar {
	border-top: 1px solid var(--border);
	background: rgba(13, 17, 23, .6);
}
.utility-bar__inner {
	max-width: 1080px;
	margin: 0 auto;
	padding: 8px 20px;
	display: flex;
	align-items: flex-start;
	gap: 10px 22px;
	flex-wrap: wrap;
}

.pages-nav ul {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 2px 6px;
	margin: 0;
	padding: 0;
}
.pages-nav a {
	font-family: var(--mono);
	font-size: .82rem;
	color: var(--text);
	padding: 4px 8px;
	border-radius: 5px;
	display: block;
}
.pages-nav a::before { content: "./"; color: var(--accent-dim); }
.pages-nav a:hover { color: var(--accent); background: var(--panel-2); text-decoration: none; }

.cat-accordion { position: relative; }
.cat-toggle {
	background: none;
	border: 1px solid transparent;
	border-radius: 5px;
	color: var(--text);
	font-family: var(--mono);
	font-size: .82rem;
	padding: 4px 8px;
	cursor: pointer;
}
.cat-toggle::before { content: "$ ls "; color: var(--accent-dim); }
.cat-toggle:hover { color: var(--accent); }
.cat-toggle[aria-expanded="true"] { color: var(--accent); border-color: var(--border); background: var(--panel); }
.cat-count { color: var(--muted); }
.cat-arrow { display: inline-block; transition: transform .18s ease; color: var(--accent-dim); }
.cat-toggle[aria-expanded="true"] .cat-arrow { transform: rotate(180deg); }

.cat-panel {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 60;
	width: min(560px, calc(100vw - 40px));
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
	padding: 14px 16px;
}
.cat-panel ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 2px 18px;
	max-height: 46vh;
	overflow-y: auto;
}
.cat-panel li {
	display: flex;
	align-items: baseline;
	gap: 8px;
	font-size: .86rem;
	padding: 3px 2px;
}
.cat-panel li a { color: var(--text); font-family: var(--mono); font-size: .82rem; }
.cat-panel li a::before { content: "#"; color: var(--accent-dim); }
.cat-panel li a:hover { color: var(--accent); text-decoration: none; }
.cat-posts { font-family: var(--mono); font-size: .72rem; color: var(--muted); }

.utility-search { margin-left: auto; }
.utility-search .search-form .search-field { padding: 6px 10px; font-size: .82rem; width: 180px; }
.utility-search .search-form .search-submit { padding: 6px 12px; font-size: .8rem; }

/* ---------- search ------------------------------------------------------- */

.search-form { display: flex; gap: 8px; }
.search-form .search-field {
	flex: 1;
	background: #07090c;
	border: 1px solid var(--border);
	border-radius: 6px;
	color: var(--text);
	font-family: var(--mono);
	font-size: .9rem;
	padding: 9px 12px;
	min-width: 0;
}
.search-form .search-field:focus { outline: none; border-color: var(--accent-dim); }
.search-form .search-submit {
	background: var(--panel-2);
	border: 1px solid var(--border);
	border-radius: 6px;
	color: var(--accent);
	font-family: var(--mono);
	font-size: .85rem;
	padding: 9px 16px;
	cursor: pointer;
}
.search-form .search-submit:hover { border-color: var(--accent-dim); }

/* ---------- comments ------------------------------------------------------ */

.comments-area { margin-top: 52px; }
.comments-title, .comment-reply-title {
	font-family: var(--mono);
	font-size: 1.15rem;
	color: var(--text-strong);
}
.comments-title::before, .comment-reply-title::before { content: "// "; color: var(--accent-dim); }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .children { list-style: none; padding-left: 28px; }
.comment-body {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 16px 20px;
	margin: 0 0 14px;
}
.comment-meta { font-family: var(--mono); font-size: .76rem; color: var(--muted); margin-bottom: 6px; }
.comment-author { font-family: var(--mono); font-size: .88rem; }
.comment-author a { color: var(--text-strong); }
.comment-content p { margin: .4em 0; }
.reply a { font-family: var(--mono); font-size: .78rem; }
.comment-form label { font-family: var(--mono); font-size: .82rem; color: var(--muted); display: block; margin-bottom: 4px; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
	width: 100%;
	background: #07090c;
	border: 1px solid var(--border);
	border-radius: 6px;
	color: var(--text);
	font-family: var(--mono);
	font-size: .9rem;
	padding: 9px 12px;
}
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--accent-dim); }
.comment-form .submit {
	background: var(--accent-dim);
	border: none;
	border-radius: 6px;
	color: #06130b;
	font-family: var(--mono);
	font-weight: 700;
	font-size: .88rem;
	padding: 10px 22px;
	cursor: pointer;
}
.comment-form .submit:hover { background: var(--accent); }

/* ---------- 404 ------------------------------------------------------------ */

.error-404 .page-title { font-family: var(--mono); }
.error-404 .terminal-box {
	background: #07090c;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font-family: var(--mono);
	font-size: .92rem;
	padding: 22px 24px;
	margin-bottom: 26px;
}
.error-404 .terminal-box .cmd { color: var(--text-strong); }
.error-404 .terminal-box .cmd::before { content: "$ "; color: var(--accent); }
.error-404 .terminal-box .err { color: var(--red); }
.cursor::after {
	content: "▊";
	color: var(--accent);
	animation: blink 1.05s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- footer ---------------------------------------------------------- */

.site-footer {
	border-top: 1px solid var(--border);
	background: var(--bg-soft);
}
.site-footer__inner {
	max-width: 1080px;
	margin: 0 auto;
	padding: 26px 20px 34px;
	display: flex;
	flex-wrap: wrap;
	gap: 10px 26px;
	align-items: center;
	font-family: var(--mono);
	font-size: .8rem;
	color: var(--muted);
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer .exit-line::before { content: "$ "; color: var(--accent-dim); }
.footer-nav ul { list-style: none; display: flex; gap: 16px; margin: 0; padding: 0; }

/* ---------- wordpress core --------------------------------------------------- */

.alignleft { float: left; margin: .3em 1.2em 1em 0; }
.alignright { float: right; margin: .3em 0 1em 1.2em; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: .82rem; color: var(--muted); text-align: center; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 1.6em; }
.gallery img { border-radius: 6px; border: 1px solid var(--border); }
.sticky { border-color: var(--accent-dim); }
.bypostauthor > .comment-body { border-color: var(--accent-dim); }
.screen-reader-text {
	border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
	height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; word-wrap: normal !important;
}
.no-results .page-title::before { content: "$ "; color: var(--accent); }

/* ---------- responsive --------------------------------------------------------- */

@media (max-width: 720px) {
	body { font-size: 15.5px; }
	.site-description { display: none; }
	.window-dots { display: none; }
	.nav-toggle { display: block; }
	.site-nav { display: none; width: 100%; }
	.site-nav.is-open { display: block; }
	.site-header__inner { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
	.site-nav ul { flex-direction: column; padding: 8px 0; }
	.entry-header .entry-title { font-size: 1.55rem; }
	.post-navigation .nav-links { flex-direction: column; }
	.post-card { padding: 19px 18px; }
	.utility-search { margin-left: 0; width: 100%; }
	.utility-search .search-form .search-field { flex: 1; width: auto; }
	.cat-panel { position: fixed; left: 20px; right: 20px; width: auto; }
}

/* ---------- share box ------------------------------------------------------ */
.share-box {
	margin: 44px 0 10px;
	padding: 26px 16px 20px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-soft);
	text-align: center;
}
.share-title {
	margin: 0 0 16px;
	color: var(--text-strong);
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.05em;
}
.share-list {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px 18px;
}
.share-item {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	gap: 7px;
	min-width: 72px;
	padding: 8px 6px;
	border: 0;
	background: none;
	color: var(--text);
	font-family: inherit;
	font-size: 12px;
	cursor: pointer;
}
.share-item svg {
	width: 27px;
	height: 27px;
	fill: currentColor;
}
.share-item:hover {
	color: var(--accent);
	text-decoration: none;
}

/* ---------- headline list (article index page template) -------------------- */
.headline-list {
	margin: 0;
	padding: 0;
	list-style: none;
}
.headline-item {
	border-bottom: 1px solid var(--border);
}
.headline-item:first-child {
	border-top: 1px solid var(--border);
}
.headline-link {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 8px;
	color: var(--text);
}
.headline-link:hover {
	background: var(--panel);
	text-decoration: none;
}
.headline-thumb {
	flex: 0 0 104px;
	width: 104px;
	height: 78px;
	overflow: hidden;
	border-radius: 4px;
	background: var(--panel-2);
}
.headline-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.headline-body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}
.headline-title {
	color: var(--text-strong);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.5;
}
.headline-link:hover .headline-title {
	color: var(--accent);
}
.headline-meta {
	display: flex;
	gap: 12px;
	color: var(--muted);
	font-family: var(--mono);
	font-size: 12px;
}
.headline-cat {
	color: var(--accent-dim);
}
.headline-pagination {
	margin-top: 26px;
	text-align: center;
}
@media (max-width: 560px) {
	.headline-thumb {
		flex-basis: 76px;
		width: 76px;
		height: 57px;
	}
	.headline-title {
		font-size: 14px;
	}
}
