/**
 * Daeword — theme styles.
 *
 * theme.json handles colour, type scale and spacing. This file only carries
 * what theme.json cannot express: the rotating hero, the sticky header, the
 * card row that overlaps the hero, and the two-band footer.
 *
 * @package Daeword
 */

/* -------------------------------------------------------------------------
 * 1. Base
 * ---------------------------------------------------------------------- */

html {
	scroll-behavior: smooth;
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow-x: hidden;
}

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

/* -------------------------------------------------------------------------
 * 1b. Band rhythm
 *
 * The live site runs its full-width bands flush against one another. WordPress
 * otherwise puts `blockGap` between the top-level regions, which shows up as a
 * strip of page background between every coloured section — above the hero and
 * between the footer bands especially.
 * ---------------------------------------------------------------------- */

.wp-site-blocks > header.daeword-header-wrap,
.wp-site-blocks > main,
.wp-site-blocks > footer {
	margin-block-start: 0;
	margin-block-end: 0;
}

/*
 * The template already sets `blockGap: 0` on the post content, and WordPress
 * does emit it — but at the same specificity as its own global
 * `:root :where(.is-layout-constrained) > *` rule, which comes later in the
 * cascade and wins. Restating it here settles the tie.
 *
 * Scoped to the alignfull post content, which only the front page and the
 * full-width page template use, so ordinary pages keep their paragraph rhythm.
 */
.wp-block-post-content.alignfull > * {
	margin-block-start: 0;
	margin-block-end: 0;
}

/* -------------------------------------------------------------------------
 * 2. Rotating hero
 *
 * The slideshow is a plain core/gallery block with the class
 * `daeword-hero__slides`. Editors add, remove or reorder photos in the
 * gallery exactly as they would anywhere else; assets/js/hero.js cross-fades
 * whatever is in there.
 * ---------------------------------------------------------------------- */

.daeword-hero {
	position: relative;
	display: flex;
	align-items: center;
	min-height: 630px;
	padding-block: var(--wp--preset--spacing--50);
	overflow: hidden;
	isolation: isolate;
}

.daeword-hero__slides.wp-block-gallery {
	position: absolute;
	inset: 0;
	z-index: 0;
	display: block;
	margin: 0;
	padding: 0;
	gap: 0;
	background-color: var(--wp--preset--color--contrast);
}

/* The scrim that keeps the hero copy readable over any photo. */
.daeword-hero__slides.wp-block-gallery::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
	background: var(--wp--preset--gradient--hero-scrim, linear-gradient(90deg, rgba(23, 37, 42, 0.72) 0%, rgba(23, 37, 42, 0.45) 100%));
	pointer-events: none;
}

/*
 * `:not(#individual-image)` is core's own idiom for the gallery: it lends the
 * selector ID-level specificity so the tiled `width: calc(50% - gap)` sizing
 * can be overridden. We need the same weight to stack the photos instead.
 */
.daeword-hero .daeword-hero__slides.wp-block-gallery figure.wp-block-image:not(#individual-image) {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	transition: opacity 1s ease-in-out;
}

/*
 * Nested gallery images ship `flex: 1 0 0%`, which collapses them to their
 * flex basis instead of filling the slide.
 */
.daeword-hero .daeword-hero__slides.wp-block-gallery figure.wp-block-image img:not(#individual-image) {
	flex: 1 1 100%;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	border-radius: 0;
}

.daeword-hero__slides.wp-block-gallery figcaption {
	display: none;
}

/*
 * First frame is visible before (and without) JavaScript. These must carry the
 * same ID-level weight as the rule that sets `opacity: 0` above, or the slides
 * would never become visible.
 */
