/*
Theme Name: Tidibook
Theme URI: https://tidibook.com/
Author: Tidibook
Description: Lightweight custom blog theme for Tidibook: sage-green palette, rounded cards, fast and mobile-first.
Version: 1.3.0
Requires at least: 6.3
Tested up to: 6.8
Requires PHP: 7.4
License: GPLv2 or later
Text Domain: tidibook
*/

/* ---------- Design tokens ---------- */
:root {
	--ink: #16201c;
	--ink-2: #2c3a33;
	--green: #1f6b4d;
	--green-2: #2a7d5b;
	--mint: #7fd1a8;
	--sage: #dde6e1;
	--sage-2: #eaf0ec;
	--mist: #f4f6f5;
	--stone: #e9ebe9;
	--line: #e1e8e4;
	--muted: #5b6962;
	--radius: 28px;
	--radius-lg: 36px;
	--wrap: 1160px;
	--font: "Alexandria", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
	margin: 0;
	font-family: var(--font);
	font-size: 17px;
	line-height: 1.75;
	color: var(--ink);
	background: #fff;
	-webkit-font-smoothing: antialiased;
}

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

a { color: var(--green); }
a:hover { color: var(--ink); }

:focus-visible { outline: 3px solid var(--green-2); outline-offset: 3px; border-radius: 8px; }

h1, h2, h3, h4 { font-weight: 700; color: inherit; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 820px; }

.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(--ink); color: #fff;
	padding: 8px 16px; border-radius: 999px; text-decoration: none;
}
.skip-link:focus { left: 12px; }

