/*
Theme Name: Shieltag
Theme URI: https://example.com/shieltag
Author: Karya Generasi Biru
Author URI: https://example.com
Description: A simple, clean block theme for the Shieltag blog. White header, soft blue footer, and a minimal three-page layout (Blog, Categories, Contact).
Requires at least: 6.5
Tested up to: 6.9
Requires PHP: 7.4
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: shieltag
Tags: blog, block-theme, full-site-editing, one-column, custom-colors, custom-menu
*/

/* =====================================================================
   Sticky footer — keeps footer at viewport bottom on short pages
   ===================================================================== */
.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}
.wp-site-blocks > .shieltag-main {
	flex: 1 0 auto;
}

/* =====================================================================
   Footer — full viewport width
   Flow layout makes sections block-level (full width); zero out the
   24 px margin-block-start that WordPress injects between flow children.
   ===================================================================== */
.wp-site-blocks > footer.wp-block-template-part {
	width: 100%;
	max-width: none !important;
	margin-inline: 0 !important;
}
footer.wp-block-group.is-layout-flow > .wp-block-group {
	margin-block-start: 0 !important;
	margin-block-end: 0 !important;
}

/* =====================================================================
   Blog hero banner
   ===================================================================== */
.shieltag-blog-hero {
	background: linear-gradient(135deg, #eef2ff 0%, #e4ebff 100%);
	border-bottom: 1px solid #e6eaf2;
}

/* =====================================================================
   Post card — outer wrapper
   ===================================================================== */
.shieltag-post-card {
	overflow: hidden;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.shieltag-post-card:hover {
	box-shadow: 0 8px 32px rgba(52, 80, 162, 0.11);
	transform: translateY(-3px);
}

/* =====================================================================
   Card inner — horizontal flex row
   ===================================================================== */
.shieltag-card-inner {
	display: flex !important;
	flex-direction: row !important;
	align-items: stretch !important;
	flex-wrap: nowrap !important;
	min-height: 160px;
}

/* =====================================================================
   Card image column — fixed 220 px, covers its space
   ===================================================================== */
.shieltag-card-image {
	flex: 0 0 220px !important;
	width: 220px !important;
	overflow: hidden;
	position: relative;
}
.shieltag-card-image .wp-block-post-featured-image {
	height: 100%;
}
.shieltag-card-image .wp-block-post-featured-image a,
.shieltag-card-image .wp-block-post-featured-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
/* Hide image column gracefully when no featured image is set */
.shieltag-card-image:not(:has(img)) {
	display: none;
}

/* =====================================================================
   Card content column
   ===================================================================== */
.shieltag-card-content {
	flex: 1 !important;
	display: flex !important;
	flex-direction: column !important;
	gap: 0.55rem !important;
}
.shieltag-card-content .wp-block-post-title a {
	text-decoration: none;
	color: var(--wp--preset--color--contrast);
	transition: color 0.15s;
}
.shieltag-card-content .wp-block-post-title a:hover {
	color: #3450a2;
}

/* =====================================================================
   Category chip — pill badge on cards
   ===================================================================== */
.shieltag-category-chip .wp-block-post-terms {
	display: flex;
	gap: 0.35rem;
	flex-wrap: wrap;
}
.shieltag-category-chip .wp-block-post-terms a {
	display: inline-block;
	background: #eef2ff;
	color: #3450a2;
	padding: 0.18rem 0.65rem;
	border-radius: 999px;
	text-decoration: none !important;
	font-size: 0.72rem !important;
	font-weight: 600 !important;
	text-transform: uppercase !important;
	letter-spacing: 0.05em !important;
	transition: background 0.15s, color 0.15s;
}
.shieltag-category-chip .wp-block-post-terms a:hover {
	background: #3450a2;
	color: #fff;
}

/* =====================================================================
   "Read more →" link in excerpt
   ===================================================================== */
.shieltag-read-more {
	margin-top: auto;
}
.shieltag-read-more .wp-block-post-excerpt__more-link {
	color: #3450a2;
	font-weight: 600;
	font-size: 0.88rem;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 0.2rem;
}
.shieltag-read-more .wp-block-post-excerpt__more-link:hover {
	text-decoration: underline;
}

/* =====================================================================
   Sidebar widgets
   ===================================================================== */
.shieltag-sidebar-heading {
	color: #3450a2 !important;
	border-bottom: 2px solid #3450a2;
	padding-bottom: 0.5rem !important;
	margin-bottom: 0.9rem !important;
}

/* =====================================================================
   WP Popular Posts widget — thumbnail left, text right (CSS Grid)
   ===================================================================== */
.shieltag-sidebar-widget .wpp-list {
	padding: 0;
	margin: 0;
	list-style: none;
}

/* Each list item: 2-column grid — thumbnail | text stack */
.shieltag-sidebar-widget .wpp-list li {
	display: grid;
	grid-template-columns: 70px 1fr;
	grid-template-rows: auto auto auto;
	column-gap: 0.75rem;
	align-items: start;
	padding: 0.75rem 0;
	border-bottom: 1px solid #f0f3f9;
}
.shieltag-sidebar-widget .wpp-list li:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

/* Thumbnail anchor — spans all text rows in column 1 */
.shieltag-sidebar-widget .wpp-list li > a:first-child {
	grid-column: 1;
	grid-row: 1 / 4;
	display: block;
	flex-shrink: 0;
}
.shieltag-sidebar-widget .wpp-list li > a:first-child img {
	width: 70px;
	height: 70px;
	object-fit: cover;
	border-radius: 6px;
	display: block;
}

/* Post title — column 2, row 1 */
.shieltag-sidebar-widget .wpp-list .wpp-post-title {
	grid-column: 2;
	grid-row: 1;
	font-weight: 600;
	text-decoration: none;
	color: var(--wp--preset--color--contrast);
	font-size: 0.88rem;
	line-height: 1.35;
	display: block;
}
.shieltag-sidebar-widget .wpp-list .wpp-post-title:hover {
	color: #3450a2;
}

/* Excerpt — column 2, row 2; clamped to 3 lines */
.shieltag-sidebar-widget .wpp-list .wpp-excerpt {
	grid-column: 2;
	grid-row: 2;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 0.8rem;
	color: #5b6272;
	line-height: 1.45;
	margin-top: 0.2rem;
}

/* Meta (views, date) — column 2, row 3 */
.shieltag-sidebar-widget .wpp-list .wpp-meta {
	grid-column: 2;
	grid-row: 3;
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	font-size: 0.75rem;
	color: #5b6272;
	margin-top: 0.25rem;
}
.shieltag-sidebar-widget .wpp-list .wpp-views,
.shieltag-sidebar-widget .wpp-list .wpp-date {
	font-size: 0.75rem;
	color: #5b6272;
}

/* No-thumbnail variant: single column */
.shieltag-sidebar-widget .wpp-list:not(.wpp-list-with-thumbnails) li {
	display: block;
}

/* =====================================================================
   Pagination
   ===================================================================== */
.wp-block-query-pagination {
	font-size: 0.9rem;
}
.wp-block-query-pagination-numbers .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2rem;
	height: 2rem;
	border-radius: 6px;
	padding: 0 0.4rem;
	text-decoration: none;
	font-weight: 500;
	color: #3450a2;
	transition: background 0.15s, color 0.15s;
}
.wp-block-query-pagination-numbers .page-numbers.current,
.wp-block-query-pagination-numbers .page-numbers:hover {
	background: #3450a2;
	color: #fff;
}

/* =====================================================================
   Header — ensure white background persists
   ===================================================================== */
header.wp-block-group {
	background-color: #ffffff;
	position: sticky;
	top: 0;
	z-index: 100;
}

/* =====================================================================
   Navigation — active link underline
   ===================================================================== */
.wp-block-navigation .current-menu-item > a {
	color: #3450a2 !important;
	border-bottom: 2px solid #3450a2;
}

/* =====================================================================
   Single post & page — readable line length
   ===================================================================== */
.wp-block-post-content > * {
	max-width: 72ch;
}
.wp-block-post-content > .alignwide,
.wp-block-post-content > .alignfull {
	max-width: none;
}

/* =====================================================================
   Comments section — wrapper & title
   ===================================================================== */
.shieltag-comments {
	border-top: 2px solid #e6eaf2;
	padding-top: var(--wp--preset--spacing--60);
}

.shieltag-comments-title {
	font-size: 1.3rem !important;
	font-weight: 700 !important;
	color: var(--wp--preset--color--contrast) !important;
	display: flex !important;
	align-items: center;
	gap: 0.6rem;
	margin-bottom: 1.75rem !important;
}

.shieltag-comments-title::before {
	content: '';
	display: inline-block;
	width: 4px;
	height: 1.1em;
	background: #3450a2;
	border-radius: 3px;
	flex-shrink: 0;
}

/* =====================================================================
   Comment list spacing
   ===================================================================== */
.shieltag-comment-list {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--40);
	list-style: none;
	padding: 0;
	margin: 0;
}

