/* ===============================================
   Insight Lab - Front-end polish
   theme.json 으로 처리하기 어려운 인터랙션/디테일만 여기서.
   =============================================== */

:root {
	--insight-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
	--insight-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ----- Global niceties ----- */
html {
	scroll-behavior: smooth;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

body {
	font-feature-settings: "ss01", "ss02", "cv01", "cv11";
}

/* 한영 혼용 줄바꿈: 영어 단어는 단어 단위로, 한글은 자연스럽게.
   긴 영어 단어/URL이 있어도 컨테이너 밖으로 새지 않도록 anywhere fallback. */
h1, h2, h3, h4, h5, h6,
.wp-block-post-title,
.wp-block-post-excerpt,
.insight-prose p,
.insight-prose li {
	word-break: keep-all;
	overflow-wrap: anywhere;
}

/* Grid/flex children should be allowed to shrink below content width */
.insight-card,
.wp-block-post-template > * {
	min-width: 0;
}

::selection {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--background);
}

::-webkit-scrollbar {
	width: 10px;
	height: 10px;
}
::-webkit-scrollbar-track {
	background: var(--wp--preset--color--background);
}
::-webkit-scrollbar-thumb {
	background: var(--wp--preset--color--surface-2);
	border-radius: 999px;
	border: 2px solid var(--wp--preset--color--background);
}
::-webkit-scrollbar-thumb:hover {
	background: var(--wp--preset--color--border);
}

/* ----- Sticky header polish ----- */
.insight-header {
	backdrop-filter: saturate(180%) blur(12px);
	-webkit-backdrop-filter: saturate(180%) blur(12px);
	background-color: color-mix(in srgb, var(--wp--preset--color--background) 80%, transparent) !important;
	border-bottom: 1px solid transparent;
	transition: border-color 200ms var(--insight-ease);
}

@supports not (backdrop-filter: blur(12px)) {
	.insight-header {
		background-color: var(--wp--preset--color--background) !important;
	}
}

/* Scroll-aware border (visual only — falls back gracefully). */
.insight-header {
	border-bottom-color: var(--wp--preset--color--border);
}

/* ----- Post grid card ----- */
.insight-card {
	position: relative;
	transition: transform 400ms var(--insight-ease-out);
}

.insight-card:hover {
	transform: translateY(-4px);
}

.insight-card .wp-block-post-title a,
.insight-card .wp-block-post-title {
	transition: color 200ms var(--insight-ease);
}

.insight-card:hover .wp-block-post-title a {
	color: var(--wp--preset--color--accent);
}

/* Card cover image */
.insight-card__cover {
	overflow: hidden;
	border-radius: 12px;
	background-color: var(--wp--preset--color--surface);
	position: relative;
}

.insight-card__cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 700ms var(--insight-ease-out);
}

.insight-card:hover .insight-card__cover img {
	transform: scale(1.04);
}

/* Empty cover placeholder (when no featured image) */
.insight-card .wp-block-post-featured-image:not(:has(img)) {
	display: none;
}

/* Tag/category chip look */
.insight-card .wp-block-post-terms a,
.wp-block-post-terms a {
	color: var(--wp--preset--color--muted);
	transition: color 200ms var(--insight-ease);
}

.wp-block-post-terms a:hover {
	color: var(--wp--preset--color--foreground);
}

/* ----- Single post (prose) ----- */
.insight-prose {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.8;
	color: var(--wp--preset--color--foreground);
}

.insight-prose > * + * {
	margin-top: 1.5em;
}

.insight-prose h2 {
	margin-top: 2.5em;
	margin-bottom: 0.75em;
	font-size: var(--wp--preset--font-size--x-large);
	font-weight: 700;
	letter-spacing: -0.025em;
	line-height: 1.3;
}

.insight-prose h3 {
	margin-top: 2em;
	margin-bottom: 0.5em;
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
	letter-spacing: -0.02em;
}

.insight-prose h4 {
	margin-top: 1.75em;
	margin-bottom: 0.5em;
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
}

.insight-prose p {
	font-size: inherit;
	line-height: inherit;
}

.insight-prose a:not(.wp-block-button__link) {
	color: var(--wp--preset--color--primary);
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--border);
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
	transition: text-decoration-color 200ms var(--insight-ease);
}

.insight-prose a:not(.wp-block-button__link):hover {
	text-decoration-color: var(--wp--preset--color--primary);
}

.insight-prose blockquote,
.insight-prose .wp-block-quote {
	border-left: 3px solid var(--wp--preset--color--primary);
	padding-left: 1.5rem;
	margin: 2em 0;
	font-size: var(--wp--preset--font-size--large);
	color: var(--wp--preset--color--foreground);
}

.insight-prose blockquote p {
	margin: 0.5em 0;
}

