/* ==========================================================================
   Smart Gadgets Reviews – single article (single-post.php)
   --------------------------------------------------------------------------
   Loaded on single posts only (inc/single-article.php). Cards in "Related
   articles" reuse .sgr-card / .sgr-posts from css/content.css; optional
   boxes are styled in css/article-blocks.css. Colour variables (--sgr-c-*)
   are defined in css/content.css.

     1. Page frame (width aligned with header/footer)
     2. Header band: category, H1, excerpt, meta, disclosure
     3. Two-column layout (desktop) / single column (tablet, mobile)
     4. Featured image
     5. Article body typography
     6. Table of contents
     7. Article footer: tags, author box
     8. Related articles
     9. Responsive
   ========================================================================== */

/* 1. Page frame ----------------------------------------------------------- */
body .site-main.sgr-single {
	max-width: none;
	padding-inline: 0;
}
.sgr-single__container {
	box-sizing: border-box;
	width: 100%;
	max-width: 1240px; /* 1200px content + 2 × 20px, like the header */
	margin-inline: auto;
	padding-inline: 20px;
}
.sgr-single a:focus-visible,
.sgr-single summary:focus-visible {
	outline: 2px solid var(--sgr-c-primary);
	outline-offset: 2px;
}
@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}

/* 2. Header band ---------------------------------------------------------- */
.sgr-article__header {
	padding-block: 40px 48px;
	background: var(--sgr-c-light);
	border-block-end: 1px solid var(--sgr-c-border);
}
.sgr-article__category {
	margin: 0 0 16px;
}
.sgr-single .sgr-article__category a {
	display: inline-block;
	padding: 4px 12px;
	border-radius: 999px;
	background: #E5EDFF;
	color: var(--sgr-c-primary);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1.5;
	text-decoration: none;
	text-transform: uppercase;
}
.sgr-single .sgr-article__category a:hover {
	background: var(--sgr-c-primary);
	color: #FFFFFF;
}
.sgr-article__title {
	max-width: 900px;
	margin: 0;
	color: var(--sgr-c-navy);
	font-size: 44px;
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.02em;
	overflow-wrap: break-word;
}
.sgr-article__excerpt {
	max-width: 780px;
	margin: 16px 0 0;
	color: var(--sgr-c-text);
	font-size: 20px;
	line-height: 1.6;
}
.sgr-article__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 0;
	margin-top: 24px;
	color: var(--sgr-c-muted);
	font-size: 15px;
	line-height: 1.5;
}
.sgr-article__meta .sgr-avatar {
	margin-inline-end: 12px;
}
.sgr-article__meta-item + .sgr-article__meta-item::before {
	content: "\00B7";
	margin-inline: 10px;
	color: #98A2B3;
}
.sgr-article__meta time {
	color: var(--sgr-c-text);
}
.sgr-single .sgr-article__byline a {
	color: var(--sgr-c-navy);
	font-weight: 600;
	text-decoration: none;
}
.sgr-single .sgr-article__byline a:hover {
	color: var(--sgr-c-primary);
}

.sgr-avatar {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--sgr-c-navy);
	color: #FFFFFF;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.02em;
}
.sgr-avatar--lg {
	width: 56px;
	height: 56px;
	font-size: 18px;
}

.sgr-disclosure {
	max-width: 780px;
	margin-top: 24px;
	padding: 12px 16px;
	border: 1px solid var(--sgr-c-border);
	border-inline-start: 3px solid var(--sgr-c-primary);
	border-radius: 8px;
	background: #FFFFFF;
	color: var(--sgr-c-text);
	font-size: 14px;
	line-height: 1.6;
}
.sgr-disclosure p { margin: 0; }
.sgr-disclosure strong { color: var(--sgr-c-navy); }
.sgr-single .sgr-disclosure a {
	color: var(--sgr-c-primary);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* 3. Layout ----------------------------------------------------------------- */
.sgr-article__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas: "media" "aside" "body";
	gap: 32px 64px;
	padding-block: 40px 72px;
}
.sgr-article__layout--no-image {
	grid-template-areas: "aside" "body";
}
.sgr-article__media { grid-area: media; }
.sgr-article__aside { grid-area: aside; min-width: 0; }
.sgr-article__body { grid-area: body; min-width: 0; }

