.portfolio-media {
    margin: 0;
    width: 100%;
}

.portfolio-media__image,
.portfolio-media__video {
    display: block;
    width: 100%;
    height: auto;
}

.portfolio-media__embed {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #111;
}

.portfolio-media__embed--deferred {
    display: grid;
    place-items: center;
}

.portfolio-media__embed-load {
    padding: 12px 18px;
    border: 1px solid rgba(255, 255, 255, .6);
    color: #fff;
    background: rgba(0, 0, 0, .32);
    cursor: pointer;
}

.portfolio-media__embed-load:hover,
.portfolio-media__embed-load:focus-visible {
    background: rgba(0, 0, 0, .58);
}

.portfolio-media__embed iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.portfolio-media__link {
    display: block;
    cursor: zoom-in;
}

.portfolio-media__link:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
}

.portfolio-media__video {
    background: #111;
}

.portfolio-video-player {
	position: relative;
	width: 100%;
	background: #111;
	overflow: hidden;
}

.portfolio-video-player .portfolio-media__video {
	position: relative;
	z-index: 0;
}

/* Keep portrait videos fully visible when the custom player enters fullscreen. */
.portfolio-video-player:fullscreen,
.portfolio-video-player:-webkit-full-screen {
	display: grid;
	place-items: center;
	width: 100vw;
	height: 100vh;
	background: #000;
	overflow: hidden;
}

.portfolio-video-player:fullscreen .portfolio-media__video,
.portfolio-video-player:-webkit-full-screen .portfolio-media__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	object-fit: contain;
	object-position: center;
}

/* Fallback for browsers/environments where the Fullscreen API is unavailable. */
.portfolio-video-player.is-fullscreen {
	position: fixed;
	inset: 0;
	z-index: 2147483647;
	display: grid;
	place-items: center;
	width: 100vw;
	height: 100vh;
	background: #000;
	overflow: hidden;
}

.portfolio-video-player.is-fullscreen .portfolio-media__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	object-fit: contain;
	object-position: center;
}

html.portfolio-video-fullscreen,
body.portfolio-video-fullscreen {
	overflow: hidden;
}

.portfolio-video__poster {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: grid;
	width: 100%;
	height: 100%;
	place-items: center;
	padding: 0;
	border: 0;
	color: #fff;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.34));
	cursor: pointer;
	transition: background-color 180ms ease-out;
}

.portfolio-video__poster:hover,
.portfolio-video__poster:focus-visible {
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.46));
}

.portfolio-video__poster:focus-visible,
.portfolio-video__button:focus-visible,
.portfolio-video__seek:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.portfolio-video__poster-icon {
	display: grid;
	width: 64px;
	height: 64px;
	place-items: center;
	border: 1px solid rgba(255, 255, 255, 0.72);
	border-radius: 50%;
	background: rgba(15, 15, 15, 0.32);
	transition: transform 180ms ease-out, background-color 180ms ease-out;
}

.portfolio-video__poster:hover .portfolio-video__poster-icon,
.portfolio-video__poster:focus-visible .portfolio-video__poster-icon {
	transform: scale(1.06);
	background: rgba(15, 15, 15, 0.58);
}

.portfolio-video__poster .portfolio-video__icon {
	width: 26px;
	height: 26px;
	margin-left: 3px;
}

.portfolio-video__controls {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 3;
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 58px;
	padding: 18px 14px 10px;
	color: #fff;
	background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.78));
}

.portfolio-video__button {
	display: inline-grid;
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	place-items: center;
	padding: 0;
	border: 0;
	color: inherit;
	background: transparent;
	cursor: pointer;
}

.portfolio-video__button:hover {
	color: rgba(255, 255, 255, 0.72);
}

.portfolio-video__volume {
	display: flex;
	flex: 0 1 132px;
	align-items: center;
	gap: 2px;
}

.portfolio-video__volume .portfolio-video__button {
	flex: 0 0 44px;
}

.portfolio-video__icon {
	display: block;
	width: 19px;
	height: 19px;
}

.portfolio-video__seek {
	flex: 1 1 auto;
	min-width: 80px;
	display: block;
	align-self: center;
	height: 20px;
	margin: 0;
	padding: 0;
	accent-color: #fff;
	background: transparent;
	cursor: pointer;
	line-height: 0;
	vertical-align: middle;
	-webkit-appearance: none;
	appearance: none;
}