.insight-prose ul,
.insight-prose ol {
	padding-left: 1.5em;
}

.insight-prose ul li,
.insight-prose ol li {
	margin: 0.5em 0;
}

.insight-prose ul li::marker {
	color: var(--wp--preset--color--muted);
}

.insight-prose img,
.insight-prose .wp-block-image img {
	border-radius: 12px;
	width: 100%;
	height: auto;
}

.insight-prose figure figcaption,
.insight-prose .wp-element-caption {
	margin-top: 0.75em;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
	text-align: center;
}

.insight-prose code:not([class*="language-"]) {
	background-color: var(--wp--preset--color--surface-2);
	color: var(--wp--preset--color--foreground);
	padding: 0.15em 0.4em;
	border-radius: 4px;
	font-size: 0.9em;
	font-family: var(--wp--preset--font-family--mono);
}

.insight-prose pre.wp-block-code {
	background-color: var(--wp--preset--color--surface-2);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 12px;
	padding: 1.25rem 1.5rem;
	overflow-x: auto;
	font-size: var(--wp--preset--font-size--small);
}

.insight-prose pre.wp-block-code code {
	background: none;
	padding: 0;
}

.insight-prose hr {
	border: 0;
	border-top: 1px solid var(--wp--preset--color--border);
	margin: 3em 0;
}

/* Featured image rounded corners */
.wp-block-post-featured-image img {
	border-radius: 12px;
}

/* ----- Search block styling ----- */
.wp-block-search__inside-wrapper {
	border: 1px solid var(--wp--preset--color--border) !important;
	background-color: var(--wp--preset--color--surface);
	border-radius: 999px !important;
	padding: 4px 4px 4px 20px;
	transition: border-color 200ms var(--insight-ease);
}

.wp-block-search__inside-wrapper:focus-within {
	border-color: var(--wp--preset--color--primary) !important;
}

.wp-block-search__input {
	background: transparent !important;
	border: none !important;
	color: var(--wp--preset--color--foreground) !important;
	font-size: var(--wp--preset--font-size--small) !important;
	padding: 0.5rem 0 !important;
}

.wp-block-search__input:focus {
	outline: none !important;
}

.wp-block-search__input::placeholder {
	color: var(--wp--preset--color--muted);
}

.wp-block-search__button {
	background-color: var(--wp--preset--color--primary) !important;
	color: var(--wp--preset--color--background) !important;
	border: none !important;
	border-radius: 999px !important;
	padding: 0.5rem 0.75rem !important;
}

/* ----- Pagination ----- */
.wp-block-query-pagination {
	gap: var(--wp--preset--spacing--40);
	font-size: var(--wp--preset--font-size--small);
}

.wp-block-query-pagination a,
.wp-block-query-pagination .page-numbers {
	color: var(--wp--preset--color--subtle);
	padding: 0.5rem 0.85rem;
	border-radius: 8px;
	transition: all 200ms var(--insight-ease);
	text-decoration: none;
}

.wp-block-query-pagination a:hover {
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--primary);
}

.wp-block-query-pagination .page-numbers.current {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--background);
	font-weight: 600;
}

/* ----- Comment form ----- */
.insight-comments .wp-block-post-comments-form input[type="text"],
.insight-comments .wp-block-post-comments-form input[type="email"],
.insight-comments .wp-block-post-comments-form input[type="url"],
.insight-comments .wp-block-post-comments-form textarea {
	background-color: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	color: var(--wp--preset--color--foreground);
	border-radius: 8px;
	padding: 0.75rem 1rem;
	font-family: inherit;
	font-size: var(--wp--preset--font-size--small);
	transition: border-color 200ms var(--insight-ease);
}

.insight-comments input:focus,
.insight-comments textarea:focus {
	outline: none;
	border-color: var(--wp--preset--color--primary);
}

.insight-comments .wp-block-post-comments-form .submit {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--background);
	border: none;
	border-radius: 999px;
	padding: 0.75rem 1.5rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 200ms var(--insight-ease);
}

.insight-comments .wp-block-post-comments-form .submit:hover {
	background-color: var(--wp--preset--color--foreground);
}

/* ----- Navigation ----- */
.wp-block-navigation .wp-block-navigation-item__content {
	color: var(--wp--preset--color--subtle);
	transition: color 200ms var(--insight-ease);
}

.wp-block-navigation .wp-block-navigation-item__content:hover,
.wp-block-navigation .current-menu-item .wp-block-navigation-item__content {
	color: var(--wp--preset--color--primary);
}

/* ----- Site title hover ----- */
.wp-block-site-title a {
	transition: opacity 200ms var(--insight-ease);
}

.wp-block-site-title a:hover {
	opacity: 0.7;
}

/* =========================================
   Responsive
   템플릿 인라인 padding 을 미디어쿼리로 덮어씁니다.
   ========================================= */