/* Without a table of contents the "aside" area is simply empty. */
.sgr-article__layout:not(.sgr-article__layout--toc) {
	grid-template-areas: "media" "body";
}
.sgr-article__layout--no-image:not(.sgr-article__layout--toc) {
	grid-template-areas: "body";
}

@media (min-width: 1025px) {
	.sgr-article__layout {
		grid-template-columns: minmax(0, 780px);
	}
	.sgr-article__layout--toc {
		grid-template-columns: minmax(0, 780px) 300px;
		grid-template-areas: "media aside" "body aside";
		grid-template-rows: auto 1fr;
		justify-content: space-between;
	}
	.sgr-article__layout--toc.sgr-article__layout--no-image {
		grid-template-areas: "body aside";
		grid-template-rows: auto;
	}
	.sgr-article__aside {
		align-self: start;
		position: sticky;
		top: 24px;
	}
	.admin-bar .sgr-article__aside { top: 56px; }
}

/* 4. Featured image --------------------------------------------------------- */
.sgr-article__media {
	margin: 0;
}
.sgr-article__img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 10; /* space reserved before the image loads: no layout shift */
	object-fit: cover;
	border-radius: var(--sgr-radius);
	background: var(--sgr-c-light);
}
.sgr-article__caption {
	margin-top: 10px;
	color: var(--sgr-c-muted);
	font-size: 14px;
	line-height: 1.5;
}

/* 5. Article body ---------------------------------------------------------- */
.sgr-article__content {
	color: var(--sgr-c-text);
	font-size: 18px;
	line-height: 1.75;
	overflow-wrap: break-word;
}
.sgr-article__content > :first-child { margin-top: 0; }
.sgr-article__content p {
	margin: 0 0 1.25em;
}
.sgr-article__content h2,
.sgr-article__content h3,
.sgr-article__content h4 {
	color: var(--sgr-c-navy);
	font-weight: 700;
	scroll-margin-top: 24px;
}
.admin-bar .sgr-article__content :is(h2, h3, h4) { scroll-margin-top: 56px; }
.sgr-article__content h2 {
	margin: 48px 0 16px;
	font-size: 30px;
	line-height: 1.25;
	letter-spacing: -0.01em;
}
.sgr-article__content h3 {
	margin: 36px 0 12px;
	font-size: 22px;
	line-height: 1.35;
}
.sgr-article__content h4 {
	margin: 28px 0 10px;
	font-size: 18px;
	line-height: 1.4;
}
.sgr-single .sgr-article__content a:not(.wp-block-button__link):not(.sgr-btn) {
	color: var(--sgr-c-primary);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}
