/*
Theme Name: Sinmaeche
Theme URI: https://sinmaeche.com/
Author: Studio Sinmaeche
Description: Hub site for Studio Sinmaeche. Black ground, white type, Cargo-style index. Links to the studio's sites and shows the @sinmaeche Instagram posts as a grid, copied into WordPress with their images so new posts keep arriving even with a page cache on.
Version: 1.1.0
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sinmaeche
Tags: portfolio, grid-layout, one-column, two-columns
*/

/* Layout: sticky name strip / large intro / full-bleed site rows that invert on hover /
   thumbnail grid of Instagram posts / footer columns. */
:root {
	--bg: #171717;
	--fg: #f2f2ee;
	--mute: #8b8b86;
	--line: #3b3b38;
	--well: #222220;
	--sans: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
	--mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
	--gutter: clamp(16px, 2.2vw, 32px);
	--meta: 0.75rem;
	color-scheme: dark;
}

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--sans);
	font-size: 0.9375rem;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	word-break: keep-all;
	overflow-wrap: break-word;
}

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

a {
	color: inherit;
	text-decoration: none;
}

a:focus-visible,
button:focus-visible {
	outline: 2px solid var(--fg);
	outline-offset: 3px;
}

::selection {
	background: var(--fg);
	color: var(--bg);
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.sm-skip:focus {
	position: fixed !important;
	top: 8px;
	left: 8px;
	z-index: 100;
	width: auto;
	height: auto;
	margin: 0;
	padding: 8px 12px;
	clip: auto;
	background: var(--fg);
	color: var(--bg);
	font: 500 var(--meta) / 1.4 var(--mono);
}

.sm-page {
	min-height: 100vh;
	min-height: 100svh;
	display: flex;
	flex-direction: column;
}

.sm-page > main {
	flex: 1 0 auto;
}

.sm-inner {
	padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
	padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

.sm-arrow {
	width: 0.9em;
	height: 0.9em;
	flex: none;
	transition: transform 120ms ease-out;
}

/* Name strip */
.sm-top {
	position: sticky;
	top: env(safe-area-inset-top, 0px);
	z-index: 10;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: baseline;
	gap: 6px 24px;
	padding-block: 16px;
	background: var(--bg);
}

.sm-brand {
	display: inline-flex;
	align-items: baseline;
	gap: 0.5em;
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.sm-brand__en {
	color: var(--mute);
	font-weight: 400;
}

.sm-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 22px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-weight: 600;
}

.sm-nav a {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.sm-nav a:hover,
.sm-nav .is-current > a,
.sm-nav .current-menu-item > a {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
}

/* Intro */
.sm-intro {
	padding-block: clamp(40px, 9vh, 120px) clamp(48px, 8vh, 104px);
}

.sm-intro__lead {
	max-width: 19em;
	margin: 0;
	font-size: clamp(1.75rem, 3.6vw, 3.25rem);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.02em;
	text-wrap: balance;
}

.sm-intro__sub {
	max-width: 40em;
	margin: 16px 0 0;
	color: var(--mute);
	font-size: 1rem;
}

/* Section labels */
.sm-label {
	margin: 0;
	padding-block: 0 12px;
	color: var(--mute);
	font: 400 var(--meta) / 1.4 var(--mono);
	letter-spacing: 0.02em;
}

.sm-count {
	margin-left: 0.4em;
}

/* Linked sites */
.sm-sites {
	margin-bottom: clamp(64px, 11vh, 144px);
}

.sm-sites ul {
	margin: 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--line);
}

.sm-sites li {
	border-bottom: 1px solid var(--line);
}

.sm-site {
	display: grid;
	grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) auto;
	align-items: baseline;
	gap: 6px 28px;
	padding-block: clamp(14px, 2vw, 26px) clamp(16px, 2.2vw, 28px);
	transition: background-color 80ms linear, color 80ms linear;
}

.sm-site__name {
	font-size: clamp(1.625rem, 3.8vw, 3.5rem);
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: -0.025em;
}

.sm-site__note {
	color: var(--mute);
}

.sm-site__host {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font: 400 var(--meta) / 1.4 var(--mono);
	white-space: nowrap;
}

.sm-site:hover,
.sm-site:focus-visible {
	background: var(--fg);
	color: var(--bg);
}

.sm-site:hover .sm-site__note,
.sm-site:focus-visible .sm-site__note {
	color: inherit;
}

.sm-site:focus-visible {
	outline: 2px solid var(--bg);
	outline-offset: -8px;
}

.sm-site:hover .sm-arrow,
.sm-site:focus-visible .sm-arrow {
	transform: translate(2px, -2px);
}

/* Works header: label, view switch, account filter */
.sm-works__bar {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: baseline;
	gap: 8px 24px;
}

/* Grid */
.sm-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	align-items: start;
	gap: clamp(28px, 3.4vw, 52px) clamp(14px, 1.6vw, 24px);
	margin: 0;
	padding-block: 0;
	list-style: none;
}