/* Tablet (782 ~ 1024) — 2 column grid */
@media (max-width: 1024px) and (min-width: 782px) {
	.insight-post-grid .wp-block-post-template.is-layout-grid {
		grid-template-columns: repeat(2, 1fr) !important;
		gap: var(--wp--preset--spacing--70) !important;
	}
}

/* Phone & small tablet (≤781) — 1 column, tighter padding */
@media (max-width: 781px) {
	.insight-post-grid .wp-block-post-template.is-layout-grid {
		grid-template-columns: 1fr !important;
		gap: var(--wp--preset--spacing--90) !important;
	}

	.insight-header,
	main.wp-block-group.alignfull,
	.insight-footer {
		padding-left: 1.25rem !important;
		padding-right: 1.25rem !important;
	}

	.insight-header {
		padding-top: 1rem !important;
		padding-bottom: 1rem !important;
	}

	main.wp-block-group.alignfull {
		padding-top: 2.5rem !important;
		padding-bottom: 4rem !important;
	}

	.insight-footer {
		padding-top: 4rem !important;
		padding-bottom: 2.5rem !important;
		margin-top: 4rem !important;
	}

	/* Footer stacks: bring the brand block under the big tagline cleanly */
	.insight-footer .wp-block-columns {
		flex-direction: column !important;
		gap: var(--wp--preset--spacing--70) !important;
	}
	.insight-footer .wp-block-column {
		flex-basis: 100% !important;
	}

	/* Single-post body & prose */
	.insight-prose {
		font-size: var(--wp--preset--font-size--medium) !important;
		line-height: 1.75 !important;
	}

	/* Hero h1 letter-spacing softens on tiny screens */
	body.home main h1,
	body.blog main h1,
	main h1 {
		letter-spacing: -0.025em !important;
	}

	/* Tighter spacing under hero */
	.wp-block-spacer[style*="--wp--preset--spacing--100"] {
		height: 2rem !important;
	}
	.wp-block-spacer[style*="--wp--preset--spacing--110"] {
		height: 3rem !important;
	}
}

/* Phone only (≤480) — extra compaction */
@media (max-width: 480px) {
	.insight-header,
	main.wp-block-group.alignfull,
	.insight-footer {
		padding-left: 1rem !important;
		padding-right: 1rem !important;
	}

	main.wp-block-group.alignfull {
		padding-top: 2rem !important;
	}

	.insight-card {
		gap: 0.75rem !important;
	}

	.insight-card .wp-block-post-title {
		font-size: 1.25rem !important;
	}
}

/* =========================================
   Touch targets — pagination, nav, links
   엄지로 누르기 충분한 크기 보장.
   ========================================= */
@media (hover: none), (max-width: 781px) {
	.wp-block-query-pagination a,
	.wp-block-query-pagination .page-numbers {
		padding: 0.75rem 1rem !important;
		min-width: 44px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}

	.wp-block-navigation .wp-block-navigation-item__content {
		padding: 0.5rem 0 !important;
	}

	.wp-block-search__inside-wrapper {
		padding: 6px 6px 6px 20px !important;
	}
	.wp-block-search__button {
		min-height: 40px;
		min-width: 40px;
	}
}

/* =========================================
   Skip link (a11y / SEO)
   ========================================= */
.insight-skip-link {
	position: absolute;
	top: -100px;
	left: 1rem;
	z-index: 9999;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--background);
	padding: 0.75rem 1.25rem;
	border-radius: 999px;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-decoration: none;
	transition: top 200ms var(--insight-ease);
}
.insight-skip-link:focus {
	top: 1rem;
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

/* =========================================
   Reading time (insight-reading-time)
   the_content 필터로 게시물 본문 상단에 자동 삽입됨.
   ========================================= */
.insight-reading-time {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	margin: 0 0 var(--wp--preset--spacing--80) 0 !important;
	padding: 0.4rem 0.85rem;
	background-color: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 999px;
	font-size: var(--wp--preset--font-size--x-small) !important;
	color: var(--wp--preset--color--subtle) !important;
	letter-spacing: 0.01em;
	font-weight: 500;
	font-feature-settings: "tnum";
}

/* =========================================
   Mobile menu (overlay) — readable & tappable
   ========================================= */
.wp-block-navigation__responsive-container.is-menu-open {
	padding: var(--wp--preset--spacing--80) var(--wp--preset--spacing--70) !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-size: var(--wp--preset--font-size--x-large) !important;
	padding: 0.5rem 0 !important;
	font-weight: 500 !important;
}

/* ----- WP-admin bar offset for sticky header ----- */
@media screen and (min-width: 600px) {
	.admin-bar .insight-header {
		top: 32px !important;
	}
}

@media screen and (max-width: 782px) {
	.admin-bar .insight-header {
		top: 46px !important;
	}
}