/* =====================================================================
   Individual comment card
   ===================================================================== */
.shieltag-comment-item {
	transition: box-shadow 0.2s ease;
}

.shieltag-comment-item:hover {
	box-shadow: 0 6px 24px rgba(52, 80, 162, 0.09);
}

/* Avatar — circular, bordered */
.shieltag-comment-item .wp-block-avatar img {
	border-radius: 50% !important;
	border: 2px solid #d1d9f0;
	width: 48px !important;
	height: 48px !important;
	object-fit: cover;
	display: block;
}

/* Author name */
.shieltag-comment-item .wp-block-comment-author-name,
.shieltag-comment-item .wp-block-comment-author-name a {
	font-weight: 700 !important;
	font-size: 0.95rem !important;
	color: var(--wp--preset--color--contrast) !important;
	text-decoration: none !important;
}

/* Date */
.shieltag-comment-item .wp-block-comment-date,
.shieltag-comment-item .wp-block-comment-date a {
	font-size: 0.8rem !important;
	color: #5b6272 !important;
	text-decoration: none !important;
}

/* Comment body text */
.shieltag-comment-item .wp-block-comment-content p {
	font-size: 0.95rem;
	line-height: 1.7;
	color: #3d4452;
	margin: 0;
}

/* Reply button */
.shieltag-reply-btn .comment-reply-link,
.shieltag-comment-item .comment-reply-link {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	font-size: 0.82rem !important;
	font-weight: 600 !important;
	color: #3450a2 !important;
	text-decoration: none !important;
	padding: 0.3rem 0.85rem;
	border: 1.5px solid #d1d9f0;
	border-radius: 999px;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.shieltag-reply-btn .comment-reply-link::before,
.shieltag-comment-item .comment-reply-link::before {
	content: '↩';
	font-size: 0.9em;
}

.shieltag-reply-btn .comment-reply-link:hover,
.shieltag-comment-item .comment-reply-link:hover {
	background: #eef2ff;
	border-color: #3450a2;
}

/* =====================================================================
   Threaded replies — indented sub-list
   ===================================================================== */
.wp-block-comment > .children,
ol.children {
	list-style: none;
	padding: 0;
	margin: 1rem 0 0 2.5rem;
	border-left: 2px solid #e6eaf2;
	padding-left: 1rem;
}

/* =====================================================================
   Comment form
   ===================================================================== */
.shieltag-comment-form #respond,
.shieltag-comments #respond {
	background: #ffffff;
	border: 1.5px solid #e6eaf2;
	border-radius: 16px;
	padding: 2rem 2rem 2rem;
	margin-top: 2.5rem;
}