/* ---------- Top bar & header ---------- */
.topbar {
	background: var(--ink);
	color: #e6eee9;
	text-align: center;
	font-size: 13px;
	line-height: 1.4;
	padding: 6px 0;
}
.topbar p { margin: 0; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar-social { display: flex; align-items: center; gap: 10px; }
.topbar-follow { font-weight: 600; }
.social-links.social-links--top { margin: 0; gap: 6px; }
.social-links--top a, .social-links--top span { width: 28px; height: 28px; }
.social-links--top svg { width: 15px; height: 15px; }
@media (max-width: 480px) { .topbar-follow { display: none; } .topbar p { font-size: 12px; text-align: left; } }

.site-header {
	position: sticky; top: 0; z-index: 50;
	background: rgba(255, 255, 255, .96);
	backdrop-filter: saturate(160%) blur(8px);
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
@media (max-width: 600px) { .admin-bar .site-header { top: 0; } }

.header-inner {
	display: flex; align-items: center; justify-content: space-between;
	gap: 16px; min-height: 76px;
}

.brand {
	font-weight: 700; font-size: 25px; letter-spacing: -.02em;
	color: var(--ink); text-decoration: none; line-height: 1;
}
.brand span { color: var(--green); }
.brand:hover { color: var(--ink); }
.custom-logo { max-height: 44px; width: auto; display: block; }

.menu, .sub-menu, .footer-menu { list-style: none; margin: 0; padding: 0; }

.site-nav .menu { display: flex; align-items: center; gap: 4px; }
.site-nav a {
	display: block; padding: 10px 16px; border-radius: 999px;
	color: var(--ink); text-decoration: none;
	font-weight: 500; font-size: 15px; line-height: 1.3;
}
.site-nav a:hover,
.site-nav .current-menu-item > a,
.site-nav .current-menu-ancestor > a { background: var(--sage-2); color: var(--ink); }
/* "Topics" jumps to a section of the homepage; don't mark it as the current page. */
.home .site-nav .menu > li > a[href*="#"]:not(:hover) { background: transparent; }

.site-nav .menu-item-has-children { position: relative; }
.site-nav .menu-item-has-children > a::after {
	content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 9px;
	border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
	transform: translateY(-3px) rotate(45deg);
}
.site-nav .sub-menu {
	position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px;
	background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 8px;
	box-shadow: 0 20px 44px rgba(22, 32, 28, .10);
	opacity: 0; visibility: hidden; transform: translateY(6px);
	transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.site-nav .sub-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.site-nav .menu > li:last-child > .sub-menu { left: auto; right: 0; }
.site-nav .menu-item-has-children:hover > .sub-menu,
.site-nav .menu-item-has-children:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.site-nav .sub-menu a { border-radius: 14px; font-size: 14.5px; padding: 9px 14px; }

.menu-toggle {
	display: none; width: 46px; height: 46px; border: 0; border-radius: 50%;
	background: var(--sage-2); cursor: pointer; align-items: center; justify-content: center; padding: 0;
}
.menu-toggle-bars,
.menu-toggle-bars::before,
.menu-toggle-bars::after {
	display: block; width: 18px; height: 2px; border-radius: 2px;
	background: var(--ink); position: relative; transition: transform .2s ease, background .2s ease;
}
.menu-toggle-bars::before,
.menu-toggle-bars::after { content: ""; position: absolute; left: 0; }
.menu-toggle-bars::before { top: -6px; }
.menu-toggle-bars::after { top: 6px; }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars { background: transparent; }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars::before { top: 0; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle-bars::after { top: 0; transform: rotate(-45deg); }

@media (max-width: 900px) {
	.menu-toggle { display: inline-flex; }
	.site-nav {
		display: none; position: absolute; left: 0; right: 0; top: 100%;
		background: #fff; border-top: 1px solid var(--line);
		padding: 12px 20px 22px; box-shadow: 0 24px 32px rgba(22, 32, 28, .08);
		max-height: calc(100vh - 110px); overflow-y: auto;
	}
	.site-nav.is-open { display: block; }
	.site-nav .menu { flex-direction: column; align-items: stretch; gap: 2px; }
	.site-nav .sub-menu {
		position: static; opacity: 1; visibility: visible; transform: none;
		box-shadow: none; border: 0; background: transparent; min-width: 0; padding: 0 0 6px 14px;
	}
	.site-nav .sub-menu::before { display: none; }
	.site-nav .menu-item-has-children > a::after { display: none; }
}

/* ---------- Shared pieces ---------- */
.pill {
	display: inline-block; padding: 5px 14px; border-radius: 999px;
	background: var(--sage); color: var(--green);
	font-size: 13px; font-weight: 600; line-height: 1.4; text-decoration: none;
}
a.pill:hover { background: var(--green); color: #fff; }
.pill-light { background: #fff; color: var(--ink); }

.btn {
	display: inline-flex; align-items: center; justify-content: center;
	padding: 14px 28px; border-radius: 999px;
	font-weight: 600; font-size: 15px; line-height: 1.2; text-decoration: none;
	transition: transform .15s ease, background .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--ink); color: #fff; }
.btn-light { background: #fff; color: var(--ink); }
.btn-light:hover { color: var(--green); }

.section { padding-top: 80px; }
.section-tight { padding-top: 36px; }
.section-head { text-align: center; margin-bottom: 30px; }
.section-head h1,
.section-head h2 {
	font-size: clamp(26px, 3.6vw, 38px); line-height: 1.15;
	letter-spacing: -.02em; margin: 12px 0 0;
}
.empty { text-align: center; color: var(--muted); }

/* ---------- Hero ---------- */
.hero-section { padding-top: 8px; }
.hero {
	position: relative; overflow: hidden; text-align: center;
	border-radius: var(--radius-lg); padding: 56px 24px;
	background:
		repeating-radial-gradient(circle at 50% 50%, transparent 0 94px, rgba(22, 32, 28, .08) 95px 96px),
		var(--sage);
}
.hero h1 {
	font-size: clamp(26px, 4.4vw, 46px); line-height: 1.08; letter-spacing: -.035em;
	margin: 14px auto 12px; max-width: 700px;
}
.hero-lead { max-width: 560px; margin: 0 auto 22px; color: var(--ink-2); font-size: clamp(14px, 1.6vw, 16px); line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 0; }

/* ---------- Topic cards ---------- */
.topic-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.topic-card {
	display: flex; flex-direction: column; justify-content: space-between; gap: 16px;
	min-height: 200px; padding: 24px; border-radius: var(--radius);
	color: var(--ink); text-decoration: none; background: var(--mist);
	transition: transform .2s ease;
}
.topic-card:hover { transform: translateY(-3px); color: var(--ink); }
.topic-card.tone-1 { background: var(--sage); }
.topic-card.tone-2 { background: var(--stone); }
.topic-card.tone-3 { background: var(--ink); color: #fff; }
.topic-card.tone-3:hover { color: #fff; }
.topic-num { font-size: 13px; font-weight: 700; color: var(--green); }
.tone-3 .topic-num { color: var(--mint); }
.topic-card h3 { font-size: 20px; line-height: 1.25; margin: 0 0 4px; }
.topic-count { font-size: 13px; opacity: .75; }
.topic-go { font-size: 14px; font-weight: 600; }

/* ---------- Article cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card {
	position: relative; display: flex; flex-direction: column;
	background: var(--mist); border-radius: var(--radius); overflow: hidden;
	transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(22, 32, 28, .08); }
.card-media img { display: block; width: 100%; aspect-ratio: 12 / 7; object-fit: cover; }
.card-body { display: flex; flex-direction: column; gap: 10px; padding: 26px; flex: 1; }
.card-body .pill { align-self: flex-start; background: #fff; position: relative; z-index: 2; }
.card-body a.pill:hover { background: var(--green); color: #fff; }
.card-title { font-size: 20px; line-height: 1.3; letter-spacing: -.01em; margin: 0; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card:hover .card-title a { color: var(--green); }
.card-excerpt { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.card-meta { margin-top: auto; padding-top: 6px; display: flex; gap: 8px; font-size: 13px; color: var(--muted); }

/* ---------- Why cards ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.step { border-radius: var(--radius); padding: 28px; background: var(--mist); }
.step:nth-child(2) { background: var(--sage); }
.step:nth-child(3) { background: var(--stone); }
.step:nth-child(4) { background: var(--ink); color: #fff; }
.step-num { font-size: 13px; font-weight: 700; color: var(--green); }
.step:nth-child(4) .step-num { color: var(--mint); }
.step h3 { font-size: 19px; margin: 16px 0 6px; line-height: 1.3; }
.step p { margin: 0; font-size: 14.5px; line-height: 1.6; opacity: .85; }

/* ---------- Pagination ---------- */
.pagination { margin-top: 44px; }
.pagination .nav-links { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.page-numbers {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 46px; height: 46px; padding: 0 16px; border-radius: 999px;
	background: var(--mist); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px;
}
a.page-numbers:hover { background: var(--sage); color: var(--ink); }
.page-numbers.current { background: var(--ink); color: #fff; }

/* ---------- Topic / search / 404 header ---------- */
.archive-hero {
	background: var(--sage); border-radius: var(--radius-lg);
	padding: 60px 24px; text-align: center; margin-top: 8px;
}
.archive-hero h1 {
	font-size: clamp(30px, 5vw, 50px); line-height: 1.1; letter-spacing: -.025em; margin: 14px 0 10px;
}
.archive-hero p { margin: 0 auto 18px; max-width: 640px; color: var(--ink-2); }
.archive-hero p:last-child { margin-bottom: 0; }

/* ---------- Single article & pages ---------- */
.single-article { padding-top: 20px; }
.breadcrumbs { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--green); }
.breadcrumbs .sep { margin: 0 8px; }

.entry-header {
	background: var(--sage); border-radius: 32px;
	padding: 46px 36px; margin-bottom: 38px;
}
.entry-header-page { margin-top: 8px; }
.entry-title {
	font-size: clamp(30px, 4.6vw, 46px); line-height: 1.12; letter-spacing: -.025em; margin: 14px 0 12px;
}
.entry-header-page .entry-title { margin: 0; }
.entry-meta { font-size: 14px; color: var(--ink-2); display: flex; gap: 8px; flex-wrap: wrap; }
.entry-thumb { margin: 0 0 32px; }
.entry-thumb img { border-radius: var(--radius); display: block; width: 100%; }

.entry-content { font-size: 18px; }
.entry-content > * { margin-top: 0; }
.entry-content h2 { font-size: clamp(23px, 3vw, 29px); line-height: 1.25; letter-spacing: -.015em; margin: 2.1em 0 .6em; }
.entry-content h3 { font-size: 20px; line-height: 1.35; margin: 1.8em 0 .4em; }
.entry-content p,
.entry-content ul,
.entry-content ol { margin: 0 0 1.2em; }
.entry-content ul,
.entry-content ol { padding-left: 1.3em; }
.entry-content li { margin-bottom: .45em; }
.entry-content li::marker { color: var(--green); }
.entry-content a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.entry-content strong { font-weight: 600; }
.entry-content code { background: var(--sage-2); padding: 2px 7px; border-radius: 7px; font-size: .88em; }

.entry-content figure.wp-block-table {
	margin: 1.6em 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 22px;
}
.entry-content table { width: 100%; border-collapse: collapse; font-size: 15.5px; line-height: 1.55; }
.entry-content th,
.entry-content td { padding: 12px 18px; text-align: left; border: 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.entry-content thead th { background: var(--sage-2); font-weight: 600; }
.entry-content tbody tr:last-child td { border-bottom: 0; }

.entry-content blockquote,
.entry-content .wp-block-quote {
	margin: 1.6em 0; padding: 22px 26px; border: 0;
	background: var(--mist); border-radius: 22px; font-style: normal;
}
.entry-content blockquote p:last-child { margin-bottom: 0; }

.entry-content hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

/* Writer box added at the end of each article */
.entry-content .tidibook-writer {
	margin-top: 2.6em; background: var(--ink); color: #dfe8e3;
	border-radius: var(--radius); padding: 26px 30px;
}
.entry-content .tidibook-writer hr { display: none; }
.entry-content .tidibook-writer p { margin: 0; font-size: 15.5px; line-height: 1.7; }
.entry-content .tidibook-writer strong { display: inline-block; color: #fff; font-size: 17px; margin-bottom: 4px; font-weight: 700; }

/* Related */
.related { padding-top: 64px; }

/* ---------- Forms (search, contact, comments) ---------- */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="tel"],
input[type="number"],
textarea,
select {
	font: inherit; font-size: 16px; width: 100%;
	padding: 13px 18px; border: 1px solid var(--line); border-radius: 18px;
	background: #fff; color: var(--ink);
}
textarea { min-height: 160px; }
input:focus,
textarea:focus,
select:focus { outline: 2px solid var(--green-2); border-color: transparent; }

button,
input[type="submit"],
.wp-block-button__link,
.wp-block-search__button {
	font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
	background: var(--green); color: #fff; border: 0; border-radius: 999px;
	padding: 13px 26px; line-height: 1.2;
}
button:hover,
input[type="submit"]:hover,
.wp-block-button__link:hover { background: var(--ink); color: #fff; }
.menu-toggle:hover { background: var(--sage); }

.search-form { display: flex; gap: 8px; max-width: 540px; margin: 0 auto 6px; }
.search-form label { flex: 1; }
.search-form .search-submit { width: auto; flex: none; }

.entry-content .contact-form label,
.entry-content .grunion-field-label { font-weight: 600; font-size: 15px; }

/* Comments */
.comments { margin-top: 56px; padding-top: 36px; border-top: 1px solid var(--line); }
.comments-title,
.comment-reply-title { font-size: 24px; letter-spacing: -.01em; margin: 0 0 18px; }
.comment-list { list-style: none; margin: 0 0 32px; padding: 0; }
.comment-list .comment { background: var(--mist); border-radius: 22px; padding: 18px 22px; margin-bottom: 14px; }
.comment-list .children { list-style: none; padding-left: 20px; margin-top: 14px; }
.comment-meta { font-size: 13px; color: var(--muted); }
.comment-author .avatar { border-radius: 50%; vertical-align: middle; margin-right: 8px; }
.comment-form p { margin: 0 0 14px; }
.comment-form label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }

/* ---------- Footer ---------- */
.site-footer { padding: 88px 0 24px; }
.footer-card {
	background: var(--ink); color: #c9d5ce; border-radius: var(--radius-lg);
	padding: 46px 40px 28px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px;
}
.footer-card .brand { color: #fff; }
.footer-card .brand span { color: var(--mint); }
.footer-brand p { margin: 12px 0 0; max-width: 440px; font-size: 15px; line-height: 1.7; }
.footer-menu { display: flex; flex-wrap: wrap; gap: 10px 22px; justify-content: flex-end; align-content: start; }
.footer-menu a { color: #fff; text-decoration: none; font-size: 15px; }
.footer-menu a:hover { color: var(--mint); }
.social-links { list-style: none; margin: 18px 0 0; padding: 0; display: flex; gap: 10px; }
.social-links a, .social-links span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; transition: background .2s, color .2s; }
.social-links a:hover, .social-links a:focus-visible { background: var(--mint); color: #12352a; }
.social-links .is-soon { opacity: .45; cursor: default; }
.copyright {
	grid-column: 1 / -1; margin: 6px 0 0; padding-top: 22px;
	border-top: 1px solid rgba(255, 255, 255, .12); font-size: 13px;
}

/* ---------- WordPress alignment helpers ---------- */
.alignleft { float: left; margin: .3em 1.4em 1em 0; }
.alignright { float: right; margin: .3em 0 1em 1.4em; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.wp-caption-text,
figcaption { font-size: 14px; color: var(--muted); text-align: center; margin-top: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
	.card-grid { grid-template-columns: repeat(2, 1fr); }
	.topic-grid,
	.steps { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
	.footer-card { grid-template-columns: 1fr; padding: 34px 26px 24px; }
	.footer-menu { justify-content: flex-start; }
}

@media (max-width: 640px) {
	body { font-size: 16px; }
	.wrap { padding: 0 16px; }
	.header-inner { min-height: 66px; }
	.brand { font-size: 23px; }
	.hero { padding: 28px 16px 24px; border-radius: 24px; }
	.hero h1 { font-size: 24px; margin: 10px auto 8px; }
	.hero-lead { font-size: 13.5px; line-height: 1.55; margin-bottom: 16px; }
	.hero .pill { font-size: 11.5px; padding: 3px 11px; }
	.hero-actions { gap: 8px; flex-wrap: nowrap; }
	.hero-actions .btn { padding: 9px 16px; font-size: 13.5px; }
	.section { padding-top: 60px; }
	.card-grid { grid-template-columns: 1fr; gap: 16px; }
	.card-body { padding: 22px; }
	.topic-grid { gap: 12px; }
	.topic-card { min-height: 168px; padding: 18px; border-radius: 24px; }
	.topic-card h3 { font-size: 17px; }
	.steps { grid-template-columns: 1fr; }
	.archive-hero { padding: 44px 18px; border-radius: 28px; }
	.entry-header { padding: 32px 22px; border-radius: 26px; margin-bottom: 30px; }
	.entry-content { font-size: 17px; }
	.entry-content .tidibook-writer { padding: 22px; }
	.search-form { flex-direction: column; }
	.search-form .search-submit { width: 100%; }
	.site-footer { padding-top: 64px; }
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { transition: none !important; animation: none !important; }
}
