/*
Theme Name: RailWatts
Theme URI: https://railwatts.com/
Author: RailWatts
Description: Lightweight blog theme for a plug-in and balcony solar website. Card-based archives, sidebar with archives and categories, built-in AdSense placements, savings calculator shortcode and table of contents.
Version: 1.0.0
Requires at least: 6.0
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: railwatts
*/

:root {
	--navy: #14213d;
	--navy-2: #1f3158;
	--amber: #e09f1f;
	--amber-soft: #fff6e3;
	--teal: #2a7f62;
	--teal-soft: #e8f4ef;
	--ink: #1e2430;
	--muted: #5b6573;
	--line: #e3e7ee;
	--bg: #f6f7f9;
	--card: #ffffff;
	--radius: 10px;
	--shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 4px 14px rgba(20, 33, 61, .05);
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--serif: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	font-family: var(--font);
	font-size: 17px;
	line-height: 1.7;
	color: var(--ink);
	background: var(--bg);
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--navy); }
h1, h2, h3, h4 { line-height: 1.25; color: var(--navy); margin: 1.6em 0 .6em; }
h1 { font-size: 2.1rem; margin-top: 0; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p, ul, ol { margin: 0 0 1.1em; }
.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link:focus {
	position: fixed; top: 8px; left: 8px; z-index: 100; width: auto; height: auto; clip: auto;
	background: #fff; padding: 8px 12px; border-radius: 6px;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.topbar { background: var(--navy); color: #cfd6e4; font-size: 13px; }
.topbar .wrap { display: flex; justify-content: space-between; gap: 12px; padding-top: 6px; padding-bottom: 6px; }
.topbar a { color: #fff; text-decoration: none; }
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand-name { font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; }
.brand-name span { color: var(--amber); }
.brand-tag { display: block; font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; }

.main-nav ul { list-style: none; margin: 0; padding: 0; }
.main-nav > ul { display: flex; gap: 2px; }
.main-nav li { position: relative; }
.main-nav a {
	display: block; padding: 10px 10px; white-space: nowrap; color: var(--ink); text-decoration: none;
	font-weight: 600; font-size: 15px; border-radius: 6px;
}
.main-nav a:hover, .main-nav .current-menu-item > a, .main-nav .current-cat > a { color: var(--teal); background: var(--teal-soft); }
.main-nav .menu-item-has-children > a::after, .main-nav .has-children > a::after { content: " ▾"; font-size: 11px; }
.main-nav ul ul {
	position: absolute; left: 0; top: 100%; min-width: 230px; background: #fff; border: 1px solid var(--line);
	border-radius: 8px; box-shadow: var(--shadow); padding: 6px; display: none;
}
.main-nav li:hover > ul, .main-nav li:focus-within > ul { display: block; }
.main-nav ul ul a { font-weight: 500; }
.nav-cta a { background: var(--amber); color: var(--navy) !important; }
.nav-cta a:hover { background: #f0b53d !important; }
.menu-toggle {
	display: none; background: none; border: 1px solid var(--line); border-radius: 6px;
	padding: 8px 12px; font-size: 15px; font-weight: 600; color: var(--navy); cursor: pointer;
}

/* ---------- Layout ---------- */
.site-content { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; padding-top: 32px; padding-bottom: 48px; }
.content-full { grid-template-columns: minmax(0, 1fr); max-width: 860px; }

/* ---------- Hero (front page) ---------- */
.hero {
	background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); color: #e8ecf3;
	border-radius: var(--radius); padding: 34px 32px; margin-bottom: 28px; position: relative; overflow: hidden;
}
.hero::after {
	content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
	background: radial-gradient(circle, rgba(224,159,31,.9) 0 38%, rgba(224,159,31,.15) 39% 60%, transparent 61%);
}
.hero h1 { color: #fff; font-size: 1.9rem; max-width: 620px; position: relative; z-index: 1; }
.hero p { max-width: 600px; position: relative; z-index: 1; }
.hero .btns { display: flex; flex-wrap: wrap; gap: 10px; position: relative; z-index: 1; }
.btn {
	display: inline-block; padding: 11px 18px; border-radius: 8px; font-weight: 700; text-decoration: none;
	font-size: 15px; border: 0; cursor: pointer;
}
.btn-amber { background: var(--amber); color: var(--navy); }
.btn-amber:hover { background: #f0b53d; color: var(--navy); }
.btn-ghost { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.btn-ghost:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ---------- Archive header ---------- */
.archive-header { margin-bottom: 22px; }
.archive-header .eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; color: var(--muted); font-weight: 700; }
.archive-header h1 { margin: 4px 0 8px; }
.archive-header .desc { color: var(--muted); margin: 0; }
.subcats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.subcats a { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 14px; text-decoration: none; }

/* ---------- Post cards ---------- */
.post-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.card {
	background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
	display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(20,33,61,.1); }
.card-thumb { display: block; aspect-ratio: 16 / 7; position: relative; overflow: hidden; }
.card-thumb svg, .card-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.card-cat { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; text-decoration: none; }
.card h2 { font-size: 1.18rem; margin: 6px 0 8px; }
.card h2 a { color: var(--navy); text-decoration: none; }
.card h2 a:hover { color: var(--teal); }
.card .meta { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.card .excerpt { font-size: 15px; color: #3a4352; margin: 0 0 12px; }
.card .more { margin-top: auto; font-weight: 700; font-size: 14px; text-decoration: none; }
.card .more::after { content: " →"; }
.post-grid .card.featured { grid-column: 1 / -1; }
.post-grid .card.featured .card-thumb { aspect-ratio: 16 / 5.5; }
.post-grid .card.featured h2 { font-size: 1.5rem; }

.pagination { margin-top: 30px; display: flex; gap: 6px; flex-wrap: wrap; }
.pagination .page-numbers {
	padding: 7px 13px; border: 1px solid var(--line); border-radius: 6px; background: #fff; text-decoration: none; color: var(--ink);
}
.pagination .current { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Single ---------- */
.entry { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 34px 38px; box-shadow: var(--shadow); }
.breadcrumbs { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.breadcrumbs a { color: var(--muted); }
.entry-header .meta { color: var(--muted); font-size: 14px; margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.entry-content { font-size: 17.5px; }
.entry-content > *:first-child { margin-top: 0; }
.entry-content h2 { padding-top: 6px; border-top: 1px solid var(--line); padding-top: 22px; }
.entry-content table { width: 100%; border-collapse: collapse; margin: 0 0 1.4em; font-size: 15px; display: block; overflow-x: auto; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.entry-content th { background: var(--navy); color: #fff; font-weight: 700; }
.entry-content tr:nth-child(even) td { background: #f8f9fb; }
.entry-content blockquote { margin: 0 0 1.2em; padding: 12px 18px; border-left: 4px solid var(--amber); background: var(--amber-soft); }
.entry-content li { margin-bottom: .35em; }

.key-takeaways, .note, .warning {
	border-radius: 8px; padding: 16px 20px; margin: 0 0 1.4em; font-size: 16px;
}
.key-takeaways { background: var(--teal-soft); border: 1px solid #c7e4d8; }
.key-takeaways > strong:first-child { display: block; color: var(--teal); margin-bottom: 4px; text-transform: uppercase; font-size: 13px; letter-spacing: .06em; }
.key-takeaways ul { margin-bottom: 0; }
.note { background: #f1f4f9; border: 1px solid var(--line); }
.warning { background: #fdf0ee; border: 1px solid #f3cbc4; }

.entry-content a.shop-btn {
	display: inline-block; background: var(--amber); color: var(--navy); font-weight: 700; text-decoration: none;
	padding: 8px 14px; border-radius: 7px; font-size: 15px; margin: 2px 0;
}
.entry-content a.shop-btn:hover { background: #f0b53d; }
.product-box { border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; margin: 0 0 1.4em; background: #fcfcfd; }
.product-box h3 { margin-top: 0; }
.product-box .pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 15px; }
.product-box .pros-cons ul { margin: 4px 0 0; padding-left: 18px; }
@media (max-width: 640px) { .product-box .pros-cons { grid-template-columns: 1fr; } }
.disclosure { font-size: 14px; color: var(--muted); background: #f8f9fb; border: 1px dashed var(--line); padding: 10px 14px; border-radius: 8px; margin-bottom: 20px; }

.toc { background: #f8f9fb; border: 1px solid var(--line); border-radius: 8px; padding: 14px 20px; margin: 0 0 1.6em; font-size: 15px; }
.toc summary { font-weight: 700; cursor: pointer; color: var(--navy); }
.toc ol { margin: 10px 0 0; padding-left: 20px; }

.faq h3 { margin-top: 1.2em; }

.author-box { display: flex; gap: 16px; align-items: flex-start; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.author-box .avatar-sun { flex: none; width: 52px; height: 52px; }

.related { margin-top: 28px; }
.related h2 { font-size: 1.25rem; }
.related ul { padding-left: 18px; }

/* ---------- Ads ---------- */
.bw-ad { margin: 26px 0; text-align: center; min-height: 90px; }
.bw-ad-label { display: block; font-size: 11px; color: #9aa3b0; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.bw-ad-placeholder { border: 2px dashed #cdd4df; border-radius: 8px; padding: 26px 10px; color: #8a94a3; font-size: 13px; background: #fafbfc; }
.sidebar .bw-ad { min-height: 250px; }

/* ---------- Sidebar ---------- */
.sidebar .widget { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 22px; box-shadow: var(--shadow); font-size: 15px; }
.sidebar .widget-title { font-size: 1rem; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--navy); }
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.sidebar li:last-child { border-bottom: 0; }
.sidebar li ul { padding-left: 14px; margin-top: 6px; }
.sidebar li li { border-bottom: 0; padding: 3px 0; }
.sidebar a { text-decoration: none; color: var(--ink); }
.sidebar a:hover { color: var(--teal); }
.sidebar .sticky-zone { position: sticky; top: 90px; }
.widget-cta { background: var(--amber-soft) !important; border-color: #f2dcaa !important; }
.widget-cta p { margin: 0 0 12px; }
.search-form { display: flex; gap: 6px; }
.search-form input[type=search] { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 15px; }
.search-form button { padding: 9px 14px; border: 0; border-radius: 6px; background: var(--navy); color: #fff; font-weight: 700; cursor: pointer; }

/* ---------- Calculator ---------- */
.bw-calc { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: #fbfcfd; margin: 0 0 1.6em; }
.bw-calc h3 { margin-top: 0; }
.bw-calc .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.bw-calc label { display: block; font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.bw-calc select, .bw-calc input { width: 100%; padding: 9px 10px; border: 1px solid #cfd6e0; border-radius: 6px; font-size: 15px; background: #fff; }
.bw-calc .hint { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.bw-calc .results { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.bw-calc .res { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; text-align: center; }
.bw-calc .res b { display: block; font-size: 1.35rem; color: var(--teal); }
.bw-calc .res span { font-size: 12.5px; color: var(--muted); }
.bw-calc .fine { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #b9c2d3; font-size: 14.5px; padding: 40px 0 26px; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; }
.site-footer h3 { color: #fff; font-size: 1rem; margin: 0 0 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { padding: 3px 0; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 26px; padding-top: 16px; font-size: 13px; }

/* ---------- 404 / search ---------- */
.empty { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
	.site-content { grid-template-columns: minmax(0, 1fr); }
	.sidebar .sticky-zone { position: static; }
}
@media (max-width: 860px) {
	.menu-toggle { display: block; }
	.main-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
	.main-nav.open { display: block; }
	.main-nav > ul { flex-direction: column; padding: 8px 12px 14px; }
	.main-nav ul ul { position: static; display: block; box-shadow: none; border: 0; padding: 0 0 0 14px; }
	.brand-tag { display: none; }
	.post-grid { grid-template-columns: minmax(0, 1fr); }
	.entry { padding: 22px 18px; }
	.footer-cols { grid-template-columns: 1fr; }
	.bw-calc .grid { grid-template-columns: 1fr; }
	.bw-calc .results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	h1 { font-size: 1.7rem; }
	.hero { padding: 26px 20px; }
	.hero h1 { font-size: 1.55rem; padding-right: 40px; }
	.hero::after { width: 120px; height: 120px; right: -55px; top: -55px; opacity: .7; }
	.topbar .hide-sm { display: none; }
}

/* Block widgets added by the site owner */
.sidebar .wp-block-heading, .sidebar h2 { font-size: 1rem; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .06em; }
.sidebar .wp-block-search__inside-wrapper { display: flex; gap: 6px; }
.sidebar .wp-block-search__input { flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; }
.sidebar .wp-block-search__button { padding: 9px 14px; border: 0; border-radius: 6px; background: var(--navy); color: #fff; font-weight: 700; }
@media (max-width: 1180px) and (min-width: 861px) { .brand-tag { display: none; } .main-nav a { font-size: 14px; padding: 8px 7px; } }
