/*
 * Saero Women's Clinic blog.
 *
 * Values are taken from design/example.jpeg and design/main.png. The mockup is
 * a scaled screenshot, so metrics were derived by measuring it and scaling to a
 * 1920px design width -- see docs/design-notes.md for the arithmetic.
 */

/* ── Tokens ─────────────────────────────────────────────── */

:root {
	--c-bg: #ffffff;
	--c-surface: #f2f2f2;
	--c-line: #e5e5e5;

	--c-text: #222222;   /* card titles, body copy   */
	--c-text-2: #666666; /* category nav, hours      */
	--c-text-3: #888888; /* excerpts                 */
	--c-text-4: #aaaaaa; /* dates, placeholders      */

	--c-accent: #f89880; /* coral: hour pills, notes */
	--c-on-accent: #ffffff;

	/* Warm brown wash over the hero photograph. */
	--hero-scrim: rgba(88, 71, 58, 0.46);

	/*
	 * Pretendard matches the mockup and is the de-facto Korean UI face, but it
	 * is not bundled -- no external font request is made. If it is installed or
	 * self-hosted later it is picked up automatically; until then the platform
	 * Korean faces are used. See docs/design-notes.md.
	 */
	--font-body: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo",
		"Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif;

	--container: 1200px;
	--sidebar-w: 170px;
	--gutter: 56px;

	--pill: 999px;
}

/* ── Base ───────────────────────────────────────────────── */

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

body {
	margin: 0;
	background: var(--c-bg);
	color: var(--c-text);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	/* Korean wraps mid-word by default; keep breaks on word boundaries. */
	word-break: keep-all;
	overflow-wrap: break-word;
}

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

a {
	color: inherit;
}

h1,
h2,
h3,
h4 {
	line-height: 1.4;
	letter-spacing: -0.01em;
}

/* ── Hero ───────────────────────────────────────────────── */

.hero {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	/*
	 * Required. Once min-height wins over the aspect-ratio height, the ratio is
	 * resolved the other way and the box derives its WIDTH from that height --
	 * 360px x 3.42 = 1231px, which overflows any narrow viewport. Clamping the
	 * width keeps the ratio as a height hint only.
	 */
	width: 100%;
	max-width: 100%;
	/* Visible before the image loads, and the whole hero if none is set. */
	background: #6b5a4c;
	color: #ffffff;
}

.hero--tall {
	aspect-ratio: 2561 / 748;
	min-height: 360px;
}

.hero--compact {
	aspect-ratio: 2561 / 460;
	min-height: 200px;
}

/*
 * Banner with the text already in it: keep the artwork's own proportions rather
 * than cropping through it. --hero-ratio comes from the attachment; the
 * fallback matches the current banner.
 */
.hero--bare {
	aspect-ratio: var(--hero-ratio, 2561 / 748);
	min-height: 0;
}

.hero__image,
.hero__scrim {
	position: absolute;
	inset: 0;
}

.hero__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	z-index: -2;
}

.hero__scrim {
	background: var(--hero-scrim);
	z-index: -1;
}

.hero__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 30px;
	height: 100%;
	padding: 40px 20px;
	text-align: center;
}

.hero__identity {
	display: flex;
	align-items: center;
	gap: 30px;
}

.hero__logo img,
.hero__logo .custom-logo {
	display: block;
	width: auto;
	max-height: 64px;
}

.hero__wordmark {
	font-size: 1.75rem;
	font-weight: 700;
	text-decoration: none;
	letter-spacing: -0.02em;
}

.hero__tagline {
	margin: 0;
	padding-left: 30px;
	border-left: 1px solid rgba(255, 255, 255, 0.55);
	font-size: 1.0625rem;
	line-height: 1.75;
	text-align: left;
}

.hero__badge {
	margin: 0;
	padding: 7px 18px;
	border: 1px solid rgba(255, 255, 255, 0.65);
	font-size: 0.8125rem;
	letter-spacing: -0.01em;
}

.hero__scroll {
	color: #ffffff;
	opacity: 0.9;
	transition: transform 0.2s ease;
}

.hero__scroll:hover {
	transform: translateY(3px);
}

/* ── Layout ─────────────────────────────────────────────── */

.layout {
	display: grid;
	grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
	gap: var(--gutter);
	align-items: start;
	max-width: var(--container);
	margin-inline: auto;
	padding: 72px 20px 100px;
}

/* Single-column pages: same rhythm as .layout, no sidebar track. */
.container {
	max-width: 820px;
	margin-inline: auto;
	padding: 72px 20px 100px;
}