.sm-grid[hidden] {
	display: none;
}

.sm-grid[data-cols="3"] {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sm-grid[data-cols="5"] {
	grid-template-columns: repeat(5, minmax(0, 1fr));
}

.sm-grid[data-cols="6"] {
	grid-template-columns: repeat(6, minmax(0, 1fr));
}

.sm-card__link {
	display: grid;
	gap: 6px;
}

.sm-card__media {
	display: block;
	margin-bottom: 4px;
	background: var(--well);
	line-height: 0;
}

.sm-card__media img {
	display: block;
	width: 100%;
	height: auto;
	transition: opacity 120ms linear;
}

.sm-crop .sm-card__media img {
	aspect-ratio: 1;
	object-fit: cover;
}

.sm-card__blank {
	display: block;
	aspect-ratio: 4 / 5;
}

.sm-card__title {
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.4;
}

.sm-card__meta {
	color: var(--mute);
	font: 400 var(--meta) / 1.4 var(--mono);
}

.sm-card__link:hover .sm-card__title,
.sm-card__link:focus-visible .sm-card__title {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.sm-card__link:hover img {
	opacity: 0.86;
}

/* Text pages */
.sm-text {
	padding-block: clamp(32px, 7vh, 96px) 0;
}

.sm-text article {
	max-width: 46em;
}

.sm-text article + article {
	margin-top: 56px;
}

.sm-text__title {
	margin: 0 0 20px;
	font-size: clamp(1.75rem, 3.4vw, 3rem);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.02em;
	text-wrap: balance;
}

.sm-text__meta {
	color: var(--mute);
	font: 400 var(--meta) / 1.4 var(--mono);
}

.sm-text__body a {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.sm-text__body img {
	height: auto;
}

/* Footer */
.sm-foot {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 28px 24px;
	margin-top: clamp(72px, 12vh, 160px);
	padding-block: 32px 28px;
	border-top: 1px solid var(--line);
	font-size: 0.875rem;
}

.sm-foot__label {
	margin: 0 0 10px;
	color: var(--mute);
	font: 400 var(--meta) / 1.4 var(--mono);
}

.sm-foot ul {
	display: grid;
	gap: 3px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.sm-foot p {
	margin: 0;
}

.sm-foot a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.sm-foot__copy {
	grid-column: 1 / -1;
	color: var(--mute);
	font: 400 var(--meta) / 1.4 var(--mono);
}

/* Narrower screens */
@media (max-width: 1100px) {
	.sm-grid[data-cols="4"],
	.sm-grid[data-cols="5"],
	.sm-grid[data-cols="6"] {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 900px) {
	.sm-site {
		grid-template-columns: minmax(0, 1fr) auto;
	}

	.sm-site__note {
		grid-column: 1;
		grid-row: 2;
	}

	.sm-site__host {
		grid-column: 2;
		grid-row: 1 / span 2;
		align-self: center;
	}
}

@media (max-width: 720px) {
	.sm-grid,
	.sm-grid[data-cols] {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.sm-site {
		grid-template-columns: minmax(0, 1fr);
	}

	.sm-site__note,
	.sm-site__host {
		grid-column: 1;
		grid-row: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sm-site,
	.sm-arrow,
	.sm-card__media img {
		transition: none;
	}
}
