/*
Theme Name: TrayGrown
Theme URI: https://traygrown.xyz/
Author: TrayGrown
Description: A fast, lightweight blog theme built for indoor-growing guides. Built-in SEO (meta, Open Graph, JSON-LD schema, breadcrumbs), automatic table of contents, related posts, author box, AdSense-ready ad settings with virtual ads.txt, and a seed density calculator shortcode. Turns its own SEO output off automatically when Rank Math or Yoast is active.
Version: 1.0.0
Requires at least: 6.2
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: traygrown
Tags: blog, one-column, two-columns, right-sidebar, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

:root {
	--c-bg: #fbfcf8;
	--c-surface: #ffffff;
	--c-soft: #eef5ea;
	--c-line: #dfe8da;
	--c-text: #1d2a21;
	--c-muted: #56665b;
	--c-brand: #2e6a3a;
	--c-brand-dark: #1f4d29;
	--c-accent: #7cc36b;
	--c-warn-bg: #fff6e0;
	--c-warn-line: #f0c96b;
	--radius: 12px;
	--shadow: 0 1px 2px rgba(20, 40, 25, .06), 0 4px 16px rgba(20, 40, 25, .06);
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
	--w-container: 1140px;
	--w-content: 740px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
	margin: 0;
	background: var(--c-bg);
	color: var(--c-text);
	font-family: var(--font);
	font-size: 18px;
	line-height: 1.7;
	text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; }

a { color: var(--c-brand); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--c-brand-dark); text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
	outline: 3px solid var(--c-accent);
	outline-offset: 2px;
}

h1, h2, h3, h4 { line-height: 1.25; color: var(--c-text); margin: 1.6em 0 .55em; }
h1 { font-size: clamp(1.9rem, 4.2vw, 2.6rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.75rem); letter-spacing: -.01em; }
h3 { font-size: 1.22rem; }
p { margin: 0 0 1.15em; }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link {
	position: absolute; left: -9999px; top: 8px; z-index: 100;
	background: var(--c-brand); color: #fff; padding: 8px 14px; border-radius: 6px;
}
.skip-link:focus { left: 8px; }

.container { width: 100%; max-width: var(--w-container); margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: calc(var(--w-content) + 32px); }

/* ---------- Header ---------- */
.site-header {
	background: var(--c-surface);
	border-bottom: 1px solid var(--c-line);
	position: sticky; top: 0; z-index: 50;
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 0; position: relative; } }
.header-inner { display: flex; align-items: center; gap: 12px; min-height: 64px; flex-wrap: wrap; }
.site-branding { margin-right: auto; }
.site-title {
	display: inline-flex; align-items: center; gap: 8px;
	font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em;
	color: var(--c-brand-dark); text-decoration: none;
}
.site-title:hover { color: var(--c-brand); }
.logo-mark { color: #8a5a3b; }
.custom-logo { max-height: 44px; width: auto; display: block; }

.menu-toggle {
	display: none; background: none; border: 1px solid var(--c-line); border-radius: 8px;
	padding: 8px; color: var(--c-text); cursor: pointer; line-height: 0;
}
.main-navigation { display: flex; align-items: center; gap: 12px; }
.main-navigation ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.main-navigation li { position: relative; }
.main-navigation a {
	display: block; padding: 8px 9px; border-radius: 8px;
	color: var(--c-text); text-decoration: none; font-weight: 600; font-size: .92rem;
}
.main-navigation a:hover, .main-navigation .current-menu-item > a, .main-navigation .current-post-ancestor > a, .main-navigation .current-category-ancestor > a { background: var(--c-soft); color: var(--c-brand-dark); }
.main-navigation .sub-menu {
	display: none; position: absolute; left: 0; top: 100%; min-width: 220px; padding: 6px;
	background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 10px; box-shadow: var(--shadow);
	flex-direction: column;
}
.main-navigation li:hover > .sub-menu, .main-navigation li:focus-within > .sub-menu { display: flex; }

.search-form { display: flex; align-items: stretch; max-width: 100%; }
.search-field {
	font: inherit; font-size: .95rem; padding: 8px 12px; min-width: 0; width: 150px;
	border: 1px solid var(--c-line); border-right: 0; border-radius: 8px 0 0 8px; background: var(--c-bg); color: var(--c-text);
}
.search-submit {
	border: 1px solid var(--c-brand); background: var(--c-brand); color: #fff; border-radius: 0 8px 8px 0;
	padding: 0 12px; cursor: pointer; line-height: 0;
}
.search-submit:hover { background: var(--c-brand-dark); }

@media (min-width: 1181px) {
	.main-navigation .search-form { display: none; }
}
@media (max-width: 1180px) {
	.menu-toggle { display: inline-block; }
	.main-navigation { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 14px; }
	.main-navigation.is-open { display: flex; }
	.main-navigation ul { flex-direction: column; }
	.main-navigation .sub-menu { display: flex; position: static; box-shadow: none; border: 0; padding-left: 14px; }
	.search-field { width: 100%; flex: 1; }
}

/* ---------- Buttons ---------- */
.button, .wp-block-button__link, input[type="submit"] {
	display: inline-block; font: inherit; font-weight: 700; font-size: 1rem;
	background: var(--c-brand); color: #fff; border: 2px solid var(--c-brand);
	padding: 10px 20px; border-radius: 999px; text-decoration: none; cursor: pointer;
}
.button:hover, .wp-block-button__link:hover, input[type="submit"]:hover { background: var(--c-brand-dark); border-color: var(--c-brand-dark); color: #fff; }
.button-ghost { background: transparent; color: var(--c-brand-dark); }
.button-ghost:hover { background: var(--c-soft); color: var(--c-brand-dark); }

/* ---------- Hero ---------- */
.hero {
	background:
		radial-gradient(1200px 300px at 85% -10%, rgba(124, 195, 107, .28), transparent 60%),
		linear-gradient(180deg, var(--c-soft), var(--c-bg));
	border-bottom: 1px solid var(--c-line);
}
.hero-inner { padding-top: 56px; padding-bottom: 48px; }
.hero-title, .hero-lead { max-width: 760px; }
.hero-title { margin-top: 0; font-family: var(--font-serif); font-weight: 700; font-size: clamp(2rem, 5vw, 3rem); }
.hero-lead { font-size: 1.15rem; color: var(--c-muted); max-width: 680px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 22px 0; }
.hero .search-form { max-width: 460px; }
.hero .search-field { width: 100%; flex: 1; padding: 12px 14px; background: #fff; }

.section-title { margin-top: 48px; }

.topic-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.topic-grid a {
	display: flex; flex-direction: column; gap: 4px; height: 100%;
	padding: 18px; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius);
	text-decoration: none; color: var(--c-text); transition: border-color .15s, transform .15s;
}
.topic-grid a:hover { border-color: var(--c-accent); transform: translateY(-2px); }
.topic-name { font-weight: 800; color: var(--c-brand-dark); }
.topic-desc { font-size: .92rem; color: var(--c-muted); line-height: 1.5; }
.topic-count { font-size: .8rem; font-weight: 700; color: var(--c-brand); margin-top: auto; padding-top: 6px; }

/* ---------- Cards ---------- */
.card-grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-top: 18px; }
.card {
	background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius);
	overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.card-media { display: block; aspect-ratio: 16 / 9; background: var(--c-soft); }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-placeholder { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, var(--c-soft), #d7ead0); }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.card-cat { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; text-decoration: none; }
.card-title { font-size: 1.12rem; margin: 6px 0 8px; line-height: 1.35; }
.card-title a { color: var(--c-text); text-decoration: none; }
.card-title a:hover { color: var(--c-brand); text-decoration: underline; }
.card-excerpt { font-size: .95rem; color: var(--c-muted); line-height: 1.55; margin-bottom: 10px; }
.card-meta { font-size: .8rem; color: var(--c-muted); margin: auto 0 0; }

/* ---------- Breadcrumbs & archives ---------- */
.breadcrumbs { font-size: .85rem; color: var(--c-muted); margin: 20px 0 0; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.breadcrumbs li + li::before { content: "›"; margin-right: 4px; color: var(--c-muted); }
.breadcrumbs a { color: var(--c-muted); }
.archive-header { margin: 8px 0 10px; }
.archive-title { margin-top: 18px; }
.archive-description { color: var(--c-muted); max-width: var(--w-content); }

/* ---------- Single ---------- */
.site-main { padding-bottom: 64px; }
.content-wrap { max-width: var(--w-content); margin: 0 auto; }
.has-sidebar .site-main.container { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; }
.has-sidebar .site-main.container > .breadcrumbs { grid-column: 1 / -1; }
.has-sidebar .content-wrap { margin: 0; }
@media (max-width: 1000px) { .has-sidebar .site-main.container { display: block; } }
.sidebar .widget { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 18px; margin-top: 24px; font-size: .95rem; }
.widget-title, .sidebar h2 { font-size: 1rem; margin-top: 0; }
.sidebar ul { padding-left: 1.1em; margin: 0; }
.sidebar .wp-block-search__inside-wrapper { display: flex; }
.sidebar .wp-block-search__input { flex: 1; min-width: 0; font: inherit; padding: 8px 10px; border: 1px solid var(--c-line); border-radius: 8px 0 0 8px; }
.sidebar .wp-block-search__button { margin: 0; border: 0; background: var(--c-brand); color: #fff; border-radius: 0 8px 8px 0; padding: 0 12px; font: inherit; }

.entry-header { margin-top: 10px; }
.entry-cat { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; text-decoration: none; }
.entry-title { margin: 8px 0 12px; font-family: var(--font-serif); }
.entry-meta { font-size: .9rem; color: var(--c-muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.entry-meta a { color: var(--c-text); font-weight: 600; text-decoration: none; }
.entry-thumb { margin: 22px 0 8px; }
.entry-thumb img { border-radius: var(--radius); display: block; width: 100%; }

.entry-content { margin-top: 18px; }
.entry-content > * { max-width: 100%; }
.entry-content h2 { scroll-margin-top: 84px; padding-top: .2em; }
.entry-content h3 { scroll-margin-top: 84px; }
.entry-content ul, .entry-content ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.entry-content li { margin-bottom: .4em; }
.entry-content li::marker { color: var(--c-brand); }
.entry-content img { border-radius: 10px; }
.entry-content blockquote {
	margin: 1.5em 0; padding: 14px 20px; border-left: 4px solid var(--c-accent);
	background: var(--c-soft); border-radius: 0 10px 10px 0;
}
.entry-content blockquote p:last-child { margin-bottom: 0; }
.entry-content hr { border: 0; border-top: 1px solid var(--c-line); margin: 2.5em 0; }
.entry-content code { background: var(--c-soft); padding: 2px 6px; border-radius: 4px; font-size: .9em; }

/* Callouts written as <div class="callout"> or the key-takeaways box */
.callout, .key-takeaways {
	background: var(--c-soft); border: 1px solid var(--c-line); border-radius: var(--radius);
	padding: 16px 20px; margin: 1.6em 0;
}
.key-takeaways { background: #f3f9ef; border-left: 5px solid var(--c-brand); }
.key-takeaways > :first-child, .callout > :first-child { margin-top: 0; }
.key-takeaways > :last-child, .callout > :last-child { margin-bottom: 0; }
.callout.warning { background: var(--c-warn-bg); border-color: var(--c-warn-line); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 1.5em 0; border: 1px solid var(--c-line); border-radius: var(--radius); background: var(--c-surface); }
.table-wrap table, .entry-content table { border-collapse: collapse; width: 100%; font-size: .93rem; line-height: 1.5; margin: 0; }
.entry-content th, .entry-content td { padding: 10px 12px; border-bottom: 1px solid var(--c-line); text-align: left; vertical-align: top; }
.entry-content thead th { background: var(--c-soft); font-weight: 700; white-space: nowrap; }
.entry-content tbody tr:last-child > * { border-bottom: 0; }
.entry-content tbody th { font-weight: 700; }
.wp-block-table { margin: 0; }
.wp-block-table table { border: 0; }

/* Table of contents */
.toc { margin: 1.6em 0 2em; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); }
.toc summary { cursor: pointer; font-weight: 800; padding: 14px 18px; list-style-position: inside; }
.toc ul { margin: 0; padding: 0 18px 14px 36px; font-size: .95rem; list-style: square; }
.toc li::marker { color: var(--c-accent); }
.toc li { margin: .25em 0; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* FAQ styled as details */
.entry-content details.faq { border: 1px solid var(--c-line); border-radius: 10px; padding: 0 16px; margin: 0 0 10px; background: var(--c-surface); }
.entry-content details.faq summary { cursor: pointer; font-weight: 700; padding: 12px 0; }

/* Entry footer */
.tag-list { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list a { display: inline-block; font-size: .8rem; padding: 4px 10px; border-radius: 999px; background: var(--c-soft); text-decoration: none; color: var(--c-brand-dark); }
.author-box {
	display: flex; gap: 16px; align-items: flex-start; margin: 32px 0 0; padding: 20px;
	background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius);
}
.author-avatar { border-radius: 50%; flex: none; }
.author-name { font-weight: 800; margin: 0 0 4px; }
.author-name a { text-decoration: none; }
.author-bio { font-size: .95rem; color: var(--c-muted); margin: 0 0 6px; }
.author-links { font-size: .85rem; margin: 0; }

.related { margin-top: 48px; }
.related h2 { margin-top: 0; }
.related .card-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

.post-navigation { margin-top: 36px; }
.post-navigation .nav-links { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.post-navigation a { display: block; padding: 14px 16px; border: 1px solid var(--c-line); border-radius: var(--radius); text-decoration: none; background: var(--c-surface); color: var(--c-text); font-weight: 600; font-size: .95rem; height: 100%; }
.post-navigation .nav-next { text-align: right; }
.nav-label { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted); font-weight: 700; }
@media (max-width: 600px) { .post-navigation .nav-links { grid-template-columns: 1fr; } .post-navigation .nav-next { text-align: left; } }

.pagination { margin-top: 32px; }
.pagination .nav-links { display: flex; gap: 6px; flex-wrap: wrap; }
.pagination .page-numbers { display: inline-block; padding: 6px 12px; border: 1px solid var(--c-line); border-radius: 8px; text-decoration: none; background: var(--c-surface); }
.pagination .current { background: var(--c-brand); color: #fff; border-color: var(--c-brand); }

/* Ads */
.ad-slot { margin: 2em 0; min-height: 90px; text-align: center; clear: both; }

/* Comments */
.comments-area { margin-top: 48px; }
.comment-list { padding-left: 0; list-style: none; }
.comment-list .children { list-style: none; padding-left: 24px; }
.comment-body { padding: 14px 0; border-bottom: 1px solid var(--c-line); font-size: .95rem; }
.comment-form label { display: block; font-weight: 600; font-size: .9rem; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
	width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--c-line); border-radius: 8px; background: #fff;
}

/* Seed calculator */
.calc { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 20px; margin: 1.5em 0; box-shadow: var(--shadow); }
.calc-form { display: grid; gap: 12px; }
.calc-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.calc-row[hidden] { display: none; }
.calc-row label { font-weight: 700; font-size: .95rem; min-width: 130px; }
.calc-custom label { min-width: 0; }
.calc select, .calc input { font: inherit; font-size: 1rem; padding: 8px 10px; border: 1px solid var(--c-line); border-radius: 8px; background: #fff; color: var(--c-text); max-width: 100%; }
.calc input[type="number"] { width: 100px; }
.calc-result { margin-top: 16px; padding: 16px; background: var(--c-soft); border-radius: 10px; }
.calc-amount { font-size: 1.25rem; margin: 0 0 8px; }
.calc-amount span { color: var(--c-muted); font-size: 1rem; }
.calc-notes { margin: 0; padding-left: 1.2em; font-size: .95rem; }

/* Contact page details */
.contact-card { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 18px 20px; }

/* ---------- Footer ---------- */
.site-footer { background: #17251b; color: #cfdccf; font-size: .95rem; }
.site-footer a { color: #e6f1e3; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; padding-top: 40px; padding-bottom: 24px; }
.footer-title { font-weight: 800; color: #fff; font-size: 1.1rem; margin-bottom: 4px; }
.footer-about { max-width: 420px; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 16px; padding-bottom: 24px; font-size: .85rem; color: #9fb19f; }
.footer-bottom p { margin: 0; }

/* WordPress core classes */
.alignleft { float: left; margin: 0 1.5em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.5em; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.wp-caption-text, figcaption { font-size: .85rem; color: var(--c-muted); text-align: center; margin-top: 6px; }
.sticky, .bypostauthor, .gallery-caption { outline: 0; }

@media (max-width: 600px) {
	body { font-size: 17px; }
	.hero-inner { padding-top: 36px; padding-bottom: 32px; }
	.author-box { flex-direction: column; }
	.calc-row label { min-width: 100%; }
}

@media print {
	.site-header, .site-footer, .related, .post-navigation, .comments-area, .ad-slot, .toc { display: none !important; }
	body { background: #fff; }
}