.daeword-hero .daeword-hero__slides.wp-block-gallery figure.wp-block-image:first-child:not(#individual-image),
.daeword-hero .daeword-hero__slides.wp-block-gallery figure.wp-block-image.is-active:not(#individual-image) {
	opacity: 1;
}

.daeword-hero .daeword-hero__slides.is-ready figure.wp-block-image:first-child:not(.is-active):not(#individual-image) {
	opacity: 0;
}

.daeword-hero__inner {
	position: relative;
	z-index: 3;
	width: 100%;
}

.daeword-hero__inner,
.daeword-hero__inner :where(p, h1, h2, h3, h4, h5, h6) {
	color: var(--wp--preset--color--base);
}

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

/* Outlined "ghost" button used for the secondary hero action. */
.daeword-hero .wp-block-button.is-style-outline > .wp-block-button__link,
.wp-block-button.is-style-outline > .wp-block-button__link.daeword-ghost {
	background-color: transparent;
	border-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--base);
}

.daeword-hero .wp-block-button.is-style-outline > .wp-block-button__link:hover,
.wp-block-button.is-style-outline > .wp-block-button__link.daeword-ghost:hover {
	background-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

@media (prefers-reduced-motion: reduce) {
	.daeword-hero__slides.wp-block-gallery .wp-block-image {
		transition: none;
	}
}

@media (max-width: 781px) {
	.daeword-hero {
		min-height: 460px;
		text-align: center;
	}

	.daeword-hero__slides.wp-block-gallery::after {
		background: rgba(23, 37, 42, 0.62);
	}
}

/* -------------------------------------------------------------------------
 * 3. Header
 * ---------------------------------------------------------------------- */

/* The header's own bands must touch, same specificity problem as elsewhere. */
.daeword-site-header > * {
	margin-block-start: 0;
	margin-block-end: 0;
}

.daeword-topbar {
	font-size: var(--wp--preset--font-size--small);
}

/*
 * Map pin and envelope markers, mirroring the little icons the live site puts
 * before the address and the e-mail. Inline SVG in a paragraph would not
 * survive block validation, so they ride in as backgrounds.
 */
.daeword-topbar__item {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
}

.daeword-topbar__item::before {
	content: "";
	flex: 0 0 auto;
	width: 1em;
	height: 1em;
	background-color: currentColor;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
}

.daeword-topbar__item.is-icon-map::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C8.1 2 5 5.1 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.9-3.1-7-7-7zm0 9.5A2.5 2.5 0 1 1 12 6.5a2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C8.1 2 5 5.1 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.9-3.1-7-7-7zm0 9.5A2.5 2.5 0 1 1 12 6.5a2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E");
}

.daeword-topbar__item.is-icon-mail::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 5h18a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1zm.9 2L12 12.2 20.1 7H3.9zM20 9.3l-8 5.1-8-5.1V17h16V9.3z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 5h18a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1zm.9 2L12 12.2 20.1 7H3.9zM20 9.3l-8 5.1-8-5.1V17h16V9.3z'/%3E%3C/svg%3E");
}

.daeword-topbar :where(a) {
	color: var(--wp--preset--color--base);
}

.daeword-topbar :where(a):hover {
	color: var(--wp--preset--color--primary-light);
}

.daeword-topbar .wp-block-social-links .wp-social-link {
	background: none;
}

/*
 * Language switcher — the segmented pill from nuri.iksi.or.kr, in our own
 * colours. It sits in the navigation row, so it has to read on a white bar and
 * on the transparent bar over the hero photo alike.
 */
.daeword-lang-toggle {
	display: inline-flex;
	align-items: center;
	border: 1px solid rgba(0, 76, 151, 0.35);
	border-radius: 24px;
	overflow: hidden;
	line-height: 1;
}

