/*
Theme Name: Paperbook
Theme URI: https://gurtejpalsingh.com
Author: Gurtejpal Singh
Author URI: https://gurtejpalsingh.com
Description: A minimalist, editorial blog theme for an advocate. Blog-first homepage, a Tools hub for embedded court-order downloaders, self-hosted serif typography and a light/dark toggle.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.8
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: paperbook
*/

/* ---------- Fonts (self-hosted, SIL OFL) ---------- */
@font-face {
	font-family: "Newsreader";
	src: url("assets/fonts/newsreader-latin-wght-normal.woff2") format("woff2");
	font-weight: 200 800;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Newsreader";
	src: url("assets/fonts/newsreader-latin-wght-italic.woff2") format("woff2");
	font-weight: 200 800;
	font-style: italic;
	font-display: swap;
}
@font-face {
	font-family: "Inter";
	src: url("assets/fonts/inter-latin-wght-normal.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
	--bg: #ffffff;
	--surface: #f6f5f2;
	--ink: #141414;
	--muted: #6a6a66;
	--rule: #e4e2dc;
	--accent: #7a1f2b;
	--accent-ink: #ffffff;
	--serif: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
	--sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	--measure: 42rem;
	--wide: 68rem;
	--gutter: clamp(1.25rem, 4vw, 2.5rem);
}
[data-theme="dark"] {
	--bg: #121211;
	--surface: #1b1b19;
	--ink: #ecebe6;
	--muted: #9c9a93;
	--rule: #2c2c29;
	--accent: #e3a3a9;
	--accent-ink: #121211;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--serif);
	font-size: 1.1875rem;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
img, video, iframe { max-width: 100%; }
img { height: auto; display: block; }
a { color: inherit; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.15; letter-spacing: -0.012em; margin: 0 0 0.5em; }
p { margin: 0 0 1.25em; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
::selection { background: var(--accent); color: var(--accent-ink); }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: var(--measure); margin-left: auto; margin-right: auto; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 0.5rem; left: 0.5rem; width: auto; height: auto; clip: auto; padding: 0.5rem 1rem; background: var(--ink); color: var(--bg); z-index: 100; font-family: var(--sans); font-size: 0.875rem; }

.label, .meta {
	font-family: var(--sans);
	font-size: 0.75rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
}
.meta a { text-decoration: none; }
.meta .sep { margin: 0 0.5em; opacity: 0.6; }
.label--accent, .meta .cat { color: var(--accent); }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 4.5rem; }
.brand { display: flex; flex-direction: column; text-decoration: none; line-height: 1.2; padding: 0.9rem 0; }
.brand:hover { color: inherit; }
.brand__name { font-size: 1.375rem; font-weight: 500; letter-spacing: -0.01em; }
.brand__cred { font-family: var(--sans); font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 0.2rem; }
.custom-logo { max-height: 44px; width: auto; }

.header-tools { display: flex; align-items: center; gap: 0.25rem; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.75rem; }
.site-nav a { font-family: var(--sans); font-size: 0.875rem; text-decoration: none; padding: 0.5rem 0; border-bottom: 1px solid transparent; }
.site-nav a:hover, .site-nav .current-menu-item > a, .site-nav .current_page_item > a { color: var(--ink); border-bottom-color: var(--accent); }
.site-nav .sub-menu { display: none; }

.icon-btn { appearance: none; background: none; border: 0; color: var(--ink); width: 2.5rem; height: 2.5rem; display: inline-grid; place-items: center; border-radius: 50%; cursor: pointer; margin-left: 0.75rem; }
.icon-btn:hover { background: var(--surface); }
.icon-btn svg { width: 1.125rem; height: 1.125rem; }
.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: block; }
.nav-toggle { display: none; margin-left: 0; }

@media (max-width: 760px) {
	.nav-toggle { display: inline-grid; }
	.site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--bg); border-bottom: 1px solid var(--rule); padding: 0.5rem var(--gutter) 1.25rem; z-index: 20; }
	.site-nav.is-open { display: block; }
	.site-nav ul { flex-direction: column; gap: 0; }
	.site-nav a { display: block; padding: 0.8rem 0; font-size: 1rem; border-bottom: 1px solid var(--rule); }
	.site-header { position: relative; }
}

/* ---------- Home ---------- */
.intro { padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem); }
.intro__text { font-size: clamp(1.75rem, 4.2vw, 2.875rem); line-height: 1.18; letter-spacing: -0.02em; font-weight: 400; max-width: 22em; margin: 0; }
.intro__text em { color: var(--accent); }