.shieltag-comment-form #respond h3#reply-title,
.shieltag-comments #respond h3#reply-title {
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--wp--preset--color--contrast);
	margin: 0 0 1.5rem;
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0.5rem;
}

/* "Cancel reply" link next to the form title */
.shieltag-comments #respond #cancel-comment-reply-link {
	font-size: 0.82rem;
	font-weight: 400;
	color: #5b6272;
	text-decoration: none;
}

.shieltag-comments #respond #cancel-comment-reply-link:hover {
	text-decoration: underline;
}

/* Logged-in note */
.shieltag-comments #respond .logged-in-as {
	font-size: 0.85rem;
	color: #5b6272;
	margin: -0.75rem 0 1.25rem;
}

.shieltag-comments #respond .logged-in-as a {
	color: #3450a2;
}

/* Required field note */
.shieltag-comments #respond .comment-notes {
	font-size: 0.82rem;
	color: #5b6272;
	margin: 0 0 1.25rem;
}

/* Form fields */
.shieltag-comments #respond .comment-form p {
	margin: 0 0 1rem;
}

.shieltag-comments #respond label {
	display: block;
	font-size: 0.85rem;
	font-weight: 600;
	color: #3d4452;
	margin-bottom: 0.4rem;
}

.shieltag-comments #respond input[type="text"],
.shieltag-comments #respond input[type="email"],
.shieltag-comments #respond input[type="url"],
.shieltag-comments #respond textarea {
	width: 100%;
	border: 1.5px solid #d1d9f0;
	border-radius: 8px;
	padding: 0.65rem 0.9rem;
	font-size: 0.95rem;
	font-family: inherit;
	color: var(--wp--preset--color--contrast);
	background: #f8f9fc;
	transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
	box-sizing: border-box;
}