/* ── Sidebar: category navigation ───────────────────────── */

.cat-nav__list {
	margin: 0;
	padding: 26px 0;
	list-style: none;
	background: var(--c-surface);
}

.cat-nav__link {
	display: block;
	padding: 16px 20px;
	color: var(--c-text-2);
	font-size: 0.8125rem;
	text-decoration: none;
	letter-spacing: -0.02em;
	transition: color 0.15s ease;
}

.cat-nav__link:hover,
.cat-nav__link:focus-visible,
.cat-nav__link.is-current {
	color: var(--c-text);
	font-weight: 600;
}

/* ── Sidebar: search ────────────────────────────────────── */

.sidebar__search {
	margin-top: 22px;
}

.search-form {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 0 12px;
	background: var(--c-surface);
	border-radius: 3px;
}

.search-form__field {
	flex: 1;
	min-width: 0;
	padding: 11px 0;
	border: 0;
	background: transparent;
	color: var(--c-text-2);
	font: inherit;
	font-size: 0.75rem;
	text-align: center;
}

.search-form__field::placeholder {
	color: var(--c-text-3);
}

.search-form__field:focus {
	outline: none;
	text-align: left;
}

.search-form__submit {
	display: grid;
	place-items: center;
	padding: 4px;
	border: 0;
	background: none;
	color: var(--c-text-2);
	cursor: pointer;
}

/* ── Sidebar: clinic hours ──────────────────────────────── */

.hours {
	margin-top: 26px;
}

.hours__list {
	margin: 0;
	display: grid;
	gap: 9px;
}

.hours__row {
	display: grid;
	grid-template-columns: 52px minmax(0, 1fr);
	gap: 8px;
	align-items: start;
}

.hours__label {
	padding: 3px 0;
	border-radius: var(--pill);
	background: var(--c-accent);
	color: var(--c-on-accent);
	font-size: 0.625rem;
	font-weight: 500;
	line-height: 1.5;
	text-align: center;
	letter-spacing: -0.03em;
}

.hours__value {
	margin: 0;
}

.hours__time {
	display: block;
	color: var(--c-text-2);
	font-size: 0.6875rem;
	line-height: 1.5;
	letter-spacing: -0.01em;
	white-space: nowrap;
}

.hours__note {
	display: block;
	margin-top: 2px;
	color: var(--c-accent);
	font-size: 0.625rem;
	font-weight: 600;
	line-height: 1.45;
	letter-spacing: -0.03em;
}

.hours__footnote {
	margin: 12px 0 0;
	color: var(--c-text-4);
	font-size: 0.625rem;
	line-height: 1.5;
	letter-spacing: -0.02em;
}

.sidebar__widgets {
	margin-top: 30px;
}

.widget-title {
	margin: 0 0 10px;
	font-size: 0.8125rem;
	color: var(--c-text-2);
}

/* ── Post grid ──────────────────────────────────────────── */

.card-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 56px 24px;
}

.card__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.card__media {
	position: relative;
	aspect-ratio: 3 / 2;
	overflow: hidden;
	background: var(--c-surface);
}

.card__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}

.card__link:hover .card__image {
	transform: scale(1.04);
}

.card__placeholder {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: var(--c-text-4);
	font-size: 0.75rem;
}

.card__title {
	margin: 16px 0 0;
	color: var(--c-text);
	font-size: 0.9375rem;
	font-weight: 700;
	line-height: 1.5;
	/* Two lines, so uneven titles do not stagger the rows. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.card__excerpt {
	margin: 10px 0 0;
	color: var(--c-text-3);
	font-size: 0.75rem;
	line-height: 1.7;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.card__date {
	display: block;
	margin-top: 12px;
	color: var(--c-text-4);
	font-size: 0.6875rem;
}

/* ── Archive header, pagination ─────────────────────────── */

.archive-header {
	margin-bottom: 34px;
}

.archive-title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 700;
}

.archive-description {
	margin-top: 8px;
	color: var(--c-text-3);
	font-size: 0.875rem;
}

.pagination {
	margin-top: 64px;
}

.pagination .nav-links {
	display: flex;
	justify-content: center;
	gap: 6px;
	flex-wrap: wrap;
}

.pagination .page-numbers {
	display: grid;
	place-items: center;
	min-width: 34px;
	height: 34px;
	padding: 0 10px;
	border-radius: 3px;
	color: var(--c-text-2);
	font-size: 0.8125rem;
	text-decoration: none;
}

.pagination .page-numbers:hover {
	background: var(--c-surface);
}

.pagination .page-numbers.current {
	background: var(--c-accent);
	color: var(--c-on-accent);
}

