/*
Theme Name: Tingjpg
Theme URI: https://tingjpg.com
Description: Lightweight tool theme for tingjpg.com. In-browser JPG and PNG compressor on the front page, clean blog templates everywhere else.
Version: 1.0.0
Requires at least: 6.5
Requires PHP: 8.0
License: GPL-2.0-or-later
Text Domain: tingjpg
*/

@font-face {
	font-family: "Geist";
	src: url("assets/fonts/Geist-Variable.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
}

:root {
	--bg: #F5F7FA;
	--surface: #FFFFFF;
	--ink: #121826;
	--muted: #566173;
	--line: #DDE2EA;
	--accent: #2250E8;
	--accent-hover: #1A40C4;
	--accent-soft: #E8EEFF;
	--accent-ink: #FFFFFF;
	--danger: #B42318;
	--font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
	--r-sm: 6px;
	--r-md: 12px;
	--r-lg: 20px;
	--wrap: 1160px;
	--gutter: clamp(16px, 4vw, 32px);
	--shadow: 0 1px 2px rgba(18, 24, 38, .04), 0 12px 32px -12px rgba(34, 52, 92, .18);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
:where(html) { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
:where(body, h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd) { margin: 0; }
:where(ul, ol)[class] { list-style: none; padding: 0; }
:where(img, svg, video) { display: block; max-width: 100%; height: auto; }
:where(button, input, select, textarea) { font: inherit; color: inherit; }
@media (prefers-reduced-motion: reduce) {
	:where(html) { scroll-behavior: auto; }
	*, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	font-feature-settings: "tnum" 1;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}
.site-main { flex: 1; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.screen-reader-text, .sr-only {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link:focus {
	position: fixed !important; top: 8px; left: 8px; width: auto; height: auto; clip: auto; clip-path: none;
	z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: var(--r-sm);
}

.wrap { width: 100%; max-width: calc(var(--wrap) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }

h1, h2, h3, h4 { font-weight: 650; line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); letter-spacing: -0.035em; line-height: 1.05; }
h2 { font-size: clamp(1.6rem, 2.8vw, 2.25rem); letter-spacing: -0.03em; }
h3 { font-size: 1.125rem; letter-spacing: -0.01em; }

/* Buttons */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 40px; padding: 0 16px; border-radius: var(--r-sm);
	border: 1px solid transparent; font-size: 15px; font-weight: 550; line-height: 1;
	text-decoration: none; cursor: pointer; white-space: nowrap;
	transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-line { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-line:hover { border-color: var(--ink); color: var(--ink); }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* Header */
.site-header {
	position: sticky; top: 0; z-index: 20;
	background: rgba(245, 247, 250, .86);
	backdrop-filter: saturate(160%) blur(10px);
	-webkit-backdrop-filter: saturate(160%) blur(10px);
	border-bottom: 1px solid var(--line);
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: -0.03em; }
.brand:hover { color: var(--ink); }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand b { color: var(--accent); font-weight: 700; }

.site-nav ul { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.site-nav a {
	display: block; padding: 8px 12px; border-radius: var(--r-sm);
	color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500;
}
.site-nav a:hover, .site-nav .current-menu-item > a, .site-nav .current_page_parent > a { color: var(--ink); background: rgba(18, 24, 38, .05); }
.nav-toggle {
	display: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: var(--r-sm);
	background: var(--surface); cursor: pointer; align-items: center; justify-content: center;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
	display: block; width: 16px; height: 1.5px; background: var(--ink); position: relative; transition: transform .15s;
}
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; }
.nav-toggle span::before { top: -5px; }
.nav-toggle span::after { top: 5px; }
.nav-open .nav-toggle span { background: transparent; }
.nav-open .nav-toggle span::before { transform: translateY(5px) rotate(45deg); }
.nav-open .nav-toggle span::after { transform: translateY(-5px) rotate(-45deg); }

@media (max-width: 720px) {
	.nav-toggle { display: inline-flex; }
	.site-nav {
		position: absolute; top: 100%; left: 0; right: 0; display: none;
		background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px var(--gutter) 16px;
	}
	.nav-open .site-nav { display: block; }
	.site-nav ul { flex-direction: column; align-items: stretch; }
	.site-nav a { padding: 12px; font-size: 16px; }
}

/* Hero + tool */
.hero { padding: clamp(40px, 7vw, 88px) 0 clamp(32px, 5vw, 56px); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.hero-copy p { margin-top: 20px; max-width: 30em; font-size: clamp(1.05rem, 1.4vw, 1.18rem); color: var(--muted); }

.tool {
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
	box-shadow: var(--shadow); padding: 12px;
}
.drop {
	position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
	gap: 10px; min-height: 260px; padding: 32px 24px; text-align: center; cursor: pointer;
	border: 1.5px dashed #C3CBD8; border-radius: var(--r-md); background: #FAFBFD;
	transition: border-color .15s, background-color .15s;
}
.drop:hover, .drop.is-over, .drop:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-icon {
	width: 52px; height: 52px; border-radius: 14px; background: var(--accent); color: var(--accent-ink);
	display: grid; place-items: center; margin-bottom: 6px;
}
.drop-icon svg { width: 24px; height: 24px; }
.drop strong { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.drop > span:not(.drop-icon) { font-size: 14px; color: var(--muted); }
.drop kbd { font: inherit; font-size: 12px; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); }
.drop small { font-size: 13px; color: var(--muted); }
@media (hover: none) { .paste-hint { display: none; } }

.tool-settings { display: flex; align-items: center; gap: 16px; padding: 14px 8px 4px; }
.tool-settings label { font-size: 14px; font-weight: 550; white-space: nowrap; }
.tool-settings output { min-width: 3ch; font-size: 14px; font-weight: 600; text-align: right; }
.tool-settings .hint { font-size: 13px; color: var(--muted); white-space: nowrap; }
input[type="range"] { flex: 1; accent-color: var(--accent); height: 20px; cursor: pointer; }

/* Results */
.results { padding-bottom: clamp(40px, 6vw, 72px); scroll-margin-top: 80px; }
.results[hidden] { display: none; }
.results-head {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
	padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
	border-radius: var(--r-md) var(--r-md) 0 0;
}
.summary { font-size: 15px; color: var(--muted); }
.summary strong { color: var(--ink); font-weight: 650; }
.summary .gain { color: var(--accent); }
.results-actions { display: flex; gap: 8px; }
.rows { background: var(--surface); border: 1px solid var(--line); border-radius: 0 0 var(--r-md) var(--r-md); }
.row {
	display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto auto; align-items: center; gap: 16px;
	padding: 12px 20px; border-top: 1px solid var(--line); font-size: 14px;
}
.row:first-child { border-top: 0; }
.row-thumb { width: 44px; height: 44px; border-radius: 8px; background: var(--bg); overflow: hidden; border: 1px solid var(--line); }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-name { min-width: 0; }
.row-name b { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-bar { display: block; height: 4px; margin-top: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.row-bar[hidden] { display: none; }
.row-bar i { display: block; height: 100%; width: 40%; background: var(--accent); border-radius: 4px; animation: tj-bar 1.1s ease-in-out infinite; }
@keyframes tj-bar { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.row-note { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.row-sizes { color: var(--muted); white-space: nowrap; }
.row-sizes s { text-decoration-color: rgba(86, 97, 115, .6); }
.row-sizes em { font-style: normal; color: var(--ink); font-weight: 550; }
.row-saved { min-width: 4.5ch; text-align: right; font-weight: 650; color: var(--accent); white-space: nowrap; }
.row-dl { min-height: 34px; padding: 0 12px; font-size: 14px; }
.row[data-state="error"] .row-note { color: var(--danger); }
.row[data-state="working"] .row-saved, .row[data-state="working"] .row-dl,
.row[data-state="error"] .row-dl, .row[data-state="error"] .row-saved { visibility: hidden; }

@media (max-width: 640px) {
	.row { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 16px; }
	.row-thumb { grid-row: span 2; }
	.row-sizes { grid-column: 2; grid-row: 2; font-size: 13px; }
	.row-saved { grid-column: 3; grid-row: 1; }
	.row-dl { grid-column: 3; grid-row: 2; }
	.results-head { padding: 14px 16px; }
}

/* Sections */
.section { padding: clamp(56px, 8vw, 104px) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { max-width: 40rem; margin-bottom: clamp(28px, 4vw, 48px); }
.section-head p { margin-top: 12px; color: var(--muted); font-size: 17px; }

/* Bento */
.bento { display: grid; grid-template-columns: 1.1fr 1fr 1fr; grid-template-rows: auto auto; gap: 12px; }
.cell {
	border-radius: var(--r-md); padding: clamp(20px, 2.6vw, 32px);
	background: var(--surface); border: 1px solid var(--line);
	display: flex; flex-direction: column; gap: 8px;
}
.cell p { color: var(--muted); font-size: 15px; }
.cell-lead { grid-row: span 2; background: var(--ink); border-color: var(--ink); color: #EEF1F6; justify-content: space-between; min-height: 340px; }
.cell-lead p { color: #A9B2C3; max-width: 26em; }
.cell-lead .big { font-size: clamp(4rem, 9vw, 7rem); font-weight: 650; letter-spacing: -0.06em; line-height: .9; color: #FFFFFF; }
.cell-lead .big small { font-size: .32em; letter-spacing: -0.02em; color: #8FA6FF; margin-left: 6px; }
.cell-wide { grid-column: span 2; background: var(--accent-soft); border-color: #D4DEFF; flex-direction: row; align-items: center; justify-content: space-between; gap: 24px; }
.cell-wide .formats { display: flex; gap: 8px; flex-wrap: wrap; }
.cell-wide .formats span {
	padding: 6px 12px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid #D4DEFF;
	font-size: 14px; font-weight: 600; color: var(--accent);
}
.cell-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--bg); display: grid; place-items: center; color: var(--ink); margin-bottom: 8px; }
.cell-icon svg { width: 18px; height: 18px; }

@media (max-width: 900px) {
	.bento { grid-template-columns: 1fr 1fr; }
	.cell-lead { grid-row: auto; grid-column: span 2; min-height: 0; gap: 24px; }
	.cell-wide { grid-column: span 2; }
}
@media (max-width: 560px) {
	.bento { grid-template-columns: 1fr; }
	.cell-lead, .cell-wide { grid-column: auto; }
	.cell-wide { flex-direction: column; align-items: flex-start; }
}

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; counter-reset: step; }
.steps li { border-top: 2px solid var(--ink); padding-top: 20px; counter-increment: step; }
.steps li::before { content: counter(step); display: block; font-size: 14px; font-weight: 650; color: var(--accent); margin-bottom: 12px; }
.steps p { margin-top: 8px; color: var(--muted); font-size: 15px; max-width: 30em; }
@media (max-width: 720px) { .steps { grid-template-columns: 1fr; gap: 28px; } }

/* FAQ */
.faq { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr); gap: clamp(28px, 6vw, 96px); align-items: start; }
.faq .section-head { margin-bottom: 0; position: sticky; top: 96px; }
.faq-list { border-top: 1px solid var(--line); }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list summary {
	display: flex; justify-content: space-between; align-items: center; gap: 16px;
	padding: 20px 0; cursor: pointer; list-style: none; font-weight: 600; font-size: 17px; letter-spacing: -0.01em;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
	content: ""; flex: none; width: 10px; height: 10px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
	transform: rotate(45deg) translateY(-3px); transition: transform .15s;
}
.faq-list details[open] summary::after { transform: rotate(-135deg) translateY(-3px); }
.faq-list details p { padding: 0 0 20px; color: var(--muted); max-width: 40em; }
@media (max-width: 820px) {
	.faq { grid-template-columns: 1fr; }
	.faq .section-head { position: static; }
}

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); font-size: 14px; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; padding-block: 28px; }
.footer-brand { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer-brand .brand { font-size: 16px; }
.footer-brand .brand svg { width: 22px; height: 22px; }
.footer-nav ul { display: flex; flex-wrap: wrap; gap: 4px 20px; list-style: none; margin: 0; padding: 0; }
.footer-nav a { color: var(--muted); text-decoration: none; }
.footer-nav a:hover { color: var(--ink); }

/* Blog and pages */
.page-head { padding: clamp(40px, 6vw, 72px) 0 clamp(24px, 3vw, 40px); }
.page-head p { margin-top: 12px; color: var(--muted); font-size: 17px; max-width: 40rem; }
.post-list { display: grid; gap: 0; border-top: 1px solid var(--line); margin-bottom: clamp(48px, 7vw, 96px); }
.post-item { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 24px; padding: 28px 0; border-bottom: 1px solid var(--line); }
.post-item time { font-size: 14px; color: var(--muted); padding-top: 4px; }
.post-item h2 { font-size: clamp(1.3rem, 2vw, 1.6rem); }
.post-item h2 a { color: var(--ink); text-decoration: none; }
.post-item h2 a:hover { color: var(--accent); }
.post-item p { margin-top: 8px; color: var(--muted); max-width: 42rem; }
@media (max-width: 640px) { .post-item { grid-template-columns: 1fr; gap: 6px; } }

.entry-head { max-width: 720px; margin-inline: auto; }
.entry { max-width: 720px; margin-inline: auto; padding-bottom: clamp(48px, 7vw, 96px); }
.entry-meta { margin-top: 14px; font-size: 14px; color: var(--muted); }
.entry-thumb { margin: 0 0 32px; border-radius: var(--r-md); overflow: hidden; }
.entry-content { font-size: 17.5px; line-height: 1.7; }
.entry-content > * + * { margin-top: 1.15em; }
.entry-content h2 { font-size: 1.6rem; margin-top: 1.8em; }
.entry-content h3 { font-size: 1.25rem; margin-top: 1.6em; }
.entry-content img { border-radius: var(--r-md); }
.entry-content blockquote { border-left: 3px solid var(--accent); padding: 4px 0 4px 20px; color: var(--muted); }
.entry-content pre, .entry-content code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .9em; }
.entry-content pre { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; overflow: auto; }
.entry-content :where(ul, ol) { padding-left: 1.3em; }

.pagination { margin: -40px 0 80px; }
.pagination .nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.pagination .page-numbers { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); text-decoration: none; }
.pagination .current { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }

.comments { max-width: 720px; margin: 0 auto clamp(48px, 7vw, 96px); padding-top: 32px; border-top: 1px solid var(--line); }
.comments h2 { font-size: 1.4rem; margin-bottom: 20px; }
.comment-list { list-style: none; padding: 0; }
.comment-list .comment { padding: 16px 0; border-bottom: 1px solid var(--line); }
.comment-meta { font-size: 14px; color: var(--muted); }
.comment-form p { margin-top: 12px; }
.comment-form label { display: block; font-size: 14px; font-weight: 550; margin-bottom: 4px; }
.comment-form :where(input[type="text"], input[type="email"], input[type="url"], textarea) {
	width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
}
.comment-form .submit { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--r-sm); padding: 10px 16px; font-weight: 550; cursor: pointer; }

.not-found { text-align: center; padding: clamp(72px, 12vw, 160px) 0; }
.not-found p { margin: 12px auto 28px; color: var(--muted); max-width: 30rem; }

@media (max-width: 900px) {
	.hero .wrap { grid-template-columns: 1fr; gap: 28px; }
	.hero { padding-top: 32px; }
	.drop { min-height: 200px; }
}
@media (max-width: 480px) {
	.tool-settings { flex-wrap: wrap; gap: 8px 12px; }
	.tool-settings input[type="range"] { flex-basis: 100%; order: 3; }
	.tool-settings .hint { order: 4; }
}
