/*
Theme Name: DesiCoder
Theme URI: https://desicoderpankaj.com/
Author: Pankaj
Description: A calm, mobile-first classic theme for a coding YouTube channel.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: desicoder
*/

/* ---------- Tokens ---------- */
:root {
	--paper: #F4F6FA;
	--ink: #0F1B2D;
	--saffron: #F5B83D;
	--teal: #1D4ED8;
	--muted: #4B5A70;
	--line: #DCE2EC;
	--radius: 12px;
	--navy: #0B1F3A;
	--gutter: 16px;
	--font-head: "Plus Jakarta Sans", system-ui, sans-serif;
	--font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- Base (mobile first) ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 1.0625rem;
	line-height: 1.7;
}

img, iframe, video { max-width: 100%; height: auto; }

h1, h2, h3 {
	font-family: var(--font-head);
	font-weight: 800;
	line-height: 1.2;
	margin: 0 0 .5em;
}
h1 { font-size: clamp(2rem, 7vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 4.5vw, 2.1rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }

a { color: var(--teal); text-underline-offset: .2em; }
a:hover { color: var(--ink); }

::selection { background: var(--saffron); color: var(--ink); }

:focus-visible {
	outline: 3px solid var(--teal);
	outline-offset: 3px;
	border-radius: 4px;
}

.screen-reader-text,
.skip-link:not(:focus) {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}
.skip-link:focus {
	position: fixed;
	top: 8px;
	left: 8px;
	z-index: 100;
	padding: .75em 1em;
	background: var(--ink);
	color: var(--paper);
}

.wrap {
	width: 100%;
	max-width: 1120px;
	margin-inline: auto;
	padding-inline: var(--gutter);
}
.narrow {
	max-width: 720px;
	margin-inline: auto;
	padding-inline: var(--gutter);
}

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap {
	display: flex;
	flex-direction: column;
	gap: .25rem;
	padding-block: .75rem;
}
.site-title {
	font-family: var(--font-head);
	font-weight: 800;
	font-size: 1.4rem;
	color: var(--ink);
	text-decoration: none;
}
.custom-logo { max-height: 44px; width: auto; }

.site-nav .menu {
	display: flex;
	flex-wrap: wrap;
	gap: 0 1.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}
.site-nav a {
	display: inline-block;
	padding: .65rem 0;
	min-height: 44px;
	color: var(--ink);
	text-decoration: none;
	font-weight: 500;
}
.site-nav a:hover,
.site-nav .current-menu-item > a { color: var(--teal); text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn {
	display: inline-block;
	min-height: 44px;
	padding: .7rem 1.3rem;
	border: 2px solid var(--ink);
	border-radius: 999px;
	background: var(--ink);
	color: var(--paper);
	font-weight: 600;
	text-decoration: none;
	text-align: center;
	transition: transform .15s ease, background-color .15s ease;
}
.btn:hover { background: var(--teal); border-color: var(--teal); color: #fff; transform: translateY(-2px); }
.btn-outline { background: transparent; color: var(--ink); }
.btn-outline:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-saffron { background: var(--saffron); border-color: var(--saffron); color: var(--ink); }
.btn-saffron:hover { background: var(--paper); border-color: var(--paper); color: var(--ink); }

/* ---------- Hero ---------- */
.hero { padding-block: 2.5rem 3rem; background: var(--navy); color: #EAF0FA; }
.hero .wrap { display: grid; gap: 2rem; }
.hero h1 { color: #fff; }
.hero-text p { color: #B9C6DB; font-size: 1.15rem; max-width: 34rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.hero .btn { background: var(--saffron); border-color: var(--saffron); color: var(--ink); }
.hero .btn:hover { background: #fff; border-color: #fff; color: var(--ink); }
.hero .btn-outline { background: transparent; border-color: #5B7399; color: #fff; }
.hero .btn-outline:hover { background: #fff; border-color: #fff; color: var(--ink); }
.hero :focus-visible { outline-color: var(--saffron); }
.hero-visual { display: grid; gap: 1.25rem; }
.hero-image { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); }

/* Quote */
.quote { padding-block: 2rem; }
.quote blockquote {
	margin: 0;
	padding: .25rem 0 .25rem 1.25rem;
	border-left: 4px solid var(--saffron);
}
.quote p {
	margin: 0 0 .5rem;
	font-family: var(--font-head);
	font-weight: 800;
	font-size: clamp(1.3rem, 4vw, 1.9rem);
	line-height: 1.3;
}
.quote cite { color: var(--muted); font-style: normal; }

.code-card {
	background: #07142A;
	color: #EEF0F7;
	border-radius: var(--radius);
	box-shadow: 8px 8px 0 var(--saffron);
	margin-right: 8px;
	overflow: hidden;
}
.code-card pre {
	margin: 0;
	padding: 1.25rem;
	overflow-x: auto;
	font: .95rem/1.7 ui-monospace, "Cascadia Code", Consolas, monospace;
}
.code-card .out {
	border-top: 1px solid #22344F;
	color: var(--saffron);
}

/* ---------- Sections ---------- */
.section { padding-block: 2.5rem; }
.section-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: .25rem 1rem;
	margin-bottom: 1.25rem;
}
.section-head h2 { margin: 0; }
.section-head a { font-weight: 600; }

.video-frame {
	position: relative;
	aspect-ratio: 16 / 9;
	background: var(--ink);
	border-radius: var(--radius);
	overflow: hidden;
}
.video-frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}
.note {
	padding: 1rem 1.25rem;
	border: 1px dashed var(--muted);
	border-radius: var(--radius);
	color: var(--muted);
}

.video-grid { display: grid; gap: 1.25rem; margin-top: 1.25rem; list-style: none; padding: 0; }
.video-grid a { display: block; color: var(--ink); text-decoration: none; font-weight: 600; line-height: 1.4; }
.video-grid a:hover { color: var(--teal); text-decoration: underline; }
.video-grid img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; margin-bottom: .5rem; }

/* Shorts: horizontal scroll row of portrait thumbnails */
.shorts-row {
	display: flex;
	gap: 1rem;
	margin: 0;
	padding: 0 0 .75rem;
	list-style: none;
	overflow-x: auto;
	scroll-snap-type: x proximity;
}
.shorts-row li { flex: 0 0 150px; scroll-snap-align: start; }
.shorts-row a { display: block; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; line-height: 1.4; }
.shorts-row a:hover { color: var(--teal); text-decoration: underline; }
.shorts-row img { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 10px; margin-bottom: .5rem; }

/* Video popup */
#dc-video-modal {
	width: min(960px, calc(100% - 2 * var(--gutter)));
	padding: 0;
	border: 0;
	border-radius: var(--radius);
	background: var(--ink);
	overflow: visible;
}
#dc-video-modal::backdrop { background: rgba(15, 27, 45, .85); }
#dc-video-modal.is-short { width: min(380px, calc(100% - 2 * var(--gutter))); }
.modal-frame { aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; }
.is-short .modal-frame { aspect-ratio: 9 / 16; max-height: 80vh; margin-inline: auto; }
.modal-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.modal-close {
	position: absolute;
	top: -48px;
	right: 0;
	min-height: 44px;
	padding: .5rem 1.1rem;
	border: 0;
	border-radius: 999px;
	background: var(--paper);
	color: var(--ink);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

/* ---------- Cards and grids ---------- */
.columns { display: grid; gap: 2rem; }
.columns h3 { font-size: 1.3rem; margin-bottom: .75rem; }

.card-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.card {
	display: flex;
	gap: 1rem;
	padding: .75rem;
	background: #FFFFFF;
	border: 1px solid var(--line);
	border-radius: var(--radius);
}
.card-thumb { display: block; flex: 0 0 96px; }
.card-thumb img {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: 8px;
}
.card-title { font-size: 1.05rem; margin: 0 0 .25rem; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a:hover { color: var(--teal); text-decoration: underline; }
.card-date { color: var(--muted); font-size: .9rem; }

.project-grid { display: grid; gap: 1.25rem; }
.project {
	background: #FFFFFF;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
}
.project .card-thumb { flex: none; }
.project .card-thumb img { border-radius: 0; }
.project .card-body { padding: 1rem 1.1rem 1.25rem; }
.card-excerpt { color: var(--muted); margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0 0 .75rem; padding: 0; }
.tags li {
	padding: .15rem .65rem;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--paper);
	color: var(--muted);
	font-size: .875rem;
}

/* ---------- Closing band ---------- */
.band {
	margin-block: 1rem 3rem;
	padding: 2.5rem 1.5rem;
	background: var(--ink);
	color: var(--paper);
	border-radius: 24px;
	text-align: center;
}
.band h2 { margin-bottom: 1.25rem; }

/* ---------- Pages, articles ---------- */
.page-head { padding-block: 2rem 1rem; }
.entry { padding-bottom: 3rem; }
.entry-meta { color: var(--muted); }
.entry-content { font-size: 1.125rem; }
.entry-content h2, .entry-content h3 { margin-top: 1.75em; }
.entry-content pre {
	overflow-x: auto;
	padding: 1rem;
	background: var(--ink);
	color: #EEF0F7;
	border-radius: 10px;
}
.entry-content pre code.hljs { padding: 0; background: transparent; }
.entry-content pre { line-height: 1.6; font-size: .95rem; }
.entry-content code { font-family: ui-monospace, Consolas, monospace; font-size: .95em; }
.entry-content :not(pre) > code { background: var(--line); padding: .1em .35em; border-radius: 4px; }
.entry-content blockquote {
	margin-inline: 0;
	padding-left: 1rem;
	border-left: 4px solid var(--saffron);
	color: var(--muted);
}
.entry-thumb { margin: 0 0 1.5rem; }
.entry-thumb img { display: block; border-radius: var(--radius); }

.post-nav {
	display: grid;
	gap: 1rem;
	margin-top: 2.5rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--line);
}
.post-nav a { font-weight: 600; }
.post-nav .next { text-align: left; }

.pagination { margin-top: 2rem; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: .5rem; }
.pagination .page-numbers {
	display: inline-block;
	min-width: 44px;
	min-height: 44px;
	padding: .6rem .9rem;
	border: 1px solid var(--line);
	border-radius: 10px;
	text-align: center;
	text-decoration: none;
}
.pagination .current { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.error-links { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 1.5rem; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; }
.site-footer p { margin: 0; }

/* ---------- Tablet and up ---------- */
@media (min-width: 640px) {
	:root { --gutter: 24px; }
	.site-header .wrap { flex-direction: row; align-items: center; justify-content: space-between; }
	.project-grid, .video-grid { grid-template-columns: repeat(2, 1fr); }
	.card-thumb { flex-basis: 128px; }
	.shorts-row li { flex-basis: 180px; }
	.band { padding: 3.5rem 2rem; }
	.post-nav { grid-template-columns: 1fr 1fr; }
	.post-nav .next { text-align: right; }
}

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
	.hero { padding-block: 4.5rem 5rem; }
	.hero-image { aspect-ratio: 4 / 3; }
	.hero-visual .code-card { margin: -4.5rem 0 0 -2.5rem; position: relative; }
	.hero .wrap { grid-template-columns: 1.1fr 1fr; align-items: center; gap: 3.5rem; }
	.code-card { box-shadow: 12px 12px 0 var(--saffron); margin-right: 12px; }
	.section { padding-block: 3.5rem; }
	.columns { grid-template-columns: 1fr 1fr; gap: 2.5rem; }
	.project-grid, .video-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { transition: none !important; animation: none !important; }
	.btn:hover { transform: none; }
}

/* ---------- Contact form ---------- */
.contact-form { margin-top: 2rem; padding: 1.25rem; background: #FFFFFF; border: 1px solid var(--line); border-radius: var(--radius); }
.contact-form label { display: block; margin-bottom: .35rem; font-weight: 600; }
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
	width: 100%;
	padding: .7rem .85rem;
	border: 1px solid #B9C3D3;
	border-radius: 8px;
	background: var(--paper);
	color: var(--ink);
	font: inherit;
}
.contact-form textarea { resize: vertical; }
.contact-form .hp { position: absolute; left: -9999px; }
.form-note { padding: .75rem 1rem; border-radius: 8px; font-weight: 500; }
.form-note-ok { background: #E3F4EA; color: #14532D; }
.form-note-bad { background: #FDE8E8; color: #7F1D1D; }
