/*
Theme Name: Searchbeam
Description: Lightweight news theme for searchbeam.co. Bilingual (Polylang), static-export friendly.
Version: 0.3.0
Requires PHP: 8.0
Text Domain: searchbeam
*/

@font-face {
	font-family: "Inter";
	src: url("fonts/inter-latin.woff2") format("woff2");
	font-weight: 100 900;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Inter";
	src: url("fonts/inter-latin-ext.woff2") format("woff2");
	font-weight: 100 900;
	font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
	--bg: #ffffff;
	--bg-soft: #f7f7f8;
	--card: #ffffff;
	--text: #0b0f17;
	--text-2: #3b4351;
	--muted: #6b7280;
	--line: #e7e8ec;
	--accent: #f2541b;
	--accent-ink: #c2410c;
	--accent-soft: #fff3ec;
	--grad: linear-gradient(120deg, #ff8a1f 0%, #e5344e 100%);
	--shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
	--radius: 16px;
	--maxw: 1160px;
	--readw: 720px;
	--font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0a0d13;
		--bg-soft: #10141c;
		--card: #121722;
		--text: #eef1f6;
		--text-2: #c4cad4;
		--muted: #8b93a1;
		--line: #222936;
		--accent: #ff7a3d;
		--accent-ink: #ff9a66;
		--accent-soft: #2a160c;
		--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
		color-scheme: dark;
	}
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 400 17px/1.65 var(--font);
	font-feature-settings: "cv11", "ss01";
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 18px; } }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; background: var(--bg); padding: 8px 12px; z-index: 50; }

/* ---------- Header ---------- */
.site-header {
	position: sticky; top: 0; z-index: 20;
	background: color-mix(in srgb, var(--bg) 82%, transparent);
	backdrop-filter: saturate(180%) blur(14px);
	-webkit-backdrop-filter: saturate(180%) blur(14px);
	border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 28px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 21px; letter-spacing: -0.035em; }