.portfolio-video__seek::-webkit-slider-runnable-track {
	height: 3px;
	border-radius: 99px;
	background: rgba(255, 255, 255, 0.45);
}

.portfolio-video__seek::-webkit-slider-thumb {
	width: 11px;
	height: 11px;
	margin-top: -4px;
	border: 0;
	border-radius: 50%;
	background: #fff;
	-webkit-appearance: none;
}

.portfolio-video__seek::-moz-range-track {
	height: 3px;
	border-radius: 99px;
	background: rgba(255, 255, 255, 0.45);
}

.portfolio-video__seek::-moz-range-thumb {
	width: 11px;
	height: 11px;
	border: 0;
	border-radius: 50%;
	background: #fff;
}

.portfolio-video__volume-range {
	width: 76px;
	display: block;
	align-self: center;
	height: 20px;
	margin: 0;
	padding: 0;
	accent-color: #fff;
	background: transparent;
	cursor: pointer;
	line-height: 0;
	vertical-align: middle;
	-webkit-appearance: none;
	appearance: none;
}

.portfolio-video__volume-range::-webkit-slider-runnable-track {
	height: 3px;
	border-radius: 99px;
	background: rgba(255, 255, 255, 0.45);
}

.portfolio-video__volume-range::-webkit-slider-thumb {
	width: 11px;
	height: 11px;
	margin-top: -4px;
	border: 0;
	border-radius: 50%;
	background: #fff;
	-webkit-appearance: none;
}

.portfolio-video__volume-range::-moz-range-track {
	height: 3px;
	border-radius: 99px;
	background: rgba(255, 255, 255, 0.45);
}

.portfolio-video__volume-range::-moz-range-thumb {
	width: 11px;
	height: 11px;
	border: 0;
	border-radius: 50%;
	background: #fff;
}

.portfolio-video__time {
	flex: 0 0 auto;
	min-width: 82px;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	line-height: 1;
	white-space: nowrap;
}

.portfolio-video__status {
	position: absolute;
	top: 12px;
	left: 14px;
	z-index: 4;
	margin: 0;
	padding: 5px 8px;
	color: #fff;
	font-size: 12px;
	line-height: 1.2;
	background: rgba(15, 15, 15, 0.58);
}

.portfolio-video-player [hidden] {
	display: none !important;
}

.portfolio-media figcaption {
    margin-top: 8px;
    color: #666;
    font-size: 12px;
    line-height: 1.45;
}

.portfolio-media__empty {
    display: grid;
    min-height: 220px;
    place-items: center;
    background: #eee;
    color: #555;
    font-size: 14px;
}

.project-media--split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.project-media--split .portfolio-media {
    min-width: 0;
}

.portfolio-project-text {
    max-width: 70ch;
    margin: 0 auto;
    font-size: clamp(16px, 1.35vw, 20px);
    line-height: 1.55;
}

.portfolio-project-text a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.portfolio-project-text--heading {
    font-size: clamp(24px, 3vw, 44px);
    line-height: 1.1;
}

.portfolio-project-credits {
    max-width: 70ch;
    margin: 0 auto;
    color: #666;
    font-size: 13px;
    line-height: 1.55;
}

.portfolio-project-credits__title {
    margin: 0 0 12px;
    color: #222;
    font-size: 13px;
    font-weight: 400;
}

.portfolio-project-credits__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.portfolio-project-credits__item {
    margin: 0;
}

/* Editor controls: give each decision a clear vertical rhythm. */
.portfolio-media-full-editor,
.portfolio-media-split-editor {
    container-type: inline-size;
    padding: clamp(12px, 2vw, 20px);
    background: #f4f4f4;
}

.portfolio-media-full-editor .components-placeholder__fieldset,
.portfolio-media-split-editor .components-placeholder__fieldset {
    gap: clamp(12px, 2vw, 20px);
}

.portfolio-media-full-editor .components-placeholder__label,
.portfolio-media-split-editor .components-placeholder__label {
    font-size: 16px;
    line-height: 1.3;
}

.portfolio-media-full-editor .components-placeholder__instructions,
.portfolio-media-split-editor .components-placeholder__instructions {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.4;
}

.portfolio-media-full-editor .portfolio-media-slot {
    width: min(100%, 520px);
}

.portfolio-media-split-editor .components-placeholder__fieldset {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}

.portfolio-media-slot {
    display: flex;
    min-height: 0;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border: 1px dashed #999;
    background: #fff;
}