/* ── Single post and pages ──────────────────────────────── */

/*
 * The grid's content column is ~970px, far too wide for comfortable Korean
 * prose. The article is capped and centred within it instead.
 */
.entry-single,
.entry-page {
	max-width: 740px;
	margin-inline: auto;
}

.entry-header {
	padding-bottom: 26px;
	border-bottom: 1px solid var(--c-line);
}

/* Same pill vocabulary as the opening-hours labels. */
.entry-category {
	display: inline-block;
	margin-bottom: 14px;
	padding: 4px 14px;
	border-radius: var(--pill);
	background: var(--c-accent);
	color: var(--c-on-accent);
	font-size: 0.6875rem;
	font-weight: 600;
	text-decoration: none;
	letter-spacing: -0.02em;
}

.entry-single .entry-title,
.entry-page .entry-title {
	margin: 0;
	font-size: 1.625rem;
	font-weight: 700;
	line-height: 1.45;
}

.entry-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 14px;
	color: var(--c-text-4);
	font-size: 0.75rem;
}

.entry-meta a {
	color: var(--c-text-3);
	text-decoration: none;
}

.entry-thumbnail {
	margin: 34px 0 0;
}

.entry-thumbnail img {
	display: block;
	width: 100%;
}

/*
 * Korean body copy needs more leading than Latin at the same size; 2.0 is the
 * ratio Korean blogs settle on and it is what makes long posts readable.
 */
.entry-content {
	margin-top: 34px;
	font-size: 1rem;
	line-height: 2;
	color: #333333;
}

.entry-content > * {
	margin-block: 0 1.5em;
}

.entry-content :where(h2, h3, h4) {
	margin: 2.4em 0 0.8em;
	color: var(--c-text);
	line-height: 1.5;
}

.entry-content h2 {
	padding-left: 14px;
	border-left: 3px solid var(--c-accent);
	font-size: 1.25rem;
}

.entry-content h3 {
	font-size: 1.0625rem;
	color: var(--c-accent);
}

.entry-content h4 {
	font-size: 1rem;
}

.entry-content :where(img, figure, .wp-block-image) {
	max-width: 100%;
	height: auto;
}

/* Images in Korean blog posts read as full-width breaks between sections. */
.entry-content figure {
	margin-block: 2em;
}

.entry-content figcaption {
	margin-top: 10px;
	color: var(--c-text-4);
	font-size: 0.8125rem;
	text-align: center;
}

.entry-content a:not([class]) {
	color: var(--c-text);
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-color: var(--c-accent);
}

.entry-content strong {
	font-weight: 700;
	color: var(--c-text);
}

.entry-content mark {
	background: #fdece7;
	color: inherit;
	padding: 0 3px;
}

.entry-content blockquote {
	margin-inline: 0;
	padding: 4px 0 4px 20px;
	border-left: 3px solid var(--c-accent);
	color: var(--c-text-2);
}

.entry-content blockquote > :last-child {
	margin-bottom: 0;
}

.entry-content :where(ul, ol) {
	padding-left: 1.3em;
}

.entry-content li {
	margin-bottom: 0.5em;
}

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

.entry-content table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875rem;
}

.entry-content :where(th, td) {
	padding: 10px 12px;
	border: 1px solid var(--c-line);
	text-align: left;
}

.entry-content th {
	background: var(--c-surface);
	font-weight: 600;
}

/* Wide content must scroll inside itself, never widen the page. */
.entry-content :where(pre, .wp-block-table) {
	overflow-x: auto;
}

.entry-footer {
	margin-top: 40px;
}

.entry-tags a {
	display: inline-block;
	margin: 0 6px 6px 0;
	padding: 4px 12px;
	border-radius: var(--pill);
	background: var(--c-surface);
	color: var(--c-text-2);
	font-size: 0.75rem;
	text-decoration: none;
}

.post-navigation {
	max-width: 740px;
	margin: 52px auto 0;
	padding-top: 26px;
	border-top: 1px solid var(--c-line);
	font-size: 0.8125rem;
}

.post-navigation .nav-links {
	display: grid;
	gap: 10px;
}

.post-navigation a {
	color: var(--c-text-2);
	text-decoration: none;
}

.nav-label {
	color: var(--c-accent);
	font-weight: 600;
}

/* ── Comments ───────────────────────────────────────────── */

.comments-area {
	max-width: 740px;
	margin: 56px auto 0;
}

.comments-title {
	margin: 0 0 24px;
	font-size: 1.0625rem;
	font-weight: 700;
}