.shieltag-comments #respond input[type="text"]:focus,
.shieltag-comments #respond input[type="email"]:focus,
.shieltag-comments #respond input[type="url"]:focus,
.shieltag-comments #respond textarea:focus {
	outline: none;
	border-color: #3450a2;
	background: #ffffff;
	box-shadow: 0 0 0 3px rgba(52, 80, 162, 0.12);
}

.shieltag-comments #respond textarea {
	min-height: 140px;
	resize: vertical;
}

/* Cookie consent checkbox row */
.shieltag-comments #respond .comment-form-cookies-consent {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	font-size: 0.82rem;
	color: #5b6272;
}

.shieltag-comments #respond .comment-form-cookies-consent input[type="checkbox"] {
	margin-top: 0.15rem;
	accent-color: #3450a2;
}

/* Submit button */
.shieltag-comments #respond .form-submit {
	margin: 0.5rem 0 0;
}

.shieltag-comments #respond input[type="submit"] {
	background: #3450a2;
	color: #ffffff;
	border: none;
	border-radius: 8px;
	padding: 0.75rem 2.25rem;
	font-size: 0.95rem;
	font-weight: 700;
	cursor: pointer;
	font-family: inherit;
	letter-spacing: 0.02em;
	transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.shieltag-comments #respond input[type="submit"]:hover {
	background: #2a3f85;
	box-shadow: 0 4px 16px rgba(52, 80, 162, 0.28);
	transform: translateY(-1px);
}

.shieltag-comments #respond input[type="submit"]:active {
	transform: translateY(0);
	box-shadow: none;
}

/* =====================================================================
   Responsive — tablet & mobile
   ===================================================================== */
@media (max-width: 900px) {
	/* Stack columns vertically */
	.wp-block-columns:not(.is-not-stacked-on-mobile) {
		flex-direction: column !important;
	}
	.wp-block-column[style*="flex-basis:65%"],
	.wp-block-column[style*="flex-basis:35%"] {
		flex-basis: 100% !important;
	}
}

@media (max-width: 640px) {
	/* Stack the card image above content on small screens */
	.shieltag-card-inner {
		flex-direction: column !important;
	}
	.shieltag-card-image {
		flex: 0 0 auto !important;
		width: 100% !important;
		max-height: 200px;
	}
	.shieltag-card-image .wp-block-post-featured-image {
		max-height: 200px;
	}
	.shieltag-card-image .wp-block-post-featured-image img {
		height: 200px;
	}
}

/* =====================================================================
   Categories page — hero
   ===================================================================== */
.shieltag-cat-hero {
	background: #ffffff;
	border-bottom: 1px solid #e6eaf2;
}

/* =====================================================================
   Categories page — tab bar
   ===================================================================== */
.shieltag-tab-bar {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
	margin-top: 0.25rem;
}

.shieltag-tab {
	display: inline-block;
	padding: 0.45rem 1.25rem;
	border-radius: 999px;
	background: #ffffff;
	border: 1.5px solid #d1d9f0;
	color: #3450a2;
	font-size: 0.88rem;
	font-weight: 600;
	text-decoration: none !important;
	transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
	white-space: nowrap;
}

.shieltag-tab:hover {
	background: #eef2ff;
	border-color: #3450a2;
}

.shieltag-tab.is-active,
.shieltag-tab[aria-selected="true"] {
	background: #3450a2;
	color: #ffffff;
	border-color: #3450a2;
	box-shadow: 0 2px 8px rgba(52, 80, 162, 0.22);
}

/* =====================================================================
   Categories page — card grid (server-rendered via wp:post-template)
   ===================================================================== */
.shieltag-cat-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.shieltag-cat-card:hover {
	box-shadow: 0 8px 32px rgba(52, 80, 162, 0.13);
	transform: translateY(-3px);
}