.sgr-single .sgr-article__content a:not(.wp-block-button__link):not(.sgr-btn):hover {
	color: var(--sgr-c-navy);
}
/* Product components (css/products.css) style their own buttons and lists. */
.sgr-article__content :is(ul, ol):not(.sgr-list):not(.sgr-product *) {
	margin: 0 0 1.25em;
	padding-inline-start: 1.5em;
}
.sgr-article__content li { margin-bottom: 0.5em; }
.sgr-article__content li::marker { color: var(--sgr-c-primary); }
.sgr-article__content img {
	max-width: 100%;
	height: auto;
	border-radius: 8px;
}
.sgr-article__content figure {
	margin: 32px 0;
}
.sgr-article__content figcaption,
.sgr-article__content .wp-element-caption {
	margin-top: 8px;
	color: var(--sgr-c-muted);
	font-size: 14px;
	line-height: 1.5;
	text-align: start;
}
.sgr-article__content blockquote,
.sgr-article__content .wp-block-quote {
	margin: 32px 0;
	padding: 4px 0 4px 24px;
	border-inline-start: 4px solid var(--sgr-c-primary);
	color: var(--sgr-c-navy);
	font-size: 20px;
	font-style: italic;
}
.sgr-article__content blockquote cite {
	display: block;
	margin-top: 8px;
	color: var(--sgr-c-muted);
	font-size: 15px;
	font-style: normal;
}
/* Plain tables (not the boxed specification/comparison tables). */
.sgr-article__content .wp-block-table:not(.sgr-table) {
	overflow-x: auto;
}
.sgr-article__content .wp-block-table:not(.sgr-table) table {
	width: 100%;
	border-collapse: collapse;
	font-size: 16px;
}
.sgr-article__content .wp-block-table:not(.sgr-table) :is(th, td) {
	padding: 10px 12px;
	border: 1px solid var(--sgr-c-border);
	text-align: start;
}
.sgr-article__content .wp-block-table:not(.sgr-table) thead th {
	background: var(--sgr-c-light);
	color: var(--sgr-c-navy);
}
.sgr-article__content hr {
	margin: 48px 0;
	border: 0;
	border-top: 1px solid var(--sgr-c-border);
}
.sgr-article__content code {
	padding: 2px 6px;
	border-radius: 4px;
	background: var(--sgr-c-light);
	font-size: 0.9em;
}
.sgr-article__content pre {
	padding: 16px;
	border-radius: 8px;
	background: var(--sgr-c-navy);
	color: #FFFFFF;
	overflow-x: auto;
}
.sgr-article__content pre code { padding: 0; background: none; }
.sgr-article__content .alignwide,
.sgr-article__content .alignfull {
	margin-inline: 0;
	width: auto;
	max-width: 100%;
}

.sgr-article__pages {
	margin-top: 32px;
	font-weight: 600;
}

/* 6. Table of contents ------------------------------------------------------ */
.sgr-toc__details {
	border: 1px solid var(--sgr-c-border);
	border-radius: var(--sgr-radius);
	background: #FFFFFF;
}
.sgr-toc__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	cursor: pointer;
	list-style: none;
}
.sgr-toc__summary::-webkit-details-marker { display: none; }
.sgr-toc__summary::after {
	content: "";
	width: 8px;
	height: 8px;
	margin-inline-start: 12px;
	border-right: 2px solid var(--sgr-c-navy);
	border-bottom: 2px solid var(--sgr-c-navy);
	transform: rotate(45deg) translateY(-2px);
	transition: transform .2s ease;
}
.sgr-toc__details[open] .sgr-toc__summary::after {
	transform: rotate(-135deg) translateY(-2px);
}
.sgr-toc__title {
	color: var(--sgr-c-navy);
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}
.sgr-toc__list,
.sgr-toc__sub {
	margin: 0;
	padding: 0;
	list-style: none;
}
.sgr-toc__list {
	padding: 0 20px 16px;
	font-size: 15px;
	line-height: 1.45;
}
.sgr-toc__list > li {
	margin: 0;
	border-top: 1px solid var(--sgr-c-border);
}
.sgr-toc__sub {
	margin: -4px 0 8px;
	padding-inline-start: 14px;
	font-size: 14px;
}
.sgr-single .sgr-toc a {
	display: block;
	padding: 9px 0;
	color: var(--sgr-c-text);
	text-decoration: none;
}
.sgr-single .sgr-toc__sub a {
	padding: 5px 0;
	color: var(--sgr-c-muted);
}
.sgr-single .sgr-toc a:hover {
	color: var(--sgr-c-primary);
}