.portfolio-media-slot + .portfolio-media-slot {
    margin-top: 0;
}

.portfolio-media-slot > strong {
    display: block;
    margin: 0;
    color: #1e1e1e;
    font-size: 13px;
    line-height: 1.35;
}

.portfolio-media-slot .components-base-control {
    width: 100%;
    margin: 0 !important;
}

.portfolio-media-slot .components-base-control__field {
    margin: 0;
}

.portfolio-media-slot .components-base-control__label {
    display: block;
    margin: 0 0 5px;
    color: #383838;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.portfolio-media-slot .components-select-control__input,
.portfolio-media-slot .components-text-control__input {
    min-height: 36px;
}

.portfolio-media-slot > .components-button {
    align-self: flex-start;
    min-height: 38px;
    margin: 0;
}

.portfolio-media-slot > img,
.portfolio-media-slot > video,
.portfolio-media-slot > p {
    margin: 0 !important;
}

.portfolio-media-editor__preview {
    display: block;
    width: 100%;
    max-height: clamp(100px, 18vh, 160px);
    object-fit: contain;
    object-position: left center;
}

.portfolio-media-poster-controls {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-top: 4px;
}

.portfolio-media-poster-controls > strong {
	color: #1e1e1e;
	font-size: 12px;
	line-height: 1.35;
}

.portfolio-media-editor__poster-preview {
	display: block;
	width: 100%;
	max-height: 120px;
	object-fit: contain;
	object-position: left center;
}

.portfolio-media-poster-help {
	margin: 0;
	color: #666;
	font-size: 12px;
	line-height: 1.4;
}

.portfolio-media-editor__selected {
    color: #555;
    font-size: 12px;
}

.wp-block-portfolio-project-text > .components-base-control {
    margin-bottom: 12px;
}

.portfolio-recently-inserted {
    outline: 2px solid #3858e9;
    outline-offset: 4px;
}

@container (max-width: 680px) {
    .portfolio-media-split-editor .components-placeholder__fieldset {
        grid-template-columns: 1fr;
    }

    .portfolio-video__controls {
		flex-wrap: wrap;
        gap: 4px;
        padding-right: 8px;
        padding-left: 8px;
    }

    .portfolio-video__button {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
    }

    .portfolio-video__time {
        min-width: 70px;
        font-size: 11px;
    }

	.portfolio-video__volume {
		flex: 1 1 100px;
	}

	.portfolio-video__volume-range {
		flex: 1 1 auto;
		width: auto;
		min-width: 40px;
	}
}

.wp-block-portfolio-project-text .block-editor-rich-text__editable {
    min-height: 42px;
}

@media (max-width: 767px) {
	.portfolio-video__controls {
		display: flex;
		flex-wrap: nowrap;
		align-items: center;
		gap: 4px;
		min-height: 58px;
		padding: 18px 8px 8px;
	}

	.portfolio-video__controls > .portfolio-video__button,
	.portfolio-video__volume .portfolio-video__button {
		flex: 0 0 32px;
		width: 32px;
		height: 32px;
	}

	.portfolio-video__seek {
		flex: 0 1 clamp(90px, 35vw, 140px);
		width: clamp(90px, 35vw, 140px);
		min-width: 82px;
		max-width: 140px;
	}

	.portfolio-video__time {
		min-width: auto;
		font-size: 10px;
	}

	.portfolio-video__volume {
		position: relative;
		flex: 0 0 32px;
		width: 32px;
		gap: 0;
	}

	.portfolio-video__volume-range {
		display: none;
		position: absolute;
		left: calc(50% - 60px);
		right: auto;
		bottom: calc(100% + 51px);
		z-index: 5;
		width: 120px;
		height: 30px;
		min-width: 0;
		padding: 0 8px;
		border-radius: 999px;
		background: rgba(15, 15, 15, 0.82);
		box-shadow: 0 2px 12px rgba(0, 0, 0, 0.24);
		touch-action: none;
		overscroll-behavior: contain;
		-webkit-user-select: none;
		user-select: none;
		transform: rotate(-90deg);
		transform-origin: center;
	}

	.portfolio-video-player.is-volume-open .portfolio-video__volume-range {
		display: block;
	}

    .project-media--split {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .portfolio-media-full-editor,
    .portfolio-media-split-editor {
        padding: 12px;
    }

    .portfolio-media-split-editor .components-placeholder__fieldset {
        grid-template-columns: 1fr;
    }
}