/* Featured image: 16:9 top, rounded top corners */
.shieltag-cat-card .wp-block-post-featured-image {
	aspect-ratio: 16 / 9;
	overflow: hidden;
}

.shieltag-cat-card .wp-block-post-featured-image a,
.shieltag-cat-card .wp-block-post-featured-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Card body */
.cat-card-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.cat-card-body .wp-block-post-title {
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.35;
}

.cat-card-body .wp-block-post-title a {
	text-decoration: none;
	color: var(--wp--preset--color--contrast);
	transition: color 0.15s;
}

.cat-card-body .wp-block-post-title a:hover {
	color: #3450a2;
}

.cat-card-body .wp-block-post-date {
	font-size: 0.8rem;
	color: #5b6272;
}

/* Excerpt — 3-line clamp */
.cat-card-excerpt,
.cat-card-body .wp-block-post-excerpt__excerpt {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 0.875rem;
	color: #5b6272;
	line-height: 1.55;
	margin: 0;
}

/* Hide "read more" link inside excerpts on cat grid */
.cat-card-excerpt .wp-block-post-excerpt__more-link,
.cat-card-body .wp-block-post-excerpt__more-link {
	display: none;
}

/* =====================================================================
   Categories page — JS-rendered cards (same visual style)
   ===================================================================== */
.shieltag-cat-card-item {
	list-style: none;
}

.shieltag-cat-card-item .shieltag-cat-card {
	border: 1px solid #e6eaf2;
	border-radius: 12px;
	background: #ffffff;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	height: 100%;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.shieltag-cat-card-item .shieltag-cat-card:hover {
	box-shadow: 0 8px 32px rgba(52, 80, 162, 0.13);
	transform: translateY(-3px);
}

.cat-card-thumb {
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #f0f3fb;
}

.cat-card-img-link {
	display: block;
	height: 100%;
}

.cat-card-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cat-card-img-placeholder {
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #eef2ff, #e4ebff);
}

.shieltag-cat-card-item .cat-card-body {
	padding: 1.25rem;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.cat-card-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
}

.shieltag-chip {
	display: inline-block;
	background: #eef2ff;
	color: #3450a2;
	padding: 0.18rem 0.65rem;
	border-radius: 999px;
	text-decoration: none !important;
	font-size: 0.72rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	transition: background 0.15s, color 0.15s;
}

.shieltag-chip:hover {
	background: #3450a2;
	color: #ffffff;
}

.cat-card-title {
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.35;
	margin: 0;
}

.cat-card-title a {
	text-decoration: none;
	color: var(--wp--preset--color--contrast);
	transition: color 0.15s;
}

.cat-card-title a:hover {
	color: #3450a2;
}

.cat-card-date {
	font-size: 0.8rem;
	color: #5b6272;
	display: block;
}

.cat-card-excerpt {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 0.875rem;
	color: #5b6272;
	line-height: 1.55;
	margin: 0;
}

/* =====================================================================
   Categories page — loading & empty states
   ===================================================================== */
.shieltag-cat-grid .wp-block-post-template.is-loading {
	opacity: 0.5;
	pointer-events: none;
}

.shieltag-grid-loading {
	list-style: none;
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	padding: 3rem 0;
	font-size: 0.95rem;
	color: #5b6272;
}

.shieltag-spinner {
	display: inline-block;
	width: 1.1rem;
	height: 1.1rem;
	border: 2px solid #d1d9f0;
	border-top-color: #3450a2;
	border-radius: 50%;
	animation: shieltag-spin 0.7s linear infinite;
}

@keyframes shieltag-spin {
	to { transform: rotate(360deg); }
}

.shieltag-no-posts {
	list-style: none;
	grid-column: 1 / -1;
	text-align: center;
	padding: 3rem 0;
	color: #5b6272;
}

/* =====================================================================
   Categories page — responsive grid
   ===================================================================== */
@media (max-width: 900px) {
	.shieltag-cat-grid .wp-block-post-template {
		grid-template-columns: repeat(2, 1fr) !important;
	}
}

@media (max-width: 560px) {
	.shieltag-cat-grid .wp-block-post-template {
		grid-template-columns: 1fr !important;
	}

	.shieltag-tab-bar {
		gap: 0.4rem;
	}

	.shieltag-tab {
		padding: 0.4rem 0.9rem;
		font-size: 0.82rem;
	}
}
