/* ============================================
   Terminal Portfolio - Style System
   ============================================ */

:root {
	--term-bg: rgba(22, 22, 26, 0.78);
	--term-titlebar: rgba(38, 38, 42, 0.92);
	--term-border: rgba(255, 255, 255, 0.08);
	--term-text: #d4d4d8;
	--term-bright: #f4f4f5;
	--term-muted: rgba(212, 212, 216, 0.5);
	--term-green: #7cc496;
	--term-blue: #60a5fa;
	--term-purple: #a78bfa;
	--term-yellow: #fbbf24;
	--term-red: #f87171;
	--term-cyan: #67e8f9;
	--term-orange: #fb923c;
	--term-mint: #62a87c;
	--term-prompt: #7cc496;
	--term-cursor: #7cc496;
	--term-selection: rgba(124, 196, 150, 0.18);
	--term-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
	--term-radius: 12px;
	--scenery-image: url('scenery/osaka_cityscape.png');
}

[data-time="night"] {
	--scenery-image: url('scenery/osaka_cityscape_night.png');
	--term-bg: rgba(16, 16, 20, 0.82);
	--term-titlebar: rgba(28, 28, 32, 0.94);
}

/* ---- Reset & Base ---- */
* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html,
body {
	height: 100%;
	overflow: hidden;
}

body {
	font-family: "JetBrains Mono", "SF Mono", "Fira Code", "Fira Mono", "Cascadia Code", monospace;
	font-size: 14px;
	line-height: 1.6;
	color: var(--term-text);
	background: #0a0a0e;
}

/* ---- Scenery Background ---- */
body::before {
	content: "";
	position: fixed;
	inset: 0;
	background-image: var(--scenery-image);
	background-size: cover;
	background-position: center bottom;
	image-rendering: -webkit-optimize-contrast;
	image-rendering: crisp-edges;
	z-index: -1;
	transition: opacity 0.8s ease;
}

/* ---- Terminal Window ---- */
.terminal-window {
	display: flex;
	flex-direction: column;
	width: min(960px, calc(100% - 40px));
	height: calc(100vh - 48px);
	margin: 24px auto;
	border-radius: var(--term-radius);
	box-shadow: var(--term-shadow);
	overflow: hidden;
	border: 1px solid var(--term-border);
}

/* ---- Title Bar ---- */
.terminal-titlebar {
	display: flex;
	align-items: center;
	height: 40px;
	padding: 0 14px;
	background: var(--term-titlebar);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	border-bottom: 1px solid var(--term-border);
	flex-shrink: 0;
	user-select: none;
}

.traffic-lights {
	display: flex;
	gap: 8px;
	flex-shrink: 0;
}

.light {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	transition: opacity 0.2s;
}

.light.red {
	background: #ff5f57;
}

.light.yellow {
	background: #febc2e;
}

.light.green {
	background: #28c840;
}

.terminal-title {
	flex: 1;
	text-align: center;
	font-size: 12px;
	color: var(--term-muted);
	font-weight: 500;
	letter-spacing: 0.3px;
}

.titlebar-spacer {
	width: 52px;
	flex-shrink: 0;
}

/* ---- Terminal Body ---- */
.terminal-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px 18px;
	background: var(--term-bg);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	scroll-behavior: smooth;
}

.terminal-body::-webkit-scrollbar {
	width: 6px;
}

.terminal-body::-webkit-scrollbar-track {
	background: transparent;
}

.terminal-body::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.12);
	border-radius: 3px;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
	background: rgba(255, 255, 255, 0.2);
}

/* ---- Input Line ---- */
.input-line {
	display: flex;
	align-items: center;
	min-height: 28px;
	margin-top: 4px;
}

.prompt {
	color: var(--term-prompt);
	font-weight: 500;
	white-space: pre;
	flex-shrink: 0;
}

#command-input {
	flex: 1;
	background: transparent;
	border: none;
	outline: none;
	color: var(--term-bright);
	font-family: inherit;
	font-size: inherit;
	line-height: inherit;
	caret-color: var(--term-cursor);
	padding: 0;
}

#command-input::selection {
	background: var(--term-selection);
}