.daeword-lang-toggle__item {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	padding: 5px 12px;
	border-radius: 24px;
	color: var(--wp--preset--color--primary);
	font-size: 0.75rem;
	font-weight: 400;
	letter-spacing: 0.02em;
	text-decoration: none;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.daeword-lang-toggle__item:hover,
.daeword-lang-toggle__item:focus-visible {
	color: var(--wp--preset--color--primary-dark);
	text-decoration: none;
}

.daeword-lang-toggle__item.is-active {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	font-weight: 600;
}

/* Korean labels want a touch more room than the Latin ones. */
.daeword-lang-toggle__item[lang="ko-KR"] {
	letter-spacing: 0;
}

/*
 * The whole header part is the sticky unit. Sticking only the white bar would
 * not work: a sticky element can never travel outside its own parent, and the
 * parent of the white bar ends the moment the bar does.
 */
.daeword-header-wrap {
	position: sticky;
	top: 0;
	z-index: 100;
}

.admin-bar .daeword-header-wrap {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar .daeword-header-wrap {
		top: 46px;
	}
}

.daeword-header {
	background-color: var(--wp--preset--color--base);
	box-shadow: var(--wp--preset--shadow--header);
	transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

/* -------------------------------------------------------------------------
 * 3b. Header floating over the hero
 *
 * On pages that open with the hero the bar sits transparently on top of the
 * photo, then turns solid white once you scroll past it. `daeword-has-hero`
 * is added server-side so pages without a hero keep an ordinary white bar.
 * ---------------------------------------------------------------------- */

.wp-site-blocks {
	position: relative;
}

/*
 * A zero-width strip the height of the header, sitting at the very top of the
 * page. header.js watches it with an IntersectionObserver: the moment it
 * scrolls out of view, the bar goes solid.
 */
.daeword-header-sentinel {
	position: absolute;
	top: 0;
	left: 0;
	width: 1px;
	height: var(--daeword-header-h, 150px);
	pointer-events: none;
	visibility: hidden;
}

.daeword-has-hero .daeword-header-wrap {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
}

/* Absolutely positioned, the bar sits inside the flow the admin bar already
   pushed down — so it must not be offset a second time. */
.admin-bar.daeword-has-hero .daeword-header-wrap {
	top: 0;
}

.daeword-has-hero .daeword-header {
	background-color: transparent;
	box-shadow: none;
}

/* Core sets `color: inherit` on the item content, so it has to be named. */
.daeword-has-hero .daeword-header .wp-block-navigation a:where(:not(.wp-element-button)),
.daeword-has-hero .daeword-header .wp-block-navigation .wp-block-navigation-item__content {
	color: var(--wp--preset--color--base);
}

.daeword-has-hero .daeword-logo img {
	filter: brightness(0) invert(1);
	transition: filter 0.25s ease;
}

/* Switcher over the photo: light track, white active pill. */
.daeword-has-hero .daeword-header .daeword-lang-toggle {
	border-color: rgba(255, 255, 255, 0.4);
}

.daeword-has-hero .daeword-header .daeword-lang-toggle__item {
	color: rgba(255, 255, 255, 0.82);
}

.daeword-has-hero .daeword-header .daeword-lang-toggle__item:hover,
.daeword-has-hero .daeword-header .daeword-lang-toggle__item:focus-visible {
	color: var(--wp--preset--color--base);
}

.daeword-has-hero .daeword-header .daeword-lang-toggle__item.is-active {
	background-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--primary-dark);
}

/* Reserve room for the floating bar so the hero copy stays clear of it. */
.daeword-has-hero .daeword-hero {
	padding-top: calc(var(--daeword-header-h, 150px) + var(--wp--preset--spacing--40));
}

.daeword-has-hero .daeword-header-wrap.is-stuck {
	position: fixed;
	top: 0;
	animation: daeword-drop 0.28s ease;
}

.admin-bar.daeword-has-hero .daeword-header-wrap.is-stuck {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar.daeword-has-hero .daeword-header-wrap.is-stuck {
		top: 46px;
	}
}

.daeword-has-hero .daeword-header-wrap.is-stuck .daeword-header {
	background-color: var(--wp--preset--color--base);
	box-shadow: var(--wp--preset--shadow--header);
}

.daeword-has-hero .daeword-header-wrap.is-stuck .daeword-header .wp-block-navigation a:where(:not(.wp-element-button)),
.daeword-has-hero .daeword-header-wrap.is-stuck .daeword-header .wp-block-navigation .wp-block-navigation-item__content {
	color: var(--wp--preset--color--primary);
}

.daeword-has-hero .daeword-header-wrap.is-stuck .daeword-logo img {
	filter: none;
}

/*
 * Once stuck, only the navigation row travels — the black contact bar drops
 * away, as on the live site. The bar is out of the flow here, so hiding it
 * costs no reflow.
 */
.daeword-has-hero .daeword-header-wrap.is-stuck .daeword-topbar {
	display: none;
}

/* Stuck means a white bar again, so the switcher returns to its dark treatment. */
.daeword-has-hero .daeword-header-wrap.is-stuck .daeword-header .daeword-lang-toggle {
	border-color: rgba(0, 76, 151, 0.35);
}

.daeword-has-hero .daeword-header-wrap.is-stuck .daeword-header .daeword-lang-toggle__item {
	color: var(--wp--preset--color--primary);
}

.daeword-has-hero .daeword-header-wrap.is-stuck .daeword-header .daeword-lang-toggle__item.is-active {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
}

@keyframes daeword-drop {
	from {
		transform: translateY(-100%);
	}

	to {
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.daeword-has-hero .daeword-header-wrap.is-stuck {
		animation: none;
	}
}

.daeword-header .wp-block-navigation a:where(:not(.wp-element-button)),
.daeword-header .wp-block-navigation .wp-block-navigation-item__content {
	color: var(--wp--preset--color--primary);
}

.daeword-header .wp-block-navigation a:where(:not(.wp-element-button)):hover,
.daeword-header .wp-block-navigation .current-menu-item > a {
	color: var(--wp--preset--color--primary-dark);
}

/*
 * Only the input itself is a white box; everything around it stays
 * transparent, so the search does not read as a white panel dropped onto the
 * hero photo. Core's `button-inside` wrapper carries a border, padding and a
 * background of its own, which is what produced that panel.
 */
.daeword-header .wp-block-search__inside-wrapper {
	border: 0;
	padding: 0;
	background-color: transparent;
}

.daeword-header .wp-block-search__input {
	border: 1px solid #dedede;
	border-right: 0;
	border-radius: 5px 0 0 5px;
	background-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	padding: 8px 12px;
}

.daeword-header .wp-block-search__button {
	background-color: var(--wp--preset--color--accent);
	border: 1px solid var(--wp--preset--color--accent-dark);
	border-radius: 0 5px 5px 0;
	color: var(--wp--preset--color--base);
	margin-left: 0;
	padding: 8px 14px;
}

.daeword-header .wp-block-search__button:hover {
	background-color: var(--wp--preset--color--accent-dark);
}

.daeword-logo img {
	max-height: 62px;
	width: auto;
}

/*
 * On phones the search box would wrap onto its own line and push the header to
 * roughly 360px, swallowing the hero. The live site hides it at this width too;
 * search is still reachable from the search and 404 templates.
 */
@media (max-width: 781px) {
	.daeword-header .wp-block-search {
		display: none;
	}

	.daeword-topbar .daeword-topbar__item.is-icon-map {
		display: none;
	}
}

/* -------------------------------------------------------------------------
 * 4. Cards
 * ---------------------------------------------------------------------- */

.is-style-daeword-card,
.is-style-daeword-card-flat {
	background-color: var(--wp--preset--color--base);
	height: 100%;
}

.is-style-daeword-card {
	box-shadow: var(--wp--preset--shadow--card);
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.is-style-daeword-card:hover {
	box-shadow: var(--wp--preset--shadow--card-hover);
	transform: translateY(-3px);
}

/*
 * The four-up row that sits on top of the hero.
 *
 * The doubled class is deliberate: WordPress emits
 * `:root :where(.is-layout-constrained) > :first-child { margin-block-start: 0 }`
 * at the same specificity as a single class, and it wins on source order.
 */
.wp-block-columns.daeword-features {
	position: relative;
	z-index: 4;
	margin-top: -84px;
	background-color: var(--wp--preset--color--base);
	box-shadow: var(--wp--preset--shadow--card);
}

.daeword-features .wp-block-column + .wp-block-column {
	border-left: 1px solid #ececec;
}

@media (max-width: 781px) {
	.wp-block-columns.daeword-features {
		margin-top: -48px;
	}

	.daeword-features .wp-block-column + .wp-block-column {
		border-left: 0;
		border-top: 1px solid #ececec;
	}
}

/* Short orange rule used under the icon in the feature cards. */
.is-style-daeword-rule.wp-block-separator {
	width: 40px;
	max-width: 40px;
	height: 3px;
	margin-inline: auto;
	border: 0;
	border-radius: 2px;
	background-color: var(--wp--preset--color--highlight);
	opacity: 1;
}

.is-style-daeword-icon img {
	max-height: 44px;
	width: auto;
}

/* -------------------------------------------------------------------------
 * 4b. Full-bleed split sections
 *
 * The Foundation and Research bands on the live site are a 50/50 split running
 * the full width of the window: the photo fills its entire half, square-cropped,
 * while the copy sits in the other half with generous inset padding.
 * ---------------------------------------------------------------------- */

.daeword-split__row.wp-block-columns {
	gap: 0;
	margin-bottom: 0;
	align-items: stretch;
}

/*
 * `min-width: 0` matters: flex items default to `min-width: auto`, so the
 * nested card grid in the copy column would otherwise push past its 50% basis
 * and squeeze the photo out of square.
 */
.daeword-split__row > .wp-block-column {
	/*
	 * Columns are content-box by default, so the copy column's inset padding
	 * would be added outside its 50% basis and flex-shrink would take the
	 * difference out of the photo — leaving a 44/56 split instead of 50/50.
	 */
	box-sizing: border-box;
	min-width: 0;
}

.wp-block-columns .wp-block-column.daeword-split__media {
	position: relative;
	align-self: stretch;
	/*
	 * A floor tied to the column's own width (it is half the window), so a band
	 * with little copy beside it still reads as roughly square rather than a
	 * letterbox. Capped so it cannot run away on very wide screens; bands with
	 * taller copy are unaffected and keep taking their height from the text.
	 */
	min-height: clamp(380px, 46vw, 640px);
	padding: 0;
}

/*
 * The photo is taken out of the flow on purpose. Left in it, `height: 100%`
 * against an auto-height parent resolves to auto, so the image's own aspect
 * ratio sets the band height — a portrait photo stretched the whole section
 * and stopped it reading as square. Absolutely positioned, the band is sized
 * by the copy column alone and the photo simply fills whatever that comes to.
 */
.daeword-split__media > .wp-block-image {
	position: absolute;
	inset: 0;
	margin: 0;
}

.daeword-split__media > .wp-block-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.wp-block-columns .wp-block-column.daeword-split__text {
	align-self: center;
	/* The live site uses ~32px vertical and 107px horizontal here; 8.3vw lands
	   on that inset at a 1280px viewport. */
	padding-block: var(--wp--preset--spacing--40);
	padding-inline: clamp(var(--wp--preset--spacing--30), 8.3vw, 107px);
}

@media (max-width: 781px) {
	/* Stacked, the column has no sibling to take its height from. */
	.wp-block-columns .wp-block-column.daeword-split__media {
		min-height: 280px;
	}

	.wp-block-columns .wp-block-column.daeword-split__text {
		padding-block: var(--wp--preset--spacing--50);
		padding-inline: var(--wp--preset--spacing--30);
	}
}

/* Equal-height columns for every card grid. */
.daeword-grid .wp-block-column {
	display: flex;
	flex-direction: column;
}

.daeword-grid .wp-block-column > * {
	flex: 0 0 auto;
}

/* -------------------------------------------------------------------------
 * 5. News grid
 * ---------------------------------------------------------------------- */

.daeword-news .wp-block-post {
	background-color: var(--wp--preset--color--base);
	box-shadow: var(--wp--preset--shadow--card);
	display: flex;
	flex-direction: column;
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.daeword-news .wp-block-post:hover {
	box-shadow: var(--wp--preset--shadow--card-hover);
	transform: translateY(-3px);
}

.daeword-news .wp-block-post-featured-image {
	margin: 0;
}

.daeword-news .wp-block-post-featured-image img {
	width: 100%;
	height: 220px;
	object-fit: cover;
}

.daeword-news .wp-block-post-title {
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
	line-height: 1.35;
}

.daeword-news .wp-block-post-title a {
	color: var(--wp--preset--color--contrast);
}

.daeword-news .wp-block-post-title a:hover {
	color: var(--wp--preset--color--primary);
}

/* -------------------------------------------------------------------------
 * 6. Footer
 * ---------------------------------------------------------------------- */

.daeword-subfooter,
.daeword-footer {
	position: relative;
	overflow: hidden;
}

.daeword-subfooter :where(h1, h2, h3, h4, h5, h6),
.daeword-footer :where(h1, h2, h3, h4, h5, h6) {
	color: var(--wp--preset--color--base);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
	text-align: center;
	margin-bottom: var(--wp--preset--spacing--30);
}

.daeword-subfooter :where(p, li),
.daeword-footer :where(p, li) {
	color: var(--wp--preset--color--base);
	text-align: center;
}

.daeword-subfooter :where(a),
.daeword-footer :where(a) {
	color: var(--wp--preset--color--primary-light);
}

.daeword-subfooter :where(a):hover,
.daeword-footer :where(a):hover {
	color: var(--wp--preset--color--base);
	text-decoration: none;
}

.is-style-daeword-footer-links {
	list-style: none;
	padding-left: 0;
	margin: 0;
}

.is-style-daeword-footer-links li {
	margin-bottom: 0.75rem;
}

/* Watermark logo in the bottom-right corner of the dark footer band. */
.daeword-footer__mark {
	position: absolute;
	right: -10px;
	bottom: -20px;
	width: 190px;
	opacity: 0.35;
	pointer-events: none;
	margin: 0;
}

.daeword-footer__mark img {
	width: 100%;
	height: auto;
}

@media (max-width: 781px) {
	.daeword-footer__mark {
		display: none;
	}
}

/* White, not the brand blue: #004C97 on the near-black colophon is unreadable. */
.daeword-colophon,
.daeword-colophon :where(p) {
	color: var(--wp--preset--color--base);
	font-size: var(--wp--preset--font-size--small);
	text-align: center;
}

.daeword-colophon :where(a) {
	color: var(--wp--preset--color--primary);
}

/* Social link rows inside the footer keep the plain icon look. */
.daeword-subfooter .wp-block-social-links .wp-social-link,
.daeword-footer .wp-block-social-links .wp-social-link {
	background: none;
	color: var(--wp--preset--color--base);
}

/* -------------------------------------------------------------------------
 * 7. Content niceties
 * ---------------------------------------------------------------------- */

.daeword-section-lead {
	max-width: 44rem;
	margin-inline: auto;
	text-align: center;
	color: var(--wp--preset--color--muted);
}

.wp-block-post-content > * {
	margin-block: var(--wp--preset--spacing--30);
}

.wp-block-query-pagination {
	margin-top: var(--wp--preset--spacing--50);
}

/*
 * Block themes do not auto-enqueue style.css, so the visually-hidden helper is
 * repeated here rather than relying on the copy core happens to emit inline.
 */
.screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

.screen-reader-text:focus {
	background-color: var(--wp--preset--color--base);
	clip-path: none;
	color: var(--wp--preset--color--contrast);
	display: block;
	font-size: 0.875rem;
	height: auto;
	left: 5px;
	line-height: normal;
	padding: 15px 23px 14px;
	text-decoration: none;
	top: 5px;
	width: auto;
	z-index: 200;
}

.skip-link:focus {
	z-index: 200;
}

/* -------------------------------------------------------------------------
 * 8. Tablet tier
 *
 * WordPress collapses every columns block to a single stack below 782px, which
 * on a tablet turns the four-up rows into very tall single columns while the
 * news grid stays stubbornly three-up and cramped. Meet in the middle: two-up
 * for the card and footer rows, and let the news grid step down with width.
 *
 * The !important matches core's own stacking rule, which uses it too.
 * ---------------------------------------------------------------------- */

@media (min-width: 600px) and (max-width: 781px) {
	.daeword-features.wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column,
	.daeword-grid.wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column,
	.daeword-subfooter .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column,
	.daeword-footer > .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column {
		/* border-box: these columns carry inline padding, which on content-box
		   would push a pair past the container and force a single stack. */
		box-sizing: border-box;
		/* Basis small enough that two fit whatever the row gap is; flex-grow
		   then shares out the remainder evenly. */
		flex-basis: calc(50% - 2rem) !important;
		flex-grow: 1;
	}

	/* Two-up means the vertical rule between cards no longer reads. */
	.daeword-features .wp-block-column + .wp-block-column {
		border-top: 0;
	}
}

@media (max-width: 1023px) {
	.daeword-news .wp-block-post-template.is-layout-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 599px) {
	.daeword-news .wp-block-post-template.is-layout-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* -------------------------------------------------------------------------
 * 9. Korean typography
 *
 * Open Sans has no Hangul, so without this the Korean edition falls back to
 * whatever the operating system happens to supply — Malgun Gothic on Windows,
 * Apple SD Gothic Neo on a Mac — and renders differently on every machine.
 *
 * `word-break: keep-all` is the important one: Korean is written without
 * spaces inside a word, and the default `break-word` behaviour chops words
 * across lines mid-syllable. Any Korean reader notices immediately.
 * ---------------------------------------------------------------------- */

body.daeword-lang-ko {
	font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", var(--wp--preset--font-family--body);
	word-break: keep-all;
	overflow-wrap: break-word;
}

body.daeword-lang-ko :where(h1, h2, h3, h4, h5, h6, p, li, figcaption, .wp-block-button__link) {
	word-break: keep-all;
	overflow-wrap: break-word;
}

/* Hangul has no ascenders/descenders to speak of, so tight display leading
   that suits Latin looks cramped here. */
body.daeword-lang-ko :where(h1, h2, h3) {
	line-height: 1.4;
}

/* Uppercasing and wide letter-spacing do nothing for Hangul but do pull the
   syllable blocks apart. */
body.daeword-lang-ko :where(h5) {
	text-transform: none;
	letter-spacing: 0;
}

/* -------------------------------------------------------------------------
 * 10. Instagram feed
 *
 * Square thumbnails on a grid, matching the news cards below it. The caption
 * only shows on hover/focus so the row stays visually calm.
 * ---------------------------------------------------------------------- */

.daeword-instagram__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--30);
	list-style: none;
	margin: 0;
	padding: 0;
}

.daeword-instagram__item {
	margin: 0;
}

.daeword-instagram__item a {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background-color: var(--wp--preset--color--surface);
	box-shadow: var(--wp--preset--shadow--card);
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.daeword-instagram__item a:hover,
.daeword-instagram__item a:focus-visible {
	box-shadow: var(--wp--preset--shadow--card-hover);
	transform: translateY(-3px);
}

.daeword-instagram__item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.daeword-instagram__video {
	position: absolute;
	top: 0.6rem;
	right: 0.6rem;
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 6px 0 6px 10px;
	border-color: transparent transparent transparent #fff;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

.daeword-instagram__caption {
	position: absolute;
	inset: auto 0 0 0;
	padding: 0.75rem;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
	color: #fff;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.4;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.daeword-instagram__item a:hover .daeword-instagram__caption,
.daeword-instagram__item a:focus-visible .daeword-instagram__caption {
	opacity: 1;
}

.daeword-instagram__follow {
	margin-top: var(--wp--preset--spacing--30);
	text-align: center;
	font-weight: 600;
}

.daeword-instagram__notice {
	padding: 1rem;
	background-color: var(--wp--preset--color--surface);
	border-left: 3px solid var(--wp--preset--color--accent);
	font-size: var(--wp--preset--font-size--small);
}

@media (max-width: 1023px) {
	.daeword-instagram__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	/* Touch devices have no hover, so the caption would never be readable. */
	.daeword-instagram__caption {
		opacity: 1;
	}
}

/*
 * With no token configured the feed block renders nothing, which would leave
 * this band as a heading over empty space. Collapse the whole section instead.
 * Browsers without :has() simply keep showing it, which is the current state.
 */
.daeword-instagram-band:not(:has(.daeword-instagram)):not(:has(.daeword-instagram__notice)) {
	display: none;
}