.brand svg { width: 32px; height: 32px; flex: none; border-radius: 9px; }
.brand .beam, .grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { font-size: 15px; font-weight: 500; color: var(--text-2); white-space: nowrap; padding: 7px 12px; border-radius: 999px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--bg-soft); color: var(--text); }
.nav a.is-current { background: var(--accent-soft); color: var(--accent-ink); }
.lang { display: flex; padding: 3px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; font-weight: 650; }
.lang a { padding: 4px 10px; border-radius: 999px; color: var(--muted); }
.lang a.is-current { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

@media (max-width: 820px) {
	.site-header .wrap { flex-wrap: wrap; height: auto; padding-top: 12px; gap: 0 12px; }
	.lang { margin-left: auto; }
	.nav { order: 3; width: calc(100% + 36px); margin: 8px -18px 0; padding: 0 14px 10px; }
}

/* ---------- Category colors (match cover images) ---------- */
.cat-seo    { --c: #059669; --c-soft: #e7f8f1; --c-grad: linear-gradient(120deg, #34d399, #14b8a6); }
.cat-ai     { --c: #7c3aed; --c-soft: #f1ebff; --c-grad: linear-gradient(120deg, #a78bfa, #ec4899); }
.cat-google { --c: #2563eb; --c-soft: #e8f0ff; --c-grad: linear-gradient(120deg, #60a5fa, #22d3ee); }
.cat-dm     { --c: #c2410c; --c-soft: #fff3ec; --c-grad: linear-gradient(120deg, #ff8a1f, #e5344e); }
@media (prefers-color-scheme: dark) {
	.cat-seo    { --c: #6ee7b7; --c-soft: #0b2a20; }
	.cat-ai     { --c: #c4b5fd; --c-soft: #1e1536; }
	.cat-google { --c: #93c5fd; --c-soft: #0f1f3a; }
	.cat-dm     { --c: #ff9a66; --c-soft: #2a160c; }
}
.cat-seo .chip, .cat-ai .chip, .cat-google .chip, .cat-dm .chip,
.chip.cat-seo, .chip.cat-ai, .chip.cat-google, .chip.cat-dm { color: var(--c); background: var(--c-soft); }
.cat-seo .chip::before, .cat-ai .chip::before, .cat-google .chip::before, .cat-dm .chip::before,
.chip.cat-seo::before, .chip.cat-ai::before, .chip.cat-google::before, .chip.cat-dm::before { background: var(--c-grad); }
.topic[class*="cat-"] { position: relative; overflow: hidden; }
.topic[class*="cat-"]::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c-grad); }
.topic[class*="cat-"] .count { color: var(--c); }
.lead[class*="cat-"]::after { background: var(--c-grad); }

/* ---------- Shared bits ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; letter-spacing: .02em; color: var(--accent-ink); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--grad); }
.meta { font-size: 13.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.meta .dot::before { content: "·"; }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 18px; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 72px 0 56px; }
main { overflow-x: clip; }
.hero::before {
	content: ""; position: absolute; inset: -40% -10% auto auto; width: 720px; height: 720px; z-index: -1;
	background: radial-gradient(closest-side, rgba(255, 122, 31, .22), rgba(229, 52, 78, .10) 55%, transparent 72%);
	filter: blur(10px);
}
@media (max-width: 700px) {
	.hero { padding: 48px 0 40px; }
	.hero::before { inset: -120px -200px auto auto; width: 460px; height: 460px; filter: none; }
}
.hero h1, .lead h2, .article-head h1, .page-head h1 { text-wrap: balance; }
.hero h1 { font-size: clamp(38px, 6.4vw, 68px); line-height: 1.02; letter-spacing: -0.045em; font-weight: 780; margin: 18px 0 20px; max-width: 900px; }
.hero p { font-size: clamp(18px, 2.1vw, 21px); color: var(--text-2); max-width: 640px; margin: 0; line-height: 1.55; }
.hero-points { display: flex; gap: 10px 22px; flex-wrap: wrap; margin-top: 28px; font-size: 15px; color: var(--text-2); }
.hero-points span::before { content: "✓"; color: var(--accent); font-weight: 700; margin-right: 7px; }

/* ---------- Topic cards ---------- */
.topics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding-bottom: 64px; }
@media (max-width: 960px) { .topics { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .topics { grid-template-columns: 1fr; } }
.topic { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; transition: transform .15s, box-shadow .15s, border-color .15s; display: flex; flex-direction: column; gap: 8px; }
.topic:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: transparent; }
.topic h3 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.topic p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.topic .count { margin-top: auto; padding-top: 8px; font-size: 13px; font-weight: 600; color: var(--accent-ink); }

/* ---------- Story cards ---------- */
.stories { padding-bottom: 72px; }
.lead { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: clamp(24px, 4vw, 40px); margin-bottom: 20px; position: relative; overflow: hidden; transition: box-shadow .15s; }
.lead::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--grad); }
.lead:hover { box-shadow: var(--shadow); }
.lead.has-img { display: grid; grid-template-columns: 1.05fr 1fr; gap: 32px; align-items: center; }
.lead-img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; }
@media (max-width: 900px) { .lead.has-img { grid-template-columns: 1fr; gap: 20px; } }
.lead h2 { font-size: clamp(26px, 3.6vw, 40px); line-height: 1.12; letter-spacing: -0.035em; margin: 14px 0 12px; max-width: 880px; }
.lead p { font-size: 18px; color: var(--text-2); margin: 0 0 16px; max-width: 760px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; list-style: none; margin: 0; padding: 0; }
@media (max-width: 960px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s, border-color .15s; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: transparent; }
.card-img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-bottom: 1px solid var(--line); }
.card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card h3 { margin: 4px 0 0; font-size: 19px; line-height: 1.3; letter-spacing: -0.02em; }
.card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.card .meta { margin-top: auto; padding-top: 6px; }

.empty-note { display: flex; gap: 14px; align-items: center; padding: 20px 24px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: 15px; }
.empty-note .pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--grad); flex: none; box-shadow: 0 0 0 0 rgba(242, 84, 27, .5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(242, 84, 27, 0); } 100% { box-shadow: 0 0 0 0 rgba(242, 84, 27, 0); } }
@media (prefers-reduced-motion: reduce) { .empty-note .pulse { animation: none; } .card, .topic { transition: none; } }