/* ---- Output Blocks ---- */
.output-block {
	margin-bottom: 8px;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.output-block .cmd-echo {
	display: flex;
}

.output-block .cmd-echo .prompt {
	color: var(--term-prompt);
	font-weight: 500;
}

.output-block .cmd-echo .cmd-text {
	color: var(--term-bright);
}

.output-block .cmd-result {
	margin-top: 4px;
	padding-left: 2px;
}

/* ---- Boot Sequence ---- */
.boot-line {
	margin-bottom: 2px;
}

.boot-line .boot-label {
	color: var(--term-muted);
}

.boot-line .boot-ok {
	color: var(--term-green);
	font-weight: 600;
}

.boot-line .boot-info {
	color: var(--term-blue);
}

/* ---- Text Styles ---- */
.t-green {
	color: var(--term-green);
}

.t-blue {
	color: var(--term-blue);
}

.t-purple {
	color: var(--term-purple);
}

.t-yellow {
	color: var(--term-yellow);
}

.t-red {
	color: var(--term-red);
}

.t-cyan {
	color: var(--term-cyan);
}

.t-orange {
	color: var(--term-orange);
}

.t-muted {
	color: var(--term-muted);
}

.t-bright {
	color: var(--term-bright);
}

.t-mint {
	color: var(--term-mint);
}

.t-bold {
	font-weight: 700;
}

.t-dim {
	opacity: 0.5;
}

.t-underline {
	text-decoration: underline;
}

/* ---- Section Headers (inside output) ---- */
.section-header {
	color: var(--term-green);
	font-weight: 700;
	font-size: 15px;
	margin: 12px 0 6px;
	padding-bottom: 4px;
	border-bottom: 1px solid rgba(124, 196, 150, 0.2);
	display: block;
}

.section-header:first-child {
	margin-top: 4px;
}

.section-sub {
	color: var(--term-purple);
	font-weight: 600;
	margin: 10px 0 4px;
	display: block;
}

/* ---- Table-like formatting ---- */
.term-table {
	display: grid;
	gap: 2px 0;
	margin: 4px 0;
}

.term-row {
	display: flex;
	gap: 8px;
}

.term-key {
	color: var(--term-cyan);
	min-width: 22ch;
	flex-shrink: 0;
}

.term-val {
	color: var(--term-text);
}

/* ---- Skills Grid ---- */
.skill-category {
	margin: 6px 0;
}

.skill-category .cat-name {
	color: var(--term-yellow);
	font-weight: 600;
}

.skill-category .cat-items {
	color: var(--term-text);
	padding-left: 4ch;
}

/* ---- Project Cards (in terminal) ---- */
.term-project {
	display: block;
	margin: 6px 0;
	padding: 10px 14px;
	border: 1px solid rgba(124, 196, 150, 0.15);
	border-radius: 8px;
	background: rgba(124, 196, 150, 0.04);
	cursor: pointer;
	transition: border-color 0.2s, background 0.2s;
	text-decoration: none;
	color: inherit;
}

.term-project:hover {
	border-color: rgba(124, 196, 150, 0.35);
	background: rgba(124, 196, 150, 0.08);
}

.term-project .proj-name {
	color: var(--term-green);
	font-weight: 600;
}

.term-project .proj-tech {
	color: var(--term-muted);
	font-size: 12px;
}

.term-project .proj-desc {
	color: var(--term-text);
	margin-top: 4px;
	font-size: 13px;
}

/* ---- Roadmap Items ---- */
.term-roadmap-item {
	display: flex;
	align-items: baseline;
	gap: 10px;
	padding: 4px 0;
}

.roadmap-dot {
	flex-shrink: 0;
}

.roadmap-dot.active {
	color: var(--term-green);
}

.roadmap-dot.acquired {
	color: var(--term-cyan);
}

.roadmap-dot.planned {
	color: var(--term-muted);
}

.roadmap-label {
	flex: 1;
}

.roadmap-status-tag {
	font-size: 12px;
	padding: 1px 8px;
	border-radius: 4px;
}

.roadmap-status-tag.acquired {
	color: var(--term-cyan);
	border: 1px solid rgba(100, 200, 255, 0.3);
}

.roadmap-status-tag.studying {
	color: var(--term-green);
	border: 1px solid rgba(124, 196, 150, 0.3);
}

.roadmap-status-tag.planned {
	color: var(--term-muted);
	border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ---- Blog Entries ---- */
.term-blog-entry {
	display: flex;
	align-items: baseline;
	gap: 12px;
	padding: 4px 0;
	cursor: pointer;
	transition: padding-left 0.15s;
}

.term-blog-entry:hover {
	padding-left: 4px;
}

.blog-entry-date {
	color: var(--term-muted);
	min-width: 10ch;
	flex-shrink: 0;
}

.blog-entry-name {
	color: var(--term-text);
	font-weight: 500;
}

.blog-entry-tag {
	font-size: 12px;
	color: var(--term-green);
	padding: 1px 8px;
	border: 1px solid rgba(124, 196, 150, 0.2);
	border-radius: 4px;
}

/* ---- Help Command Grid ---- */
.help-grid {
	display: grid;
	gap: 2px 0;
	margin: 4px 0 8px;
}

.help-row {
	display: flex;
	gap: 4px;
}

.help-cmd {
	color: var(--term-green);
	min-width: 20ch;
	flex-shrink: 0;
	font-weight: 500;
}

.help-desc {
	color: var(--term-muted);
}

/* ---- Inline Code ---- */
.term-code {
	background: rgba(124, 196, 150, 0.1);
	color: var(--term-green);
	padding: 1px 5px;
	border-radius: 3px;
	font-size: 0.92em;
}

/* ---- Writeup Images ---- */
.term-img {
	max-width: 100%;
	max-height: 380px;
	object-fit: contain;
	border-radius: 6px;
	border: 1px solid var(--term-border);
	margin: 8px 0;
	display: block;
}

/* ---- Terminal Code Block ---- */
.term-codeblock {
	background: rgba(0, 0, 0, 0.3);
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 6px;
	padding: 10px 14px;
	margin: 8px 0;
	overflow-x: auto;
	font-size: 13px;
}

.term-codeblock .cb-prompt {
	color: var(--term-green);
}

.term-codeblock .cb-comment {
	color: rgba(255, 255, 255, 0.3);
}

.term-codeblock .cb-output {
	color: rgba(255, 255, 255, 0.6);
}

.term-codeblock .cb-success {
	color: #4ade80;
}

.term-codeblock .cb-error {
	color: #f87171;
}

.term-codeblock .cb-url {
	color: var(--term-blue);
}

/* ---- Neofetch Style ---- */
.neofetch-box {
	display: flex;
	gap: 24px;
	margin: 4px 0;
}

.neofetch-ascii {
	color: var(--term-green);
	font-size: 12px;
	line-height: 1.3;
	flex-shrink: 0;
}

.neofetch-info {
	display: grid;
	gap: 1px 0;
}

.nf-row {
	display: flex;
	gap: 4px;
}

.nf-key {
	color: var(--term-green);
	font-weight: 600;
	min-width: 14ch;
}

.nf-val {
	color: var(--term-text);
}

.nf-separator {
	border: none;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	margin: 4px 0;
}

.nf-colors {
	display: flex;
	gap: 4px;
	margin-top: 4px;
}

.nf-color-block {
	width: 24px;
	height: 12px;
	border-radius: 2px;
}

/* ---- Link styling ---- */
.term-link {
	color: var(--term-blue);
	text-decoration: underline;
	text-decoration-style: dotted;
	text-underline-offset: 2px;
	cursor: pointer;
	transition: color 0.15s;
}

.term-link:hover {
	color: var(--term-cyan);
}

/* ---- Autocomplete hint ---- */
.autocomplete-hint {
	color: rgba(255, 255, 255, 0.2);
	pointer-events: none;
}

/* ---- Tab bar (for project pages) ---- */
.terminal-tabs {
	display: flex;
	height: 32px;
	background: rgba(30, 30, 34, 0.6);
	border-bottom: 1px solid var(--term-border);
	padding: 0 8px;
	gap: 2px;
	align-items: flex-end;
	flex-shrink: 0;
}

.terminal-tab {
	padding: 5px 14px;
	font-size: 11px;
	color: var(--term-muted);
	border-radius: 6px 6px 0 0;
	border: 1px solid transparent;
	border-bottom: none;
	cursor: pointer;
	font-family: inherit;
	background: transparent;
	transition: color 0.15s, background 0.15s;
}

.terminal-tab:hover {
	color: var(--term-text);
}

.terminal-tab.active {
	background: var(--term-bg);
	color: var(--term-text);
	border-color: var(--term-border);
}

/* ---- Writeup Sections ---- */
.writeup-section {
	margin: 12px 0;
}

.writeup-h2 {
	color: var(--term-green);
	font-weight: 700;
	font-size: 15px;
	margin: 16px 0 8px;
	padding-bottom: 4px;
	border-bottom: 1px solid rgba(124, 196, 150, 0.15);
}

.writeup-h3 {
	color: var(--term-purple);
	font-weight: 600;
	font-size: 14px;
	margin: 12px 0 4px;
}

.writeup-p {
	color: var(--term-text);
	margin: 4px 0;
	line-height: 1.7;
}

.tools-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 6px 0;
}

.tool-tag {
	padding: 2px 10px;
	border-radius: 4px;
	font-size: 12px;
	color: var(--term-green);
	border: 1px solid rgba(124, 196, 150, 0.25);
	background: rgba(124, 196, 150, 0.06);
}

/* ---- Cursor blink ---- */
@keyframes blink {

	0%,
	100% {
		opacity: 1;
	}

	50% {
		opacity: 0;
	}
}

#command-input:focus {
	caret-color: var(--term-cursor);
}

/* ---- Responsive ---- */
@media (max-width: 720px) {
	.terminal-window {
		width: calc(100% - 16px);
		height: calc(100vh - 16px);
		margin: 8px auto;
		border-radius: 8px;
	}

	body {
		font-size: 13px;
	}

	.terminal-body {
		padding: 12px 10px;
	}

	.term-key {
		min-width: 16ch;
	}

	.help-cmd {
		min-width: 14ch;
	}

	.neofetch-box {
		flex-direction: column;
		gap: 12px;
	}

	.neofetch-ascii {
		font-size: 10px;
	}

	.nf-key {
		min-width: 12ch;
	}
}

@media (max-width: 480px) {
	.terminal-titlebar {
		height: 36px;
	}

	.light {
		width: 10px;
		height: 10px;
	}

	.traffic-lights {
		gap: 6px;
	}

	.term-key,
	.help-cmd {
		min-width: 12ch;
	}
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {

	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}

	.terminal-body {
		scroll-behavior: auto;
	}
}