.featured { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; padding: clamp(1.5rem, 4vw, 3rem) 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); }
.featured--noimg { grid-template-columns: 1fr; }
.featured__media { display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--surface); }
.featured__media img { width: 100%; height: 100%; object-fit: cover; }
.featured__title { font-size: clamp(1.875rem, 4vw, 2.75rem); margin: 0.75rem 0 0.75rem; }
.featured__title a { text-decoration: none; }
.featured__excerpt { color: var(--muted); margin-bottom: 1.25rem; }
.more-link { font-family: var(--sans); font-size: 0.875rem; font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--accent); padding-bottom: 2px; }
@media (max-width: 760px) { .featured { grid-template-columns: 1fr; } }

.section { padding: clamp(2.5rem, 6vw, 4rem) 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--ink); }
.section__title { font-size: 1.5rem; margin: 0; }
.section__link { font-family: var(--sans); font-size: 0.8125rem; text-decoration: none; color: var(--muted); }

/* Article rows */
.entry-row { display: grid; grid-template-columns: 8.5rem 1fr auto; gap: 1.5rem; padding: 1.75rem 0; border-bottom: 1px solid var(--rule); align-items: start; }
.entry-row__date { padding-top: 0.45rem; }
.entry-row__title { font-size: 1.625rem; margin: 0 0 0.4rem; }
.entry-row__title a { text-decoration: none; }
.entry-row__excerpt { color: var(--muted); font-size: 1.0625rem; margin: 0 0 0.6rem; max-width: 38em; }
.entry-row__thumb { width: 8.5rem; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface); display: block; }
.entry-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 760px) {
	.entry-row { grid-template-columns: 1fr; gap: 0.4rem; padding: 1.5rem 0; }
	.entry-row__thumb { display: none; }
	.entry-row__date { padding-top: 0; }
	.entry-row__title { font-size: 1.4375rem; }
}

/* Tool cards */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); margin-top: 1.5rem; }
.tool-card { background: var(--bg); padding: 1.5rem; display: flex; flex-direction: column; text-decoration: none; min-height: 11rem; transition: background 0.15s ease; }
.tool-card:hover { background: var(--surface); color: inherit; }
.tool-card__title { font-size: 1.375rem; margin: 0.6rem 0 0.5rem; }
.tool-card__desc { color: var(--muted); font-size: 1rem; line-height: 1.5; margin: 0 0 1.25rem; }
.tool-card__go { margin-top: auto; font-family: var(--sans); font-size: 0.8125rem; font-weight: 500; color: var(--accent); }