@media (min-width: 1025px) {
	/* Desktop: always open sidebar box; the scroll area stays in view. */
	.sgr-toc__summary {
		cursor: default;
		padding-bottom: 12px;
	}
	.sgr-toc__summary::after { display: none; }
	.sgr-toc__list {
		max-height: calc(100vh - 140px);
		overflow-y: auto;
	}
}
@media (max-width: 1024px) {
	.sgr-toc__details { background: var(--sgr-c-light); }
	.sgr-toc__list > li { border-color: #E4E7EC; }
}

/* 7. Article footer ---------------------------------------------------------- */
.sgr-article__footer {
	margin-top: 48px;
}
.sgr-article__tags {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0 0 24px;
	font-size: 14px;
}
.sgr-article__tags-label {
	color: var(--sgr-c-muted);
	font-weight: 600;
}
.sgr-single .sgr-article__tags a {
	padding: 4px 10px;
	border: 1px solid var(--sgr-c-border);
	border-radius: 999px;
	color: var(--sgr-c-text);
	text-decoration: none;
}
.sgr-single .sgr-article__tags a:hover {
	border-color: var(--sgr-c-primary);
	color: var(--sgr-c-primary);
}

.sgr-author {
	display: flex;
	align-items: flex-start;
	gap: 20px;
	padding: 24px;
	border: 1px solid var(--sgr-c-border);
	border-radius: var(--sgr-radius);
	background: var(--sgr-c-light);
}
.sgr-author__body { min-width: 0; }
.sgr-author__label {
	margin: 0;
	color: var(--sgr-c-muted);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}
.sgr-author__name {
	margin: 2px 0 0;
	color: var(--sgr-c-navy);
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
}
.sgr-author__bio {
	margin-top: 8px;
	color: var(--sgr-c-text);
	font-size: 15px;
	line-height: 1.65;
}
.sgr-author__bio p { margin: 0 0 0.75em; }
.sgr-author__bio p:last-child { margin-bottom: 0; }
.sgr-single .sgr-author__link {
	display: inline-block;
	margin-top: 10px;
	color: var(--sgr-c-primary);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
}
.sgr-single .sgr-author__link::after { content: " \2192"; }
.sgr-single .sgr-author__link:hover { color: var(--sgr-c-navy); }

.sgr-article__body #comments,
.sgr-article__body .comment-respond { margin-top: 48px; }
/* WordPress comment form (Settings > Discussion): match the article headings. */
.sgr-article__body .comment-reply-title,
.sgr-article__body .comments-title {
	margin: 0 0 12px;
	color: var(--sgr-c-navy);
	font-size: 24px;
	font-weight: 700;
	line-height: 1.3;
}
.sgr-article__body .comment-form { font-size: 15px; }

/* 8. Related articles -------------------------------------------------------- */
.sgr-related {
	padding-block: 64px 88px;
	background: var(--sgr-c-light);
	border-block-start: 1px solid var(--sgr-c-border);
}
.sgr-related__title {
	margin: 0 0 24px;
	color: var(--sgr-c-navy);
	font-size: 28px;
	font-weight: 700;
	line-height: 1.25;
}
.sgr-related .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

/* 9. Responsive ----------------------------------------------------------- */
@media (max-width: 1024px) {
	.sgr-article__title { font-size: 38px; }
	.sgr-article__layout { padding-block: 32px 64px; gap: 24px; }
	.sgr-article__layout > * { max-width: 780px; }
}
@media (max-width: 767px) {
	.sgr-article__header { padding-block: 28px 32px; }
	.sgr-article__category { margin-bottom: 12px; }
	.sgr-article__title { font-size: 30px; line-height: 1.2; }
	.sgr-article__excerpt { font-size: 17px; }
	.sgr-article__meta { margin-top: 20px; font-size: 14px; }
	.sgr-article__content { font-size: 17px; line-height: 1.7; }
	.sgr-article__content h2 { margin-top: 40px; font-size: 25px; }
	.sgr-article__content h3 { margin-top: 28px; font-size: 20px; }
	.sgr-article__content blockquote,
	.sgr-article__content .wp-block-quote { font-size: 18px; padding-inline-start: 18px; }
	.sgr-article__footer { margin-top: 40px; }
	.sgr-author { gap: 16px; padding: 20px; }
	.sgr-avatar--lg { width: 48px; height: 48px; font-size: 16px; }
	.sgr-related { padding-block: 48px 64px; }
	.sgr-related__title { font-size: 24px; }
}
@media (max-width: 400px) {
	.sgr-article__title { font-size: 27px; }
}
@media (prefers-reduced-motion: reduce) {
	.sgr-toc__summary::after { transition: none; }
}