/* ---------- Archive head ---------- */
.page-head { padding: 56px 0 32px; }
.page-head h1 { margin: 14px 0 10px; font-size: clamp(32px, 4.6vw, 48px); letter-spacing: -0.04em; line-height: 1.08; }
.page-head p { margin: 0; color: var(--text-2); font-size: 18px; max-width: 680px; }

/* Pagination */
.pagination { display: flex; gap: 8px; padding: 32px 0 0; font-size: 15px; }
.pagination a, .pagination span { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; }
.pagination .current { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- Article ---------- */
.article { max-width: var(--readw); margin: 0 auto; padding: 56px 0 72px; }
.article-head h1 { font-size: clamp(32px, 5vw, 48px); line-height: 1.1; letter-spacing: -0.04em; margin: 16px 0 16px; font-weight: 760; }
.article-cover { margin: 28px 0 0; }
.article-cover img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: var(--radius); }
.tldr-box { margin: 32px 0 12px; padding: 20px 22px; background: var(--accent-soft); border-radius: var(--radius); font-size: 16.5px; line-height: 1.6; position: relative; }
.tldr-box strong { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }
.tldr-box strong span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.prose { font-size: 18.5px; line-height: 1.75; color: var(--text-2); }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose figure { margin: 0 0 1.15em; }
.prose strong { color: var(--text); }
.prose h2 { color: var(--text); font-size: 25px; line-height: 1.3; letter-spacing: -0.025em; margin: 1.9em 0 .55em; }
.prose h3 { color: var(--text); font-size: 20px; letter-spacing: -0.015em; margin: 1.5em 0 .4em; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: .45em; }
.prose li::marker { color: var(--accent); }
.prose a { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.prose a:hover { color: var(--accent-ink); }
.prose blockquote { padding-left: 18px; border-left: 3px solid var(--accent); }
.prose h2:last-of-type + ul { font-size: 15.5px; padding: 18px 18px 18px 36px; background: var(--bg-soft); border-radius: 12px; }

.article-foot { margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--line); }
.tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tags a { font-size: 13px; font-weight: 500; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-2); }
.tags a:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Author ---------- */
.avatar { width: 56px; height: 56px; flex: none; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 750; font-size: 22px; }
.author-head { display: flex; gap: 24px; align-items: flex-start; }
.author-head .avatar { width: 88px; height: 88px; font-size: 36px; margin-top: 6px; }
.author-links { display: flex; gap: 16px; margin-top: 12px !important; font-size: 15px; }
.author-links a { color: var(--accent-ink); font-weight: 600; }
.author-box { display: flex; gap: 16px; align-items: flex-start; padding: 20px; background: var(--bg-soft); border-radius: var(--radius); margin-bottom: 20px; }
.author-box p { margin: 4px 0 0; font-size: 15px; color: var(--muted); line-height: 1.55; }
.pub-dates { margin: 0 0 14px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pub-dates .dot::before { content: "·"; margin-right: 2px; }
.author-mini { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 18px; }
.author-mini .avatar { width: 28px; height: 28px; font-size: 13px; margin-top: 1px; }
.author-mini p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.author-mini strong { color: var(--text); margin-right: 4px; }
.author-mini .author-link { color: var(--accent-ink); font-weight: 600; margin-left: 4px; white-space: nowrap; }
.byline { color: var(--text-2); font-weight: 600; }
.byline:hover { color: var(--accent-ink); }
@media (max-width: 600px) { .author-head { flex-direction: column; gap: 12px; } .author-head .avatar { width: 64px; height: 64px; font-size: 26px; } }

/* ---------- Static pages ---------- */
.page-body { max-width: var(--readw); margin: 0 auto; padding: 56px 0 72px; }
.page-body h1 { font-size: clamp(34px, 5vw, 48px); letter-spacing: -0.04em; line-height: 1.1; margin: 0 0 24px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); padding: 48px 0 40px; font-size: 14.5px; color: var(--muted); }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr; gap: 24px; } }
.foot-grid h2 { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text); margin: 0 0 12px; }
.foot-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.foot-grid a:hover { color: var(--text); }
.foot-about p { margin: 12px 0 0; max-width: 360px; line-height: 1.6; }
.foot-bottom { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; }