/* Pagination */
.pagination, .post-nav { font-family: var(--sans); font-size: 0.875rem; padding: 2rem 0 0; }
.pagination .nav-links { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pagination .page-numbers { padding: 0.45rem 0.85rem; border: 1px solid var(--rule); text-decoration: none; }
.pagination .page-numbers.current { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Page heads ---------- */
.page-head { padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(1.5rem, 3vw, 2.25rem); }
.page-head__title { font-size: clamp(2.125rem, 5vw, 3.25rem); margin: 0.6rem 0 0; }
.page-head__lede { color: var(--muted); font-size: 1.25rem; margin: 1rem 0 0; max-width: 36em; }
.page-head--center { text-align: left; }

/* ---------- Single ---------- */
.post-head { padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(1.5rem, 4vw, 2.5rem); }
.post-head__title { font-size: clamp(2.25rem, 5.6vw, 3.5rem); margin: 1rem 0 1.25rem; letter-spacing: -0.022em; }
.post-hero { margin: 0 auto clamp(2rem, 5vw, 3.5rem); }
.post-hero img { width: 100%; }
.post-hero figcaption { font-family: var(--sans); font-size: 0.8125rem; color: var(--muted); margin-top: 0.5rem; }

.prose { font-size: 1.25rem; line-height: 1.7; }
.prose > * { max-width: var(--measure); margin-left: auto; margin-right: auto; }
.prose > .alignwide { max-width: var(--wide); }
.prose > .alignfull { max-width: none; }
.prose h2 { font-size: 1.875rem; margin: 2.25em auto 0.6em; }
.prose h3 { font-size: 1.5rem; margin: 2em auto 0.5em; }
.prose h4 { font-family: var(--sans); font-size: 0.875rem; letter-spacing: 0.08em; text-transform: uppercase; margin: 2em auto 0.75em; }
.prose a { color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.4em; margin-top: 0; margin-bottom: 1.25em; }
.prose li { margin-bottom: 0.4em; }
.prose blockquote { border-left: 2px solid var(--accent); margin-top: 2em; margin-bottom: 2em; padding: 0.1em 0 0.1em 1.25em; font-style: italic; font-size: 1.375rem; line-height: 1.5; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose blockquote cite { display: block; font-family: var(--sans); font-style: normal; font-size: 0.8125rem; color: var(--muted); margin-top: 0.75rem; }
.prose figure { margin-top: 2em; margin-bottom: 2em; }
.prose figcaption { font-family: var(--sans); font-size: 0.8125rem; color: var(--muted); margin-top: 0.5rem; text-align: left; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85em; background: var(--surface); padding: 0.1em 0.35em; }
.prose pre { background: var(--surface); padding: 1.25rem; overflow-x: auto; font-size: 0.9375rem; line-height: 1.55; }
.prose pre code { background: none; padding: 0; }
.prose table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: 0.9375rem; }
.prose th, .prose td { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--rule); }
.prose th { border-bottom-color: var(--ink); font-weight: 600; }
.prose sup { font-family: var(--sans); font-size: 0.7em; }
.prose .wp-block-button__link, .btn {
	display: inline-block; font-family: var(--sans); font-size: 0.875rem; font-weight: 500;
	background: var(--ink); color: var(--bg); padding: 0.8rem 1.4rem; border-radius: 0; text-decoration: none; border: 1px solid var(--ink); cursor: pointer;
}
.prose .wp-block-button__link:hover, .btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--ghost { background: transparent; color: var(--ink); }
.alignleft { float: left; margin: 0.4em 1.5em 1em 0; }
.alignright { float: right; margin: 0.4em 0 1em 1.5em; }
.aligncenter { margin-left: auto; margin-right: auto; }

.post-foot { margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem; }
.tags a { font-family: var(--sans); font-size: 0.75rem; text-decoration: none; border: 1px solid var(--rule); padding: 0.3rem 0.7rem; color: var(--muted); }
.tags a:hover { border-color: var(--accent); color: var(--accent); }
.byline-note { font-style: italic; color: var(--muted); font-size: 1.0625rem; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; border-top: 1px solid var(--ink); margin-top: 2.5rem; padding-top: 1.5rem; }
.post-nav a { text-decoration: none; font-family: var(--serif); font-size: 1.25rem; line-height: 1.3; display: block; margin-top: 0.4rem; }
.post-nav .next { text-align: right; }
@media (max-width: 600px) { .post-nav { grid-template-columns: 1fr; } .post-nav .next { text-align: left; } }

/* ---------- Tool page ---------- */
.tool-frame { border: 1px solid var(--rule); background: #fff; margin: 0 0 1rem; }
.tool-frame iframe { display: block; width: 100%; border: 0; }
.tool-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem 1.5rem; font-family: var(--sans); font-size: 0.8125rem; color: var(--muted); margin-bottom: 3rem; }
.tool-bar a { color: var(--accent); text-decoration: none; font-weight: 500; }

/* ---------- Comments & forms ---------- */
.comments { margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--ink); }
.comments__title { font-size: 1.5rem; }
.comment-list, .comment-list .children { list-style: none; margin: 0; padding: 0; }
.comment-list .children { padding-left: 1.5rem; border-left: 1px solid var(--rule); }
.comment-body { padding: 1.5rem 0; border-bottom: 1px solid var(--rule); font-size: 1.0625rem; }
.comment-meta { font-family: var(--sans); font-size: 0.8125rem; color: var(--muted); margin-bottom: 0.75rem; }
.comment-meta .avatar { display: none; }
.comment-meta .fn { color: var(--ink); font-weight: 600; font-style: normal; }
.comment-meta a { text-decoration: none; }
.reply a { font-family: var(--sans); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); text-decoration: none; }

label { font-family: var(--sans); font-size: 0.8125rem; color: var(--muted); display: block; margin-bottom: 0.35rem; }
input[type="text"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="number"], input[type="password"], textarea, select {
	width: 100%; font-family: var(--sans); font-size: 1rem; color: var(--ink); background: var(--bg);
	border: 1px solid var(--rule); border-radius: 0; padding: 0.75rem 0.9rem;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ink); }
input[type="submit"], button[type="submit"], .wp-block-search__button {
	font-family: var(--sans); font-size: 0.875rem; font-weight: 500; background: var(--ink); color: var(--bg);
	border: 1px solid var(--ink); padding: 0.8rem 1.4rem; border-radius: 0; cursor: pointer;
}
input[type="submit"]:hover, button[type="submit"]:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.search-form { display: flex; gap: 0.5rem; max-width: 30rem; }
.search-form label { flex: 1; margin: 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--ink); margin-top: clamp(3rem, 8vw, 6rem); padding: clamp(2.5rem, 6vw, 4rem) 0 2rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2.5rem; }
.footer-brand__name { font-size: 1.375rem; font-weight: 500; margin: 0 0 0.25rem; }
.footer-brand p { color: var(--muted); font-size: 1rem; margin: 0 0 0.5rem; max-width: 22em; }
.footer-col h2 { font-family: var(--sans); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0.4rem 0 0.9rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 0.45rem; }
.footer-col a { font-family: var(--sans); font-size: 0.875rem; text-decoration: none; }
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 0.75rem; color: var(--muted); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
@media print {
	.site-header, .site-footer, .post-nav, .comments, .tool-frame, .icon-btn { display: none !important; }
	body { font-size: 12pt; color: #000; background: #fff; }
}