/*
 * Styles WordPress's default html5 comment markup rather than replacing it with
 * a custom walker: the default already handles threading, pingbacks, moderation
 * notices and edit links correctly, and reimplementing that only adds bugs.
 */
.comment-list,
.comment-list .children {
	margin: 0;
	padding: 0;
	list-style: none;
}

.comment-list > li + li {
	margin-top: 4px;
}

/* The form takes no e-mail, so Gravatar has nothing to hash and every avatar
   resolves to the same placeholder while still sending the reader's IP and
   referrer to a third party. They are off (설정 › 토론 › 아바타 표시).
   The gutter follows the avatar rather than being assumed, so the layout holds
   whichever way that setting goes -- and a browser without :has() drops the
   rule to no gutter, which is the correct result for avatars off. */
.comment-body {
	position: relative;
	padding: 22px 0;
	border-top: 1px solid var(--c-line);
}

.comment-body:has(.avatar) {
	padding-left: 62px;
}

.comment-list > li:first-child > .comment-body {
	border-top: 0;
	padding-top: 0;
}

.comment-body .avatar {
	position: absolute;
	top: 22px;
	left: 0;
	width: 44px;
	height: 44px;
	border-radius: 50%;
}

.comment-list > li:first-child > .comment-body .avatar {
	top: 0;
}

.comment-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 10px;
	margin-bottom: 8px;
}

.comment-author {
	font-size: 0.875rem;
}

.comment-author .fn {
	font-weight: 700;
	font-style: normal;
	color: var(--c-text);
}

.comment-author a {
	text-decoration: none;
}

/* "…says:" adds nothing next to a name and reads oddly in Korean. */
.comment-author .says {
	display: none;
}

.comment-metadata,
.comment-metadata a {
	color: var(--c-text-4);
	font-size: 0.75rem;
	text-decoration: none;
}

/* Editor-only link; keep it off the timestamp. */
.comment-metadata .edit-link::before {
	content: "·";
	margin: 0 5px;
}

/* The clinic answering in its own comment thread should be recognisable. */
.bypostauthor > .comment-body .fn::after {
	content: "작성자";
	display: inline-block;
	margin-left: 6px;
	padding: 2px 8px;
	border-radius: var(--pill);
	background: var(--c-accent);
	color: var(--c-on-accent);
	font-size: 0.625rem;
	font-weight: 600;
	vertical-align: 1px;
}

.comment-content {
	font-size: 0.875rem;
	line-height: 1.85;
	color: #333333;
}

.comment-content > :first-child {
	margin-top: 0;
}

.comment-content > :last-child {
	margin-bottom: 0;
}

.comment-awaiting-moderation {
	display: block;
	margin-bottom: 8px;
	color: var(--c-accent);
	font-size: 0.75rem;
	font-style: normal;
}

.comment-body .reply {
	margin-top: 10px;
}

.comment-reply-link {
	color: var(--c-text-2);
	font-size: 0.75rem;
	text-decoration: none;
}

.comment-reply-link:hover {
	color: var(--c-accent);
}

/* Replies: indented, with a rule marking the thread. */
.comment-list .children {
	margin-left: 26px;
	padding-left: 22px;
	border-left: 2px solid var(--c-surface);
}

.comment-list .children .comment-body:has(.avatar) {
	padding-left: 52px;
}

.comment-list .children .avatar {
	width: 36px;
	height: 36px;
}

/* Pingbacks and trackbacks carry no avatar, so the gutter rule above already
   skips them; they only need the smaller type. */
.pingback .comment-body,
.trackback .comment-body {
	font-size: 0.8125rem;
}

.comments-pagination {
	margin-top: 26px;
	font-size: 0.8125rem;
}

.no-comments {
	color: var(--c-text-4);
	font-size: 0.8125rem;
}

/* ── Comment form ───────────────────────────────────────── */

.comment-respond {
	margin-top: 44px;
	padding-top: 30px;
	border-top: 1px solid var(--c-line);
}

.comment-reply-title {
	margin: 0 0 6px;
	font-size: 1rem;
	font-weight: 700;
}

.comment-reply-title small {
	margin-left: 10px;
	font-size: 0.75rem;
	font-weight: 400;
}

.comment-reply-title small a {
	color: var(--c-accent);
	text-decoration: none;
}

/*
 * Two fields only — the e-mail, website and cookie-consent rows are removed in
 * functions.php, since the clinic never reads any of them.
 */
.comment-form {
	display: grid;
	gap: 18px;
	max-width: 560px;
	font-size: 0.8125rem;
}

/* Core wraps each row in a <p>; the grid gap is doing that spacing already. */
.comment-form p {
	margin: 0;
}

.comment-form :where(.comment-form-author, .comment-form-comment) label {
	display: block;
	margin-bottom: 5px;
	color: var(--c-text-2);
}

.comment-form .required {
	color: var(--c-accent);
}

/* Same fill-and-no-border treatment as the sidebar search field. */
.comment-form :where(input[type="text"], textarea) {
	display: block;
	width: 100%;
	padding: 10px 12px;
	border: 0;
	border-radius: 3px;
	background: var(--c-surface);
	color: var(--c-text);
	font: inherit;
}

.comment-form :where(input[type="text"], textarea)::placeholder {
	color: var(--c-text-3);
}

/* With no resting border, focus has to draw its own. */
.comment-form :where(input[type="text"], textarea):focus {
	outline: none;
	box-shadow: inset 0 0 0 1px var(--c-accent);
}

.comment-form textarea {
	min-height: 130px;
	resize: vertical;
}

.comment-form .submit {
	justify-self: start;
	padding: 11px 26px;
	border: 0;
	border-radius: var(--pill);
	background: var(--c-accent);
	color: var(--c-on-accent);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.comment-form .comment-notes {
	margin: 0;
	color: var(--c-text-4);
	font-size: 0.75rem;
}

/* ── Empty states ───────────────────────────────────────── */

.no-results,
.error-404 {
	padding: 40px 0 60px;
}

.page-title {
	margin: 0 0 12px;
	font-size: 1.25rem;
}

.no-results .search-form,
.error-404 .search-form {
	max-width: 300px;
	margin-top: 20px;
}

/* ── Footer ─────────────────────────────────────────────── */

.site-footer {
	padding: 40px 20px;
	border-top: 1px solid var(--c-line);
	text-align: center;
}

.footer-menu {
	display: flex;
	justify-content: center;
	gap: 20px;
	margin: 0 0 14px;
	padding: 0;
	list-style: none;
	font-size: 0.8125rem;
}

.footer-menu a {
	color: var(--c-text-2);
	text-decoration: none;
}

.site-copyright {
	margin: 0;
	color: var(--c-text-4);
	font-size: 0.75rem;
}

/* ── Accessibility ──────────────────────────────────────── */

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link:focus {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 100000;
	width: auto;
	height: auto;
	padding: 12px 16px;
	clip-path: none;
	background: var(--c-bg);
	color: var(--c-text);
	white-space: normal;
}

:where(a, button, input, [tabindex]):focus-visible {
	outline: 2px solid var(--c-accent);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 1080px) {
	:root {
		--gutter: 36px;
		--sidebar-w: 150px;
	}

	.card-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 820px) {
	.layout {
		grid-template-columns: minmax(0, 1fr);
		gap: 28px;
		padding: 40px 20px 72px;
	}

	/*
	 * Lets the sidebar's blocks become grid items of .layout so they can be
	 * reordered independently: navigation and search stay above the posts,
	 * the opening hours drop below them.
	 */
	.sidebar {
		display: contents;
	}

	.cat-nav {
		order: 1;
	}

	.sidebar__search {
		order: 2;
		margin-top: 0;
	}

	.content-area {
		order: 3;
	}

	.hours {
		order: 4;
		margin-top: 0;
		padding-top: 26px;
		border-top: 1px solid var(--c-line);
	}

	.sidebar__widgets {
		order: 5;
		margin-top: 0;
	}

	/* Categories become a horizontal strip rather than a tall column. */
	.cat-nav__list {
		display: flex;
		gap: 4px;
		padding: 8px;
		overflow-x: auto;
		scrollbar-width: none;
	}

	.cat-nav__list::-webkit-scrollbar {
		display: none;
	}

	.cat-nav__link {
		padding: 8px 14px;
		white-space: nowrap;
	}

	.hours__row {
		grid-template-columns: 58px minmax(0, 1fr);
	}

	.hours__time,
	.hours__label {
		font-size: 0.75rem;
	}

	.hero__identity {
		flex-direction: column;
		gap: 18px;
	}

	.hero__tagline {
		padding-left: 0;
		border-left: 0;
		text-align: center;
		font-size: 0.9375rem;
	}

	.hero__logo img,
	.hero__logo .custom-logo {
		max-height: 46px;
	}
}

@media (max-width: 560px) {
	.card-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 36px;
	}

	.hero--tall {
		aspect-ratio: auto;
		min-height: 340px;
	}

	.entry-single .entry-title,
	.entry-page .entry-title {
		font-size: 1.375rem;
	}
}
